query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
sequencelengths
19
20
metadata
dict
Options are the values that are going to be passed as environment variables to the script; Static envs should work as a filter.
function envOptions(path, queries, staticEnv, data) { //Evaluate json queries var env = evalQueries(queries, data) _.merge(env, staticEnv); //static from descriptor _.merge(env, _.omit(process.env, function(value, varName) { if (_.includes(varName, 'npm_')) return true; return false; })); //process environment variables, omitting npm variables return { env: env, cwd: path }; }
[ "_parseOptionsEnv() {\n this.options.forEach((option) => {\n if (option.envVar && option.envVar in process.env) {\n const optionKey = option.attributeName();\n // Priority check. Do not overwrite cli or options from unknown source (client-code).\n if (this.getOptionValue(optionKey) === undefined || ['default', 'config', 'env'].includes(this.getOptionValueSource(optionKey))) {\n if (option.required || option.optional) { // option can take a value\n // keep very simple, optional always takes value\n this.emit(`optionEnv:${option.name()}`, process.env[option.envVar]);\n } else { // boolean\n // keep very simple, only care that envVar defined and not the value\n this.emit(`optionEnv:${option.name()}`);\n }\n }\n }\n });\n }", "function envVarSource(options) {\n return ({}).merge(options);\n}", "async buildEnvVars(options) {\n return process.env;\n }", "function envVar(options) {\n return ({\n name: (options && options.name) || null,\n }).merge(options);\n}", "function getOptionValuesFromOtherEnvVars() {\n const options = {};\n if(process.env.NODE_PENDING_DEPRECATION === '1') {\n options['--pending-deprecation'] = true;\n }\n return options;\n}", "function secretEnvSource(options) {\n return ({}).merge(options);\n}", "setEnvironment(env){\n process.argv.ENVIRONMENT = env;\n }", "function getEnvironmentOptions() {\n\tvar envOptions = defaultOptions;\n\n\tif (/^prod(uction)?$/i.test(process.env.ENV)) {\n\t\tenvOptions.production = true;\n\t\tenvOptions.development = false;\n\t}\n\n\tif (!_.isEmpty(process.env.HOST)) {\n\t\tenvOptions.host = process.env.HOST;\n\t}\n\n\tif (!_.isEmpty(process.env.PORT)) {\n\t\tenvOptions.port = process.env.PORT;\n\t}\n\n\tif (/^true$/i.test(process.env.OPEN)) {\n\t\tenvOptions.open = true;\n\t}\n\n\tif (!_.isEmpty(process.env.API_ENDPOINT)) {\n\t\tenvOptions.apiEndpoint = process.env.API_ENDPOINT;\n\t}\n\n\tif (!_.isEmpty(process.env.SKIP_GIT)) {\n\t\tenvOptions.skipGit = process.env.SKIP_GIT;\n\t}\n\n\treturn envOptions;\n}", "function cli_env(setting, val, appOriginated, setEmpty) {\n return cli.cli('env', setting, val, appOriginated, setEmpty);\n }", "reportEnvVars() {\n this.addSection('Environment');\n const keys = Object.keys(process.env).sort();\n keys.forEach(key => {\n this.add(key, process.env[key]);\n });\n return this;\n }", "function envFromSource(options) {\n return ({}).merge(options);\n}", "processServiceEnv(){\n var serviceDefaults = {\n ID: process.env.SERVICE_ID,\n Name: process.env.SERVICE_NAME,\n Address: process.env.SERVICE_ADDRESS,\n Port: process.env.SERVICE_PORT || -1,\n Tags: process.env.SERVICE_TAGS ? process.env.SERVICE_TAGS.split(',') : [],\n EnableTagOverride: process.env.SERVICE_EnableTagOverride? true: false\n };\n return serviceDefaults;\n }", "function _processOptions() {\n\n /////////////////////////\n // Application options //\n /////////////////////////\n\n // Initialise app\n __App = __options.App;\n\n }", "constructor(options) {\n\t\tif (options && options.cachePeriod !== null) {\n\t\t\tthis.cachePeriod = options.cachePeriod;\n\t\t} else {\n\t\t\t// Default to 1 second cache:\n\t\t\tthis.cachePeriod = 1;\n\t\t}\n\t\t\n\t\tif (options && options.command) {\n\t\t\tthis.command = options.command;\n\t\t} else {\n\t\t\tthis.command = 'env';\n\t\t}\n\t}", "function setOptions( env ) {\n\n\t\tcookieModule.setCookie( 'env-settings', env, 90 );\n\n\t}", "function options() {\n // The only option that needs parsing is the parallelism flag. Ignore any failures.\n let parallel;\n const parallelOpt = process.env[nodeEnvKeys.parallel];\n if (parallelOpt) {\n try {\n parallel = parseInt(parallelOpt, 10);\n }\n catch (err) {\n // ignore.\n }\n }\n // Now just hydrate the rest from environment variables. These might be missing, in which case\n // we will fail later on when we actually need to create an RPC connection back to the engine.\n return {\n // node runtime\n project: process.env[nodeEnvKeys.project],\n stack: process.env[nodeEnvKeys.stack],\n dryRun: (process.env[nodeEnvKeys.dryRun] === \"true\"),\n queryMode: (process.env[nodeEnvKeys.queryMode] === \"true\"),\n parallel: parallel,\n monitorAddr: process.env[nodeEnvKeys.monitorAddr],\n engineAddr: process.env[nodeEnvKeys.engineAddr],\n syncDir: process.env[nodeEnvKeys.syncDir],\n cacheDynamicProviders: process.env[nodeEnvKeys.cacheDynamicProviders] !== \"false\",\n // pulumi specific\n testModeEnabled: (process.env[pulumiEnvKeys.testMode] === \"true\"),\n legacyApply: (process.env[pulumiEnvKeys.legacyApply] === \"true\"),\n };\n}", "function cli_env(setting, val, appOriginated, setEmpty) {\n return cli.cli('env', setting, val, appOriginated, setEmpty);\n }", "loadEnvVarsForLocal() {\n const defaultEnvVars = {\n IS_LOCAL: 'true',\n };\n\n _.merge(process.env, defaultEnvVars);\n\n // in some circumstances, setting these provider-independent environment variables is not enough\n // eg. in case of local 'docker' invocation, which relies on this module,\n // these provider-independent environment variables have to be propagated to the container\n this.serverless.service.provider.environment =\n this.serverless.service.provider.environment || {};\n const providerEnv = this.serverless.service.provider.environment;\n for (const [envVariableKey, envVariableValue] of Object.entries(defaultEnvVars)) {\n if (!Object.prototype.hasOwnProperty.call(providerEnv, envVariableKey)) {\n providerEnv[envVariableKey] = envVariableValue;\n }\n }\n\n // Turn zero or more --env options into an array\n // ...then split --env NAME=value and put into process.env.\n [].concat(this.options.env || []).forEach((itm) => {\n const splitItm = itm.split(/=(.+)/);\n process.env[splitItm[0]] = splitItm[1] || '';\n });\n }", "function buildOptions (argv) {\n const optionsMask = 'name,migrationsDirectory,relativeTo,migrationsTable,host,port,db,user,username,password,authKey,driver,discovery,pool,cursor,servers,ssl,i,ignoreTimestamp,to,extension'\n const envVars = Mask(process.env, optionsMask)\n const file = Mask(readOptionsFile(argv), optionsMask)\n const args = Mask(argv, optionsMask)\n\n // normalize the -i / --ignore-timestamp option to result to ignoreTimestamp option\n // for arguments input schema validation\n if (args.hasOwnProperty('i')) {\n delete args.i\n args.ignoreTimestamp = true\n }\n\n return Object.assign({}, envVars, file, args)\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
will iterate through the global codeObj JSON object and when done, run itself again after a delay
function iterateCodeObj() { var lastFadeId; var tDelay = 0; for(key in codeObj) { tDelay += delayArrIteration(codeObj[key], tDelay); var fadeDelay = tDelay + 4000; lastFadeId = setTimeout(codeContainerChildrenFade, fadeDelay); fadingTimeoutIds.push(lastFadeId); } clearTimeout(lastFadeId); lastFadeId = setTimeout(codeContainerChildrenFade, tDelay - lastDelay + 4000); fadingTimeoutIds.push(lastFadeId); iterateCodeObjTimeoutId = setTimeout(iterateCodeObj, tDelay - lastDelay + 6000); firstTime = true; }
[ "function geoCodeLoop(geoCodeArray, geocoder, data, geoCodeIndex, iterations) {\n for (i = 0; i < iterations; i++) {\n geoCodeIndex--;\n //Find the mural ID in the geoCodeArray by selecting it by it's index\n var muralID = geoCodeArray[geoCodeIndex];\n //decriment geoCodeIndex to count it as a pass and to go to the next mural in the next iteration\n //Get the address from the data of the corresponding muralID\n var address = data[muralID].location + ', Baltimore MD'\n //Geocode with Google maps API geocoding service\n geoCodeAddress(geocoder, markers[geoCodeArray[geoCodeIndex]], address, geoCodeArray, geoCodeIndex);\n }\n //check if .toBeGeocoded has changed and update view if it has\n viewModel.locations.valueHasMutated();\n //If there are at least 10 murals left, recursively call the function after 10 seconds\n if (geoCodeIndex > 10) {\n setTimeout(function() {\n geoCodeLoop(geoCodeArray, geocoder, data, geoCodeIndex, 10);\n }, 10000)\n //If there are less than 10 murals left, either code the remaining murals or don't call the function again\n } else if (geoCodeIndex < 10) {\n if (geoCodeIndex > 0) {\n var finalTimeOut = geoCodeIndex * 1000;\n setTimeout(function() {\n geoCodeLoop(geoCodeArray, geocoder, data, geoCodeIndex, geoCodeIndex);\n }, finalTimeOut);\n } else if (geoCodeIndex <= 0) {\n //check if .toBeGeocoded has changed and update view if it has after waiting 1 second so geocode calls return \n setTimeout(function() {\n viewModel.locations.valueHasMutated();\n console.log(\"Geocoding complete\");\n }, 1000);\n }\n }\n}", "function delayedGenerateCode(){\n\tif ( timerId !== 0 ) {\n\t\tclearTimeout(timerId);\n\t}\n\ttimerId = setTimeout(generateCode, 500);\n}", "function startReplacing() {\n if (wordsJson != null && wordsJson != undefined) {\n var words = wordsJson[wordsMainGroup];\n console.log(wordsMainGroup);\n\n for (var key in words) {\n if (words.hasOwnProperty(key)) {\n // Start pasing\n parsingData(words, key);\n }\n }\n\n console.info('[EasyPage] End. All data has been success replaced.');\n }\n }", "function runContentLoop(){\n angular.forEach(vm.graphObject.content, function(value, key) {\n //console.log(key + ': ' + value.type);\n currentGraphObject = key;\n cb(vm.board, value.type);\n });\n }", "function run() {\n\t\tif (done) { restart(); return; }\n\t\trunFlag = true;\n\t\twhile(!done) walk();\n\t\trunFlag = false;\n\t\teditor.selectNextLine(14);\n\t\tupdateVarBox();\n\t}", "loop() {\n if (this.isLoadingEnded()) {\n this.toExec();\n }\n else {\n setTimeout(()=>this.loop(),ScriptLoader.LOOP_INTERVAL);\n }\n }", "function controlLoopFast(){\r\n\trefreshDataFast();\r\n\tsetTimeout(controlLoopFast,200);\r\n}", "function runCode() {\n // Create a client using the public API key\n var apigClient = apigClientFactory.newClient({\n apiKey: HELLO_API_KEY\n });\n \n if (display)\n display.destroy();\n display = null;\n // Set up a bootstrap modal to display the output of the run\n $('#outputContainer').empty();\n $('#outputContainer').html(\"<pre id=\\\"output\\\">Please wait...</pre>\");\n \n $('#outputModalTitle').text('Running...');\n $('#output').show();\n $('#exTime').html('Execution time: ___ ms');\n $('#testOutputSelector').hide();\n $('#outputModal').modal('show');\n \n // Prepare the output display as a read-only editor\n setupDisplay('output');\n \n // Get the main class's actual name..\n // drop the .java extension\n var mainName = FileManager.getMainFile().name.replace(/\\.[^/.]+$/, \"\");\n // Get the file's package name\n var pkgReg = /package\\s+([\\w\\.]+)\\s*;/;\n var packageName = pkgReg.exec(FileManager.getMainFile().contents);\n // Add the package name to the class's name\n if (packageName !== null && packageName.length >= 2) {\n mainName = packageName[1] + \".\" + mainName;\n }\n \n // Add the derived classname to the compiling message\n $('#outputModalTitle').text('Compiling and running ' + mainName + '...');\n \n // Prepare the request to run the code\n // Set up the request body for a compile-run request\n var body = {\n version: 1,\n compile: {\n version: 1,\n mainClass: mainName,\n sourceFiles: []\n },\n data: {\n version: 1,\n dataFiles: []\n },\n \"test-type\": \"run\"\n };\n \n var root = FileManager.getRootFolder();\n // Add the files in the global file manager to the request body.\n addAllSourceFiles(root, body.compile.sourceFiles);\n \n // Add data files to the request\n addAllDataFiles(root, body.data.dataFiles);\n \n // Add parameters for the request\n var params = {\n \"Content-Type\": \"application/json\",\n \"Accept\": \"application/json\"\n };\n \n var additionalParams = {};\n \n // Record the current time to calculate how long the request takes\n var start = new Date().getTime();\n var timer = displayElapsedTime($('#exTime'), start);\n $('#outputModal').on('hide.bs.modal', function(e) {\n clearInterval(timer);\n });\n \n // Make the compile-run request\n apigClient.helloFunctionPost(params, body, additionalParams)\n // Show the result of the request\n .then(function(result) {\n showSucceeded(result, display, timer, start, \"Execution\");\n }).catch(function(result){\n showFailed(result, display, timer, start);\n });\n}", "function defineInt() {\n // DONE\n setInterval(fetchJson, 10000);\n}", "async function traverse(jsonObj){\n var j = 0;\n for (i in jsonObj){\n link = jsonObj[i]['link'];\n dir = i;\n \n console.log(\"Gathering state level data for\", dir, \"... \");\n if ((j + 1) % 2 == 0) {await scrapBLS_GS(link, dir); scrapBLS_GS(link, dir, 1);}\n else {scrapBLS_GS(link, dir); scrapBLS_GS(link, dir, 1);}\n //scrapBLS_GS(link, dir);\n //break;\n j++;\n }\n\n}", "function timedCallback(data){\n currentTime = new Date();\n for (const key in data) {\n if (data.hasOwnProperty(key)) {\n let e = data[key];\n for (let i = 0; i < e.length; i++) {\n const timeCommand = e[i];\n let commandTime = timeCommand.time;\n \n if(commandTime> 10){\n console.log(\"Loaded timed commaned: %s \", JSON.stringify(timeCommand));\n setTimeout(postTimedCommand,commandTime*60,timeCommand.message); \n }\n }\n }\n } \n}", "resetCodeLoop() {\n this.app.code = this.sceneEditor.getValue();\n this.tracksCode = this.tracksEditor.getValue();\n this.app.emit('app:codeUpdate', {\n tracks: this.tracksCode\n });\n }", "asynchRepeat(body, ok, fail, tag, delay, maxdelay) {\nvar closedARFun, n;\n//-----------\nn = 0;\nclosedARFun = function() {\nbody();\nif (ok()) {\nif (tag) {\nreturn typeof lggr.trace === \"function\" ? lggr.trace(`SToCAObj: ${tag} completed delay=${n}`) : void 0;\n}\n} else {\nn += delay;\nif (n < maxdelay) {\nreturn setTimeout(closedARFun, delay);\n} else {\nif (typeof lggr.trace === \"function\") {\nlggr.trace(`SToCAObj: ${tag} abandoned delay=${n}`);\n}\nreturn fail();\n}\n}\n};\nreturn closedARFun();\n}", "function advanceToNextJson() {\n global.cacheIndex ++;\n\n console.log(`Advanced cache index to: ${global.cacheIndex}.`);\n if(global.cacheIndex >= global.cacheTotal) {\n finalizeCaching();\n return;\n }\n\n console.log(`${global.cacheTotal - global.cacheIndex} Json file(s) remaining.`);\n downloadJson();\n}", "fetchCodes(iteration=iterationCurrent) {\n if (this.fetchInProgress || !this.signedIn) {\n return\n }\n\n if (this.lastFetch && this.lastFetch.getTime() + this.backoff > new Date().getTime()) {\n // slow down spammy requests\n return\n }\n this.lastFetch = new Date()\n\n this.fetchInProgress=true\n\n let successFunc= iteration == iterationCurrent ? this.updateCodes : this.updatePreFetch\n if (iteration == iterationCurrent && this.preFetch !== null) {\n successFunc(this.preFetch)\n this.fetchInProgress = false\n return\n }\n\n axios.get(`codes.json?it=${iteration}`)\n .then(resp => {\n successFunc(resp.data)\n this.backoff = 500 // Reset backoff to 500ms\n })\n .catch(err => {\n this.backoff = this.backoff * 1.5 > 30000 ? 30000 : this.backoff * 1.5\n\n if (err.response && err.response.status) {\n switch (err.response.status) {\n case 401:\n this.createAlert('danger', 'Logged out...', 'Server has no valid token for you: You need to re-login.')\n this.signedIn = false\n this.otpItems = []\n break\n\n case 500:\n this.createAlert('danger', 'Oops.', `Something went wrong when fetching your codes, will try again in ${Math.round(this.backoff / 1000)}s...`, this.backoff)\n break;\n }\n } else {\n console.error(err)\n this.createAlert('danger', 'Oops.', `The request went wrong, will try again in ${Math.round(this.backoff / 1000)}s...`, this.backoff)\n }\n\n if (iteration === iterationCurrent) {\n this.otpItems = []\n this.loading = true\n }\n })\n .finally(() => { this.fetchInProgress=false })\n }", "function ani_loop2 () {\n var q = d3.queue();\n if (graph_num == head) {\n q.defer(d3.json, \"/graph/\" + userfile + \"/\" + userfile + \"_graph_\" + graph_num + \".js\");\n }\n if (unit == 5) {\n q.defer(d3.json, \"/graph/\" + userfile + \"/\" + userfile + \"_graph_\" + (graph_num + 1) + \".js\");\n } else {\n q.defer(d3.json, \"/graph/\" + userfile + \"/\" + userfile + \"_graph_\" + (graph_num + 10) + \".js\"); // load future graph\n }\n\tq.awaitAll(afterLoadJson);\n}", "function main_update_loop() {\n refresh_vehicle_locations(function() {\n setTimeout(main_update_loop, 10000);\n });\n}", "function inception(loop){\r\n for (var i = 0; i < loop; i++){\r\n run();\r\n }\r\n}", "static run( jsenCode ) {\n const threadContext = {\n code: jsenCode,\n pc: 0,\n labelList: {\n blockBegin: 0,\n blockEnd: jsenCode.length,\n },\n };\n JZENVM._runContext( threadContext );\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the source of the recipe by making another API call using the id fetched from getRecipe() The function was from the tutorial but we'll still want to use it, probably.
function getSource(id){ $.ajax({ url:"https://api.spoonacular.com/recipes/"+id+"/information?apiKey=99a01e3d7525405894929bfbec77ffa3", success: function(res) { document.getElementById("sourceLink").innerHTML=res.sourceUrl document.getElementById("sourceLink").href=res.sourceUrl } }); }
[ "static async getRecipeById(id) {\n\t\tconst res = await this.request(`recipe/${id}`);\n\t\treturn res.recipe;\n\t}", "static async getRecipe(id) {\n let res = await this.request(`recipes/${id}`);\n return res;\n }", "async function getSingleRecipe(recipeId) {\r\n let singleRecipe = await fetch(`https://forkify-api.herokuapp.com/api/get?rId=${recipeId}`),\r\n singleRecipeData = await singleRecipe.json();\r\n singleRecipeDataContent = singleRecipeData.recipe;\r\n displaySingleRecipe();\r\n}", "function getSingleRecipe(recipeId) {\n const queryString = `/recipes/${recipeId}`;\n const init = {\n method: 'GET'\n }\n fetch(queryString, init)\n .then(response => {\n if (response.ok) {\n return response.json();\n }\n throw new Error(response.statusText);\n })\n .then(responseJson => {\n renderSingleRecipe(responseJson, '.single-recipe-container');\n })\n .catch(err => {\n console.log(`Something went wrong: ${err.message}`);\n });\n}", "function getSpecificRecipeURL(recipeId){\n var url = \"http://food2fork.com/api/get?key=0e799db0a42173dfbfd14aad4560b1bc\";\n url += \"&rId=\" + recipeId;\n return url;\n}", "function getRecipeInfoById(id) {\n\n // Note how we sepecified the ID in our endpoint!\n fetch(`https://api.spoonacular.com/recipes/${id}/information?apiKey=${key}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json'\n }\n }).then(response => response.json()) // The response here is information on one recipe. We convert it to JSON again...\n .then(response => renderRecipe(response)); // And pass in the information to a helper function...\n}", "loadRecipeEntry (recipeID) {\n\t\treturn Api().get(`/recipes/${recipeID}`);\n\t}", "function getRecipeById(id) {\n const apiUrl = new URL('https://www.themealdb.com/api/json/v1/1/lookup.php');\n // Add id (i) param\n const idKey = 'i'\n apiUrl.searchParams.set(idKey, id);\n\n return fetch(apiUrl)\n .then(response => {\n return response.json();\n });\n}", "getSingleRecipe(recipeId) {\n let deferred = this.$q.defer();\n\n let httpReturn = this.$http({\n url: API_CONST.URL_DEV + API_CONST.URL_RECIPES_SINGLE + recipeId,\n method: 'GET'\n });\n\n deferred.resolve(httpReturn);\n return deferred.promise;\n }", "function getRecipe(recipeID) {\n // API URL\n var queryURL = \"https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/\" + recipeID + \"/information\";\n\n $.ajax({\n url: queryURL,\n method: \"GET\",\n beforeSend: function (xhr) {\n xhr.setRequestHeader(\"X-Mashape-Authorization\", \"Jn8goME99rmshWQrcQDNuZ9e7TN8p1FXY71jsnp6yW4jmAtQuu\");\n }\n }).done(function (recipe) {\n // test to see if we get coking instructions\n if (recipe.instructions) {\n // console.log(recipe);\n var recipeIngredients = [];\n for (var i = 0; i < recipe.extendedIngredients.length; i++) {\n recipeIngredients.push(recipe.extendedIngredients[i]);\n }\n // call to create missing items\n compareIngredients(recipeIngredients);\n // display recipe card\n layoutRecipeCard(recipe);\n // if we going to the shopping cart check the trigger if true\n if (shoppingCartTrigger) {\n shoppingCartTrigger = false;\n $(\"#selected\").hide()\n layoutShoppingCard(recipe);\n }\n }\n });\n }", "function getRecipeById(id) {\n return jsonObjects[id];\n}", "async function getRecipeDetails(id) {\n let apiResponse = await fetch(`https://forkify-api.herokuapp.com/api/get?rId=${id}`);\n details = await apiResponse.json();\n details = details.recipe;\n displayRecipeDetails();\n}", "async getRecipeByID(state, id) {\n const config = {\n method: 'get',\n url: `${store.getState().baseURL}/recipes/${id}`,\n };\n\n await axios(config)\n .then((response) => {\n store.setState({\n recipeDetails: response.data.data.recipeDetails,\n });\n store.setState({ recipeSteps: response.data.data.recipeSteps });\n store.setState({ recipe: response.data.data.recipe });\n store.setState({ recipeCreator: response.data.data.user });\n })\n .catch((error) => {\n store.setState({ recipe: false });\n });\n }", "function getRecipeInstructions(recipeId, image_src, recipeName) {\n\n var queryURL = \"https://api.spoonacular.com/recipes/\" + recipeId + \"/analyzedInstructions?apiKey=3d8504ff72124b3790e1881e4619a59c\";\n // console.log(recipeId);\n\n $.ajax({\n url: queryURL,\n method: \"GET\"\n }).then(function (response) {\n console.log(response);\n // console.log(response[0].steps[0].number);\n // console.log(response[0].steps[0].step);\n console.log(response[0].steps[0].ingredients);\n\n var currentIngredients = response[0].steps[0].ingredients;\n $(\".recipe-ingredients\").html(\"\");\n for (var i=0; i<currentIngredients.length; i++) {\n $(\".recipe-ingredients\").append(\"<li>\" + currentIngredients[i].name + \"</li>\");\n $(\".recipe-ingredients\").val().toUpperCase();\n }\n\n // Add cooking instructions to the recipe modal.\n var stepsInstructions = response[0].steps;\n $(\".recipe-step\").html(\"\");\n for (j=0; j<stepsInstructions.length; j++) {\n $(\".recipe-step\").append(\"<p>\" +\n stepsInstructions[j].number + \". \" +\n stepsInstructions[j].step + \"</p>\");\n } // End of AJAX call for recipeId\n\n });\n}", "function findAndCloneRecipeById(recipeId) {\n\t// TODO: Do not repeat code for fetching recipe from Yummly API. Use a helper\n\t$.get(\"/apiInfo\").done(function (res) {\n\t\t// var APP_ID = res.id;\n\t\t// var APP_KEY = res.key;\n\t\t$.get(yummlyApiEndpoint + \"recipe/\" + recipeId + \"?\", {\n\t\t\t\t_app_id: APP_ID,\n\t\t\t\t_app_key: APP_KEY \n\t\t\t}).done(function(res) {\n\t\t\t\tvar recipeInfo = stripYummlyResponseData(res);\n\t\t\t\t$.post('/recipes/', recipeInfo);\n\t\t\t});\n\t})\n\t\n}", "async function previewRecipeById(parm){\n try{\n let recipeInfo =[];\n recipeInfo.push(await axios.get(`${recipes_api_url}/${parm.id}/information?${api_key}`));\n \n recipesData=extractRelevantRecipeData(recipeInfo);\n return recipesData;\n } catch (error) {\n throw { status: 404, message: `A recipe with the id ${parm.id} does not exist.` };\n }\n}", "function findRecipe(recipeId) {\n results = config.results\n recipes = results.recipes.concat(results.ingredients, results.myRecipe)\n\n for (let recipe of recipes) {\n if ('recipe-' + recipe.id === recipeId) {\n return recipe\n }\n }\n\n console.log('ERROR: found unknown recipe with id: ' + recipeId)\n return {}\n}", "function fetchSource(id) {\n const request = lookup('service:request');\n return request.promiseRequest({\n modelName: 'source',\n method: 'fetchSource',\n query: { data: id }\n });\n}", "function getRecipeData(id, type) {\n var queryUrl;\n switch (type) {\n case \"recipe\":\n queryUrl = \"/api/recipes/\" + id;\n break;\n case \"author\":\n queryUrl = \"/api/authors/\" + id;\n break;\n default:\n return;\n }\n $.get(queryUrl, function(data) {\n if (data) {\n console.log(data.AuthorId || data.id);\n // If this recipe exists, prefill our add-recipe forms with its data\n titleInput.val(data.title);\n ingredientsInput.val(data.ingredients);\n preparationInput.val(data.preparation);\n image_linkInput.val(data.image_link); \n servingsInput.val(data.servings); \n authorId = data.AuthorId || data.id;\n // If we have a recipe with this id, set a flag for us to know to update the recipe\n // when we hit submit\n updating = true;\n }\n });\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Action creator for showing link context.
function showLinkContext() { return function(dispatch, getState) { var state = getState(); var selectedContacts = state.outlook.pages[state.outlook.page].filter(function(e) { return e.selected; }); if (selectedContacts.length === 0) { dispatch(showAlert(resources_1.default.getString('MailApp_Module_Select_Link_Alert'))); return; } dispatch({ type: actionTypes_1.default.SHOW_LINK_CONTEXT }); dispatch(loadAccounts()); }; }
[ "function hideLinkContext() {\n return function(dispatch) {\n dispatch({ type: actionTypes_1.default.HIDE_LINK_CONTEXT });\n };\n }", "function linkToAction(showLink, action, text) {\n if (!showLink) {\n return text;\n }\n return \"<a href='javascript:eng.ProcessAction(&quot;\" + action + \"&quot;);'>\"\n + text + \"</a>\";\n}", "function showUIActionContext(event) {\n if (!g_user.hasRole(\"ui_action_admin\"))\n return;\n var element = Event.element(event);\n if (element.tagName.toLowerCase() == \"span\")\n element = element.parentNode;\n var id = element.getAttribute(\"gsft_id\");\n var mcm = new GwtContextMenu('context_menu_action_' + id);\n mcm.clear();\n mcm.addURL(getMessage('Edit UI Action'), \"sys_ui_action.do?sys_id=\" + id, \"gsft_main\");\n contextShow(event, mcm.getID(), 500, 0, 0);\n Event.stop(event);\n}", "function showUIActionContext(event) {\n if (!g_user.hasRole(\"ui_action_admin\"))\n return;\n var element = Event.element(event);\n if (element.tagName.toLowerCase() == \"span\")\n element = element.parentNode;\n var id = element.getAttribute(\"gsft_id\");\n var mcm = new GwtContextMenu('context_menu_action_' + id);\n mcm.clear();\n mcm.addURL(getMessage('Edit UI Action'), \"sys_ui_action.do?sys_id=\" + id, \"gsft_main\");\n contextShow(event, mcm.getID(), 500, 0, 0);\n Event.stop(event);\n}", "function context_menu_clicked(obj) {\n if (DEBUG) {\n console.log(\"LL: context_menu_clicked(obj) called\\ndump of obj:\");\n debug_dump(obj);\n }\n if (obj.menuItemId == MENU_ITEM_ID) {\n if (current_link) store_link(current_link);\n }\n}", "displayLink() {\n if (this.context.getSelectedImageConfig() === null) return;\n let callback = ((settings) => {\n let url =\n Misc.assembleImageLink(\n this.context.server,\n this.image_info.image_id,\n settings);\n // show link and register close button\n $('.link-url button').blur();\n let linkDiv = $('.link-url div');\n let linkInput = linkDiv.children('input').get(0);\n linkInput.value = url;\n linkDiv.show();\n linkInput.focus();\n if (linkInput && linkInput.setSelectionRange)\n linkInput.setSelectionRange(0, linkInput.value.length);\n $('.link-url img').on(\"click\",\n () => {linkDiv.hide(); $('.link-url img').off(\"click\")});\n linkDiv.show();\n });\n\n // fetch settings and execute callback once we have them\n this.context.publish(\n VIEWER_IMAGE_SETTINGS,\n {config_id : this.context.selected_config,\n callback :callback});\n }", "function showContext() {\n addLoader();\n // send API request\n smxProxy.sendRequest(\"get-context\", null, \"onContext\");\n}", "displayLink() {\n var url;\n if (this.props.activity.desttype === \"Communities\") {\n url = \"/\" + this.props.activity.community.url;\n return <a href={url}>\n {this.props.activity.community.name}\n </a>;\n }\n else if (this.props.activity.desttype === \"Projects\") {\n url = \"/project/\" + this.props.activity.project.url;\n return <a href={url}>{this.props.activity.project.title}</a>;\n }\n else if (this.props.activity.desttype === \"Tasks\") {\n return this.props.activity.task.title;\n }\n else if (this.props.activity.desttype === \"Orgs\") {\n url = \"/org/\" + this.props.activity.org._id;\n return <a href={url}>{this.props.activity.org.name}</a>;\n }\n }", "clickListener(e) {\n e.preventDefault();\n e.stopPropagation();\n if (this.toggle)\n document.querySelector('body').classList.toggle('showcontext');\n else if (this.show)\n document.querySelector('body').classList.add('showcontext');\n const el = document.querySelector(this.target);\n if (!el) {\n console.warn(\"Did not find target element: \", this.target);\n return;\n }\n\n if (this.href) {\n el.contextdata = this.context;\n if (el.contenturl)\n el.contenturl = this.href;\n else\n el.url = this.href;\n } else if (this.home) {\n el.home();\n } else if (this.reload) {\n el.reload();\n }\n }", "function viewArticleLink(id, promo, form) {\n\n return function () {\n form.action = \"default.asp\";\n addHiddenElementToForm(form, \"doWork::WScontent::loadArticle\", \"Load\");\n addHiddenElementToForm(form, \"BOparam::WScontent::loadArticle::article_id\", id);\n if (promo) {\n addHiddenElementToForm(form, \"BOparam::WScontent::loadArticle::promocode_access_code_url\", promo);\n }\n form.submit();\n };\n}", "enterLinkExp(ctx) {\n\t}", "function linkToTreeView() {\n var answer = null;\n if ($scope.contextId) {\n var node = null;\n var tab = null;\n if ($scope.endpointPath) {\n tab = \"browseEndpoint\";\n node = workspace.findMBeanWithProperties(Camel.jmxDomain, {\n context: $scope.contextId,\n type: \"endpoints\",\n name: $scope.endpointPath\n });\n }\n else if ($scope.routeId) {\n tab = \"routes\";\n node = workspace.findMBeanWithProperties(Camel.jmxDomain, {\n context: $scope.contextId,\n type: \"routes\",\n name: $scope.routeId\n });\n }\n var key = node ? node[\"key\"] : null;\n if (key && tab) {\n answer = \"#/camel/\" + tab + \"?tab=camel&nid=\" + key;\n }\n }\n return answer;\n }", "function egwActionLink(_manager)\n{\n\tthis.enabled = true;\n\tthis.visible = true;\n\tthis.actionId = \"\";\n\tthis.actionObj = null;\n\tthis.manager = _manager;\n}", "function onContextMenuClicked(info) {\n console.log(\"Context menu button clicked.\", info);\n getShareServiceFromStorage({fullKey: info.menuItemId}, function(service) {\n service.sendShareMessage({url: info.linkUrl});\n });\n}", "showShareableLink() {\n let copyAction;\n let closeAction;\n let messageObj;\n const link = this.getSharableLink();\n\n copyAction = new Action('copy.sharablelink.action', 'Kopieren', null, true, () => {\n const succeeded = copyText(null, link);\n if (succeeded) {\n copyAction.setLabel('Kopiert');\n } else {\n this.showMessage(Severity.Warning, 'Link konnte nicht automatisch in die Zwischenablage kopiert werden. Bitte manuell markieren und kopieren.');\n }\n });\n\n closeAction = new Action('close.sharablelink.action', 'Schließen', null, true, () => {\n this.messageList.hideMessage(messageObj);\n });\n\n // Create message instance\n messageObj = new MessageWithAction(`Ihr Link: ${link}`, [copyAction, closeAction]);\n\n // Show it\n this.showMessage(Severity.Info, messageObj);\n }", "LinkProvider(args, prefix, { this: , isRequester: , false: , this: , command: , \"link\": , this: , isResponder: , true: , this: , defaultNodes, let, nodes: { [key]: string } }) { }", "getLink() {\n\t\t\tif (cur.module === \"profile\") {\n\t\t\t\treturn CONTEXT.getUserLink();\n\t\t\t} else {\n\t\t\t\tconst altItem = CONTEXT.getCurrentAltItem();\n\n\t\t\t\tif (altItem != null) {\n\t\t\t\t\treturn CONTEXT.getCurrentAltLink(altItem);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn CONTEXT.getPageLink();\n\t\t}", "function viewAction(event) {\n console.log(\"View item\");\n \n // TODO: add logic to view an item, make the param the id of the node that triggered the event\n}", "enterLink_name(ctx) {\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a matrix of 2N3 equations based on the method of joints, and solves it
function methodOfJoints(){ var force_matrix=[]; //each row will represent an Fx and Fy equation for each node var solution=[]; //this will represent the external forces in the x and y direction acting on the node for(var i=0;i<E.nodes.length;i++){ //iterate through all of the nodes that exist var rowX=[]; //will represent the Fx equation for the node var rowY=[]; //will represent the Fy equation for the node solution.push(-E.nodes[i].external_force[0]); //the external forces in the x direction of the node solution.push(-E.nodes[i].external_force[1]); //the external forces in the y direction o fthe noe for(var j=0;j<E.members.length;j++){ //iterate through all of the members that exist E.members[j].calcLength(); E.members[j].calcUnitVector(); var connected=false; //check if the member is connected to the node for(var k=0;k<E.nodes[i].connected_members.length;k++){ if(E.members[j]===E.nodes[i].connected_members[k]){ //if the member is connected to the node if(E.nodes[i].connected_members[k].x1===E.nodes[i].left && E.nodes[i].connected_members[k].y1===E.nodes[i].top){ //if the start of the member is connected to the node rowX.push(E.nodes[i].connected_members[k].unit_vector[0]); rowY.push(-1*E.nodes[i].connected_members[k].unit_vector[1]); } else{ //if the end of the member is at the node, flip the direction so all forces are tensile rowX.push(-1*E.nodes[i].connected_members[k].unit_vector[0]); rowY.push(E.nodes[i].connected_members[k].unit_vector[1]); } connected=true; } } if(!connected){ //if the member is not connected to the node, then its not part of its Force equations rowX.push(0); rowY.push(0); } } force_matrix.push(rowX); force_matrix.push(rowY); } //eliminating last 3 equation since we have 2N equations and have 2N-3 members, thus we have 3 extra equations force_matrix.pop(); force_matrix.pop(); force_matrix.pop(); solution.pop(); solution.pop(); solution.pop(); var forces=numeric.solve(force_matrix, solution, false); //solving for the forces //applying the force value to the specified member for(i=0;i<E.members.length;i++){ E.members[i].setForce(forces[i],E); } }
[ "function Translational3Constraint(joint, limitMotor1, limitMotor2, limitMotor3) {\n\n this.m1 = NaN;\n this.m2 = NaN;\n this.i1e00 = NaN;\n this.i1e01 = NaN;\n this.i1e02 = NaN;\n this.i1e10 = NaN;\n this.i1e11 = NaN;\n this.i1e12 = NaN;\n this.i1e20 = NaN;\n this.i1e21 = NaN;\n this.i1e22 = NaN;\n this.i2e00 = NaN;\n this.i2e01 = NaN;\n this.i2e02 = NaN;\n this.i2e10 = NaN;\n this.i2e11 = NaN;\n this.i2e12 = NaN;\n this.i2e20 = NaN;\n this.i2e21 = NaN;\n this.i2e22 = NaN;\n this.ax1 = NaN;\n this.ay1 = NaN;\n this.az1 = NaN;\n this.ax2 = NaN;\n this.ay2 = NaN;\n this.az2 = NaN;\n this.ax3 = NaN;\n this.ay3 = NaN;\n this.az3 = NaN;\n this.r1x = NaN;\n this.r1y = NaN;\n this.r1z = NaN;\n this.r2x = NaN;\n this.r2y = NaN;\n this.r2z = NaN;\n this.t1x1 = NaN; // jacobians\n this.t1y1 = NaN;\n this.t1z1 = NaN;\n this.t2x1 = NaN;\n this.t2y1 = NaN;\n this.t2z1 = NaN;\n this.l1x1 = NaN;\n this.l1y1 = NaN;\n this.l1z1 = NaN;\n this.l2x1 = NaN;\n this.l2y1 = NaN;\n this.l2z1 = NaN;\n this.a1x1 = NaN;\n this.a1y1 = NaN;\n this.a1z1 = NaN;\n this.a2x1 = NaN;\n this.a2y1 = NaN;\n this.a2z1 = NaN;\n this.t1x2 = NaN;\n this.t1y2 = NaN;\n this.t1z2 = NaN;\n this.t2x2 = NaN;\n this.t2y2 = NaN;\n this.t2z2 = NaN;\n this.l1x2 = NaN;\n this.l1y2 = NaN;\n this.l1z2 = NaN;\n this.l2x2 = NaN;\n this.l2y2 = NaN;\n this.l2z2 = NaN;\n this.a1x2 = NaN;\n this.a1y2 = NaN;\n this.a1z2 = NaN;\n this.a2x2 = NaN;\n this.a2y2 = NaN;\n this.a2z2 = NaN;\n this.t1x3 = NaN;\n this.t1y3 = NaN;\n this.t1z3 = NaN;\n this.t2x3 = NaN;\n this.t2y3 = NaN;\n this.t2z3 = NaN;\n this.l1x3 = NaN;\n this.l1y3 = NaN;\n this.l1z3 = NaN;\n this.l2x3 = NaN;\n this.l2y3 = NaN;\n this.l2z3 = NaN;\n this.a1x3 = NaN;\n this.a1y3 = NaN;\n this.a1z3 = NaN;\n this.a2x3 = NaN;\n this.a2y3 = NaN;\n this.a2z3 = NaN;\n this.lowerLimit1 = NaN;\n this.upperLimit1 = NaN;\n this.limitVelocity1 = NaN;\n this.limitState1 = 0; // -1: at lower, 0: locked, 1: at upper, 2: unlimited\n this.enableMotor1 = false;\n this.motorSpeed1 = NaN;\n this.maxMotorForce1 = NaN;\n this.maxMotorImpulse1 = NaN;\n this.lowerLimit2 = NaN;\n this.upperLimit2 = NaN;\n this.limitVelocity2 = NaN;\n this.limitState2 = 0; // -1: at lower, 0: locked, 1: at upper, 2: unlimited\n this.enableMotor2 = false;\n this.motorSpeed2 = NaN;\n this.maxMotorForce2 = NaN;\n this.maxMotorImpulse2 = NaN;\n this.lowerLimit3 = NaN;\n this.upperLimit3 = NaN;\n this.limitVelocity3 = NaN;\n this.limitState3 = 0; // -1: at lower, 0: locked, 1: at upper, 2: unlimited\n this.enableMotor3 = false;\n this.motorSpeed3 = NaN;\n this.maxMotorForce3 = NaN;\n this.maxMotorImpulse3 = NaN;\n this.k00 = NaN; // K = J*M*JT\n this.k01 = NaN;\n this.k02 = NaN;\n this.k10 = NaN;\n this.k11 = NaN;\n this.k12 = NaN;\n this.k20 = NaN;\n this.k21 = NaN;\n this.k22 = NaN;\n this.kv00 = NaN; // diagonals without CFMs\n this.kv11 = NaN;\n this.kv22 = NaN;\n this.dv00 = NaN; // ...inverted\n this.dv11 = NaN;\n this.dv22 = NaN;\n this.d00 = NaN; // K^-1\n this.d01 = NaN;\n this.d02 = NaN;\n this.d10 = NaN;\n this.d11 = NaN;\n this.d12 = NaN;\n this.d20 = NaN;\n this.d21 = NaN;\n this.d22 = NaN;\n\n this.limitMotor1 = limitMotor1;\n this.limitMotor2 = limitMotor2;\n this.limitMotor3 = limitMotor3;\n this.b1 = joint.body1;\n this.b2 = joint.body2;\n this.p1 = joint.anchorPoint1;\n this.p2 = joint.anchorPoint2;\n this.r1 = joint.relativeAnchorPoint1;\n this.r2 = joint.relativeAnchorPoint2;\n this.l1 = this.b1.linearVelocity;\n this.l2 = this.b2.linearVelocity;\n this.a1 = this.b1.angularVelocity;\n this.a2 = this.b2.angularVelocity;\n this.i1 = this.b1.inverseInertia;\n this.i2 = this.b2.inverseInertia;\n this.limitImpulse1 = 0;\n this.motorImpulse1 = 0;\n this.limitImpulse2 = 0;\n this.motorImpulse2 = 0;\n this.limitImpulse3 = 0;\n this.motorImpulse3 = 0;\n this.cfm1 = 0; // Constraint Force Mixing\n this.cfm2 = 0;\n this.cfm3 = 0;\n this.weight = -1;\n}", "function Translational3Constraint(joint, limitMotor1, limitMotor2, limitMotor3) {\n this.m1 = NaN;\n this.m2 = NaN;\n this.i1e00 = NaN;\n this.i1e01 = NaN;\n this.i1e02 = NaN;\n this.i1e10 = NaN;\n this.i1e11 = NaN;\n this.i1e12 = NaN;\n this.i1e20 = NaN;\n this.i1e21 = NaN;\n this.i1e22 = NaN;\n this.i2e00 = NaN;\n this.i2e01 = NaN;\n this.i2e02 = NaN;\n this.i2e10 = NaN;\n this.i2e11 = NaN;\n this.i2e12 = NaN;\n this.i2e20 = NaN;\n this.i2e21 = NaN;\n this.i2e22 = NaN;\n this.ax1 = NaN;\n this.ay1 = NaN;\n this.az1 = NaN;\n this.ax2 = NaN;\n this.ay2 = NaN;\n this.az2 = NaN;\n this.ax3 = NaN;\n this.ay3 = NaN;\n this.az3 = NaN;\n this.r1x = NaN;\n this.r1y = NaN;\n this.r1z = NaN;\n this.r2x = NaN;\n this.r2y = NaN;\n this.r2z = NaN;\n this.t1x1 = NaN; // jacobians\n this.t1y1 = NaN;\n this.t1z1 = NaN;\n this.t2x1 = NaN;\n this.t2y1 = NaN;\n this.t2z1 = NaN;\n this.l1x1 = NaN;\n this.l1y1 = NaN;\n this.l1z1 = NaN;\n this.l2x1 = NaN;\n this.l2y1 = NaN;\n this.l2z1 = NaN;\n this.a1x1 = NaN;\n this.a1y1 = NaN;\n this.a1z1 = NaN;\n this.a2x1 = NaN;\n this.a2y1 = NaN;\n this.a2z1 = NaN;\n this.t1x2 = NaN;\n this.t1y2 = NaN;\n this.t1z2 = NaN;\n this.t2x2 = NaN;\n this.t2y2 = NaN;\n this.t2z2 = NaN;\n this.l1x2 = NaN;\n this.l1y2 = NaN;\n this.l1z2 = NaN;\n this.l2x2 = NaN;\n this.l2y2 = NaN;\n this.l2z2 = NaN;\n this.a1x2 = NaN;\n this.a1y2 = NaN;\n this.a1z2 = NaN;\n this.a2x2 = NaN;\n this.a2y2 = NaN;\n this.a2z2 = NaN;\n this.t1x3 = NaN;\n this.t1y3 = NaN;\n this.t1z3 = NaN;\n this.t2x3 = NaN;\n this.t2y3 = NaN;\n this.t2z3 = NaN;\n this.l1x3 = NaN;\n this.l1y3 = NaN;\n this.l1z3 = NaN;\n this.l2x3 = NaN;\n this.l2y3 = NaN;\n this.l2z3 = NaN;\n this.a1x3 = NaN;\n this.a1y3 = NaN;\n this.a1z3 = NaN;\n this.a2x3 = NaN;\n this.a2y3 = NaN;\n this.a2z3 = NaN;\n this.lowerLimit1 = NaN;\n this.upperLimit1 = NaN;\n this.limitVelocity1 = NaN;\n this.limitState1 = 0; // -1: at lower, 0: locked, 1: at upper, 2: unlimited\n this.enableMotor1 = false;\n this.motorSpeed1 = NaN;\n this.maxMotorForce1 = NaN;\n this.maxMotorImpulse1 = NaN;\n this.lowerLimit2 = NaN;\n this.upperLimit2 = NaN;\n this.limitVelocity2 = NaN;\n this.limitState2 = 0; // -1: at lower, 0: locked, 1: at upper, 2: unlimited\n this.enableMotor2 = false;\n this.motorSpeed2 = NaN;\n this.maxMotorForce2 = NaN;\n this.maxMotorImpulse2 = NaN;\n this.lowerLimit3 = NaN;\n this.upperLimit3 = NaN;\n this.limitVelocity3 = NaN;\n this.limitState3 = 0; // -1: at lower, 0: locked, 1: at upper, 2: unlimited\n this.enableMotor3 = false;\n this.motorSpeed3 = NaN;\n this.maxMotorForce3 = NaN;\n this.maxMotorImpulse3 = NaN;\n this.k00 = NaN; // K = J*M*JT\n this.k01 = NaN;\n this.k02 = NaN;\n this.k10 = NaN;\n this.k11 = NaN;\n this.k12 = NaN;\n this.k20 = NaN;\n this.k21 = NaN;\n this.k22 = NaN;\n this.kv00 = NaN; // diagonals without CFMs\n this.kv11 = NaN;\n this.kv22 = NaN;\n this.dv00 = NaN; // ...inverted\n this.dv11 = NaN;\n this.dv22 = NaN;\n this.d00 = NaN; // K^-1\n this.d01 = NaN;\n this.d02 = NaN;\n this.d10 = NaN;\n this.d11 = NaN;\n this.d12 = NaN;\n this.d20 = NaN;\n this.d21 = NaN;\n this.d22 = NaN;\n this.limitMotor1 = limitMotor1;\n this.limitMotor2 = limitMotor2;\n this.limitMotor3 = limitMotor3;\n this.b1 = joint.body1;\n this.b2 = joint.body2;\n this.p1 = joint.anchorPoint1;\n this.p2 = joint.anchorPoint2;\n this.r1 = joint.relativeAnchorPoint1;\n this.r2 = joint.relativeAnchorPoint2;\n this.l1 = this.b1.linearVelocity;\n this.l2 = this.b2.linearVelocity;\n this.a1 = this.b1.angularVelocity;\n this.a2 = this.b2.angularVelocity;\n this.i1 = this.b1.inverseInertia;\n this.i2 = this.b2.inverseInertia;\n this.limitImpulse1 = 0;\n this.motorImpulse1 = 0;\n this.limitImpulse2 = 0;\n this.motorImpulse2 = 0;\n this.limitImpulse3 = 0;\n this.motorImpulse3 = 0;\n this.cfm1 = 0; // Constraint Force Mixing\n this.cfm2 = 0;\n this.cfm3 = 0;\n this.weight = -1;\n}", "function Translational3Constraint (joint,limitMotor1,limitMotor2,limitMotor3){\n\n\t this.m1=NaN;\n\t this.m2=NaN;\n\t this.i1e00=NaN;\n\t this.i1e01=NaN;\n\t this.i1e02=NaN;\n\t this.i1e10=NaN;\n\t this.i1e11=NaN;\n\t this.i1e12=NaN;\n\t this.i1e20=NaN;\n\t this.i1e21=NaN;\n\t this.i1e22=NaN;\n\t this.i2e00=NaN;\n\t this.i2e01=NaN;\n\t this.i2e02=NaN;\n\t this.i2e10=NaN;\n\t this.i2e11=NaN;\n\t this.i2e12=NaN;\n\t this.i2e20=NaN;\n\t this.i2e21=NaN;\n\t this.i2e22=NaN;\n\t this.ax1=NaN;\n\t this.ay1=NaN;\n\t this.az1=NaN;\n\t this.ax2=NaN;\n\t this.ay2=NaN;\n\t this.az2=NaN;\n\t this.ax3=NaN;\n\t this.ay3=NaN;\n\t this.az3=NaN;\n\t this.r1x=NaN;\n\t this.r1y=NaN;\n\t this.r1z=NaN;\n\t this.r2x=NaN;\n\t this.r2y=NaN;\n\t this.r2z=NaN;\n\t this.t1x1=NaN;// jacobians\n\t this.t1y1=NaN;\n\t this.t1z1=NaN;\n\t this.t2x1=NaN;\n\t this.t2y1=NaN;\n\t this.t2z1=NaN;\n\t this.l1x1=NaN;\n\t this.l1y1=NaN;\n\t this.l1z1=NaN;\n\t this.l2x1=NaN;\n\t this.l2y1=NaN;\n\t this.l2z1=NaN;\n\t this.a1x1=NaN;\n\t this.a1y1=NaN;\n\t this.a1z1=NaN;\n\t this.a2x1=NaN;\n\t this.a2y1=NaN;\n\t this.a2z1=NaN;\n\t this.t1x2=NaN;\n\t this.t1y2=NaN;\n\t this.t1z2=NaN;\n\t this.t2x2=NaN;\n\t this.t2y2=NaN;\n\t this.t2z2=NaN;\n\t this.l1x2=NaN;\n\t this.l1y2=NaN;\n\t this.l1z2=NaN;\n\t this.l2x2=NaN;\n\t this.l2y2=NaN;\n\t this.l2z2=NaN;\n\t this.a1x2=NaN;\n\t this.a1y2=NaN;\n\t this.a1z2=NaN;\n\t this.a2x2=NaN;\n\t this.a2y2=NaN;\n\t this.a2z2=NaN;\n\t this.t1x3=NaN;\n\t this.t1y3=NaN;\n\t this.t1z3=NaN;\n\t this.t2x3=NaN;\n\t this.t2y3=NaN;\n\t this.t2z3=NaN;\n\t this.l1x3=NaN;\n\t this.l1y3=NaN;\n\t this.l1z3=NaN;\n\t this.l2x3=NaN;\n\t this.l2y3=NaN;\n\t this.l2z3=NaN;\n\t this.a1x3=NaN;\n\t this.a1y3=NaN;\n\t this.a1z3=NaN;\n\t this.a2x3=NaN;\n\t this.a2y3=NaN;\n\t this.a2z3=NaN;\n\t this.lowerLimit1=NaN;\n\t this.upperLimit1=NaN;\n\t this.limitVelocity1=NaN;\n\t this.limitState1=0; // -1: at lower, 0: locked, 1: at upper, 2: unlimited\n\t this.enableMotor1=false;\n\t this.motorSpeed1=NaN;\n\t this.maxMotorForce1=NaN;\n\t this.maxMotorImpulse1=NaN;\n\t this.lowerLimit2=NaN;\n\t this.upperLimit2=NaN;\n\t this.limitVelocity2=NaN;\n\t this.limitState2=0; // -1: at lower, 0: locked, 1: at upper, 2: unlimited\n\t this.enableMotor2=false;\n\t this.motorSpeed2=NaN;\n\t this.maxMotorForce2=NaN;\n\t this.maxMotorImpulse2=NaN;\n\t this.lowerLimit3=NaN;\n\t this.upperLimit3=NaN;\n\t this.limitVelocity3=NaN;\n\t this.limitState3=0; // -1: at lower, 0: locked, 1: at upper, 2: unlimited\n\t this.enableMotor3=false;\n\t this.motorSpeed3=NaN;\n\t this.maxMotorForce3=NaN;\n\t this.maxMotorImpulse3=NaN;\n\t this.k00=NaN; // K = J*M*JT\n\t this.k01=NaN;\n\t this.k02=NaN;\n\t this.k10=NaN;\n\t this.k11=NaN;\n\t this.k12=NaN;\n\t this.k20=NaN;\n\t this.k21=NaN;\n\t this.k22=NaN;\n\t this.kv00=NaN; // diagonals without CFMs\n\t this.kv11=NaN;\n\t this.kv22=NaN;\n\t this.dv00=NaN; // ...inverted\n\t this.dv11=NaN;\n\t this.dv22=NaN;\n\t this.d00=NaN; // K^-1\n\t this.d01=NaN;\n\t this.d02=NaN;\n\t this.d10=NaN;\n\t this.d11=NaN;\n\t this.d12=NaN;\n\t this.d20=NaN;\n\t this.d21=NaN;\n\t this.d22=NaN;\n\n\t this.limitMotor1=limitMotor1;\n\t this.limitMotor2=limitMotor2;\n\t this.limitMotor3=limitMotor3;\n\t this.b1=joint.body1;\n\t this.b2=joint.body2;\n\t this.p1=joint.anchorPoint1;\n\t this.p2=joint.anchorPoint2;\n\t this.r1=joint.relativeAnchorPoint1;\n\t this.r2=joint.relativeAnchorPoint2;\n\t this.l1=this.b1.linearVelocity;\n\t this.l2=this.b2.linearVelocity;\n\t this.a1=this.b1.angularVelocity;\n\t this.a2=this.b2.angularVelocity;\n\t this.i1=this.b1.inverseInertia;\n\t this.i2=this.b2.inverseInertia;\n\t this.limitImpulse1=0;\n\t this.motorImpulse1=0;\n\t this.limitImpulse2=0;\n\t this.motorImpulse2=0;\n\t this.limitImpulse3=0;\n\t this.motorImpulse3=0;\n\t this.cfm1=0;// Constraint Force Mixing\n\t this.cfm2=0;\n\t this.cfm3=0;\n\t this.weight=-1;\n\t}", "function Translational3Constraint(joint, limitMotor1, limitMotor2, limitMotor3) {\n\n\t\tthis.m1 = NaN;\n\t\tthis.m2 = NaN;\n\t\tthis.i1e00 = NaN;\n\t\tthis.i1e01 = NaN;\n\t\tthis.i1e02 = NaN;\n\t\tthis.i1e10 = NaN;\n\t\tthis.i1e11 = NaN;\n\t\tthis.i1e12 = NaN;\n\t\tthis.i1e20 = NaN;\n\t\tthis.i1e21 = NaN;\n\t\tthis.i1e22 = NaN;\n\t\tthis.i2e00 = NaN;\n\t\tthis.i2e01 = NaN;\n\t\tthis.i2e02 = NaN;\n\t\tthis.i2e10 = NaN;\n\t\tthis.i2e11 = NaN;\n\t\tthis.i2e12 = NaN;\n\t\tthis.i2e20 = NaN;\n\t\tthis.i2e21 = NaN;\n\t\tthis.i2e22 = NaN;\n\t\tthis.ax1 = NaN;\n\t\tthis.ay1 = NaN;\n\t\tthis.az1 = NaN;\n\t\tthis.ax2 = NaN;\n\t\tthis.ay2 = NaN;\n\t\tthis.az2 = NaN;\n\t\tthis.ax3 = NaN;\n\t\tthis.ay3 = NaN;\n\t\tthis.az3 = NaN;\n\t\tthis.r1x = NaN;\n\t\tthis.r1y = NaN;\n\t\tthis.r1z = NaN;\n\t\tthis.r2x = NaN;\n\t\tthis.r2y = NaN;\n\t\tthis.r2z = NaN;\n\t\tthis.t1x1 = NaN; // jacobians\n\t\tthis.t1y1 = NaN;\n\t\tthis.t1z1 = NaN;\n\t\tthis.t2x1 = NaN;\n\t\tthis.t2y1 = NaN;\n\t\tthis.t2z1 = NaN;\n\t\tthis.l1x1 = NaN;\n\t\tthis.l1y1 = NaN;\n\t\tthis.l1z1 = NaN;\n\t\tthis.l2x1 = NaN;\n\t\tthis.l2y1 = NaN;\n\t\tthis.l2z1 = NaN;\n\t\tthis.a1x1 = NaN;\n\t\tthis.a1y1 = NaN;\n\t\tthis.a1z1 = NaN;\n\t\tthis.a2x1 = NaN;\n\t\tthis.a2y1 = NaN;\n\t\tthis.a2z1 = NaN;\n\t\tthis.t1x2 = NaN;\n\t\tthis.t1y2 = NaN;\n\t\tthis.t1z2 = NaN;\n\t\tthis.t2x2 = NaN;\n\t\tthis.t2y2 = NaN;\n\t\tthis.t2z2 = NaN;\n\t\tthis.l1x2 = NaN;\n\t\tthis.l1y2 = NaN;\n\t\tthis.l1z2 = NaN;\n\t\tthis.l2x2 = NaN;\n\t\tthis.l2y2 = NaN;\n\t\tthis.l2z2 = NaN;\n\t\tthis.a1x2 = NaN;\n\t\tthis.a1y2 = NaN;\n\t\tthis.a1z2 = NaN;\n\t\tthis.a2x2 = NaN;\n\t\tthis.a2y2 = NaN;\n\t\tthis.a2z2 = NaN;\n\t\tthis.t1x3 = NaN;\n\t\tthis.t1y3 = NaN;\n\t\tthis.t1z3 = NaN;\n\t\tthis.t2x3 = NaN;\n\t\tthis.t2y3 = NaN;\n\t\tthis.t2z3 = NaN;\n\t\tthis.l1x3 = NaN;\n\t\tthis.l1y3 = NaN;\n\t\tthis.l1z3 = NaN;\n\t\tthis.l2x3 = NaN;\n\t\tthis.l2y3 = NaN;\n\t\tthis.l2z3 = NaN;\n\t\tthis.a1x3 = NaN;\n\t\tthis.a1y3 = NaN;\n\t\tthis.a1z3 = NaN;\n\t\tthis.a2x3 = NaN;\n\t\tthis.a2y3 = NaN;\n\t\tthis.a2z3 = NaN;\n\t\tthis.lowerLimit1 = NaN;\n\t\tthis.upperLimit1 = NaN;\n\t\tthis.limitVelocity1 = NaN;\n\t\tthis.limitState1 = 0; // -1: at lower, 0: locked, 1: at upper, 2: unlimited\n\t\tthis.enableMotor1 = false;\n\t\tthis.motorSpeed1 = NaN;\n\t\tthis.maxMotorForce1 = NaN;\n\t\tthis.maxMotorImpulse1 = NaN;\n\t\tthis.lowerLimit2 = NaN;\n\t\tthis.upperLimit2 = NaN;\n\t\tthis.limitVelocity2 = NaN;\n\t\tthis.limitState2 = 0; // -1: at lower, 0: locked, 1: at upper, 2: unlimited\n\t\tthis.enableMotor2 = false;\n\t\tthis.motorSpeed2 = NaN;\n\t\tthis.maxMotorForce2 = NaN;\n\t\tthis.maxMotorImpulse2 = NaN;\n\t\tthis.lowerLimit3 = NaN;\n\t\tthis.upperLimit3 = NaN;\n\t\tthis.limitVelocity3 = NaN;\n\t\tthis.limitState3 = 0; // -1: at lower, 0: locked, 1: at upper, 2: unlimited\n\t\tthis.enableMotor3 = false;\n\t\tthis.motorSpeed3 = NaN;\n\t\tthis.maxMotorForce3 = NaN;\n\t\tthis.maxMotorImpulse3 = NaN;\n\t\tthis.k00 = NaN; // K = J*M*JT\n\t\tthis.k01 = NaN;\n\t\tthis.k02 = NaN;\n\t\tthis.k10 = NaN;\n\t\tthis.k11 = NaN;\n\t\tthis.k12 = NaN;\n\t\tthis.k20 = NaN;\n\t\tthis.k21 = NaN;\n\t\tthis.k22 = NaN;\n\t\tthis.kv00 = NaN; // diagonals without CFMs\n\t\tthis.kv11 = NaN;\n\t\tthis.kv22 = NaN;\n\t\tthis.dv00 = NaN; // ...inverted\n\t\tthis.dv11 = NaN;\n\t\tthis.dv22 = NaN;\n\t\tthis.d00 = NaN; // K^-1\n\t\tthis.d01 = NaN;\n\t\tthis.d02 = NaN;\n\t\tthis.d10 = NaN;\n\t\tthis.d11 = NaN;\n\t\tthis.d12 = NaN;\n\t\tthis.d20 = NaN;\n\t\tthis.d21 = NaN;\n\t\tthis.d22 = NaN;\n\n\t\tthis.limitMotor1 = limitMotor1;\n\t\tthis.limitMotor2 = limitMotor2;\n\t\tthis.limitMotor3 = limitMotor3;\n\t\tthis.b1 = joint.body1;\n\t\tthis.b2 = joint.body2;\n\t\tthis.p1 = joint.anchorPoint1;\n\t\tthis.p2 = joint.anchorPoint2;\n\t\tthis.r1 = joint.relativeAnchorPoint1;\n\t\tthis.r2 = joint.relativeAnchorPoint2;\n\t\tthis.l1 = this.b1.linearVelocity;\n\t\tthis.l2 = this.b2.linearVelocity;\n\t\tthis.a1 = this.b1.angularVelocity;\n\t\tthis.a2 = this.b2.angularVelocity;\n\t\tthis.i1 = this.b1.inverseInertia;\n\t\tthis.i2 = this.b2.inverseInertia;\n\t\tthis.limitImpulse1 = 0;\n\t\tthis.motorImpulse1 = 0;\n\t\tthis.limitImpulse2 = 0;\n\t\tthis.motorImpulse2 = 0;\n\t\tthis.limitImpulse3 = 0;\n\t\tthis.motorImpulse3 = 0;\n\t\tthis.cfm1 = 0; // Constraint Force Mixing\n\t\tthis.cfm2 = 0;\n\t\tthis.cfm3 = 0;\n\t\tthis.weight = -1;\n\t}", "function Rotational3Constraint ( joint, limitMotor1, limitMotor2, limitMotor3 ) {\n\t \n\t this.cfm1=NaN;\n\t this.cfm2=NaN;\n\t this.cfm3=NaN;\n\t this.i1e00=NaN;\n\t this.i1e01=NaN;\n\t this.i1e02=NaN;\n\t this.i1e10=NaN;\n\t this.i1e11=NaN;\n\t this.i1e12=NaN;\n\t this.i1e20=NaN;\n\t this.i1e21=NaN;\n\t this.i1e22=NaN;\n\t this.i2e00=NaN;\n\t this.i2e01=NaN;\n\t this.i2e02=NaN;\n\t this.i2e10=NaN;\n\t this.i2e11=NaN;\n\t this.i2e12=NaN;\n\t this.i2e20=NaN;\n\t this.i2e21=NaN;\n\t this.i2e22=NaN;\n\t this.ax1=NaN;\n\t this.ay1=NaN;\n\t this.az1=NaN;\n\t this.ax2=NaN;\n\t this.ay2=NaN;\n\t this.az2=NaN;\n\t this.ax3=NaN;\n\t this.ay3=NaN;\n\t this.az3=NaN;\n\n\t this.a1x1=NaN; // jacoians\n\t this.a1y1=NaN;\n\t this.a1z1=NaN;\n\t this.a2x1=NaN;\n\t this.a2y1=NaN;\n\t this.a2z1=NaN;\n\t this.a1x2=NaN;\n\t this.a1y2=NaN;\n\t this.a1z2=NaN;\n\t this.a2x2=NaN;\n\t this.a2y2=NaN;\n\t this.a2z2=NaN;\n\t this.a1x3=NaN;\n\t this.a1y3=NaN;\n\t this.a1z3=NaN;\n\t this.a2x3=NaN;\n\t this.a2y3=NaN;\n\t this.a2z3=NaN;\n\n\t this.lowerLimit1=NaN;\n\t this.upperLimit1=NaN;\n\t this.limitVelocity1=NaN;\n\t this.limitState1=0; // -1: at lower, 0: locked, 1: at upper, 2: free\n\t this.enableMotor1=false;\n\t this.motorSpeed1=NaN;\n\t this.maxMotorForce1=NaN;\n\t this.maxMotorImpulse1=NaN;\n\t this.lowerLimit2=NaN;\n\t this.upperLimit2=NaN;\n\t this.limitVelocity2=NaN;\n\t this.limitState2=0; // -1: at lower, 0: locked, 1: at upper, 2: free\n\t this.enableMotor2=false;\n\t this.motorSpeed2=NaN;\n\t this.maxMotorForce2=NaN;\n\t this.maxMotorImpulse2=NaN;\n\t this.lowerLimit3=NaN;\n\t this.upperLimit3=NaN;\n\t this.limitVelocity3=NaN;\n\t this.limitState3=0; // -1: at lower, 0: locked, 1: at upper, 2: free\n\t this.enableMotor3=false;\n\t this.motorSpeed3=NaN;\n\t this.maxMotorForce3=NaN;\n\t this.maxMotorImpulse3=NaN;\n\n\t this.k00=NaN; // K = J*M*JT\n\t this.k01=NaN;\n\t this.k02=NaN;\n\t this.k10=NaN;\n\t this.k11=NaN;\n\t this.k12=NaN;\n\t this.k20=NaN;\n\t this.k21=NaN;\n\t this.k22=NaN;\n\n\t this.kv00=NaN; // diagonals without CFMs\n\t this.kv11=NaN;\n\t this.kv22=NaN;\n\n\t this.dv00=NaN; // ...inverted\n\t this.dv11=NaN;\n\t this.dv22=NaN;\n\n\t this.d00=NaN; // K^-1\n\t this.d01=NaN;\n\t this.d02=NaN;\n\t this.d10=NaN;\n\t this.d11=NaN;\n\t this.d12=NaN;\n\t this.d20=NaN;\n\t this.d21=NaN;\n\t this.d22=NaN;\n\n\t this.limitMotor1=limitMotor1;\n\t this.limitMotor2=limitMotor2;\n\t this.limitMotor3=limitMotor3;\n\t this.b1=joint.body1;\n\t this.b2=joint.body2;\n\t this.a1=this.b1.angularVelocity;\n\t this.a2=this.b2.angularVelocity;\n\t this.i1=this.b1.inverseInertia;\n\t this.i2=this.b2.inverseInertia;\n\t this.limitImpulse1=0;\n\t this.motorImpulse1=0;\n\t this.limitImpulse2=0;\n\t this.motorImpulse2=0;\n\t this.limitImpulse3=0;\n\t this.motorImpulse3=0;\n\n\t}", "function Rotational3Constraint(joint, limitMotor1, limitMotor2, limitMotor3) {\n\n this.cfm1 = NaN;\n this.cfm2 = NaN;\n this.cfm3 = NaN;\n this.i1e00 = NaN;\n this.i1e01 = NaN;\n this.i1e02 = NaN;\n this.i1e10 = NaN;\n this.i1e11 = NaN;\n this.i1e12 = NaN;\n this.i1e20 = NaN;\n this.i1e21 = NaN;\n this.i1e22 = NaN;\n this.i2e00 = NaN;\n this.i2e01 = NaN;\n this.i2e02 = NaN;\n this.i2e10 = NaN;\n this.i2e11 = NaN;\n this.i2e12 = NaN;\n this.i2e20 = NaN;\n this.i2e21 = NaN;\n this.i2e22 = NaN;\n this.ax1 = NaN;\n this.ay1 = NaN;\n this.az1 = NaN;\n this.ax2 = NaN;\n this.ay2 = NaN;\n this.az2 = NaN;\n this.ax3 = NaN;\n this.ay3 = NaN;\n this.az3 = NaN;\n\n this.a1x1 = NaN; // jacoians\n this.a1y1 = NaN;\n this.a1z1 = NaN;\n this.a2x1 = NaN;\n this.a2y1 = NaN;\n this.a2z1 = NaN;\n this.a1x2 = NaN;\n this.a1y2 = NaN;\n this.a1z2 = NaN;\n this.a2x2 = NaN;\n this.a2y2 = NaN;\n this.a2z2 = NaN;\n this.a1x3 = NaN;\n this.a1y3 = NaN;\n this.a1z3 = NaN;\n this.a2x3 = NaN;\n this.a2y3 = NaN;\n this.a2z3 = NaN;\n\n this.lowerLimit1 = NaN;\n this.upperLimit1 = NaN;\n this.limitVelocity1 = NaN;\n this.limitState1 = 0; // -1: at lower, 0: locked, 1: at upper, 2: free\n this.enableMotor1 = false;\n this.motorSpeed1 = NaN;\n this.maxMotorForce1 = NaN;\n this.maxMotorImpulse1 = NaN;\n this.lowerLimit2 = NaN;\n this.upperLimit2 = NaN;\n this.limitVelocity2 = NaN;\n this.limitState2 = 0; // -1: at lower, 0: locked, 1: at upper, 2: free\n this.enableMotor2 = false;\n this.motorSpeed2 = NaN;\n this.maxMotorForce2 = NaN;\n this.maxMotorImpulse2 = NaN;\n this.lowerLimit3 = NaN;\n this.upperLimit3 = NaN;\n this.limitVelocity3 = NaN;\n this.limitState3 = 0; // -1: at lower, 0: locked, 1: at upper, 2: free\n this.enableMotor3 = false;\n this.motorSpeed3 = NaN;\n this.maxMotorForce3 = NaN;\n this.maxMotorImpulse3 = NaN;\n\n this.k00 = NaN; // K = J*M*JT\n this.k01 = NaN;\n this.k02 = NaN;\n this.k10 = NaN;\n this.k11 = NaN;\n this.k12 = NaN;\n this.k20 = NaN;\n this.k21 = NaN;\n this.k22 = NaN;\n\n this.kv00 = NaN; // diagonals without CFMs\n this.kv11 = NaN;\n this.kv22 = NaN;\n\n this.dv00 = NaN; // ...inverted\n this.dv11 = NaN;\n this.dv22 = NaN;\n\n this.d00 = NaN; // K^-1\n this.d01 = NaN;\n this.d02 = NaN;\n this.d10 = NaN;\n this.d11 = NaN;\n this.d12 = NaN;\n this.d20 = NaN;\n this.d21 = NaN;\n this.d22 = NaN;\n\n this.limitMotor1 = limitMotor1;\n this.limitMotor2 = limitMotor2;\n this.limitMotor3 = limitMotor3;\n this.b1 = joint.body1;\n this.b2 = joint.body2;\n this.a1 = this.b1.angularVelocity;\n this.a2 = this.b2.angularVelocity;\n this.i1 = this.b1.inverseInertia;\n this.i2 = this.b2.inverseInertia;\n this.limitImpulse1 = 0;\n this.motorImpulse1 = 0;\n this.limitImpulse2 = 0;\n this.motorImpulse2 = 0;\n this.limitImpulse3 = 0;\n this.motorImpulse3 = 0;\n}", "function Rotational3Constraint(joint, limitMotor1, limitMotor2, limitMotor3) {\n this.cfm1 = NaN;\n this.cfm2 = NaN;\n this.cfm3 = NaN;\n this.i1e00 = NaN;\n this.i1e01 = NaN;\n this.i1e02 = NaN;\n this.i1e10 = NaN;\n this.i1e11 = NaN;\n this.i1e12 = NaN;\n this.i1e20 = NaN;\n this.i1e21 = NaN;\n this.i1e22 = NaN;\n this.i2e00 = NaN;\n this.i2e01 = NaN;\n this.i2e02 = NaN;\n this.i2e10 = NaN;\n this.i2e11 = NaN;\n this.i2e12 = NaN;\n this.i2e20 = NaN;\n this.i2e21 = NaN;\n this.i2e22 = NaN;\n this.ax1 = NaN;\n this.ay1 = NaN;\n this.az1 = NaN;\n this.ax2 = NaN;\n this.ay2 = NaN;\n this.az2 = NaN;\n this.ax3 = NaN;\n this.ay3 = NaN;\n this.az3 = NaN;\n this.a1x1 = NaN; // jacoians\n this.a1y1 = NaN;\n this.a1z1 = NaN;\n this.a2x1 = NaN;\n this.a2y1 = NaN;\n this.a2z1 = NaN;\n this.a1x2 = NaN;\n this.a1y2 = NaN;\n this.a1z2 = NaN;\n this.a2x2 = NaN;\n this.a2y2 = NaN;\n this.a2z2 = NaN;\n this.a1x3 = NaN;\n this.a1y3 = NaN;\n this.a1z3 = NaN;\n this.a2x3 = NaN;\n this.a2y3 = NaN;\n this.a2z3 = NaN;\n this.lowerLimit1 = NaN;\n this.upperLimit1 = NaN;\n this.limitVelocity1 = NaN;\n this.limitState1 = 0; // -1: at lower, 0: locked, 1: at upper, 2: free\n this.enableMotor1 = false;\n this.motorSpeed1 = NaN;\n this.maxMotorForce1 = NaN;\n this.maxMotorImpulse1 = NaN;\n this.lowerLimit2 = NaN;\n this.upperLimit2 = NaN;\n this.limitVelocity2 = NaN;\n this.limitState2 = 0; // -1: at lower, 0: locked, 1: at upper, 2: free\n this.enableMotor2 = false;\n this.motorSpeed2 = NaN;\n this.maxMotorForce2 = NaN;\n this.maxMotorImpulse2 = NaN;\n this.lowerLimit3 = NaN;\n this.upperLimit3 = NaN;\n this.limitVelocity3 = NaN;\n this.limitState3 = 0; // -1: at lower, 0: locked, 1: at upper, 2: free\n this.enableMotor3 = false;\n this.motorSpeed3 = NaN;\n this.maxMotorForce3 = NaN;\n this.maxMotorImpulse3 = NaN;\n this.k00 = NaN; // K = J*M*JT\n this.k01 = NaN;\n this.k02 = NaN;\n this.k10 = NaN;\n this.k11 = NaN;\n this.k12 = NaN;\n this.k20 = NaN;\n this.k21 = NaN;\n this.k22 = NaN;\n this.kv00 = NaN; // diagonals without CFMs\n this.kv11 = NaN;\n this.kv22 = NaN;\n this.dv00 = NaN; // ...inverted\n this.dv11 = NaN;\n this.dv22 = NaN;\n this.d00 = NaN; // K^-1\n this.d01 = NaN;\n this.d02 = NaN;\n this.d10 = NaN;\n this.d11 = NaN;\n this.d12 = NaN;\n this.d20 = NaN;\n this.d21 = NaN;\n this.d22 = NaN;\n this.limitMotor1 = limitMotor1;\n this.limitMotor2 = limitMotor2;\n this.limitMotor3 = limitMotor3;\n this.b1 = joint.body1;\n this.b2 = joint.body2;\n this.a1 = this.b1.angularVelocity;\n this.a2 = this.b2.angularVelocity;\n this.i1 = this.b1.inverseInertia;\n this.i2 = this.b2.inverseInertia;\n this.limitImpulse1 = 0;\n this.motorImpulse1 = 0;\n this.limitImpulse2 = 0;\n this.motorImpulse2 = 0;\n this.limitImpulse3 = 0;\n this.motorImpulse3 = 0;\n}", "function Rotational3Constraint(joint, limitMotor1, limitMotor2, limitMotor3) {\n\n\t\tthis.cfm1 = NaN;\n\t\tthis.cfm2 = NaN;\n\t\tthis.cfm3 = NaN;\n\t\tthis.i1e00 = NaN;\n\t\tthis.i1e01 = NaN;\n\t\tthis.i1e02 = NaN;\n\t\tthis.i1e10 = NaN;\n\t\tthis.i1e11 = NaN;\n\t\tthis.i1e12 = NaN;\n\t\tthis.i1e20 = NaN;\n\t\tthis.i1e21 = NaN;\n\t\tthis.i1e22 = NaN;\n\t\tthis.i2e00 = NaN;\n\t\tthis.i2e01 = NaN;\n\t\tthis.i2e02 = NaN;\n\t\tthis.i2e10 = NaN;\n\t\tthis.i2e11 = NaN;\n\t\tthis.i2e12 = NaN;\n\t\tthis.i2e20 = NaN;\n\t\tthis.i2e21 = NaN;\n\t\tthis.i2e22 = NaN;\n\t\tthis.ax1 = NaN;\n\t\tthis.ay1 = NaN;\n\t\tthis.az1 = NaN;\n\t\tthis.ax2 = NaN;\n\t\tthis.ay2 = NaN;\n\t\tthis.az2 = NaN;\n\t\tthis.ax3 = NaN;\n\t\tthis.ay3 = NaN;\n\t\tthis.az3 = NaN;\n\n\t\tthis.a1x1 = NaN; // jacoians\n\t\tthis.a1y1 = NaN;\n\t\tthis.a1z1 = NaN;\n\t\tthis.a2x1 = NaN;\n\t\tthis.a2y1 = NaN;\n\t\tthis.a2z1 = NaN;\n\t\tthis.a1x2 = NaN;\n\t\tthis.a1y2 = NaN;\n\t\tthis.a1z2 = NaN;\n\t\tthis.a2x2 = NaN;\n\t\tthis.a2y2 = NaN;\n\t\tthis.a2z2 = NaN;\n\t\tthis.a1x3 = NaN;\n\t\tthis.a1y3 = NaN;\n\t\tthis.a1z3 = NaN;\n\t\tthis.a2x3 = NaN;\n\t\tthis.a2y3 = NaN;\n\t\tthis.a2z3 = NaN;\n\n\t\tthis.lowerLimit1 = NaN;\n\t\tthis.upperLimit1 = NaN;\n\t\tthis.limitVelocity1 = NaN;\n\t\tthis.limitState1 = 0; // -1: at lower, 0: locked, 1: at upper, 2: free\n\t\tthis.enableMotor1 = false;\n\t\tthis.motorSpeed1 = NaN;\n\t\tthis.maxMotorForce1 = NaN;\n\t\tthis.maxMotorImpulse1 = NaN;\n\t\tthis.lowerLimit2 = NaN;\n\t\tthis.upperLimit2 = NaN;\n\t\tthis.limitVelocity2 = NaN;\n\t\tthis.limitState2 = 0; // -1: at lower, 0: locked, 1: at upper, 2: free\n\t\tthis.enableMotor2 = false;\n\t\tthis.motorSpeed2 = NaN;\n\t\tthis.maxMotorForce2 = NaN;\n\t\tthis.maxMotorImpulse2 = NaN;\n\t\tthis.lowerLimit3 = NaN;\n\t\tthis.upperLimit3 = NaN;\n\t\tthis.limitVelocity3 = NaN;\n\t\tthis.limitState3 = 0; // -1: at lower, 0: locked, 1: at upper, 2: free\n\t\tthis.enableMotor3 = false;\n\t\tthis.motorSpeed3 = NaN;\n\t\tthis.maxMotorForce3 = NaN;\n\t\tthis.maxMotorImpulse3 = NaN;\n\n\t\tthis.k00 = NaN; // K = J*M*JT\n\t\tthis.k01 = NaN;\n\t\tthis.k02 = NaN;\n\t\tthis.k10 = NaN;\n\t\tthis.k11 = NaN;\n\t\tthis.k12 = NaN;\n\t\tthis.k20 = NaN;\n\t\tthis.k21 = NaN;\n\t\tthis.k22 = NaN;\n\n\t\tthis.kv00 = NaN; // diagonals without CFMs\n\t\tthis.kv11 = NaN;\n\t\tthis.kv22 = NaN;\n\n\t\tthis.dv00 = NaN; // ...inverted\n\t\tthis.dv11 = NaN;\n\t\tthis.dv22 = NaN;\n\n\t\tthis.d00 = NaN; // K^-1\n\t\tthis.d01 = NaN;\n\t\tthis.d02 = NaN;\n\t\tthis.d10 = NaN;\n\t\tthis.d11 = NaN;\n\t\tthis.d12 = NaN;\n\t\tthis.d20 = NaN;\n\t\tthis.d21 = NaN;\n\t\tthis.d22 = NaN;\n\n\t\tthis.limitMotor1 = limitMotor1;\n\t\tthis.limitMotor2 = limitMotor2;\n\t\tthis.limitMotor3 = limitMotor3;\n\t\tthis.b1 = joint.body1;\n\t\tthis.b2 = joint.body2;\n\t\tthis.a1 = this.b1.angularVelocity;\n\t\tthis.a2 = this.b2.angularVelocity;\n\t\tthis.i1 = this.b1.inverseInertia;\n\t\tthis.i2 = this.b2.inverseInertia;\n\t\tthis.limitImpulse1 = 0;\n\t\tthis.motorImpulse1 = 0;\n\t\tthis.limitImpulse2 = 0;\n\t\tthis.motorImpulse2 = 0;\n\t\tthis.limitImpulse3 = 0;\n\t\tthis.motorImpulse3 = 0;\n\t}", "adjoint(){\n\t\t\tvar det00= determinanteDos(this.a11,this.a22,this.a12,this.a21);\n\t\t\tvar det01= -determinanteDos(this.a10,this.a22,this.a12,this.a20);\n\t\t\tvar det02= determinanteDos(this.a10,this.a21,this.a11,this.a20);\n\t\t\tvar det10= -determinanteDos(this.a01,this.a22,this.a02,this.a21);\n\t\t\tvar det11= determinanteDos(this.a00,this.a22,this.a02,this.a20);\n\t\t\tvar det12= -determinanteDos(this.a00,this.a21,this.a20,this.a01);\n\t\t\tvar det20= determinanteDos(this.a01,this.a12,this.a02,this.a11);\n\t\t\tvar det21= -determinanteDos(this.a00,this.a12,this.a02,this.a10);\n\t\t\tvar det22= determinanteDos(this.a00,this.a11,this.a01,this.a10);\n\t\t\treturn (new Matrix3(det00,det01,det02,det03,det10,det11,det12,det20,det21,det22));\n\t\t}", "function objective3 () {\n\t\n\tgl.uniformMatrix4fv(modelViewMatrixLoc, false, flatten(modelViewMatrix));\n\t\n\tvar x = 0;\n\t\n\tquadObjectives(x+2, x+3, x, x+1, 3 );\n\tvar x2 = x;\n\tfor (var j=0; j<3; j++){\n\t\tquadObjectives( x2, x2+1, x2+5, x2+4, 3);\n\t\tx2++;\n\t}\n\tquadObjectives( x+3, x, x+4, x+7, 3);\n\tquadObjectives( x+4, x+5, x+6, x+7, 3);\n}", "function Choleski_Decomposition(sj, ndof, hbw) {\r\n var p,q; //Integer;\r\n var su, te; // Double;\r\n\r\n var indx1, indx2, indx3;\r\n // WrMat[\"Decompose IN sj ..\", sj, ndof, hbw]\r\n // PrintMat[\"Choleski_Decomposition IN sj[] ..\", sj[], dd[], ndof, hbw]\r\n\r\n\r\n WScript.Echo(\"<Choleski_Decomposition ...>\");\r\n WScript.Echo(\"ndof, hbw\", ndof, hbw);\r\n for (global_i = baseIndex; global_i < ndof; global_i++) {\r\n WScript.Echo(\"global_i=\", global_i);\r\n p = ndof - global_i - 1;\r\n\r\n if (p > hbw-1) {\r\n p = hbw-1;\r\n }\r\n\r\n for (global_j = baseIndex; global_j < (p+1); global_j++) {\r\n q = (hbw-2) - global_j;\r\n if (q > global_i - 1) {\r\n q = global_i - 1;\r\n }\r\n\r\n su = sj[global_i][global_j];\r\n\r\n if (q >= 0) {\r\n for (global_k = baseIndex; global_k < q+1; global_k++) {\r\n if (global_i > global_k) {\r\n //su = su - sj[global_i - global_k][global_k + 1] * sj[global_i - global_k][global_k + global_j];\r\n indx1 = global_i - global_k - 1;\r\n indx2 = global_k + 1;\r\n indx3 = global_k + global_j + 1;\r\n su = su - sj[indx1][indx2] * sj[indx1][indx3];\r\n } // End If [\r\n } // next k\r\n } // End If [\r\n\r\n if (global_j != 0) {\r\n sj[global_i][global_j] = su * te;\r\n } else {\r\n if (su <= 0) {\r\n WScript.Echo(\"matrix -ve TERM Terminated ???\");\r\n //End\r\n\r\n } else {\r\n // BEGIN\r\n te = 1 / Math.sqrt(su);\r\n sj[global_i][global_j] = te;\r\n } // End If [\r\n } // End If [\r\n } // next j\r\n \r\n WScript.Echo(\"SJ[]: \",global_i); \r\n fpTracer.WriteLine(\"SJ[]: \" + global_i.toString());\r\n fprintMatrix(sj); \r\n \r\n \r\n } // next i\r\n\r\n // PrintMat[\"Choleski_Decomposition OUT sj[] ..\", sj[], dd[], ndof, hbw]\r\n\r\n} //.. Choleski_Decomposition ..", "function SolveEquationsOfMotion (iStateVec)\r\n {\r\n // extract \r\n var omega1 = iStateVec[0];\r\n var omega2 = iStateVec[1];\r\n var omega3 = iStateVec[2];\r\n \r\n var theta1 = iStateVec[3];\r\n var theta2 = iStateVec[4];\r\n var theta3 = iStateVec[5];\r\n\r\n // Create a three by three matrix with the necessary elements\r\n // note that the matrix is symmetrical about the diagonal so we don't need to compute\r\n // all the the elements\r\n var m11 = (_dMass1 + _dMass2 + _dMass3) * _dLength1 * _dLength1;\r\n var m12 = (_dMass2 + _dMass3) * _dLength1 * _dLength2 * Math.cos (theta1 - theta2);\r\n var m13 = _dMass3 * _dLength1 * _dLength3 * Math.cos (theta1 - theta3);\r\n\r\n var m21 = m12;\r\n var m22 = (_dMass2 + _dMass3) * _dLength2 * _dLength2;\r\n var m23 = _dMass3 * _dLength2 * _dLength3 * Math.cos (theta2 - theta3);\r\n\r\n var m31 = m13;\r\n var m32 = m23;\r\n var m33 = _dMass3 * _dLength3 * _dLength3;\r\n\r\n // Actually we are not computing the matrix, rather the inverse of the matrix\r\n var mInv = math.inv ( [ [m11, m12, m13], [m21, m22, m23], [m31, m32, m33] ] );\r\n\r\n var f1 = -1 * (_dMass2 + _dMass3) * _dLength1 * _dLength2 * Math.sin (theta1 - theta2) * omega2 * omega2\r\n - _dMass3 * _dLength1 * _dLength3 * Math.sin (theta1 - theta3) * omega3 * omega3\r\n - (_dMass1 + _dMass2 + _dMass3) * _dGravityConst * _dLength1 * Math.sin (theta1);\r\n var f2 = (_dMass2 + _dMass3) * _dLength1 * _dLength2 * Math.sin (theta1 - theta2) * omega1 * omega1\r\n - _dMass3 * _dLength2 * _dLength3 * Math.sin (theta2 - theta3) * omega3 * omega3\r\n - (_dMass2 + _dMass3) * _dGravityConst * _dLength2 * Math.sin (theta2);\r\n var f3 = _dMass3 * _dLength1 * _dLength3 * Math.sin (theta1 - theta3) * omega1 * omega1\r\n + _dMass3 * _dLength2 * _dLength3 * Math.sin (theta2 - theta3) * omega2 * omega2\r\n - _dMass3 * _dGravityConst * _dLength3 * Math.sin (theta3);\r\n\r\n // This damping is just a very slight approximation\r\n f1 -= _dDampingConst * omega1;\r\n f2 -= _dDampingConst * omega2;\r\n f2 -= _dDampingConst * omega3;\r\n\r\n // Make a matrix of the stuff of the 'remaining stuff' from the lagrangian\r\n var F = math.matrix ( [f1, f2, f3] );\r\n\r\n // Compute theta double dot...\r\n var thetaDDot = math.multiply (mInv, F);\r\n\r\n // Uncomment for debugging...\r\n // console.log (thetaDDot._data[0], thetaDDot._data[1], f1, f2);\r\n\r\n return [ thetaDDot._data[0], thetaDDot._data[1], thetaDDot._data[2], omega1, omega2, omega3 ];\r\n }", "function matrixAdjoint(a) {\n var result = new Array();\n\n if (a[0].length == a.length) {\n for (var i = 0; i < a.length; i++) {\n result[i] = [];\n for (var j = 0;j < a.length;j++) {\n result[i][j] = Math.pow(-1,i+j) *\n matrixDeterminant(matrixCofactor(a,i+1,j+1),a.length-1);\n }\n }\n result = matrixTranspose(result);\n }\n\n else {\n console.log(\"Invalid parameter\");\n }\n\n return result;\n}", "function SolveEquationsOfMotion (iStateVec)\r\n {\r\n // extract \r\n var omega1 = iStateVec[0];\r\n var omega2 = iStateVec[1];\r\n \r\n var theta1 = iStateVec[2];\r\n var theta2 = iStateVec[3];\r\n\r\n\t// Create a two by two matrix with the necessary elements. \r\n var m11 = (_dMass1 + _dMass2) * _dLength1;\r\n var m12 = _dMass2 * _dLength2 * Math.cos (theta1 - theta2);\r\n var m21 = _dLength1 * Math.cos (theta1 - theta2);\r\n var m22 = _dLength2;\r\n\r\n // Uncomment for debugging...\r\n // console.log (math.det ( [ [m11, m12], [m21, m22] ] ) );\r\n // var dDeterminant = m11 * m22 - m12 * m21;\r\n // var invM11 = m22 / dDeterminant;\r\n // var invM12 = -1 * m21 / dDeterminant;\r\n // var invM21 = -1 * m12 / dDeterminant;\r\n // var invM22 = m11 / dDeterminant;\r\n // console.log (dDeterminant, invM11, invM12, invM21, invM22);\r\n\r\n // Actually we are not computing the matrix, rather the inverse of the matrix\r\n var mInv = math.inv ( [ [m11, m12], [m21, m22] ] );\r\n\r\n var f1 = -1 * _dMass2 * _dLength2 * omega2 * omega2 * Math.sin (theta1 - theta2) - (_dMass1 + _dMass2) * _dGravityConst * Math.sin (theta1);\r\n var f2 = _dLength1 * omega1 * omega1 * Math.sin (theta1 - theta2) - _dGravityConst * Math.sin (theta2);\r\n\r\n // This damping is just a very slight approximation\r\n f1 -= _dDampingConst * omega1;\r\n f2 -= _dDampingConst * omega2;\r\n\r\n // Make a matrix of the stuff of the 'remaining stuff' from the lagrangian\r\n var F = math.matrix ( [f1, f2] );\r\n\r\n // Compute theta double dot...\r\n var thetaDDot = math.multiply (mInv, F);\r\n\r\n // Uncomment for debugging...\r\n // console.log (thetaDDot._data[0], thetaDDot._data[1], f1, f2);\r\n\r\n return [ thetaDDot._data[0], thetaDDot._data[1], omega1, omega2 ];\r\n }", "fillJacobian( targetJoints, freeJoints, outJacobian ) {\n\n\t\tconst {\n\t\t\ttranslationStep,\n\t\t\trotationStep,\n\t\t\tlockedJointDoF,\n\t\t\tlockedJointDoFCount,\n\t\t\ttranslationFactor,\n\t\t\trotationFactor,\n\t\t} = this;\n\n\t\t// TODO: abstract this\n\t\tconst affectedClosures = this.affectedClosures;\n\t\tconst affectedConnectedClosures = this.affectedConnectedClosures;\n\n\t\tlet colIndex = 0;\n\t\tfor ( let c = 0, tc = freeJoints.length; c < tc; c ++ ) {\n\n\t\t\t// TODO: If this is a goal we should skip adding it to the jacabian columns\n\t\t\tconst freeJoint = freeJoints[ c ];\n\t\t\tconst relevantClosures = affectedClosures.get( freeJoint );\n\t\t\tconst relevantConnectedClosures = affectedConnectedClosures.get( freeJoint );\n\t\t\tconst dofList = freeJoint.dof;\n\t\t\tconst colCount = freeJoint.translationDoFCount + freeJoint.rotationDoFCount;\n\n\t\t\tconst isLocked = lockedJointDoFCount.has( freeJoint );\n\t\t\tconst lockedDoF = lockedJointDoF.get( freeJoint );\n\n\t\t\t// get the world inverse of the free joint\n\t\t\tmat4.invert( tempInverseMatrixWorld, freeJoint.matrixWorld );\n\n\t\t\t// iterate over every degree of freedom in the joint\n\t\t\tfor ( let co = 0; co < colCount; co ++ ) {\n\n\t\t\t\tconst dof = dofList[ co ];\n\n\t\t\t\t// skip this joint if it's locked\n\t\t\t\tif ( isLocked && lockedDoF[ dof ] ) {\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\tlet rowIndex = 0;\n\n\t\t\t\t// generate the adjusted matrix based on the epsilon for the joint.\n\t\t\t\tlet delta = dof < 3 ? translationStep : rotationStep;\n\t\t\t\tif ( freeJoint.getDeltaWorldMatrix( dof, delta, tempDeltaWorldMatrix ) ) {\n\n\t\t\t\t\tdelta *= - 1;\n\n\t\t\t\t}\n\n\t\t\t\t// Iterate over every target\n\t\t\t\tfor ( let r = 0, tr = targetJoints.length; r < tr; r ++ ) {\n\n\t\t\t\t\tconst targetJoint = targetJoints[ r ];\n\n\t\t\t\t\t// if it's a closure target\n\t\t\t\t\tif ( targetJoint.isClosure ) {\n\n\t\t\t\t\t\tif ( relevantClosures.has( targetJoint ) || relevantConnectedClosures.has( targetJoint ) ) {\n\n\t\t\t\t\t\t\t// TODO: If this is a Goal it only add 1 or 2 fields if only two axes are set. Quat is only\n\t\t\t\t\t\t\t// needed if 3 eulers are used.\n\t\t\t\t\t\t\t// TODO: these could be cached per target joint get the current error within the closure joint\n\n\t\t\t\t\t\t\t// Get the error from child towards the closure target\n\t\t\t\t\t\t\ttargetJoint.getClosureError( tempPos, tempQuat );\n\t\t\t\t\t\t\tif ( relevantConnectedClosures.has( targetJoint ) ) {\n\n\t\t\t\t\t\t\t\t// If this is affecting a link connected to a closure joint then adjust that child link by\n\t\t\t\t\t\t\t\t// the delta rotation.\n\t\t\t\t\t\t\t\tmat4.multiply( targetRelativeToJointMatrix, tempInverseMatrixWorld, targetJoint.child.matrixWorld );\n\t\t\t\t\t\t\t\tmat4.multiply( targetDeltaWorldMatrix, tempDeltaWorldMatrix, targetRelativeToJointMatrix );\n\n\t\t\t\t\t\t\t\t// Get the new error\n\t\t\t\t\t\t\t\tgetMatrixDifference( targetJoint.matrixWorld, targetDeltaWorldMatrix, tempPos2, tempQuat2 );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// If this is directly affecting a closure joint then adjust that child link by the delta\n\t\t\t\t\t\t\t\t// rotation.\n\t\t\t\t\t\t\t\tmat4.multiply( targetRelativeToJointMatrix, tempInverseMatrixWorld, targetJoint.matrixWorld );\n\t\t\t\t\t\t\t\tmat4.multiply( targetDeltaWorldMatrix, tempDeltaWorldMatrix, targetRelativeToJointMatrix );\n\n\t\t\t\t\t\t\t\t// Get the new error\n\t\t\t\t\t\t\t\tgetMatrixDifference( targetDeltaWorldMatrix, targetJoint.child.matrixWorld, tempPos2, tempQuat2 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Get the amount that the rotation and translation error changed due to the\n\t\t\t\t\t\t\t// small DoF adjustment to serve as the derivative.\n\t\t\t\t\t\t\tvec3.subtract( tempPos, tempPos, tempPos2 );\n\t\t\t\t\t\t\tvec3.scale( tempPos, tempPos, translationFactor / delta );\n\n\t\t\t\t\t\t\tvec4.subtract( tempQuat, tempQuat, tempQuat2 );\n\t\t\t\t\t\t\tvec4.scale( tempQuat, tempQuat, rotationFactor / delta );\n\n\t\t\t\t\t\t\tif ( targetJoint.isGoal ) {\n\n\t\t\t\t\t\t\t\tconst { translationDoFCount, rotationDoFCount, dof } = targetJoint;\n\t\t\t\t\t\t\t\tfor ( let i = 0; i < translationDoFCount; i ++ ) {\n\n\t\t\t\t\t\t\t\t\tconst d = dof[ i ];\n\t\t\t\t\t\t\t\t\toutJacobian[ rowIndex + i ][ colIndex ] = tempPos[ d ];\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif ( rotationDoFCount === 3 ) {\n\n\t\t\t\t\t\t\t\t\toutJacobian[ rowIndex + translationDoFCount + 0 ][ colIndex ] = tempQuat[ 0 ];\n\t\t\t\t\t\t\t\t\toutJacobian[ rowIndex + translationDoFCount + 1 ][ colIndex ] = tempQuat[ 1 ];\n\t\t\t\t\t\t\t\t\toutJacobian[ rowIndex + translationDoFCount + 2 ][ colIndex ] = tempQuat[ 2 ];\n\t\t\t\t\t\t\t\t\toutJacobian[ rowIndex + translationDoFCount + 3 ][ colIndex ] = tempQuat[ 3 ];\n\t\t\t\t\t\t\t\t\trowIndex += 4;\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\trowIndex += translationDoFCount;\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// set translation\n\t\t\t\t\t\t\t\toutJacobian[ rowIndex + 0 ][ colIndex ] = tempPos[ 0 ];\n\t\t\t\t\t\t\t\toutJacobian[ rowIndex + 1 ][ colIndex ] = tempPos[ 1 ];\n\t\t\t\t\t\t\t\toutJacobian[ rowIndex + 2 ][ colIndex ] = tempPos[ 2 ];\n\n\t\t\t\t\t\t\t\t// set rotation\n\t\t\t\t\t\t\t\toutJacobian[ rowIndex + 3 ][ colIndex ] = tempQuat[ 0 ];\n\t\t\t\t\t\t\t\toutJacobian[ rowIndex + 4 ][ colIndex ] = tempQuat[ 1 ];\n\t\t\t\t\t\t\t\toutJacobian[ rowIndex + 5 ][ colIndex ] = tempQuat[ 2 ];\n\t\t\t\t\t\t\t\toutJacobian[ rowIndex + 6 ][ colIndex ] = tempQuat[ 3 ];\n\t\t\t\t\t\t\t\trowIndex += 7;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// if the target isn't relevant then there's no delta\n\t\t\t\t\t\t\tlet totalRows = 7;\n\t\t\t\t\t\t\tif ( targetJoint.isGoal ) {\n\n\t\t\t\t\t\t\t\ttotalRows = targetJoint.translationDoFCount;\n\t\t\t\t\t\t\t\tif ( targetJoint.rotationDoFCount === 3 ) {\n\n\t\t\t\t\t\t\t\t\ttotalRows += 4;\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < totalRows; i ++ ) {\n\n\t\t\t\t\t\t\t\toutJacobian[ rowIndex + i ][ colIndex ] = 0;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\trowIndex += totalRows;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check if this joint has a target set and update the jacobian rows if it does\n\t\t\t\t\tif ( targetJoint.targetSet ) {\n\n\t\t\t\t\t\tconst rowCount = targetJoint.translationDoFCount + targetJoint.rotationDoFCount;\n\n\t\t\t\t\t\tif ( freeJoint === targetJoint ) {\n\n\t\t\t\t\t\t\t// if we're just dealing with a target dof joint then there can't be any influence\n\t\t\t\t\t\t\t// but otherwise the only joint that can have an effect on this error is the joint\n\t\t\t\t\t\t\t// itself.\n\t\t\t\t\t\t\t// TODO: Having noted that is this really necessary? Is there any way that this doesn't just\n\t\t\t\t\t\t\t// jump to the solution and lock? How can we afford some slack? With a low weight? Does that\n\t\t\t\t\t\t\t// get applied here?\n\t\t\t\t\t\t\t// TODO: If this joint happens to have three euler joints we need to use a quat here. Otherwise we\n\t\t\t\t\t\t\t// use the euler angles.\n\t\t\t\t\t\t\tfor ( let i = 0; i < rowCount; i ++ ) {\n\n\t\t\t\t\t\t\t\toutJacobian[ rowIndex + colIndex ][ colIndex ] = - 1;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < rowCount; i ++ ) {\n\n\t\t\t\t\t\t\t\toutJacobian[ rowIndex + i ][ colIndex ] = 0;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\trowIndex += rowCount;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tcolIndex ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( colIndex !== outJacobian[ 0 ].length ) {\n\n\t\t\tthrow new Error();\n\n\t\t}\n\n\t}", "function solveAC() {\n \"use strict\";\n var matrix = [], eq = [], i, j, k, l, controller1, controller2, expr = [], t, r, b_index;\n /*For each node we write an equation. Each equation has n terms: (n-1) variable coefficients and 1 known term.*/\nnodes_cycle:\n for (i = 1; i < Point.cur_ID; ++i) {\n /*Initializes all the equation terms to 0.*/\n for (j = 0; j < Point.cur_ID; ++j) {\n eq[j] = new Complex(0, 0);\n }\nbranches_cycle:\n /*Each branch j adjacent to the node i contributes to some terms of the equation, depending on its type.*/\n for (j = 0; j < nodes[i].branches.length; ++j) {\n b_index = nodes[i].branches[j]; //branch index\n t = branches[b_index].T; //type of the branch\n switch (t) {\n //At first, we ignore voltage generators and wires, so we skip to the next adjacent branch.\n case \"voltage\":\n case \"wire\":\n case \"voltagealpha\":\n case \"voltagebeta\":\n continue branches_cycle;\n //For current generator, we add (or sub, depending on its orientation) its value to the known term of the equation (last column).\n case \"current\":\n if (branches[b_index].point2ID === i) { //direction of the generator\n eq[Point.cur_ID - 1] = add(eq[Point.cur_ID - 1], branches[b_index].V_AC);\n } else {\n eq[Point.cur_ID - 1] = sub(eq[Point.cur_ID - 1], branches[b_index].V_AC);\n }\n break;\n //For current controlled current sources, we find its current expression and add (or sub) it to the equation.\n case \"currentalpha\":\n controller1 = branches[b_index].I;\n expr = getIntensityExpressionAC(branches[controller1], branches[controller1].point2ID); //doesn't matter if point2ID or point1ID\n if (branches[b_index].point2ID === i) { //direction of the generator\n eq[Point.cur_ID - 1] = add(eq[Point.cur_ID - 1], mul(branches[b_index].V_AC, expr[Point.cur_ID - 1])); //known term; V_AC stores alpha\n for (k = 0; k < Point.cur_ID - 1; ++k) {\n eq[k] = sub(eq[k], mul(branches[b_index].V_AC, expr[k])); //-alpha * voltage terms\n }\n } else {\n eq[Point.cur_ID - 1] = sub(eq[Point.cur_ID - 1], mul(branches[b_index].V_AC, expr[Point.cur_ID - 1])); //alpha * known term of expr\n for (k = 0; k < Point.cur_ID - 1; ++k) {\n eq[k] = add(eq[k], mul(branches[b_index].V_AC, expr[k])); //+alpha * voltage terms\n }\n }\n break;\n //For current sources controlled by potential difference, we add (or subtract) the factor beta to the controller terms of the equation\n case \"currentbeta\":\n controller1 = branches[b_index].VA; //index of the first controller node\n controller2 = branches[b_index].VB; //index of the second controller node\n if (branches[b_index].point2ID === i) { //direction of the generator\n if (controller1 > 0) { //the ground doesn't have its own term in the equation\n eq[controller1 - 1] = sub(eq[controller1 - 1], branches[b_index].V_AC); //-beta (in the first controller term)\n }\n if (controller2 > 0) {\n eq[controller2 - 1] = add(eq[controller2 - 1], branches[b_index].V_AC); //+beta (in the second controller term)\n }\n } else {\n if (controller1 > 0) {\n eq[controller1 - 1] = add(eq[controller1 - 1], branches[b_index].V_AC); //+beta\n }\n if (controller2 > 0) {\n eq[controller2 - 1] = sub(eq[controller2 - 1], branches[b_index].V_AC); //-beta\n }\n }\n break;\n /*For passive components, we need to calculate the self-admittance and mutual-admittance terms.*/\n case \"resistor\":\n case \"inductor\":\n case \"capacitor\":\n eq[i - 1] = add(eq[i - 1], (inv(branches[b_index].V_AC))); //self-admittance\n if (branches[b_index].point1ID === i) { //direction of the component\n if (branches[b_index].point2ID !== 0) {\n eq[branches[b_index].point2ID - 1] = sub(eq[branches[b_index].point2ID - 1], (inv(branches[b_index].V_AC))); //mutual admittance\n }\n } else {\n if (branches[b_index].point1ID !== 0) {\n eq[branches[b_index].point1ID - 1] = sub(eq[branches[b_index].point1ID - 1], (inv(branches[b_index].V_AC)));\n }\n }\n break;\n } //end of switch\n } //end of branches_cycle\n /*Appends the new equation to the equations matrix*/\n matrix[matrix.length] = [];\n for (j = 0; j < Point.cur_ID; ++j) {\n matrix[matrix.length - 1][j] = eq[j];\n }\n }\n /*Our system of equations is incomplete yet. We've skipped voltage generators, wires and so on. Now, we must write as many equation as the skipped component. Again, the structure of the equation depends on the branch typology. Note that we're still following nodal analysis rules about equation writing.*/\n k = 0; //k is used as index of the component of which we need to write an equation. It's initialized to 0, then a scan through all branches is performed.\n for (i = 1; i < Point.cur_ID; ++i) {\n //For each node adjacent to a \"skipped component\", that is all nodes with a non-negative partition number.\n if (nodes[i].partition !== -1) {\n r = nodes[i].partition; //r is the index of the root node for the path to which i belongs.\n /*If i isn't the root itself, and ground isn't the root, we move (adding) the equation of i to the equation of the root.\n At the end, the root node will contain the sum of the equations of its nodes.\n On the contrary, we'll use non-root slots to hold the equations of each single skipped element (like voltage generators).\n */\n if ((i !== r) && (r !== 0)) {\n for (j = 0; j < Point.cur_ID; ++j) {\n matrix[r - 1][j] = add(matrix[r - 1][j], matrix[i - 1][j]);\n }\n }\n /*If i isn't the root, we replace its content with the equation of one of the skipped components. There's no information loss in this replacement, since we've already moved its content elsewhere in the previous statements.*/\n if (i !== r) {\n //clear the equation\n for (j = 0; j < Point.cur_ID; ++j) {\n matrix[i - 1][j] = new Complex(0, 0);\n }\n //find the next component of which we need to write an equation, k will be its index.\n while ((branches[k].T !== \"voltage\" && branches[k].T !== \"wire\" && branches[k].T !== \"voltagealpha\" && branches[k].T !== \"voltagebeta\") && (k < branches.length)) { //cerca il prossimo gen. di tensione da scrivere\n ++k;\n }\n //the equation pattern is something like v1 - v2 = <something>, where something depends on the type.\n if (branches[k].point1ID > 0) { //+v2, unless ground node\n matrix[i - 1][branches[k].point1ID - 1] = new Complex(-1, 0);\n }\n if (branches[k].point2ID > 0) { //-v1, unless ground node\n matrix[i - 1][branches[k].point2ID - 1] = new Complex(1, 0);\n }\n switch (branches[k].T) {\n //for independent voltage generators, <something> is exactly the value of the generator.\n case \"voltage\":\n matrix[i - 1][Point.cur_ID - 1] = branches[k].V_AC;\n break;\n //for voltages generators controlled by voltage, <something> is alpha*(vA-vB)\n case \"voltagealpha\":\n controller1 = branches[k].VA;\n controller2 = branches[k].VB;\n if (controller1 > 0) {\n matrix[i - 1][controller1 - 1] = sub(matrix[i - 1][controller1 - 1], branches[k].V_AC); //-alpha*vB\n }\n if (controller2 > 0) {\n matrix[i - 1][controller2 - 1] = add(matrix[i - 1][controller2 - 1], branches[k].V_AC); //+alpha*vA\n }\n break;\n //For voltages generators controlled by current, first we need to find the current expression. Then <something> is beta*expression\n case \"voltagebeta\":\n controller1 = branches[k].I;\n expr = getIntensityExpressionAC(branches[controller1], branches[controller1].point2ID);\n matrix[i - 1][Point.cur_ID - 1] = add(matrix[i - 1][Point.cur_ID - 1], mul(branches[k].V_AC, expr[Point.cur_ID - 1])); //alpha * known term of expr\n for (l = 0; l < Point.cur_ID - 1; ++l) {\n matrix[i - 1][l] = sub(matrix[i - 1][l], mul(branches[k].V_AC, expr[l])); //alpha * each term of expr\n }\n break;\n }\n ++k; //needed, otherwise we cycle on the same generator\n }\n }\n }\n /*Once the equation matrix is complete, we solve it through Gauss elimination and return the result (voltages)*/\n return complexGaussElimination(matrix);\n}", "_createJacobian (parameters, eigenVectors) {\n const jacobian = numeric.rep(\n [2 * this.numPatches, this.numParameters + 4],\n 0.0\n );\n let j0;\n let j1;\n for (let i = 0; i < this.numPatches; i++) {\n // 1\n j0 = this.meanShape[i][0];\n j1 = this.meanShape[i][1];\n for (let p = 0; p < this.numParameters; p++) {\n j0 += parameters[p + 4] * eigenVectors[i * 2][p];\n j1 += parameters[p + 4] * eigenVectors[(i * 2) + 1][p];\n }\n jacobian[i * 2][0] = j0;\n jacobian[(i * 2) + 1][0] = j1;\n // 2\n j0 = this.meanShape[i][1];\n j1 = this.meanShape[i][0];\n for (let p = 0; p < this.numParameters; p++) {\n j0 += parameters[p + 4] * eigenVectors[(i * 2) + 1][p];\n j1 += parameters[p + 4] * eigenVectors[i * 2][p];\n }\n jacobian[i * 2][1] = -j0;\n jacobian[(i * 2) + 1][1] = j1;\n // 3\n jacobian[i * 2][2] = 1;\n jacobian[(i * 2) + 1][2] = 0;\n // 4\n jacobian[i * 2][3] = 0;\n jacobian[(i * 2) + 1][3] = 1;\n // the rest\n for (let j = 0; j < this.numParameters; j++) {\n j0 = (\n parameters[0] *\n eigenVectors[i * 2][j] - parameters[1] *\n eigenVectors[(i * 2) + 1][j] + eigenVectors[i * 2][j]\n );\n j1 = (\n parameters[0] *\n eigenVectors[(i * 2) + 1][j] + parameters[1] *\n eigenVectors[i * 2][j] + eigenVectors[(i * 2) + 1][j]\n );\n jacobian[i * 2][j + 4] = j0;\n jacobian[(i * 2) + 1][j + 4] = j1;\n }\n }\n\n return jacobian;\n }", "function setupBondMatrix()\n{\n for (var k=0;k<2;k++)\n for (var j=0;j<chemVecSize;j++)\n for (var i=0;i<chemVecSize;i++)\n {\n bondMatrix[k].x[i+j*chemVecSize] = \n\t LOCALITY*( (i==j) + OFFDIAG*(2*Math.random()-1));\n }\n}", "function TranslationalConstraint(joint, limitMotor) {\n\t\tthis.cfm = NaN;\n\t\tthis.m1 = NaN;\n\t\tthis.m2 = NaN;\n\t\tthis.i1e00 = NaN;\n\t\tthis.i1e01 = NaN;\n\t\tthis.i1e02 = NaN;\n\t\tthis.i1e10 = NaN;\n\t\tthis.i1e11 = NaN;\n\t\tthis.i1e12 = NaN;\n\t\tthis.i1e20 = NaN;\n\t\tthis.i1e21 = NaN;\n\t\tthis.i1e22 = NaN;\n\t\tthis.i2e00 = NaN;\n\t\tthis.i2e01 = NaN;\n\t\tthis.i2e02 = NaN;\n\t\tthis.i2e10 = NaN;\n\t\tthis.i2e11 = NaN;\n\t\tthis.i2e12 = NaN;\n\t\tthis.i2e20 = NaN;\n\t\tthis.i2e21 = NaN;\n\t\tthis.i2e22 = NaN;\n\t\tthis.motorDenom = NaN;\n\t\tthis.invMotorDenom = NaN;\n\t\tthis.invDenom = NaN;\n\t\tthis.ax = NaN;\n\t\tthis.ay = NaN;\n\t\tthis.az = NaN;\n\t\tthis.r1x = NaN;\n\t\tthis.r1y = NaN;\n\t\tthis.r1z = NaN;\n\t\tthis.r2x = NaN;\n\t\tthis.r2y = NaN;\n\t\tthis.r2z = NaN;\n\t\tthis.t1x = NaN;\n\t\tthis.t1y = NaN;\n\t\tthis.t1z = NaN;\n\t\tthis.t2x = NaN;\n\t\tthis.t2y = NaN;\n\t\tthis.t2z = NaN;\n\t\tthis.l1x = NaN;\n\t\tthis.l1y = NaN;\n\t\tthis.l1z = NaN;\n\t\tthis.l2x = NaN;\n\t\tthis.l2y = NaN;\n\t\tthis.l2z = NaN;\n\t\tthis.a1x = NaN;\n\t\tthis.a1y = NaN;\n\t\tthis.a1z = NaN;\n\t\tthis.a2x = NaN;\n\t\tthis.a2y = NaN;\n\t\tthis.a2z = NaN;\n\t\tthis.lowerLimit = NaN;\n\t\tthis.upperLimit = NaN;\n\t\tthis.limitVelocity = NaN;\n\t\tthis.limitState = 0; // -1: at lower, 0: locked, 1: at upper, 2: free\n\t\tthis.enableMotor = false;\n\t\tthis.motorSpeed = NaN;\n\t\tthis.maxMotorForce = NaN;\n\t\tthis.maxMotorImpulse = NaN;\n\n\t\tthis.limitMotor = limitMotor;\n\t\tthis.b1 = joint.body1;\n\t\tthis.b2 = joint.body2;\n\t\tthis.p1 = joint.anchorPoint1;\n\t\tthis.p2 = joint.anchorPoint2;\n\t\tthis.r1 = joint.relativeAnchorPoint1;\n\t\tthis.r2 = joint.relativeAnchorPoint2;\n\t\tthis.l1 = this.b1.linearVelocity;\n\t\tthis.l2 = this.b2.linearVelocity;\n\t\tthis.a1 = this.b1.angularVelocity;\n\t\tthis.a2 = this.b2.angularVelocity;\n\t\tthis.i1 = this.b1.inverseInertia;\n\t\tthis.i2 = this.b2.inverseInertia;\n\t\tthis.limitImpulse = 0;\n\t\tthis.motorImpulse = 0;\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets default footer template
_setDefaultFooterTemplate(initialization) { const that = this; that.$.calendarDropDown.footerTemplate = that._defaultFooterTemplate; if (initialization) { that.$.calendarDropDown._handleLayoutTemplate(that.$.calendarDropDown.$.footer, that._defaultFooterTemplate); } that._hourElement = that.$.calendarDropDown.getElementsByClassName('jqx-hour-element')[0]; that._minuteElement = that.$.calendarDropDown.getElementsByClassName('jqx-minute-element')[0]; that._ampmElement = that.$.calendarDropDown.getElementsByClassName('jqx-am-pm-element')[0]; that._todayElement = that.$.calendarDropDown.getElementsByClassName('jqx-today-element')[0]; that._todayElement.title = that.localize('now'); Array.from(that.$.calendarDropDown.$.footer.getElementsByTagName('jqx-repeat-button')).forEach(function (button) { button.animation = that.animation; }); that._addCalendarFooterListeners(); that._defaultFooterTemplateApplied = true; }
[ "_setDefaultFooterTemplate(initialization) {\n const that = this;\n\n that.$.calendarDropDown.footerTemplate = that._defaultFooterTemplate;\n\n if (initialization) {\n that.$.calendarDropDown._handleLayoutTemplate(that.$.calendarDropDown.$.footer, that._defaultFooterTemplate);\n }\n\n that._hourElement = that.$.calendarDropDown.getElementsByClassName('smart-hour-element')[0];\n that._minuteElement = that.$.calendarDropDown.getElementsByClassName('smart-minute-element')[0];\n that._ampmElement = that.$.calendarDropDown.getElementsByClassName('smart-am-pm-element')[0];\n that._todayElement = that.$.calendarDropDown.getElementsByClassName('smart-today-element')[0];\n\n that._todayElement.title = that.localize('now');\n\n Array.from(that.$.calendarDropDown.$.footer.getElementsByTagName('smart-repeat-button')).forEach(function (button) {\n button.animation = that.animation;\n });\n\n that._addCalendarFooterListeners();\n\n that._defaultFooterTemplateApplied = true;\n }", "function setFooter() {\n var count = setCountLeft();\n var s = true;\n var all = true;\n var active = false;\n var completed = false;\n\n if (count == 1) {\n s = false;\n }\n\n var url = window.location.hash;\n\n if (url == '#/active') {\n all = false;\n active = true;\n $(\"#footer\").show();\n } else if (url == '#/completed') {\n all = false;\n completed = true;\n $(\"#footer\").show();\n }\n\n var html = ss.tmpl['todo-footer'].render({\n countLeft: count,\n countComplete: todosLocalLength - count,\n s: s,\n all: all,\n active: active,\n completed: completed,\n });\n $(\"#footer\").html('');\n $(html).appendTo('#footer');\n}", "get footerTemplate() {\n\t\treturn this.nativeElement ? this.nativeElement.footerTemplate : undefined;\n\t}", "getDefaultFooter() {\n\t\tconst footer = document.createElement('div');\n\t\tfooter.className = 'modal-footer';\n\t\tfooter.innerHTML = `<pretty-button value=\"Cancel\" id=\"cancel\"></pretty-button>\n\t\t\t<pretty-button type=\"primary\" value=\"Ok\" id=\"submit\"></pretty-button>\n\t\t`;\n\t\treturn footer;\n\t}", "function FOOTER$static_(){ToolbarSkin.FOOTER=( new ToolbarSkin(\"footer\"));}", "function createDefaultFooter() {\n footer = document.createElement(\"footer\");\n\n let footerContainer = document.createElement(\"div\");\n footerContainer.setAttribute(\"id\", \"footerContainer\");\n footer.appendChild(footerContainer);\n\n let zaanLogo = document.createElement(\"img\");\n zaanLogo.setAttribute(\"src\", \"/img/ZAAN/ZAAN_Logo_Invert_NoText.svg\");\n zaanLogo.setAttribute(\"height\", \"60px\");\n zaanLogo.setAttribute(\"alt\", \"ZAAN Games Logo\");\n zaanLogo.setAttribute(\"onerror\", \"this.src='./img/ZAAN/ZAAN_Logo_Invert_NoText_Small.png\");\n footerContainer.appendChild(zaanLogo);\n\n let emailParagraph = document.createElement(\"p\");\n let emailText = document.createTextNode(\"General @ Mytholympics.com\");\n emailParagraph.appendChild(emailText);\n footerContainer.appendChild(emailParagraph);\n\n let copyrightHeader = document.createElement(\"h2\");\n let copyrightText = document.createTextNode(\"ZAAN Games \\u00A9 2018\");\n copyrightHeader.appendChild(copyrightText);\n footerContainer.appendChild(copyrightHeader);\n\n document.body.appendChild(footer);\n\n handleFooterPositioning();\n}", "function footerChangeRegion() {\n app.getView().render('components/footer/footerchangeregion');\n}", "renderFooter() {\n return null;\n }", "setFooter(options) {\n if (options === null) {\n this.footer = undefined;\n return this;\n }\n const { text, iconURL } = options;\n // Data assertions\n ow_1.default(text, 'text', Assertions_1.footerTextPredicate);\n ow_1.default(iconURL, 'iconURL', Assertions_1.urlPredicate);\n this.footer = { text, icon_url: iconURL };\n return this;\n }", "renderFooter() {\n return null;\n }", "displayFooter() {\n const { footer } = this.tool.options;\n if (footer) {\n this.out(footer, 1);\n }\n }", "function resetFooter() {\n var footer = doc.getFooter();\n var paragraphs = footer.getParagraphs();\n var doctrack = \"##doctrack##\\t\";\n\n // Update the first line of the footer\n e0 = paragraphs[0];\n e0.replaceText('^.*$', '##docfilename##\\tWorking Draft ##docrev##\\t##docdate##');\n \n // Update the second line of the footer\n e1 = paragraphs[1];\n e1.replaceText('^[a-zA-Z\\-\\\\s]+\\t', doctrack);\n}", "function setFooter(stats) {\n var footer = '';\n if (stats.show == 'true') {\n if (stats.type.value == \"image\") {\n footer = '<div id=\"footer\" style=\"z-index:30;text-align:' + stats.align.value + ';\"> <img src=\"' + basePath + 'images/' + stats.logo + '\" /></div>';\n }\n else {\n footer = '<div id=\"footer\" style=\"z-index:3;position:absolute;width:100%;text-align:' + stats.align.value + ';\"><div class=\"font-setter\" style=\"z-index:3;font-size:' + stats.size.value + ';\">' + stats.text + '</div></div>';\n }\n }\n return footer;\n }", "function EMBEDDED_FOOTER$static_(){ToolbarSkin.EMBEDDED_FOOTER=( new ToolbarSkin(\"embedded-footer\"));}", "buildFooter() {\n this.footer = document.createElement('footer');\n this.footer.appendChild(this.buildItemCounter());\n this.footer.appendChild(this.buildActivityNotifier());\n }", "function appendFooter(){\n var footer = \"<div class='footer'>\";\n footer += \"<center><div class='copyrightText'>&copy; 2017 ITEE Group Canada</div></center>\";\n footer += \"</div>\";\n $('body').append(footer);\n }", "goToFooter() {\n this.owner.enableHeaderAndFooter = true;\n this.enableHeadersFootersRegion(this.start.paragraph.bodyWidget.page.footerWidget);\n }", "function createFooter() {\n\n // append footer to page\n content.appendChild(footer);\n \n h3.textContent = \"Footer of Website\";\n footer.appendChild(h3);\n }", "function insertFooter () {\n \"use strict\";\n try {\n var footer;\n\t\t\t/* There are at least one, and maybe more, courses that are developed in partnership with BYU or BYU-Hawaii and require that to be displayed in the copyright. Checking here for customCopyright allows for those courses to create this variable with the custom text in the course.js file before the online.js is appended and then will use the custom text */\n\t\t\tif (typeof customCopyright === \"undefined\") {\n\t\t\t\tfooter = \"<div id='footer'>Copyright &copy; \" + new Date().getFullYear() + \" by Brigham Young University - Idaho. All Rights Reserved.</div>\";\n\t\t\t} else {\n\t\t\t\tfooter = \"<div id='footer'>\" + customCopyright + \"</div>\";\n\t\t\t}\n document.getElementById(\"main\").insertAdjacentHTML(\"beforeend\", footer); \n } catch (ex) {\n console.log(ex.name + \": \" + ex.message);\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resize the iframe to be the size of the article.
function resizeIframe(iframe) { iframe.height = iframe.contentWindow.document.body.scrollHeight + "px"; }
[ "function _resizeIframe() {\n if (isOn && $iframe) {\n var chatBoxWidth = chatBox.$panel.innerWidth() + \"px\";\n $iframe.attr(\"width\", chatBoxWidth);\n }\n }", "function sizeFrame(){\r\nvar frameWidth = $('.slide iframe').width();\r\nvar aspect = (frameWidth * 0.75)\r\n$('.slide iframe').css('height', aspect);\r\n}", "function resize() {\n if ($('#presentation>iframe')) {\n $('#presentation>iframe').width(getPresentationWidth());\n $('#presentation>iframe').height(getPresentationHeihgt());\n }\n}", "function iframeResizer(iframe){\n if (iframe.is(':visible') && iframe.attr('sandbox') === undefined) {\n iframe.contents().find(\"body\").css({margin:0});\n iframe.contents().find(\"body > pre\").css({whiteSpace:'pre-wrap',margin : 0,fontSize : '12px',fontFamily: 'consolas, monaco, menlo, courier', wordWrap:'break-word', '-ms-word-wrap':'break-word', overflow:'hidden'});\n setTimeout(function(){\n jQuery('iframe').each(function(){\n iframe.height(iframe.contents().find(\"body\").height());\n });\n }, 200);\n }\n}", "resizeIframe(event) {\n const pdfHeightWidthRatio = 11 / 8.5; // height:width ratio for one-page pdf\n let iframe = event.target;\n let frameWidth = iframe.clientWidth; // width of iframe in HTML doc\n // scale the height of the iframe based on its computed width\n let frameHeight = frameWidth * pdfHeightWidthRatio;\n iframe.style.height = frameHeight + 'px';\n }", "static resizeIframe() {\n const calculatePageY = (elem) => {\n return elem.offsetParent\n ? elem.offsetTop + calculatePageY(elem.offsetParent)\n : elem.offsetTop;\n };\n\n let height = document.documentElement.clientHeight;\n height -= calculatePageY(document.getElementById(\"jitsiWindow\"));\n height = height < 0 ? 0 : height;\n\n document.getElementById(\"jitsiWindow\").style.height = `${height}px`;\n document.getElementById(\"jitsiWindow\").style.width = `calc(100% + 8px)`;\n }", "function ResizeContentIframe(frameId, newHeight) {\n $(\"#\" + frameId).css(\"height\", newHeight);\n}", "function resize() {\n\n // wb_container >> content >> pane\n var $wb_container = $container.parent().parent();\n \tvar scale = $wb_container.height() / NATIVE_IFRAME_HEIGHT;\n\n $iframe_holder.css({\n \twidth : $iframe_holder.parent().width(),\n\t\t\theight : $iframe_holder.parent().height(),\n });\n\n $iframe.css({\n \ttransform : 'scale({0}, {0})'.f(scale),\n\t\t\twidth : $iframe_holder.width() / scale / (pos in css_w ? 2 : 1),\n\t\t\theight : $iframe_holder.height() / scale / (pos == 'top' ? 2 : 1),\n\t\t});\n }", "function adjustEditorHeight() {\n editor.setSize(\"100%\", $iframe.offsetHeight);\n }", "function resizeTo(width, height) {\n var containerElm, iframeElm, containerSize, iframeSize;\n\n function getSize(elm) {\n return {\n width: elm.clientWidth,\n height: elm.clientHeight\n };\n }\n\n containerElm = editor.getContainer();\n iframeElm = editor.getContentAreaContainer().firstChild;\n containerSize = getSize(containerElm);\n iframeSize = getSize(iframeElm);\n\n if (width !== null) {\n width = Math.max(settings['min_width'] || 100, width);\n width = Math.min(settings['max_width'] || 0xFFFF, width);\n\n DOM.css(containerElm, 'width', width + (containerSize.width - iframeSize.width));\n DOM.css(iframeElm, 'width', width);\n }\n\n height = Math.max(settings['min_height'] || 100, height);\n height = Math.min(settings['max_height'] || 0xFFFF, height);\n DOM.css(iframeElm, 'height', height);\n\n editor.fire('ResizeEditor');\n }", "function postIframeResize() {\n var newheight;\n if (document.getElementById) {\n newheight = parent.document.getElementById(UNIPOOLE_GLOBAL.IFRAME_ID).contentWindow.document.body.scrollHeight;\n }\n jQuery('#' + UNIPOOLE_GLOBAL.IFRAME_ID, parent.document).attr('style', \"height: \" + (newheight) + \"px;\");\n}", "function resizeTo(width, height) {\n\t\tvar containerElm, iframeElm, containerSize, iframeSize;\n\n\t\tfunction getSize(elm) {\n\t\t\treturn {\n\t\t\t\twidth: elm.clientWidth,\n\t\t\t\theight: elm.clientHeight\n\t\t\t};\n\t\t}\n\n\t\tcontainerElm = editor.getContainer();\n\t\tiframeElm = editor.getContentAreaContainer().firstChild;\n\t\tcontainerSize = getSize(containerElm);\n\t\tiframeSize = getSize(iframeElm);\n\n\t\tif (width !== null) {\n\t\t\twidth = Math.max(settings.min_width || 100, width);\n\t\t\twidth = Math.min(settings.max_width || 0xFFFF, width);\n\n\t\t\tDOM.setStyle(containerElm, 'width', width + (containerSize.width - iframeSize.width));\n\t\t\tDOM.setStyle(iframeElm, 'width', width);\n\t\t}\n\n\t\theight = Math.max(settings.min_height || 100, height);\n\t\theight = Math.min(settings.max_height || 0xFFFF, height);\n\t\tDOM.setStyle(iframeElm, 'height', height);\n\n\t\teditor.fire('ResizeEditor');\n\t}", "fitToParent() {\n this.iframe.setAttribute('height', this.container.offsetHeight);\n this.iframe.setAttribute('width', this.container.offsetWidth);\n }", "function parentIframeResize() {\r\n\tvar height = getParam('height');\r\n\t// This works as our parent's parent is on our domain\r\n\tparent.parent.resizeIframe(height);\r\n}", "function resize(width, height) {\n JFCustomWidget.requestFrameResize({\n width: width,\n height: height,\n })\n}", "sizeiframe(size, animate) {\n let theSize;\n const self = this;\n\n // @todo: refactor to better handle the iframe async rendering\n if (this.iframe) {\n if (animate === true) {\n this.iframeContainer.classList.add('is-animating');\n this.iframe.classList.add('is-animating');\n }\n\n if (size < maxViewportWidth) {\n theSize = size;\n } else {\n //If the entered size is larger than the max allowed viewport size, cap value at max vp size\n theSize = maxViewportWidth;\n }\n\n if (size < minViewportWidth) {\n //If the entered size is less than the minimum allowed viewport size, cap value at min vp size\n theSize = minViewportWidth;\n }\n\n if (theSize > this.clientWidth) {\n theSize = this.clientWidth;\n }\n\n // resize viewport wrapper to desired size + size of drag resize handler\n // this.iframeContainer.style.width = theSize + this.viewportResizeHandleWidth + 'px';\n this.iframeContainer.style.width = theSize + 'px';\n // this.iframe.style.width = theSize + 'px'; // resize viewport to desired size\n\n // auto-remove transition classes if not the animate param isn't set to true\n setTimeout(function () {\n if (animate === true) {\n self.iframeContainer.classList.remove('is-animating');\n self.iframe.classList.remove('is-animating');\n }\n }, 800);\n\n const targetOrigin =\n window.location.protocol === 'file:'\n ? '*'\n : window.location.protocol + '//' + window.location.host;\n\n const obj = JSON.stringify({\n event: 'patternLab.resize',\n resize: 'true',\n });\n\n // only tell the iframe to resize when it's ready\n if (this._hasInitiallyRendered) {\n this.iframe.contentWindow.postMessage(obj, targetOrigin);\n }\n\n this.updateSizeReading(theSize); // update the displayed values in the toolbar\n }\n }", "sizeiframe(size, animate) {\n let theSize;\n const self = this;\n\n // @todo: refactor to better handle the iframe async rendering\n if (this.iframe) {\n if (animate === true) {\n this.iframeContainer.classList.add('is-animating');\n this.iframe.classList.add('is-animating');\n }\n\n if (size < maxViewportWidth) {\n theSize = size;\n } else if (size < minViewportWidth) {\n //If the entered size is less than the minimum allowed viewport size, cap value at min vp size\n theSize = minViewportWidth;\n } else {\n //If the entered size is larger than the max allowed viewport size, cap value at max vp size\n theSize = maxViewportWidth;\n }\n\n if (theSize > this.clientWidth) {\n theSize = this.clientWidth;\n }\n\n // resize viewport wrapper to desired size + size of drag resize handler\n // this.iframeContainer.style.width = theSize + this.viewportResizeHandleWidth + 'px';\n this.iframeContainer.style.width = theSize + 'px';\n // this.iframe.style.width = theSize + 'px'; // resize viewport to desired size\n\n // auto-remove transition classes if not the animate param isn't set to true\n setTimeout(function() {\n if (animate === true) {\n self.iframeContainer.classList.remove('is-animating');\n self.iframe.classList.remove('is-animating');\n }\n }, 800);\n\n const targetOrigin =\n window.location.protocol === 'file:'\n ? '*'\n : window.location.protocol + '//' + window.location.host;\n\n const obj = JSON.stringify({\n event: 'patternLab.resize',\n resize: 'true',\n });\n\n // only tell the iframe to resize when it's ready\n if (this._hasInitiallyRendered) {\n this.iframe.contentWindow.postMessage(obj, targetOrigin);\n }\n\n this.updateSizeReading(theSize); // update the displayed values in the toolbar\n }\n }", "hay() {\n this.iframe.sizeiframe(store.getState().app.viewportPx + 1, true);\n }", "function adjustIFrameSize (iframeWindow) {\n if (iframeWindow.document.height) {\n var iframeElement = parent.document.getElementById(iframeWindow.name);\n iframeElement.style.height = (iframeWindow.document.height+2) + 'px';\n iframeElement.style.width = iframeWindow.document.width + 'px';\n }\n else if (document.all) {\n var iframeElement = parent.document.all[iframeWindow.name];\n if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') \n {\n iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 'px';\n iframeElement.style.width = iframeWindow.document.documentElement.scrollWidth + 'px';\n }\n else {\n iframeElement.style.height = iframeWindow.document.body.scrollHeight + 'px';\n iframeElement.style.width = iframeWindow.document.body.scrollWidth + 'px';\n }\n }\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Grab players from sessionStorage and push into players array
function getPlayerStorage() { let storage = JSON.parse(sessionStorage.getItem('players')); for (item in storage) { addPlayer(storage[item].color, storage[item].name); } }
[ "function setPlayerStorage() {\r\n sessionStorage.setItem(\"players\", JSON.stringify(players));\r\n}", "function getPlayers() {\r\n let players;\r\n if (sessionStorage.getItem(\"players\") === null) {\r\n players = [];\r\n } else {\r\n players = JSON.parse(sessionStorage.getItem(\"players\"));\r\n playerOneName.innerHTML = players[0];\r\n playerTwoName.innerHTML = players[1];\r\n document.querySelector(\".input-container\").classList.add(\"hide\");\r\n }\r\n}", "function loadPlayers() {\n //console.log('IN LOAD PLAYERS');\n\n\n storedPlayers =\n JSON.parse(window.localStorage.getItem('players'));\n\n if (storedPlayers !== 0) {\n\n players = storedPlayers;\n }\n else {\n player.cheeseBricks = 100;\n player.currentCheeseBricks = 100;\n players.push(player);\n savePlayer();\n\n }\n}", "playerStorage () {\n this.hangmanPlayers = JSON.parse(this.storage.getItem('hangmanPlayers')) || []\n if (this.solvedWords > 0) {\n let player = {\n nickname: this.playerNick,\n score: this.solvedWords\n }\n this.hangmanPlayers.push(player)\n this.storage.setItem('hangmanPlayers', JSON.stringify(this.hangmanPlayers))\n }\n }", "function addFetchedSongsToStorage(songs) {\n let fetched = [];\n if (sessionStorage.getItem(\"songs\") === null) {\n fetched = [];\n } else {\n fetched = JSON.parse(sessionStorage.getItem(\"songs\"));\n }\n\n fetched.push(songs);\n sessionStorage.setItem(\"songs\", JSON.stringify(fetched));\n}", "function storePlayer() {\n localStorage.setItem(\"player names\", JSON.stringify(playerName));\n localStorage.setItem(\"player scores\", JSON.stringify(hiscoreList));\n}", "function getPlayers() {\n var correctNames = true;\n var currentName;\n var plr = document.getElementsByName('player');\n\n //save all names in an array. If any input field is empty set placeholder as name\n\n for (var j = 0; j < plr.length; j++) {\n currentName = plr[j].value;\n if(currentName == \"\") {\n currentName = \"Player \" + (1 + j);\n }\n players.push(currentName);\n }\n //store array in session storage\n storeInSessionStorage(\"players\", players);\n //move to the game page\n window.location.href = \"./counter.html\";\n}", "function loadPlayers(){\n\tlet players;\n\tplayers = JSON.parse(localStorage.getItem('state'));\n\n\t// Sort the players as per the moves taken by them to finish the game\n\tif (players) {\n\t\tplayers.sort(function(a,b){\n\t\t\treturn a.score.move - b.score.move;\n\t\t});\n\t}else {\n\t\tplayers = [];\n\t}\n\treturn players;\n}", "function sessionStorage2() {\n if (corazon.getAttribute('src') =='zip/assets/icon-fav-active.svg') {\n arraySessionSTorage.push(imgGifs.src);\n //console.log(arraySessionSTorage);\n } else {\n arraySessionSTorage.pop(imgGifs.src);\n //console.log(arraySessionSTorage);\n }\n var arraySession = JSON.stringify(arraySessionSTorage);\n sessionStorage.setItem('nuevoArray', arraySession);\n }", "function addSelectedToStorage(song) {\n let selected;\n\n if (sessionStorage.getItem(\"selected\") === null) {\n selected = [];\n } else {\n selected = JSON.parse(sessionStorage.getItem(\"selected\"));\n }\n\n selected.push(song);\n sessionStorage.setItem(\"selected\", JSON.stringify(selected));\n}", "function sessionStorageExpandir() {\n if (imgfavExpandirGifo_carrusel.src == linkCorazonActive) {\n arraySessionSTorage.push(imgGifs.src);\n console.log(arraySessionSTorage);\n } else {\n arraySessionSTorage.pop(imgGifs.src);\n console.log(arraySessionSTorage);\n }\n var arraySession = JSON.stringify(arraySessionSTorage);\n sessionStorage.setItem('nuevoArray', arraySession);\n }", "function storeLocal() {\n var playersJSON = JSON.stringify(parsedlclStrgObjArr);\n localStorage.setItem('players', playersJSON);\n}", "function setLocalStorage(){\r\n var playerSetter = JSON.stringify(allPlayers);\r\n localStorage.setItem('players', playerSetter);\r\n}", "function savePlayersLocal() {\n // Serialize object to a string for storage using JSON.stringify()\n // and save to local storage\n localStorage.setItem('players', JSON.stringify(players));\n}", "function getPlayerName(){\n return sessionStorage.getItem('name');\n}", "function getSessionUsers() {\n return (JSON.parse(window.sessionStorage.getItem('users')) || []);\n}", "function saveScore(){\n var allPlayers = JSON.parse(localStorage.getItem(\"player\")) || []\n\n var player = {\n playerName: playerInput.value.trim(),\n playerScore: timerCount\n };\n allPlayers.push(player)\n \n localStorage.setItem(\"player\", JSON.stringify(allPlayers))\n }", "function push_in_session(arr) {\n\n\n if (in_the_session.todo_items[0] == \"No Items Present\") {\n in_the_session.todo_items.splice(0, 1);\n var move = JSON.stringify(in_the_session);\n sessionStorage.setItem('current_user', move)\n window.location.reload();\n } else {\n\n console.log(in_the_session);\n var move = JSON.stringify(in_the_session);\n sessionStorage.setItem('current_user', move);\n\n\n\n }\n\n\n}", "function setPlayer() {\n player = sessionStorage.getItem('playerName');\n if ( player === $('#playerName').val()) {\n return\n } else {\n sessionStorage.clear();\n sessionStorage.setItem('playerName', $('#playerName').val());\n sessionStorage.setItem('playerScore', '0');\n }\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the pcb that will be rolled out for a roll in
function get_least_important_pcb() { var worst_pcb; for (pid in _residency) { if (_residency[pid].partition !== undefined && _residency[pid].partition !== null) { worst_pcb = _residency[pid]; } } return worst_pcb; }
[ "function calculatePinsUpRoll2(rolls){\n\treturn 10-rolls;\n}", "determineProposer() {\n let proposerPower = 0;\n this.roundAccumPower.forEach((power, addr) => {\n //this.log(` ${addr} has ${power} (${typeof power}) voting power.`);\n if (power > proposerPower) {\n this.currentProposer = addr;\n proposerPower = power;\n }\n });\n this.log(`The block proposer for ${this.height}-${this.round} is ${this.currentProposer}`);\n this.updateRoundAccumPower(this.currentProposer);\n }", "pick_loot (players, currentLoot, rounds) {\n let bestCardIndex = undefined;\n currentLoot.forEach((card, index) => {\n // If rounds === 1 and the AI player is smart enough don't\n // pick any non loot cards (firstaid or extra clip) as they will serve no purpose\n if (rounds === 1 && this.difficulty > 1) {\n if (card.type !== 'firstaid' && card.type !== 'clip' && currentLoot.length > 1) {\n let bestCard = this.best_card(bestCardIndex, card, currentLoot)\n bestCardIndex = bestCard === card ? index : bestCardIndex\n } else if (currentLoot.length === 1) {\n bestCardIndex = index\n }\n } else {\n let bestCard = this.best_card(bestCardIndex, card, currentLoot)\n bestCardIndex = bestCard === card ? index : bestCardIndex\n }\n })\n return bestCardIndex\n }", "getBoostedLineup(primedRoster, boosts) {\n\t\tfunction tryToAssign(assignments, seeker, bIdealOnly, bCanDisplace, tested = []) {\n\t\t\tlet sDebugPrefix = \"\";\n\t\t\tfor (let i = 0; i < tested.length; i++) {\n\t\t\t\tsDebugPrefix += \"-\";\n\t\t\t}\n\t\t\tsDebugPrefix += \" \";\n\n\t\t\t// Identify state of all viable slots\n\t\t\tlet open_ideal = [], open_viable = [], occupied_ideal = [], occupied_viable = [];\n\t\t\tfor (let i = 0; i < 12; i++) {\n\t\t\t\tif (!seeker.viable_slots[i]) continue;\n\t\t\t\tif (assignments[i].id != \"\") {\n\t\t\t\t\toccupied_viable.push(i);\n\t\t\t\t\tif (seeker.trait_slots[i]) occupied_ideal.push(i);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\topen_viable.push(i);\n\t\t\t\t\tif (seeker.trait_slots[i]) open_ideal.push(i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// 1) Seat in ideal open slot\n\t\t\tif (open_ideal.length > 0) {\n\t\t\t\tdoAssign(assignments, seeker, open_ideal[0], sDebugPrefix);\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// 2A)\n\t\t\tif (bIdealOnly) {\n\t\t\t\t// 2A1) Seat in occupied slot only if everyone moves around willingly\n\t\t\t\tlet idealsTested = [...tested];\n\t\t\t\tfor (let i = 0; i < occupied_ideal.length; i++) {\n\t\t\t\t\tlet slot = occupied_ideal[i];\n\t\t\t\t\t// Ignore slots we've already inquired about by this seeker and descendant seekers\n\t\t\t\t\tif (idealsTested.indexOf(slot) >= 0) continue;\n\t\t\t\t\tidealsTested.push(slot);\n\t\t\t\t\tlet assignee = assignments[slot];\n\t\t\t\t\tassemblyLog += \"\\n\" + sDebugPrefix + seeker.name + \" (\" + seeker.score + \") would be ideal in slot \" + slot + \". Is \" + assignee.name + \" (\" + assignee.score + \") willing and able to move?\";\n\t\t\t\t\tif (tryToAssign(assignments, assignee, true, false, idealsTested)) {\n\t\t\t\t\t\tdoAssign(assignments, seeker, slot, sDebugPrefix);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// 2A2) Seat in occupied slot only if exactly 1 other is able to move from ideal slot\n\t\t\t\tidealsTested = [...tested];\n\t\t\t\tfor (let i = 0; i < occupied_ideal.length; i++) {\n\t\t\t\t\tlet slot = occupied_ideal[i];\n\t\t\t\t\t// Ignore slots we've already inquired about by this seeker and descendant seekers\n\t\t\t\t\tif (idealsTested.indexOf(slot) >= 0) continue;\n\t\t\t\t\tidealsTested.push(slot);\n\t\t\t\t\tlet assignee = assignments[slot];\n\t\t\t\t\tassemblyLog += \"\\n\" + sDebugPrefix + seeker.name + \" (\" + seeker.score + \") insists on being in slot \" + slot + \". Is \" + assignee.name + \" (\" + assignee.score + \") able to move?\";\n\t\t\t\t\tif (tryToAssign(assignments, assignee, false, true, idealsTested)) {\n\t\t\t\t\t\tdoAssign(assignments, seeker, slot, sDebugPrefix);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// 2B)\n\t\t\tif (!bIdealOnly) {\n\t\t\t\t// 2B1) Seat in open slot\n\t\t\t\tif (open_viable.length > 0) {\n\t\t\t\t\tdoAssign(assignments, seeker, open_viable[0], sDebugPrefix);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t// 2B2) Seat in occupied slot only if everyone moves around willingly\n\t\t\t\tlet viablesTested = [...tested];\n\t\t\t\tfor (let i = 0; i < occupied_viable.length; i++) {\n\t\t\t\t\tlet slot = occupied_viable[i];\n\t\t\t\t\t// Ignore slots we've already inquired about by this seeker and descendant seekers\n\t\t\t\t\tif (viablesTested.indexOf(slot) >= 0) continue;\n\t\t\t\t\tviablesTested.push(slot);\n\t\t\t\t\tlet assignee = assignments[slot];\n\t\t\t\t\tif (!seeker.trait_slots[slot] && assignee.trait_slots[slot] && !bCanDisplace)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tassemblyLog += \"\\n\" + sDebugPrefix + seeker.name + \" (\" + seeker.score + \") is inquiring about slot \" + slot + \". Is \" + assignee.name + \" (\" + assignee.score + \") willing and able to move?\";\n\t\t\t\t\tif (tryToAssign(assignments, assignee, false, false, viablesTested)) {\n\t\t\t\t\t\tdoAssign(assignments, seeker, slot, sDebugPrefix);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// 3) Can't seat\n\t\t\tassemblyLog += \"\\n\" + sDebugPrefix + seeker.name + \" (\" + seeker.score + \") will not take a new assignment\";\n\t\t\treturn false;\n\t\t}\n\n\t\tfunction doAssign(assignments, seeker, iAssignment, sPrefix = \"\") {\n\t\t\tlet sIdeal = seeker.trait_slots[iAssignment] ? \"ideal \" : \"\";\n\t\t\tlet sOpen = assignments[iAssignment].id == \"\" ? \"open \": \"\";\n\t\t\tassemblyLog += \"\\n\" + sPrefix + seeker.name + \" (\" + seeker.score + \") accepts \" + sIdeal + \"assignment in \" + sOpen + \"slot \" + iAssignment;\n\t\t\tassignments[iAssignment] = seeker;\n\t\t\tassignments[iAssignment].assignment = iAssignment;\n\t\t\tassignments[iAssignment].isIdeal = seeker.trait_slots[iAssignment];\n\t\t}\n\n\t\tlet assemblyLog = \"\";\t// Only use for debugging in development\n\n\t\tconst trait_boost = 200;\n\n\t\tlet boostedScores = [];\n\t\tfor (let i = 0; i < primedRoster.length; i++) {\n\t\t\tlet baseScore = primedRoster[i].primary_score*boosts.primary +\n\t\t\t\t\t\t\tprimedRoster[i].secondary_score*boosts.secondary +\n\t\t\t\t\t\t\tprimedRoster[i].other_score*boosts.other;\n\t\t\tlet bestScore = baseScore + trait_boost;\n\t\t\tlet baseSlots = [], bestSlots = [];\n\t\t\tfor (let j = 0; j < 12; j++) {\n\t\t\t\tif (!primedRoster[i].viable_slots[j]) continue;\n\t\t\t\tbaseSlots.push(j);\n\t\t\t\tif (primedRoster[i].trait_slots[j]) bestSlots.push(j);\n\t\t\t}\n\t\t\tif (bestSlots.length > 0)\n\t\t\t\tboostedScores.push({ score: bestScore, id: primedRoster[i].id, isIdeal: true });\n\t\t\tif (baseSlots.length > bestSlots.length)\n\t\t\t\tboostedScores.push({ score: baseScore, id: primedRoster[i].id, isIdeal: false });\n\t\t}\n\t\tboostedScores.sort((a, b) => b.score - a.score);\n\n\t\tlet assignments = Array.from({length:12},()=> ({'id': ''}));\n\t\tlet iAssigned = 0;\n\n\t\tlet skipped = [];\n\n\t\twhile (boostedScores.length > 0 && iAssigned < 12) {\n\t\t\tlet testScore = boostedScores.shift();\n\n\t\t\t// Volunteer is already assigned, list other matching slots as alts\n\t\t\tlet repeat = assignments.find(assignee => assignee.id == testScore.id);\n\t\t\tif (repeat) {\n\t\t\t\tassemblyLog += \"\\n~ \" + repeat.name + \" (\" + testScore.score + \") is already assigned to slot \" + repeat.assignment + \" (\" + repeat.score + \") ~\";\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlet volunteer = primedRoster.find(primed => primed.id == testScore.id);\n\t\t\tvolunteer.score = testScore.score;\n\n\t\t\tif (tryToAssign(assignments, volunteer, testScore.isIdeal, testScore.isIdeal)) {\n\t\t\t\tiAssigned++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet bRepeatSkip = skipped.indexOf(volunteer.id) >= 0;\n\t\t\t\tskipped.push(volunteer.id);\n\t\t\t\tif (bRepeatSkip || !testScore.isIdeal)\n\t\t\t\t\tassemblyLog += \"\\n!! Skipping \" + volunteer.name + \" (\" + volunteer.score + \") forever !!\";\n\t\t\t\telse\n\t\t\t\t\tassemblyLog += \"\\n! Skipping \" + volunteer.name + \" (\" + volunteer.score + \") for now !\";\n\t\t\t}\n\t\t}\n\n\t\tif (iAssigned == 12)\n\t\t\treturn new VoyagersLineup(assignments);\n\n\t\treturn false;\n\t}", "function getPoLR(){\n\t\tPoLR=[0,0,0,0,0,0,0,0];\n\t\tfor(i=0;i<3;i++){\n\t\t\tif(game[0][i]==0) PoLR[i]++;\n\t\t\tif(game[1][i]==0) PoLR[i]++;\n\t\t\tif(game[2][i]==0) PoLR[i]++;\n\t\t}\n\t\tfor(i=0;i<3;i++){\n\t\t\tif(game[i][0]==0) PoLR[i+3]++;\n\t\t\tif(game[i][1]==0) PoLR[i+3]++;\n\t\t\tif(game[i][2]==0) PoLR[i+3]++;\n\t\t}\n\t\tif(game[0][0]==0) PoLR[6]++;\n\t\tif(game[1][1]==0) PoLR[6]++;\n\t\tif(game[2][2]==0) PoLR[6]++;\n\n\t\tif(game[0][2]==0) PoLR[7]++;\n\t\tif(game[1][1]==0) PoLR[7]++;\n\t\tif(game[2][0]==0) PoLR[7]++;\n\t}", "function rollTheDice(die, dice, winpaypercent, payoutfactor, pointsbet) {\n\n\n die = 6;\n dice = 3;\n\n var roll = 0;\n for (loop = 0; loop < dice; loop++) {\n roll = roll + Math.round(Math.random() * (die - 1)) + 1;\n }\n\n\n var maxnumberyoucanroll = die * dice;\n\n //so must get at least half to win i.e. in 3 die 6 sides 9 is minimum\n var minnumbertowin = maxnumberyoucanroll * 0.5;\n\n //added for greater flexibility\n if (roll >= minnumbertowin) {\n\n\n }\n\n\n }", "function findOneCombo(nAttacks) {\n\n var newCombo = [], // placeholder for final series of randomly generated attacks\n nextDigit, // temp placeholder for finger char to be verified as possible next finger\n i,\n nextDigitFound,\n index; \n\n\n for (var i = 0; i < nAttacks; i++){\n nextDigitFound = false;\n\n while (!nextDigitFound){\n // find random index\n index = Math.floor(Math.random() * rightHandData.length);\n\n nextDigit = rightHandData[index];\n\n if ((nextDigit == 'p') || (nextDigit != newCombo[i-1])){\n newCombo.push( nextDigit );\n nextDigitFound = true;\n }\n }\n }\n\n return newCombo;\n }", "function getPayout(sum) {\n\n}", "function $btl_cases() {\n return $pallets * 72;\n }", "function getPCB(pid) {\n for (var i = 0; i < ResidentList.length; i++) {\n if (ResidentList[i].pid === parseInt(pid))\n return ResidentList[i];\n }\n _StdIn.putText(\"No such process with PID \" + pid);\n return null;\n}", "function rollB(){\n \t\tpin1=pin2=pin3=pin4=pin5=pin6=pin7=pin8=pin9=pin10 = 0;\n\t\tif(pins.pin1!=1){\n\t\t pin1 = Math.floor(Math.random()*2);\n\t\t}\n\t\tif(pins.pin2!=1){\n\t\t pin2 = Math.floor(Math.random()*2);\n\t\t}\n\t\tif(pins.pin3!=1){\n\t\t pin3 = Math.floor(Math.random()*2);\n\t\t}\n\t\tif(pins.pin4!=1){\n\t\t pin4 = Math.floor(Math.random()*2);\n\t\t}\n\t\tif(pins.pin5!=1){\n\t\t pin5 = Math.floor(Math.random()*2);\n\t\t}\n\t\tif(pins.pin6!=1){\n\t\t pin6 = Math.floor(Math.random()*2);\n\t\t}\n\t\tif(pins.pin7!=1){\n\t\t pin7 = Math.floor(Math.random()*2);\n\t\t}\n\t\tif(pins.pin8!=1){\n\t\t pin8 = Math.floor(Math.random()*2);\n\t\t}\n\t\tif(pins.pin9!=1){\n\t\t pin9 = Math.floor(Math.random()*2);\n\t\t}\n\t\tif(pins.pin10!=1){\n\t\t pin10 = Math.floor(Math.random()*2);\n\t\t}\n\t\t// Add up the additional pins knocked down to the already knocked down pins\n\t\ttotalPins = pin1+pin2+pin3+pin4+pin5+pin6+pin7+pin8+pin9+pin10+pins.totalPins;\n\t\t// Reassign the knocked down pins\n\t\tpins.totalPins = totalPins;\n\t\t// TESTING PURPOSES ONLY\n\t\t// console.log(pin1);\n\t\t// console.log(pin2);\n\t\t// console.log(pin3);\n\t\t// console.log(pin4);\n\t\t// console.log(pin5);\n\t\t// console.log(pin6);\n\t\t// console.log(pin7);\n\t\t// console.log(pin8);\n\t\t// console.log(pin9);\n\t\t// console.log(pin10);\n}", "check2(state) {\n if (!state.combinations[1].locked && state.dices[0].value < 7) {\n var dicesResult = [];\n for (let i = 0; i < state.dices.length; i++) {\n dicesResult.push(state.dices[i].value)\n }\n dicesResult.sort();\n var sum = 0;\n for (let i = 0; i < state.dices.length; i++) {\n if (dicesResult[i] == 2) {\n sum += dicesResult[i];\n }\n }\n state.combinations[1].value = sum;\n for (let i = 0; i < 5; i++) {\n state.dices[i].locked = false;\n state.dices[i].value = i + 7;\n }\n state.combinations[1].locked = true;\n state.rollNumber = 1;\n state.roundNumber++;\n }\n }", "function getLeftmostUpperRing()\n{\n\tfor(var id = 0; id < numOfRings; id++) {\n\t\tif(ringWorkState[id]) return id;\n\t}\n\treturn -1; //no upper ring\n}", "function calcBlowouts() {\n const scores = getScores(),\n p1Scores = scores[0],\n p2Scores = scores[1];\n\n let p1Blowouts = 0,\n p2Blowouts = 0;\n\n // Iterates through scores and determines if a game was blowout\n // blowout = score differential of at least 20 points\n for (let i = 0; i < p1Scores.length; i++) {\n\n if ((p1Scores[i] - p2Scores[i]) >= 20) {\n p1Blowouts++;\n } else if ((p2Scores[i] - p1Scores[i]) >= 20) {\n p2Blowouts++;\n }\n }\n\n displayBlowouts(p1Blowouts, p2Blowouts);\n}", "check4(state) {\n if (!state.combinations[3].locked && state.dices[0].value < 7) {\n var dicesResult = [];\n for (let i = 0; i < state.dices.length; i++) {\n dicesResult.push(state.dices[i].value)\n }\n dicesResult.sort();\n var sum = 0;\n for (let i = 0; i < state.dices.length; i++) {\n if (dicesResult[i] == 4) {\n sum += dicesResult[i];\n }\n }\n state.combinations[3].value = sum;\n for (let i = 0; i < 5; i++) {\n state.dices[i].locked = false;\n state.dices[i].value = i + 7;\n }\n state.combinations[3].locked = true;\n state.rollNumber = 1;\n state.roundNumber++;\n }\n }", "function lookupBPScout(bpscout) {\r\n\tfor (var x = 0;x< scoutArr.length;x++) {\r\n\t\t// not all scout records have the bpscout property\r\n\t\tif (scoutArr[x].bpscout != undefined) {\r\n\t\t\tif (scoutArr[x].bpscout.toLowerCase() == bpscout.toLowerCase()) {\r\n\t\t\t\treturn scoutArr[x].id;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn -1;\r\n}", "function calculate_legal_pieces(roll)\r\n{\r\n var legal_pieces = [];\r\n for(var i = 0; i < pieces.length; i++)\r\n {\r\n if (pieces[i].color == CURRENT_PLAYER && pieces[i].position >= 6)\r\n {\r\n if(pieces[i].position + roll == WHITE_PIECE_X_LOCATIONS.length)\r\n {\r\n legal_pieces.push(i);\r\n }\r\n else if(pieces[i].position + roll < WHITE_PIECE_X_LOCATIONS.length )\r\n {\r\n var spot_occupied = false;\r\n for(var j = 0; j < pieces.length; j++)\r\n {\r\n if (pieces[j].position == pieces[i].position + roll && pieces[j].color == pieces[i].color)\r\n {\r\n spot_occupied = true;\r\n }\r\n else if (pieces[j].position == pieces[i].position + roll && pieces[j].color != pieces[i].color && pieces[j].position == 14)\r\n {\r\n spot_occupied = true;\r\n }\r\n }\r\n\r\n if(spot_occupied == false)\r\n {\r\n legal_pieces.push(i);\r\n }\r\n }\r\n }\r\n }\r\n return legal_pieces;\r\n}", "check1(state) {\n if (!state.combinations[0].locked && state.dices[0].value < 7) {\n var dicesResult = [];\n for (let i = 0; i < state.dices.length; i++) {\n dicesResult.push(state.dices[i].value)\n }\n dicesResult.sort();\n var sum = 0;\n for (let i = 0; i < state.dices.length; i++) {\n if (dicesResult[i] == 1) {\n sum += dicesResult[i];\n }\n }\n state.combinations[0].value = sum;\n for (let i = 0; i < 5; i++) {\n state.dices[i].locked = false;\n state.dices[i].value = i + 7;\n }\n state.combinations[0].locked = true;\n state.rollNumber = 1;\n state.roundNumber++;\n }\n }", "check3(state) {\n if (!state.combinations[2].locked && state.dices[0].value < 7) {\n var dicesResult = [];\n for (let i = 0; i < state.dices.length; i++) {\n dicesResult.push(state.dices[i].value)\n }\n dicesResult.sort();\n var sum = 0;\n for (let i = 0; i < state.dices.length; i++) {\n if (dicesResult[i] == 3) {\n sum += dicesResult[i];\n }\n }\n state.combinations[2].value = sum;\n for (let i = 0; i < 5; i++) {\n state.dices[i].locked = false;\n state.dices[i].value = i + 7;\n }\n state.combinations[2].locked = true;\n state.rollNumber = 1;\n state.roundNumber++;\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add get role method, hard coded as "Manager"
getRole(){ return "Manager" }
[ "getRole(){\n return 'Manager';\n }", "getRole() {\r\n return \"Manager\";\r\n }", "getRole() {\n return \"Manager\";\n }", "getRole() {\n return \"Manager\";\n }", "getRole() {\n\n return \"Manager\";\n }", "getRole() {\n //add code to return \"Engineer\", since that is what the test expects this function to do\n return \"Manager\";\n }", "getRoleManager() {\n return this.rm;\n }", "getRole() {\n return \"Engineer\";\n }", "getRole() {\n return \"Engineer\"\n }", "getRole() {\n return \"Employee\";\n }", "getRole() {\n return \"Employee\"\n }", "getRole(parent, args, content, ast) {\n const feathersParams = convertArgs(args, content, ast);\n return roles.get(args.key, feathersParams).then(extractFirstItem);\n }", "get role() {\n return super.role;\n }", "get role() {\n return this.getStringAttribute('role');\n }", "get role () {\n\t\treturn this._role;\n\t}", "getRole() {\n\t\treturn \"Employee\";\n\t}", "getRole() {\n return \"Intern\"\n }", "function getRole(role) {\n return roleSet[role];\n }", "_getRole() {\n // get list of all of member's roles\n let roles = this.guildMember.roles.array();\n let role = roles[0];\n\n // find highest role\n for (let i = 1; i < roles.length; ++i) {\n if (role.comparePositionTo(roles[i]) < 0) {\n role = roles[i];\n }\n }\n\n return role;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update heading when creating/managing movie night theme
function updateHeading() { var mnTheme = $('input[field="theme"]').val(); $('h1#lmnopHeading').text('New ' + mnTheme); }
[ "updateTitle() {\n if (this.style == 'full') {\n if (this.tileable.title.includes(this.app.get_name())) {\n this.title.text = this.tileable.title;\n } else {\n const escapedAppName = GLib.markup_escape_text(this.app.get_name(), -1);\n const escapedTitle = GLib.markup_escape_text(this.tileable.title, -1);\n this.title\n .get_clutter_text()\n .set_markup(\n `${escapedTitle}<span alpha=\"${\n this.has_style_class_name('active')\n ? '40%'\n : '20%'\n }\"> - ${escapedAppName}</span>`\n );\n }\n } else if (this.style == 'name') {\n this.title.text = this.app.get_name();\n }\n }", "function pageSceneEditTitle() {\n voicelyTitleSettings(false, 'white-text lighten-3 theme ' + oldTheme)\n newVoicelyBtnSettings(false, 'Cancel')\n editTitleBtnSettings(false, 'Update Title')\n phraseDivSettings(true)\n recordSmsSaveBtnSettings(true)\n}", "plotHeading() {\n this.heading.draw(this.s.global.strings.headings[2].title);\n }", "function renderHeading() {\n // HTML element ID's assingned varribles\n var m = moment();\n var title = $('#title')\n var date = $('#date');\n var time = $('#time');\n \n // methods assigned verribles \n title.empty();\n title.text('NOTE PAD');\n title.addClass('notepad-title')\n date.html(m.format(\"l\"));\n time.html(m.format(\"LTS\"));\n // funcitons executed to asigned page locations\n $('#heading').addClass('heading');\n $('#title-elemement').append(title);\n $('.date-element').append(date, time);\n date.removeClass().addClass('note-book-theme');\n time.removeClass().addClass('note-book-theme');\n }", "function onUpdate() {\n viz_title.style(\"fill\", (theme.skin() != customSkin) ? theme.skin().labelColor : \"#000\");\n }", "function setHeading() {\n\tif (curStore == \"localAppDirectory\" || curStore == \"remoteFHGAppStore\") {\n\n\t\t$(\"h1#appstore\").addClass(\"highlightHeading\");\n\t\tvar welcome = \"<strong style='font-size: 1.4em;'> Appstore </strong> <br> <em>\"\n\t\t\t\t+ curStore + \"</em>\";\n\n\t\tdocument.getElementById(\"appstore\").innerHTML = welcome;\n\t\t$(\"div#vorwort\").css(\"display\", \"inline\");\n\n\t} else {\n\t\tdocument.getElementById(\"noAppstore\").innerHTML = \"Sorry. Unknown appstore.\";\n\t}\n}", "function rewriteTitle() {\n\tif( typeof( window.SKIP_TITLE_REWRITE ) != 'undefined' && window.SKIP_TITLE_REWRITE ) {\n\t\treturn;\n\t}\n \n\tif( $('#title-meta').length == 0 ) {\n\t\treturn;\n\t}\n \n\tvar newTitle = $('#title-meta').html();\n\tif( skin == \"oasis\" ) {\n\t\t$('header.WikiaPageHeader > h1').html('<div id=\"title-meta\" style=\"display: inline;\">' + newTitle + '</div>');\n\t\t$('header.WikiaPageHeader > h1').attr('style','text-align:' + $('#title-align').html() + ';');\n\t} else {\n\t\t$('.firstHeading').html('<div id=\"title-meta\" style=\"display: inline;\">' + newTitle + '</div>');\n\t\t$('.firstHeading').attr('style','text-align:' + $('#title-align').html() + ';');\n\t}\n}", "function rewriteTitle() {\n\tif( typeof( window.SKIP_TITLE_REWRITE ) != 'undefined' && window.SKIP_TITLE_REWRITE ) {\n\t\treturn;\n\t}\n \n\tif( $('#title-meta').length === 0 ) {\n\t\treturn;\n\t}\n \n\tvar newTitle = $('#title-meta').html();\n\tif( skin == \"oasis\" ) {\n\t\t$('header.WikiaPageHeader > h1').html('<div id=\"title-meta\" style=\"display: inline;\">' + newTitle + '</div>');\n\t\t$('header.WikiaPageHeader > h1').attr('style','text-align:' + $('#title-align').html() + ';');\n\t} else {\n\t\t$('.firstHeading').html('<div id=\"title-meta\" style=\"display: inline;\">' + newTitle + '</div>');\n\t\t$('.firstHeading').attr('style','text-align:' + $('#title-align').html() + ';');\n\t}\n}", "function updateHeading(){\n\t\tif (ide == \"st3\"){ // use Sublime Text 3 heading\n\t\t\t$(\".your_snippet\").text(\"Your Sublime Text Snippet:\")\n\t\t\t$(\".hidden_heading\").text(\"Your Sublime Text Snippet:\")\n\t\t}\n\t\telse { // use Visual Studio Code heading\n\t\t\t$(\".your_snippet\").text(\"Your VS Code Snippet:\")\n\t\t\t$(\".hidden_heading\").text(\"Your VS Code Snippet:\")\n\t\t}\n\t}", "function setHeader(){\n\t\t\tvar wid = innerWidth;\n\t\t\tvar appTitle = setHeader.appTitle = setHeader.appTitle?setHeader.appTitle:dom.byId(\"appTitle\");\n\t\t\tif (wid < 750 && setHeader.fullText !== 0){\n\t\t\t\tappTitle.innerHTML = \"Bathymetry\";\n\t\t\t\tsetHeader.fullText = 0;\n\t\t\t}else if(wid > 749 && setHeader.fullText === 0){\n\t\t\t\tappTitle.innerHTML = \"Delta Bathymetry Catalog\"\n\t\t\t\tsetHeader.fullText = 1;\n\t\t\t}\n\t\t}", "function rewriteTitle() {\n\tif( typeof( window.SKIP_TITLE_REWRITE ) != 'undefined' && window.SKIP_TITLE_REWRITE ) {\n\t\treturn;\n\t}\n\n\tif( $('#title-meta').length == 0 ) {\n\t\treturn;\n\t}\n\n\tvar newTitle = $('#title-meta').html();\n\tif( skin == \"oasis\" ) {\n\t\t$('header.WikiaPageHeader > h1').html('<div id=\"title-meta\" style=\"display: inline;\">' + newTitle + '</div>');\n\t\t$('header.WikiaPageHeader > h1').attr('style','text-align:' + $('#title-align').html() + ';');\n\t} else {\n\t\t$('.firstHeading').html('<div id=\"title-meta\" style=\"display: inline;\">' + newTitle + '</div>');\n\t\t$('.firstHeading').attr('style','text-align:' + $('#title-align').html() + ';');\n\t}\n}", "function updateTitle(){\n let header = document.getElementById(\"TaskLabelHeader\");\n if (header){\n document.title = header.innerText;\n return;\n }\n\n let generalHeader = document.getElementsByClassName(\"page-header\")[0];\n if (generalHeader){\n document.title = \"ESP \" + generalHeader.innerText;\n }\n document.title = document.title.replace(\"Word Editor - TaskDescription - \", \"Text \")\n}", "function drawHeading(time) {\n // Draw screen heading for a few seconds after changing screens\n if (time - _lastScreenChangeTime < 3) {\n g.setFont(\"Vector\",25);\n g.drawString(getScreenHeading(),80,30);\n }\n}", "function changeHeading(newHeading){\r\n document.querySelector('h1').innerText=\"My First BenchMark - Day 9\"\r\n}", "function changeHeadingWord (color) {\ndocument.getElementById('heading').innerHTML=color; }", "function titleStyle() {\n if (playMode === 1) {\n if (currentPlayer === 3) {\n document.getElementById('title').innerHTML = `Computer's turn..`;\n } else {\n document.getElementById('title').innerHTML = `Your turn..`;\n }\n } else {\n document.getElementById('title').innerHTML = `Player ${currentPlayer} turn`;\n }\n\n document.getElementById('title').style.background = '#000';\n document.getElementById('title').style.color = '#fff';\n}", "function changeTitleNewToUpdate(heading, title) {\n\theading.innerHTML = 'Change your topic \"' + title + '\"';\n}", "function updateWindowTitle() {\n /***** for before/after school testing ******/\n //blockInfo = testDT;\n /***********/\n console.log(\"Updated title\");\n \n if(!isDuringSchoolDay(blockInfo)) {\n return;\n }\n\n let titleText = blockInfo.currentBlock.period + '[' + blockInfo.currentBlock.block + ']' + \n ' ' + blockInfo.remainingDisp + \"min\";\n let windowTitle = document.getElementsByTagName('title')[0];\n\n windowTitle.innerText = titleText;\n\n}", "function handleheadertheme() {\n\t\t$('.theme-color > a.header-theme').on(\"click\", function() {\n\t\t\tvar headertheme = $(this).attr(\"header-theme\");\n\t\t\t$('.pcoded-header').attr(\"header-theme\", headertheme);\n });\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
wrapper for selectHeirloom, to handle the protect button
function newSelectHeirloom(number, location, elem){ selectHeirloom(number, location, elem); protectHeirloom(); }
[ "function selectionTool() {\r\n var ref = $(\"[id^='select-']\");\r\n for (var i = 0; i < ref.length; i++) {\r\n $(ref[i]).click(function (evt) {\r\n if (varsel == 0) {\r\n selctfeaturelayerlistwidget.show();\r\n }\r\n var t = evt.target.value;\r\n t = t.toUpperCase();\r\n gl = 1;\r\n selectionToolbar.activate(Draw[t]);\r\n $(\"#select_clear\").prop(\"disabled\", false);\r\n });\r\n }\r\n }", "function update_select(){\n\thidden_activate = sel_hid_active.property('value')\n\trestricted_activate = sel_rest_active.property(\"value\")\n}", "function clickOptiontoSelect(){\n\n}", "function selectOption() {\n\n $imageChoiceQuestion.selectable({\n stop: function() {\n console.log($(this));\n $(this).children().not('.ui-selected').addClass('overlay');\n $(this).selectable('disable');\n }\n });\n\n $wordChoiceQuestion.selectable({\n stop: function() {\n console.log($(this));\n $(this).children().not('.ui-selected').addClass('overlay');\n $(this).selectable('disable');\n }\n });\n\n}", "clickSelectTool(event) {\n event.preventDefault();\n if (this.state.selectTool === SELECT_ALL) {\n this.setState({ selectTool: SELECT_NONE });\n this.setSelectionForAll(false);\n } else {\n this.setState({ selectTool: SELECT_ALL });\n this.setSelectionForAll(true);\n }\n }", "handlePrivateSelect(event) {\n this.selectedOptions = event.detail.selectedOptions;\n }", "function select() {\n selection.select(swimlane);\n }", "function handleSelection() {\n\n shadow = self.element.parentNode;\n if(shadow.getSelection){\n selection = shadow.getSelection();\n }else {\n selection = window.getSelection();\n }\n\n range = selection.getRangeAt(0);\n const edit =texthighlight.querySelector(\"#edit\");\n edit.style.display =\"none\";\n if (selection && selection.toString()!== \"\") {\n showMenu();\n\n }else {\n if (isAlreadyMarked()) {\n markElement = getMarkElement();\n showMenu();\n } else {\n\n hideMenu();\n }\n }\n\n }", "enterSimpleSelect(ctx) {\n\t}", "function SelectHelper() {\r\n\t// SelectHelper.getAnswersAsList(mode, ans)\r\n\t// SelectHelper.createSelectBox(mode, choices, correct, answers, page, cls, defaultHelp)\r\n\t// SelectHelper.getSelectionAsText(choices, answers)\r\n\t// SelectHelper.createDivBox(mode, choices, correct, answers, page, cls)\r\n\t// SelectHelper.setupOnReportClick(mode, choices, correct, answers, page, reportDiv)\r\n}", "enterSelectElement(ctx) {\n\t}", "function filterSelectID(){\n \n }", "function MENVIT_InputSelect(el_input){\n //console.log( \"===== MENVIT_InputSelect ========= \");\n MENVIT_disable_save_btn(false);\n }", "function selectVoterByKeypress(down) {\r\n $all_voters = $('.voter');\r\n $selected_voter = $('.voter.selected');\r\n\r\n\r\n if ($selected_voter.length == 0 && down) {\r\n $selected_voter = $($all_voters[0]);\r\n }\r\n else if ($selected_voter.length > 0) { \r\n \r\n if (down) {\r\n i = parseInt($selected_voter.data('voter-index')) + 1\r\n if (i >= $all_voters.length) {\r\n i = 0;\r\n }\r\n $selected_voter = $($all_voters[i]);\r\n }\r\n else {\r\n i = parseInt($selected_voter.data('voter-index')) - 1\r\n if (i < 0) {\r\n i = ($all_voters.length - 1);\r\n }\r\n\r\n $selected_voter = $($all_voters[i]);\r\n }\r\n \r\n }\r\n \r\n selectVoter($selected_voter)\r\n }", "_clickOnProfessional(e) {\n e.preventDefault();\n const selectedLIId = this._selectLIFrom(e.target);\n this._unselect();\n if (selectedLIId === this.selectedID) {\n this.selectedID = false;\n return;\n }\n this.selectedID = selectedLIId;\n this._select();\n }", "_makeSelectInteraction() {\n return new olSelectInteraction({\n addCondition: olEventsConditions.singleClick,\n toggleCondition: olEventsConditions.always\n });\n }", "function selectControlElements(){editor.on('click',function(e){var target=e.target;// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250\n\t// WebKit can't even do simple things like selecting an image\n\tif(/^(IMG|HR)$/.test(target.nodeName)&&dom.getContentEditableParent(target)!==\"false\"){e.preventDefault();selection.select(target);editor.nodeChanged();}if(target.nodeName=='A'&&dom.hasClass(target,'mce-item-anchor')){e.preventDefault();selection.select(target);}});}", "function MAG_fill_select_authindex () { // PR2023-02-06\n //console.log(\"----- MAG_fill_select_authindex -----\") ;\n //console.log(\" mod_MAG_dict.examperiod\", mod_MAG_dict.examperiod);\n //console.log(\" mod_MAG_dict.requsr_auth_list\", mod_MAG_dict.requsr_auth_list);\n\n // --- fill selectbox auth_index\n if (el_MAG_auth_index){\n // auth_list = [{value: 1, caption: 'Chairperson'}, {value: 3, caption: 'Examiner'} )\n const auth_list = [];\n const cpt_list = [null, loc.Chairperson, loc.Secretary, loc.Examiner, loc.Corrector];\n for (let i = 0, auth_index; auth_index = mod_MAG_dict.requsr_auth_list[i]; i++) {\n auth_list.push({value: auth_index, caption: cpt_list[auth_index]});\n };\n t_FillOptionsFromList(el_MAG_auth_index, auth_list, \"value\", \"caption\",\n loc.Select_function, loc.No_functions_found, setting_dict.sel_auth_index);\n//console.log(\" >>>>>>>>>>>>>>>> auth_list\", auth_list)\n//const is_disabled = (!auth_list || auth_list.length <= 1);\n//console.log(\" >>>>>>>>>>>>>>>> is_disabled\", is_disabled)\n el_MAG_auth_index.readOnly = (!auth_list || auth_list.length <= 1);\n };\n }", "function enableSelect(el) {\n\tel.style.userSelect = 'auto'\n\tel.style.webkitUserSelect = 'auto'\n\tel.style.mozUserSelect = 'auto'\n\tel.dataset.selectionEnabled = 'true'\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get start menu shortcut id.
function getStartMenuShortcutId(installPath) { return "startMenuShortcut_" + makeUniqueShortId(installPath) }
[ "get startedUsingShortcut() {\n return this._startedUsingShortcut;\n }", "function getDesktopShortcutId(installPath) {\n\treturn \"desktopShortcut_\" + makeUniqueShortId(installPath)\n}", "getID() {\n return this._menuID;\n }", "getSubmenuId() {\n return 'submenu-' + this.submenuIndex++;\n }", "getStartPointID() {\n if (this.selected[0]) return parseInt(this.getStartPoint().id.substring(1));\n return null;\n }", "function getTagIdFromItemId(itemId, menuNode)\r{\r\tvar retVal = \"\";\r\tvar parent;\r\tvar parentId;\r\r\tif (menuNode)\r\t{\r\t\tparent = menuNode.parentNode;\r\t\t\r\t\tif (parent.tagName == \"SHORTCUTLIST\")\r\t\t{\r\t\t\tretVal = parent.getAttribute(\"id\");\r\t\t}\r\t\telse\r\t\t{\r\t\t\twhile (parent && !parentId)\r\t\t\t{\r\t\t\t\tif (parent.tagName == \"MENUBAR\")\r\t\t\t\t{\r\t\t\t\t\tparentId = parent.getAttribute(\"id\");\r\t\t\t\t}\r\t\t\t\telse\r\t\t\t\t{\r\t\t\t\t\tparent = parent.parentNode;\r\t\t\t\t}\r\t\t\t}\r\t\t}\r\t\r\t\tif (parentId)\r\t\t{\r\t\t\tif (parentId ==\"DWMainSite\")\r\t\t\t\tretVal = \"DWMainSite1\"\r\t\t\telse if (parentId ==\"DWMainWindow\")\r\t\t\t\tretVal = \"DWMainWindow1\"\r\t\t}\r\t}\r\r\treturn retVal;\r}", "function get_workspace_id_from_menu() {\n var item = dm3c.ui.menu_item(\"workspace-menu\")\n if (item) {\n return item.value\n }\n }", "function get_topicmap_id() {\n return ui.menu_item(\"topicmap-menu\").value\n }", "function getStartCommand() {\n switch (process.platform) { \n case 'darwin' : return 'open';\n case 'win32' : return 'start';\n case 'win64' : return 'start';\n default : return 'xdg-open';\n }\n}", "function getContextMenuId()\n{\n\treturn \"DWConnectionsContext\";\n}", "function getStartPid() {\n return self.players.ids.list[Math.floor(Math.random() * 2)];\n }", "function getContextMenuId()\n{\n\treturn \"DWDataSourcesContext\";\n}", "function Getkey ($this) {\n return $($this).parents(\".kncatshell\").attr(\"id\")\n }", "function get_workspace_id() {\n return ui.menu_item(\"workspace-menu\").value\n }", "getStartingIndex() {\n // 1. look for url #hash\n const urlHash = this.hashes.indexOf(window.location.hash);\n if (urlHash > -1) return urlHash;\n\n // 2. look for active nav item\n const navIndex = this.tabs.findIndex(\n tab => tab && tab.classList.contains(Tabs.options.classActive),\n );\n if (navIndex > -1) return navIndex;\n\n // 3. look for active pane\n const paneIndex = this.panes.findIndex(\n pane => pane && pane.classList.contains(Tabs.options.classActive),\n );\n if (paneIndex > -1) return paneIndex;\n\n // 4. default to first tab\n return 0;\n }", "function getAccKeyboardShortcut()\n{\n try{\n return accNode.accKeyboardShortcut;\n }\n catch(e){\n return(e);\n }\n}", "function getSelectedMenuId(menuId) {\n var $menuActive = $(\".menuActive\");\n\n if (!menuId) {\n if ($menuActive.length === 1) {\n return $menuActive.data(\"menuid\");\n } else {\n return;\n }\n }\n return menuId;\n }", "findCursorByID(id) {\n\t\tfor (let i = 0; i < this.menuData.length; i++) {\n\t\t\tif (this.menuData[i].id === id) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "function getMenuRowIndex (item) {\n let menu = item.parentElement;\n return(parseInt(menu.dataset.index, 10));\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A helper function useful for extracting `R3DependencyMetadata` from a Render2 `CompileTypeMetadata` instance.
function dependenciesFromGlobalMetadata(type,outputCtx,reflector){var e_1,_a;// Use the `CompileReflector` to look up references to some well-known Angular types. These will // be compared with the token to statically determine whether the token has significance to // Angular, and set the correct `R3ResolvedDependencyType` as a result. var injectorRef=reflector.resolveExternalReference(Identifiers.Injector);// Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them. var deps=[];try{for(var _b=Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(type.diDeps),_c=_b.next();!_c.done;_c=_b.next()){var dependency=_c.value;if(dependency.token){var tokenRef=tokenReference(dependency.token);var resolved=dependency.isAttribute?R3ResolvedDependencyType.Attribute:R3ResolvedDependencyType.Token;// In the case of most dependencies, the token will be a reference to a type. Sometimes, // however, it can be a string, in the case of older Angular code or @Attribute injection. var token=tokenRef instanceof StaticSymbol?outputCtx.importExpr(tokenRef):literal(tokenRef);// Construct the dependency. deps.push({token:token,resolved:resolved,host:!!dependency.isHost,optional:!!dependency.isOptional,self:!!dependency.isSelf,skipSelf:!!dependency.isSkipSelf});}else{unsupported('dependency without a token');}}}catch(e_1_1){e_1={error:e_1_1};}finally{try{if(_c&&!_c.done&&(_a=_b["return"]))_a.call(_b);}finally{if(e_1)throw e_1.error;}}return deps;}
[ "function dependenciesFromGlobalMetadata(type,outputCtx,reflector){// Use the `CompileReflector` to look up references to some well-known Angular types. These will\n// be compared with the token to statically determine whether the token has significance to\n// Angular, and set the correct `R3ResolvedDependencyType` as a result.\nvar injectorRef=reflector.resolveExternalReference(Identifiers.Injector);// Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them.\nvar deps=[];for(var _iterator19=type.diDeps,_isArray19=Array.isArray(_iterator19),_i36=0,_iterator19=_isArray19?_iterator19:_iterator19[Symbol.iterator]();;){var _ref41;if(_isArray19){if(_i36>=_iterator19.length)break;_ref41=_iterator19[_i36++]}else{_i36=_iterator19.next();if(_i36.done)break;_ref41=_i36.value}var dependency=_ref41;if(dependency.token){var tokenRef=tokenReference(dependency.token);var resolved=dependency.isAttribute?R3ResolvedDependencyType.Attribute:R3ResolvedDependencyType.Token;// In the case of most dependencies, the token will be a reference to a type. Sometimes,\n// however, it can be a string, in the case of older Angular code or @Attribute injection.\nvar token=tokenRef instanceof StaticSymbol?outputCtx.importExpr(tokenRef):literal(tokenRef);// Construct the dependency.\ndeps.push({token:token,resolved:resolved,host:!!dependency.isHost,optional:!!dependency.isOptional,self:!!dependency.isSelf,skipSelf:!!dependency.isSkipSelf})}else{unsupported(\"dependency without a token\")}}return deps}", "function dependenciesFromGlobalMetadata(type,outputCtx,reflector){// Use the `CompileReflector` to look up references to some well-known Angular types. These will\n// be compared with the token to statically determine whether the token has significance to\n// Angular, and set the correct `R3ResolvedDependencyType` as a result.\nvar injectorRef=reflector.resolveExternalReference(Identifiers.Injector);// Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them.\nvar deps=[];for(var _iterator8=type.diDeps,_isArray8=Array.isArray(_iterator8),_i22=0,_iterator8=_isArray8?_iterator8:_iterator8[Symbol.iterator]();;){var _ref29;if(_isArray8){if(_i22>=_iterator8.length)break;_ref29=_iterator8[_i22++]}else{_i22=_iterator8.next();if(_i22.done)break;_ref29=_i22.value}var dependency=_ref29;if(dependency.token){var tokenRef=tokenReference(dependency.token);var resolved=dependency.isAttribute?R3ResolvedDependencyType.Attribute:R3ResolvedDependencyType.Token;// In the case of most dependencies, the token will be a reference to a type. Sometimes,\n// however, it can be a string, in the case of older Angular code or @Attribute injection.\nvar token=tokenRef instanceof StaticSymbol?outputCtx.importExpr(tokenRef):literal(tokenRef);// Construct the dependency.\ndeps.push({token:token,resolved:resolved,host:!!dependency.isHost,optional:!!dependency.isOptional,self:!!dependency.isSelf,skipSelf:!!dependency.isSkipSelf})}else{unsupported(\"dependency without a token\")}}return deps}", "function dependenciesFromGlobalMetadata(type,outputCtx,reflector){// Use the `CompileReflector` to look up references to some well-known Angular types. These will\n// be compared with the token to statically determine whether the token has significance to\n// Angular, and set the correct `R3ResolvedDependencyType` as a result.\nvar injectorRef=reflector.resolveExternalReference(Identifiers.Injector);// Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them.\nvar deps=[];for(var _iterator6=type.diDeps,_isArray6=Array.isArray(_iterator6),_i16=0,_iterator6=_isArray6?_iterator6:_iterator6[Symbol.iterator]();;){var _ref28;if(_isArray6){if(_i16>=_iterator6.length)break;_ref28=_iterator6[_i16++]}else{_i16=_iterator6.next();if(_i16.done)break;_ref28=_i16.value}var dependency=_ref28;if(dependency.token){var tokenRef=tokenReference(dependency.token);var resolved=dependency.isAttribute?R3ResolvedDependencyType.Attribute:R3ResolvedDependencyType.Token;// In the case of most dependencies, the token will be a reference to a type. Sometimes,\n// however, it can be a string, in the case of older Angular code or @Attribute injection.\nvar token=tokenRef instanceof StaticSymbol?outputCtx.importExpr(tokenRef):literal(tokenRef);// Construct the dependency.\ndeps.push({token:token,resolved:resolved,host:!!dependency.isHost,optional:!!dependency.isOptional,self:!!dependency.isSelf,skipSelf:!!dependency.isSkipSelf})}else{unsupported(\"dependency without a token\")}}return deps}", "function dependenciesFromGlobalMetadata(type, outputCtx, reflector) {\n // Use the `CompileReflector` to look up references to some well-known Angular types. These will\n // be compared with the token to statically determine whether the token has significance to\n // Angular, and set the correct `R3ResolvedDependencyType` as a result.\n const elementRef = reflector.resolveExternalReference(Identifiers.ElementRef);\n const templateRef = reflector.resolveExternalReference(Identifiers.TemplateRef);\n const viewContainerRef = reflector.resolveExternalReference(Identifiers.ViewContainerRef);\n const injectorRef = reflector.resolveExternalReference(Identifiers.Injector);\n // Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them.\n const deps = [];\n for (let dependency of type.diDeps) {\n if (dependency.token) {\n const tokenRef = tokenReference(dependency.token);\n let resolved = R3ResolvedDependencyType.Token;\n if (tokenRef === elementRef) {\n resolved = R3ResolvedDependencyType.ElementRef;\n }\n else if (tokenRef === templateRef) {\n resolved = R3ResolvedDependencyType.TemplateRef;\n }\n else if (tokenRef === viewContainerRef) {\n resolved = R3ResolvedDependencyType.ViewContainerRef;\n }\n else if (tokenRef === injectorRef) {\n resolved = R3ResolvedDependencyType.Injector;\n }\n else if (dependency.isAttribute) {\n resolved = R3ResolvedDependencyType.Attribute;\n }\n // In the case of most dependencies, the token will be a reference to a type. Sometimes,\n // however, it can be a string, in the case of older Angular code or @Attribute injection.\n const token = tokenRef instanceof StaticSymbol ? outputCtx.importExpr(tokenRef) : literal(tokenRef);\n // Construct the dependency.\n deps.push({\n token,\n resolved,\n host: !!dependency.isHost,\n optional: !!dependency.isOptional,\n self: !!dependency.isSelf,\n skipSelf: !!dependency.isSkipSelf,\n });\n }\n else {\n unsupported('dependency without a token');\n }\n }\n return deps;\n}", "function dependenciesFromGlobalMetadata(type, outputCtx, reflector) {\n var e_1, _a;\n // Use the `CompileReflector` to look up references to some well-known Angular types. These will\n // be compared with the token to statically determine whether the token has significance to\n // Angular, and set the correct `R3ResolvedDependencyType` as a result.\n var elementRef = reflector.resolveExternalReference(Identifiers.ElementRef);\n var templateRef = reflector.resolveExternalReference(Identifiers.TemplateRef);\n var viewContainerRef = reflector.resolveExternalReference(Identifiers.ViewContainerRef);\n var injectorRef = reflector.resolveExternalReference(Identifiers.Injector);\n // Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them.\n var deps = [];\n try {\n for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__values\"])(type.diDeps), _c = _b.next(); !_c.done; _c = _b.next()) {\n var dependency = _c.value;\n if (dependency.token) {\n var tokenRef = tokenReference(dependency.token);\n var resolved = R3ResolvedDependencyType.Token;\n if (tokenRef === elementRef) {\n resolved = R3ResolvedDependencyType.ElementRef;\n }\n else if (tokenRef === templateRef) {\n resolved = R3ResolvedDependencyType.TemplateRef;\n }\n else if (tokenRef === viewContainerRef) {\n resolved = R3ResolvedDependencyType.ViewContainerRef;\n }\n else if (tokenRef === injectorRef) {\n resolved = R3ResolvedDependencyType.Injector;\n }\n else if (dependency.isAttribute) {\n resolved = R3ResolvedDependencyType.Attribute;\n }\n // In the case of most dependencies, the token will be a reference to a type. Sometimes,\n // however, it can be a string, in the case of older Angular code or @Attribute injection.\n var token = tokenRef instanceof StaticSymbol ? outputCtx.importExpr(tokenRef) : literal(tokenRef);\n // Construct the dependency.\n deps.push({\n token: token,\n resolved: resolved,\n host: !!dependency.isHost,\n optional: !!dependency.isOptional,\n self: !!dependency.isSelf,\n skipSelf: !!dependency.isSkipSelf,\n });\n }\n else {\n unsupported('dependency without a token');\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return deps;\n}", "function dependenciesFromGlobalMetadata(type, outputCtx, reflector) {\n var e_1, _a;\n // Use the `CompileReflector` to look up references to some well-known Angular types. These will\n // be compared with the token to statically determine whether the token has significance to\n // Angular, and set the correct `R3ResolvedDependencyType` as a result.\n var injectorRef = reflector.resolveExternalReference(Identifiers.Injector);\n // Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them.\n var deps = [];\n try {\n for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__values\"])(type.diDeps), _c = _b.next(); !_c.done; _c = _b.next()) {\n var dependency = _c.value;\n if (dependency.token) {\n var tokenRef = tokenReference(dependency.token);\n var resolved = dependency.isAttribute ?\n R3ResolvedDependencyType.Attribute :\n R3ResolvedDependencyType.Token;\n // In the case of most dependencies, the token will be a reference to a type. Sometimes,\n // however, it can be a string, in the case of older Angular code or @Attribute injection.\n var token = tokenRef instanceof StaticSymbol ? outputCtx.importExpr(tokenRef) : literal(tokenRef);\n // Construct the dependency.\n deps.push({\n token: token,\n resolved: resolved,\n host: !!dependency.isHost,\n optional: !!dependency.isOptional,\n self: !!dependency.isSelf,\n skipSelf: !!dependency.isSkipSelf,\n });\n }\n else {\n unsupported('dependency without a token');\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return deps;\n}", "function dependenciesFromGlobalMetadata(type, outputCtx, reflector) {\n // Use the `CompileReflector` to look up references to some well-known Angular types. These will\n // be compared with the token to statically determine whether the token has significance to\n // Angular, and set the correct `R3ResolvedDependencyType` as a result.\n const injectorRef = reflector.resolveExternalReference(Identifiers.Injector);\n // Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them.\n const deps = [];\n for (let dependency of type.diDeps) {\n if (dependency.token) {\n const tokenRef = tokenReference(dependency.token);\n let resolved = dependency.isAttribute ?\n R3ResolvedDependencyType.Attribute :\n R3ResolvedDependencyType.Token;\n // In the case of most dependencies, the token will be a reference to a type. Sometimes,\n // however, it can be a string, in the case of older Angular code or @Attribute injection.\n const token = tokenRef instanceof StaticSymbol ? outputCtx.importExpr(tokenRef) : literal(tokenRef);\n // Construct the dependency.\n deps.push({\n token,\n resolved,\n host: !!dependency.isHost,\n optional: !!dependency.isOptional,\n self: !!dependency.isSelf,\n skipSelf: !!dependency.isSkipSelf,\n });\n }\n else {\n unsupported('dependency without a token');\n }\n }\n return deps;\n}", "function toR3DirectiveMeta(metaObj, code, sourceUrl) {\n var typeExpr = metaObj.getValue('type');\n var typeName = typeExpr.getSymbolName();\n if (typeName === null) {\n throw new fatal_linker_error_1.FatalLinkerError(typeExpr.expression, 'Unsupported type, its name could not be determined');\n }\n return {\n typeSourceSpan: createSourceSpan(typeExpr.getRange(), code, sourceUrl),\n type: util_1.wrapReference(typeExpr.getOpaque()),\n typeArgumentCount: 0,\n internalType: metaObj.getOpaque('type'),\n deps: null,\n host: toHostMetadata(metaObj),\n inputs: metaObj.has('inputs') ? metaObj.getObject('inputs').toLiteral(toInputMapping) : {},\n outputs: metaObj.has('outputs') ?\n metaObj.getObject('outputs').toLiteral(function (value) { return value.getString(); }) :\n {},\n queries: metaObj.has('queries') ?\n metaObj.getArray('queries').map(function (entry) { return toQueryMetadata(entry.getObject()); }) :\n [],\n viewQueries: metaObj.has('viewQueries') ?\n metaObj.getArray('viewQueries').map(function (entry) { return toQueryMetadata(entry.getObject()); }) :\n [],\n providers: metaObj.has('providers') ? metaObj.getOpaque('providers') : null,\n fullInheritance: false,\n selector: metaObj.has('selector') ? metaObj.getString('selector') : null,\n exportAs: metaObj.has('exportAs') ?\n metaObj.getArray('exportAs').map(function (entry) { return entry.getString(); }) :\n null,\n lifecycle: {\n usesOnChanges: metaObj.has('usesOnChanges') ? metaObj.getBoolean('usesOnChanges') : false,\n },\n name: typeName,\n usesInheritance: metaObj.has('usesInheritance') ? metaObj.getBoolean('usesInheritance') : false,\n };\n }", "function toR3InjectorMeta(metaObj) {\n var typeExpr = metaObj.getValue('type');\n var typeName = typeExpr.getSymbolName();\n if (typeName === null) {\n throw new fatal_linker_error_1.FatalLinkerError(typeExpr.expression, 'Unsupported type, its name could not be determined');\n }\n return {\n name: typeName,\n type: util_1.wrapReference(typeExpr.getOpaque()),\n internalType: metaObj.getOpaque('type'),\n providers: metaObj.has('providers') ? metaObj.getOpaque('providers') : null,\n imports: metaObj.has('imports') ? metaObj.getArray('imports').map(function (i) { return i.getOpaque(); }) : [],\n };\n }", "getDirectiveMetadata(ref) {\n const clazz = ref.node;\n const def = this.reflector.getMembersOfClass(clazz).find(field => field.isStatic && (field.name === 'ɵcmp' || field.name === 'ɵdir'));\n if (def === undefined) {\n // No definition could be found.\n return null;\n }\n else if (def.type === null || !ts.isTypeReferenceNode(def.type) ||\n def.type.typeArguments === undefined || def.type.typeArguments.length < 2) {\n // The type metadata was the wrong shape.\n return null;\n }\n const inputs = ClassPropertyMapping.fromMappedObject(readStringMapType(def.type.typeArguments[3]));\n const outputs = ClassPropertyMapping.fromMappedObject(readStringMapType(def.type.typeArguments[4]));\n return Object.assign(Object.assign({ ref, name: clazz.name.text, isComponent: def.name === 'ɵcmp', selector: readStringType(def.type.typeArguments[1]), exportAs: readStringArrayType(def.type.typeArguments[2]), inputs,\n outputs, queries: readStringArrayType(def.type.typeArguments[5]) }, extractDirectiveTypeCheckMeta(clazz, inputs, this.reflector)), { baseClass: readBaseClass(clazz, this.checker, this.reflector), isPoisoned: false });\n }", "function getDependencyData(){\n \tvar deps, //the found dependencies\n \t name, // the registered module name\n \t func; //the processed function\n\n \t//register(\"name\",[dependencies],func)\n \tif(arguments.length === 3){\n \t\tname = arguments[0]; // name explicit\n \t\tdeps = arguments[1]; // dependencies explicit\n \t\t\tfunc = arguments[2]\n \t}else if (arguments.length === 2){\n \t\t//register([deps],function name(){})\n \t\tif(Array.isArray(arguments[0])){\n \t\t\tdeps = arguments[0];\n \t\t\tfunc = arguments[1];\n \t\t\tname = func.name;\n \t\t//register(\"name\",function(){ })\n \t\t}else{\n \t\t\tfunc = arguments[1];\n \t\t\tdeps = depParser(func); //deps in parameters\n \t\t\tname = arguments[0];\n \t\t}\n \t//register(function name(){})\n \t}else{\n \tfunc = arguments[0];\n \tname = func.name;\n \tdeps = depParser(func); //deps in parameters\n \t}\n \treturn {name:name,deps:deps,func:func};\n }", "function toR3PipeMeta(metaObj) {\n var typeExpr = metaObj.getValue('type');\n var typeName = typeExpr.getSymbolName();\n if (typeName === null) {\n throw new fatal_linker_error_1.FatalLinkerError(typeExpr.expression, 'Unsupported type, its name could not be determined');\n }\n var pure = metaObj.has('pure') ? metaObj.getBoolean('pure') : true;\n return {\n name: typeName,\n type: util_1.wrapReference(typeExpr.getOpaque()),\n internalType: metaObj.getOpaque('type'),\n typeArgumentCount: 0,\n deps: null,\n pipeName: metaObj.getString('name'),\n pure: pure,\n };\n }", "function parseID3v1Metadata(footer) {\n var title = footer.getASCIIText(3, 30);\n var artist = footer.getASCIIText(33, 30);\n var album = footer.getASCIIText(63, 30);\n var p = title.indexOf('\\0');\n if (p !== -1)\n title = title.substring(0, p);\n p = artist.indexOf('\\0');\n if (p !== -1)\n artist = artist.substring(0, p);\n p = album.indexOf('\\0');\n if (p !== -1)\n album = album.substring(0, p);\n\n metadata[TITLE] = title || undefined;\n metadata[ARTIST] = artist || undefined;\n metadata[ALBUM] = album || undefined;\n var b1 = footer.getUint8(125);\n var b2 = footer.getUint8(126);\n if (b1 === 0 && b2 !== 0)\n metadata[TRACKNUM] = b2;\n var genre = footer.getUint8(127);\n metadata[GENRE] = genre || undefined;\n metadataCallback(metadata);\n }", "function readMetadata () {\n return new P((resolve, reject) => {\n wire.readBytes(0xAA, 22, function (error, data) {\n if (error) {\n console.error(\"Error reading metadata:\", error);\n reject(error);\n } else {\n let [\n ac1h, ac1l,\n ac2h, ac2l,\n ac3h, ac3l,\n ac4h, ac4l,\n ac5h, ac5l,\n ac6h, ac6l,\n b1h, b1l,\n b2h, b2l,\n mbh, mbl,\n mch, mcl,\n mdh, mdl,\n ] = data;\n\n let ac1 = short(ac1h, ac1l); \n let ac2 = short(ac2h, ac2l);\n let ac3 = short(ac3h, ac3l);\n let ac4 = ushort(ac4h, ac4l);\n let ac5 = ushort(ac5h, ac5l);\n let ac6 = ushort(ac6h, ac6l);\n let b1 = short(b1h, b1l);\n let b2 = short(b2h, b2l);\n let mb = short(mbh, mbl);\n let mc = short(mch, mcl);\n let md = short(mdh, mdl);\n\n console.log(\"Metadata:\", data);\n console.log(` ac1 : ${ac1}`);\n console.log(` ac2 : ${ac2}`);\n console.log(` ac3 : ${ac3}`);\n console.log(` ac4 : ${ac4}`);\n console.log(` ac5 : ${ac5}`);\n console.log(` ac6 : ${ac6}`);\n console.log(` b1 : ${b1}`);\n console.log(` b2 : ${b2}`);\n console.log(` mb : ${mb}`);\n console.log(` mc : ${mc}`);\n console.log(` md : ${md}`);\n\n resolve({\n ac1, ac2, ac3, ac4, ac5, ac6,\n b1, b2,\n mb, mc, md,\n });\n }\n });\n });\n}", "function extract_metadata(contents) {\n var metadata = undefined;\n \n if (contents && contents.substring(0,metadata_tag.length) == metadata_tag) {\n var end = contents.indexOf('\\n');\n if (end != -1) {\n metadata = JSON.parse(contents.substring(metadata_tag.length,end));\n contents = contents.substring(end+1,contents.length);\n }\n }\n\n return {contents: contents, metadata: metadata };\n }", "readPackageMetadata(dir) {\n var _this3 = this;\n\n return this.getCache(`metadata-${dir}`, (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {\n const metadata = yield _this3.readJson(path.join(dir, (_constants || _load_constants()).METADATA_FILENAME));\n const pkg = yield _this3.readManifest(dir, metadata.registry);\n\n return {\n package: pkg,\n artifacts: metadata.artifacts || [],\n hash: metadata.hash,\n remote: metadata.remote,\n registry: metadata.registry\n };\n }));\n }", "function parseID3v1Metadata(footer) {\n var title = footer.getASCIIText(3, 30);\n var artist = footer.getASCIIText(33, 30);\n var album = footer.getASCIIText(63, 30);\n var p = title.indexOf('\\0');\n if (p !== -1)\n title = title.substring(0, p);\n p = artist.indexOf('\\0');\n if (p !== -1)\n artist = artist.substring(0, p);\n p = album.indexOf('\\0');\n if (p !== -1)\n album = album.substring(0, p);\n\n metadata[TITLE] = title || undefined;\n metadata[ARTIST] = artist || undefined;\n metadata[ALBUM] = album || undefined;\n var b1 = footer.getUint8(125);\n var b2 = footer.getUint8(126);\n if (b1 === 0 && b2 !== 0)\n metadata[TRACKNUM] = b2;\n metadataCallback(metadata);\n }", "static convertImage3DMetadata( oldMeta ){\n Image3DMetadataConverter.completeHeader( oldMeta );\n var newMetaObj = Image3DMetadataConverter.convertOld2New( oldMeta );\n\n return newMetaObj;\n }", "getDependencies(rule) {\n if (!rule || !rule.functionBody) {\n return [];\n }\n return rule.functionBody\n .match(REGEX_TOKEN)\n .map(t => t.substr(2, t.length - 4));\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create Struts Xml insert values variable
function makeStrutsXmlInsertValues() { var xml = ''; for (var i = 1; i < gValuesOfRange.length; i++) { /** set common var in column range*/ if (!setCommonVar(i)) { return ''; } if (cPhysicalNameOfColumn == '') { break; } xml += '#' + cJavaPropertyName + '#'; if (!cIsLastRow) { xml += ','; } xml += newLine; } return xml; }
[ "function makeStrutsXmlUpdateValues() {\n\n var xml = '';\n\n for (var i = 1; i < gValuesOfRange.length; i++) {\n\n /** set common var in column range*/\n if (!setCommonVar(i)) {\n return '';\n }\n\n if (cPhysicalNameOfColumn == '') {\n break;\n }\n\n xml += cPhysicalNameOfColumn + ' = #' + cJavaPropertyName + '#';\n if (!cIsLastRow) {\n xml += ',';\n }\n xml += newLine;\n }\n\n return xml;\n}", "function MODSBasicInsertXML(hiddenFormField) \r\n{\r\n hiddenFormField.value = MODSBuildXML();\r\n}", "function addValueToXML(extractValue) {\n var valueXMLContent = \"<value\";\n valueXMLContent += \" startIndexOf='\" + extractValue.startIndexOf + \"'\";\n valueXMLContent += \" startAdd='\" + extractValue.startAdd + \"'\";\n valueXMLContent += \" endIndexOf='\" + extractValue.endIndexOf + \"'\";\n valueXMLContent += \" endAdd='\" + extractValue.endAdd + \"'\";\n valueXMLContent += \" wrapper='\" + extractValue.wrapper + \"'\";\n valueXMLContent += \" startRegex='\" + extractValue.startRegex + \"'\";\n valueXMLContent += \" endRegex='\" + extractValue.endRegex + \"'>\";\n if (extractValue.parameterValue) {\n valueXMLContent += extractValue.parameterValue;\n }\n valueXMLContent += \"</value>\\n\";\n return valueXMLContent;\n}", "function makeStrutsXmlResultMap() {\n\n var xml = '';\n\n for (var i = 1; i < gValuesOfRange.length; i++) {\n\n /** set common var in column range*/\n if (!setCommonVar(i)) {\n return '';\n }\n\n if (cPhysicalNameOfColumn == '') {\n break;\n }\n\n var columnName = cPhysicalNameOfColumnUpper;\n xml += '<result column=\"' + columnName + '\" property=\"' + cJavaPropertyName + '\" jdbcType=\"' + cTypeVal + '\" />' + newLine;\n }\n\n return xml;\n}", "function makeXml(key,value){\n return \"<update><\"+key+\">\"+value+\"</\"+key+\"></update>\";\n}", "function sendxml(xml){\n\nvar addId =$('#mid').val();\nvar addTitle =$('#mtitle').val();\nvar addYear=$('#myear').val();\nvar addDirector=$('#mdirector').val();\nvar addStars=$('#mstars').val();\nvar addReview=$('#mreview').val();\n\nvar xml = `<film> \n <id>${addId}</id>\n <title>${addTitle}</title>\n <year>${addYear}</year>\n <director>${addDirector}</director>\n <stars>${addStars}</stars>\n <review>${addReview}</review></film>`;\n\nurljx = \"application/xml\";\njx = xml;\njxdtype= 'xml';\n}", "function generateXML(){\r\n checkEmpty2();\r\n var value = output.value;\r\n var x2js = new X2JS();\r\n //this line important\r\n input.value = x2js.json2xml_str(JSON.parse(output.value));\r\n}", "function convertToXMLFormat() {\n var xmlContent = '<xml>\\n';\n xmlContent += '<rules>\\n';\n\n allRuleList.map(function (rule) {\n xmlContent += \"<rule\";\n xmlContent += \" name ='\" + rule.name + \"'\";\n xmlContent += \" type ='\" + rule.ruleType + \"'\";\n xmlContent += \">\\n\";\n\n xmlContent += addFindListToXML(rule.findList)\n xmlContent += addTargetListToXML(rule.extracts)\n\n xmlContent += \"</rule>\\n\";\n });\n\n xmlContent += '</rules>\\n';\n xmlContent += '</xml>\\n';\n\n //config dosyasi olustururken & yazilinca edit ile modal acinca sorunla karsilasildigi icin yapildi.\n xmlContent = xmlContent.split(\"&\").join(\"&amp;\");\n\n return xmlContent;\n}", "function getXmlParam(xmldoc,type,value,iscdata)\n {\n var paramtag = xmldoc.createElement(\"param\");\n var valuetag = xmldoc.createElement(\"value\");\n var typetag = xmldoc.createElement(type);\n var datatag;\n if(iscdata)\n {\n datatag = xmldoc.createCDATASection(value);\n }else\n {\n datatag = xmldoc.createTextNode(value);\n }\n \n typetag.appendChild(datatag);\n valuetag.appendChild(typetag);\n paramtag.appendChild(valuetag);\n return paramtag;\n }", "xml (dados) {\n let tag = this.tagSingular\n\n if (Array.isArray(dados)) {\n tag = this.tagPlural\n dados = dados.map((item) => {\n return {\n [this.tagSingular]: item\n }\n })\n \n }\n return jsontoxml({ [tag]: dados}) /*PARA CONVERTER EM XML É NECESSÁRIO UMA TAG, \n .TAG ONDE IRÁ AGRUPAR TODOS OS DADOS */\n }", "c2xml (qonly){\n let g = '';\n let h = '';\n let e = qonly ? \"\" : `editable=\"${this.editable || 'false'}\"`;\n if (this.ctype === \"value\" || this.ctype === \"list\")\n g = `path=\"${this.path}\" op=\"${Object(__WEBPACK_IMPORTED_MODULE_1__utils_js__[\"d\" /* esc */])(this.op)}\" value=\"${Object(__WEBPACK_IMPORTED_MODULE_1__utils_js__[\"d\" /* esc */])(this.value)}\" code=\"${this.code}\" ${e}`;\n else if (this.ctype === \"lookup\"){\n let ev = (this.extraValue && this.extraValue !== \"Any\") ? `extraValue=\"${this.extraValue}\"` : \"\";\n g = `path=\"${this.path}\" op=\"${Object(__WEBPACK_IMPORTED_MODULE_1__utils_js__[\"d\" /* esc */])(this.op)}\" value=\"${Object(__WEBPACK_IMPORTED_MODULE_1__utils_js__[\"d\" /* esc */])(this.value)}\" ${ev} code=\"${this.code}\" ${e}`;\n }\n else if (this.ctype === \"multivalue\"){\n g = `path=\"${this.path}\" op=\"${this.op}\" code=\"${this.code}\" ${e}`;\n h = this.values.map( v => `<value>${Object(__WEBPACK_IMPORTED_MODULE_1__utils_js__[\"d\" /* esc */])(v)}</value>` ).join('');\n }\n else if (this.ctype === \"subclass\")\n g = `path=\"${this.path}\" type=\"${this.type}\" ${e}`;\n else if (this.ctype === \"null\")\n g = `path=\"${this.path}\" op=\"${this.op}\" code=\"${this.code}\" ${e}`;\n if(h)\n return `<constraint ${g}>${h}</constraint>\\n`;\n else\n return `<constraint ${g} />\\n`;\n }", "function buildXMLString()\r\n\t\t{\r\n\t\t\tif(d.p.elName.text != \"\")\r\n\t\t\t{\r\n\t\t\t\tif(d.topGP.attGp.bottomRow.attribList.items[0].text != \"None\")\r\n\t\t\t\t{\r\n\t\t\t\t\tvar params = \"\";\r\n\t\t\t\t\tfor(var i = 0;i < d.topGP.attGp.bottomRow.attribList.items.length;i++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar item = d.topGP.attGp.bottomRow.attribList.items[i]\r\n\t\t\t\t\t\tparams += \" \" + item.text + \"='\" + item.value + \"'\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar n = \"<\" + d.p.elName.text + params + \">\" + d.topGP.attGp2.dText.text + \"</\" + d.p.elName.text + \">\";\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tvar n = \"<\" + d.p.elName.text + \">\" + d.topGP.attGp2.dText.text + \"</\" + d.p.elName.text + \">\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(d.elementGp.eText.text != \"\")\r\n\t\t\t{\r\n\t\t\t\tvar n = d.elementGp.eText.text;\r\n\t\t\t}\r\n\t\t\treturn n;\t\t\r\n\t\t}", "function saveValues() {\r\n\t \r\n\t var number = document.getElementById(\"number\").value;\r\n\t var translation = document.getElementById(\"translationSelect\").value;\r\n\t \r\n\t xmlDoc=loadXMLDoc(\"../resources/settings/\", \"settings.xml\");\r\n\t \r\n\t node = xmlDoc.getElementsByTagName(\"number\")[0].childNodes[0];\r\n\t node.nodeValue = number;\t \r\n\t xmlDoc.replaceChild(node, xmlDoc.getElementsByTagName(\"number\")[0].childNodes[0]);\r\n\t \r\n\t node = xmlDoc.getElementsByTagName(\"translation\")[0].childNodes[0];\r\n\t node.nodeValue = translation;\r\n\t xmlDoc.replaceChild(\"uuu\", xmlDoc.getElementsByTagName(\"LVEN\"));\r\n}", "function build_xml_elt( ) { \n\tvar str = \"\" ;\n\n\tstr = str + \"<?xml version='1.0' encoding='utf-8'?>\\r\\n\" ;\n\t\n\tif (rblFormArray[ IDFORM ] ) {\n\t\tstr = str + rblFormArray[ IDFORM ].startXml() + \"\\r\\n\" ;\n\t\n\t\tvar _col = 0 ;\n\t\tvar _ligne = 0 ;\n\t\tvar _id_c ;\n\t\t\n\t\t$(\"#\" + IDFORM).find(\"ul\")\n\t\t\t\t\t\t.each( function(){\n\n\t\t\t\t\t\t\t_id_c = $(this).attr(\"id_n\") ;\n\t\t\t\t\t\t\tstr = str + rblColArray[ _id_c ].startXml() ;\n\n\t\t\t\t\t\t\t$(this).find(\"li\")\n\t\t\t\t\t\t\t\t\t.each( function(){\n\t\t\t\t\t\t\t\t\t\tvar _id = $(this).attr('id') ;\n\t\t\t\t\t\t\t\t\t\tvar _x = _id.indexOf(\"f_col_\") ;\n\t\t\t\t\t\t\t\t\t\tif ( _x == 0) {\n\t\t\t\t\t\t\t\t\t\t\t_col = _col + 1 ;\n\t\t\t\t\t\t\t\t\t\t\t_ligne = 0 ;\n\t\t\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\t\t_ligne = _ligne + 1 ;\n\t\t\t\t\t\t\t\t\t\t\t\t_id = _id.substr(2) ;\n\t\t\t\t\t\t\t\t\t\t\t\tif ( rblEltArray[ _id ] != null ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tstr = str + \" \"+ rblEltArray[ _id ].drawXml(_col, _ligne) +\"\\r\\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}\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\t\t\n\t\t\t\t\t\t\tstr = str + rblColArray[ _id_c ].endXml() ;\n\t\t\t\t\t\t});\n\t\t\t\n\t\tstr = str + rblFormArray[ IDFORM ].endXml() ;\n\t}\n\telse {\n\t\t\talert ( 'form not defined' );\n\t}\n\treturn str ;\n}", "xml(dados) {\n // Nomo do campo no singular\n let tag = this.tagSingular\n\n // Verifica se os dados a serem retornados são um lista\n if (Array.isArray(dados)) {\n // Utiliza a tag no plural\n tag = this.tagPlural\n // Mapea todos os dados da lista, criando um novo objeto com todos os fornecedores separados \n dados = dados.map((item) => {\n return {\n [this.tagSingular]: item\n }\n })\n }\n\n return jsontoxml({ [tag]: dados })\n }", "function getVariableCopyItemData(data) {\n return `<tns:ZdarCgVarsC>\n <Action>${data.Action}</Action>\n <Env>${getConfig('environment')}</Env>\n <Calcgroupid>${getParamCalcGroupId()}</Calcgroupid>\n <Fromvariableid>${data.Fromvariableid}</Fromvariableid>\n <Tovariableid>${data.Tovariableid}</Tovariableid>\n <Page>assets/js/common/common.js</Page>\n </tns:ZdarCgVarsC>`;\n}", "function CreateTablesXML() {\n var date = getCurrentDate();\n var USRKEY = localStorage.getItem(\"USRKEY\");\n var USR = localStorage.getItem(\"USR\");\n var MOKED = localStorage.getItem(\"MOKED\");\n var RLSCODE = localStorage.getItem(\"RLSCODE\");\n\n var xml = '<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">\\\n <soapenv:Header/>\\\n <soapenv:Body>\\\n <tem:'+ XMLMETHOD + '>\\\n <!--Optional:-->\\\n <tem:xml><![CDATA[<DATA><MSG><SYSTEMID>1</SYSTEMID><HEADER><MSGVER>1</MSGVER><CODE>13</CODE><SENDTIME>'+ date + '</SENDTIME><GPS/><USRKEY>' + USRKEY + '</USRKEY><DEVKEY>9999</DEVKEY><VER>2</VER></HEADER><DATA><TBL><TBLID>1</TBLID><TBLDATA>1</TBLDATA><TBLSTR>1</TBLSTR></TBL></DATA></MSG></DATA>]]></tem:xml>\\\n</tem:'+ XMLMETHOD + '>\\\n </soapenv:Body>\\\n</soapenv:Envelope>';\n return xml;\n }", "assignNewIDsToXML(xml,doWorkflows=true){\r\n var xmlString = xml;//(new XMLSerializer()).serializeToString(xml);\r\n var id = int(this.idNum)+1;\r\n //Nodes\r\n while(xmlString.indexOf(\"<id>\")>=0){\r\n var startIndex=xmlString.indexOf(\"<id>\");\r\n var endIndex = xmlString.indexOf(\"</id>\");\r\n var replaceId=xmlString.substring(startIndex+4,endIndex);\r\n xmlString=xmlString.substring(0,startIndex)+\"<tempid>\"+id+\"</tempid>\"+xmlString.substring(endIndex+5);\r\n //cycle through all the links. Linked IDs need to be updated, otherwise they'll link to random things.\r\n while(xmlString.indexOf(\"<topnode>\"+replaceId+\"</topnode>\")>=0){xmlString = xmlString.replace(\"<topnode>\"+replaceId+\"</topnode>\",\"<topnode>temporaryID\"+id+\"</topnode>\");}\r\n while(xmlString.indexOf(\"<bottomnode>\"+replaceId+\"</bottomnode>\")>=0){xmlString = xmlString.replace(\"<bottomnode>\"+replaceId+\"</bottomnode>\",\"<bottomnode>temporaryID\"+id+\"</bottomnode>\");}\r\n while(xmlString.indexOf(\"<targetid>\"+replaceId+\"</targetid>\")>=0){xmlString = xmlString.replace(\"<targetid>\"+replaceId+\"</targetid>\",\"<targetid>temporaryID\"+id+\"</targetid>\");}\r\n xmlString = this.assignNewIDsToXMLArrays(xmlString,\"fixedlinkARRAY\",replaceId,\"\"+id);\r\n id++;\r\n }\r\n //Weeks\r\n while(xmlString.indexOf(\"<weekid>\")>=0){\r\n var startIndex=xmlString.indexOf(\"<weekid>\");\r\n var endIndex = xmlString.indexOf(\"</weekid>\");\r\n var replaceId=xmlString.substring(startIndex+8,endIndex);\r\n xmlString=xmlString.substring(0,startIndex)+\"<weektempid>\"+id+\"</weektempid>\"+xmlString.substring(endIndex+9);\r\n id++;\r\n }\r\n //Workflows\r\n if(doWorkflows)while(xmlString.indexOf(\"<wfid>\")>=0){\r\n var startIndex=xmlString.indexOf(\"<wfid>\");\r\n var endIndex = xmlString.indexOf(\"</wfid>\");\r\n var replaceId=xmlString.substring(startIndex+6,endIndex);\r\n xmlString=xmlString.substring(0,startIndex)+\"<wftempid>\"+id+\"</wftempid>\"+xmlString.substring(endIndex+7);\r\n //cycle through all the links. Linked IDs need to be updated, otherwise they'll link to random things.\r\n xmlString = this.assignNewIDsToXMLArrays(xmlString,\"usedwfARRAY\",replaceId,\"\"+id);\r\n xmlString = this.assignNewIDsToXMLArrays(xmlString,\"linkedwf\",replaceId,\"\"+id);\r\n id++;\r\n }\r\n if(doWorkflows)while(xmlString.indexOf(\"<tagid>\")>=0){\r\n var startIndex=xmlString.indexOf(\"<tagid>\");\r\n var endIndex = xmlString.indexOf(\"</tagid>\");\r\n var replaceId=xmlString.substring(startIndex+7,endIndex);\r\n xmlString=xmlString.substring(0,startIndex)+\"<tagtempid>\"+id+\"</tagtempid>\"+xmlString.substring(endIndex+8);\r\n //cycle through all the links. Linked IDs need to be updated, otherwise they'll link to random things.\r\n while(xmlString.indexOf(\"<nodetagid>\"+replaceId+\"</nodetagid>\")>=0){xmlString = xmlString.replace(\"<nodetagid>\"+replaceId+\"</nodetagid>\",\"<nodetagid>temporaryID\"+id+\"</nodetagid>\");}\r\n while(xmlString.indexOf(\"<linktagid>\"+replaceId+\"</linktagid>\")>=0){xmlString = xmlString.replace(\"<linktagid>\"+replaceId+\"</linktagid>\",\"<linktagid>temporaryID\"+id+\"</linktagid>\");}\r\n xmlString = this.assignNewIDsToXMLArrays(xmlString,\"tagsetARRAY\",replaceId,\"\"+id);\r\n xmlString = this.assignNewIDsToXMLArrays(xmlString,\"tagARRAY\",replaceId,\"\"+id);\r\n id++;\r\n }\r\n //replace all those temp id tage with real ones.\r\n while(xmlString.indexOf(\"tempid>\")>=0)xmlString = xmlString.replace(\"tempid>\",\"id>\");\r\n while(xmlString.indexOf(\"temporaryID\")>=0)xmlString = xmlString.replace(\"temporaryID\",\"\");\r\n //save the new id number\r\n this.idNum=id;\r\n //return as string\r\n return xmlString;\r\n \r\n }", "function setSerializedInsertingDataVariables(strSerialized)\n{\n\tvar numPos1 = 0;\n\tvar numPos2 = 0;\n\t//since the format of strSerialized is dependent on how to pass it\n\t//to javascript in XSLT, two tag cases must be included.\n\tvar strCloseTag1 = \">\";\n\tvar strStartTag1 = \"<\";\n\tvar strCloseTag2 = \"&gt;\";\n\tvar strStartTag2 = \"&lt;\";\n\tnumPos1 = strSerialized.indexOf(strCloseTag1);\n\tif(numPos1 > 0){\n\t\tstrSerializedInsertingDataFirstPart = strSerialized.substring(0, numPos1 + strCloseTag1.length);\n\t\t//strSerializedInsertingDataRestPart = strSerialized.substring(numPos1 + 1 + strCloseTag1.length);\n\t\tstrSerializedInsertingDataRestPart = strSerialized.substring(numPos1 + strCloseTag1.length);\n\t}else{\n\t\tnumPos2 = strSerialized.indexOf(strCloseTag2);\n\t\tif(numPos2 > 0){\n\t\t\tstrSerializedInsertingDataFirstPart = strSerialized.substring(0, numPos2 + strCloseTag2.length);\n\t\t\t//strSerializedInsertingDataRestPart = strSerialized.substring(numPos2 + 1 + strCloseTag2.length);\n\t\t\tstrSerializedInsertingDataRestPart = strSerialized.substring(numPos2 + strCloseTag2.length);\n\t\t}\n\t}\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the sentence "The quick brown fox jumps over the lazy dog" is a pangram, because it uses the letters AZ at least once (case is irrelevant). Given a string, detect whether or not it is a pangram. Return True if it is, False if not. Ignore numbers and punctuation. remove all nonletter chars split the string
function isPangram(str){ const alphArr = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']; let s = str.replace(/[^a-z]/ig, ''); let strArr = s.toLowerCase().split(''); strArr.map(char => alphArr.includes(char) && alphArr.splice(alphArr.indexOf(char), 1)); return !alphArr.length; }
[ "function isPangram(string) {\n return [...string.replace(/[^\\w\\s]|_/g, \"\").replace(/[0-9]/g, '').split(\" \")].every((item) => item.length + 1 === 26 ? false : item.length === new Set(item).size);\n}", "function isPangram(string){\n return /(?=.*a)(?=.*b)(?=.*c)(?=.*d)(?=.*e)(?=.*f)(?=.*g)(?=.*h)(?=.*i)(?=.*j)(?=.*k)(?=.*l)(?=.*m)(?=.*n)(?=.*o)(?=.*p)(?=.*q)(?=.*r)(?=.*s)(?=.*t)(?=.*u)(?=.*v)(?=.*w)(?=.*x)(?=.*y)(?=.*z)./i.test(string)\n}", "function isPangram(string) {\n const filtered = string\n .toUpperCase()\n .split('')\n .filter(char => char.charCodeAt(0) >= 65 && char.charCodeAt(0) <= 90);\n\n return [...new Set(filtered)].length === 26;\n}", "function isPangram(sentence){\n const letters = \"aąbcćdeęfghijklłmnńoóprsśtuwyzźż\";\n const lowerCaseString = sentence.toLowerCase();\n for(let i = 0; i < letters.length; i++){\n if(lowerCaseString.indexOf(letters[i]) == -1)\n return false;\n }\n return true;\n}", "function isPangram(string){\n string = string.toLowerCase();\n let letras = 'abcdefghijklmnopqrstuvwxyz';\n let panStr = letras.split(\"\");\n return panStr.every(x => string.includes(x));\n}", "function _isPangram(string) {\n let arr = string.split(\"\");\n let alphabet = \"abcdefghijklmnopqrstuvwxyz\".split(\"\");\n let pangramCheck = alphabet.map((letter) => arr.includes(letter));\n return !pangramCheck.includes(false);\n}", "function isPangram(sentence){\n // const letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',\n // 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',\n // 't', 'u', 'v', 'w', 'x', 'y', 'z'];\n // for (let letter of letters){\n // if (sentence.toLowerCase().indexOf(letter) === -1) {\n // return false;\n // }\n // }\n // return true;\n\n let lowerCased = sentence.toLowerCase();\n for (let char of 'abcdefghijklmnopqrstuvwxyz') {\n if (!lowerCased.includes(char)){\n return false;\n }\n }\n return true;\n}", "function isPangram(string){\n newString = [...new Set(string.toLowerCase())].toString().replace(/[^a-zA-Z]/g, '').toLowerCase();\n return [...new Set(newString)].length === 26;\n }", "function isAPangram (sentence) {\n const lowerSentence = sentence.toLowerCase()\n for (let char of 'abcdefghijklmnopqrstuvwxyz'){\n if (!lowerSentence.includes(char)){\n return false\n }\n }\n return true\n}", "function isPangram(input) {\n\tlet arr = input.split(''),\n\t\t\talphabet = {},\n\t\t\tsize = 0;\n\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tlet letter = arr[i].toLowerCase();\n\n\t\tif (alphabet[letter] === undefined && letter.match(/[a-z]/ig)) {\n\t\t\talphabet[letter] = letter;\n\t\t}\n\t}\n\n\tfor (let key in alphabet) {\n\t\tsize++;\n\t}\n\n\tconsole.log(size === 26 ? 'pangram' : 'not pangram');\n}", "function pangrams(s) {\n let baseStr = s.toLowerCase()\n let testStr = \"abcdefghijklmnopqrstuvwxyz\".split('');\n let counter=0\n for (let i = 0; i < baseStr.length; i++){\n if (testStr.includes(baseStr[i])) {\n delete testStr[testStr.indexOf(baseStr[i])]\n counter++;\n }\n\n }\n return counter==26 ? \"pangram\" : \"not pangram\"\n\n}", "function pangrams(s) {\n s = s.toUpperCase(); //convert the string into one case eith uper or lower\n s = s.split(' ').join(''); // remove all the spaces\n s = s.split(''); // create all char array.\n s = [...new Set(s)]; // remove duplicate character from the array.\n\n return (s.length === 26 ? \"pangram\" : \"not pangram\");\n}", "function hasPunctuation(string) {\n return /[!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~]/g.test(string);\n}", "function pangrams(s) {\r\n s=s.toLowerCase()\r\n for (let i in s) {\r\n if(sta.indexOf(s[i])!=-1)\r\n sta.splice(sta.indexOf(s[i]),1)\r\n }\r\n\r\n if (sta.length==0)\r\n return \"pangram\"\r\n \r\n else\r\n return \"not pangram\";\r\n }", "function isSimplePhrase(input) {\n return /^[\\w !#$%&'*+-\\/=?^_`{|}~]+$/.test(input);\n}", "function pangram(str){\n let abcArr = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];\n let strLen = str.length;\n str = str.toLowerCase();\n let answer = \"true\";\n\n for (let i=0; i<26;i++ ){\n \n for(let k=0; k<strLen;k++){\n if(str.charAt(k) === abcArr[i]){\n answer = \"true\";\n k = str.Len\n }\n else{\n answer = \"false\"\n }\n }\n }\n return answer;\n }", "function isTitleString(str) {\n var words = str.split(\" \"); // Split string where there's a space\n // Loop through the words\n for (var k = 0; k < words.length; k++) {\n // If word starts with a lower-case letter, return false\n // .charCodeAt(ind) returns the UTF-16 character code at some index in the string\n // \"a\" returns 97, while \"z\" returns 122\n if (words[k].charCodeAt(0) >= 97 && words[k].charCodeAt(0) <= 122) {\n return false;\n }\n }\n return true;\n}", "function palindromePermutation(str) {\n const standard = str.toLowerCase();\n const set = new Set();\n for (let i = 0; i < standard.length; i++) {\n let char = standard[i];\n if (char === ' ') {\n continue;\n }\n set.has(char) ? set.delete(char) : set.add(char);\n }\n return set.size <= 1;\n}", "function cleanUp(str) {\n let regex = /[^a-z]/gi;\n let words = str.replace(regex, ' ').split(' ');\n words = words.filter(word => word !== '');\n return words.join(' ');\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes the groupings (x and yaxis color bars).
function change_groups(inst_index) { d3.selectAll('.' + dom_class) .style('fill', function(d) { return group_colors[d.group[inst_index]]; }); }
[ "function runGroupingStep() {\n var groupColors = [\"#1abc9c\", \"#3498db\", \"#9b59b6\", \"#2ecc71\",\n \"#f1c40f\", \"#e67e22\", \"#e74c3c\",\n \"#16a085\", \"#27ae60\", \"#2980b9\", \"#8e44ad\",\n \"#f39c12\", \"#d35400\",\"#c0392b\"];\n\n toggleAnimating();\n var currentGroup = [];\n config.points.forEach(function(point) {\n // Erase old, ungrouped point\n graphics.setTransition(0);\n if (currentGroup.length == config.m - 1)\n graphics.setDelay(40);\n else\n graphics.setDelay(0);\n graphics.erasePoint(point);\n\n // Get the group color\n var groupID = config.groups.length;\n var pointColor = groupColors[groupID % groupColors.length];\n graphics.setColor(pointColor);\n\n // Add the new, grouped point\n graphics.setDelay(0);\n graphics.setTransition(0);\n var x = point.getX();\n var y = point.getY();\n var coloredPoint = graphics.drawPoint(x, y);\n currentGroup.push(coloredPoint);\n\n // Change groups when group is filled\n if (currentGroup.length == config.m) {\n config.groups.push(currentGroup);\n currentGroup = [];\n }\n }, currentGroup);\n if (currentGroup.length != 0)\n config.groups.push(currentGroup);\n graphics.whenDone(toggleAnimating);\n }", "function goGrouped() {\n yscale.domain([0, yGroupedMax]);\n rects.transition()\n .duration(1000)\n .delay(function (d, i) { return i * 20; })\n .attr(\"x\", function (d, i, j) { return xscale(i) + xscale.rangeBand() / stackedData.length * j; })\n .attr(\"width\", xscale.rangeBand() / stackedData.length)\n .transition()\n .attr(\"y\", function (d) { return yscale(d.y); })\n .attr(\"height\", function (d) { return chartHeight - yscale(d.y); });\n gridLines.data(yscale.ticks(10)).transition()\n .duration(1000)\n .delay(function (d, i) { return i * 20; })\n .attr(\"y1\", yscale)\n .attr(\"y2\", yscale);\n gridLabels.data(yscale.ticks(10)).transition()\n .duration(1000)\n .delay(function (d, i) { return i * 20; })\n .attr(\"y\", yscale)\n .text(String);\n}", "function transitionGrouped() {\n currentChartType = 'grouped';\n y.domain([0, yGroupMax]);\n\n rect.transition()\n .duration(500)\n .delay(function(d, i) {\n return i * 10;\n })\n .attr(\"x\", function(d, i, j) {\n return x(d.x) + x.rangeBand() / n * j;\n })\n .attr(\"width\", x.rangeBand() / n)\n .transition()\n .attr(\"y\", function(d) {\n return y(d.y);\n })\n .attr(\"height\", function(d) {\n return height - y(d.y);\n });\n\n //update y axis\n yAxisGroupSelector\n .transition()\n .duration(500)\n .call(yAxis);\n }", "function numbergroupChanged(ng) {\n\n // Change subtitle\n $(\"#viz-container h2\").text(subtitleDic[ng]);\n\n // Needs to recalculate categoryTotal\n data.forEach(function(d, i) {\n y0 = 0;\n d.categories = color.domain().map(function(name, k) { \n return {\n name: name, \n y0: y0, \n y1: y0 += d.Category[k][ng],\n rawNumber: d.Category[k][ng],\n channels: d.Category[k][\"Channels\"]\n }; \n });\n categoryTotal[i] = y0;\n\n d.categories.forEach(function(d) { \n d.y0 /= categoryTotal[i]; \n d.y1 /= categoryTotal[i]; \n });\n });\n\n categoryChanged(selectedNumbergroup);\n}", "function updateGroupBarChart(data) {\n window.myGroup.data = data;\n window.myGroup.update();\n}", "function update_groups(x,y){\n d3.selectAll(\".group\").remove();\n create_groups();\n // This code is tested and works to update. It's here if needed.\n // var area = d3.area()\n // .curve(d3.curveBasisOpen)\n // .x(function(d) { return x(d.x); })\n // .y0(function(d) { return y(d.y); })\n // .y1(function(d) { return y(d.height); });\n //\n // d3.selectAll(\".group\")\n // .transition()\n // .attr(\"d\", area);\n}", "function createGroupedBars() {\n //set all values by series\n chart.data.forEach(function (d) {\n d.values = axis.serieNames.map(function (name) {\n return {\n name: name,\n xValue: d[chart.xField],\n yValue: +d[name]\n };\n })\n });\n\n //get new y domain\n var newYDomain = [0, d3.max(chart.data, function (d) {\n return d3.max(d.values, function (v) {\n return v.yValue * 1.1;\n });\n })];\n\n //check whether the chart is reversed\n if (isReversed) {\n //set new domain\n newYDomain = [d3.max(chart.data, function (d) {\n return d3.max(d.values, function (v) {\n return v.yValue * 1.1;\n });\n }), 0];\n\n //update x axis\n axis.x.domain(newYDomain);\n } else {\n //update y axis\n axis.y.domain(newYDomain);\n }\n\n //get range band\n var rangeBand = groupAxis.rangeBand();\n\n //create bar groups on canvas\n groupedBars = chart.svg.selectAll('.eve-series')\n .data(chart.data)\n .enter().append('g')\n .attr('class', 'eve-series')\n .attr('transform', function (d) {\n if (isReversed)\n return 'translate(' + (axis.offset.left) + ',' + (axis.y(d[chart.xField])) + ')';\n else\n return 'translate(' + (axis.x(d[chart.xField]) + axis.offset.left) + ',0)';\n });\n\n //create bar group rectangles\n groupedBarsRects = groupedBars.selectAll('rect')\n .data(function (d) { return d.values; })\n .enter().append('rect')\n .attr('class', function (d, i) { return 'eve-bar-serie eve-bar-serie-' + i; })\n .attr('width', function (d) { return isReversed ? (axis.offset.width - axis.x(d.yValue)) : rangeBand; })\n .attr('x', function (d) { return isReversed ? 0 : groupAxis(d.name); })\n .attr('y', function (d) { return isReversed ? groupAxis(d.name) : axis.y(d.yValue); })\n .attr('height', function (d) { return isReversed ? rangeBand : (axis.offset.height - axis.y(d.yValue)); })\n .style('fill', function (d, i) {\n //check whether the serie has color\n if (chart.series[i].color === '')\n return i <= e.colors.length ? e.colors[i] : e.randColor();\n else\n return chart.series[i].color;\n })\n .style('stroke', '#ffffff')\n .style('stroke-width', function (d, i) { return chart.series[i].strokeSize + 'px'; })\n .style('stroke-opacity', function (d, i) { return chart.series[i].alpha; })\n .style('fill-opacity', function (d, i) { return chart.series[i].alpha; })\n .on('mousemove', function(d, i) {\n var balloonContent = chart.getXYFormat(d, chart.series[d.index]);\n\n //show balloon\n chart.showBalloon(balloonContent);\n\n //increase bullet stroke size\n d3.select(this)\n .style('stroke-width', function (d) { return chart.series[i].strokeSize + 1; });\n })\n .on('mouseout', function(d, i) {\n //hide balloon\n chart.hideBalloon();\n\n //increase bullet stroke size\n d3.select(this)\n .style('stroke-width', function (d) { return chart.series[i].strokeSize; });\n });\n\n //set serie labels\n groupedBarsTexts = groupedBars.selectAll('text')\n .data(function(d) { return d.values; })\n .enter().append('text')\n .attr('class', function(d, i) { return 'eve-bar-label eve-bar-label-' + i; })\n .style('cursor', 'pointer')\n .style('fill', function(d, i) { return chart.series[i].labelFontColor; })\n .style('font-weight', function(d, i) { return chart.series[i].labelFontStyle == 'bold' ? 'bold' : 'normal'; })\n .style('font-style', function(d, i) { return chart.series[i].labelFontStyle == 'bold' ? 'normal' : chart.series[i].labelFontStyle; })\n .style(\"font-family\", function(d, i) { return chart.series[i].labelFontFamily; })\n .style(\"font-size\", function(d, i) { return chart.series[i].labelFontSize + 'px'; })\n .text(function(d, i) {\n //check whether the label format is enabled\n if(chart.series[i].labelFormat != '')\n return chart.getXYFormat(d, chart.series[i], 'label');\n })\n .attr('x', function(d, i) {\n //return calculated x pos\n return isReversed ? (axis.offset.width - axis.x(d.yValue)) : (i * rangeBand);\n })\n .attr('y', function(d, i) {\n //return calculated y pos\n return isReversed ? groupAxis(d.name) + rangeBand : axis.y(d.yValue) - 2;\n });\n }", "appendAxisGroups() {\n let vis = this;\n\n vis.xAxisG = vis.chart.append('g')\n .attr('class', 'axis x-axis x-axis-barchart');\n\n vis.yAxisG = vis.chart.append('g')\n .attr('class', 'axis y-axis y-axis-barchart');\n }", "function createGroupedBars() {\n //set all values by series\n chart.data.forEach(function (d) {\n d.values = axis.serieNames.map(function (name) {\n return {\n name: name,\n xValue: d[chart.xField],\n yValue: +d[name]\n };\n })\n });\n\n //get new y domain\n var newYDomain = [0, d3.max(chart.data, function (d) {\n return d3.max(d.values, function (v) {\n return v.yValue * 1;\n });\n })];\n\n //check whether the chart is reversed\n if (isReversed) {\n //set new domain\n newYDomain = [d3.max(chart.data, function (d) {\n return d3.max(d.values, function (v) {\n return v.yValue * 1;\n });\n }), 0];\n\n //update x axis\n axis.x.domain(newYDomain);\n } else {\n //update y axis\n axis.y.domain(newYDomain);\n }\n\n //get range band\n var rangeBand = groupAxis.rangeBand();\n\n //create bar groups on canvas\n groupedBars = chart.svg.selectAll('.eve-series')\n .data(chart.data)\n .enter().append('g')\n .attr('class', 'eve-series')\n .attr('transform', function (d) {\n if (isReversed)\n return 'translate(' + (axis.offset.left) + ',' + (axis.y(d[chart.xField])) + ')';\n else\n return 'translate(' + (axis.x(d[chart.xField]) + axis.offset.left) + ',0)';\n });\n\n //create bar group rectangles\n groupedBarsRects = groupedBars.selectAll('rect')\n .data(function (d) { return d.values; })\n .enter().append('rect')\n .attr('class', function (d, i) { return 'eve-bar-serie eve-bar-serie-' + i; })\n .attr('width', function (d) { return isReversed ? (axis.offset.width - axis.x(d.yValue)) : rangeBand; })\n .attr('x', function (d) { return isReversed ? 0 : groupAxis(d.name); })\n .attr('y', function (d) { return isReversed ? groupAxis(d.name) : axis.y(d.yValue); })\n .attr('height', function (d) { return isReversed ? rangeBand : (axis.offset.height - axis.y(d.yValue)); })\n .style('fill', function (d, i) {\n //check whether the serie has color\n if (chart.series[i].color === '')\n return i <= e.colors.length ? e.colors[i] : e.randColor();\n else\n return chart.series[i].color;\n })\n .style('stroke', '#ffffff')\n .style('stroke-width', function (d, i) { return chart.series[i].strokeSize + 'px'; })\n .style('stroke-opacity', function (d, i) { return chart.series[i].alpha; })\n .style('fill-opacity', function (d, i) { return chart.series[i].alpha; })\n .on('mousemove', function(d, i) {\n var balloonContent = chart.getXYFormat(d, chart.series[d.index]);\n\n //show balloon\n chart.showBalloon(balloonContent);\n\n //increase bullet stroke size\n d3.select(this)\n .style('stroke-width', function (d) { return chart.series[i].strokeSize + 1; });\n })\n .on('mouseout', function(d, i) {\n //hide balloon\n chart.hideBalloon();\n\n //increase bullet stroke size\n d3.select(this)\n .style('stroke-width', function (d) { return chart.series[i].strokeSize; });\n });\n\n //set serie labels\n groupedBarsTexts = groupedBars.selectAll('text')\n .data(function(d) { return d.values; })\n .enter().append('text')\n .attr('class', function(d, i) { return 'eve-bar-label eve-bar-label-' + i; })\n .style('cursor', 'pointer')\n .style('fill', function(d, i) { return chart.series[i].labelFontColor; })\n .style('font-weight', function(d, i) { return chart.series[i].labelFontStyle == 'bold' ? 'bold' : 'normal'; })\n .style('font-style', function(d, i) { return chart.series[i].labelFontStyle == 'bold' ? 'normal' : chart.series[i].labelFontStyle; })\n .style(\"font-family\", function(d, i) { return chart.series[i].labelFontFamily; })\n .style(\"font-size\", function(d, i) { return chart.series[i].labelFontSize + 'px'; })\n .text(function(d, i) {\n //check whether the label format is enabled\n if(chart.series[i].labelFormat != '')\n return chart.getXYFormat(d, chart.series[i], 'label');\n })\n .attr('x', function(d, i) {\n //return calculated x pos\n return isReversed ? (axis.offset.width - axis.x(d.yValue)) : (i * rangeBand);\n })\n .attr('y', function(d, i) {\n //return calculated y pos\n return isReversed ? groupAxis(d.name) + rangeBand : axis.y(d.yValue) - 2;\n });\n }", "function repaintGroups() {\r\n\tfor(group in groups) {\r\n\t\tif(groups.hasOwnProperty(group)) {\r\n\t\t\tgroups[group].marker.setMap(map.getZoom()>16 && map.getZoom()<18 ? map : null);\r\n\t\t\tif(map.getZoom()<18) {\r\n\t\t\t\tfor(var i=0;i<groups[group].locations.length;++i) {\r\n\t\t\t\t\tvar j = groups[group].locations[i];\r\n\t\t\t\t\tlocations[j].marker.setIcon(encodeSvg());\r\n\t\t\t\t\tif(j==selectedLocationIndex) {\r\n\t\t\t\t\t\tgroups[group].marker.setIcon(encodeSvg(getTextSvg('group',true,true,groups[group].text,groups[group].text)));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "createGroups() {\n this.xAxisG = this.g.diagram.append('g')\n .attr('class', 'top-axis axis')\n .attr('clip-path', 'url(#clip-path)');\n this.yLeftAxisG = this.g.diagram.append('g')\n .attr('class', 'left-axis axis');\n this.yRightAxisG = this.g.diagram.append('g')\n .attr('class', 'right-axis axis')\n .attr('transform', `translate(${this.dims.marey.innerWidth},0)`);\n this.yScrollAxisG = this.g.scroll.append('g')\n .attr('class', 'scroll-axis axis');\n this.yStopSelAxisG = this.g.stopSelection.append('g')\n .attr('class', 'stop-selection-axis axis');\n this.tripsG = this.g.diagram.append('g')\n .attr('class', 'trips')\n .attr('clip-path', 'url(#clip-path-trips)');\n this.timelineG = this.g.diagram.append('g')\n .attr('class', 'timeline');\n }", "setBarsToSortedColor(bars) {\n 'use strict';\n super.setBarsToSortedColor(bars);\n }", "function groupBubbles() {\n hideGroups();\n\n force.on('tick', function (e) {\n bubbles.each(moveToCenter(e.alpha))\n .attr('cx', function (d) { return d.x; })\n .attr('cy', function (d) { return d.y; });\n });\n\n force.start();\n }", "assignGroups() {\n\t\t// Assign colors to groups.\n\t\tlet colorChanged = 0;\n\t\tfor (let i=0; i<this.colors.length; i++) {\n\t\t\tlet minDiff = Number.MAX_VALUE;\n\t\t\tlet groupIndex = -1;\n\t\t\tfor (let j=0; j<this.groups.length; j++) {\n\t\t\t\tlet diff = RGBA.difference(this.groups[j].mean, this.colors[i]);\n\t\t\t\tif (diff < minDiff) {\n\t\t\t\t\tminDiff = diff;\n\t\t\t\t\tgroupIndex = j;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.groups[groupIndex].newList.push(this.colors[i]);\n\t\t\tif (this.groups[groupIndex].oldList.indexOf(this.colors[i]) < 0) {\n\t\t\t\tcolorChanged++;\n\t\t\t}\n\t\t}\n\t\t// Swap old list with new list.\n\t\tfor (let i=0; i<this.groups.length; i++) {\n\t\t\tthis.groups[i].oldList = this.groups[i].newList;\n\t\t\tthis.groups[i].newList = [];\n\t\t}\n\t\treturn colorChanged / this.colors.length;\n\t}", "initGroups() {\n\t\tthis.groups.push({\n\t\t\tmean: RGBA.zero(),\n\t\t\tsd: RGBA.zero(),\n\t\t\toldList: [],\n\t\t\tnewList: []\n\t\t});\n\t}", "function setGroupCss(options) {\n for (var key in options) {\n if (options.hasOwnProperty(key)) {\n setCss.call(this, key, options[key]);\n }\n }\n }", "function groupedBarChart() {\n\n\t//pading around the chart\n\tvar margin = {\n\t\t\ttop: 20,\n\t\t\tright: 20,\n\t\t\tbottom: 30,\n\t\t\tleft: 40\n\t\t};\n\tvar width = 960 - margin.left - margin.right;\n\tvar height = 500 - margin.top - margin.bottom;\n\tvar yLabel =\"\";\n\n\t//column name of first grouping\n\t//the bars will be grouped by this column\n\tvar mainGroupingName = \"\"\n\n\t//scale responsible for the main grouping\n\tvar x0 = d3.scale.ordinal()\n\n\t//scale responsible for the grouped bars\n\t//it \"exists\" inside x0: its range is as big as one band in X0\n\tvar x1 = d3.scale.ordinal();\n\n\tvar y = d3.scale.linear();\n\n\t//a color scale for the grouped bars\n\tvar color = d3.scale.category20();\n\t\n\tvar xAxis = d3.svg.axis()\n\t\t.scale(x0)\n\t\t.orient(\"bottom\");\n\n\tvar yAxis = d3.svg.axis()\n\t\t.scale(y)\n\t\t.orient(\"left\")\n\t\t.tickFormat(d3.format(\".2s\"));\n\n\t//add styling to the axis. \n\tvar styleAxis = function (element) {\n\t\telement.style(\"fill\", \"none\")\n\t\t\t.style(\"stroke\", \"#000\")\n\t\t\t.style(\"shape-rendering\", \"crispEdges\")\n\t\t\t.style(\"font\", \"10px sans-serif\")\n\n\t\treturn element;\n\t}\n\n\tvar chart = function (selection) {\n\n\t\tselection.each(function (data) {\n\n\t\t\t//retrieve the inner grouping column names as all the column names of a node except the primary one\n\t\t\tvar secondGroupingNames = d3.keys(data[0]).filter(function (key) {\n\t\t\t\treturn key !== mainGroupingName;\n\t\t\t});\n\n\t\t\t//add a new field to all data objects that contains an array off all the values in a key - value format\n\t\t\t//this is needed to be able to join the grouped data to its marks\n\t\t\tdata.forEach(function (d) {\n\t\t\t\td.secondGrouping = secondGroupingNames.map(function (name) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: name,\n\t\t\t\t\t\tvalue: +d[name]\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tx0.rangeRoundBands([0, width], .1); \n\n\t\t\t//the domain of the primary grouping\n\t\t\tx0.domain(data.map(function (d) {\n\t\t\t\treturn d[mainGroupingName];\n\t\t\t}));\n\n\t\t\t//the domain of the secondary grouping represents the values of the secondary grouped columns\n\t\t\t//the range is the range of one of the primary groupings. This ensures that the grouped columns fit in the larger grouping\n\t\t\tx1.domain(secondGroupingNames).rangeRoundBands([0, x0.rangeBand()]);\n\t\t\t\n\t\t\ty.range([height, 0]);\n\n\t\t\t//compute the maximum of all the nested values\n\t\t\ty.domain([0, d3.max(data, function (d) {\n\t\t\t\treturn d3.max(d.secondGrouping, function (d) {\n\t\t\t\t\treturn d.value;\n\t\t\t\t});\n\t\t\t})]);\n\n\t\t\tvar svg = d3.select(this) //the element that contains the graph\n\t\t\t\t.append(\"svg\") //create the svg\n\t\t\t\t.attr(\"width\", width + margin.left + margin.right) //width, including margins\n\t\t\t\t.attr(\"height\", height + margin.top + margin.bottom) //height, including margins\n\t\t\t\t.append(\"g\")\n\t\t\t\t.attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\"); //translate to margin corner\n\n\t\t\t//Ox axis styling\n\t\t\tsvg.append(\"g\")\n\t\t\t\t.call(styleAxis)\n\t\t\t\t.attr(\"transform\", \"translate(0,\" + height + \")\")\n\t\t\t\t.call(xAxis);\n\n\t\t\t//Oy axis styling and label\n\t\t\tsvg.append(\"g\")\n\t\t\t\t.call(styleAxis)\n\t\t\t\t.call(yAxis)\n\t\t\t\t.append(\"text\")\n\t\t\t\t.attr(\"transform\", \"rotate(-90)\")\n\t\t\t\t.attr(\"y\", 6)\n\t\t\t\t.attr(\"dy\", \".71em\")\n\t\t\t\t.style(\"text-anchor\", \"end\")\n\t\t\t\t.text(yLabel);\n\n\t\t\t//create groups for each main grouping value\n\t\t\tvar mainGrouping = svg.selectAll(\".mainGrouping\")\n\t\t\t\t.data(data) //the top level data is joined, each row in the data gets one group\n\t\t\t\t.enter().append(\"g\")\n\t\t\t\t.attr(\"class\", \"g\")\n\t\t\t\t.attr(\"transform\", function (d) {\n\t\t\t\t\treturn \"translate(\" + x0(d[mainGroupingName]) + \",0)\"; //each main grouping is translated to a position via the x0 scale\n\n\t\t\t\t});\n\n\t\t\t//create the grouped bars\n\t\t\tmainGrouping.selectAll(\"rect\")\n\t\t\t\t.data(function (d) { //for each row, join its nested data to rectangles from inside each higher level group\n\t\t\t\t\treturn d.secondGrouping;\n\t\t\t\t})\n\t\t\t\t.enter().append(\"rect\")\n\t\t\t\t.attr(\"width\", x1.rangeBand()) //use x1 to get the height of a single bar, so it fits inside the larger band defined by x0\n\t\t\t\t.attr(\"x\", function (d) {\n\t\t\t\t\treturn x1(d.name); //use x1 to obtain the position of a specific bar\n\t\t\t\t})\n\t\t\t\t.attr(\"y\", function (d) {\n\t\t\t\t\treturn y(d.value); //use y to scale the actual value\n\t\t\t\t})\n\t\t\t\t.attr(\"height\", function (d) {\n\t\t\t\t\treturn height - y(d.value);\n\t\t\t\t})\n\t\t\t\t.style(\"fill\", function (d) {\n\t\t\t\t\treturn color(d.name); //get the color for a specific bar\n\t\t\t\t});\n\n\n\t\t\tvar legend = svg.selectAll(\".legend\")\n\t\t\t\t.data(secondGroupingNames.slice())\n\t\t\t\t.enter().append(\"g\")\n\t\t\t\t.attr(\"class\", \"legend\")\n\t\t\t\t.attr(\"transform\", function (d, i) {\n\t\t\t\t\treturn \"translate(0,\" + i * 20 + \")\"; //put the legend boxes vertically on top of each other\n\t\t\t\t});\n\n\t\t\tlegend.append(\"rect\")\n\t\t\t\t.attr(\"x\", width - 18)\n\t\t\t\t.attr(\"width\", 18)\n\t\t\t\t.attr(\"height\", 18)\n\t\t\t\t.style(\"fill\", color);\n\n\t\t\tlegend.append(\"text\")\n\t\t\t\t.attr(\"x\", width - 24)\n\t\t\t\t.attr(\"y\", 9)\n\t\t\t\t.attr(\"dy\", \".35em\")\n\t\t\t\t.style(\"text-anchor\", \"end\")\n\t\t\t\t.text(function (d) {\n\t\t\t\t\treturn d;\n\t\t\t\t});\n\t\t});\n\n\t}\n\n\t//here be getters and setters\n\n\tchart.mainGroupingName = function (value) {\n\t\tif (!arguments.length) return dateFormat;\n\t\tmainGroupingName = value;\n\n\t\treturn this;\n\t};\n\n\tchart.width = function (value) {\n\t\tif (!arguments.length) return width;\n\t\twidth = value - margin.left - margin.right;\n\n\t\treturn this;\n\t};\n\n\tchart.height = function (value) {\n\t\tif (!arguments.length) return height;\n\t\theight = value - margin.top - margin.bottom;\n\n\t\treturn this;\n\t};\n\n\tchart.yLabel = function (value) {\n\t\tif (!arguments.length) return yLabel;\n\t\tyLabel = value;\n\n\t\treturn this;\n\t};\n\n\tchart.yLabel = function (value) {\n\t\tif (!arguments.length) return yLabel;\n\t\tyLabel = value;\n\n\t\treturn this;\n\t};\n\n\treturn chart;\n}", "_renderGroups(dataset, restForDataset) {\n const colors = [\n \"rgb(58, 189, 174)\",\n \"rgb(74, 140, 219)\",\n \"rgb(245, 155, 66)\",\n \"rgb(95, 103, 114)\",\n \"rgb(76, 63, 130)\"\n ];\n\n this._groups = this._svg\n .selectAll(\"g.data-container\")\n .data(dataset)\n .enter()\n .append(\"g\")\n .style(\"fill\", function(d, i) {\n if (restForDataset > 0 && i === dataset.length - 1) {\n return \"rgb(225, 231, 239)\";\n } else {\n return colors[i];\n }\n });\n }", "function updateGroup (circleGroup, newScale,chosenAxis, xORy){\n\tif (xORy ===\"x\"){\n\t\tif (chosenAxis===\"BnB\"){\n\t\t\tcircleGroup.transition()\n\t\t\t .duration(1000)\n\t\t\t .attr(\"cx\", d => newScale(d[chosenAxis])+newScale.bandwidth()/2);\n\t\t\treturn circleGroup;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcircleGroup.transition()\n\t\t\t .duration(1000)\n\t\t\t .attr(\"cx\", d => newScale(d[chosenAxis]));\n\n\n\t \t\treturn circleGroup;\n\t \t}\n\t}\n\telse {\n\t\tcircleGroup.transition()\n\t\t .duration(1000)\n\t\t .attr(\"cy\", d => newScale(d[chosenAxis]));\n\n\n \t\treturn circleGroup\n\t}\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
All calls to setToggleButton should be protected, and only called within a callback from getDropListChildren
function setToggleButton (e, checked) { let toggleButton = e.parentElement.querySelector("button.upDownButton"); let dropList = e.parentElement.querySelector("div.dropList"); let dropListItems = dropList.children; let n = countShowing(dropList); if (checked) { if (n == 0) { toggleButton.checked = true; toggleButton.classList.remove("upAndFilter") toggleButton.classList.add("up"); toggleButton.disabled = false; toggleButton.setAttribute("title", "Hide all"); } else { toggleButton.checked = true; toggleButton.classList.remove("up"); toggleButton.classList.add("upAndFilter") toggleButton.disabled = false; toggleButton.setAttribute("title", "Filter"); } } else { if (n == dropListItems.length) { toggleButton.checked = true; toggleButton.classList.remove("up", "upAndFilter"); toggleButton.disabled = true; toggleButton.removeAttribute("title"); } else { toggleButton.checked = false; toggleButton.classList.remove("up", "upAndFilter"); toggleButton.disabled = false; toggleButton.setAttribute("title", "Show all"); } } }
[ "handleToggleDropList() {\n if (this.state.isOpen) {\n removeEvent(document, 'click', this.handleDocumentClick);\n } else {\n addEvent(document, 'click', this.handleDocumentClick);\n }\n\n this.setState({\n isOpen: !this.state.isOpen\n });\n }", "function handleToggleCheckUncheckedItems() {}", "function clustertree_toggle_button_state(instanceid, uniqueid, dropdown_button_text, tree_button_text, usingdropdown) {\n\tvar toggle_name = uniqueid + '_toggle';\n\n\tvar toggle_buttons = clustertree_get_container_elements_by_name(instanceid, toggle_name);\n\tfor (var i = 0; i < toggle_buttons.length; i++) {\n\t\tif (usingdropdown) {\n\t\t toggle_buttons[i].value = dropdown_button_text;\n\t\t} else {\n\t\t\ttoggle_buttons[i].value = tree_button_text;\n\t\t}\n\t\tbreak;\n\t}\n}", "toggleControlsOff() {\n this.setState({selected: false});\n }", "handleToggle() {\n this.doToggle(false);\n }", "processChildrenOnClick(target) {\n const children = this.getChildItems();\n for (let i = 0, len = children.length; i < len; ++i) {\n if (children[i] !== target) {\n children[i].expanded = false;\n }\n }\n }", "todoItemSelectionToggle(node) {\n this.checklistSelection.toggle(node);\n const descendants = this.treeControl.getDescendants(node);\n this.checklistSelection.isSelected(node)\n ? this.checklistSelection.select(...descendants)\n : this.checklistSelection.deselect(...descendants);\n // Force update for the parent\n descendants.forEach(child => this.checklistSelection.isSelected(child));\n this.checkAllParentsSelection(node);\n }", "_addToggleButton(div, hidden = false) {\n const toggler = document.createElement(\"div\");\n toggler.className = \"treeItemToggler\";\n if (hidden) {\n toggler.classList.add(\"treeItemsHidden\");\n }\n toggler.onclick = evt => {\n evt.stopPropagation();\n toggler.classList.toggle(\"treeItemsHidden\");\n\n if (evt.shiftKey) {\n const shouldShowAll = !toggler.classList.contains(\"treeItemsHidden\");\n this._toggleTreeItem(div, shouldShowAll);\n }\n };\n div.insertBefore(toggler, div.firstChild);\n }", "function container_onClick() {\n\t\t\t if (_dropDownListJQuery.is(\":hidden\")) {\n\t\t\t toggleDropDownList(true);\n\t\t\t }\n\t\t\t else {\n\t\t\t toggleDropDownList(false);\n\t\t\t }\n\t\t\t }", "todoItemSelectionToggle(node) {\n this.checklistSelection.toggle(node);\n const descendants = this.treeControl.getDescendants(node);\n this.checklistSelection.isSelected(node)\n ? this.checklistSelection.select(...descendants)\n : this.checklistSelection.deselect(...descendants);\n // Force update for the parent\n descendants.every(child => this.checklistSelection.isSelected(child));\n this.checkAllParentsSelection(node);\n }", "cb_locationPick(){\n this._submenuPlaces.menu.toggle();\n }", "_actionButtonsChanged() {\n // set _notifyActionChange false to prevent firing px-dropdown-selection-changed while updating the new set of buttons\n this._notifyActionChange = false;\n let actionBtns = JSON.parse(JSON.stringify(this.actionButtons));\n // set default max buttons if not passed in the JSON object\n let maxButtons = actionBtns.maxButtons || 3;\n // set default max primary buttons if not passed in the JSON object\n let maxPrimaryButtons = actionBtns.maxPrimaryButtons || 1;\n let primaryBtns = [];\n let btns = [];\n for(let x in actionBtns.items) {\n if(actionBtns.items[x].isPrimary) {\n if(primaryBtns.length < maxPrimaryButtons) {\n // add primary button to array\n primaryBtns.push(actionBtns.items[x]);\n } else {\n // just delete isPrimary to add to btns array\n delete actionBtns.items[x].isPrimary;\n }\n }\n if(!actionBtns.items[x].isPrimary) {\n btns.push(actionBtns.items[x]);\n }\n }\n this._isDisplayDropdown = false;\n if(this.primary) {\n actionBtns.items = primaryBtns;\n } else {\n actionBtns.items = btns;\n this._isDisplayDropdown = actionBtns.items.length > maxButtons;\n }\n this._isDisplayButtons = false;\n \n \n if(this._isDisplayDropdown) {\n this._setupDropdownButtons(actionBtns);\n } else {\n this._items = actionBtns.items;\n this._isDisplayButtons = true;\n }\n this._notifyActionChange = true;\n }", "todoLeafItemSelectionToggle(node) {\n this.checklistSelection.toggle(node);\n this.checkAllParentsSelection(node);\n }", "function togglePointsOfReferenceDropdownButton() {\r\n\tif (pointsOfReferenceGroupCount > 0) {\r\n\t\t$('#points-of-reference-dropdown-button').removeClass('disabled');\r\n\t} else {\r\n\t\t$('#points-of-reference-dropdown-button').addClass('disabled');\r\n\t}\r\n}", "function handleChangeToggleButton(state) {\n\tif (state.checked) {\n\t\tpanel.show({\n\t\t\tposition: button\n\t\t});\n\t}\n}", "todoLeafItemSelectionToggle(node) {\n this.checklistSelection.toggle(node);\n this.checkAllParentsSelection(node);\n console.log(this.checklistSelection.toggle(node));\n }", "setValidTargets() {\n const dropdowns = document.getElementsByClassName('c-dropdown--on-click');\n\n for (let dropdown of dropdowns) {\n let dropDownList = dropdown.getElementsByClassName('c-dropdown__list')[0]\n ? dropdown.getElementsByClassName('c-dropdown__list')[0]\n : '';\n\n let dropdownButton = dropdown.getElementsByTagName('button')[0]\n ? dropdown.getElementsByTagName('button')[0]\n : '';\n\n let buttonLabel = dropdownButton.getElementsByClassName('c-button__label-text')[0]\n ? dropdownButton.getElementsByClassName('c-button__label-text')[0]\n : '';\n\n let buttonLabelReverse = dropdownButton.getElementsByClassName(\n 'c-button__label-text--reverse'\n )[0]\n ? dropdownButton.getElementsByClassName('c-button__label-text--reverse')[0]\n : '';\n\n let buttonIcon = dropdownButton.getElementsByTagName('i')[0]\n ? dropdownButton.getElementsByTagName('i')[0]\n : '';\n\n let validTargets = [\n dropDownList,\n dropdownButton,\n buttonLabel,\n buttonIcon,\n buttonLabelReverse,\n ];\n\n this.toggle(validTargets, dropDownList);\n }\n }", "todoItemSelectionToggle(node) {\n this.checklistSelection.toggle(node);\n const descendants = this.treeControl.getDescendants(node);\n this.checklistSelection.isSelected(node)\n ? this.checklistSelection.select(...descendants)\n : this.checklistSelection.deselect(...descendants);\n }", "toggleDropDown () {\n if (this.state.dropDownOpen) {\n this.setState({\n dropDownOpen: false\n })\n }\n else {\n this.setState({\n dropDownOpen: true\n })\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Coloured Rounded Line Chart Line Chart
function coloredRounedLineChart(dataColouredRoundedLineChart) { optionsColouredRoundedLineChart = { lineSmooth: Chartist.Interpolation.cardinal({ tension: 10 }), axisY: { showGrid: true, offset: 40, labelInterpolationFnc: function(value) { value = formatLargeCurrencies(value); return currentCurrencyPreference + value; }, scaleMinSpace: 15 }, axisX: { showGrid: false, }, showPoint: true, height: '400px' }; // Empty the chart div let coloredChartDiv = document.getElementById('colouredRoundedLineChart'); // Replace inner HTML with EMPTY while (coloredChartDiv.firstChild) { coloredChartDiv.removeChild(coloredChartDiv.firstChild); } // Dispose the previous tooltips created $("#colouredRoundedLineChart").tooltip('dispose'); // Append tooltip with line chart var colouredRoundedLineChart = new Chartist.Line('#colouredRoundedLineChart', dataColouredRoundedLineChart, optionsColouredRoundedLineChart).on("draw", function(data) { if (data.type === "point") { data.element._node.setAttribute("title", "Total: <strong>" + currentCurrencyPreference + formatNumber(data.value.y, currentUser.locale) + '</strong>'); data.element._node.setAttribute("data-chart-tooltip", "colouredRoundedLineChart"); } }).on("created", function() { // Initiate Tooltip $("#colouredRoundedLineChart").tooltip({ selector: '[data-chart-tooltip="colouredRoundedLineChart"]', container: "#colouredRoundedLineChart", html: true, placement: 'auto', delay: { "show": 300, "hide": 100 } }); }); md.startAnimationForLineChart(colouredRoundedLineChart); }
[ "getLineColorsAndWidth(){\n\n\t\tthis.radarChart.series.forEach((value,j) => {\n\t\t\tfor(let i=0;i<this.chartVizInfo.length;i++){\n\t\t\t\tif( i === j){\n\t\t\t\t\tthis.chartVizInfo[i].XX_LINE_COLOR.lineColor = value.lineColor;\n\t\t\t\t\tthis.chartVizInfo[i].XX_LINE_WIDTH.lineWidth = value.lineWidth;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t}", "function SVGLineChart() {\r\n }", "drawLineChart(){\n\t\tlet crimeRatesPerYearAndPerCrimeType = this.createCrimeRateData();\n\t\tthis.createLineChart(crimeRatesPerYearAndPerCrimeType);\n\t}", "function createFocusLineChart(g, sources, line, color) {\n sources.forEach(element => {\n var width = 1;\n if (element.name == \"Moyenne\") {\n width = 2;\n }\n\n g.append(\"path\")\n .datum(element.values)\n .attr(\"class\", \"line\")\n .attr(\"d\", line)\n .attr(\"clip-path\", \"url(#clip)\")\n .style('stroke', setStrokeColor(element.name, color))\n .style('stroke-width', width)\n });\n\n}", "function simpleLineChartData() {\n var sin = [{ x: 3, y: 55 }, { x: 4, y: 59 }, { x: 5, y: 68 }, { x: 6, y: 73 }, { x: 7, y: 95 }, { x: 8, y: 109 }, { x: 9, y: 146 }, { x: 10, y: 124 }, { x: 11, y: 110 }, { x: 12, y: 92 }, { x: 13, y: 101 }, { x: 14, y: 104 }],\n cos = [{ x: 3, y: 50 }, { x: 4, y: 52 }, { x: 5, y: 60 }, { x: 6, y: 68 }, { x: 7, y: 89 }, { x: 8, y: 99 }, { x: 9, y: 122 }, { x: 10, y: 110 }, { x: 11, y: 100 }, { x: 12, y: 88 }, { x: 13, y: 90 }, { x: 14, y: 85 }];\n\n var data = $('#RopesDiscardedData').val();\n data = JSON.parse(data);\n\n return [\n {\n values: data,\n key: 'Discarded',\n color: success\n }\n //{\n // values: cos,\n // key: 'Requiring Discard',\n // color: '#0F3976'\n //}\n ];\n }", "function setRedLine() {\n var main = values.slice(0, 13);\n var braintree = values.slice(12, 18);\n var jfk = values.slice(12, 13);\n var others = values.slice(18, 22);\n var ashmont = jfk.concat(others);\n makeLines(main);\n makeLines(braintree);\n makeLines(ashmont);\n\n makeMarkers(values);\n}", "function styleLine(selection) {\n selection\n .attr(\"fill\", \"none\")\n .attr(\"stroke-width\", 3)\n .style(\"stroke-dasharray\", (\"10, 10\"))\n .attr(\"opacity\", 0.9);\n}", "createLineChart(crimeRateData){\n\t\tvar data = transferToCleanJavascriptObject(crimeRateData),\t\t\n\t\t\tthat =this,\n\t\t\theight = this.height,\n\t\t\twidth = this.width,\n\t\t\tlabelWidth = width/5,\n\t\t\tlabelHeight = labelWidth/5,\t\t\t\n\t\t\tcontainer = this.container,\n\t\t\tmaxYear = configNamespace.STATES_AND_CRIMES.maxYear,\n\t\t\tminYear = configNamespace.STATES_AND_CRIMES.minYear,\n\t\t\tminCrime = 0,\n\t\t\tmaxCrime = 8000,\n\t\t\tmindate = new Date(minYear,0,1),\n\t\t\tmaxdate = new Date(maxYear,0,31),\t\t\t\n\t\t\tmargin = {top: height/8, right: width/10, bottom: height/10, left: width/10},\n\t\t\tchartWidth = width - margin.left - margin.right,\n\t\t\tchartHeight = height - margin.top - margin.bottom,\n\t\t\taxisDateLabelX = width/2 + this.xAxisLabelX,\n\t\t\taxisDateLabelY = height - margin.bottom-margin.bottom + this.xAxisLabelY,\t\t\t\n\t\t\taxisNumberLabelX = - chartWidth/2 + this.yAxisLabelX,\t\t\t\n\t\t\taxisNumberLabelY = + margin.left + this.yAxisLabelY,\t\t\t\n\t\t\txRange = d3.scaleTime().domain([mindate, maxdate]).range([0,chartWidth ]), \n\t\t\tyRange = d3.scaleLinear().domain([minCrime, maxCrime]).range([chartHeight, 0]),\t\t\t\n\t\t\txAxis = d3.axisBottom(xRange), \n\t\t\tyAxis = d3.axisLeft(yRange),\n\t\t\tdeltaAxisY = chartHeight-margin.bottom,\n\t\t\tdurationTime = 1000,\n\t\t\tzooming,\n\t\t\tcanvas,\n\t\t\tcoordinateSystem,\n\t\t\txCoordLine,\n\t\t\tyCoordLine,\n\t\t\tallGraphLines,\n\t\t\tsingleLine,\n\t\t\tlabel,\n\t\t\tlineClass = \"line\"+this.chartId,\n\t\t\tlinesClass = \"lines\"+this.chartId;\t\n\t\t\t\n\t\tinitZoomingBehaviour();\n\t\tinitLabel();\n\t\tprepareContainer();\t\n\t\tinitCanvas();\t\t\n\t\tinitCoordinateSystem();\n\t\tinitXCoordLine();\n\t\tinitYCoordLine();\n\t\tinitAllGraphLines();\t\n\t\tinitSingleLine();\n\t\tdrawGraph();\t\n\t\tappendDateLabel();\n\t\tappendNumberLabel();\n\n\t\t//calls the d3 zoom function to zoom the lineChart\n\t\tfunction initZoomingBehaviour(){\n\t\t\tzooming = d3.zoom()\n\t\t\t\t.scaleExtent([1, Infinity])\n\t\t\t\t.translateExtent([[0, 0], [width, height]])\n\t\t\t\t.extent([[0, 0], [width, height]])\n\t\t\t\t.on(\"zoom\", zoomCoordSystemAndLines);\n\t\t}\n\n\t\t//inits the label which tells the user\n\t\t//how to interact with the chart\n\t\tfunction initLabel(){\n\t\t\tlet inVisible = 0;\n\t\t\tlabel = container.append(\"text\")\n\t\t\t\t.attr(\"x\", 0) \n\t\t\t\t.attr(\"y\", 0) \n\t\t\t\t.style(\"text-anchor\", \"middle\")\n\t\t\t\t.text(\"Scroll to zoom!\")\n\t\t\t\t.style(\"opacity\", inVisible);\n\t\t}\n\n\t\t//sets width and height of the rootElement\n\t\tfunction prepareContainer(){\n\t\t\tcontainer\n\t\t\t\t.call(zooming)\n\t\t\t\t.style(\"pointer-events\", \"all\")\n\t\t\t\t.on(\"mouseenter\" ,showAndHideLabel) \n\t\t\t\t.on(\"mouseleave\", hideLabel); \n\t\t}\n\n\t\tfunction showAndHideLabel(){\n\t\t\tlet visible = 1,\n\t\t\t\tinVisible = 0,\n\t\t\t\tdurationTime = 2000,\n\t\t\t\tx = that.width/2,\n\t\t\t\ty = that.height/2;\t\t\t\n\t\t\tlabel\n\t\t\t\t.style(\"opacity\", visible)\n\t\t\t\t.attr(\"x\", x) \n\t\t\t\t.attr(\"y\", y)\n\t\t\t\t.transition()\n\t\t\t\t.ease(d3.easeLinear)\n\t\t\t\t.duration(durationTime) \n\t\t\t\t.style(\"opacity\", inVisible); \n\t\t}\n\n\t\tfunction hideLabel(){\n\t\t\tlet inVisible = 0;\n\t\t\tlabel\n\t\t\t\t.style(\"opacity\", inVisible)\n\t\t\t\t.attr(\"transform\", \"translate(\" + 0 + \",\" + 0 + \")\");\n\t\t}\t\t\n\n\t\t//inits container and sets width and height and position of the canvas\n\t\tfunction initCanvas(){\n\t\t\tcanvas = container.append(\"svg\").attr(\"class\", \"canvas\").attr(\"id\", \"lineChartCanvas\")\n\t\t\t\t.attr(\"width\", chartWidth)\n\t\t\t\t.attr(\"height\", chartHeight) \n\t\t\t\t.attr(\"transform\", \"translate(\" + margin.left + \",\" + 0 + \")\");\n\t\t}\t\t\t\t\n\n\t\t//inits coordinateSystem and sets width and height and position of the coordindate system\n\t\tfunction initCoordinateSystem(){\n\t\t\tcoordinateSystem = container.append(\"g\").attr(\"class\", \"coordinateSystem\")\n\t\t\t\t.attr(\"width\", chartWidth)\n\t\t\t\t.attr(\"height\", chartHeight) \n\t\t\t\t.attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\t\t\t\t\n\t\t} \n\n\t\t//inits xCoordLine and sets width and height and position of the xAxis\n\t\tfunction initXCoordLine(){\n\t\t\txCoordLine = coordinateSystem.append(\"g\").attr(\"class\", \"xAxis\")\n\t\t\t\t.attr(\"transform\", \"translate(0,\"+(deltaAxisY)+\")\") \n\t\t\t\t.call(xAxis);\n\t\t}\n\n\t\t//inits yCoordLine and sets width and height and position of the yAxis\n\t\tfunction initYCoordLine(){\n\t\t\tyCoordLine = coordinateSystem.append(\"g\").attr(\"class\", \"yAxis\")\n\t\t\t\t.attr(\"transform\",\"translate(0,-\"+margin.bottom+\")\")\n\t\t\t\t.call(yAxis);\n\t\t}\n\n\t\t//inits allGraphLines and sets width and height and position of allGraphLines\n\t\tfunction initAllGraphLines(){\n\t\t\tallGraphLines = canvas.append(\"g\").attr(\"class\", linesClass)\n\t\t\t\t.attr(\"width\", chartWidth)\n\t\t\t\t.attr(\"height\", chartHeight) \n\t\t\t\t.style(\"fill\", \"white\");\n\t\t}\n\n\t\t//inits singleLine which is a d3.line function \n\t\tfunction initSingleLine(){\n\t\t\tsingleLine = d3.line()\n\t\t\t\t.x(function(d){return getXPos(d);}) \n\t\t\t\t.y(function(d){return getYPos(d);});\t\t\n\t\t}\t\t\n\n\t\t//tranforms a string 'year' to a date which can be used on the x-Axis\n\t\tfunction getXPos(d){\n\t\t\tlet year = parseInt(d.year),\n\t\t\t\tdate = new Date(year,0,1); \n\t\t\treturn xRange(date);\t\t\n\t\t}\n\n\t\t//tranforms a string 'crimerate' to a number which can be used on the y-Axis\n\t\tfunction getYPos(d){\n\t\t\tlet crimerate = parseInt(d.crimerate); \n\t\t\treturn yRange(crimerate);\n\t\t}\t\t\t\n\n\t\t//gives data to selectedGraphLines and draws new lines with new data on enter\n\t\tfunction drawGraph(){\n\t\t\tlet selectedGraphLines = container.selectAll(\".\"+linesClass),\n\t\t\t\tinvisible = 0,\n\t\t\t\tvisible =1; \n\n\t\t\tselectedGraphLines\n\t\t\t\t.selectAll(\"line\")\n\t\t\t\t.data(data)\n\t\t\t\t.enter()\n\t\t\t\t.append(\"path\")\t\t\t\t\n\t\t\t\t.attr(\"class\", lineClass) \n\t\t\t\t.attr(\"lineId\", function(d){\n\t\t\t\t\treturn that.getId(d.key);\n\t\t\t\t})\n\t\t\t\t.attr(\"d\", function(d){\t\t\t\t\n\t\t\t\t\tlet line = singleLine(d.values); \n\t\t\t\t\treturn line;\n\t\t\t\t}) \n\t\t\t\t.attr(\"stroke\", function(d){\n\t\t\t\t\treturn getColor(d);\n\t\t\t\t})\n\t\t\t\t.attr(\"fill\",\"none\")\n\t\t\t\t.attr(\"opacity\", invisible)\n\t\t\t\t.transition()\n\t\t\t\t.ease(d3.easeLinear)\n\t\t\t\t.duration(durationTime) \n\t\t\t\t.attr(\"opacity\", visible);\n\t\t}\t\n\n\t\t//returns color according to crimeType\n\t\tfunction getColor(d){\n\t\t\tlet crime = d.key;\n\t\t\treturn commonfunctionsNamespace.getCrimeColor(crime);\n\t\t} \n\n\t\t//zooms in and out of the chart\n\t\tfunction zoomCoordSystemAndLines() { \n\t\t\tlet transitionZoomTime = 750, \n\t\t\t\tallLines = container.selectAll(\".\"+linesClass)\n\t\t\t\t\t.transition().duration(transitionZoomTime)\n\t\t\t\t\t.attr(\"transform\", d3.event.transform), \n\t\t\t\tlines = d3.selectAll(\".\"+lineClass).style(\"stroke-width\", 2/d3.event.transform.k), \n\t\t\t\txCall = xCoordLine.transition().duration(transitionZoomTime).call(xAxis.scale(d3.event.transform.rescaleX(xRange))),\n\t\t\t\tyCall = yCoordLine.transition().duration(transitionZoomTime).call(yAxis.scale(d3.event.transform.rescaleY(yRange))); \n\t\t}\n\n\t\tfunction transferToCleanJavascriptObject(jsondata){\n\t\t\treturn JSON.parse(JSON.stringify(jsondata));\n\t\t}\n\n\t\tfunction appendDateLabel(){\n\t\t\tcontainer.append(\"text\")\n\t\t\t\t.attr(\"x\", axisDateLabelX) \n\t\t\t\t.attr(\"y\", axisDateLabelY) \n\t\t\t\t.style(\"text-anchor\", \"middle\")\n\t\t\t\t.text(\"Date\");\n\t\t}\n\n\t\tfunction appendNumberLabel(){\n\t\t\tcontainer.append(\"text\")\n\t\t\t\t.attr(\"transform\", \"rotate(-90)\")\n\t\t\t\t.attr(\"x\", axisNumberLabelX) \n\t\t\t\t.attr(\"y\", axisNumberLabelY) \n\t\t\t\t.style(\"text-anchor\", \"middle\")\n\t\t\t\t.text(\"Number of crimes per 100 000 inhabits\");\n\t\t}\n\t}", "function drawSeriesLines(series){\n\t\t\tfunction plotLine(data, offset){\n\t\t\t\tif(data.length < 2) return;\n\t\n\t\t\t\tvar prevx = tHoz(data[0][0]),\n\t\t\t\t\tprevy = tVert(data[0][1]) + offset;\n\t\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.moveTo(prevx, prevy);\n\t\t\t\tfor(var i = 0; i < data.length - 1; ++i){\n\t\t\t\t\tvar x1 = data[i][0], y1 = data[i][1],\n\t\t\t\t\t\tx2 = data[i+1][0], y2 = data[i+1][1];\n\t\n\t\t\t\t\t/**\n\t\t\t\t\t * Clip with ymin.\n\t\t\t\t\t */\n\t\t\t\t\tif(y1 <= y2 && y1 < yaxis.min){\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Line segment is outside the drawing area.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif(y2 < yaxis.min) continue;\n\t\t\t\t\t\t\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Compute new intersection point.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tx1 = (yaxis.min - y1) / (y2 - y1) * (x2 - x1) + x1;\n\t\t\t\t\t\ty1 = yaxis.min;\n\t\t\t\t\t}else if(y2 <= y1 && y2 < yaxis.min){\n\t\t\t\t\t\tif(y1 < yaxis.min) continue;\n\t\t\t\t\t\tx2 = (yaxis.min - y1) / (y2 - y1) * (x2 - x1) + x1;\n\t\t\t\t\t\ty2 = yaxis.min;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t/**\n\t\t\t\t\t * Clip with ymax.\n\t\t\t\t\t */ \n\t\t\t\t\tif(y1 >= y2 && y1 > yaxis.max) {\n\t\t\t\t\t\tif(y2 > yaxis.max) continue;\n\t\t\t\t\t\tx1 = (yaxis.max - y1) / (y2 - y1) * (x2 - x1) + x1;\n\t\t\t\t\t\ty1 = yaxis.max;\n\t\t\t\t\t}\n\t\t\t\t\telse if(y2 >= y1 && y2 > yaxis.max){\n\t\t\t\t\t\tif(y1 > yaxis.max) continue;\n\t\t\t\t\t\tx2 = (yaxis.max - y1) / (y2 - y1) * (x2 - x1) + x1;\n\t\t\t\t\t\ty2 = yaxis.max;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t/**\n\t\t\t\t\t * Clip with xmin.\n\t\t\t\t\t */\n\t\t\t\t\tif(x1 <= x2 && x1 < xaxis.min){\n\t\t\t\t\t\tif(x2 < xaxis.min) continue;\n\t\t\t\t\t\ty1 = (xaxis.min - x1) / (x2 - x1) * (y2 - y1) + y1;\n\t\t\t\t\t\tx1 = xaxis.min;\n\t\t\t\t\t}else if(x2 <= x1 && x2 < xaxis.min){\n\t\t\t\t\t\tif(x1 < xaxis.min) continue;\n\t\t\t\t\t\ty2 = (xaxis.min - x1) / (x2 - x1) * (y2 - y1) + y1;\n\t\t\t\t\t\tx2 = xaxis.min;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t/**\n\t\t\t\t\t * Clip with xmax.\n\t\t\t\t\t */\n\t\t\t\t\tif(x1 >= x2 && x1 > xaxis.max){\n\t\t\t\t\t\tif (x2 > xaxis.max) continue;\n\t\t\t\t\t\ty1 = (xaxis.max - x1) / (x2 - x1) * (y2 - y1) + y1;\n\t\t\t\t\t\tx1 = xaxis.max;\n\t\t\t\t\t}else if(x2 >= x1 && x2 > xaxis.max){\n\t\t\t\t\t\tif(x1 > xaxis.max) continue;\n\t\t\t\t\t\ty2 = (xaxis.max - x1) / (x2 - x1) * (y2 - y1) + y1;\n\t\t\t\t\t\tx2 = xaxis.max;\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif(prevx != tHoz(x1) || prevy != tVert(y1) + offset)\n\t\t\t\t\t\tctx.moveTo(tHoz(x1), tVert(y1) + offset);\n\t\t\t\t\t\n\t\t\t\t\tprevx = tHoz(x2);\n\t\t\t\t\tprevy = tVert(y2) + offset;\n\t\t\t\t\tctx.lineTo(prevx, prevy);\n\t\t\t\t}\n\t\t\t\tctx.stroke();\n\t\t\t}\n\t\t\t\n\t\t\t/**\n\t\t\t * Function used to fill\n\t\t\t * @param {Object} data\n\t\t\t */\n\t\t\tfunction plotLineArea(data){\n\t\t\t\tif(data.length < 2) return;\n\t\n\t\t\t\tvar bottom = Math.min(Math.max(0, yaxis.min), yaxis.max);\n\t\t\t\tvar top, lastX = 0;\n\t\t\t\tvar first = true;\n\t\t\t\t\n\t\t\t\tctx.beginPath();\n\t\t\t\tfor(var i = 0; i < data.length - 1; ++i){\n\t\t\t\t\t\n\t\t\t\t\tvar x1 = data[i][0], y1 = data[i][1],\n\t\t\t\t\t\tx2 = data[i+1][0], y2 = data[i+1][1];\n\t\t\t\t\t\n\t\t\t\t\tif(x1 <= x2 && x1 < xaxis.min){\n\t\t\t\t\t\tif(x2 < xaxis.min) continue;\n\t\t\t\t\t\ty1 = (xaxis.min - x1) / (x2 - x1) * (y2 - y1) + y1;\n\t\t\t\t\t\tx1 = xaxis.min;\n\t\t\t\t\t}else if(x2 <= x1 && x2 < xaxis.min){\n\t\t\t\t\t\tif(x1 < xaxis.min) continue;\n\t\t\t\t\t\ty2 = (xaxis.min - x1) / (x2 - x1) * (y2 - y1) + y1;\n\t\t\t\t\t\tx2 = xaxis.min;\n\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\tif(x1 >= x2 && x1 > xaxis.max){\n\t\t\t\t\t\tif(x2 > xaxis.max) continue;\n\t\t\t\t\t\ty1 = (xaxis.max - x1) / (x2 - x1) * (y2 - y1) + y1;\n\t\t\t\t\t\tx1 = xaxis.max;\n\t\t\t\t\t}else if(x2 >= x1 && x2 > xaxis.max){\n\t\t\t\t\t\tif (x1 > xaxis.max) continue;\n\t\t\t\t\t\ty2 = (xaxis.max - x1) / (x2 - x1) * (y2 - y1) + y1;\n\t\t\t\t\t\tx2 = xaxis.max;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(first){\n\t\t\t\t\t\tctx.moveTo(tHoz(x1), tVert(bottom));\n\t\t\t\t\t\tfirst = false;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t/**\n\t\t\t\t\t * Now check the case where both is outside.\n\t\t\t\t\t */\n\t\t\t\t\tif(y1 >= yaxis.max && y2 >= yaxis.max){\n\t\t\t\t\t\tctx.lineTo(tHoz(x1), tVert(yaxis.max));\n\t\t\t\t\t\tctx.lineTo(tHoz(x2), tVert(yaxis.max));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}else if(y1 <= yaxis.min && y2 <= yaxis.min){\n\t\t\t\t\t\tctx.lineTo(tHoz(x1), tVert(yaxis.min));\n\t\t\t\t\t\tctx.lineTo(tHoz(x2), tVert(yaxis.min));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t/**\n\t\t\t\t\t * Else it's a bit more complicated, there might\n\t\t\t\t\t * be two rectangles and two triangles we need to fill\n\t\t\t\t\t * in; to find these keep track of the current x values.\n\t\t\t\t\t */\n\t\t\t\t\tvar x1old = x1, x2old = x2;\n\t\t\t\t\t\n\t\t\t\t\t/**\n\t\t\t\t\t * And clip the y values, without shortcutting.\n\t\t\t\t\t * Clip with ymin.\n\t\t\t\t\t */\n\t\t\t\t\tif(y1 <= y2 && y1 < yaxis.min && y2 >= yaxis.min){\n\t\t\t\t\t\tx1 = (yaxis.min - y1) / (y2 - y1) * (x2 - x1) + x1;\n\t\t\t\t\t\ty1 = yaxis.min;\n\t\t\t\t\t}else if(y2 <= y1 && y2 < yaxis.min && y1 >= yaxis.min){\n\t\t\t\t\t\tx2 = (yaxis.min - y1) / (y2 - y1) * (x2 - x1) + x1;\n\t\t\t\t\t\ty2 = yaxis.min;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t/**\n\t\t\t\t\t * Clip with ymax.\n\t\t\t\t\t */\n\t\t\t\t\tif(y1 >= y2 && y1 > yaxis.max && y2 <= yaxis.max){\n\t\t\t\t\t\tx1 = (yaxis.max - y1) / (y2 - y1) * (x2 - x1) + x1;\n\t\t\t\t\t\ty1 = yaxis.max;\n\t\t\t\t\t}else if(y2 >= y1 && y2 > yaxis.max && y1 <= yaxis.max){\n\t\t\t\t\t\tx2 = (yaxis.max - y1) / (y2 - y1) * (x2 - x1) + x1;\n\t\t\t\t\t\ty2 = yaxis.max;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t/**\n\t\t\t\t\t * If the x value was changed we got a rectangle to fill.\n\t\t\t\t\t */\n\t\t\t\t\tif(x1 != x1old){\n\t\t\t\t\t\ttop = (y1 <= yaxis.min) ? top = yaxis.min : yaxis.max;\t\t\t\t\t\t\n\t\t\t\t\t\tctx.lineTo(tHoz(x1old), tVert(top));\n\t\t\t\t\t\tctx.lineTo(tHoz(x1), tVert(top));\n\t\t\t\t\t}\n\t\t\t\t \t\n\t\t\t\t\t/**\n\t\t\t\t\t * Fill the triangles.\n\t\t\t\t\t */\n\t\t\t\t\tctx.lineTo(tHoz(x1), tVert(y1));\n\t\t\t\t\tctx.lineTo(tHoz(x2), tVert(y2));\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Fill the other rectangle if it's there.\n\t\t\t\t\t */\n\t\t\t\t\tif(x2 != x2old){\n\t\t\t\t\t\ttop = (y2 <= yaxis.min) ? yaxis.min : yaxis.max;\n\t\t\t\t\t\tctx.lineTo(tHoz(x2old), tVert(top));\n\t\t\t\t\t\tctx.lineTo(tHoz(x2), tVert(top));\n\t\t\t\t\t}\n\t\n\t\t\t\t\tlastX = Math.max(x2, x2old);\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.moveTo(tHoz(data[0][0]), tVert(0));\n\t\t\t\tfor (var i = 0; i < data.length; i++) {\n\t\t\t\t\tctx.lineTo(tHoz(data[i][0]), tVert(data[i][1]));\n\t\t\t\t}\n\t\t\t\tctx.lineTo(tHoz(data[data.length - 1][0]), tVert(0));*/\n\t\t\t\tctx.lineTo(tHoz(lastX), tVert(bottom));\n\t\t\t\tctx.closePath();\n\t\t\t\tctx.fill();\n\t\t\t}\n\t\t\t\n\t\t\tctx.save();\n\t\t\tctx.translate(plotOffset.left, plotOffset.top);\n\t\t\tctx.lineJoin = 'round';\n\t\n\t\t\tvar lw = series.lines.lineWidth;\n\t\t\tvar sw = series.shadowSize;\n\t\t\t/**\n\t\t\t * @todo: consider another form of shadow when filling is turned on\n\t\t\t */\n\t\t\tif(sw > 0){\n\t\t\t\tctx.lineWidth = sw / 2;\n\t\t\t\tctx.strokeStyle = \"rgba(0,0,0,0.1)\";\n\t\t\t\tplotLine(series.data, lw/2 + sw/2 + ctx.lineWidth/2);\n\t\n\t\t\t\tctx.lineWidth = sw / 2;\n\t\t\t\tctx.strokeStyle = \"rgba(0,0,0,0.2)\";\n\t\t\t\tplotLine(series.data, lw/2 + ctx.lineWidth/2);\n\t\t\t}\n\t\n\t\t\tctx.lineWidth = lw;\n\t\t\tctx.strokeStyle = series.color;\n\t\t\tif(series.lines.fill){\n\t\t\t\tctx.fillStyle = series.lines.fillColor != null ? series.lines.fillColor : parseColor(series.color).scale(null, null, null, 0.4).toString();\n\t\t\t\tplotLineArea(series.data, 0);\n\t\t\t}\n\t\n\t\t\tplotLine(series.data, 0);\n\t\t\tctx.restore();\n\t\t}", "function drawAllLines() {\n var j;\n\n for(j=0; j< series.length; j++) {\n var color = graph.options.colors[j+seriesIndex],\n line = graph.paper.path(\"M0 0\").attr({\n 'stroke': color,\n 'stroke-width': graph.options.lines.width,\n 'opacity': graph.options.lines.opacity\n });\n\n drawLine({\n series:series[j],\n line:line,\n isLineFilled:graph.seriesOptions[seriesIndex].fillLines,\n color:color,\n units:graph.seriesOptions[seriesIndex].pointLabelUnits\n });\n\n\n }\n\n var rollOvers = graph.paper.set();\n for(j=0; j< graph.numPoints; j++) {\n if (graph.tooltips && graph.tooltips[j]) {\n rollOvers.push(lineHover(series, graph.yTicks[seriesIndex], j, graph.seriesOptions[seriesIndex]));\n }\n }\n rollOvers.toFront();\n }", "function addLine(line, color) {\n return chartGroup.append(\"path\")\n .data([data])\n .attr(\"d\", line)\n .classed(color, true);\n }", "function linRegr(){\n var lr = {};\n var sum_x = 0;\n var sum_y = 0;\n var sum_xy = 0;\n var sum_xx = 0;\n var sum_yy = 0;\n\n // remove old line\n svgScatter.selectAll('.linregline').remove();\n\n // if there are no highlighted (county selected) points the draw line\n // also there has to data\n if(hlightPoints.length == 0 && filtered_irate_data.length > 0){\n // get x and y\n let x = [];\n let y = [];\n for (var i =0; i < filtered_irate_data.length; i++){\n x.push(+filtered_irate_data[i].temp);\n y.push(+filtered_irate_data[i].rate)\n }\n\n var n = y.length;\n\n for (var i = 0; i < y.length; i++) {\n\n sum_x += x[i];\n sum_y += y[i];\n sum_xy += (x[i]*y[i]);\n sum_xx += (x[i]*x[i]);\n sum_yy += (y[i]*y[i]);\n } \n\n lr['slope'] = (n * sum_xy - sum_x * sum_y) / (n*sum_xx - sum_x * sum_x);\n lr['intercept'] = (sum_y - lr.slope * sum_x)/n;\n lr['r2'] = Math.pow((n*sum_xy - sum_x*sum_y)/Math.sqrt((n*sum_xx-sum_x*sum_x)*(n*sum_yy-sum_y*sum_y)),2);\n\n // y intercept\n let yInt = lr['intercept'];\n if(yInt < 0){\n yInt = (lr['slope'] * filters.highTemp) + lr['intercept']\n }\n\n // x intercept\n let xInt = lr['intercept']/ (lr['slope'] * -1.0);\n\n // calculate x1,x2,y1,y1\n let x1 = x2 = y1 = y2 = 0.0;\n if(lr['slope'] < 0){\n x1 = filters.margL;\n x2 = filters.currTempScale(xInt);\n y1 = filters.currIrateScale(yInt);\n y2 = 200 - filters.margB;\n }\n else{\n x1 = 1000 - filters.margR;\n x2 = filters.currTempScale(xInt);\n y1 = filters.currIrateScale(yInt);\n y2 = 200 - filters.margB;\n }\n\n // add the line\n let lrg = svgScatter.append('g')\n lrg.attr('class', 'linregline');\n\n lrg.append('line')\n .datum(lr)\n .style(\"stroke\", \"red\") \n .style(\"stroke-width\", \"1px\") \n .attr(\"x1\", function(){return x1}) \n .attr(\"y1\", function(){return y1}) \n .attr(\"x2\", function(){return x2}) \n .attr(\"y2\", function(){return y2})\n .on(\"mousemove\",function (mouseData,d){\n d3.selectAll('.tooltip').remove();\n d3.selectAll('.tooltipScatter').remove();\n d3.select('body')\n .append(\"div\")\n .classed('tooltipScatter', true)\n .style(\"opacity\",.9)\n .style('font-weight','bold')\n .style(\"left\",(mouseData.x -150).toString() +\"px\")\n .style(\"top\",(mouseData.y + 10).toString()+\"px\")\n .style('height', '40px')\n .style('width', '175px')\n .html(\n \"<div class='tooltipData'>Line: y = \" +d.slope.toFixed(2) + \"x + \" + d.intercept.toFixed(2) + \"</div>\" +\n \"<div class='tooltipData'>r2: \"+d.r2.toFixed(2)+\"</div>\"\n )\n })\n .on(\"mouseleave\",function (mouseData,d){\n d3.selectAll('.tooltip').remove();\n d3.selectAll('.tooltipScatter').remove();\n\n })\n }\n return lr;\n}", "function componentLineChart () {\n\n /* Default Properties */\n var width = 400;\n var height = 400;\n var transition = { ease: d3.easeLinear, duration: 0 };\n var colors = palette.categorical(3);\n var colorScale = void 0;\n var xScale = void 0;\n var yScale = void 0;\n var dispatch = d3.dispatch(\"customValueMouseOver\", \"customValueMouseOut\", \"customValueClick\", \"customSeriesMouseOver\", \"customSeriesMouseOut\", \"customSeriesClick\");\n var classed = \"lineChart\";\n\n /**\n * Initialise Data and Scales\n *\n * @private\n * @param {Array} data - Chart data.\n */\n function init(data) {\n var _dataTransform$summar = dataTransform(data).summary(),\n rowKeys = _dataTransform$summar.rowKeys,\n valueMax = _dataTransform$summar.valueMax;\n\n var valueExtent = [0, valueMax];\n\n // TODO: Use dataTransform() to calculate date domains?\n var dateDomain = d3.extent(data[0].values, function (d) {\n return d.key;\n });\n\n if (typeof colorScale === \"undefined\") {\n colorScale = d3.scaleOrdinal().domain(rowKeys).range(colors);\n }\n\n if (typeof xScale === \"undefined\") {\n xScale = d3.scaleTime().domain(dateDomain).range([0, width]);\n }\n\n if (typeof yScale === \"undefined\") {\n yScale = d3.scaleLinear().domain(valueExtent).range([height, 0]).nice();\n }\n }\n\n /**\n * Constructor\n *\n * @constructor\n * @alias lineChart\n * @param {d3.selection} selection - The chart holder D3 selection.\n */\n function my(selection) {\n init(selection.data());\n selection.each(function () {\n\n // Line generation function\n var line = d3.line().curve(d3.curveCardinal).x(function (d) {\n return xScale(d.key);\n }).y(function (d) {\n return yScale(d.value);\n });\n\n // Line animation tween\n var pathTween = function pathTween(data) {\n var interpolate = d3.scaleQuantile().domain([0, 1]).range(d3.range(1, data.length + 1));\n return function (t) {\n return line(data.slice(0, interpolate(t)));\n };\n };\n\n // Update series group\n var seriesGroup = d3.select(this);\n seriesGroup.classed(classed, true).attr(\"id\", function (d) {\n return d.key;\n }).on(\"mouseover\", function (d) {\n dispatch.call(\"customSeriesMouseOver\", this, d);\n }).on(\"click\", function (d) {\n dispatch.call(\"customSeriesClick\", this, d);\n });\n\n // Create series group\n var seriesLine = seriesGroup.selectAll(\".seriesLine\").data(function (d) {\n return [d];\n });\n\n seriesLine.enter().append(\"path\").attr(\"class\", \"seriesLine\").attr(\"stroke-width\", 1.5).attr(\"stroke\", function (d) {\n return colorScale(d.key);\n }).attr(\"fill\", \"none\").merge(seriesLine).transition().duration(transition.duration).attrTween(\"d\", function (d) {\n return pathTween(d.values);\n });\n\n seriesLine.exit().transition().style(\"opacity\", 0).remove();\n });\n }\n\n /**\n * Width Getter / Setter\n *\n * @param {number} _v - Width in px.\n * @returns {*}\n */\n my.width = function (_v) {\n if (!arguments.length) return width;\n width = _v;\n return this;\n };\n\n /**\n * Height Getter / Setter\n *\n * @param {number} _v - Height in px.\n * @returns {*}\n */\n my.height = function (_v) {\n if (!arguments.length) return height;\n height = _v;\n return this;\n };\n\n /**\n * Color Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 color scale.\n * @returns {*}\n */\n my.colorScale = function (_v) {\n if (!arguments.length) return colorScale;\n colorScale = _v;\n return my;\n };\n\n /**\n * Colors Getter / Setter\n *\n * @param {Array} _v - Array of colours used by color scale.\n * @returns {*}\n */\n my.colors = function (_v) {\n if (!arguments.length) return colors;\n colors = _v;\n return my;\n };\n\n /**\n * X Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 scale.\n * @returns {*}\n */\n my.xScale = function (_v) {\n if (!arguments.length) return xScale;\n xScale = _v;\n return my;\n };\n\n /**\n * Y Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 scale.\n * @returns {*}\n */\n my.yScale = function (_v) {\n if (!arguments.length) return yScale;\n yScale = _v;\n return my;\n };\n\n /**\n * Dispatch Getter / Setter\n *\n * @param {d3.dispatch} _v - Dispatch event handler.\n * @returns {*}\n */\n my.dispatch = function (_v) {\n if (!arguments.length) return dispatch();\n dispatch = _v;\n return this;\n };\n\n /**\n * Dispatch On Getter\n *\n * @returns {*}\n */\n my.on = function () {\n var value = dispatch.on.apply(dispatch, arguments);\n return value === dispatch ? my : value;\n };\n\n return my;\n }", "_renderLineChart() {\n if (this.dataLineOne.length === 0) {\n console.error('ERROR: Chart data was not provided. *the attribute data-line-one is required.');\n this._renderErrorChart();\n return;\n }\n\n /** Min & Max to build the horizontal domain. */\n let horizontalMin = this.dataLineOne[0][0];\n let horizontalMax = this.dataLineOne[0][0];\n\n /** Min & Max to build the vertical domain. */\n let verticalMin = 0;\n let verticalMax = this.dataLineOne[0][1];\n\n [[...this.dataLineOne], [...this.dataLineTwo], [...this.dataLineThree]].forEach((tupleList, index) => {\n /** Find min and max ranges from list of lines. */\n tupleList.forEach((tuple) => {\n if (tuple[0] < horizontalMin) {\n horizontalMin = tuple[0];\n }\n if (tuple[0] > horizontalMax) {\n horizontalMax = tuple[0];\n }\n if (tuple[1] < verticalMin) {\n verticalMin = tuple[1];\n }\n if (tuple[1] > verticalMax) {\n verticalMax = tuple[1];\n }\n });\n\n /** Apply the scale to the horizontal domain. */\n this._scaleHorizontal.domain([horizontalMin, horizontalMax]);\n\n /** Apply the scale to the vertical domain. */\n this._scaleVertical.domain([verticalMin, verticalMax]);\n /** Build the line graphs and attach. */\n this._svg\n .append('path')\n .data([tupleList])\n .attr('data', tupleList)\n .attr('class', 'line line-' + index)\n .attr('d', this._line);\n });\n }", "function drawLine() {\n\n var data = new google.visualization.DataTable();\n data.addColumn('number', 'X');\n data.addColumn('number', 'Clients');\n data.addRows(self.charts.line.rows);\n\n var options = self.charts.line.options;\n\n var chart = new google.visualization.LineChart(document.getElementById('chart_div'));\n\n chart.draw(data, options);\n }", "function drawChart(points, lineColor) {\n xAxisScale.domain(d3.extent(points, (a) => { return a.y }));\n yAxisScale.domain([-1.0, 1.0]);\n cpath\n .append(\"g\")\n .attr(\"class\", \"x-axis axis\")\n .attr(\"transform\", \"translate(0,\" + (yAxisLength / 2) + \")\")\n .call(bottomTick)\n .append(\"text\")\n .attr(\"x\", 450)\n .attr(\"y\", -8)\n .style(\"text-anchor\", \"end\")\n .text(\"Turn\");\n cpath\n .append(\"g\")\n .attr(\"class\", \"y-axis axis\")\n .call(leftTick)\n .append(\"text\")\n .attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", 6)\n .attr(\"dy\", \".91em\")\n .style(\"text-anchor\", \"end\")\n .text(\"Value\");\n cpath\n .append(\"path\")\n .datum(points)\n .attr(\"class\", \"line\")\n .attr(\"id\", \"affect-cartesian-chart-line\")\n .attr(\"d\", chartInterpolatedLine)\n .attr(\"stroke\", () => { return lineColor });\n }", "function drawSeriesLines(series, currentindex, serieslength)\n {\n function plotLine(data, offset)\n {\n if (data.length < 2) return;\n\n var prevx = tHoz(data[0][0]),\n\t\t\t\t\tprevy = tVert(data[0][1]) + offset;\n\n ctx.beginPath();\n ctx.moveTo(prevx, prevy);\n for (var i = 1; i < data.length - 1; ++i)//modified by anand so that lines start from first point along x-axis and not from origin\n {\n var x1 = data[i][0], y1 = data[i][1],\n\t\t\t\t\t\tx2 = data[i + 1][0], y2 = data[i + 1][1];\n\n /**\n * Clip with ymin.\n */\n if (y1 <= y2 && y1 < yaxis.min)\n {\n /**\n * Line segment is outside the drawing area.\n */\n if (y2 < yaxis.min) continue;\n\n /**\n * Compute new intersection point.\n */\n x1 = (yaxis.min - y1) / (y2 - y1) * (x2 - x1) + x1;\n y1 = yaxis.min;\n } else if (y2 <= y1 && y2 < yaxis.min)\n {\n if (y1 < yaxis.min) continue;\n x2 = (yaxis.min - y1) / (y2 - y1) * (x2 - x1) + x1;\n y2 = yaxis.min;\n }\n\n /**\n * Clip with ymax.\n */\n if (y1 >= y2 && y1 > yaxis.max)\n {\n if (y2 > yaxis.max) continue;\n x1 = (yaxis.max - y1) / (y2 - y1) * (x2 - x1) + x1;\n y1 = yaxis.max;\n }\n else if (y2 >= y1 && y2 > yaxis.max)\n {\n if (y1 > yaxis.max) continue;\n x2 = (yaxis.max - y1) / (y2 - y1) * (x2 - x1) + x1;\n y2 = yaxis.max;\n }\n\n /**\n * Clip with xmin.\n */\n if (x1 <= x2 && x1 < xaxis.min)\n {\n if (x2 < xaxis.min) continue;\n y1 = (xaxis.min - x1) / (x2 - x1) * (y2 - y1) + y1;\n x1 = xaxis.min;\n } else if (x2 <= x1 && x2 < xaxis.min)\n {\n if (x1 < xaxis.min) continue;\n y2 = (xaxis.min - x1) / (x2 - x1) * (y2 - y1) + y1;\n x2 = xaxis.min;\n }\n\n /**\n * Clip with xmax.\n */\n if (x1 >= x2 && x1 > xaxis.max)\n {\n if (x2 > xaxis.max) continue;\n y1 = (xaxis.max - x1) / (x2 - x1) * (y2 - y1) + y1;\n x1 = xaxis.max;\n } else if (x2 >= x1 && x2 > xaxis.max)\n {\n if (x1 > xaxis.max) continue;\n y2 = (xaxis.max - x1) / (x2 - x1) * (y2 - y1) + y1;\n x2 = xaxis.max;\n }\n\n if (prevx != tHoz(x1) || prevy != tVert(y1) + offset)\n ctx.moveTo(tHoz(x1), tVert(y1) + offset);\n\n prevx = tHoz(x2);\n prevy = tVert(y2) + offset;\n ctx.lineTo(prevx, prevy);\n }\n ctx.stroke();\n }\n\n /**\n * Function used to fill\n * @param {Object} data\n */\n function plotLineArea(data)\n {\n if (data.length < 2) return;\n\n var bottom = Math.min(Math.max(0, yaxis.min), yaxis.max);\n var top, lastX = 0;\n var first = true;\n\n ctx.beginPath();\n for (var i = 0; i < data.length - 1; ++i)\n {\n\n var x1 = data[i][0], y1 = data[i][1],\n\t\t\t\t\t\tx2 = data[i + 1][0], y2 = data[i + 1][1];\n\n if (x1 <= x2 && x1 < xaxis.min)\n {\n if (x2 < xaxis.min) continue;\n y1 = (xaxis.min - x1) / (x2 - x1) * (y2 - y1) + y1;\n x1 = xaxis.min;\n } else if (x2 <= x1 && x2 < xaxis.min)\n {\n if (x1 < xaxis.min) continue;\n y2 = (xaxis.min - x1) / (x2 - x1) * (y2 - y1) + y1;\n x2 = xaxis.min;\n }\n\n if (x1 >= x2 && x1 > xaxis.max)\n {\n if (x2 > xaxis.max) continue;\n y1 = (xaxis.max - x1) / (x2 - x1) * (y2 - y1) + y1;\n x1 = xaxis.max;\n } else if (x2 >= x1 && x2 > xaxis.max)\n {\n if (x1 > xaxis.max) continue;\n y2 = (xaxis.max - x1) / (x2 - x1) * (y2 - y1) + y1;\n x2 = xaxis.max;\n }\n\n if (first)\n {\n ctx.moveTo(tHoz(x1), tVert(bottom));\n first = false;\n }\n\n /**\n * Now check the case where both is outside.\n */\n if (y1 >= yaxis.max && y2 >= yaxis.max)\n {\n ctx.lineTo(tHoz(x1), tVert(yaxis.max));\n ctx.lineTo(tHoz(x2), tVert(yaxis.max));\n continue;\n } else if (y1 <= yaxis.min && y2 <= yaxis.min)\n {\n ctx.lineTo(tHoz(x1), tVert(yaxis.min));\n ctx.lineTo(tHoz(x2), tVert(yaxis.min));\n continue;\n }\n\n /**\n * Else it's a bit more complicated, there might\n * be two rectangles and two triangles we need to fill\n * in; to find these keep track of the current x values.\n */\n var x1old = x1, x2old = x2;\n\n /**\n * And clip the y values, without shortcutting.\n * Clip with ymin.\n */\n if (y1 <= y2 && y1 < yaxis.min && y2 >= yaxis.min)\n {\n x1 = (yaxis.min - y1) / (y2 - y1) * (x2 - x1) + x1;\n y1 = yaxis.min;\n } else if (y2 <= y1 && y2 < yaxis.min && y1 >= yaxis.min)\n {\n x2 = (yaxis.min - y1) / (y2 - y1) * (x2 - x1) + x1;\n y2 = yaxis.min;\n }\n\n /**\n * Clip with ymax.\n */\n if (y1 >= y2 && y1 > yaxis.max && y2 <= yaxis.max)\n {\n x1 = (yaxis.max - y1) / (y2 - y1) * (x2 - x1) + x1;\n y1 = yaxis.max;\n } else if (y2 >= y1 && y2 > yaxis.max && y1 <= yaxis.max)\n {\n x2 = (yaxis.max - y1) / (y2 - y1) * (x2 - x1) + x1;\n y2 = yaxis.max;\n }\n\n /**\n * If the x value was changed we got a rectangle to fill.\n */\n if (x1 != x1old)\n {\n top = (y1 <= yaxis.min) ? top = yaxis.min : yaxis.max;\n ctx.lineTo(tHoz(x1old), tVert(top));\n ctx.lineTo(tHoz(x1), tVert(top));\n }\n\n /**\n * Fill the triangles.\n */\n ctx.lineTo(tHoz(x1), tVert(y1));\n ctx.lineTo(tHoz(x2), tVert(y2));\n\n /**\n * Fill the other rectangle if it's there.\n */\n if (x2 != x2old)\n {\n top = (y2 <= yaxis.min) ? yaxis.min : yaxis.max;\n ctx.lineTo(tHoz(x2old), tVert(top));\n ctx.lineTo(tHoz(x2), tVert(top));\n }\n\n lastX = Math.max(x2, x2old);\n }\n /*\n ctx.beginPath();\n ctx.moveTo(tHoz(data[0][0]), tVert(0));\n for (var i = 0; i < data.length; i++) {\n ctx.lineTo(tHoz(data[i][0]), tVert(data[i][1]));\n }\n ctx.lineTo(tHoz(data[data.length - 1][0]), tVert(0));*/\n ctx.lineTo(tHoz(lastX), tVert(bottom));\n ctx.closePath();\n ctx.fill();\n }\n\n ctx.save();\n ctx.translate(plotOffset.left, plotOffset.top);\n ctx.lineJoin = 'round';\n\n var lw = series.lines.lineWidth;\n var sw = series.shadowSize;\n /**\n * @todo: consider another form of shadow when filling is turned on\n */\n if (sw > 0)\n {\n ctx.lineWidth = sw / 2;\n ctx.strokeStyle = \"rgba(0,0,0,0.1)\";\n plotLine(series.data, lw / 2 + sw / 2 + ctx.lineWidth / 2);\n\n ctx.lineWidth = sw / 2;\n ctx.strokeStyle = \"rgba(0,0,0,0.2)\";\n plotLine(series.data, lw / 2 + ctx.lineWidth / 2);\n }\n\n ctx.lineWidth = lw;\n ctx.strokeStyle = series.color;\n if (series.lines.fill)\n {\n //ctx.fillStyle = series.lines.fillColor != null ? series.lines.fillColor : parseColor(series.color).scale(null, null, null, 0.4).toString();\n ctx.fillStyle = series.lines.fillColor != null ? series.lines.fillColor : parseColor(series.color).scale(null, null, null).toString();\n plotLineArea(series.data, 0);\n }\n\n plotLine(series.data, 0);\n ctx.restore();\n }", "createXLines(data) {\n\n if (data == null) return;\n if (this.props.xAxisTransform == null) return;\n if (!this.xLabelLines) return;\n\n // Define the color of the line\n let lineColor = TRC.TotoTheme.theme.COLOR_THEME_LIGHT + 50;\n\n let lines = []\n\n // For each point, create a vertical line\n for (var i = 0; i < data.length; i++) {\n\n // If you only want to see the first and last VP, then the same applies for the labels\n if (this.showFirstAndLastVP) {\n if (i != 0 && i != data.length - 1) continue;\n }\n\n let datum = data[i];\n\n // Define the start and end of the line\n let lineStart = 0;\n let lineEnd = this.y(datum.y);\n\n if (this.xLabelPosition == 'top') lineStart += this.xLabelBottomPadding + this.xLabelSize*2.5;\n \n let line = d3.shape.line()\n .x((d) => {return d.x})\n .y((d) => {return d.y});\n\n let path = line([{x: this.x(datum.x), y: lineStart}, {x: this.x(datum.x), y: lineEnd}]);\n\n lines.push(this.createShape(path, lineColor, null, [5,5]));\n }\n \n return lines;\n }", "function lineDefault(){\n\treturn { style:\n\t\t { line: \"yellow\"\n\t\t , text: \"green\"\n\t\t , baseline: \"black\"}\n\t\t , xLabelPadding: 3\n\t\t , xPadding: 5\n\t\t , showLegend: true\n\t\t , wholeNumbersOnly: false \t\n\t\t , label: ''}\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Estimates crosssection widths given image collection (higherorder function).
function etimateWidthForImages(images) { return function(crossSection) { var timeSeries = getWidthTimeSeries(images, crossSection) var widths = timeSeries.aggregate_array('width') var widths_masked = timeSeries.aggregate_array('masked') var times = timeSeries.aggregate_array('system:time_start') var quality = timeSeries.aggregate_array('quality_score') var mission = timeSeries.aggregate_array('MISSION') return crossSection.set({ times: times, widths: widths, widths_masked: widths_masked, quality: quality, mission: mission }) } }
[ "function generateWidthForCatchment(c, index, crossSections) {\n var bounds = c.geometry()\n \n crossSections = crossSections.filterBounds(bounds)\n\n crossSections.size().evaluate(function(size) {\n print(index)\n \n if(!size) {\n print('<no cross-sections detected>')\n return\n }\n \n var images = getImages(bounds) \n \n print('Number of images covering catchment: ', images.size())\n \n // for every cross-section, estimate widths\n \n var fn = etimateWidthForImages(images)\n \n var results = crossSections.map(fn)\n \n var id = c.get('HYBAS_ID')\n \n id.evaluate(function(id) {\n Export.table.toDrive({\n collection: results, \n description: 'widths-' + id, \n folder: 'water-Niger-river-widths', \n fileNamePrefix: 'widths-' + id, \n fileFormat: 'GeoJSON'\n })\n })\n }) \n}", "function getWidthTimeSeries(images, crossSection) {\n var geom = crossSection.geometry()\n\n var imagesClean = images.filterBounds(geom)\n \n imagesClean = assets.getMostlyCleanImages(imagesClean, geom.buffer(300), {\n cloudFrequencyThresholdDelta: 0 // -0.15\n }).sort('system:time_start')\n \n var length = crossSection.length()\n\n var timeSeries = imagesClean.map(function(i) { \n var ndwi = i.normalizedDifference(['green', 'swir']).rename('mndwi')\n\n // ... a bit strange way to compute widths, double-check this\n var all = ee.Image.constant(1).float().reduceRegion(ee.Reducer.sum(), geom, scale, crs).values().get(0)\n\n var mask = i.select('green').mask().rename('mask')\n var maskedValid = ee.Number(mask.reduceRegion(ee.Reducer.sum(), geom, scale, crs).values().get(0))\n var masked = maskedValid.divide(all)\n \n var water = ndwi.gt(0)\n var widthValue = ee.Number(water.reduceRegion(ee.Reducer.sum(), geom, scale, crs).values().get(0))\n var width = widthValue.divide(all).multiply(length)\n\n return i.set({\n width: width,\n masked: masked\n })\n })\n \n animation.animate(timeSeries.filterDate('2018-04-01', '2018-10-01'), { maxFrames: 50 })\n // print(ui.Chart.feature.byFeature(timeSeries, 'system:time_start', ['masked', 'quality_score']))\n \n\n return timeSeries \n}", "function widthAllImgsInRow(imgArr)\r\n{\r\n var widthsCombined = 0;\r\n for(var imgElement = 0; imgElement < imgArr.length; imgElement++)\r\n {\r\n widthsCombined += imgArr[imgElement].offsetWidth;\r\n }\r\n return widthsCombined;\r\n}", "function fImagesContainerWidth (id, imagesArray) {\n console.log (\"fImagesContainerWidth:----------•\");\n var totalImgsWidth = (colRightWidth * imagesArray.length) + 100;\n id.css ({\"width\": totalImgsWidth});\n console.log (\"imagesArray.length: \", imagesArray.length);\n console.log (\"totalImgsWidth: \", totalImgsWidth);\n console.log (\"End fImagesContainerWidth:----------•\");\n }", "function normalizeWidths(id) {\n\n var imageWidths = [], imageHeights = [],\n unifiedWidths = [], widthRatios = [],\n fudge = 2; // for border width\n\n // 1. find width of collection\n var collectionWidth = $('#' + id + ' .wrapper').width();\n\n // 2. find all images and get unifiedWidths\n var assets = $('#' + id + ' .collection img');\n for (var i = 0, len = assets.length; i < len; i++) {\n var value = assets[i];\n // console.log('width', $(value).width(), 'height', $(value).height());\n var w = $(value).width(), h = $(value).height();\n imageWidths.push(w); imageHeights.push(h);\n\n console.log(id, i, w, h);\n\n unifiedWidths.push( getWidthOnUnifiedHeight(w, h) );\n };\n\n // 3. sum unifiedWidths into denominator, get relative widthRatios\n var denom = unifiedWidths.reduce(function(a, b) { return a + b; }, 0);\n for (var i = 0, len = assets.length; i < len; i++) {\n\n widthRatios.push(unifiedWidths[i] / denom);\n }\n\n // 4. i) set each image widths according to (width ratio x collectionWidth),\n // ii) force height to be same as first\n var trueHeight;\n for (var i = 0, len = assets.length; i < len; i++) {\n var trueWidth = widthRatios[i] * collectionWidth - fudge;\n\n // We define trueHeight once to keep all images on same row exactly same height\n if (!trueHeight) {\n // trueWidth = w2 = 10 * (w1 / h1) = 10 * Aspect Ratio\n // w2 * (1 / Aspect Ratio) = w2 * (h1/w1) = h2 = trueHeight\n trueHeight = trueWidth * (imageHeights[i] / imageWidths[i]);\n }\n\n $(assets[i]).animate({ width: trueWidth, height: trueHeight }, 30);\n }\n\n}", "function normalizeWidths(id) {\n\n var imageWidths = [], imageHeights = [],\n unifiedWidths = [], widthRatios = [],\n fudge = 2; // for border width\n\n // 1. find width of collection\n var collectionWidth = $('#' + id + ' .wrapper').width();\n\n // 2. find all images and get unifiedWidths\n var assets = $('#' + id + ' .collection img');\n for (var i = 0, len = assets.length; i < len; i++) {\n var value = assets[i];\n // console.log('width', $(value).width(), 'height', $(value).height());\n var w = $(value).width(), h = $(value).height();\n imageWidths.push(w); imageHeights.push(h);\n\n console.log(id, i, w, h);\n\n unifiedWidths.push( getWidthOnUnifiedHeight(w, h) );\n };\n\n // 3. sum unifiedWidths into denominator, get relative widthRatios\n var denom = unifiedWidths.reduce(function(a, b) { return a + b; }, 0);\n for (var i = 0, len = assets.length; i < len; i++) {\n\n widthRatios.push(unifiedWidths[i] / denom);\n }\n\n // 4. i) set each image widths according to (width ratio x collectionWidth),\n // ii) force height to be same as first\n var trueHeight;\n for (var i = 0, len = assets.length; i < len; i++) {\n var trueWidth = widthRatios[i] * collectionWidth - fudge;\n\n // We define trueHeight once to keep all images on same row exactly same height\n if (!trueHeight) {\n // trueWidth = w2 = 10 * (w1 / h1) = 10 * Aspect Ratio\n // w2 * (1 / Aspect Ratio) = w2 * (h1/w1) = h2 = trueHeight\n trueHeight = trueWidth * (imageHeights[i] / imageWidths[i]);\n }\n\n $(assets[i]).animate({ width: trueWidth, height: trueHeight }, 60);\n }\n\n}", "function getWidthThumbnailImage(images) {\n images.forEach(function(element, index) {\n\n // get height thumbnails\n var imageToCompute = document.getElementById('h5p-image-gallery-thumbnail-'+index);\n var imageHeight = parseFloat(window.getComputedStyle(imageToCompute).height);\n\n // get margin of thumbnails\n imageMargin = window.parseFloat(getStyle(imageToCompute, 'margin-left'), 10);\n element.image.margin = imageMargin;\n\n // calculate width of thumbnails\n var ratio = element.image.height / element.image.width ;\n element.image.newWidth = imageHeight / ratio + (2 * imageMargin) ;\n });\n}", "calculateScaledWidth(options) {\n const { config, canvasGroupings } = this.props;\n return canvasGroupings\n .getCanvases(options.index)\n .map(canvas => new ManifestoCanvas(canvas).aspectRatio)\n .reduce((acc, current) => acc + Math.floor(config.thumbnailNavigation.height * current), 8);\n }", "function calcSlideWidth(){\r\n //Update array with all images/slides\r\n slideArr = document.querySelectorAll(\".slide\");\r\n //Save width from carousel section\r\n let carouselWidth = carousel.offsetWidth;\r\n //Create counter to determine the number of slides currently\r\n //being displayed in the screen\r\n let count = 0;\r\n for(let i=0; i<slideArr.length; i++){\r\n let coords = slideArr[i].getBoundingClientRect();\r\n if(coords.left > 0 && coords.left <= carouselWidth){\r\n count++;\r\n }\r\n }\r\n //Calculate width from each single slide being displayer\r\n //in the screen\r\n let slideWidth = Math.round(carouselWidth / count);\r\n return slideWidth;\r\n}", "computeFeaturesWidth () {\n for (var f = 0, lf = this.pcm.features.length; f < lf; f++) {\n this.pcm.features[f].computeWidth()\n }\n this.computeFixedWidth()\n }", "function testSingleCrossSection() {\n var f = ee.Feature(crossSections.filterBounds(geometry.buffer(200)).first())\n\n var images = getImages(f.geometry())\n\n print('Number of images covering cross-section: ', images.size())\n\n f = etimateWidthForImages(images)(f)\n \n print(f)\n \n var t = ee.List(f.get('times'))\n var w = ee.List(f.get('widths'))\n\n var chartFeatures = t.zip(w).map(function(o) {\n o = ee.List(o)\n \n return ee.Feature(null, {\n 'system:time_start': o.get(0),\n width: o.get(1)\n })\n })\n \n chartFeatures = ee.FeatureCollection(chartFeatures).sort('system:time_start')\n\n print(ui.Chart.feature.byFeature(chartFeatures, 'system:time_start', 'width').setOptions({\n lineWidth: 0,\n pointSize: 1\n }))\n}", "width() {\n return this.height*this.img.width/this.img.height;\n }", "function FetImgWidth() {\n $(\"header .vertical-featured-image-container\").each(function() {\n var getWidth = $(this).closest(\"[class*='col-']\").width();\n $(this).width(getWidth);\n });\n }", "function halfCrossWidth(id) {\r\n return dd.elements[\"cross\"+id].w / 2;\r\n}", "function computeWidth (wrapPixels, wrapCount, widthFactor) {\n return wrapPixels || ((0.5 + wrapCount) * widthFactor);\n}", "function computeWidth (wrapPixels, wrapCount, widthFactor) {\n\t return wrapPixels || ((0.5 + wrapCount) * widthFactor);\n\t}", "function computeArrayWidths(arrays, cellWidth) {\n return arrays.map((array) => computeArrayDim(array)[0] * cellWidth);\n }", "function FetImgWidth() {\n\t$( \"header .vertical-featured-image-container\" ).each( function() {\n\t\tvar getWidth = $( this ).closest( \"[class*='col-']\" ).width();\n\t\t$( this ).width( getWidth );\n\t});\n}", "function setRows(images){\n var totalRowWidth = 0;\n\n // calculate normalized widths\n images.forEach(function(element, index) {\n var imageToCompute = document.getElementById('h5p-image-gallery-image-'+index);\n var ratio = (element.image.height) / (element.image.width);\n var imagePadding = window.parseFloat(getStyle(imageToCompute, 'padding'), 10);\n element.image.normalizedWidth = parseFloat((rowHeight / ratio));\n });\n\n // make rows\n let rowCounter = 0;\n let rowWidth = 0;\n images.forEach(function(element) {\n const createNewRow = rowWidth + element.image.normalizedWidth > containerWidth\n && rowWidth != 0;\n\n if(createNewRow) {\n rowCounter++;\n rowWidth = 0;\n }\n\n rowWidth += element.image.normalizedWidth;\n element.image.row = rowCounter;\n });\n\n // get total row width for each row\n rowWidths = images.reduce(function(result, element) {\n if(!result[element.image.row]) {\n result[element.image.row] = 0;\n }\n\n result[element.image.row] += element.image.normalizedWidth;\n return result;\n }, []);\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the message difference. / / The message edited at text. / The nothing selected text. / The select both text. / The select different text.
function RenderMessageDiff(messageEditedAtText,nothingSelectedText,selectBothText,selectDifferentText){var oldElement=$("input[id*='New']:checked");var newElement=$("input[id*='Old']:checked");if(newElement.length && oldElement.length){ // check if two different messages are selected if($("input[id*='Old']:checked").attr('id').slice(-1) == $("input[id*='New']:checked").attr('id').slice(-1)){alert(selectDifferentText);}else {var base=difflib.stringAsLines($("input[id*='Old']:checked").parent().next().next().find("input[id*='MessageField']").attr('value'));var newtxt=difflib.stringAsLines($("input[id*='New']:checked").parent().next().find("input[id*='MessageField']").attr('value'));var sm=new difflib.SequenceMatcher(base,newtxt);var opcodes=sm.get_opcodes();$("#diffContent").html('<div class="diffContent">' + diffview.buildView({baseTextLines:base,newTextLines:newtxt,opcodes:opcodes,baseTextName:messageEditedAtText + oldElement.parent().next().next().next().next().html(),newTextName:messageEditedAtText + oldElement.parent().next().next().next().next().html(),contextSize:3,viewType:0}).outerHTML + '</div>');}}else if(newElement.length || oldElement.length){alert(selectBothText);}else {alert(nothingSelectedText);}}
[ "_updateDifference () {\n if (this.to.length > this.from.length) {\n this.textDifference = this.to.substring(this.from.length, this.to.length);\n this.animationDirection = TEXT_ANIMATION_DIRECTIONS.ADD;\n }\n else {\n this.textDifference = this.from.substring(this.to.length, this.from.length);\n this.animationDirection = TEXT_ANIMATION_DIRECTIONS.REMOVE;\n }\n }", "function diffButton() {\n\tgetInput('Select Files to diff', 'diff');\n}", "function updateMessageArea() {\n\t// Add your code here\n if (selectedItems.length < 2)\n {\n messageArea.innerHTML = \"You must select two or more items\";\n }\n else if (selectedItems.length == 2)\n {\n messageArea.innerHTML = \"You have selected \" + selectedItems[0] + \" and \" + selectedItems[1];\n }\n else\n {\n var newString = \"You have selected \";\n for (var i = 0; i < selectedItems.length - 2; i++)\n {\n newString = newString + selectedItems[i] + \", \";\n }\n newString = newString + selectedItems[selectedItems.length - 2] + \" and \" + selectedItems[selectedItems.length - 1];\n messageArea.innerHTML = newString;\n }\n}", "function diffText(previous, current, el) {\n if (current.data !== previous.data) el.data = current.data;\n return el;\n }", "function compareBlocks(text1, text2, opt) {\n\n // process default options\n opt = optionOverlay(opt, {\n $container : $('body') , // default to body for output\n validate : true , // validate that diffs match input text\n style : 'adjacent', // default to side-by-side display\n title : null, // no default title\n diffData : null // precalculated diff data\n })\n\n // perform and validate diffs\n var d = opt.diffData ? opt.diffData : doDiff(text1, text2);\n if (opt.validate)\n validateDiffs(text1, text2, d);\n\n // render output\n if (opt.$container) {\n if (opt.style === 'adjacent')\n displayDiffsAsTable(d, opt.$container, opt.title);\n else if (opt.style === 'inline')\n displayDiffsAsBlock(d, opt.$container, opt.title);\n else\n throw new Error('Invalid display style: '+opt.style);\n }\n\n // return the diff data\n return d\n }", "function FP_RQIKP_PRIVATE_SelectDifferences(objINPUT,strCOMPAREValue,intCOMPAREValueLength)\n{\n var intINPUTValueLength = objINPUT.value.length; \n var intLengthDifference = intCOMPAREValueLength - intINPUTValueLength;\n\n if (intLengthDifference <= 0) return;\n\n var strAddition = strCOMPAREValue.substr(intINPUTValueLength);\n\n if (VF_System.usingExplorer)\n {\n var objTEXTRange = objINPUT.createTextRange(); \n\n objTEXTRange.text += strAddition;\n objTEXTRange.findText(strAddition,(intLengthDifference * -2));\n objTEXTRange.select();\n objTEXTRange = null; \n }\n else\n {\n objINPUT.value += strAddition;\n objINPUT.setSelectionRange(intINPUTValueLength, intCOMPAREValueLength);\n }\n\n return;\n}", "renderNoteDiffs() {\n\n // get selected item list\n var $el = this.$historyList.find('a.active');\n var selectedItems = $el.map( function(){return $(this).data('sequence')} ).toArray();\n\n // clear history window\n this.$historyWindow.empty();\n\n // if only one version is selected, display the content of this version\n if (selectedItems.length == 1) {\n this.$historyWindow\n .append('<h2>' + $($el[0]).text() + '</h2>')\n .append('<div class=\"text-diff\">' + escapeText(this.diffCache[selectedItems[0]][null]) + '</div>')\n\n // otherwise show diffs between selected versions\n } else {\n for (var i = selectedItems.length-2; i >= 0; i--) {\n compareBlocks(\n this.diffCache[ selectedItems[i+1] ][ null ],\n this.diffCache[ selectedItems[i] ][ null ],\n this.diffOptions(\n $($el[i+1]).text() + ' &rarr; ' + $($el[i]).text(),\n this.diffCache[ selectedItems[i+1] ][ selectedItems[i] ]\n )\n );\n }\n }\n }", "function diffText (previous, current, el) {\n if (current.data !== previous.data) el.data = current.data\n }", "function highlightChanges(textOne, textTwo) {\n const diff = Diff.diffLines(textTwo, textOne);\n let colorDiff = '',\n simpleDiff = '';\n\n diff.forEach((part) => {\n const { added, removed, value } = part;\n\n if (added) {\n colorDiff += chalk.green(value);\n simpleDiff += `Added: '${value}'\\n`;\n } else if (removed) {\n colorDiff += chalk.red(value);\n simpleDiff += `Removed: '${value}'\\n`;\n } else colorDiff += chalk.grey(value);\n });\n\n return { colorDiff, simpleDiff };\n}", "function diffText (previous, current, el) {\n if (current.data !== previous.data) el.data = current.data\n return el\n }", "createDisplayText(newSelection, oldSelection) {\n let value = '';\n if (this.isRemote) {\n if (newSelection.length) {\n const removedItems = oldSelection.filter(e => newSelection.indexOf(e) < 0);\n const addedItems = newSelection.filter(e => oldSelection.indexOf(e) < 0);\n this.registerRemoteEntries(addedItems);\n this.registerRemoteEntries(removedItems, false);\n value = Object.keys(this._remoteSelection).map(e => this._remoteSelection[e]).join(', ');\n }\n else {\n // If new selection is empty, clear all items\n this.registerRemoteEntries(oldSelection, false);\n }\n }\n else {\n value = this.concatDisplayText(newSelection);\n }\n return value;\n }", "function diffText (previous, current, el) {\n\t if (current !== previous) el.data = current\n\t return el\n\t }", "function redactSelectedTexts() { \n Word.run(function (context) {\n // Get selected text.\n var selection = context.document.getSelection();\n selection.load(\"text\");\n return context.sync().then(function() {\n RedactAddin.redactWordsCommon(selection.text);\n });\n }).catch(RedactAddin.handleErrors);\n }", "renderText() {\n const reviewRequest = this.model.get('parentObject').get('parentObject');\n\n if (this.$editor) {\n RB.formatText(this.$editor, {\n newText: this.model.get('text'),\n richText: this.model.get('richText'),\n isHTMLEncoded: true,\n bugTrackerURL: reviewRequest.get('bugTrackerURL'),\n });\n }\n }", "function updateTextUI() {\n select('#result').html(currentText);\n}", "function checkSelectedText() {\n\t\t\tif ( !selText ) {\n\t\t\t\tselText = options.peri;\n\t\t\t\tisSample = true;\n\t\t\t} else if ( options.replace ) {\n\t\t\t\tselText = options.peri;\n\t\t\t} else if ( selText.charAt( selText.length - 1 ) == ' ' ) {\n\t\t\t\t// Exclude ending space char\n\t\t\t\tselText = selText.substring(0, selText.length - 1);\n\t\t\t\toptions.post += ' ';\n\t\t\t}\n\t\t}", "function showOtherText(){\n /*jshint validthis:true */\n var type = this.type;\n var other = false;\n var select = false;\n\n // Dropdowns\n if ( type === 'select-one' ) {\n select = true;\n var curOpt = this.options[this.selectedIndex];\n if ( curOpt.className === 'frm_other_trigger' ) {\n other = true;\n }\n } else if ( type === 'select-multiple' ) {\n select = true;\n var allOpts = this.options;\n other = false;\n for ( var i = 0; i < allOpts.length; i++ ) {\n if ( allOpts[i].className === 'frm_other_trigger' ) {\n if ( allOpts[i].selected ) {\n other = true;\n break;\n }\n }\n }\n }\n if ( select ) {\n\t\t\tvar otherField = jQuery(this).parent().children('.frm_other_input');\n\n\t\t\tif ( otherField.length ) {\n\t\t\t\tif ( other ) {\n\t\t\t\t\t// Remove frm_pos_none\n\t\t\t\t\totherField[0].className = otherField[0].className.replace( 'frm_pos_none', '' );\n\t\t\t\t} else {\n\t\t\t\t\t// Add frm_pos_none\n\t\t\t\t\tif ( otherField[0].className.indexOf( 'frm_pos_none' ) < 1 ) {\n\t\t\t\t\t\totherField[0].className = otherField[0].className + ' frm_pos_none';\n\t\t\t\t\t}\n\t\t\t\t\totherField[0].value = '';\n\t\t\t\t}\n\t\t\t}\n\n // Radio\n } else if ( type === 'radio' ) {\n\t\t\tif ( jQuery(this).is(':checked' ) ) {\n\t\t\t\tjQuery(this).closest('.frm_radio').children('.frm_other_input').removeClass('frm_pos_none');\n\t\t\t\tjQuery(this).closest('.frm_radio').siblings().children('.frm_other_input').addClass('frm_pos_none').val('');\n\t\t\t}\n // Checkboxes\n } else if ( type === 'checkbox' ) {\n if ( this.checked ) {\n jQuery(this).closest('.frm_checkbox').children('.frm_other_input').removeClass('frm_pos_none'); \n } else {\n jQuery(this).closest('.frm_checkbox').children('.frm_other_input').addClass('frm_pos_none').val('');\n }\n }\n\t}", "function state_transition (textGot) {\r\n\t\ttxt = textGot.toString();// transform the select text into a string\r\n\t\t//we calculate the selection position(begin and end)\r\n\t\tvar begin = strpos(text,htmlspecialchars(txt,null,null,false),0);\r\n\t\tvar end = begin + txt.length ;\r\n\t\t\r\n\t\t//we check if the selection is repeated, it means strpos will return true\r\n\t\tif(strpos(text,htmlspecialchars(txt,null,null,false),(begin+1)) && (txt != '')){\r\n\t\t\t$('#warning').css(\"display\",'inline-block');\r\n\t\t\t$('#warning').html(\"Your selection '\"+txt+\"' is repeated in the text, please broaden your selection\");\r\n\t\t\t$( \"#dialog:ui-dialog\" ).dialog( \"destroy\" );\r\n\t\t\t$( \"#warning\" ).dialog({resizable: false,width: 300,modal: true,show: 'slide',hide: 'clip',\tbuttons: {\r\n\t\t\t\t\t\"Ok\": function() {\r\n\t\t\t\t\t\t$( this ).dialog( \"close\" );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\t$( \"#warning\" ).dialog('open');\r\n\t\t}\r\n\t\t//if the selection isn't repeated\r\n\t\telse{\r\n\t\t\t//we use area_intersect to know where the selection has been done\r\n\t\t\tvar check = area_intersect(begin, end, tab_of_areas_position);\r\n\t\t\tif(txt == '')//if it was a click on the text, not a selection (the selection is empty)\r\n\t\t\t{\r\n\t\t\t\t\tperform_action(state,CLIC_AREA.ON_TEXT,check,txt);//transition\r\n\t\t\t\t\tstate = CLIC_AREA.ON_TEXT;//the current state\r\n\t\t\t\t\t$(\"#clic_area_del_button\").slideUp(\"slow\");// no delete\r\n\t\t\t}\r\n\t\t\telse //a selection has been done\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\tif(check ==-1)//-1 means we have to register a new click area\r\n\t\t\t\t{\r\n\t\t\t\t\t$(\"#clic_area_del_button\").slideUp(\"slow\");// no delete\r\n\t\t\t\t\tperform_action(state,CLIC_AREA.ON_NEW_AREA,check,txt);//transition\r\n\t\t\t\t\tstate = CLIC_AREA.ON_NEW_AREA;//the current state\r\n\t\t\t\t\tclic_areas_nb++ ;//we have one more click area\r\n\t\t\t\t\tvar shifted_begin = begin + shift(begin,tab_of_areas_position);//this is new begin regarding the previous tag (to color blue) \r\n\t\t\t\t\ttab_of_areas_position[clic_areas_nb] = [begin,end];//add new positions\r\n\t\t\t\t\t//color the new area blue\r\n\t\t\t\t\ttext_visible = text_visible.substr(0, shifted_begin) + tag_color + text_visible.substr(shifted_begin,txt.length) + close_tag + text_visible.substr(shifted_begin+txt.length);\r\n\t\t\t\t\t//and update the visible text\r\n\t\t\t\t\t$(\"#added_text\").html(text_visible);\r\n\t\t\t\t}\r\n\t\t\t\telse if(check ==-2)//-2 means the selection touched several click areas\r\n\t\t\t\t{\r\n\t\t\t\t\t$(\"#clic_area_del_button\").slideUp(\"slow\");//ne delete\r\n\t\t\t\t\tperform_action(state,CLIC_AREA.ON_ERROR,check,txt);//transition\r\n\t\t\t\t\tstate = CLIC_AREA.ON_ERROR;//current state\r\n\t\t\t\t}\t\t\r\n\t\t\t\telse if(check >= 0)// a non negative integer means a click area has been selected \r\n\t\t\t\t{\r\n\t\t\t\t\t$(\"#clic_area_del_button\").slideDown(\"slow\");//delete is possible\r\n\t\t\t\t\t$(\"#clic_area_del_button\").attr(\"onclick\",\"del_clic_area(\"+check+\");\");//if someone click on the delete button, this area (check) will be deleted\r\n\t\t\t\t\tperform_action(state,CLIC_AREA.ON_ADDED_AREA,check,txt);//transition\r\n\t\t\t\t\tstate = CLIC_AREA.ON_ADDED_AREA;//current state\r\n\t\t\t\t\tlast_check = check;\t//this is information necessary for the next state transition\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "_initSelectedText() {\n if (\"_textSelected\" in this) {\n // Already initialized.\n return;\n }\n\n let spanNode = this._getSpanNode();\n if (!spanNode) {\n // can happen if the message text is under a separate root node\n // that isn't selected at all\n this._textSelected = false;\n this._otherSelected = true;\n return;\n }\n let startPoint = this._range.comparePoint(spanNode, 0);\n // Note that we are working on the HTML DOM, including text nodes,\n // so we need to use childNodes here and below.\n let endPoint = this._range.comparePoint(\n spanNode,\n spanNode.childNodes.length\n );\n if (startPoint <= 0 && endPoint >= 0) {\n let range = this._range.cloneRange();\n if (startPoint >= 0) {\n range.setStart(spanNode, 0);\n }\n if (endPoint <= 0) {\n range.setEnd(spanNode, spanNode.childNodes.length);\n }\n this._selectedText = serializeRange(range);\n\n // if the selected text is empty, set _selectedText to false\n // this happens if the carret is at the offset 0 in the span node\n this._textSelected = this._selectedText != \"\";\n } else {\n this._textSelected = false;\n }\n if (this._textSelected) {\n // to check if the start or end is cut, the result of\n // comparePoint is not enough because the selection range may\n // start or end in a text node instead of the span node\n\n if (startPoint == -1) {\n let range = spanNode.ownerDocument.createRange();\n range.setStart(spanNode, 0);\n range.setEnd(this._range.startContainer, this._range.startOffset);\n this._cutBegin = serializeRange(range) != \"\";\n } else {\n this._cutBegin = false;\n }\n\n if (endPoint == 1) {\n let range = spanNode.ownerDocument.createRange();\n range.setStart(this._range.endContainer, this._range.endOffset);\n range.setEnd(spanNode, spanNode.childNodes.length);\n this._cutEnd = !/^(\\r?\\n)?$/.test(serializeRange(range));\n } else {\n this._cutEnd = false;\n }\n }\n this._otherSelected =\n (startPoint >= 0 || endPoint <= 0) && // eliminate most negative cases\n (!this._textSelected ||\n serializeRange(this._range).length > this._selectedText.length);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
showMoveAnimation(i, j, i, k);
function showMoveAnimation( fromx , fromy , tox , toy ){ var numberCell = $('#number-cell-'+fromx+'-'+fromy ); numberCell.animate({ top:getPosTop( tox ,toy ), left:getPosLeft(tox ,toy) },200) }
[ "function animate() { }", "function updateVis(move) {\n ;\n}", "function animG(){\r\n\tAnimation13();\r\n\tAnimation14();\r\n}", "function animE(){\r\n\tAnimation9();\r\n\tAnimation10();\r\n}", "animation() {}", "function kinetic(){\n biglogs.animate();\n pinkcar.animate();\n racecar.animate();\n truck.animate();\n}", "function animF(){\r\n\tAnimation11();\r\n\tAnimation12();\r\n}", "function animC(){\r\n\tAnimation5();\r\n\tAnimation6();\r\n}", "delayAnimation(fromMove, toMove) {\n return 0;\n }", "function animD(){\r\n\tAnimation7();\r\n\tAnimation8();\r\n}", "function animation_memory_location (delta){\t \n show_arrow (delta);\n}", "function Animation(){}", "function animation_insertion_with_saturation (k, direction) {\n var end = gen_inf['mem_loc'];\n var initial = direction;\n \n for (i=0; i<(sel_val['mem_cap']); i++){\n hide_animation (i);\n }\n \n str = \"show_arrow (\"+direction+\")\";\n setTimeout(str, 0);\n str = \"animation_flag_with_saturation (\"+direction+\")\";\n setTimeout(str, 3000);\n str = \"view_second_function ('\"+k+\"', \"+offset+\")\";\n setTimeout(str, 5000);\n setTimeout('animation_second_function ();', 5000);\n \n var time = 7000;\n delta = calculate_next_memory_location (initial, offset);\n while (initial != end){ \n\tsetTimeout (\"animation_memory_location (delta)\",time);\n\tsetTimeout (\"hide_animation (delta)\", time+2000); \n\tsetTimeout (\"delta = calculate_next_memory_location (delta, offset)\",time+2000);\n\ttime = time + 2000;\n\tinitial = calculate_next_memory_location (initial, offset);\n } \n \n str = \"last_step_insertion(\"+initial+\")\";\n setTimeout (str, time);\n}", "function drawButtonAnimation(highlight, win, animation) {\n \n}", "function story1_animation(cb){\n\tvar dist = 50;\n\t$('#marbleBorderTop, #marbleBorderBottom, #marbleBorderLeft, #marbleBorderRight').show();\n\t$('#marbleBorderTop').animate({top: '+=' + dist}, {\n\t\tduration: 900,\n\t\tcomplete: cb\n\t});\n\t$('#marbleBorderBottom').animate({top: '-=' + dist}, {duration: 750});\n\t$('#marbleBorderLeft').animate({left: '+=' + dist}, {duration: 400});\n\t$('#marbleBorderRight').animate({left: '-=' + dist}, {duration: 400});\n}", "function animate(){\n\n \t// create the skeleton and set the data received of the kinect\n jQuery.each(position, function() {\n var name = this.name;\n\n \t$(\"#\"+name).attr(\"translation\", position[name].x + \" \" + position[name].y + \" \" + position[name].z);\n });\n\n // relate the members\n for (var k=0; k<relatedMembers.length; k++)\n \t\tbuildSkeleton(relatedMembers[k]);\n \t\n \tmove();\n }", "animate(){\n this.x += this.delta(3.1416*2.0,10);\n }", "function animB(){\r\n\tAnimation3();\r\n\tAnimation4();\r\n}", "function animateEnemies() {\n\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update an item in the this._cache and fire an UPDATE event. If the item does not exist, an ADD event will be fired instead.
update(item) { this._cache[item._id] = item; this.emit(events.CHANGE, item, this); }
[ "function updateItem(item) {\n $.ajax({\n method: \"PUT\",\n url: \"/api/items\",\n data: item\n })\n .done(function() {\n getItems();\n getItemsDevoured();\n });\n }", "update () {\n if (this._disabled) return\n\n this._cache()\n this._update()\n }", "handleUpdateItem (id, newItem) {\n this.props.dispatch(updateItem(id, newItem))\n }", "_updateItem(update) {\r\n const id = update[__classPrivateFieldGet(this, _idProp)];\r\n if (id == null) {\r\n throw new Error(\"Cannot update item: item has no id (item: \" +\r\n JSON.stringify(update) +\r\n \")\");\r\n }\r\n const item = __classPrivateFieldGet(this, _data).get(id);\r\n if (!item) {\r\n // item doesn't exist\r\n throw new Error(\"Cannot update item: no item with id \" + id + \" found\");\r\n }\r\n __classPrivateFieldGet(this, _data).set(id, { ...item, ...update });\r\n return id;\r\n }", "updateItem(item, itemId, callback) {\n fetch(this.EbayURL + 'items/' + itemId, {\n method: 'put', \n body: JSON.stringify(item),\n headers: {\n 'content-type': 'application/json' }\n })\n .then(response => response.json())\n .then(item => callback(item))\n }", "function updateItem( id, entry ) {\n $http.put( storelist_url + '/' + id, entry ).then(\n function(response) {\n console.log(response);\n deferred.resolve(response);\n },\n function(error) {\n deferred.reject(error);\n }\n );\n return deferred.promise;\n }", "updateItem(listId, itemId, value, status, version) {\n if (typeof value === \"object\") {\n return this.getResult(`${listId}/items/${itemId}`, \"PUT\", value);\n }\n return this.getResult(`${listId}/items/${itemId}`, \"PUT\", {\n status,\n value,\n version,\n });\n }", "hit(k) {\n this._update(k, this.cache[k].value);\n }", "function updateEditedItem(item, callBack) {\n var index = items.findIndex(i => i.Id == item.Item.Id);\n\n if (items[index].Id === item.Item.Id) {\n items[index].Name = item.Name;\n\n _saveItems(items);\n\n callBack(items[index]);\n }\n}", "updateOneInCache(entity, options) {\n // update entity might be a partial of T but must at least have its key.\n // pass the Update<T> structure as the payload\n this.dispatcher.updateOneInCache(entity, options);\n }", "editCache(item, quantity) {\n this._credits -= (this._costs.get(item) ?? 0) * quantity;\n this._inventory.set(item, (this._inventory.get(item) ?? 0) + quantity);\n }", "update(id, item) {\n return this.http\n .put(this.baseUrl + '/' + id, JSON.stringify(item), this.httpOptions)\n .pipe(retry(2), catchError(this.handleError));\n }", "update(obj) {\n console.log('[model] update item', obj.id);\n // we get index for item which we want update\n const index = this.getIndex(obj.id);\n // we check if exist index or no\n if (index !== false) {\n obj.updated = +Date.now();\n this.data[index] = obj;\n this.save();\n // item exist and saved, we return true\n return obj;\n }\n // if item not exist then return false\n return false;\n }", "function updateOneItem(cart, item) {\n\tconsole.log('in update helper');\n\tconst { itemID, name, quantity } = item;\n\tlet itemIndex = cart.inventory.findIndex((p) => p.itemID == itemID);\n\tif (itemIndex > -1) {\n\t\t//item exists in the inventory, update the quantity\n\t\tlet newItem = cart.inventory[itemIndex];\n\t\tnewItem.quantity += quantity;\n\t\tif (newItem.quantity <= 0) {\n\t\t\tconsole.log('index: ' + itemIndex);\n\t\t\tif (itemIndex == 0) {\n\t\t\t\tcart.inventory.splice(itemIndex, itemIndex + 1);\n\t\t\t} else {\n\t\t\t\tcart.inventory.splice(itemIndex, itemIndex);\n\t\t\t}\n\t\t} else {\n\t\t\tcart.inventory[itemIndex] = newItem;\n\t\t}\n\t} else {\n\t\t//item does not exists in inventory, add new item\n\t\tcart.inventory.push({ itemID, name, quantity });\n\t}\n}", "function update(item) {\n es.update({\n index: index,\n type: type,\n id: item.id,\n body: {\n doc: {\n name: item.name\n }\n }\n }, function(err) {\n if (err) {\n return debug(err);\n }\n debug('update item (id: %s) in index', item.id);\n });\n}", "updateEditedItem() {\n if (!this.currentItem.Id) {\n return;\n }\n\n var result = {\n Action: \"UpdateEditedItem\",\n Item: this.currentItem,\n Name: this.name.innerText\n };\n\n chrome.runtime.sendMessage(result, function(response) {\n this._updateList(response);\n this.renderItem(response);\n this._updateDropDown(response);\n }.bind(this));\n }", "update(item, modified) {\n const i = this.queue.indexOf(item);\n const queueItem = this.queue[i];\n if (queueItem === Object.assign({}, queueItem, modified)) {\n return false;\n }\n this.queue[i] = Object.assign({}, item, modified);\n return true;\n }", "put(item) {\n\t\t\t\tconst oldHead = this.items[this.head];\n\t\t\t\tlet newHead;\n\n\t\t\t\t// Only update if the item is not already the current head\n\t\t\t\tif (String(item.id) !== String(this.head)) {\n\t\t\t\t\t// Check if the item already exists\n\t\t\t\t\tif (Object.getOwnPropertyDescriptor(this.items, item.id)) {\n\t\t\t\t\t\t// New head is the existing item\n\t\t\t\t\t\tnewHead = this.items[item.id];\n\n\t\t\t\t\t\t// Unlink the existing item from the list\n\t\t\t\t\t\tif (String(item.id) === String(this.tail)) {\n\t\t\t\t\t\t\tthis.tail = newHead.newer;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.items[newHead.older].newer = newHead.newer;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.items[newHead.newer].older = newHead.older;\n\n\t\t\t\t\t\t// Link the old head to the new head\n\t\t\t\t\t\toldHead.newer = item.id;\n\t\t\t\t\t\tnewHead.older = this.head;\n\t\t\t\t\t\tnewHead.newer = null;\n\n\t\t\t\t\t\t// Update the header pointer\n\t\t\t\t\t\tthis.head = item.id;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnewHead = {\n\t\t\t\t\t\t\tid: item.id,\n\t\t\t\t\t\t\tname: item.name\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// Link the old head to the new head\n\t\t\t\t\t\tif (oldHead) {\n\t\t\t\t\t\t\toldHead.newer = item.id;\n\t\t\t\t\t\t\tnewHead.older = this.head;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// This must be the first item in the cache, so must be both head and tail\n\t\t\t\t\t\t\tthis.tail = item.id;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Add the new item to the cache\n\t\t\t\t\t\tthis.items[item.id] = newHead;\n\n\t\t\t\t\t\t// Update the head pointer\n\t\t\t\t\t\tthis.head = item.id;\n\n\t\t\t\t\t\t// Check if the cache has exceeded it's capacity\n\t\t\t\t\t\tthis.checkCapacity();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Return the list of cached items in order (MRU)\n\t\t\t\treturn this.list();\n\t\t\t}", "updateItem(itemId, reaction) {\n const itemRef = firebase.database().ref(`/items/${itemId}`);\n console.log(itemRef);\n\n itemRef.update({ reaction: !reaction }, function(error) {\n if (error) {\n console.log(\"update failed\");\n } else {\n console.log(\"update success\");\n }\n });\n console.log(\"State\", this.state.items);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Random input strings test. No output verification, useful for valgrind etc. Exercises fromCharCode(), toUpperCase(), toLowerCase(), toLocaleUpperCase(), toLocaleLowerCase().
function randomStringTest() { var i, j, len, arr, str, res1, res2, res3; for (i = 0; i < 100; i++) { if ((i % 10) == 0) { print(i); } len = Math.floor(Math.random() * 40000); arr = []; for (j = 0; j < len; j++) { arr.push(Math.floor(Math.random() * 0x1000000)); } str = String.fromCharCode.apply(null, arr); //print(len, str.length, Duktape.Buffer(str).length); res1 = str.toUpperCase(); res2 = str.toLowerCase(); res3 = res1.toLowerCase(); res1 = str.toLocaleUpperCase(); res2 = str.toLocaleLowerCase(); res3 = res1.toLocaleLowerCase(); // Can't really compare result lengths or contents; case conversion // may change string length, and conversion "route" affects final // result. This is just a brute force coverage test. } }
[ "function testInLowerCaseAlphabet(){\n\t\tvar StringUtils = LanguageModule.StringUtils;\n\t\tvar stringUtils = new StringUtils();\n\t\tvar encodings = stringUtils.stringEncodings;\n\t\tvar lencodings = stringUtils.languageEncodings;\n\t\tvar isLowerCaseInAlphabet1 = stringUtils.isLowerCaseInAlphabet(\"abcdef\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isLowerCaseInAlphabet2 = stringUtils.isLowerCaseInAlphabet(\"ABCDEF\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isLowerCaseInAlphabet3 = stringUtils.isLowerCaseInAlphabet(\"0123456789\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isLowerCaseInAlphabet4 = stringUtils.isLowerCaseInAlphabet(\"g\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isLowerCaseInAlphabet5 = stringUtils.isLowerCaseInAlphabet(\"->?\", encodings.ASCII, lencodings.ENGLISH);\n\t\texpect(isLowerCaseInAlphabet1).to.eql(true);\n\t\texpect(isLowerCaseInAlphabet2).to.eql(false);\n\t\texpect(isLowerCaseInAlphabet3).to.eql(false);\n\t\texpect(isLowerCaseInAlphabet4).to.eql(true);\n\t\texpect(isLowerCaseInAlphabet5).to.eql(false);\n\t}", "function getRandomLowerCaseChar() \n{\n // pick a random small case character code. \n //97 is ASCII/Unicode of a.\n var randomLowerCaseCode = 97 + Math.floor(Math.random() * 26);\n return String.fromCharCode(randomLowerCaseCode);\n}", "function coolString(inputString) {\n if(/[^a-zA-Z]/.test(inputString)) {\n return false;\n }\n \n const isLowercase = char => char.charCodeAt() >= 97 && char.charCodeAt() <= 122;\n const isUppercase = char => char.charCodeAt() >= 65 && char.charCodeAt() <= 90;\n const alternateCaseCheck = isLowercase(inputString[0]) ? [isUppercase, isLowercase] : [isLowercase, isUppercase];\n \n for(let i = 1; i < inputString.length; i++) {\n if(alternateCaseCheck[i%2](inputString[i])) {\n return false;\n }\n }\n return true;\n}", "function getRandomLowerCase() {\n return String.fromCharCode(Math.floor(Math.random() * 26) + 97);\n}", "function getRandomLowerCaseChar() {\n randomIndex = Math.floor(Math.random() * 27);\n return lowerCase[randomIndex];\n}", "manipulateString() {\n let myArray = Array.from(gatherInput().toLowerCase(), x => {\n switch (x) {\n case 'a':\n return 1\n break;\n case 'b':\n return 2\n break;\n case 'c':\n return 3\n break;\n case 'd':\n return 4\n break;\n case 'e':\n return 5\n break;\n case 'f':\n return 6\n break;\n case 'g':\n return 7\n break;\n case 'h':\n return 8\n break;\n case 'i':\n return 9\n break;\n case 'j':\n return 10\n break;\n case 'k':\n return 11\n break;\n case 'l':\n return 12\n break;\n case 'm':\n return 13\n break;\n case 'n':\n return 14\n break;\n case 'o':\n return 15\n break;\n case 'p':\n return 16\n break;\n case 'q':\n return 17\n break;\n case 'r':\n return 18\n break;\n case 's':\n return 19\n break;\n case 't':\n return 20\n break;\n case 'u':\n return 21\n break;\n case 'v':\n return 22\n break;\n case 'w':\n return 23\n break;\n case 'x':\n return 24\n break;\n case 'y':\n return 25\n break;\n case 'z':\n return 26\n break;\n case ',':\n return ','\n break;\n case '!':\n return '!'\n break;\n case '?':\n return '?'\n break;\n case '.':\n return '.'\n break;\n case ' ':\n return ' '\n break;\n case 'á':\n return '1(á)'\n break;\n case 'ã':\n return '1(ã)'\n break;\n case 'ó':\n return '15(ó)'\n break;\n case 'õ':\n return '15(õ)'\n break;\n case 'ô':\n return '15ô'\n break;\n case 'é':\n return '5(é)'\n break;\n case 'ê':\n return '5(ê)'\n break;\n case 'ç':\n return '3(ç)'\n break;\n case ',':\n return ','\n break;\n case '0':\n return 'Num(0)'\n break;\n case '1':\n return 'Num(1)'\n break;\n case '2':\n return 'Num(2)'\n break;\n case '3':\n return 'Num(3)'\n break;\n case '4':\n return 'Num(4)'\n break;\n case '5':\n return 'Num(5)'\n break;\n case '6':\n return 'Num(6)'\n break;\n case '7':\n return 'Num(7)'\n break;\n case '8':\n return 'Num(8)'\n break;\n case '9':\n return 'Num(9)'\n break;\n default:\n return 404;\n }\n })\n\n return myArray\n }", "function getRandomLowerCase() {\n return String.fromCharCode(Math.floor(Math.random() * 26) + 97);\n }", "function securityCheck(input) {\r\n var uppercase = false;\r\n var lowercase = false;\r\n var number = false;\r\n var symbol = false;\r\n for (var i = 0; i < input.length; i++) {\r\n if (/[A-Z]/.test(input.charAt(i))) {\r\n uppercase = true;\r\n }\r\n if (/[a-z]/.test(input.charAt(i))) {\r\n lowercase = true;\r\n }\r\n if (/[0-9]/.test(input.charAt(i))) {\r\n number = true;\r\n }\r\n if (/[-!$%^&*()_+|~=`{}\\[\\]:\";'<>?,.\\/]/.test(input.charAt(i))) {\r\n symbol = true;\r\n }\r\n }\r\n return uppercase && lowercase && number && symbol;\r\n}", "convertCase(string, fromCaseString, toCaseString) {\n const caseSplitters = { kebabCase: '-', snakeCase: '_', spaceCase: ' ' };\n const stringCases = ['kebabCase', 'snakeCase', 'spaceCase', 'pascalCase', 'camelCase'];\n\n if (! stringCases.includes(fromCaseString) || ! stringCases.includes(toCaseString)) {\n throw new Error('Please specify valid case: kebabCase | snakeCase | spaceCase | pascalCase | camelCase');\n }\n\n let inputStringCache = [];\n\n if (['kebabCase', 'snakeCase', 'spaceCase'].includes(fromCaseString)) {\n inputStringCache = string.split(caseSplitters[fromCaseString]).map(word => word.trim().toLowerCase());\n }\n\n else {\n const inputStringCharacters = string.split('');\n const capitalLettersAsciiRange = this.range(90, 65);\n\n let tempInputStringCharacter = [];\n inputStringCharacters.forEach((character, index, loopedOverArray) => {\n tempInputStringCharacter.push(character);\n if (\n index + 1 === loopedOverArray.length ||\n capitalLettersAsciiRange.includes(loopedOverArray[index + 1].charCodeAt(0))\n ) {\n inputStringCache.push(tempInputStringCharacter.join('').trim().toLowerCase());\n tempInputStringCharacter.length = 0;\n }\n });\n }\n\n if (['kebabCase', 'snakeCase', 'spaceCase'].includes(toCaseString)) {\n if (toCaseString === 'spaceCase') {\n inputStringCache = inputStringCache.map(word => this.ucfirst(word));\n }\n\n return inputStringCache.join(caseSplitters[toCaseString]);\n }\n\n else {\n const finalResultString = inputStringCache.map(word => this.ucfirst(word)).join('');\n if (toCaseString === 'camelCase') {\n return `${finalResultString[0].toLowerCase()}${finalResultString.slice(1)}`;\n }\n return finalResultString;\n }\n }", "function correctInput(userInput) {\n return userInput.toLowerCase();\n \n}", "function getRandomUpperCase(){\n return String.fromCharCode(Math.floor(Math.random()*26)+65);\n }", "function testInUpperCaseAlphabet(){\n\t\tvar StringUtils = LanguageModule.StringUtils;\n\t\tvar stringUtils = new StringUtils();\n\t\tvar encodings = stringUtils.stringEncodings;\n\t\tvar lencodings = stringUtils.languageEncodings;\n\t\tvar isUpperCaseInAlphabet1 = stringUtils.isUpperCaseInAlphabet(\"abcdef\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isUpperCaseInAlphabet2 = stringUtils.isUpperCaseInAlphabet(\"ABCDEF\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isUpperCaseInAlphabet3 = stringUtils.isUpperCaseInAlphabet(\"0123456789\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isUpperCaseInAlphabet4 = stringUtils.isUpperCaseInAlphabet(\"g\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isUpperCaseInAlphabet5 = stringUtils.isUpperCaseInAlphabet(\"->?\", encodings.ASCII, lencodings.ENGLISH);\n\t\texpect(isUpperCaseInAlphabet1).to.eql(false);\n\t\texpect(isUpperCaseInAlphabet2).to.eql(true);\n\t\texpect(isUpperCaseInAlphabet3).to.eql(false);\n\t\texpect(isUpperCaseInAlphabet4).to.eql(false);\n\t\texpect(isUpperCaseInAlphabet5).to.eql(false);\n\t}", "function runTest(){\n testPhraseA();\n testPhraseB();\n testPhraseC();\n testSpecialChars();\n}", "function randomString(len, an){\n an = an&&an.toLowerCase();\n var str=\"\", i=0, \n min=an==\"n\"?0:10, \n max=an==\"n\"?10:an==\"c\"?36:62;\n \n for(;i++<len;){\n var r = Math.random()*(max-min)+min <<0;\n str += String.fromCharCode(r+=r>9?r<36?55:61:48);\n }\n return str;\n}", "function shouldScramble(charCode) {\n return (charCode >= 48 && charCode <= 57) || /* numbers */\n (charCode >= 65 && charCode <= 90) || /* upper case */\n (charCode >= 97 && charCode <= 122); /* lower case */\n}", "function initalizeChars() {\n let str = '';\n logger_1.Logger.debug(\"Initializing possible chars that can appear in a random string\");\n for (let i = 'a'.charCodeAt(0); i <= 'z'.charCodeAt(0); i++) {\n str += String.fromCharCode(i);\n str += String.fromCharCode(i).toUpperCase();\n }\n for (let i = 0; i < 10; i++) {\n str += i;\n }\n logger_1.Logger.debug(\"Finished random character list initialization\");\n return str;\n}", "function getRandomLower() {\n return randomLetter();\n}", "function generateRandomLower() {\n const ascii = getRandomInt(97, 122);\n return String.fromCharCode(ascii);\n}", "function lowercase(input) {}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates the commonCovariance matrix for all gesture classes
function getCommonCovarianceMatrix(gestureClasses) { let commonCovMatrix = [...Array(NUM_FEATURES)].map(e => Array(NUM_FEATURES)); let numClasses = gestureClasses.length; // C let covMatrices = new Array(numClasses); let numGestureExamples = 0; for (let i = 0; i < numClasses; i++) { numGestureExamples += gestureClasses[i].length; covMatrices[i] = getCovarianceMatrix(gestureClasses[i]); } let denominator = -numClasses + numGestureExamples; let sum = 0; for (let i = 0; i < NUM_FEATURES; i++) { for (let j = 0; j < NUM_FEATURES; j++) { for (let k = 0; k < numClasses; k++) { let covMatrix = covMatrices[k]; sum += covMatrix[i][j]; } commonCovMatrix[i][j] = sum / denominator; sum = 0; } } return commonCovMatrix; }
[ "function setCommonCovarianceMatrix(GestureSet) {\n let matrix = [];\n for (var i = 0; i < RubineFeatures.length; i++) {\n matrix[i] = [];\n for (let j = 0; j < RubineFeatures.length; j++) {\n let num = 0.0;\n let den = -_this.gestureClasses.length;\n Object.keys(GestureSet).forEach((GestureClass) => {\n let numExamples = GestureSet[GestureClass].length;\n num += (GestureSet[GestureClass].covMatrice)[i][j] / (numExamples - 1);\n den += numExamples;\n });\n matrix[i][j] = num / den;\n }\n }\n _this.covMatrix = matrix;\n}", "function setClassCovarianceMatrix(gestures) {\n let matrix = [];\n let classMeanVector = gestures.MeanFeatureVector;\n for (let i = 0; i < RubineFeatures.length; i++) {\n matrix[i] = [];\n for (let j = 0; j < RubineFeatures.length; j++) {\n let sum = 0.0;\n for (let k = 0; k < gestures.length; k++) {\n const gestureFeatureVector = gestures[k].featureVector;\n sum += (gestureFeatureVector[i] - classMeanVector[i]) * (gestureFeatureVector[j] - classMeanVector[j]);\n }\n matrix[i][j] = sum;\n }\n }\n gestures.covMatrice = matrix;\n}", "function getCovarianceMatrix(gestureClass) {\n\tlet E = gestureClass.length;\n\tlet avgFeatures = getAvgFeatureVectorForClass(gestureClass);\n\tlet covMatrix = [...Array(NUM_FEATURES)].map(e => Array(NUM_FEATURES));\n\tfeaturesForGestureClass = new Array(E);\n\n\tfor (let i = 0; i < E; i++) {\n\t\tfeaturesForGestureClass[i] = getFeaturesForGesture(gestureClass[i]);\n\t}\n\n\tlet sum = 0;\n\tfor (let i = 0; i < NUM_FEATURES; i++) {\n\t\tfor (let j = 0; j < NUM_FEATURES; j++) {\n\t\t\tfor (let k = 0; k < E; k++) {\n\t\t\t\tlet features = featuresForGestureClass[k];\n\t\t\t\tsum += (features[i] - avgFeatures[i]) * (features[j] - avgFeatures[j]);\n\t\t\t}\n\t\t\tcovMatrix[i][j] = sum;\n\t\t\tsum = 0;\n\t\t}\n\t}\n\treturn covMatrix;\n}", "updateOutputCovariance() {\n if (this.covarianceMode === 'diagonal') {\n this.outputCovariance = this.covariance.slice(0, this.inputDimension);\n return;\n }\n\n // CASE: FULL COVARIANCE\n const covMatrixInput = Matrix(this.inputDimension, this.inputDimension);\n for (let d1 = 0; d1 < this.inputDimension; d1 += 1) {\n for (let d2 = 0; d2 < this.inputDimension; d2 += 1) {\n covMatrixInput.data[(d1 * this.inputDimension) + d2] = this.covariance[\n (d1 * this.dimension) + d2];\n }\n }\n const inv = covMatrixInput.pinv();\n const covarianceGS = Matrix(this.inputDimension, this.outputDimension);\n for (let d1 = 0; d1 < this.inputDimension; d1 += 1) {\n for (let d2 = 0; d2 < this.outputDimension; d2 += 1) {\n covarianceGS.data[(d1 * this.outputDimension) + d2] = this.covariance[\n (d1 * this.dimension) + this.inputDimension + d2];\n }\n }\n const covarianceSG = Matrix(this.outputDimension, this.inputDimension);\n for (let d1 = 0; d1 < this.outputDimension; d1 += 1) {\n for (let d2 = 0; d2 < this.inputDimension; d2 += 1) {\n covarianceSG.data[(d1 * this.inputDimension) + d2] = this.covariance[\n ((this.inputDimension + d1) * this.dimension) + d2];\n }\n }\n const tmptmptmp = inv.matrix.product(covarianceGS);\n const covarianceMod = covarianceSG.product(tmptmptmp);\n this.outputCovariance = Array(this.outputDimension ** 2).fill(0);\n for (let d1 = 0; d1 < this.outputDimension; d1 += 1) {\n for (let d2 = 0; d2 < this.outputDimension; d2 += 1) {\n this.outputCovariance[(d1 * this.outputDimension) + d2] = this.covariance[\n ((this.inputDimension + d1) * this.dimension) + this.inputDimension + d2]\n - covarianceMod.data[(d1 * this.outputDimension) + d2];\n }\n }\n }", "function CompactSupportCovarianceMatrix(N) {\n return jStat.create(N, N, function(i, j) {\n var dt = Math.abs(i - j) / N;\n return (Math.pow(1 - dt, 6) *\n ((12.8 * dt * dt * dt) + (13.8 * dt * dt) + (6 * dt) + 1));\n });\n }", "function CompactSupportCovarianceMatrix(N) {\n return jStat.create(N, N, function(i, j) {\n var dt = Math.abs(i - j) / N;\n return (Math.pow(1 - dt, 6)\n * ((12.8 * dt * dt * dt) + (13.8 * dt * dt) + (6 * dt) + 1));\n });\n}", "function computeCovariance (dataset, dimension) {\n let result = new Array(dimension).fill().map(() => new Array(dimension).fill(0));\n console.log(\"created array of zeros for covariance matrix\");\n for (let i = 0; i<dimension; i++){\n let resultRowi = result[i];\n for (let k = 0; k<dataset.length; k++){\n let datasetRowk = dataset[k];\n for (let j = 0; j<dimension; j++){\n resultRowi[j] += datasetRowk[i]*datasetRowk[j];\n }\n }\n }\n result = numbers.matrix.scalar(result, 1/(dataset.length-1));\n return result;\n}", "function covariance(arr1, arr2){\n\tlet sum = 0\n\tfor (let i = 0; i < arr1.length; ++i){\n\t\tsum += arr1[i] * arr2[i]\n\t}\n\tsum /= arr1.length\n\treturn sum - avg(arr1) * avg(arr2)\n}", "function covarianceMatrix(m) {\n const width = m[0].length;\n const height = m.length;\n\n const covM = [];\n\n for (let j = 0; j < width; j += 1) {\n const row = [];\n for (let i = 0; i < width; i += 1) {\n let c = 0;\n for (let k = 0; k < height; k += 1) {\n c += m[k][i] * m[k][j];\n }\n row.push(c / (height - 1));\n }\n covM.push(row);\n }\n\n return covM;\n}", "updateInverseCovariance() {\n if (this.covarianceMode === 'full') {\n const covMatrix = Matrix(this.dimension, this.dimension);\n\n covMatrix.data = this.covariance.slice();\n const inv = covMatrix.pinv();\n this.covarianceDeterminant = inv.determinant;\n this.inverseCovariance = inv.matrix.data;\n } else { // DIAGONAL COVARIANCE\n this.covarianceDeterminant = 1;\n for (let d = 0; d < this.dimension; d += 1) {\n if (this.covariance[d] <= 0) {\n throw new Error('Non-invertible matrix');\n }\n this.inverseCovariance[d] = 1 / this.covariance[d];\n this.covarianceDeterminant *= this.covariance[d];\n }\n }\n if (this.bimodal) {\n this.updateInverseCovarianceBimodal();\n }\n }", "function Correlations() {\n\n //vectors of orthogonal parameter data. There number of vectors matches the number of parameters. \n this._vectors = [];\n //original array of values (dictionary of orthogonal record data)\n this._array = {};\n //array of ids that is used as an intermediary to convert and index to an key (id as present in _array). This array effectively freezes the order of the keys in _array\n this._ids = [];\n //sumX for each vector, used to calculate the correlation \n this._sumX = [];\n //sumX2 (squared) for each vector, used to calculate the correlation \n this._sumX2 = [];\n //mask that represents which parameters will be eliminated (value = 1 aka not 0) and which stay (value = 0). \n this._eliminationMask = [];\n}", "function sample_covariance(x, y) {\n\n\t // The two datasets must have the same length which must be more than 1\n\t if (x.length <= 1 || x.length !== y.length) {\n\t return null;\n\t }\n\n\t // determine the mean of each dataset so that we can judge each\n\t // value of the dataset fairly as the difference from the mean. this\n\t // way, if one dataset is [1, 2, 3] and [2, 3, 4], their covariance\n\t // does not suffer because of the difference in absolute values\n\t var xmean = mean(x),\n\t ymean = mean(y),\n\t sum = 0;\n\n\t // for each pair of values, the covariance increases when their\n\t // difference from the mean is associated - if both are well above\n\t // or if both are well below\n\t // the mean, the covariance increases significantly.\n\t for (var i = 0; i < x.length; i++) {\n\t sum += (x[i] - xmean) * (y[i] - ymean);\n\t }\n\n\t // the covariance is weighted by the length of the datasets.\n\t return sum / (x.length - 1);\n\t }", "function sample_covariance(x, y) {\n\n\t // The two datasets must have the same length which must be more than 1\n\t if (x.length <= 1 || x.length != y.length){\n\t return null;\n\t }\n\n\t // determine the mean of each dataset so that we can judge each\n\t // value of the dataset fairly as the difference from the mean. this\n\t // way, if one dataset is [1, 2, 3] and [2, 3, 4], their covariance\n\t // does not suffer because of the difference in absolute values\n\t var xmean = mean(x),\n\t ymean = mean(y),\n\t sum = 0;\n\n\t // for each pair of values, the covariance increases when their\n\t // difference from the mean is associated - if both are well above\n\t // or if both are well below\n\t // the mean, the covariance increases significantly.\n\t for (var i = 0; i < x.length; i++){\n\t sum += (x[i] - xmean) * (y[i] - ymean);\n\t }\n\n\t // the covariance is weighted by the length of the datasets.\n\t return sum / (x.length - 1);\n\t }", "function covariance(arr1, arr2) {\n var u = mean(arr1);\n var v = mean(arr2);\n var arr1Len = arr1.length;\n var sq_dev = new Array(arr1Len);\n for (var i = 0; i < arr1Len; i++) {\n sq_dev[i] = (arr1[i] - u) * (arr2[i] - v);\n }\n if ((arr1Len - 1) === 0) {\n throw new Errors_1.DivZeroError(\"Evaluation of function CORREL caused a divide by zero error.\");\n }\n return sum(sq_dev) / (arr1Len - 1);\n}", "updateInverseCovarianceBimodal() {\n if (this.covarianceMode === 'full') {\n const covMatrixInput = Matrix(this.inputDimension, this.inputDimension);\n for (let d1 = 0; d1 < this.inputDimension; d1 += 1) {\n for (let d2 = 0; d2 < this.inputDimension; d2 += 1) {\n covMatrixInput.data[(d1 * this.inputDimension) + d2] = this.covariance[\n (d1 * this.dimension) + d2];\n }\n }\n const invInput = covMatrixInput.pinv();\n this.covarianceDeterminantInput = invInput.determinant;\n this.inverseCovarianceInput = invInput.matrix.data;\n } else { // DIAGONAL COVARIANCE\n this.covarianceDeterminantInput = 1;\n for (let d = 0; d < this.inputDimension; d += 1) {\n if (this.covariance[d] <= 0) {\n throw new Error('Non-invertible matrix');\n }\n this.inverseCovarianceInput[d] = 1 / this.covariance[d];\n this.covarianceDeterminantInput *= this.covariance[d];\n }\n }\n this.updateOutputCovariance();\n }", "function sample_covariance(x, y) {\n\n // The two datasets must have the same length which must be more than 1\n if (x.length <= 1 || x.length != y.length){\n return null;\n }\n\n // determine the mean of each dataset so that we can judge each\n // value of the dataset fairly as the difference from the mean. this\n // way, if one dataset is [1, 2, 3] and [2, 3, 4], their covariance\n // does not suffer because of the difference in absolute values\n var xmean = mean(x),\n ymean = mean(y),\n sum = 0;\n\n // for each pair of values, the covariance increases when their\n // difference from the mean is associated - if both are well above\n // or if both are well below\n // the mean, the covariance increases significantly.\n for (var i = 0; i < x.length; i++){\n sum += (x[i] - xmean) * (y[i] - ymean);\n }\n\n // the covariance is weighted by the length of the datasets.\n return sum / (x.length - 1);\n }", "function sample_covariance(x, y) {\n\n // The two datasets must have the same length which must be more than 1\n if (x.length <= 1 || x.length != y.length){\n return null;\n }\n\n // determine the mean of each dataset so that we can judge each\n // value of the dataset fairly as the difference from the mean. this\n // way, if one dataset is [1, 2, 3] and [2, 3, 4], their covariance\n // does not suffer because of the difference in absolute values\n var xmean = mean(x),\n ymean = mean(y),\n sum = 0;\n\n // for each pair of values, the covariance increases when their\n // difference from the mean is associated - if both are well above\n // or if both are well below\n // the mean, the covariance increases significantly.\n for (var i = 0; i < x.length; i++){\n sum += (x[i] - xmean) * (y[i] - ymean);\n }\n\n // the covariance is weighted by the length of the datasets.\n return sum / (x.length - 1);\n }", "function CovarianceMatrix(x, kFunc, noise_sigma) {\n noise_sigma = typeof noise_sigma !== 'undefined' ? noise_sigma : 0.0001;\n var noise = Independent(noise_sigma);\n return jStat.create(x.length, x.length, function(i, j) {\n return kFunc(x[i], x[j]) + noise(x[i], x[j]);\n });\n}", "getVariances()\n {\n if ( !strictFunctionTypes )\n return emptyArray;\n\n const typeParameters = this.typeParameters || emptyArray;\n\n let variances = this.variances;\n\n if ( !variances )\n {\n if ( this === globalArrayType || this === globalReadonlyArrayType )\n // Arrays are known to be covariant, no need to spend time computing this\n variances = [ Variance.Covariant ];\n else\n {\n // The emptyArray singleton is used to signal a recursive invocation.\n this.variances = emptyArray;\n variances = [];\n for ( const tp of typeParameters )\n {\n // We first compare instantiations where the type parameter is replaced with\n // marker types that have a known subtype relationship. From this we can infer\n // invariance, covariance, contravariance or bivariance.\n const typeWithSuper = this.getMarkerTypeReference( tp, markerSuperType );\n const typeWithSub = this.getMarkerTypeReference( tp, markerSubType );\n let variance = ( typeWithSub.isTypeAssignableTo( typeWithSuper ) ? Variance.Covariant : 0 ) |\n ( typeWithSuper.isTypeAssignableTo( typeWithSub ) ? Variance.Contravariant : 0 );\n // If the instantiations appear to be related bivariantly it may be because the\n // type parameter is independent (i.e. it isn't witnessed anywhere in the generic\n // type). To determine this we compare instantiations where the type parameter is\n // replaced with marker types that are known to be unrelated.\n if ( variance === Variance.Bivariant && this.getMarkerTypeReference( tp, markerOtherType ).isTypeAssignableTo( typeWithSuper ) )\n variance = Variance.Independent;\n\n variances.push( variance );\n }\n }\n this.variances = variances;\n }\n return variances;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show edit post button and input field
function showEditPost(postid){ if(document.getElementById("editPostDiv" + postid).style.display == "none"){ document.getElementById("editPostDiv" + postid).style.display = "block" document.getElementById("showEditPostBtn" + postid).innerHTML = "Cancel" } else { document.getElementById("editPostDiv" + postid).style.display = "none" document.getElementById("showEditPostBtn" + postid).innerHTML = "Edit Post" } }
[ "function editClicked() {\n editButton.style.display = 'none';\n saveButton.style.display = 'block';\n postHeading.style.border = '2px solid pink';\n postContent.style.border = '2px solid pink';\n postHeading.setAttribute('contenteditable', true);\n postContent.setAttribute('contenteditable', true);\n}", "function showEditPost(){\n var id = this.get('id').toInt();\n var content = $(id +'pComment').get('text'); // Current post text\n if ($(id+'editPostForm') == null) { // If there isn't already a form\n var editForm = new EditPostForm(id, content);\n $(id +'pComment').setStyle('display', 'none'); // Hide the comment\n editForm.display().inject($(id+'pComCont')); // Add the form\n }\n else { // If there is already a form\n $(id+'editPostForm').dispose(); // Remove the form\n $(id +'pComment').setStyle('display', 'block'); // Redisplay the comment\n } \n}", "edit() {\n this.set('newTitle', this.get('post.title'));\n this.set('isEditing', true);\n }", "function editUserPost() {\n\tvar editPostBtn = document.getElementById('editPostBtn');\n\teditPostBtn.style.display = 'none';\n\tvar savePostBtn = document.getElementById('savePostBtn');\n\tsavePostBtn.style.display = 'inline-flex';\n\n\tvar postTitle = document.getElementById('postTitle');\n\tpostTitle.setAttribute('contenteditable', true);\n\tpostTitle.style.border = '1px solid pink';\n\tvar postCotent = document.getElementById('postContent');\n\tpostCotent.setAttribute('contenteditable', true);\n\tpostCotent.style.border = '1px solid pink';\n}", "function openEditModal(post) {\n var $postModal = $('#post-modal');\n $postModal.find('.post-form').data('action', '/post/edit/' + post.id);\n $postModal.find('.modal-title').text('Edit Post');\n $postModal.find('.submit-btn').text('Save Changes');\n $postModal.find('.text').val(post.text);\n $postModal.find('.tags').val(post.tags.join(', '));\n $postModal.find('.file').val('');\n $postModal.find('.url').val('');\n\n var $preview = $postModal.find('.preview');\n $preview.empty();\n\n openPostModal(post.images);\n }", "function Wo_OpenPostEditBox(post_id) {\n var edit_box = $('#post-' + post_id).find('#edit-post');\n edit_box.modal({\n show: true\n });\n}", "function Wo_OpenPostEditBox(post_id) {\r\n var edit_box = $('#post-' + post_id).find('#edit-post');\r\n edit_box.modal({\r\n show: true\r\n });\r\n}", "function enableEdit(e) {\n e.preventDefault();\n if (e.target.parentElement.classList.contains('edit')) {\n const id = e.target.parentElement.dataset.id;\n const body = e.target.parentElement.previousElementSibling.textContent;\n const title =\n e.target.parentElement.previousElementSibling.previousElementSibling\n .textContent;\n\n const data = { id, title, body };\n\n // Fill form with current post\n ui.fillForm(data);\n\n // console.log(title, body);\n\n // if (confirm('Are you sure?')) {\n // http\n // .delete(`http://localhost:3000/posts/${id}`)\n // .then((data) => {\n // ui.showAlert('Post deleted', 'alert alert-success');\n\n // getPosts();\n // })\n // .catch((err) => console.log(err));\n // }\n }\n}", "function postEdit() {\n\tif (saveState == 0) {\n\t\tdocument.getElementById(\"editButton\").innerHTML = \"Save \" + \"<i class = 'fa fa-floppy-o' aria-hidden='true'></i>\";\n\t\tdocument.getElementById(\"blogTitle\").setAttribute(\"contenteditable\", true);\n\t\tdocument.getElementById(\"blogText\").setAttribute(\"contenteditable\", true);\n\t\tsaveState = 1;\n\t} else {\n\t\tdocument.getElementById(\"editButton\").innerHTML = \"Edit \" + \"<i class='fa fa-pencil-square-o' aria-hidden='true'></i>\";\n\t\tdocument.getElementById(\"blogTitle\").setAttribute(\"contenteditable\", false);\n\t\tdocument.getElementById(\"blogText\").setAttribute(\"contenteditable\", false);\n\t\tsaveState = 0;\n\t}\n}", "function Wo_OpenPostEditBox(post_id) {\n var edit_box = $('#post-' + post_id).find('#edit-post');\n edit_box.modal({\n show: true\n });\n}", "showEditView() {\n this.state = FIELD_STATE.EDIT;\n this.update();\n }", "function showEditButtons () {\n $element.parent().find('.edit-button').css('visibility', 'visible');\n }", "function editPost (evt) {\n var btn = this;\n var form = this.previousElementSibling;\n var li = this.parentElement;\n var editName = form.children[0].value;\n var changeName = editName;\n var editRoster = form.children[1].value;\n var obj = {};\n obj.name = editName;\n obj.roster = editRoster;\n obj.id = this.parentNode.getAttribute('id');\n li.innerHTML = editName + \": \" + editRoster + editButton + xButton;\n $.post('/posts/edit', obj, function(res) {\n console.log(obj, 'edited and saved')\n });\n\n if ($('#renderTable')){\n window.location.reload();\n }\n}", "async editPost(page,title,content){\n await page.click(or.post.editPost)\n await page.click(or.post.title,{clickCount: 3})\n await page.keyboard.press('Backspace');\n await page.type(or.post.title,title)\n await page.click(or.post.content,{clickCount: 3})\n await page.keyboard.press('Backspace');\n await page.type(or.post.content,content)\n await page.click('button[type=\"button\"]')\n }", "function showEdit(){\n\t$('#sbe-side-title, #sbe-side-content').hide();\n\t$('.sbe-side-label, #sbe-title-edit, #sbe-content-edit, #sbe-img-edit, #sbe-category-edit, #ip-open-btn, #sbe-active').show();\n}", "function toggleEdit(postDescId, editsave, titleId) {\n var postDesc = document.getElementById(postDescId);\n var buttonText = document.getElementById(editsave);\n var title = document.getElementById(titleId);\n if (postDesc.isContentEditable) {\n postDesc.contentEditable = 'false';\n title.contentEditable = 'false';\n buttonText.innerHTML = 'Edit <i class=\"fas fa-edit\"></i>';\n } else {\n postDesc.contentEditable = 'true';\n title.contentEditable = 'true';\n buttonText.innerHTML = 'Save';\n }\n}", "function showEditDiv() {\n\tshowActionDiv('edit');\n}", "function onPostEdit(e) {\n var $element = $(e.target);\n var $post = $element.parents('.discussion_post:first');\n var $topic = $element.parents('.discussion_topic:first');\n\n var courseId = COURSE_HELPERS.courseIdForElement($element);\n var topicId = $topic.data('topicId');\n var postId = $post.data('postId');\n var postContent = $post.find('.content').html();\n var postCommenter = $post.find('.user').html();\n\n $post.children().hide();\n var $form = findOrCreatePostForm($post, courseId, topicId, postId, postContent, postCommenter);\n e.preventDefault();\n }", "function edit_posting() {\r\n\tvar postid = req.data.postid\r\n\tvar data = {};\r\n\tdata.post = null;\r\n\tif (postid != null) {\r\n\t\tdata.post = app.getObjects(\"Post\",{_id:postid})[0];\r\n\t}\r\n\treturn this.manage_wrap( { content:this.manage_edit_posting_view(data) } );\r\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transitions the caption depending on alignment
function captionTransition(caption, duration) { if (caption.hasClass("center-align")) { caption.velocity({opacity: 0, translateY: -100}, {duration: duration, queue: false}); } else if (caption.hasClass("right-align")) { caption.velocity({opacity: 0, translateX: 100}, {duration: duration, queue: false}); } else if (caption.hasClass("left-align")) { caption.velocity({opacity: 0, translateX: -100}, {duration: duration, queue: false}); } }
[ "function captionTransition(caption, duration) {\n if (caption.hasClass(\"center-align\")) {\n caption.velocity({ opacity: 0, translateY: -100 }, { duration: duration, queue: false });\n } else if (caption.hasClass(\"right-align\")) {\n caption.velocity({ opacity: 0, translateX: 100 }, { duration: duration, queue: false });\n } else if (caption.hasClass(\"left-align\")) {\n caption.velocity({ opacity: 0, translateX: -100 }, { duration: duration, queue: false });\n }\n }", "function captionTransition(caption, duration) {\r\n if (caption.hasClass(\"center-align\")) {\r\n caption.velocity({ opacity: 0, translateY: -100 }, { duration: duration, queue: false });\r\n } else if (caption.hasClass(\"right-align\")) {\r\n caption.velocity({ opacity: 0, translateX: 100 }, { duration: duration, queue: false });\r\n } else if (caption.hasClass(\"left-align\")) {\r\n caption.velocity({ opacity: 0, translateX: -100 }, { duration: duration, queue: false });\r\n }\r\n }", "function captionTransition(caption, duration) {\n if (caption.hasClass(\"center-align\")) {\n caption.velocity({ opacity: 0, translateY: -100 }, { duration: duration, queue: false });\n } else if (caption.hasClass(\"right-align\")) {\n caption.velocity({ opacity: 0, translateX: 100 }, { duration: duration, queue: false });\n } else if (caption.hasClass(\"left-align\")) {\n caption.velocity({ opacity: 0, translateX: -100 }, { duration: duration, queue: false });\n }\n }", "function captionTransition(caption, duration) { // 3264\n if (caption.hasClass(\"center-align\")) { // 3265\n caption.velocity({opacity: 0, translateY: -100}, {duration: duration, queue: false}); // 3266\n } // 3267\n else if (caption.hasClass(\"right-align\")) { // 3268\n caption.velocity({opacity: 0, translateX: 100}, {duration: duration, queue: false}); // 3269\n } // 3270\n else if (caption.hasClass(\"left-align\")) { // 3271\n caption.velocity({opacity: 0, translateX: -100}, {duration: duration, queue: false}); // 3272\n } // 3273\n } // 3274", "function animateCaption() {\n if (options.hideBottom)\n return;\n\n if ((prevIndex >= 0) || (nextIndex >= 0) && (!options.noNavigation) && (!options.hideButtons)) {\n $(navLinks).css({display: ''});\n $([caption, number]).addClass(\"nav\");\n if (options.hideCaption) $([caption, number]).css({display: 'none'});\n if (prevIndex >= 0) $(prevLink).fadeIn(options.captionFadeDuration);\n if (nextIndex >= 0) $(nextLink).fadeIn(options.captionFadeDuration);\n }\n\n // fade in \n $(bottomContainer).css({opacity: \"\"}).fadeIn(options.captionFadeDuration);\n $(bottom).css({marginTop: -bottom.offsetHeight}).animate({marginTop: 0}, options.captionFadeDuration);\n $(center).animate({borderBottomLeftRadius: 0, borderBottomRightRadius: 0}, options.captionFadeDuration);\n }", "function animateCaption() {\n\t\tif (options.hideBottom)\n\t\t\treturn;\n\n\t\tif (((prevIndex >= 0) || (nextIndex >= 0)) && (!options.noNavigation) && (!options.hideButtons)) {\n\t\t\t$(navLinks).css({display: ''});\n\t\t\t$([caption, number]).addClass(\"nav\");\n\t\t\tif (prevIndex < 0) $(prevLink).addClass(\"disabled\");\n\t\t\tif (nextIndex < 0) $(nextLink).addClass(\"disabled\");\n\t\t}\n\t\t\n\t\tif (!options.hideCaption)\n\t\t\t$([caption, number]).show();\n\n\t\t// fade in\n\t\t$(bottom).fadeIn(options.captionFadeDuration);\n\t\t$(center).animate({height: centerSize[1]+bottom.offsetHeight}, options.captionFadeDuration, options.resizeEasing);\n\t}", "function addMoveCaption(nextcaption,opt,params,frame,downscale) {\n\t\t\t\t\t\t\tvar tl = nextcaption.data('timeline');\n\n\t\t\t\t\t\t\tvar newtl = new TimelineLite();\n\n\t\t\t\t\t\t\tvar animobject = nextcaption;\n\n\t\t\t\t\t\t\tif (params.typ == \"chars\") animobject = nextcaption.data('mySplitText').chars;\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif (params.typ == \"words\") animobject = nextcaption.data('mySplitText').words;\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif (params.typ == \"lines\") animobject = nextcaption.data('mySplitText').lines;\n\t\t\t\t\t\t\tparams.animation.ease = params.ease;\n\n\t\t\t\t\t\t\tif (params.animation.rotationZ !=undefined) params.animation.rotation = params.animation.rotationZ;\n\t\t\t\t\t\t\tparams.animation.data = new Object();\n\t\t\t\t\t\t\tparams.animation.data.oldx = params.animation.x;\n\t\t\t\t\t\t\tparams.animation.data.oldy = params.animation.y;\n\n\t\t\t\t\t\t\tparams.animation.x = params.animation.x * downscale;\n\t\t\t\t\t\t\tparams.animation.y = params.animation.y * downscale;\n\n\n\t\t\t\t\t\t\ttl.add(newtl.staggerTo(animobject,params.speed,params.animation,params.elementdelay),params.start);\n\t\t\t\t\t\t\ttl.addLabel(frame,params.start);\n\n\t\t\t\t\t\t\tnextcaption.data('timeline',tl);\n\n\t\t\t\t}", "function showCaptionBox() {\n $(\"div.caption\").stop().animate({ bottom: 0 }, showCaptionSpeed, showCaptionEasing);\n } // End show caption", "function changeCaption ( obj, slide_idx ) {\n \tvar widgetdata = obj.data('widgetsettings');\n \tvar myindexstart = widgetdata.idx_start;\t// get stored starting index for widget\n\tvar cap_idx = slide_idx - myindexstart;\n// \talert(\"cap_idx: \" + cap_idx);\n\tvar mycaption = widgetdata.captions[cap_idx];\t// get stored caption for index, correcting for index offset\n// \talert(\"mycaption: \" + mycaption);\n\tvar widgetcaption = obj.find('.caption');\n\twidgetcaption.html(mycaption);\n//\tobj.find('.ccimages').animate( { 'left': newposition } );\n}", "function updatePopOnCaptionText() {\n\n var numNewDisplayCaption = 1;\n //if there are more than one caption at the same time, iterate to the last caption\n while (true) {\n var cursor = captions[cursorID];\n\n //hide the caption if data is empty\n if (!cursor.data) {\n updateCaptionOverlay(numNewDisplayCaption - 1, true);\n } else {\n updateCaptionOverlay(numNewDisplayCaption - 1, false);\n }\n // apply position and alignment style to caption\n applyCaptionStyle(captionOverlays[numNewDisplayCaption - 1], cursor);\n\n var captionText = convertRubyTags(cursor.data);\n captionText = applyGroupTagStyle(captionText);\n captionOverlays[numNewDisplayCaption - 1].find('.vjs-caption-overlay-text span').html(captionText);\n\n // check if more than one caption in the same time period (same start and end time)\n if ((cursorID < captions.length - 1) && (\n cursor.startTime != captions[cursorID + 1].startTime || cursor.endTime != captions[cursorID + 1].endTime)) {\n break;\n }\n numNewDisplayCaption++;\n cursorID++;\n\n // if there isn't enough caption overlays, create more\n if(numNewDisplayCaption > captionOverlays.length){\n addCaptionOverlay();\n }\n\n // if we past the caption\n if (cursorID > captions.length - 1) {\n noCaption = true;\n break;\n }\n }\n // hide the captions that aren't displaying\n while (numDisplayCaption > numNewDisplayCaption) {\n updateCaptionOverlay(numDisplayCaption - 1, true);\n numDisplayCaption--;\n }\n numDisplayCaption = numNewDisplayCaption;\n\n // callback only once for each caption\n setting.onCaptionChange(cursorID);\n\n // at this point, cursor should point to the last caption for the same time interval\n }", "function realignCaptions($container) {\n $container.each(function() {\n \t var $h5 = $(this).find('a h5');\n \t $h5.css( 'margin-top', $(this).height() / 2 - $h5.get()[0].clientHeight / 2 );\n });\n}", "function showCaption(){\n\n\tvar childInFocus = $('div#carousel').data('roundabout').childInFocus;\n\tvar setCaption = $('.carousel_data .carousel_item .caption:eq('+childInFocus+')').html();\n $('#captions').html(setCaption);\n var newHeight = $('#captions').height()+'px';\n $('.caption_container').animate({'height':newHeight},500, function(){\n $('#captions').animate({'opacity':1},250);\n\n });\n\n}", "function setSliderTextTransitions(slider, direction, offset = 40, $heading, $subheading, $description, $link) {\n\n\tvar\n\t\ttl = new TimelineMax(),\n\t\ttextAlign = $heading.css('text-align'),\n\t\toffsetXNextIn = 0,\n\t\toffsetXNextOut = 0,\n\t\toffsetYNextIn = 0,\n\t\toffsetYNextOut = 0,\n\t\toffsetXPrevIn = 0,\n\t\toffsetXPrevOut = 0,\n\t\toffsetYPrevIn = 0,\n\t\toffsetYPrevOut = 0,\n\n\t\tfromNextIn = 'start',\n\t\tfromNextOut = 'start',\n\t\tfromPrevIn = 'end',\n\t\tfromPrevOut = 'end';\n\n\n\tswitch (textAlign) {\n\t\tcase 'left':\n\t\t\t// text align left & slider horizontal\n\t\t\tif (direction == 'horizontal') {\n\n\t\t\t\toffsetXNextIn = offset;\n\t\t\t\toffsetXNextOut = offset * (-1);\n\t\t\t\toffsetXPrevIn = offset * (-1);\n\t\t\t\toffsetXPrevOut = offset;\n\n\t\t\t\tfromNextOut = 'start';\n\t\t\t\tfromNextIn = 'start';\n\t\t\t\tfromPrevOut = 'end';\n\t\t\t\tfromPrevIn = 'end';\n\n\t\t\t}\n\t\t\t// text align left & slider vertical\n\t\t\tif (direction == 'vertical') {\n\n\t\t\t\toffsetYNextIn = offset;\n\t\t\t\toffsetYNextOut = offset * (-1);\n\t\t\t\toffsetYPrevIn = offset * (-1);\n\t\t\t\toffsetYPrevOut = offset;\n\n\t\t\t\tfromNextOut = 'start';\n\t\t\t\tfromNextIn = 'end';\n\t\t\t\tfromPrevOut = 'end';\n\t\t\t\tfromPrevIn = 'start';\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'center':\n\t\t\t// text align center & slider horizontal\n\t\t\tif (direction == 'horizontal') {\n\n\t\t\t\toffsetXNextIn = offset;\n\t\t\t\toffsetXNextOut = offset * (-1);\n\t\t\t\toffsetXPrevIn = offset * (-1);\n\t\t\t\toffsetXPrevOut = offset;\n\n\t\t\t\tfromNextOut = 'start';\n\t\t\t\tfromNextIn = 'start';\n\t\t\t\tfromPrevOut = 'end';\n\t\t\t\tfromPrevIn = 'end';\n\n\t\t\t}\n\t\t\t// text align left & slider vertical\n\t\t\tif (direction == 'vertical') {\n\n\t\t\t\toffsetYNextIn = offset / 2;\n\t\t\t\toffsetYNextOut = offset * (-1) / 2;\n\t\t\t\toffsetYPrevIn = offset * (-1) / 2;\n\t\t\t\toffsetYPrevOut = offset / 2;\n\n\t\t\t\tfromNextOut = 'center';\n\t\t\t\tfromNextIn = 'center';\n\t\t\t\tfromPrevOut = 'center';\n\t\t\t\tfromPrevIn = 'center';\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'right':\n\t\t\t// text align right & slider horizontal\n\t\t\tif (direction == 'horizontal') {\n\n\t\t\t\toffsetXNextIn = offset * (-1);\n\t\t\t\toffsetXNextOut = offset;\n\t\t\t\toffsetXPrevIn = offset;\n\t\t\t\toffsetXPrevOut = offset * (-1);\n\n\t\t\t\tfromNextOut = 'end';\n\t\t\t\tfromNextIn = 'end';\n\t\t\t\tfromPrevOut = 'start';\n\t\t\t\tfromPrevIn = 'start';\n\n\t\t\t}\n\t\t\t// text align right & slider vertical\n\t\t\tif (direction == 'vertical') {\n\n\t\t\t\toffsetYNextIn = offset * (-1);\n\t\t\t\toffsetYNextOut = offset;\n\t\t\t\toffsetYPrevIn = offset;\n\t\t\t\toffsetYPrevOut = offset * (-1);\n\n\t\t\t\tfromNextOut = 'end';\n\t\t\t\tfromNextIn = 'start';\n\t\t\t\tfromPrevOut = 'start';\n\t\t\t\tfromPrevIn = 'end';\n\t\t\t}\n\t\t\tbreak;\n\t}\n\n\tslider\n\t\t.on('slideNextTransitionStart', function () {\n\n\t\t\tvar\n\t\t\t\t$activeSlide = $(slider.slides[slider.activeIndex]),\n\t\t\t\t$activeHeading = $activeSlide.find($heading),\n\t\t\t\t$activeSubheading = $activeSlide.find($subheading),\n\t\t\t\t$activeDescription = $activeSlide.find($description),\n\t\t\t\t$activeLink = $activeSlide.find($link);\n\n\t\t\ttl.clear();\n\n\t\t\t$heading.each(function () {\n\n\t\t\t\ttl\n\t\t\t\t\t.add(hideChars($(this), 0.6, 0.3, Power3.easeInOut, offsetXNextOut, offsetYNextOut, fromNextOut), '0')\n\t\t\t\t\t.add(hideChars($subheading, 0.6, 0.3, Power3.easeInOut, offsetXNextOut, offsetYNextOut, fromNextOut), '0')\n\t\t\t\t\t.add(hideLines($description, 0.6, 0.05, offsetYNextOut, Power3.easeOut, true), '0')\n\t\t\t\t\t.add(hideButton(), '-=0.6')\n\t\t\t\t\t.add(hideChars($(this), 0, 0, Power3.easeInOut, offsetXNextIn, offsetYNextIn))\n\t\t\t\t\t.add(hideChars($subheading, 0, 0, Power3.easeInOut, offsetXNextIn, offsetYNextIn))\n\t\t\t\t\t.add(hideLines($activeDescription, 0, 0, offsetYNextIn))\n\t\t\t\t\t.add(setButton());\n\n\t\t\t});\n\n\t\t\ttl\n\t\t\t\t.add(animateChars($activeHeading, 1.2, 0.3, Power3.easeOut, fromNextIn))\n\t\t\t\t.add(animateLines($activeDescription, 1.2, 0.1, Power3.easeOut, fromNextIn), '-=1.2')\n\t\t\t\t.add(animateChars($activeSubheading, 1.2, 0.3, Power3.easeOut, fromNextIn), '-=1.2')\n\t\t\t\t.add(showButton($activeLink), '-=0.9');\n\n\t\t})\n\t\t.on('slidePrevTransitionStart', function () {\n\n\t\t\tvar\n\t\t\t\t$activeSlide = $(slider.slides[slider.activeIndex]),\n\t\t\t\t$activeHeading = $activeSlide.find($heading),\n\t\t\t\t$activeSubheading = $activeSlide.find($subheading),\n\t\t\t\t$activeDescription = $activeSlide.find($description),\n\t\t\t\t$activeLink = $activeSlide.find($link);\n\n\t\t\ttl.clear();\n\n\t\t\t$heading.each(function () {\n\n\t\t\t\ttl\n\t\t\t\t\t.add(hideChars($(this), 0.6, 0.3, Power3.easeInOut, offsetXPrevOut, offsetYPrevOut, fromPrevOut), '0')\n\t\t\t\t\t.add(hideChars($subheading, 0.6, 0.3, Power3.easeInOut, offsetXPrevOut, offsetYPrevOut, fromPrevOut), '0')\n\t\t\t\t\t.add(hideLines($description, 0.6, 0.05, offsetYPrevOut, Power3.easeOut), '0')\n\t\t\t\t\t.add(hideButton(), '-=0.6')\n\t\t\t\t\t.add(hideChars($(this), 0, 0, Power3.easeInOut, offsetXPrevIn, offsetYPrevIn))\n\t\t\t\t\t.add(hideChars($subheading, 0, 0, Power3.easeInOut, offsetXPrevIn, offsetYPrevIn))\n\t\t\t\t\t.add(hideLines($activeDescription, 0, 0, offsetYPrevIn))\n\t\t\t\t\t.add(setButton($link));\n\n\t\t\t});\n\n\t\t\ttl\n\t\t\t\t.add(animateChars($activeHeading, 1.2, 0.3, Power3.easeOut, fromPrevIn))\n\t\t\t\t.add(animateLines($activeDescription, 1.2, 0.1, Power3.easeOut, fromNextIn), '-=1.2')\n\t\t\t\t.add(animateChars($activeSubheading, 1.2, 0.3, Power3.easeOut, fromPrevIn), '-=1.2')\n\t\t\t\t.add(showButton($activeLink), '-=0.9');\n\n\t\t});\n\n\tfunction hideButton() {\n\n\t\tvar tl = new TimelineMax();\n\n\t\tif (typeof $link != 'undefined' && $link.length) {\n\t\t\ttl.to($link, 0.6, {\n\t\t\t\ty: (offsetYNextOut || offsetXNextOut) * (-1) / 2 + 'px',\n\t\t\t\tautoAlpha: 0,\n\t\t\t\t// ease: Power3.easeOut\n\t\t\t});\n\t\t}\n\n\t\treturn tl;\n\n\t}\n\n\tfunction showButton($activeLink) {\n\n\t\tvar tl = new TimelineMax();\n\n\t\tif (typeof $activeLink != 'undefined' && $activeLink.length) {\n\t\t\ttl.to($activeLink, 0.6, {\n\t\t\t\ty: '0px',\n\t\t\t\tautoAlpha: 1,\n\t\t\t\t// ease: Power3.easeOut\n\t\t\t});\n\t\t}\n\n\t\treturn tl;\n\n\t}\n\n\tfunction setButton() {\n\n\t\tvar tl = new TimelineMax();\n\n\t\tif (typeof $link != 'undefined' && $link.length) {\n\t\t\ttl.set($link, {\n\t\t\t\ty: (offsetYNextIn || offsetXNextIn) / 2 + 'px',\n\t\t\t\tautoAlpha: 0\n\t\t\t});\n\t\t}\n\n\t\treturn tl;\n\n\t}\n\n}", "styleCaptionElement(element, mutation, captionOrder) {\n const realCaption = mutation.target.querySelector('span');\n const captionStyle = realCaption.style.cssText;\n element.style = captionStyle;\n element.style.width = `calc(${realCaption.parentNode.scrollWidth}px + 300px)`;\n element.style.display = 'block';\n element.style.textAlign = 'center';\n element.style.order = captionOrder;\n return element;\n }", "function positionCaption() {\n\t\tif ($(window).width() >= 960) {\n\t\t\tvar captionTop = $('.intro-content').height() + 30;\n\t\t\t$('.intro-content .slider-caption').css('top', captionTop + 'px');\n\t\t} else {\n\t\t\t$('.intro-content .slider-caption').css('top', '');\n\t\t}\n\t}", "onCenterFontButtonClick() {\n let previousFontWeight = this.get('value.options.captionFontAlign');\n this.set('value.options.captionFontAlign', previousFontWeight !== 'center' ? 'center' : 'auto');\n }", "function peekCaptionBox() {\n clearInterval(autoSlide);\n $(\"div.caption\").stop().animate({ bottom: -85 }, peekCaptionSpeed);\n showTitle();\n } // End peek caption", "function hideCaptionBox() {\n autoSlide = setInterval(slideRight, changeInterval);\n $(\"div.caption\").stop().animate({ bottom: -130 }, hideCaptionSpeed, hideCaptionEasing);\n hideTitle();\n }", "function realignPostImages() {\nif ( $('.wp-caption').hasClass('alignright')) {\n$('.wp-caption').removeClass('alignright');\n$('.wp-caption').addClass('aligncenter');\n}\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compare another graph to this one.
equals(other) { if (this === other) return true; // handle string case here if (typeof other == 'string') { let s = other; other = new this.constructor(); if (!other.fromString(s)) return s == this.toString(); if (other.n > this.n) return false; if (other.n < this.n) other.expand(this.n,other.edgeRange); } else if (!super.equals(other)) return false; // now compare the edges using sorted edge lists if (other.m != this.m) return false; let el1 = this.sortedElist(); let el2 = other.sortedElist(); for (let i = 0; i < el1.length; i++) { let e1 = el1[i]; let e2 = el2[i]; let m1 = Math.min(this.left(e1), this.right(e1)); let M1 = Math.max(this.left(e1), this.right(e1)); let m2 = Math.min(other.left(e2), other.right(e2)); let M2 = Math.max(other.left(e2), other.right(e2)); if (m1 != m2 || M1 != M2 || this.weight(e1) != other.weight(e2)) return false; } return other; }
[ "equals(other) {\n\t\tif (this === other) return true;\n\t\t// handle string case here\n if (typeof other == 'string') {\n let s = other; other = new this.constructor();\n\t\t\tif (!other.fromString(s)) return s == this.toString();\n\t\t\tif (other.n > this.n) return false;\n\t\t\tif (other.n < this.n)\n\t\t\t\tother.expand(this.n,other.edgeRange);\n } else if (other.constructor.name != this.constructor.name ||\n\t\t other.n != this.n) {\n\t\t\treturn false;\n\t\t}\n\t\t// now compare the edges using sorted edge lists\n\t\t// note: cannot use super.equals since directed graphs require\n\t\t// different sorting order\n\t\tif (this.m != other.m) return false;\n\t\tlet el1 = this.sortedElist(); let el2 = other.sortedElist();\n\t\tfor (let i = 0; i < el1.length; i++) {\n\t\t\tlet e1 = el1[i]; let e2 = el2[i];\n\t\t\tlet t1 = this.tail(e1); let t2 = other.tail(e2);\n\t\t\tlet h1 = this.head(e1); let h2 = other.head(e2);\n\t\t\tif (t1 != t2 || h1 != h2 || this.length(e1) != other.length(e2))\n\t\t\t\treturn false;\n\t\t}\n\t\treturn other;\n\t}", "makeDiff(graph1, graph2) {\n\n }", "function computeGraphIntersection(graph1, graph2){\r\n var graph_i = new Springy.Graph;\r\n for (i=0; i<graph1.nodes.length; i++){\r\n if(findNodeId(graph1.nodes[i].data.label, graph2) !== -1){\r\n graph_i.addNodes(graph1.nodes[i].data.label);\r\n };\r\n };\r\n return graph_i;\r\n}", "function nodesEqualOnto(node1,node2){\n node1.each(function(d){\n node2.each(function(d1){\n return d.index==d1.index;\n });\n });\n}", "shares_vertex(other){\n return this.source == other.source \n || this.source == other.target\n || this.target == other.source\n || this.target == other.target;\n }", "equals (other) {\n return other && this.frequency === other.frequency\n }", "function computeGraphUnion(graph1, graph2){\r\n var graph_u = new Springy.Graph;\r\n // add the nodes from each graph, with no duplicates.\r\n // the cardinality of nodes in the union is equal to the sum of the cardinalities of input nodes.\r\n for (i=0; i<graph1.nodes.length; i++){\r\n graph_u.addNodes(graph1.nodes[i].data.label);\r\n graph_u.nodes[i].cardinality = graph1.nodes[i].cardinality;\r\n };\r\n for (i=0; i<graph2.nodes.length; i++){\r\n var node_id_in_graph1 = findNodeId(graph2.nodes[i].data.label, graph1)\r\n if (node_id_in_graph1==-1){ // if true, then this node is in graph2, but not in graph1.\r\n graph_u.addNodes(graph2.nodes[i].data.label);\r\n var node_id_in_graph_u = findNodeId(graph2.nodes[i].data.label, graph_u);\r\n graph_u.nodes[node_id_in_graph_u].cardinality = graph2.nodes[i].cardinality;\r\n } else { // this node is in both graphs\r\n graph_u.nodes[node_id_in_graph1].cardinality = \r\n graph1.nodes[node_id_in_graph1].cardinality + graph2.nodes[i].cardinality;\r\n };\r\n };\r\n\r\n // add the edges from each graph, taking care not to duplicate edges\r\n for (i=0; i<graph_u.nodes.length; i++){\r\n var node_label_i = graph_u.nodes[i].data.label;\r\n var node_id1_i = findNodeId(node_label_i, graph1);\r\n var node_id2_i = findNodeId(node_label_i, graph2);\r\n\r\n for (j=0; j<graph_u.nodes.length; j++){\r\n var node_label_j = graph_u.nodes[j].data.label;\r\n var node_id1_j = findNodeId(node_label_j, graph1);\r\n var node_id2_j = findNodeId(node_label_j, graph2);\r\n\r\n if(node_id1_i >= 0 && node_id1_j >= 0){\r\n var adjacency1 = graph1.getEdges(graph1.nodes[node_id1_i], graph1.nodes[node_id1_j]);\r\n } else { var adjacency1 = []; };\r\n if(node_id2_i >= 0 && node_id2_j >= 0){\r\n var adjacency2 = graph2.getEdges(graph2.nodes[node_id2_i], graph2.nodes[node_id2_j]);\r\n } else { var adjacency2 = []; };\r\n\r\n if (adjacency1.length > 0){\r\n graph_u.newEdge(\r\n adjacency1[0].source,\r\n adjacency1[0].target,\r\n adjacency1[0].data)\r\n } else if (adjacency2.length > 0){ \r\n graph_u.newEdge(\r\n adjacency2[0].source,\r\n adjacency2[0].target,\r\n adjacency2[0].data)\r\n };\r\n };\r\n };\r\n //console.log(graph_u);\r\n return graph_u;\r\n}", "function compareNodes(n1, n2) {\r\n\t// If both nodes are input nodes (numbers)\r\n\tif (isNaN(Number(n1)) == false && isNaN(Number(n2)) == false) {\r\n\t\t// If both values are equal, return true\r\n\t\tif (n1 == n2) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\t// If both nodes are not input nodes (node objects)\r\n\tif (isNaN(Number(n1)) == true && isNaN(Number(n2)) == true) {\r\n\t\t// Nodes are equal if the bias, weights, activation function, and previous nodes are equal.\r\n\t\t\r\n\t\t// First, compare the biases\r\n\t\tif (n1.bias != n2.bias) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// Now, compare the activation function\r\n\t\tif (n1.actiation != n2.actiation) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// Next, compare the weights\r\n\t\t// If the weight lengths are not equal, return false\r\n\t\tif (n1.prevNodesWeights.length != n2.prevNodesWeights.length) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// Iterate over each weight. If the weights are not the same, return false\r\n\t\tfor (let i = 0; i < n1.prevNodesWeights.length; i++) {\r\n\t\t\t// If the ith weights are not the same, return false\r\n\t\t\tif (n1.prevNodesWeights[i] != n2.prevNodesWeights[i]) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// Finally, compare the previous nodes\r\n\t\t// If the previous node array lengths are not equal, return false\r\n\t\tif (n1.prevNodes.length != n2.prevNodes.length) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// Iterate over each previous node. If the values are not the same, then\r\n\t\t// return false.\r\n\t\tfor (let i = 0; i < n1.prevNodes.length; i++) {\r\n\t\t\t// If the nodes are not the same, return false\r\n\t\t\tif (compareNodes(n1.prevNodes[i], n2.prevNodes[i]) == false) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// If all tests pass, return true\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\t// If the node types are different, return false\r\n\treturn false;\r\n}", "function hasSimilarDegreeSequence(graph1, graph2) {\n var dg1 = degreeSequence(graph1);\n var dg2 = degreeSequence(graph2);\n for (var i = 0; i < dg1.length; i++) {\n if (dg1[i] !== dg2[i]) {\n return false;\n }\n }\n return true;\n }", "function cartesianNodes(graph1, graph2) {\n // object to hold new graph\n let nodes = new EdgeGraph();\n for (let id1 of graph1.nodes) {\n let node1 = graph1.get(id1);\n for (let id2 of graph2.nodes) {\n let node2 = graph2.get(id2);\n let newID = [id1, id2];\n let type = '';\n let text = '';\n let operator = [];\n // if both nodes are roots, the new node is also a root; if both are accepts, new node is an accept\n if (node1.type === constants.ROOT && node2.type === constants.ROOT) {\n type = constants.ROOT;\n } else if (node1.type === constants.ACCEPT && node2.type === constants.ACCEPT) {\n type = constants.ACCEPT;\n } else {\n type = constants.EPSILON;\n }\n\n // if both nodes' texts are 'root', the new node's text is also 'root'; if both are 'accept', new node is 'accept'\n if (node1.text === constants.ROOT && node2.text === constants.ROOT) {\n text = constants.ROOT;\n } else if (node1.text === constants.ACCEPT && node2.text === constants.ACCEPT) {\n text = constants.ACCEPT;\n } else {\n text = constants.EPSILON;\n }\n\n if (node1.type === constants.ACCEPT || node2.type === constants.ACCEPT) {\n operator = [];\n } else {\n operator = assignOperators(node1.operator, node2.operator);\n }\n\n // insert new node into new graph\n let newNode = {\n id: newID,\n text: text,\n type: type,\n edges: [],\n operator: operator\n };\n nodes.addNode(newNode);\n }\n }\n return nodes;\n}", "isSameNode(otherNode) {\n return this.unique === otherNode.unique;\n }", "areCousins(node1, node2) {\n if (node1.val === this.root.val || node2.val === this.root.val)\n return false;\n return (\n this.findParent(node1).val !== this.findParent(node2).val &&\n this.findRank(node1) === this.findRank(node2)\n );\n }", "function graphEquals (left, right, leftToRight) {\n if (left.size !== right.size)\n return false;\n\n leftToRight = leftToRight || {}; // Left→right mappings (optional argument).\n var rightToLeft = Object.keys(leftToRight).reduce(function (ret, from) { // Right→left mappings\n ret[leftToRight[from]] = from; // populated if m was passed in.\n return ret;\n }, {});\n\n return findIsomorphism([... left.match(null, null, null, null)], // Start with all triples.\n right, leftToRight, rightToLeft);\n}", "get _inDefaultGraph() {\n return DEFAULTGRAPH.equals(this._graph);\n }", "equals(other) {\n return this.minX === other.minX && this.minY === other.minY && this.maxX === other.maxX && this.maxY === other.maxY;\n }", "function updateGraphCompare(attr1, attr2, player1, player2) {\n config_compare.data.labels = [\"Accel\", \"Agility\", \"React\", \n \"Balance\",\" Stamina\", \"Strength\", \n \"Intercept\", \"Position\", \"Vision\"];\n config_compare.data.datasets[0].data = attr1;\n config_compare.data.datasets[1].data = attr2;\n config_compare.data.datasets[0].label= player1;\n config_compare.data.datasets[1].label= player2;\n window.myRadar.update();\n}", "function addGraphs(g1, g2) {\n\n\tvar newGraph = $.extend(true, {}, Graph); // new Graph<T>();\n\tvar nodesList = g1.getVertices();\n\tfor (v in nodesList) {\n\t\tvar neighborsList = g1.getNeighbors(nodesList[v]);\n\t\tfor (u in neighborsList) {\n\t\t\tnewGraph.addEdge(nodesList[v], neighborsList[u]);\n\t\t}\n\t}\n\t// if (g2 != null) {\n\tnodesList = g2.getVertices();\n\tfor (v in nodesList) {\n\t\tneighborsList = g2.getNeighbors(nodesList[v]);\n\t\tfor (u in neighborsList) {\n\t\t\tnewGraph.addEdge(nodesList[v], neighborsList[u]);\n\t\t}\n\t}\n\t// }\n\treturn newGraph;\n}", "compare (a, b) {\n\t\treturn this.sortFn(this.nodes[a], this.nodes[b])\n\t}", "function edges_are_equal(edge1, edge2) {\n\n this.x1 = edge1.firstSegment.point.x;\n this.y1 = edge1.firstSegment.point.y;\n\n this.x2 = edge1.lastSegment.point.x;\n this.y2 = edge1.lastSegment.point.y;\n\n this.a1 = edge2.firstSegment.point.x;\n this.b1 = edge2.firstSegment.point.y;\n\n this.a2 = edge2.lastSegment.point.x;\n this.b2 = edge2.lastSegment.point.y;\n\n\n\n if (\n (Math.abs(this.x1 - this.a1) < epsilon) &&\n (Math.abs(this.y1 - this.b1) < epsilon) &&\n (Math.abs(this.x2 - this.a2) < epsilon) &&\n (Math.abs(this.y2 - this.b2) < epsilon)\n ) {\n // console.log('edges_are_equal -- true');\n return 1;\n }\n if (\n (Math.abs(this.x1 - this.a2) < epsilon) &&\n (Math.abs(this.y1 - this.b2) < epsilon) &&\n (Math.abs(this.x2 - this.a1) < epsilon) &&\n (Math.abs(this.y2 - this.b1) < epsilon)\n ) {\n // console.log('edges_are_equal -- true');\n return 1;\n }\n\n // console.log('edges_are_equal -- false');\n return 0;\n\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses a setcookiestring based on the standard defined in RFC6265 S4.1.1.
function parseSetCookieString(str) { str = cleanCookieString(str); str = getFirstPair(str); var res = COOKIE_PAIR.exec(str); if (!res || !res[VALUE_INDEX]) return null; return { name : unescape(res[KEY_INDEX]), value : unescape(res[VALUE_INDEX]) }; }
[ "function parseSetCookieString(str) {\n str = cleanCookieString(str);\n str = getFirstPair(str);\n\n var res = COOKIE_PAIR.exec(str);\n\n return {\n name: decodeURIComponent(res[KEY_INDEX]),\n value: decodeURIComponent(res[VALUE_INDEX])\n };\n}", "function parseCookies(setCookieHeader) {\n if (!setCookieHeader) {\n return {};\n }\n if (!Array.isArray(setCookieHeader)) {\n setCookieHeader = [setCookieHeader];\n }\n\n var cookies = {};\n\n setCookieHeader.forEach(function (cookie) {\n var pairs = cookie.split(/[;] */);\n\n var name = pairs[0].substr(0, pairs[0].indexOf('=')).trim();\n\n var value = pairs[0].substr(pairs[0].indexOf('=') + 1, pairs[0].length).trim();\n\n var newcookie = {};\n\n newcookie.options = {};\n\n newcookie.name = name;\n\n try {\n newcookie.value = decodeURIComponent(value);\n }\n catch (e) {\n newcookie.value = value;\n }\n\n for (var i = 1; i < pairs.length; i++) {\n //Lower case the first letter.\n var pair = pairs[i].substr(0, 1).toLowerCase() + pairs[i].substr(1, pairs[i].length);\n\n var eq_idx = pair.indexOf('=');\n\n if (eq_idx > 0) {\n var key = pair.substr(0, eq_idx).trim();\n var val = pair.substr(++eq_idx, pair.length).trim();\n\n // quoted values\n if ('\"' === val[0]) {\n val = val.slice(1, -1);\n }\n\n //Convert dates\n if (key === 'expires') {\n newcookie.options[key] = new Date(val);\n }\n else {\n try {\n newcookie.options[key] = decodeURIComponent(val);\n }\n catch (e) {\n newcookie.options[key] = val;\n }\n }\n }\n else {\n newcookie.options[pair] = !!pair;\n }\n }\n\n cookies[newcookie.name] = { value: newcookie.value, options: newcookie.options };\n });\n\n return cookies;\n}", "function test_parse_cookie_string() {\n var TESTS = [\n { cs: \"\",\n expected: { } },\n { cs: \"a=b\",\n expected: { a: \"b\"} },\n { cs: \"a=b=c\",\n expected: { a: \"b=c\"} },\n { cs: \"a=b; c=d\",\n expected: { a: \"b\", c: \"d\" } },\n { cs: \"a=b ; c=d\",\n expected: { a: \"b\", c: \"d\" } },\n { cs: \"a= b\",\n expected: {a: \"b\" } },\n { cs: \"a=\",\n expected: { a: \"\" } },\n { cs: \"key\",\n expected: null },\n { cs: \"key=%26%20\",\n expected: { key: \"& \" } },\n { cs: \"a=\\\"\\\"\",\n expected: { a: \"\\\"\\\"\" } },\n ];\n\n announce(\"test_parse_cookie_string\");\n for (var i = 0; i < TESTS.length; i++) {\n var test = TESTS[i];\n var actual;\n\n actual = parse_cookie_string(test.cs);\n if (objects_equal(actual, test.expected))\n pass(test.cs);\n else\n fail(test.cs, test.expected, actual);\n }\n}", "parse(setCookieHeader) {\n const cookies = (0, set_cookie_parser_1.default)(setCookieHeader);\n return cookies.map((cookie) => {\n cookie.encrypted = false;\n cookie.signed = false;\n const value = cookie.value;\n /**\n * Unsign signed cookie\n */\n if (SignedCookie.canUnpack(value)) {\n cookie.value = SignedCookie.unpack(cookie.name, value, this.encryption);\n cookie.signed = true;\n return cookie;\n }\n /**\n * Decrypted encrypted cookie\n */\n if (EncryptedCookie.canUnpack(value)) {\n cookie.value = EncryptedCookie.unpack(cookie.name, value, this.encryption);\n cookie.encrypted = true;\n return cookie;\n }\n /**\n * Decode encoded cookie\n */\n if (PlainCookie.canUnpack(value)) {\n cookie.value = PlainCookie.unpack(value);\n }\n return cookie;\n });\n }", "function parseSetCookieHeader(header) {\n if (!header) return {};\n header = Array.isArray(header) ? header : [header];\n\n return header.reduce(function(res, str) {\n var cookie = parseSetCookieString(str);\n if (cookie) res[cookie.name] = cookie.value;\n return res;\n }, {});\n}", "function parseSetCookieHeader(header) {\n header = (header instanceof Array) ? header : [header];\n\n return header.reduce(function(res, str) {\n var cookie = parseSetCookieString(str);\n res[cookie.name] = cookie.value;\n return res;\n }, {});\n}", "function parseSetCookies(setCookieHeader, setCookies) {\n\n if (setCookieHeader == undefined)\n return;\n\n var cookieHeaders = setCookieHeader.split(\", \");\n\n // verify comma-delimited parse by ensuring '=' within each token\n var len = cookieHeaders.length;\n if (len > 0) {\n setCookies[0] = cookieHeaders[0];\n }\n var i, j;\n for (i = 1, j = 0; i < len; i++) {\n if (cookieHeaders[i]) {\n var eqdex = cookieHeaders[i].indexOf('=');\n if (eqdex != -1) {\n var semidex = cookieHeaders[i].indexOf(';');\n if (semidex == -1 || semidex > eqdex) {\n setCookies[++j] = cookieHeaders[i];\n }\n else {\n setCookies[j] += \", \" + cookieHeaders[i];\n }\n }\n else {\n setCookies[j] += \", \" + cookieHeaders[i];\n }\n }\n }\n}", "function parseCookies(rawCookie) {\n rawCookie && rawCookie.split(';').forEach(function( cookie ) {\n var parts = cookie.split('=');\n cookies[parts.shift().trim()] = decodeURI(parts.join('='));\n });\n}", "function parseAndStoreRawCookie(tabId, url, cookieRaw){\r\n if(DEBUG) {\r\n\t//console.log(\"Attempting to parse raw cookie string: \" + cookieRaw);\r\n }\r\n var cookieObj = {};\r\n cookieObj.url = url;\r\n \r\n var cKey = getKeyfromPId(getPseudoId(tabId, url).split(\"&\")[0]);\r\n \r\n var cookieParts = cookieRaw.split(';');\r\n\r\n if(DEBUG) {\r\n\t//console.log(cookieParts);\r\n }\r\n\r\n for( var i=0; i<cookieParts.length; i++){\r\n if(cookieParts[i].length == 0)\r\n continue;\r\n \r\n //remove the whitespace\r\n var cString = cookieParts[i].replace(/^\\s+|\\s+$/g,\"\");\r\n \r\n var splitIndex = cString.indexOf(\"=\");\r\n \r\n var namePart = cString.substring(0, splitIndex);\r\n var valuePart = cString.substring(splitIndex+1, cString.length);\r\n \r\n \r\n //first part is the name value pair\r\n if( i == 0 ){\r\n cookieObj.name = cKey + namePart;\r\n cookieObj.value = valuePart;\r\n }\r\n else if( namePart.toLowerCase() == \"path\" ){\r\n cookieObj.path = valuePart;\r\n }\r\n else if( namePart.toLowerCase() == \"domain\" ){\r\n cookieObj.domain = valuePart;\r\n }\r\n //else if( partSplit[0].toLowerCase() == \"max-age\" ){\r\n //not sure what to do here....\r\n //}\r\n else if( namePart.toLowerCase() == \"expires\" ){\r\n //convert the gmt string to seconds since the unix epoch\r\n var date = new Date(valuePart);\r\n cookieObj.expirationDate = date.getTime() / 1000;\r\n if(cookieObj.expirationDate == NaN){\r\n console.log(\"reserve here to catch bug\");\r\n //console.log(\"valuePart:\" + valuePart);\r\n }\r\n }\r\n else if( cString == \"secure\" ){\r\n //attention! secure property is not a key-value pair\r\n cookieObj.secure = true;\r\n }\r\n else{\r\n console.log(\"set Raw Unknown part!!!! cookie: \" + cString); \r\n }\r\n }\r\n if(DEBUG) {\r\n\t//console.log(cookieObj);\r\n }\r\n chrome.cookies.set(cookieObj);\r\n}", "function parseCookieString(cookieString) {\n\tcookiesSplit = cookieString.split(';');\n\tcookiesHash = {}; \n\tfor (var i in cookiesSplit) {\n\t\tcookiesSplit[i] = cookiesSplit[i].replace(/^\\s+|\\s+$/g, '');\n\t\tcookieParsed = queryString.parse(cookiesSplit[i]); \n\t\tname = Object.keys(cookieParsed)[0]; \n\t\tcookiesHash[name] = cookieParsed[name];\n\t}\n\treturn cookiesHash;\n}", "function parseCookies() {\n var cString = document.cookie;\n var list = {};\n\n cString && cString.split(';').forEach(function (cookie) {\n var parts = cookie.split('=');\n list[parts.shift().trim()] = decodeURI(parts.join('='));\n });\n\n return list;\n }", "setCookieFromString(cookieString) {\n document.cookie = cookieString;\n }", "function parseCookie() {\n return document.cookie.split(\";\").reduce(function(obj, cookie) {\n var index = cookie.indexOf(\"=\");\n var key = cookie.substring(0, index).trim();\n var value = cookie.substring(index + 1).trim();\n obj[key] = value;\n return obj;\n }, {});\n}", "function parseCookie() {\n let cookie = document.cookie.split(';');\n for (let i = 0; i < cookie.length; i++) {\n let parts = cookie[i].split('=');\n if (parts.length === 2 && parts[1].length !== 0) {\n return parts.join('=');\n }\n }\n return null;\n }", "function splitCookieString(cookie) {\r\n if(cookie.indexOf('###') != -1)\r\n console.error(\"PID might not be striped from cookie: \" + cookie);\r\n\r\n var index = cookie.indexOf('=');\r\n \r\n var name = cookie.substring(0, index);\r\n //Add the +1 to skip the '='\r\n var value = cookie.substring(index+1, cookie.length);\r\n \r\n return {'name':name, 'value':value};\r\n}", "function parseCookies(cookieStr) {\n var cookieArray = [];\n while (cookieStr) {\n const name = cookieStr.slice(0, cookieStr.indexOf(\"=\"));\n cookieArray.push(name);\n const nxtIdx = cookieStr.indexOf(\";\");\n if (nxtIdx == -1) {\n cookieStr = \"\";\n } else {\n cookieStr = cookieStr.slice(nxtIdx + 2);\n }\n }\n return cookieArray;\n}", "function parseCookieHeaders(strAllRequestHeaders) {\n console.log('all Request Headers: ' + strAllRequestHeaders);\n var strSetCookieHeader = strAllRequestHeaders.match(/Set-Cookie: ([\\s\\S]*?)Transfer-Encoding/) [1]; //Should be improved if order of headers change\n console.log('parsed 1 finished ' + strSetCookieHeader);\n var strUserSessionID = strSetCookieHeader.match(/USERSESSIONID=(.*)/) [1];\n console.log('parsed 2 finished ' + strUserSessionID);\n var strJSessionID = strSetCookieHeader.match(/JSESSIONID=(.*?);/) [1];\n console.log('parsed 3 finished ' + strJSessionID);\n \n if(strSetCookieHeader == null){\n \tconsole.error(\"No Cookie found in response\");\n }\n \n console.log('parseCookieHeaders finished ' + strSetCookieHeader);\n return {\n strSetCookieHeader: strSetCookieHeader,\n strUserSessionID: strUserSessionID,\n strJSessionID: strJSessionID\n };\n}", "function parseDate(str){if(!str){return;}/* RFC6265 S5.1.1:\n * 2. Process each date-token sequentially in the order the date-tokens\n * appear in the cookie-date\n */var tokens=str.split(DATE_DELIM);if(!tokens){return;}var hour=null;var minutes=null;var seconds=null;var day=null;var month=null;var year=null;for(var i=0;i<tokens.length;i++){var token=tokens[i].trim();if(!token.length){continue;}var result;/* 2.1. If the found-time flag is not set and the token matches the time\n * production, set the found-time flag and set the hour- value,\n * minute-value, and second-value to the numbers denoted by the digits in\n * the date-token, respectively. Skip the remaining sub-steps and continue\n * to the next date-token.\n */if(seconds===null){result=TIME.exec(token);if(result){hour=parseInt(result[1],10);minutes=parseInt(result[2],10);seconds=parseInt(result[3],10);/* RFC6265 S5.1.1.5:\n * [fail if]\n * * the hour-value is greater than 23,\n * * the minute-value is greater than 59, or\n * * the second-value is greater than 59.\n */if(hour>23||minutes>59||seconds>59){return;}continue;}}/* 2.2. If the found-day-of-month flag is not set and the date-token matches\n * the day-of-month production, set the found-day-of- month flag and set\n * the day-of-month-value to the number denoted by the date-token. Skip\n * the remaining sub-steps and continue to the next date-token.\n */if(day===null){result=DAY_OF_MONTH.exec(token);if(result){day=parseInt(result,10);/* RFC6265 S5.1.1.5:\n * [fail if] the day-of-month-value is less than 1 or greater than 31\n */if(day<1||day>31){return;}continue;}}/* 2.3. If the found-month flag is not set and the date-token matches the\n * month production, set the found-month flag and set the month-value to\n * the month denoted by the date-token. Skip the remaining sub-steps and\n * continue to the next date-token.\n */if(month===null){result=MONTH.exec(token);if(result){month=MONTH_TO_NUM[result[1].toLowerCase()];continue;}}/* 2.4. If the found-year flag is not set and the date-token matches the year\n * production, set the found-year flag and set the year-value to the number\n * denoted by the date-token. Skip the remaining sub-steps and continue to\n * the next date-token.\n */if(year===null){result=YEAR.exec(token);if(result){year=parseInt(result[0],10);/* From S5.1.1:\n * 3. If the year-value is greater than or equal to 70 and less\n * than or equal to 99, increment the year-value by 1900.\n * 4. If the year-value is greater than or equal to 0 and less\n * than or equal to 69, increment the year-value by 2000.\n */if(70<=year&&year<=99){year+=1900;}else if(0<=year&&year<=69){year+=2000;}if(year<1601){return;// 5. ... the year-value is less than 1601\n}}}}if(seconds===null||day===null||month===null||year===null){return;// 5. ... at least one of the found-day-of-month, found-month, found-\n// year, or found-time flags is not set,\n}return new Date(Date.UTC(year,month,day,hour,minutes,seconds));}", "function _parseCookieOptions (cookie, pairs) {\n\n if (pairs.length < 2) {\n return cookie;\n }\n\n for (var i = 1; i < pairs.length; i++) {\n var pair = pairs[i].substr(0, 1).toLowerCase() + pairs[i].substr(1, pairs[i].length);\n\n var eq_idx = pair.indexOf('=');\n\n if (eq_idx > 0) {\n var key = pair.substr(0, eq_idx).trim();\n var val = pair.substr(++eq_idx, pair.length).trim();\n\n // quoted values\n if ('\"' === val[0]) {\n val = val.slice(1, -1);\n }\n\n //Convert dates\n if (key === 'expires') {\n cookie[key] = new Date(val).toGMTString();\n }\n else if (key === 'max-Age' || key === 'maxAge') {\n cookie.maxAge = String(val);\n }\n else {\n try {\n cookie[key] = decodeURIComponent(val);\n }\n catch (e) {\n cookie[key] = val;\n }\n }\n }\n else {\n cookie[pair] = !!pair;\n }\n }\n\n return cookie;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bind header actions for queues and tickets
function queuesAndTicketHeader(configPass, tktType) { setCurrentRole(); fromDate(".fromDate"); changeRoles(configPass); ticketActions(configPass); add_ticket_button(configPass); get_single_ticket(configPass); addResponse(configPass); addTime(configPass); getGravatar("p.cir_gravatar", 40); // This should be in a helper if(tktType && tktType.type=="accounts"){ $('ul.filter li').removeClass('active'); $('li.time').hide(); //Set the home button $('a.home_button').off() .removeClass('home_icon').addClass('back_icon') .on('click', function(e){ e.preventDefault(); $('body').empty().addClass('spinner'); SherpaDesk.getAccounts(configPass); }); } else if (tktType && tktType.type=="queues") { $('ul.filter li').removeClass('active'); $('li.time').hide(); //Set the home button $('a.home_button').off() .removeClass('home_icon').addClass('back_icon') .on('click', function(e){ e.preventDefault(); $('body').empty().addClass('spinner'); SherpaDesk.getTicketsQueues(configPass); }); } else { //Set the home button $('a.home_button').off().on('click', function(e){ e.preventDefault(); $('body').empty().addClass('spinner'); SherpaDesk.init(); }); }; //Init list.js only if more than 0 if ( ($("ul.tickets li.ticket").size()) > 0){ filterList(); // if more than 0 tickets, enable filter }; // Hide time if ticket as_user if(localStorage.sd_user_role == "user" || localStorage.sd_user_role == "all"){ $('li.time').hide(); }; // Hide if just a user and not tech if( localStorage.sd_tech_admin === "false" ){ $('li.open_tickets, li[data-asrole="tech"], li[data-asrole="alt_tech"]').hide(); }; }
[ "editTopicInChatHeader() {\n AppDispatcher.dispatch('edit-topic');\n }", "function setHeaders(){\n\theaders = [\"ID\",\"Name\"];\n\tfor(var i=0;i<headers.length;i++){\n\t\toutlet(5,\"set \"+ i + \" 0\" + \"\\t\" + headers[i]);\n\t}\n}", "function headersmenu(obj, button, event)\n {\n $('li > a', obj).each(function() {\n var target = '#compose_' + $(this).data('target');\n\n $(this)[$(target).is(':visible') ? 'removeClass' : 'addClass']('active')\n .off().on('click', function() {\n $(target).removeClass('hidden').find('.recipient-input > input').focus();\n });\n });\n }", "addActions() {\n this.addAction('index', this.actionIndex);\n this.addAction('submit', this.actionSubmit);\n }", "function bindUIActions () {\n\n }", "[kHeaders](id, headers, kind, push_id) {\n const stream = this[kInternalState].streams.get(id);\n if (stream === undefined)\n return;\n\n stream[kHeaders](headers, kind, push_id);\n }", "function onStreamHeaders(id, headers, kind, push_id) {\n this[owner_symbol][kHeaders](id, headers, kind, push_id);\n}", "handleClickBtnHeader(event){\n\t\tthis.value = event.value;\n\t\tthis.isTemplate = false;\n\t\tthis.onInit();\n\t\tthis.showHideModal();\n\t}", "function queueSetup() {\n\t queue.subscribe(function(msg) {\n\t \tconsole.log(\"msg from q is==\"+msg.data);\n\t //send socket io here....................\n\t emitEvent(msg.data);\n\t });\n\t queue.bind(exchange.name, 'my_queue1');\n\t deadQueue.bind(exchange.name, 'my_queue2');\n\t \n }", "function initQrateSortByClickHandlers($thead_cell, primary_class, secondary_class) {\n\n $thead_cell.css(\"cursor\", \"pointer\"); // Add cursor pointer when hovering over table header cells\n\n // Append font awesome icons\n $thead_cell.append(qgcio.fn.generateFontAwesomeTag(primary_class)).on('click', function () {\n\n var $this = $(this);\n\n var $sort_icon = $this.find(\"i\"); // Get sort icon\n\n if ($this.hasClass(\"active\")) {\n $sort_icon.toggleClass(primary_class + \" \" + secondary_class); // switch class to change fontawesome icon\n } else {\n $suppliers_content_thead_cells.removeClass(\"active\"); // remove active class from previously selected table cell header\n $this.addClass(\"active\"); // add active class to newly selected table cell header\n }\n\n searchQrateSuppliers(); // Perform search\n });\n }", "function updateHeaders()\n{\n updateHeader('todoSection', 'toDoLabel', 'To Do');\n updateHeader('inProgressSection', 'inProgressLabel', 'Doing');\n updateHeader('completedSection', 'completedLabel', 'Done');\n //updateTopnav();\n}", "function addTableHeaderListeners() {\r\n const tableFields = document\r\n .querySelectorAll(\"th\")\r\n .forEach(x =>\r\n x.addEventListener(\"click\", e => view.emit(\"headerClick\", e))\r\n );\r\n return view;\r\n }", "function bindUIEvents() {\n\n var globalUIBinder = new Binder();\n globalUIBinder.check = function () {\n dom.getObject(\"$header.complete\").onClick(function (event) {\n env.role.join();\n });\n\n dom.getObject(\"$header.quit\").onClick(function (event) {\n env.user.quit();\n });\n };\n\n env.binders.uiSdk.pushHeader(globalUIBinder);\n\n /*\n Process binder registered.\n */\n for (var binder in env.binders.uiSdk) {\n if (binder instanceof Binder)\n binder.check();\n else if (binder instanceof Function)\n binder();\n else\n Log.e(\"Binder\", \"Found a invalid binder: \" + binder.vtag);\n }\n }", "function HookonBeforeSendHeaders(details) {\n //getDataFromStorage(\"status\").then((status) => {\n getDataFromStorage(LOCAL_STORAGES.STATUS.key).then((status) => {\n if (status == TASK_STATUS.ON) {\n getDataFromStorage(LOCAL_STORAGES.FILTER_SITE.key).then((filter_site) => {\n //getDataFromStorage(\"filter_site\").then((filter_site) => {\n if (filter_site == undefined){return;}\n filter_site = filter_site.toString().replace(new RegExp(\"\\\\*\", 'g'), \"(.*)\");\n var reg_exp = new RegExp(filter_site.toString());\n if (reg_exp.test(details.url) && details.url.indexOf(`${API_HOST}${API_PREFIX}${API_VERSION}/user/task`) == -1) {\n requestid = details.requestId;\n\n for (var i = 0; i < requestQueue.size(); i++) {\n if (requestQueue.get(i).requestid == requestid) {\n requestQueue.get(i).data.headers = JSON.stringify(getHeaders(details));\n console.log(\"hunter-debug:发送到后端API的数据为\" + JSON.stringify(requestQueue.get(i)));\n sendDataToHunterServer(requestQueue.get(i).data);\n }\n }\n }\n });\n }\n });\n}", "function setHeaderButtonClickFunctions(tag, color, title) {\n\t$('#' + tag).click(function() {\n\t\tif ( $('#message-form').css('display') == 'none' ) {\n\t\t\tchangeMessageForm(tag, color, title);\n\t\t\t$('#message-form').slideDown('slow', 'linear');\n\t\t}\n\t\telse {\n\t\t\t$('#message-form').fadeOut(500);\n\t\t\tsetTimeout(function (){\n\t\t\t\tchangeMessageForm(tag, color, title);\n\t\t\t\t $('#message-form').fadeIn();\n\t\t\t }, 500);\n\t\t}\n\t});\n}", "setHeader(name, value) { }", "_onHeaderTap() {\n this.fireEvent(\"headerTap\");\n }", "function updateRequestHeaders() {\n var requestHeaders = lodash.get(ctrl.selectedEvent, 'spec.attributes.headers', {});\n\n ctrl.headers = lodash.map(requestHeaders, function (value, key) {\n var header = {\n name: key,\n value: value,\n ui: {\n editModeActive: false,\n isFormValid: true,\n name: 'label',\n checked: true\n }\n };\n var existedHeader = lodash.find(ctrl.headers, ['name', key]);\n\n if (angular.isDefined(existedHeader)) {\n header.ui = lodash.assign(header.ui, existedHeader.ui);\n }\n\n return header;\n });\n ctrl.headers = lodash.compact(ctrl.headers);\n }", "setHeader(name, value) {\n this.headers[headerize(name)] = [{ raw: value }];\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Allows you to hoist methods, except those in an exclusion set from a source object into a destination object.
function hoistMethods( // tslint:disable-next-line:no-any destination, // tslint:disable-next-line:no-any source, exclusions) { if (exclusions === void 0) { exclusions = REACT_LIFECYCLE_EXCLUSIONS; } var hoisted = []; var _loop_1 = function (methodName) { if (typeof source[methodName] === 'function' && destination[methodName] === undefined && (!exclusions || exclusions.indexOf(methodName) === -1)) { hoisted.push(methodName); /* tslint:disable:no-function-expression */ destination[methodName] = function () { source[methodName].apply(source, arguments); }; /* tslint:enable */ } }; for (var methodName in source) { _loop_1(methodName); } return hoisted; }
[ "function hoistMethods(destination, source, exclusions) {\n\t if (exclusions === void 0) { exclusions = REACT_LIFECYCLE_EXCLUSIONS; }\n\t var hoisted = [];\n\t var _loop_1 = function (methodName) {\n\t if (typeof source[methodName] === 'function' &&\n\t destination[methodName] === undefined &&\n\t (!exclusions || exclusions.indexOf(methodName) === -1)) {\n\t hoisted.push(methodName);\n\t /* tslint:disable:no-function-expression */\n\t destination[methodName] = function () { source[methodName].apply(source, arguments); };\n\t /* tslint:enable */\n\t }\n\t };\n\t for (var methodName in source) {\n\t _loop_1(methodName);\n\t }\n\t return hoisted;\n\t}", "function hoistMethods(destination, source, exclusions) {\r\n if (exclusions === void 0) { exclusions = REACT_LIFECYCLE_EXCLUSIONS; }\r\n var hoisted = [];\r\n var _loop_1 = function (methodName) {\r\n if (typeof source[methodName] === 'function' &&\r\n destination[methodName] === undefined &&\r\n (!exclusions || exclusions.indexOf(methodName) === -1)) {\r\n hoisted.push(methodName);\r\n /* tslint:disable:no-function-expression */\r\n destination[methodName] = function () { source[methodName].apply(source, arguments); };\r\n /* tslint:enable */\r\n }\r\n };\r\n for (var methodName in source) {\r\n _loop_1(methodName);\r\n }\r\n return hoisted;\r\n}", "function hoistMethods(destination, source, exclusions) {\n if (exclusions === void 0) { exclusions = REACT_LIFECYCLE_EXCLUSIONS; }\n var hoisted = [];\n var _loop_1 = function (methodName) {\n if (typeof source[methodName] === 'function' &&\n destination[methodName] === undefined &&\n (!exclusions || exclusions.indexOf(methodName) === -1)) {\n hoisted.push(methodName);\n /* tslint:disable:no-function-expression */\n destination[methodName] = function () { source[methodName].apply(source, arguments); };\n /* tslint:enable */\n }\n };\n for (var methodName in source) {\n _loop_1(methodName);\n }\n return hoisted;\n}", "function proxyStaticMethods(target, source) {\n\t if (typeof source !== 'function') {\n\t return;\n\t }\n\t for (var key in source) {\n\t if (source.hasOwnProperty(key)) {\n\t var value = source[key];\n\t if (typeof value === 'function') {\n\t var bound = value.bind(source);\n\t // Copy any properties defined on the function, such as `isRequired` on\n\t // a PropTypes validator. (mergeInto refuses to work on functions.)\n\t for (var k in value) {\n\t if (value.hasOwnProperty(k)) {\n\t bound[k] = value[k];\n\t }\n\t }\n\t target[key] = bound;\n\t } else {\n\t target[key] = value;\n\t }\n\t }\n\t }\n\t}", "function proxyStaticMethods(target, source) {\n\t\t\t\t if (typeof source !== 'function') {\n\t\t\t\t return;\n\t\t\t\t }\n\t\t\t\t for (var key in source) {\n\t\t\t\t if (source.hasOwnProperty(key)) {\n\t\t\t\t var value = source[key];\n\t\t\t\t if (typeof value === 'function') {\n\t\t\t\t var bound = value.bind(source);\n\t\t\t\t // Copy any properties defined on the function, such as `isRequired` on\n\t\t\t\t // a PropTypes validator.\n\t\t\t\t for (var k in value) {\n\t\t\t\t if (value.hasOwnProperty(k)) {\n\t\t\t\t bound[k] = value[k];\n\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t target[key] = bound;\n\t\t\t\t } else {\n\t\t\t\t target[key] = value;\n\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t}", "function bridgeMethods(fromObject, toObject) {\n fromObject.cancel = toObject.cancel.bind(toObject);\n fromObject.getRequest = toObject.getRequest.bind(toObject);\n fromObject.getResponse = toObject.getResponse.bind(toObject);\n fromObject.getError = toObject.getError.bind(toObject);\n}", "function _extend_api2 (destination, source)\n{\n for (var property in source)\n {\n var desc = Object.getOwnPropertyDescriptor (source, property);\n\n if (desc && (desc.get || desc.set))\n {\n defineProperty (destination, property, desc);\n }\n else\n {\n destination [property] = source [property];\n }\n }\n return destination;\n}", "function proxyStaticMethods(target, source) {\n\t if (typeof source !== 'function') {\n\t return;\n\t }\n\t for (var key in source) {\n\t if (source.hasOwnProperty(key)) {\n\t var value = source[key];\n\t if (typeof value === 'function') {\n\t var bound = value.bind(source);\n\t // Copy any properties defined on the function, such as `isRequired` on\n\t // a PropTypes validator.\n\t for (var k in value) {\n\t if (value.hasOwnProperty(k)) {\n\t bound[k] = value[k];\n\t }\n\t }\n\t target[key] = bound;\n\t } else {\n\t target[key] = value;\n\t }\n\t }\n\t }\n\t}", "function proxyStaticMethods(target, source) {\n if (typeof source !== 'function') {\n return;\n }\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n var value = source[key];\n if (typeof value === 'function') {\n var bound = value.bind(source);\n // Copy any properties defined on the function, such as `isRequired` on\n // a PropTypes validator.\n for (var k in value) {\n if (value.hasOwnProperty(k)) {\n bound[k] = value[k];\n }\n }\n target[key] = bound;\n } else {\n target[key] = value;\n }\n }\n }\n}", "function expose(obj, src, method, casts) {\n obj[method] = function () {\n for (index in casts)\n arguments[index] = new (casts[index])(arguments[index]);\n src[method].apply(src, arguments);\n }\n}", "function copyNativeMethods(src, dest) {\n\t\tvar names = [ 'constructor', 'toString', 'valueOf' ];\n\t\tvar i, name;\n\n\t\tfor (i = 0; i < names.length; i++) {\n\t\t\tname = names[i];\n\n\t\t\tif (src[name] !== Object.prototype[name]) {\n\t\t\t\tdest[name] = src[name];\n\t\t\t}\n\t\t}\n\t}", "function copyNativeMethods(src, dest) {\n\tvar names = [ 'constructor', 'toString', 'valueOf' ];\n\tvar i, name;\n\n\tfor (i = 0; i < names.length; i++) {\n\t\tname = names[i];\n\n\t\tif (src[name] !== Object.prototype[name]) {\n\t\t\tdest[name] = src[name];\n\t\t}\n\t}\n}", "function copyNativeMethods(src, dest) {\n var names = ['constructor', 'toString', 'valueOf'];\n var i, name;\n\n for (i = 0; i < names.length; i++) {\n name = names[i];\n\n if (src[name] !== Object.prototype[name]) {\n dest[name] = src[name];\n }\n }\n }", "function importMethods(target, source, methods, lowercaseNames)\n {\n methods.forEach(function(name)\n {\n var newName = (lowercaseNames ? name.toLowerCase() : name);\n\n if (typeof source[name] == 'function')\n target[newName] = source[name].bind(source);\n else\n target[newName] = source[name];\n });\n\n return target;\n }", "function $__jsx_merge_interface(target, source) {\n\tfor (var k in source.prototype)\n\t\tif (source.prototype.hasOwnProperty(k))\n\t\t\ttarget.prototype[k] = source.prototype[k];\n}", "function delegateProperties(destination, source, modifiers) {\n Object.getOwnPropertyNames(source).forEach(function (propertyName) {\n var propertyDescriptor = Object.getOwnPropertyDescriptor(source, propertyName);\n\n if (typeof propertyDescriptor.value == 'function' && modifiers.value) {\n var superValue = propertyDescriptor.value;\n\n propertyDescriptor.value = function () {\n var args = [].slice.call(arguments);\n\n return modifiers.value.call(this, superValue, propertyName, args);\n };\n }\n else {\n if (propertyDescriptor.get && modifiers.get) {\n var superGetter = propertyDescriptor.get;\n\n propertyDescriptor.get = function () {\n return modifiers.get.call(this, superGetter, propertyName);\n };\n }\n\n if (propertyDescriptor.set && modifiers.set) {\n var superGetter = propertyDescriptor.set;\n\n propertyDescriptor.set = function (value) {\n return modifiers.value.call(this, superGetter, propertyName, value);\n };\n }\n }\n\n Object.defineProperty(destination, propertyName, propertyDescriptor);\n });\n\n return destination;\n}", "function transferStaticProperties(source, target) {\n var ignoreKeys = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];\n\n var keys = Object.getOwnPropertyNames(source);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (!source.hasOwnProperty(key)) {\n continue;\n }\n if (FUNCTION_STATIC_PROPERTIES[key]) {\n continue;\n }\n if (ignoreKeys && ignoreKeys.indexOf(key) > -1) {\n continue;\n }\n target[key] = source[key];\n }\n}", "function bridge_method(target, from, name, body) {\n var ancestors, i, ancestor, length;\n\n ancestors = target.$$bridge.$ancestors();\n\n // order important here, we have to check for method presence in\n // ancestors from the bridged class to the last ancestor\n for (i = 0, length = ancestors.length; i < length; i++) {\n ancestor = ancestors[i];\n\n if ($hasOwn.call(ancestor.$$proto, name) &&\n ancestor.$$proto[name] &&\n !ancestor.$$proto[name].$$donated &&\n !ancestor.$$proto[name].$$stub &&\n ancestor !== from) {\n break;\n }\n\n if (ancestor === from) {\n target.prototype[name] = body\n break;\n }\n }\n\n }", "function extend(target, source, args) {\n var exclude = {};\n \n if (args && args.exclude) {\n for (var i = 0; i < args.exclude.length; ++i) {\n exclude[args.exclude[i]] = true;\n }\n }\n\n for (var prop in source) {\n if (!args || !exclude.hasOwnProperty(prop)) {\n target[prop] = source[prop];\n }\n }\n\n return target;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set global var of sheet
function setGlobalVar() { gActiveSheet = SpreadsheetApp.getActiveSheet(); gMaxRow = gActiveSheet.getLastRow(); gValuesOfRange = gActiveSheet.getRange(10, 1, gMaxRow, 50).getValues(); gIndexOfLogicalNameOfColumn = gValuesOfRange[0].indexOf('カラム名(論理)'); gIndexOfPhysicalNameOfColumn = gValuesOfRange[0].indexOf('カラム名(物理)'); gIndexOfColumnType = gValuesOfRange[0].indexOf('型'); gIndexOfColumnSize = gValuesOfRange[0].indexOf('サイズ'); gIndexOfColumnDefaultVal = gValuesOfRange[0].indexOf('Default'); gIndexOfColumnNotNull = gValuesOfRange[0].indexOf('NOTNULL'); gTblName = gActiveSheet.getRange(8, 10, 1, 1).getValue(); // gTblName = gActiveSheet.getName(); gTblNameLogic = gActiveSheet.getRange(2, 2).getValues(); gTblNameUpper = gTblName.toUpperCase(); }
[ "function setup() {\n var sheet = SpreadsheetApp.getActiveSpreadsheet();\n SCRIPT_PROP.setProperty(\"key\", sheet.getId());\n}", "function _initSheet(){\r\n var sskey = PropertiesService.getScriptProperties().getProperty(\"ss_key\");\r\n var ss = null;\r\n if(sskey!==null){\r\n try{\r\n ss = SpreadsheetApp.openById(sskey);\r\n ss.getActiveSheet();\r\n }catch(e){\r\n Logger.log(e)\r\n PropertiesService.getScriptProperties().deleteProperty(\"ss_key\");\r\n //...\r\n }\r\n }else{\r\n ss = SpreadsheetApp.create(_getKeyPrefix() + \"spreadsheet_\"+(+new Date())); //creates a SpreadSheet for project, not a shared one \r\n PropertiesService.getScriptProperties().setProperty(\"ss_key\", ss.getId());\r\n }\r\n _setSheet(ss.getActiveSheet()); \r\n }", "function openVariablesSheet(userParams) {\n setParams(userParams);\n SpreadsheetApp.setActiveSheet(getVariablesSheetContext()); \n}", "function Sheet()\n {\n var name=null;\n var sheetData=null;\n var _columnCount=0;\n var _rowCount=0;\n var domContainer=null;\n var sheetNumber=0;\n }", "function updateSheetSettings(){\n // - try fetching the sheet by name\n var sheetObject = _SPREADSHEET.getSheetByName(SHEET_SETTINGS_TITLE);\n \n // - if has no sheet\n if (sheetObject == null) {\n sheetObject = _SPREADSHEET.insertSheet(SHEET_SETTINGS_TITLE);\n \n }\n \n // - clear the sheet object\n sheetObject.clear() \n \n // - append header row information\n sheetObject.appendRow([\"PROJECT_NAME\", _CURRENT_PROJECT.project_title]);\n sheetObject.appendRow([\"SHEET_PROJECT_INDEX\", _CURRENT_PROJECT_INDEX]);\n sheetObject.appendRow([\"SHEET_PROJECT_ISSUE_INDEX\", _CURRENT_PROJECT_ISSUE_INDEX]);\n sheetObject.appendRow([\"SHEET_LAST_ROW\", _CURRENT_SHEET_LAST_ROW]);\n sheetObject.appendRow([\"SHEET_LAST_OFFSET\", _CURRENT_SHEET_LAST_OFFSET]);\n sheetObject.appendRow([\"SHEET_LAST_PAGE\", _CURRENT_SHEET_LAST_PAGE]);\n}", "function openVariablesSheet(userParams) {\r\n setParams(userParams);\r\n SpreadsheetApp.setActiveSheet(getVariablesSheetContext()); \r\n}", "function changeExcelSheet(e) {\n setCurrSheetIndex(e.target.value);\n }", "function helloSheet(){\n let range = getSheetRange()\n range.setValue(\"hello\")\n return \"helloSheet Completed\"\n}", "function setupSheet(){ \n var ss = getSheet();\n var sheet = ss.getSheetByName('DATA');\n if(!sheet){\n sheet = ss.insertSheet('DATA',0);\n sheet.appendRow(['PHONE','MESSAGE','STATUS','LOG'])\n }\n \n}", "static set jss(instance) {\n JSSManager.sheetManager.jss = instance;\n }", "function loadCurrentSheet() {\n let data = cellData[selectedSheet];\n let rowKeys = Object.keys(data);\n for (let i of rowKeys) {\n let rowId = parseInt(i);\n let colKeys = Object.keys(data[rowId]);\n for (let j of colKeys) {\n let colId = parseInt(j);\n let cell = $(`#row-${rowId + 1}-col-${colId + 1}`);\n cell.text(data[rowId][colId].text);\n cell.css({\n \"font-family\": data[rowId][colId][\"font-family\"],\n \"font-size\": data[rowId][colId][\"font-size\"],\n \"background-color\": data[rowId][colId][\"bgcolor\"],\n \"color\": data[rowId][colId].color,\n \"font-weight\": data[rowId][colId].bold ? \"bold\" : \"\",\n \"font-style\": data[rowId][colId].italic ? \"italic\" : \"\",\n \"text-decoration\": data[rowId][colId].underlined ? \"underline\" : \"\",\n \"text-align\": data[rowId][colId].alignment\n });\n }\n }\n}", "function resetSheetSettings(){\n // - the index of the current project's issue\n _CURRENT_PROJECT_ISSUE_INDEX = 0;\n \n // - the last row of the current sheet\n _CURRENT_SHEET_LAST_ROW = 1;\n \n // - the last offset of the sheet\n _CURRENT_SHEET_LAST_OFFSET = 0;\n \n // - the last page of the sheet\n _CURRENT_SHEET_LAST_PAGE = 1;\n \n // - catch when the sheet was parsed\n _DID_PARSE_SHEET = false\n}", "function setChangesToSheet(sheet, sheetName, data) {\n sheet.dictToSheet(sheetName, data);\n}", "function set_sheet() {\n\n\tvar $spreadsheet = $('#spreadsheet');\n\n\t// Buttons\n\t$('#pegboard_link').click(function() {\n\t\tdocument.location.href = 'pegboard';\n\t});\t\n\t// Set sheet height\n\tset_sheet_height();\n\n\t// View buttons\n\t$('.view-buttons').find('button').click(function() {\n\t\tvar $clicked = $(this);\n\t\t$clicked.blur();\n\t\t$clicked.siblings(':not(.page)').addClass('btn-default').removeClass('btn-primary');\n\t\t$clicked.addClass('btn-primary').removeClass('btn-default');\n\t\tui(ui.collection, $clicked.attr('id'), ui.col_view);\n\t});\n\t\n}", "function setConfiguration()\n{\n var scoreboard = ss.getSheetByName(SHEET_SCOREBOARD);\n var data = scoreboard.getRange(\"B4:E\");\n scoreboard.getRange(\"B4:E\").setData();\n}", "function excel_define_sheet_name(excel){\n\tvar excel = excel||$JExcel.new();\n\tsheet_name = sheet_name||\"Summary\"\n\tsheet_number = sheet_number||0\n\texcel.set(sheet_number,undefined,undefined,sheet_name); \n\treturn excel \n}", "function createSheetSet() {\r\n return {\r\n sheets: [],\r\n allVariables: {},\r\n allRules: [],\r\n add: addToSet,\r\n remove: removeFromSet,\r\n clear: clearSet\r\n };\r\n }", "function fillSheet(tab, values, row, col) {\r\n sheet = ss.getSheetByName(tab);\r\n cells = sheet.getRange(row, col, values.length, values[0].length);\r\n cells.setValues(values);\r\n}", "function setCellValue(sheet, row, col, value)\n {\n var single_cell = sheet.getRange(row, col, 1, 1);\n single_cell.setValue(value);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
populating domain capacity down button dynamically using the values fetched from database
function populate_capacity_dropdown_by_query() { let select = document.getElementById("Select Capacity"); let arr= Get("api/buttonsdynamically/get/capacity"); if(select===null) alert("empty object retrieved from DOM parse"); if( select.length>1) { //alert("capacities already exist in under the domain button, no need to again add them"); return ""; } for (let i = 0; i < arr.length; i++) { let option = document.createElement("OPTION"), txt = document.createTextNode(arr[i]); option.appendChild(txt); option.setAttribute("value", arr[i]); select.insertBefore(option, select.lastChild); } }
[ "drawBadges (){\n /**\n * container in the left hand side\n * @type {T | string}\n */\n select (\"slot_not_available\").innerHTML = this.slotsArray.reduce((acc, [slotTime, flag], i)=>acc +\n `<button class=\"btn btn-primary\" ${flag?\"disabled\":\"\"} onclick=\"makeAvailable(${i})\">${slotTime}</button>`\n , \"\");\n\n /**\n * container in the right hand side\n * @type {T | string}\n */\n select(\"slot_available\").innerHTML = this.slotsArray.reduce((acc, [slotTime, flag], i)=>acc +\n `<button class=\"btn btn-success ${!flag?\"invisible\":\"\"}\" ${!flag?\"disabled\":\"\"} onclick=\"makeAvailable(${i})\">${slotTime}</button>`, \"\");\n switchButtonDisplay();\n }", "function setQuantity() {\n var quantityOptions = '', maxQuantityOptions = (parseInt(product['dvdQuantity']) >= 5) ? 5 : parseInt(product['dvdQuantity']);\n\n if (maxQuantityOptions !== 0) {\n for (i = 0; i < maxQuantityOptions; i++) {\n quantityOptions += '<button class=\"dropdown-item quantity-option\">' + (i + 1) + '</button>';\n }\n\n getElementById('dropdownQuantity').innerHTML = quantityOptions;\n }\n else {\n getElementById('dropdownQuantity').innerHTML = '';\n }\n\n getElementById('productQuantity').innerHTML = (maxQuantityOptions > 0) ? 1 : 0;\n }", "function buildQuantity() {\n var buttonData = [\n \"<div class='dropdown' style='margin-left:10px;margin-right:10px;'>\",\n \" <button class='btn btn-info btn-sm dropdown-toggle' type='button' id='dropdownMenuButton' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>Contigs Per Page</button>\",\n \" <div class='dropdown-menu' aria-labelledby='dropdownMenuButton'>\"]\n if (contigs.length > 5) {\n buttonData.push(\"<span class='dropdown-item' onclick='CONTIGquantity(5)'>5</span>\");\n }\n if (contigs.length > 10) {\n buttonData.push(\"<span class='dropdown-item' onclick='CONTIGquantity(10)'>10</span>\");\n }\n if (contigs.length > 20) {\n buttonData.push(\"<span class='dropdown-item' onclick='CONTIGquantity(20)'>20</span>\");\n }\n if (contigs.length > 50) {\n buttonData.push(\"<span class='dropdown-item' onclick='CONTIGquantity(50)'>50</span>\");\n }\n if (contigs.length > 100) {\n buttonData.push(\"<span class='dropdown-item' onclick='CONTIGquantity(100)'>100</span>\");\n }\n if (contigs.length > 250) {\n buttonData.push(\"<span class='dropdown-item' onclick='CONTIGquantity(250)'>250</span>\");\n }\n buttonData.push(\n \" <span class='dropdown-item' onclick='CONTIGquantity(\\\"all\\\")'>All</span>\",\n \" </div>\",\n \"</div>\" \n );\n document.getElementById(\"CONTIG-options\").innerHTML = buttonData.join('\\n');\n}", "function device_view_selection(adapterName) {\n gui_view_selection(\"device\");\n document.getElementById(\"DeviceCapabilities\").innerHTML = \"\";\n\n for (let i in Settings_database) {\n if (Settings_database[i].adapterName === adapterName) {\n const device = Settings_database[i];\n let dd = \"\"; //Display Devices generic information.\n //dd = dd + `<i class=\"fa fa-trash-o faRight\" style=\"font-size: 24px; color: red;\" onclick=\"device_remove('${adapterName}')\"></i>`;\n dd = dd + `<img class=\"ciconr\" src=\"ico/ico_binr.png\" style=\"margin-top: 0px;\" onclick=\"device_remove('${adapterName}')\">`;\n dd = dd + `<img class=\"cicon\" src=\"${getDeviceIconPath(device)}\" style=\"margin-top: 0px;\">`;\n dd = dd + `<h1 class=\"h2\">${device.name}</h1>`;\n dd = dd + `<h1 class=\"h3\">TYPE: ${device.type}</h1>`;\n dd = dd + `<h1 class=\"h3\">VERSION: ${device.driverVersion}</h1>`;\n\n //\n let c = 0; //capability counter\n for (let ic in device.capabilities) {\n const capabilityName = device.capabilities[ic].name;\n const capabilityLabel = device.capabilities[ic].label;\n const capabilityType = device.capabilities[ic].type;\n\n //Display first row of capabilities\n if (capabilityType === \"slider\" || capabilityType === \"button\" || capabilityType === \"switch\" || capabilityType === \"textlabel\" || capabilityType === \"imageurl\") {\n if (c == 0) {\n dd = dd + '<div style=\"background-color: #fff;\"><hr class=\"Menu\" style=\"margin-bottom: 0;\">';\n } else {\n dd = dd + '<hr class=\"subMenu\" style=\"margin-bottom: 0;\">';\n }\n c++;\n\n //Line displaying one capability\n dd = dd + `<button class=\"mi\" style=\"height: 48px !important;\">`;\n //dd = dd + ` <i class=\"fa fa-trash-o faRight\" style=\"font-size: 24px;\" onclick=\"capability_remove('${adapterName}', '${capabilityName}')\"></i>`;\n //dd = dd + ` <i class=\"faLeft\" style=\"font-size: 11px; left: 75%; margin-top:6px; color: #CCCBD0;\" onclick=\"capability_rename('${adapterName}', '${capabilityName}')\">Rename</i>`;\n dd = dd + ` <img class=\"ciconr\" src=\"ico/ico_bin.png\" style=\"margin-top: 0px;\" onclick=\"capability_remove('${adapterName}', '${capabilityName}')\">`;\n dd = dd + ` <img class=\"cicon\" src=\"ico/ico_${capabilityType}.png\" style=\"margin-top: 0px;\"/>`;\n dd = dd + ` <input type=\"text\" name=\"${capabilityName}\" value=\"${capabilityLabel}\" style=\"border-style: none; font-family: Roboto, sans-serif !important; font-size: 13px !important;\" onkeypress=\"capability_rename(event, '${adapterName}', '${capabilityName}')\">`;\n dd = dd + `</button>`;\n }\n }\n dd = dd + '</div><hr class=\"Menu\" style=\"margin-bottom: 0;\">';\n\n // Adding Capabilities view.\n dd = dd + `<div id=\"cap_view_${adapterName}\" class=\"capview\">`;\n dd = dd + ` <div class=\"field row\">`;\n dd = dd + ` <label for=\"captype_${adapterName}\">Capability type:</label>`;\n dd = dd + ` <select id=\"captype_${adapterName}\" style=\"border: 0px solid #fff; border-bottom: 2px solid #ddd; background-color: #fff; border-radius: 4px; width: 90%; height: 35px; margin-bottom: 20px;\" onchange=\"device_cap_view_type_change('${adapterName}')\">`;\n dd = dd + ` <option value=\"button\">Button</option><option value=\"switch\">Switch</option><option value=\"slider\">Slider</option><option value=\"textlabel\">textlabel</option><option value=\"image\">image</option><option value=\"large image\">large image</option></select></div>`;\n dd = dd + ` <div class=\"field row\">`;\n dd = dd + ` <label for=\"capname_${adapterName}\">Capability name:</label>`;\n dd = dd + ` <input id=\"capname_${adapterName}\" type=\"text\" placeholder=\"Button name\" style=\"border: 0px solid #fff; border-bottom: 2px solid #ddd; background-color: #fff; border-radius: 4px; width: 90%; height: 23px; margin-bottom: 20px;\"/></div>`;\n dd = dd + ` <div class=\"field row\" id=\"capslidermin_${adapterName}\" style=\"display: none;\">`;\n dd = dd + ` <label for=\"capslider_min_${adapterName}\">Slider minimum value:</label>`;\n dd = dd + ` <input id=\"capslider_min_${adapterName}\" type=\"number\" value=\"0\" style=\"border: 0px solid #fff; border-bottom: 2px solid #ddd; background-color: #fff; border-radius: 4px; width: 90%; height: 32px; margin-bottom: 20px;\"/></div>`;\n dd = dd + ` <div class=\"field row\" id=\"capslidermax_${adapterName}\" style=\"display: none;\">`;\n dd = dd + ` <label for=\"capslider_max_${adapterName}\">Slider maximum value:</label>`;\n dd = dd + ` <input id=\"capslider_max_${adapterName}\" type=\"number\" value=\"100\" style=\"border: 0px solid #fff; border-bottom: 2px solid #ddd; background-color: #fff; border-radius: 4px; width: 90%; height: 32px; \"/></div>`;\n dd = dd + ` <div class=\"field row\" id=\"capsliderunit_${adapterName}\" style=\"display: none;\">`;\n dd = dd + ` <label for=\"capslider_unit_${adapterName}\">Slider unit:</label>`;\n dd = dd + ` <input id=\"capslider_unit_${adapterName}\" type=\"text\" value=\"%\" style=\"border: 0px solid #fff; border-bottom: 2px solid #ddd; background-color: #fff; border-radius: 4px; width: 90%; height: 22px; margin-bottom: 20px;\"/></div>`;\n dd = dd + ` <div class=\"field row\" id=\"captextlabelvisible_${adapterName}\" style=\"display: none;\">`;\n dd = dd + ` <label for=\"captextlabel_visible_${adapterName}\">Label name visible:</label><br>`;\n dd = dd + ` <input id=\"captextlabel_visible_${adapterName}\" type=\"checkBox\" checked=true style=\"border: 0px solid #fff; border-bottom: 2px solid #ddd; background-color: #fff; border-radius: 4px; width: 22px; height: 22px; margin-bottom: 20px;\"/></div>`;\n dd = dd + ` <div class=\"saveCapability\" onclick=\"device_cap_save('${adapterName}')\" id=\"cap_savebtn_${adapterName}\">SAVE</div>`;\n dd = dd + ` <div class=\"cancelCapability\" onclick=\"device_cap_view_hide('${adapterName}')\" id=\"cap_savebtn_${adapterName}\">CANCEL</div>`;\n dd = dd + ` </div>`;\n dd = dd + `<div id=\"capgrp_view_${adapterName}\" class=\"capview\">`;\n dd = dd + ` <div class=\"addCapability\" onclick=\"device_capgrp_save('${adapterName}', 'mediacontrolls')\\\">Add media controlls.</div>`;\n dd = dd + ` <div class=\"addCapability\" onclick=\"device_capgrp_save('${adapterName}', 'digits')\\\">Add digits.</div>`;\n dd = dd + ` <div class=\"addCapability\" onclick=\"device_capgrp_save('${adapterName}', 'directions')\\\">Add cursor controlls.</div>`;\n dd = dd + ` <div class=\"addCapability\" onclick=\"device_capgrp_save('${adapterName}', 'power')\\\">Add power controlls.</div>`;\n dd = dd + ` <div class=\"addCapability\"><br></div>`;\n dd = dd + ` <div class=\"addCapability\" onclick=\"device_capgrp_view_hide('${adapterName}')\\\">Cancel</div>`;\n dd = dd + `</div>`;\n dd = dd + `<div class=\"addCapability\" onclick=\"device_cap_view_show('${adapterName}')\" id=\"cap_addbtn_${adapterName}\"><i class=\"fa fa-plus-circle\"></i> Add a capability...</div>`;\n dd = dd + `<div class=\"addCapability\" onclick=\"device_capgrp_view_show('${adapterName}')\" id=\"capgrp_addbtn_${adapterName}\"><i class=\"fa fa-plus-circle\"></i> Add a capability group...</div>`;\n\n document.getElementById(\"jsonconfig\").value = JSON.stringify(Settings_database);\n document.getElementById(\"DeviceCapabilities\").innerHTML = dd;\n }\n }\n}", "function UpdateProvidersDropdown() {\n for (var i in DataStoreObj.Providers) {\n var prov = DataStoreObj.Providers[i];\n var drop = document.getElementById(prov.Id)\n let label = document.getElementById(prov.Id + \"_Label\");\n drop.disabled = true;\n label.style.color = \"grey\"\n document.getElementById(prov.Id + \"_Count\").innerText = \" (\" + prov.DisplayedResourceCount.toString() + \")\";\n if (prov.DisplayedResourceCount > 0) {\n label.style.color = \"black\"\n drop.disabled = false\n }\n }\n}", "function updateCapacityVal(i) {\n if (graph.max_flow > 0) {\n graph.max_flow = 0;\n graph.edges.map(function (e) {\n e.resetFlow();\n });\n }\n if (selected_link) {\n entered_capacity_val += i;\n d3.select('.capacity_' + selected_link.id).text(entered_capacity_val);\n selected_link.capacity = parseInt(entered_capacity_val);\n restart();\n }\n}", "function updateCapacity () {\n var newIndex = 0\n boxUsed.forEach((active, index) => {\n if (active) {\n document.getElementById(\"focus-\"+index).dataset.roomIndex = newIndex+1;\n //document.getElementById(\"focus-\"+index).style.display = \"block\"\n newIndex++;\n }\n })\n document.querySelector(\"#vids.videos\").dataset.capacity = newIndex;\n }", "function createCVItineraryButton() {\r\n\tif(checkViewFields([\"text598\",\"text3381\",\"text3321\",\"text3341\",\"text4581\",\"text4541\",\"text4681\",\"text4627\",\"text4589\",\"text4543\",\"text4683\",\"text4629\",\"text4591\",\"text4545\",\"text4685\",\"text4631\",\"text4593\",\"text4547\",\"text4687\",\"text4633\",\"text4595\",\"text4549\",\"text4689\",\"text4635\",\"text4597\",\"text4551\",\"text4691\",\"text4637\",\"text4599\",\"text4553\",\"text4693\",\"text4639\",\"text4601\",\"text4555\",\"text4695\",\"text4641\",\"text4603\",\"text4557\",\"text4697\",\"text4643\",\"text4605\",\"text4559\"])){\r\n\r\n\t/*Dropdown menu from here https://www.w3schools.com/howto/howto_js_dropdown.asp*/\r\n\t//Create our HTML to inject.\r\n\tvar bereaButton = document.createElement(\"div\");\r\n\tbereaButton.style = \"float:right\";\r\n\tbereaButton.id = \"bereaButton\";\r\n\tbereaButton.innerHTML = \"<div class='BereaDropdown'>\"+\r\n\t\t\"<input ID='Berea_Menu_Button' value='Berea Visits' class='BereaBlue bigbutton new' type='button' onclick='return false;'>\"+\r\n\t \"<div id='BereaMenu' class='BereaDropdown-content'>\"+\r\n\t\t//\"<a href='#' ID='AM_No_Lunch' onclick='return false;'>AM Session</a>\"+\r\n\t\t//\"<a href='#' ID='AM_With_Lunch' onclick='return false;'>AM Session (Lunch)</a>\"+\r\n\t\t//\"<a href='#' ID='PM_Session' onclick='return false;'>PM Session</a>\"+\r\n\t\t//\"<a href='#' ID='Midday_Session' onclick='return false;'>Midday Session</a>\"+\r\n\t\t\"<a href='#' ID='Clear_Session'onclick='return false;' >Clear Sessions</a>\"+\r\n\t \"</div></div>\";\r\n\tvar buttonRow = document.getElementsByClassName('triggerBtnsTop');\r\n\tbuttonRow[0].appendChild(bereaButton);\r\n\t//Set even listeners \"click\" for the buttons above.\r\n\tdocument.getElementById(\"Berea_Menu_Button\").addEventListener(\"click\",showCVItineraryMenu);\r\n\t//document.getElementById(\"AM_No_Lunch\").addEventListener(\"click\",function(){creatCVItinerary(1);});\r\n\t//document.getElementById(\"AM_With_Lunch\").addEventListener(\"click\",function(){creatCVItinerary(2);});\r\n\t//document.getElementById(\"PM_Session\").addEventListener(\"click\",function(){creatCVItinerary(3);});\r\n\t//document.getElementById(\"Midday_Session\").addEventListener(\"click\",function(){creatCVItinerary(4);});\r\n\tdocument.getElementById(\"Clear_Session\").addEventListener(\"click\",clearCVItinerary);\r\n\t\r\n\r\n\t/*Just as a side note incase I ever need to insert a script code \r\n\thttps://www.danielcrabtree.com/blog/25/gotchas-with-dynamically-adding-script-tags-to-html*/\r\n\t} else{\r\n\t\trecheckViewFields();\r\n\t}\r\n\t\r\n}", "_updateButtons() {\n var upButton = this.getChildControl(\"upbutton\");\n var downButton = this.getChildControl(\"downbutton\");\n var value = this.getValue();\n\n if (!this.getEnabled()) {\n // If Spinner is disabled -> disable buttons\n upButton.setEnabled(false);\n downButton.setEnabled(false);\n } else {\n if (this.getWrap()) {\n // If wraped -> always enable buttons\n upButton.setEnabled(true);\n downButton.setEnabled(true);\n } else {\n // check max value\n if (value !== null && value < this.getMaximum()) {\n upButton.setEnabled(true);\n } else {\n upButton.setEnabled(false);\n }\n\n // check min value\n if (value !== null && value > this.getMinimum()) {\n downButton.setEnabled(true);\n } else {\n downButton.setEnabled(false);\n }\n }\n }\n }", "function buildCapacities(ueId) {\n // Making sure it is empty first\n $('#capacityList').html('');\n \n $.ajax({\n url: \"CapacityServlet\", \n data: {Action: \"getC\", ueId : ueId},\n success: function(response) {\n var htmlContent = '';\n $.each(response, function(){\n // For each capacity i create a html element.\n htmlContent += '<a class=\"list-group-item list-group-item-action list-group-item-primary\">' +\n '<div class=\"row\">' + \n '<div class=\"col-xl-10\">' + \n '<span>' + this.capacityName + '</span>' + \n '</div>' + \n '<div class=\"col-xl-2\">' + \n '<button type=\"button\" class=\"close\" aria-label=\"Close\" data-capacityid=\"' + \n this.id + \n '\">' + \n '<span aria-hidden=\"true\">&times;</span>' +\n '</button>' + \n '</div>' + \n '</div>' + \n '</a>';\n });\n \n // Then i add it to the detail box.\n $('#capacityList').html(htmlContent);\n \n /* When the user click on the close button on one of these \n * capacities, that capacity is deleted from the list and from \n * the database. */\n $('.close').click(function() {deleteCapacity($(this).data('capacityid'), ueId)});\n \n },\n \n error: showAjaxError,\n dataType: \"json\"\n });\n }", "function populateAbilityPage() {\n $('#abilities_container').append(`\n <div class=\"summary_top_header\">\n <h4>Abilities</h4>\n </div>\n\n <div class=\"row base_abilities_container\">\n <div class=\"col-2 ability_styling ability_top \"></div>\n <div class=\"col ability_styling ability_top\">Base</div>\n <div class=\"col ability_styling ability_top\"></div>\n <div class=\"col-2 ability_styling ability_top\">Bought</div>\n <div class=\"col ability_styling ability_top\"></div>\n <div class=\"col-2 ability_styling ability_top\">Race</div>\n <div class=\"col ability_styling ability_top\"></div>\n <div class=\"col ability_styling ability_top\">Total</div>\n <div class=\"d-none d-md-block col col-md-2 ability_styling ability_top\">Modifier</div>\n </div>`)\n\n nameAbility.forEach(element => {\n $('#abilities_container').append(`\n <div class=\"row base_abilities_container\">\n <div class=\"col-2 ability_styling ability_header\">${element.toUpperCase()}</div>\n <div class=\"col ability_styling\" id=\"base_${element}\">8</div>\n <div class=\"col ability_styling\">+</div>\n <div class=\"col-2 ability_styling\" id=\"bought_${element}\">\n <button class=\"ability_buy\" id=\"bought_${element}_down\">-</button>\n <span id=\"current_bought_${element}\">0</span>\n <button class=\"ability_buy\" id=\"bought_${element}_up\">+</button>\n </div>\n <div class=\"col ability_styling\">+</div>\n <div class=\"col-2 ability_styling\" id=\"race_${element}\">0</div>\n <div class=\"col ability_styling\">=</div>\n <div class=\"col ability_styling\" id=\"char_${element}\">8</div>\n <div class=\"d-none d-md-block col col-md-2 ability_styling\" id=\"ability_modifier_${element}\"></div>\n </div>`)\n });\n\n $('#abilities_container').append(`\n <div class=\"row base_abilities_container_footer\">\n <div class=\"abilities_styling_footer_text\">Ability Points:</div>\n <div class=\"abilities_styling_footer_value\" id=\"ability_points\">27</div>\n <div class=\"abilities_styling_footer_text\">Racial Points:</div>\n <div class=\"abilities_styling_footer_value\" id=\"race_bonus_points\">0</div>\n </div>\n `)\n}", "function createButtons() {\n\n // Load control button template\n Ractive.load('templates/buttons.html').then(function (buttonControl) {\n\n buttonsControl = new buttonControl({\n el: 'buttonControl',\n data: {\n controlButton: updateButtons\n }\n });\n\n // Added listener to update progress bar value\n buttonsControl.on('upadateBar', function (event) {\n var selectedbar = selectControls.find(\"#selectProgress\").value;\n var valueUpdate = parseInt(this.get(event.keypath));\n updateProgressBar(selectedbar, valueUpdate,limit);\n });\n\n });\n}", "function updateUpgradesDisplay(){\n if(doubleClickFood.active === true){\n doubleClickFoodButton.hidden = true;\n }\n else{\n doubleClickFoodButton.hidden = false;\n if(upgradePurchaseCheck(doubleClickFood)){\n doubleClickFoodButton.disabled = false;\n }\n else{\n doubleClickFoodButton.disabled = true;\n }\n }\n if(doubleClickWood.active === true){\n doubleClickWoodButton.hidden = true;\n }\n else{\n doubleClickWoodButton.hidden = false;\n if(upgradePurchaseCheck(doubleClickWood)){\n doubleClickWoodButton.disabled = false;\n }\n else{\n doubleClickWoodButton.disabled = true;\n }\n }\n if(doubleClickStone.active === true){\n doubleClickStoneButton.hidden = true;\n }\n else{\n doubleClickStoneButton.hidden = false;\n if(upgradePurchaseCheck(doubleClickStone)){\n doubleClickStoneButton.disabled = false;\n }\n else{\n doubleClickStoneButton.disabled = true;\n }\n }\n\n \n}", "gatherResource(e) {\n e.preventDefault() \n let resource = e.data.id\n //finding the key inside of civ class that matches the resource clicked then increasing it\n let increaseResource =Object.keys(civ).find(x => x === `${resource}`)\n civ[`${increaseResource}`]++\n //updating DOM to reflect updated civ class changes\n $(`#${resource}-count`).html(civ[`${increaseResource}`])\n //this is a check for first appearance of the hut button\n if(civ.wood >= 20){\n civ.firstWood = false;\n }\n if (civ.firstWood == false){\n $(\".hut\").show()\n }\n //disables and enables button if the player can/not afford the cost\n if (civ.wood < 20 && civ.firstWood == false){\n $(\"#hut-btn\").addClass(\"is-disabled\").prop(\"disabled\", true)\n }\n if(civ.wood >= 20 && civ.firstWood == false){\n $(\"#hut-btn\").removeClass(\"is-disabled\").prop(\"disabled\", false)\n }\n }", "function setAttribute_1_down()\n{\n --decrement_1;\n //Make the button visible\n //this.attribute_1_down.visible;\n //decrement the attribute\n attributes.decrementFirst(decrement_1);\n attributeBar.changeAttributeBar_1(-3);\n decrement_1 = -1;\n}", "addBudget() {\n html.showBudget(this.userBudget);\n }", "function createCapacity()\r\n{\r\n\tProcess.execute(\"createcapacity\", \"capacityoverview.do\");\r\n}", "function mkdfInitQuantityButtons() {\n \n $(document).on( 'click', '.mkdf-quantity-minus, .mkdf-quantity-plus', function(e) {\n e.stopPropagation();\n \n var button = $(this),\n inputField = button.siblings('.mkdf-quantity-input'),\n step = parseFloat(inputField.attr('step')),\n max = parseFloat(inputField.attr('max')),\n minus = false,\n inputValue = parseFloat(inputField.val()),\n newInputValue;\n \n if (button.hasClass('mkdf-quantity-minus')) {\n minus = true;\n }\n \n if (minus) {\n newInputValue = inputValue - step;\n if (newInputValue >= 1) {\n inputField.val(newInputValue);\n } else {\n inputField.val(0);\n }\n } else {\n newInputValue = inputValue + step;\n if ( max === undefined ) {\n inputField.val(newInputValue);\n } else {\n if ( newInputValue >= max ) {\n inputField.val(max);\n } else {\n inputField.val(newInputValue);\n }\n }\n }\n \n inputField.trigger( 'change' );\n });\n }", "function displayChoice1() {\n var heavyArmorButtonContainer = document.getElementById('heavyArmorButton');\n var lightArmorButtonContainer = document.getElementById('lightArmorButton');\n\n nextButtonDisabled(true);\n\n var heavy = document.createElement('button');\n heavy.textContent = 'select heavy armor and long sword';\n heavy.setAttribute('id', 'heavyButton');\n heavyArmorButtonContainer.appendChild(heavy);\n\n\n var light = document.createElement('button');\n light.textContent = 'select light armor and long bow';\n lightArmorButtonContainer.appendChild(light);\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::ApplicationInsights::Application.CustomComponent` resource
function cfnApplicationCustomComponentPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnApplication_CustomComponentPropertyValidator(properties).assertSuccess(); return { ComponentName: cdk.stringToCloudFormation(properties.componentName), ResourceList: cdk.listMapper(cdk.stringToCloudFormation)(properties.resourceList), }; }
[ "renderProperties(x) { return ui.divText(`Properties for ${x.name}`); }", "function cfnNetworkInsightsAnalysisAnalysisComponentPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnNetworkInsightsAnalysis_AnalysisComponentPropertyValidator(properties).assertSuccess();\n return {\n Arn: cdk.stringToCloudFormation(properties.arn),\n Id: cdk.stringToCloudFormation(properties.id),\n };\n}", "properties() {\n return this.display.show(\n this._section(\n Text(`Properties accessible from ${this.getSignature()}`),\n this._renderProperties(2, this.metadata.allProperties())\n )\n );\n }", "function renderJsxProp(name, value) {\n if (name === 'style') {\n value = stringifyObject(value, {\n singleQuotes: false,\n inlineCharacterLimit: Infinity\n });\n return `style={${value}}`;\n }\n\n if (typeof value === 'string') {\n const encodedValue = stringifyEntities(value, {\n subset: ['\"'],\n attribute: true\n });\n return `${name}=${JSON.stringify(encodedValue)}`;\n }\n\n return `${name}={${value}}`;\n}", "function cfnApplicationComponentMonitoringSettingPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnApplication_ComponentMonitoringSettingPropertyValidator(properties).assertSuccess();\n return {\n ComponentARN: cdk.stringToCloudFormation(properties.componentArn),\n ComponentConfigurationMode: cdk.stringToCloudFormation(properties.componentConfigurationMode),\n ComponentName: cdk.stringToCloudFormation(properties.componentName),\n CustomComponentConfiguration: cfnApplicationComponentConfigurationPropertyToCloudFormation(properties.customComponentConfiguration),\n DefaultOverwriteComponentConfiguration: cfnApplicationComponentConfigurationPropertyToCloudFormation(properties.defaultOverwriteComponentConfiguration),\n Tier: cdk.stringToCloudFormation(properties.tier),\n };\n}", "function cfnCustomResourcePropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnCustomResourcePropsValidator(properties).assertSuccess();\n return {\n ServiceToken: cdk.stringToCloudFormation(properties.serviceToken),\n };\n}", "function cfnCustomMetricPropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnCustomMetricPropsValidator(properties).assertSuccess();\n return {\n MetricType: cdk.stringToCloudFormation(properties.metricType),\n DisplayName: cdk.stringToCloudFormation(properties.displayName),\n MetricName: cdk.stringToCloudFormation(properties.metricName),\n Tags: cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags),\n };\n}", "async function componentUpdate() {\n const subscriptionId = \"subid\";\n const resourceGroupName = \"my-resource-group\";\n const resourceName = \"my-component\";\n const insightProperties = {\n kind: \"web\",\n location: \"South Central US\",\n tags: { applicationGatewayType: \"Internal-Only\", billingEntity: \"Self\" },\n };\n const credential = new DefaultAzureCredential();\n const client = new ApplicationInsightsManagementClient(credential, subscriptionId);\n const result = await client.components.createOrUpdate(\n resourceGroupName,\n resourceName,\n insightProperties\n );\n console.log(result);\n}", "function cfnConnectorCustomPluginPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnConnector_CustomPluginPropertyValidator(properties).assertSuccess();\n return {\n CustomPluginArn: cdk.stringToCloudFormation(properties.customPluginArn),\n Revision: cdk.numberToCloudFormation(properties.revision),\n };\n}", "function cfnCertificateCustomExtensionPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnCertificate_CustomExtensionPropertyValidator(properties).assertSuccess();\n return {\n Critical: cdk.booleanToCloudFormation(properties.critical),\n ObjectIdentifier: cdk.stringToCloudFormation(properties.objectIdentifier),\n Value: cdk.stringToCloudFormation(properties.value),\n };\n}", "inspect(inspector) {\n inspector.addAttribute(\"aws:cdk:cloudformation:type\", CfnCustomResource.CFN_RESOURCE_TYPE_NAME);\n inspector.addAttribute(\"aws:cdk:cloudformation:props\", this.cfnProperties);\n }", "function renderProperties(setup) {\n // print available exams\n var html = '';\n if (!('localStorage' in window)) {\n html += warning(getMessage('msg_options_change_disabled', 'Changing options is disabled, because your browser does not support localStorage.'));\n }\n for (var section in setup) {\n if (setup[section].opts.length) {\n html += '<p class=\"opts-header\">' + getMessage(section + '_label', setup[section].label) + '</p>';\n html += '<div class=\"list-group\">';\n for (var p in setup[section].opts) {\n html += prepareProperty(setup[section].opts[p]);\n }\n html += '</div>';\n }\n }\n renderElement('#app-properties', html);\n}", "function cfnAppMonitorCustomEventsPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnAppMonitor_CustomEventsPropertyValidator(properties).assertSuccess();\n return {\n Status: cdk.stringToCloudFormation(properties.status),\n };\n}", "async function componentCreate() {\n const subscriptionId = \"subid\";\n const resourceGroupName = \"my-resource-group\";\n const resourceName = \"my-component\";\n const insightProperties = {\n applicationType: \"web\",\n flowType: \"Bluefield\",\n requestSource: \"rest\",\n workspaceResourceId:\n \"/subscriptions/subid/resourcegroups/my-resource-group/providers/microsoft.operationalinsights/workspaces/my-workspace\",\n kind: \"web\",\n location: \"South Central US\",\n };\n const credential = new DefaultAzureCredential();\n const client = new ApplicationInsightsManagementClient(credential, subscriptionId);\n const result = await client.components.createOrUpdate(\n resourceGroupName,\n resourceName,\n insightProperties\n );\n console.log(result);\n}", "function cfnUserPoolCustomSMSSenderPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnUserPool_CustomSMSSenderPropertyValidator(properties).assertSuccess();\n return {\n LambdaArn: cdk.stringToCloudFormation(properties.lambdaArn),\n LambdaVersion: cdk.stringToCloudFormation(properties.lambdaVersion),\n };\n}", "function cfnWebACLCustomResponseBodyPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnWebACL_CustomResponseBodyPropertyValidator(properties).assertSuccess();\n return {\n Content: cdk.stringToCloudFormation(properties.content),\n ContentType: cdk.stringToCloudFormation(properties.contentType),\n };\n}", "renderCustomToolTip(props)\n {\n if (!props.active)\n {\n return null;\n }\n\n const { keyField } = this.props;\n const { activeDataField } = this.state;\n const { payload } = props.payload[0];\n const tooltip = `${payload[keyField.fieldKey]}: ${payload[activeDataField.fieldKey]}`\n return <div className='barchart-custom-tooltip'>{tooltip}</div>;\n }", "function displayCustomAttributes() {\n let customAttributeArray = Object.keys(CUSTOM_QUALIFICATION_DATA);\n let customAttributeHtml = \"\";\n for (let i = 0; i < customAttributeArray.length; i++) {\n customAttributeHtml = customAttributeHtml +\n customAttributeArray[i]+\":\"+\n \"<input type='text' id='custom\"+customAttributeArray[i]+\"'>\"+\n \"<br>\";\n }\n document.getElementById('customAttributes').innerHTML = customAttributeHtml;\n}", "function cfnStudioComponentStudioComponentInitializationScriptPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnStudioComponent_StudioComponentInitializationScriptPropertyValidator(properties).assertSuccess();\n return {\n LaunchProfileProtocolVersion: cdk.stringToCloudFormation(properties.launchProfileProtocolVersion),\n Platform: cdk.stringToCloudFormation(properties.platform),\n RunContext: cdk.stringToCloudFormation(properties.runContext),\n Script: cdk.stringToCloudFormation(properties.script),\n };\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a price, returns its pixel position
function getPixelY(vizState, price) { return vizState.canvasHeight - (((+price - vizState.minPrice) / (vizState.maxPrice - vizState.minPrice)) * vizState.canvasHeight); }
[ "getX(price) {\n const xRatio = (price - this.firstPrice) / (this.lastPrice - this.firstPrice)\n const x = this.leftYAxisX + this.chartWidth * xRatio\n\n // the coordinate should stay within the chart axis, hence the 1px max/min\n const leftCappedX = Math.max(x, this.leftYAxisX + 1)\n return Math.min(leftCappedX, this.rightYAxisX - 1)\n }", "function getPixelPos(x, y, tileWidth){\n return [\n (x / (tileWidth/2) + y / (tileWidth/4)) /2,\n (y / (tileWidth/4) -(x / (tileWidth/2))) /2\n ];\n}", "function pixelToOffset(pMousePosition) {\n let playground_position = display.getPlaygroundMousePosition(pMousePosition);\n playground_position.addToX(-setting_canvas_padding);\n playground_position.addToY(-setting_canvas_padding);\n return hexagon.getIndexFromPixel(playground_position);\n }", "function getTileIndex(pixel)\n{\n var position = pixel;\n return Math.round(position / TILE_WIDTH);\n}", "function getPointsForPrice() {\n var coords = [];\n // Loop through alla data points for AirBnB in San Francisco\n for (let t of data) {\n // Important difference between price and density heatmaps:\n // Price heatmap sets the price of an AirBnB data point as the weight of that point on the map_price\n // This makes more expensive areas of the city appear more RED\n var w = t.fields.price_night;\n coords.push({\n location: new google.maps.LatLng(t.fields.lat, t.fields.long),\n weight: w\n });\n }\n return coords\n}", "function iPixLoc (i) {return CELL_SIZE * i + (HALL_SIZE/2);} // index to pixel", "getOffsetLabelPrice(prices, pricetype) {\n const {xLabelSize} = this.props;\n var otherPricetype = this.otherPricetype(pricetype);\n var distanceY = 0;\n\n if (prices[otherPricetype] > 0) {\n distanceY = this.getSvgY(prices[pricetype])-this.getSvgY(prices[otherPricetype]);\n }\n\n if (distanceY === 0) {return 0;}\n\n if (Math.abs(distanceY) < xLabelSize) {\n // prices are too close\n if (distanceY < 0) {\n // this price is above the other\n return xLabelSize*(-0.5);\n } else {\n // this price is below the other\n return xLabelSize*0.25;\n }\n } else {\n return 0;\n }\n }", "pixelIndex(x, y) {\n return ImgUtil.pixelIndex(x, y, this.img);\n }", "function getPixelValue(value) {\n return parseFloat(value.replace(\"px\", \"\"));\n}", "function imgFractionalPos([posx, posy]) {\n let windowbox = Box(0, 0, window.innerWidth, window.innerHeight);\n let imgBox = windowbox.fitBox(Box(0, 0, 1, 1));\n return imgBox.getFractionalPosition([posx, posy]);\n}", "function pixelIndex(x, y, colorComp) {\n // x --> fi\n // y --> MAXradius - r\n // var xnew = Math.round( (y) * Math.cos( ((x / width) * 2*Math.PI) ) );\n // var ynew = Math.round( (y) * Math.sin( ((x / width) * 2*Math.PI) ) );\n var pixelIndex = (y * width + x) * numOfColorsAtIndex;\n // var pixelIndex = (ynew * width + xnew) * numOfColorsAtIndex;\n var colorCompOffset = 0;\n switch (colorComp) {\n case 'r':\n break;\n case 'g':\n colorCompOffset = 1;\n break;\n case 'b':\n colorCompOffset = 2;\n break;\n case 'a':\n colorCompOffset = 3;\n break;\n default:\n break;\n }\n return pixelIndex + colorCompOffset;\n }", "function imageIndexOf(x,y) {\n return x+(y+2)*(maxX+3)+topImages+3; } // This is the simplified version", "function getCoordinate(row, col) {\n\tvar index = 0;\n\tfor(var i = 0; i < row; i++) {\n\t\tif(i < 4) {\n\t\t\tindex += (4 + i);\n\t\t} else {\n\t\t\tindex += (6 - (i - 4));\n\t\t}\n\t}\n\tindex += col;\n\n\tvar position = $($(\"#placeHolders\").children()[index]).position();\n\treturn position;\n}", "function getXYPosition(square) {\r\n return {\r\n x: (square) % 10\r\n ,\r\n y: Math.floor((square) / 10)\r\n }\r\n}", "function calculatePosition(x, y) {\n\tvar position = y * cellXCount + x;\n\treturn position;\n}", "function pixelCoordinate(body){\n var result = {};\n result.x = body.state.pos.x + Globals.translation.x;\n result.y = body.state.pos.y - Globals.translation.y;\n return result;\n}", "function xyToIndex(x, y, imgWidth){\n return int((y * imgWidth) + x);\n}", "coordFromPosition(p) {\n return [ Math.floor(p/this.ibd.size), p % this.ibd.size ];\n }", "get priceInSatoshis () {\n const pricePerPixel = get(self, 'settings.pricePerPixel')\n return self.paintedPixelsCount * (pricePerPixel || 1)\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Maps tile ids to shape ids (both are nonnegative integers). Supports onetomany mapping (a tile may belong to multiple shapes) Also maps shape ids to tile ids. A shape may contain multiple tiles Also supports 'flattening' removing onetomany tileshape mappings by removing all but one shape from a tile. Supports onetomany mapping
function TileShapeIndex(mosaic, opts) { // indexes for mapping tile ids to shape ids var singleIndex = new Int32Array(mosaic.length); utils.initializeArray(singleIndex, -1); var multipleIndex = []; // index that maps shape ids to tile ids var shapeIndex = []; this.getTileIdsByShapeId = function(shapeId) { var ids = shapeIndex[shapeId]; // need to filter out tile ids that have been set to -1 (indicating removal) return ids ? ids.filter(function(id) {return id >= 0;}) : []; }; // assumes index has been flattened this.getShapeIdByTileId = function(id) { var shapeId = singleIndex[id]; return shapeId >= 0 ? shapeId : -1; }; // return ids of all shapes that include a tile this.getShapeIdsByTileId = function(id) { var singleId = singleIndex[id]; if (singleId >= 0) { return [singleId]; } if (singleId == -1) { return []; } return multipleIndex[id]; }; this.indexTileIdsByShapeId = function(shapeId, tileIds, weightFunction) { shapeIndex[shapeId] = []; for (var i=0; i<tileIds.length; i++) { indexShapeIdByTileId(shapeId, tileIds[i], weightFunction); } }; // remove many-to-one tile=>shape mappings this.flatten = function() { multipleIndex.forEach(function(shapeIds, tileId) { flattenStackedTile(tileId); }); multipleIndex = []; }; this.getUnusedTileIds = function() { var ids = []; for (var i=0, n=singleIndex.length; i<n; i++) { if (singleIndex[i] == -1) ids.push(i); } return ids; }; // used by gap fill; assumes that flatten() has been called this.addTileToShape = function(shapeId, tileId) { if (shapeId in shapeIndex === false || singleIndex[tileId] != -1) { error('Internal error'); } singleIndex[tileId] = shapeId; shapeIndex[shapeId].push(tileId); }; // add a shape id to a tile function indexShapeIdByTileId(shapeId, tileId, weightFunction) { var singleId = singleIndex[tileId]; if (singleId != -1 && opts.flat) { // pick the best shape if we have a weight function if (weightFunction && weightFunction(shapeId) > weightFunction(singleId)) { // replace existing shape reference removeTileFromShape(tileId, singleId); // bottleneck when overlaps are many singleIndex[tileId] = singleId; singleId = -1; } else { // keep existing shape reference return; } } if (singleId == -1) { singleIndex[tileId] = shapeId; } else if (singleId == -2) { multipleIndex[tileId].push(shapeId); } else { multipleIndex[tileId] = [singleId, shapeId]; singleIndex[tileId] = -2; } shapeIndex[shapeId].push(tileId); } function flattenStackedTile(tileId) { // TODO: select the best shape (using some metric) var shapeIds = multipleIndex[tileId]; // if (!shapeIds || shapeIds.length > 1 === false) error('flattening error'); var selectedId = shapeIds[0]; var shapeId; singleIndex[tileId] = selectedId; // add shape to single index // remove tile from other stacked shapes for (var i=0; i<shapeIds.length; i++) { shapeId = shapeIds[i]; if (shapeId != selectedId) { removeTileFromShape(tileId, shapeId); } } } function removeTileFromShape(tileId, shapeId) { var tileIds = shapeIndex[shapeId]; for (var i=0; i<tileIds.length; i++) { if (tileIds[i] === tileId) { tileIds[i] = -1; break; } } } // This function was a bottleneck in datasets with many overlaps function removeTileFromShape_old(tileId, shapeId) { shapeIndex[shapeId] = shapeIndex[shapeId].filter(function(tileId2) { return tileId2 != tileId; }); if (shapeIndex[shapeId].length > 0 === false) { // TODO: make sure to test the case where a shape becomes empty // error("empty shape") } } }
[ "function drawShapes( ctx ) {\n map_tiles.map(( col, c ) => {\n col.map(( row, r ) => {\n let item = row;\n item.shape.draw( ctx );\n });\n });\n }", "updateMap() {\n const shape = this.shape,\n data = this.shape.shape,\n map = this.map,\n pos = map.getTileIndexFromPixel(shape.x, shape.y),\n buffer = shape.getMatrix(),\n rows = data.height / map.tileHeight,\n cols = data.width / map.tileWidth;\n\n for (let j = 0; j < rows; ++j) {\n for (let i = 0; i < cols; ++i) {\n if (buffer[j * cols + i]) {\n map.updateTile(pos.x + i, pos.y + j, data.color, Tile.TYPE.WALL);\n }\n }\n }\n }", "function applyShape() {\n for (var row = 0; row < actualShape.shape.length; row++) {\n for (var col = 0; col < actualShape.shape[row].length; col++) {\n if (actualShape.shape[row][col] !== 0) {\n grid[actualShape.y + row][actualShape.x + col] = actualShape.shape[row][col];\n }\n }\n }\n }", "getShapeNameMap() {\n let nameMap = {canvas: 'canvas'};\n InstructionTreeNode\n .flatten(this.instructions)\n .filter(i => i instanceof DrawInstruction)\n .forEach(i => {\n nameMap[i.shapeId] = i.name || i.id;\n });\n return nameMap;\n }", "function drawMapTiles(svg) {\n if (Maze.wordSearch) {\n return Maze.wordSearch.drawMapTiles(svg);\n } else if (mazeUtils.isScratSkin(skin.id)) {\n return scrat.drawMapTiles(svg);\n }\n\n // Compute and draw the tile for each square.\n var tileId = 0;\n var tile, origTile;\n for (var y = 0; y < Maze.ROWS; y++) {\n for (var x = 0; x < Maze.COLS; x++) {\n // Compute the tile index.\n tile = isOnPathStr(x, y) + isOnPathStr(x, y - 1) + // North.\n isOnPathStr(x + 1, y) + // West.\n isOnPathStr(x, y + 1) + // South.\n isOnPathStr(x - 1, y); // East.\n\n var adjacentToPath = tile !== '00000';\n\n // Draw the tile.\n if (!TILE_SHAPES[tile]) {\n // We have an empty square. Handle it differently based on skin.\n if (mazeUtils.isBeeSkin(skin.id)) {\n // begin with three trees\n var tileChoices = ['null3', 'null4', 'null0'];\n var noTree = 'null1';\n // want it to be more likely to have a tree when adjacent to path\n var n = adjacentToPath ? tileChoices.length * 2 : tileChoices.length * 6;\n for (var i = 0; i < n; i++) {\n tileChoices.push(noTree);\n }\n\n tile = _.sample(tileChoices);\n } else {\n // Empty square. Use null0 for large areas, with null1-4 for borders.\n if (!adjacentToPath && Math.random() > 0.3) {\n Maze.wallMap[y][x] = 0;\n tile = 'null0';\n } else {\n var wallIdx = Math.floor(1 + Math.random() * 4);\n Maze.wallMap[y][x] = wallIdx;\n tile = 'null' + wallIdx;\n }\n\n // For the first 3 levels in maze, only show the null0 image.\n if (level.id == '2_1' || level.id == '2_2' || level.id == '2_3') {\n Maze.wallMap[y][x] = 0;\n tile = 'null0';\n }\n }\n }\n\n Maze.drawTile(svg, TILE_SHAPES[tile], y, x, tileId);\n\n // Draw checkerboard for bee.\n if (Maze.gridItemDrawer instanceof BeeItemDrawer && (x + y) % 2 === 0) {\n var isPath = !/null/.test(tile);\n Maze.gridItemDrawer.addCheckerboardTile(y, x, isPath);\n }\n\n tileId++;\n }\n }\n}", "getId(shape) {\n for (var i = 0; i < shape.length; i++) {\n for (var j = 0; j < shape[i].length; j++) {\n if (shape[i][j] != 0) {\n return shape[i][j]\n }\n }\n }\n }", "function deleteAllShape() {\n for (var i = 0; i < $scope.allShapes.length; i++) {\n $scope.allShapes[i].overlay.setMap(null);\n }\n $scope.allShapes = [];\n selectedShape = null;\n }", "drawWallTile(c, x, y, id, colors) {\n\n const LEFT = 0;\n const TOP = 1;\n const RIGHT = 2;\n const BOTTOM = 3;\n\n let lw = Tile.Width/5;\n let lh = Tile.Height/5;\n\n let empty = [\n this.getTile(x-1, y) != id, // Left,\n this.getTile(x, y-1) != id, // Top\n this.getTile(x+1, y) != id, // Right,\n this.getTile(x, y+1) != id, // Bottom\n ]\n\n // Base shape\n c.setColor(...colors[4]);\n c.fillShape(Shape.Rect,\n x * Tile.Width, y * Tile.Height,\n Tile.Width, Tile.Height);\n\n // Right empty\n if (empty[RIGHT]) {\n\n c.setColor(...colors[RIGHT]);\n c.fillShape(Shape.Rect,\n x * Tile.Width + (Tile.Width-lw), \n y * Tile.Height,\n lw, Tile.Height);\n }\n // Bottom empty\n if (empty[BOTTOM]) {\n\n c.setColor(...colors[BOTTOM]);\n c.fillShape(Shape.Rect,\n x * Tile.Width , \n y * Tile.Height + (Tile.Height-lh),\n Tile.Width, lh);\n\n // Right empty\n if (empty[RIGHT]) {\n\n c.setColor(...colors[RIGHT]);\n c.fillShape(Shape.RAngledTriangle,\n x * Tile.Width + (Tile.Width-lw), \n y * Tile.Height + (Tile.Height-lh),\n -lw, -lh);\n }\n }\n // Left empty\n if (empty[LEFT]) {\n\n c.setColor(...colors[LEFT]);\n c.fillShape(Shape.Rect,\n x * Tile.Width, \n y * Tile.Height,\n lw, Tile.Height);\n\n // Bottom empty\n if (empty[BOTTOM]) {\n\n c.setColor(...colors[BOTTOM]);\n c.fillShape(Shape.RAngledTriangle,\n x * Tile.Width, \n y * Tile.Height + (Tile.Height-lh),\n -lw, lh);\n }\n }\n // Top empty\n if (empty[TOP]) {\n\n c.setColor(...colors[TOP]);\n c.fillShape(Shape.Rect,\n x * Tile.Width , \n y * Tile.Height,\n Tile.Width, lh);\n\n // Left empty\n if (empty[LEFT]) {\n\n c.setColor(...colors[LEFT]);\n c.fillShape(Shape.RAngledTriangle,\n x * Tile.Width , \n y * Tile.Height,\n lw, lh);\n }\n // Right empty\n if (empty[RIGHT]) {\n\n c.setColor(...colors[RIGHT]);\n c.fillShape(Shape.RAngledTriangle,\n x * Tile.Width + (Tile.Width-lw), \n y * Tile.Height,\n -lw, lh);\n }\n }\n\n //\n // Corners\n //\n const MX = [0, 1, 1, 0];\n const MY = [0, 0, 1, 1];\n const FX = [-1, -1, 1, 1];\n const FY = [-1, 1, 1, -1];\n let k, m;\n for (let i = 0; i < 4; ++ i) {\n\n // Check if empty\n k = MX[i];\n m = MY[i];\n if (!empty[i] && !empty[(i+1) % 4] &&\n this.getTile(x - 1 + 2 * k, y - 1 + 2 * m) != id) {\n\n c.setColor(...colors[i]);\n c.fillShape(Shape.RAngledTriangle,\n x * Tile.Width + (Tile.Width-lw) * k, \n y * Tile.Height + (Tile.Height-lh) * m,\n lw * FX[i], lh * FY[i]);\n\n c.setColor(...colors[(i+1) % 4]);\n c.fillShape(Shape.RAngledTriangle,\n x * Tile.Width + (Tile.Width-lw) * k, \n y * Tile.Height + (Tile.Height-lh) * m,\n -lw * FX[i], -lh * FY[i]); \n }\n }\n\n }", "function explodeShapeLayer() {\n var comp = app.project.activeItem;\n var lyr = comp.selectedLayers[0];\n var contentCount = lyr.property(\"ADBE Root Vectors Group\").numProperties;\n var dupLyrArr = [];\n\n\n dup(contentCount);\n removeAllButOne();\n\n\n //duplicates layer n times\n function dup(n) {\n for (var i = 0; i < n; i++) {\n var dupLyr = lyr.duplicate();\n dupLyrArr.push(dupLyr);\n }\n lyr.enabled = false;\n }\n\n\n //removes all but one shape from each layer\n function removeAllButOne() {\n for (var i = 0; i < dupLyrArr.length; i++) {\n for (var j = contentCount; j > 0; j--) {\n if (i + 1 !== j) {\n dupLyrArr[i].content(j).remove();\n }\n }\n }\n }\n}", "function toggleShape(shapeID,forcetoggle=false,layerID=undefined){\n\tswitch(jsonData.shapes[shapeID].type){\n\t\tcase 'building': \n\t\t\tif(layerID==undefined){\n\t\t\t\tjsonData.shapes[shapeID]=toggleBuilding(jsonData.shapes[shapeID]);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tjsonData.layers[layerID].shapesObjects[shapeID]=toggleBuilding(jsonData.layers[layerID].shapesObjects[shapeID]);\n\t\t\t}\n\t\tbreak;\n\t\tcase 'circle':\n\t\t\tif(layerID==undefined){\n\t\t\t\tjsonData.shapes[shapeID]=toggleCircle(jsonData.shapes[shapeID]);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tjsonData.layers[layerID].shapesObjects[shapeID]=toggleCircle(jsonData.layers[layerID].shapesObjects[shapeID]);\n\t\t\t}\n\t\tbreak;\n\t\tcase 'polyline': \n\t\t\tif(layerID==undefined){\n\t\t\t\tjsonData.shapes[shapeID]=togglePolyline(jsonData.shapes[shapeID]);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tjsonData.layers[layerID].shapesObjects[shapeID]=togglePolyline(jsonData.layers[layerID].shapesObjects[shapeID]);\n\t\t\t}\n\t\tbreak;\n\t\tcase 'polygon': \n\t\t\tif(layerID==undefined){\n\t\t\t\tjsonData.shapes[shapeID]=togglePolygon(jsonData.shapes[shapeID]);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tjsonData.layers[layerID].shapesObjects[shapeID]=togglePolygon(jsonData.layers[layerID].shapesObjects[shapeID]);\n\t\t\t}\n\t\tbreak;\n\t\tcase 'parking': \n\t\t\tif(layerID==undefined){\n\t\t\t\tjsonData.shapes[shapeID]=toggleParking(jsonData.shapes[shapeID]);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tjsonData.layers[layerID].shapesObjects[shapeID]=toggleParking(jsonData.layers[layerID].shapesObjects[shapeID]);\n\t\t\t}\n\t\tbreak;\n\t\tcase 'poi': \n\t\t/*\n\t\t\tif(layerID==undefined){\n\t\t\t\tjsonData.shapes[shapeID]= togglePOI(jsonData.shapes[shapeID]);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tjsonData.layers[layerID].shapesObjects[shapeID]= togglePOI(jsonData.layers[layerID].shapesObjects[shapeID]);\n\t\t\t}\n\t\tbreak;\n\t\t*/\n\t\tcase 'poi': togglePOI(shapeID,forcetoggle);\n\t\tbreak;\n\t}\n}", "function shape_id_to_shape_dict(shape_id){\n let myshapes = all_shapes[shape_id];\n return said_to_dict(myshapes);\n}", "function fillTileIds() {\n\n let geojson = JSON.parse(fs.readFileSync(process.env.PATH_GEOJSON_BRASIL, 'utf8'));\n\n geojson.features.forEach(feature => {\n\n tileIDs.push(feature.properties.TileID);\n\n SentinelTile.findOne({id: feature.properties.TileID})\n .exec()\n .then((tile) => {\n if (!tile)\n new SentinelTile({id: feature.properties.TileID}).save();\n });\n\n // SentinelTile.findOneOrCreate({id: feature.properties.TileID});\n // new SentinelTile({id: feature.properties.TileID}).save();\n\n });\n\n}", "function convertTileID(tileId, tileset) {\n // We don't support the flipped diagonally flag or tile values greater than 511\n if ((tileId & TILED_DFLIP_BIT) !== 0) {\n throw new Error('Diagonally flipped bits are not supported: tileId = ' + tileId.toString(16));\n }\n\n const hflip = (tileId & TILED_HFLIP_BIT) !== 0;\n const vflip = (tileId & TILED_VFLIP_BIT) !== 0;\n\n // Mask out the flip bits\n const tileIndex = tileId & 0x1FFFFFFF;\n if (tileIndex >= 512) {\n throw new Error('A maximum of 511 tiles are supported');\n }\n\n if (tileIndex === 0) {\n // This should be a warning\n return 0;\n }\n\n // The tileId starts at one, but the tile set starts at zero. It's ok when we export,\n // because a special zero tile is inserted, but we have to manually adjust here\n if (!tileset[tileIndex - 1]) {\n throw new Error(`Tileset for tileId ${tileIndex} is underinfed`);\n }\n const mask_bit = (!tileset[tileIndex - 1].isSolid || tileIndex === GLOBALS.emptyTile) && ((GLOBALS.tileLayers.length !== 1) || GLOBALS.forceMasked);\n\n /*\n if (tileIndex === 48) {\n console.warn('isSolid: ', tileset[tileIndex - 1].isSolid);\n console.warn('GLOBALS.emptyTile: ', GLOBALS.emptyTile);\n console.warn('GLOBALS.tileLayers.length: ', GLOBALS.tileLayers.length);\n console.warn('GLOBALS.forceMasked: ', GLOBALS.forceMasked);\n console.warn('mask_bit: ', mask_bit);\n }\n */\n\n // Build up a partial set of control bits\n let control_bits = (mask_bit ? GTE_MASK_BIT : 0) + (hflip ? GTE_HFLIP_BIT : 0) + (vflip ? GTE_VFLIP_BIT : 0);\n\n // Check if this is an animated tile. If so, substitute the index of the animation slot for\n // the tile ID\n if (tileset[tileIndex - 1].animation) {\n const animation = tileset[tileIndex - 1].animation;\n tileId = animation.dynTileId * 4; // pre-map the ID -> byte offset\n control_bits = GTE_DYN_BIT;\n\n console.warn('Dyanmic animation tile found!');\n console.warn('isSolid: ', tileset[tileIndex - 1].isSolid);\n console.warn('dynTileId: ', animation.dynTileId);\n console.warn('mask_bit: ', mask_bit);\n }\n\n return (tileId & 0x1FFFFFFF) + control_bits;\n}", "function mapClearPolygons() {\n for (let id in polygons)\n polygons[id].forEach(p => p.setMap(null));\n polygons = {};\n}", "function deleteShape(objectId, hidePopup) {\n //Delete graphic\n var graphicsLayerInput = dojo.byId(LAYER_ID_KEY);\n var graphicsLayerId = graphicsLayerInput.value;\n var layer = map.getLayer(graphicsLayerId);\n for (var graphicIndex = 0; graphicIndex < layer.graphics.length; graphicIndex++) {\n if (layer.graphics[graphicIndex].attributes && layer.graphics[graphicIndex].attributes[\"OBJECTID\"] == objectId) {\n //Remove from addedGraphics\n var addedGraphicsIndex = addedGraphics.indexOf(layer.graphics[graphicIndex]);\n if (0 <= addedGraphicsIndex) {\n addedGraphics.splice(addedGraphicsIndex, 1);\n }\n //Remove from graphics layer\n layer.remove(layer.graphics[graphicIndex]);\n break;\n }\n }\n \n //Delete from itemInfo object, which will get saved to the Web map when saveWebMap is called\n var opLayerId;\n var found = false;\n for (var opLayerIndex = 0; opLayerIndex < itemInfo.itemData.operationalLayers.length && !found; opLayerIndex++) {\n var featureCollection = itemInfo.itemData.operationalLayers[opLayerIndex].featureCollection;\n var layerIndex;\n for (layerIndex = 0; layerIndex < featureCollection.layers.length && !found; layerIndex++) {\n var layer = featureCollection.layers[layerIndex];\n if (graphicsLayerId == layer.id) {\n var features = layer.featureSet.features;\n var featureIndex;\n for (featureIndex = 0; featureIndex < features.length && !found; featureIndex++) {\n if (features[featureIndex].attributes[\"OBJECTID\"] == objectId) {\n features.splice(featureIndex, 1);\n opLayerId = itemInfo.itemData.operationalLayers[opLayerIndex].id;\n found = true;\n }\n }\n }\n }\n }\n \n if (opLayerId) {\n require([\"dijit/registry\"], function (registry) {\n if (registry.byId(\"labelFeaturesMenuItem\").checked) {\n labelLayerChecked(opLayerId, false);\n labelLayerChecked(opLayerId, true);\n }\n });\n }\n \n if (map.infoWindow.features.length > 1) {\n //Remove deleted feature from the infoWindow and select another feature\n var feature = map.infoWindow.getSelectedFeature();\n for (var featureIndex = 0; featureIndex < map.infoWindow.features.length; featureIndex++) {\n if (feature === map.infoWindow.features[featureIndex]) {\n map.infoWindow.features.splice(featureIndex, 1);//i.e. remove feature at featureIndex\n map.infoWindow.select(0 == featureIndex ? 0 : featureIndex - 1);\n break;\n }\n }\n } else if (undefined == hidePopup || true == hidePopup) {\n map.infoWindow.hide();\n }\n}", "function resetShapes() {\n\tvar scale;\n\n\tselectedItem1 = -1;\n\tselectedItem2 = -1;\n\t\n\tshapeOrder = [];\n\t\n\tfor (var i=0; i<items.length; i++) {\n\t\titems[i].currLocID = items[i].startLocID;\n\t\titems[i].x = locations[items[i].currLocID].x;\n\t\titems[i].y = locations[items[i].currLocID].y;\n\t\titems[i].targetLocID = -1;\n\t}\n\n\t\n\tfor (i=0; i<shapes.length; i++) {\n\t\tshapeOrder[i] = i;\n\t\t\n\t\tshapes[i].active = shapes[i].defaultActive;\n\t}\n\t\n\n\tfor (i=0; i<items.length; i++) {\n\t\tif (shapes[items[i].id].active) {\n\t\t\titems[i].scale = scaleNormal;\n\t\t} else {\n\t\t\titems[i].scale = scaleDisabled;\n\t\t}\n\t}\n\t\n\tfor (i=0; i<maps.length; i++) {\n\t\tmaps[i].visible = maps[i].defaultVisible;\n\t}\n\n\tif (leyLineMode) {\n\t\tupdateLines = true;\n\t\trebuildLines();\n\t} else {\t\t\n\t\tlines = [];\n\t}\n}", "function mapTilesToGrid () {\n clearSpaceDivPosition = 0;\n var tileID = '';\n for (var j in tileOrder) {\n //console.log(\"sending for tile id=\"+tiles[i].id);\n tileID = tileOrder[j];\n gridId = placeTileOnGrid (tiles[tileID]);\n tiles[tileID].gridId = gridId;\n\n tiles[tileID].width = (tiles[tileID].size == \"small\") ? small_tile_size : ((tiles[tileID].size == \"medium\") ? medium_tile_size : big_tile_size);\n tiles[tileID].height = (tiles[tileID].size == \"small\") ? small_tile_size : ((tiles[tileID].size == \"big\") ? big_tile_size : medium_tile_size); \n tiles[tileID].bgColor = tiles[tileID].bgColor || colorCodes[Math.floor(Math.random()*colorCodes.length)];\n tiles[tileID].top = grids[gridId].top;\n tiles[tileID].left = grids[gridId].left;\n\n clearSpaceDivPosition = ((tiles[tileID].top+tiles[tileID].height) > clearSpaceDivPosition) ? (tiles[tileID].top+tiles[tileID].height) : clearSpaceDivPosition; \n }\n\n //TM.clearSpaceDivPosition = clearSpaceDivPosition;\n }", "function genMap()\r\n\t{\r\n\t\tvar EDGE = 2;\t\t//defaults to fenceless edge\r\n\t\tvar CORNER = 3;\t\t//defaults to fenceless corner\r\n\r\n\t\tif (Math.random() > 0.5)//random fence\r\n\t\t{\r\n\t\t\tEDGE = 4;\r\n\t\t\tCORNER = 5;\r\n\t\t}\r\n\r\n\t\tfor (var x = 0; x < tileCountX; x++)\r\n\t\t{\r\n\t\t\tvar id = 0;\r\n\t\t\tvar rotation = 0;\r\n\r\n\t\t\tspriteTiles[x] = [];\r\n\t\t\tfor (var y = 0; y < tileCountY; y++)\r\n\t\t\t{\r\n\t\t\t\tid = 0;\r\n\t\t\t\trotation = getRandom(0, 3);\r\n\r\n\t\t\t\t//level border in clockwise order from top left\r\n\t\t\t\tif (y == 0)\t\t\t\t\t\t\t\t\t// top side\r\n\t\t\t\t{\r\n\t\t\t\t\tid = EDGE;\r\n\t\t\t\t\trotation = 0;\r\n\t\t\t\t}\r\n\t\t\t\tif (x == tileCountX - 1)\t\t\t\t\t// right side\r\n\t\t\t\t{\r\n\t\t\t\t\tid = EDGE;\r\n\t\t\t\t\trotation = 1;\r\n\t\t\t\t}\r\n\t\t\t\tif (y == tileCountY - 1)\t\t\t\t\t// bottom side\r\n\t\t\t\t{\r\n\t\t\t\t\tid = EDGE;\r\n\t\t\t\t\trotation = 2;\r\n\t\t\t\t}\r\n\t\t\t\tif (x == 0)\t\t\t\t\t\t\t\t// left side\r\n\t\t\t\t{\r\n\t\t\t\t\tid = EDGE;\r\n\t\t\t\t\trotation = 3;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//level corner --- draws over border\r\n\t\t\t\tif (x == 0 && y == 0)\r\n\t\t\t\t{\t\t\t\t\t//NW\r\n\t\t\t\t\tid = CORNER;\r\n\t\t\t\t\trotation = 0;\r\n\t\t\t\t}\r\n\t\t\t\tif (x == tileCountX - 1 && y == 0)\t\t\t//NE\r\n\t\t\t\t{\r\n\t\t\t\t\tid = CORNER;\r\n\t\t\t\t\trotation = 1;\r\n\t\t\t\t}\r\n\t\t\t\tif (x == tileCountX - 1 && y == tileCountY - 1)\t//SE\r\n\t\t\t\t{\r\n\t\t\t\t\tid = CORNER;\r\n\t\t\t\t\trotation = 2;\r\n\t\t\t\t}\r\n\t\t\t\tif (x == 0 && y == tileCountY - 1)\t\t\t//SW\r\n\t\t\t\t{\r\n\t\t\t\t\tid = CORNER;\r\n\t\t\t\t\trotation = 3;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//random rocks 1 space inside border\r\n\t\t\t\tif (x >= 1 && x <= (tileCountX - 1) - 1)\r\n\t\t\t\t\tif (y >= 1 && y <= (tileCountY - 1) - 1)\r\n\t\t\t\t\t\tif (Math.random() > 0.9)\r\n\t\t\t\t\t\t\tid = (Math.random() > 0.5 ? 1 : 7);\r\n\r\n\r\n\t\t\t\tspriteTiles[x].push(new spriteID(id, rotation));\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function clipShapeRemove(id) {\n if (clipShapes_[id]) {\n delete clipShapes_[id];\n generateAlphaMap();\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a reference to the current period's horizontal FireMeshLine ignition points
horzIgnitionPoints () { return this._horzIgnitions }
[ "get leftLine() {\n if (!this._leftLine) {\n this._leftLine = new Line(this.leftTopPoint, this.leftBottomPoint)\n }\n return this._leftLine\n }", "get horizontalLineVisibility() {\r\n return this.i.pl;\r\n }", "getHorizontalLine(slab) {\n // console.log(\"getHorizontalLine() -- \" + this.arrAllLines.length);\n let retElement;\n if (this.arrAllLines.length > 0) {\n this.arrAllLines.forEach((element) => {\n if (element.topY === slab.yPosition) {\n retElement = element;\n }\n });\n }\n return retElement;\n }", "getVertIgnitionPoints () {\n // const spacing = this.bounds().ySpacing()\n const pts = []\n this._vert.forEach((line, lineIdx) => {\n const x = line.anchor()\n // const left = (lineIdx === 0) ? null : this.vertLine(lineIdx - 1)\n // const right = (lineIdx >= this._vert.length - 1) ? null : this.vertLine(lineIdx + 1)\n line.segments().forEach(segment => {\n if (segment.isBurned()) {\n pts.push([x, segment.begins()]) // always ignite the first endpoint\n // ignite any points between the endpoints that is unburned either above or below it\n // for (let y = segment.begins() + spacing; y < segment.ends(); y += spacing) {\n // if ((left && left.isUnburnedAt(y)) || (right && right.isUnburnedAt(y))) pts.push([x, y])\n // }\n // ignite the second endpoint if its not already in the array\n if (pts[pts.length - 1][1] !== segment.ends()) pts.push([x, segment.ends()])\n }\n })\n })\n return pts\n }", "function calculateLeftLine() {\n let newDefzone = 0 - DEF_DEFZONE;\n const tmfp = thirdMostForwardPlayer(2);\n const thirdMostForwardPlayerLine = tmfp.position.x + PLAYER_RADIUS;\n\n if (thirdMostForwardPlayerLine < newDefzone) {\n newDefzone = thirdMostForwardPlayerLine;\n }\n\n return newDefzone;\n}", "vertIgnitionPoints () { return this._vertIgnitions }", "X(){return this.faceXAxis;}", "get initialPoint()\r\n {\r\n return this.cPoints[0];\r\n }", "get xAxis() {\r\n if (this.i.l7 == null) {\r\n return null;\r\n }\r\n if (!this.i.l7.externalObject) {\r\n let e = IgxNumericXAxisComponent._createFromInternal(this.i.l7);\r\n if (e) {\r\n e._implementation = this.i.l7;\r\n }\r\n this.i.l7.externalObject = e;\r\n }\r\n return this.i.l7.externalObject;\r\n }", "getTieLeftX() {\n let tieEndX = this.getAbsoluteX();\n tieEndX += this.x_shift - this.extraLeftPx;\n return tieEndX;\n }", "horzLine (idx) { return this._horz[idx] }", "function d3_svg_lineX(d) {\r\n return d[0];\r\n}", "inward(){\n\t\treturn this.p.createVector(\n\t\t\t-this.position.x,\n\t\t\t-this.position.y\n\t\t).normalize();\n\t}", "initialPoint()\r\n {\r\n return this.transformedPoints[0];\r\n }", "function __lineX(line, y) {\n return line.vertical?\n line.x:\n (y - line.d) / line.k;\n}", "getNoteHeadBeginX() {\n return this.getAbsoluteX() + this.x_shift;\n }", "getOriginLineIndex(me) {\n let originIndex = 0;\n for (let i = 0; i < me.series.length; i++) {\n if (me.series[i].name === 'base line') {\n originIndex = i;\n break;\n }\n }\n return originIndex;\n }", "getTieLeftX() {\n let tieEndX = this.getAbsoluteX();\n const note_glyph_width = this.glyph.getWidth();\n tieEndX += note_glyph_width / 2;\n tieEndX -= (this.width / 2) + 2;\n\n return tieEndX;\n }", "function get_line_x1(step) {\n\treturn 75 + step * 50;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
a helper function to determine whether a list of time off requests contains a given day
function timeOffRequestContains(indicesList, day, timeoff) { let contains = false; //if there is more than one request object, loop through every list if (indicesList.length > 1) { for (let i = 0; i < indicesList.length; i++) { for (let j = 0; j < timeoff[indicesList[i]].days.length; j++) { if (timeoff[indicesList[i]].days[j] === day) { contains = true; } } } } //else, just loop through the single request object else { let index = indicesList[0]; for (let i = 0; i < timeoff[index].days.length; i++) { if (timeoff[index].days[i] === day) { contains = true; } } } return contains; }
[ "function timeOffRequestContains(indicesList, day){\n var contains = false;\n\n //if there is more than one request object, loop through every list\n if(indicesList.length > 1){\n for(var i = 0; i < indicesList.length; i++){\n for(var j = 0; j < timeOffData[indicesList[i]].days.length; j++){\n if(timeOffData[indicesList[i]].days[j] === day){\n contains = true;\n }\n }\n }\n }\n //else, just loop through the single request object\n else{\n var index = indicesList[0];\n for(var i = 0; i < timeOffData[index].days.length; i++){\n if(timeOffData[index].days[i] === day){\n contains = true;\n }\n }\n }\n\n return contains;\n}", "function isDayOff(date) {\n // Check if 'date' is a weekend\n if (date.getDay() == 0 || date.getDay() == 6) {\n return true;\n }\n\n // Check if 'date' is a schedule day off\n var daysOff = [ \"2015-3-31\", \"2015-4-1\", \"2015-4-2\", \"2015-4-3\", \"2015-5-25\" ];\n var dayOff;\n for (i = 0; i < daysOff.length - 1; i++) {\n dayOff = new Date(daysOff[i]);\n\n if (datesEqual(dayOff, date)) {\n return true;\n }\n }\n return false;\n}", "function checkTime() {\n var numberToDay = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];\n // create a time\n var d = new Date();\n var today = d.getDay();\n var hms = ('0' + d.getHours()).slice(-2)+\":\"+('0' + d.getMinutes()).slice(-2); // 0 + ... slice(-2) ensures leading zero\n // iterate through the array for today and return true if current time is in range of condition test\n if( timeDb[numberToDay[today]].some(function(t){ return hms >= t.start && hms <= t.end; }) ) {\n ajax_post(ajaxVars); // returned true\n } \n else {\n document.getElementById(\"status\").innerHTML = \"Data not scheduled to be posted to the server yet\"; // returned false\n }\n}", "function date_check(date){\n\tfor (var i = 0; i < ufo_data.length; i++){\n\t\tif (ufo_data[i].datetime === date){\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "function dateTimeExistsInSet() { //todo: it seems this fucntion could be generalized to look at a passed key rather than the eventCounter? Why?\n\tvar keyStr = '!C&' + eventCounter;\n\tvar dateStr = $('#beginDate').val();\n\tvar timeStr = $('#beginTime').val();\n\tconsole.log(\"keyStr: \" + keyStr);\n\n\tconsole.log(\" bDate: \" + dateStr + \" bTime: \" + timeStr);\n\tfor (i = 0; i < ls.length; i++) {\n\t\tif (ls.key(i).indexOf(keyStr) !== -1) {\n\t\t\tvar idx = ls.key(i);\n\t\t\tif (dateStr == getURIItem(idx, 'beginDate')) {\n\t\t\t\tif (timeStr == getURIItem(idx, 'beginTime')) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n}", "function isScheduledToday(dayid, arrSchedule) {\n for (var i = 1; i < arrSchedule.length; i++) {\n if (arrSchedule[i].dayid === dayid && arrSchedule[i].status === 2) {\n return true;\n }\n }\n return false;\n }", "_isWithinDay(now, date) {\n const diff = -date.diff(now);\n return diff < Duration.DAY && date.day() === now.getDay();\n }", "function fullTimeWorkingDay(dayWage)\n{\n return dayWage.includes(\"160\");\n}", "function isDay()\n{\n if(days.indexOf(new Date().getDay())>=0){\n return true;\n }else{\n return false;\n }\n}", "function checkForEvents(day) {\n\tvar numevents = 0;\n\n\tcheckValidEvents(events)\n\n\tfor (var i = 0; i < events.length; i++) {\n\n\t\tif ((events[i][1] == day))\n\t\t\tnumevents++;\n\t}\n\n\tif (numevents == 0) {\n\t\treturn false;\n\t} else {\n\t\treturn true;\n\t}\n}", "function verifyDate(d){\n\tvar dow = new Date(d);\n\tvar day = dow.getDay();\n\tif ((day == 6 || day == 0) && !opts.weekdays){\n\t\treturn false;\n\t} else {\n\t\t//check for holiday\n\t\tfor (var i = 0; i < holidata.length; i++){\n\t\t\tif (holidata[i][0] == (dow.getMonth() + 1) && holidata[i][1] == dow.getDate() && !opts.holidays){\n\t\t\t\t//console.log('avoided holiday on:' + holidata[i]);\n\t\t\t\treturn false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t//return true if not duplicate\n\t\tif (!opts.dupe && isDupe(d, sampleDateArray)){\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n}", "outsideTimeFrame() {\n\t\tconst date = new Date();\n\t\tconst weekday = date.getDay() || 7; // JavaScript days are Sun-Sat 0-6 but we want Mon-Sun 1-7.\n\t\tconst hour = date.getHours();\n\n\t\tif (weekday < window.pizzakitTimes.start.weekday) {\n\t\t\treturn true;\n\t\t}\n\t\telse if (weekday == window.pizzakitTimes.start.weekday) {\n\t\t\tif (hour < window.pizzakitTimes.start.hours) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (window.pizzakitTimes.end.weekday < weekday) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse if (window.pizzakitTimes.end.weekday == weekday) {\n\t\t\t\tif (window.pizzakitTimes.end.hours <= hour) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "function inBusinessHours(date, businessHours) {\n let dateDay = date.getUTCDay();\n for (var i = 0; i < businessHours.length; i++) {\n // check if date should conform to this dict's start and end times\n if (businessHours[i].daysOfWeek.includes(dateDay)) {\n // toLocaleTimeString with arg it-IT will return 24hr time\n let dateStr = date.toUTCString()\n var arr = dateStr.split(\" \")[4].split(\":\");\n arr.pop();\n timeStr = arr.join(\":\");\n\n // if time after or equal to business hour start for day\n if (businessHours[i].startTime <= timeStr) {\n // if time before or equal to business hour end for day\n if (businessHours[i].endTime >= timeStr) {\n return true\n }\n }\n // if the day matches, but any of the times do not, dont check any more\n // days and just return false immediately\n return false\n }\n }\n // if date clicked's weekday is not in businessHours at all\n return false;\n }", "function isDoctorOfficeDay(date, doctorOfficeDays)\n{\n var day = date.getDay();\n\n return doctorOfficeDays.map(function(day) {\n return day.iso;\n }).includes(day);\n}", "function checkDay(message) {\n var d = today.toLocaleString('en-us', {weekday: 'long'});\n for (var key in message) {\n var startHour = message[key][0];\n var endHour = message[key][1];\n if ((key == d) && (today.getHours() >= startHour && today.getHours() <= endHour)) {\n isAnyActiveMessage = 1;\n return 1;\n }\n }\n\n\n return 0;\n}", "function partTimeWorkingDay(dayWage)\n{\n return dayWage.includes(\"80\");\n}", "function inDay(value, arr){\n var count=arr.length;\n for(var i=0;i<count;i++){\n if(arr[i].serialnumber==value){return true;}\n }\n return false;\n}", "isDayBlocked(day) {\n var resDates = this.state.reservedDays;\n for (var i = 0; i < resDates.length; i++) {\n if (day.isBetween(moment(resDates[i][0], \"MM-DD-YYYY\"), moment(resDates[i][1], \"MM-DD-YYYY\"), 'days', '[]')) {\n return true;\n }\n }\n return false;\n }", "function filterDaytime() {\n // get current time and create a string of HH:SS format\n var currentDate = new Date();\n var strTime = currentDate.getHours()+\":\"+currentDate.getMinutes()+\":00\";\n\n // compare if it fits to 'any' of the interval\n //iterate all intervals in list\n len = daytimeList.length;\n for(var i=0; i<len; i++){\n // TODO: check empty/improper daytime\n var strFrom = daytimeList[i].from+\":00\";\n var strTo = daytimeList[i].to+\":00\";\n\n // in this interval? then filter applies\n if (strTime > strFrom && strTime < strTo){\n return true\n }\n }\n return false;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ISMonkey is an extension manager that sets up the required MutationObservers and serv socket to be used throughout.
constructor() { this.socketEventList = []; this.asyncExtensionList = []; this.extensions = {}; this.setupSocket(); }
[ "function ExtensionObserver() {\n this._eventsDict = {};\n\n AddonManager.addAddonListener(this);\n AddonManager.addInstallListener(this);\n}", "startServer () {\n return new Promise((resolve, reject) => {\n if (!this.autoreload || !this.isWatching || this.server) return resolve()\n const { host, port } = this\n this.server = new WebSocket.Server({ port }, () => {\n this.log(`listens on ws://${host}:${port}`)\n resolve()\n })\n this.server.on('error', reject)\n this.nofiyExtension = data => {\n this.server.clients.forEach(client => {\n if (client.readyState === WebSocket.OPEN) {\n client.send(JSON.stringify(data))\n }\n })\n }\n })\n }", "function install_spy() {\n\t// Surplant the current request and upgrade listeners.\n\tvar server = WebApp.httpServer;\n\t_.each(['request', 'upgrade'], function (event) {\n\t\tvar old_listeners = server.listeners(event).slice(0);\n\t\tserver.removeAllListeners(event);\n\n\t\tvar listener = function (req) {\n\t\t\tvar args = arguments,\n\t\t\t\trequest_url = req.url.split('/');\n\n\t\t\t// If url is a sockjs (non-info) url, get the sockjs server/client id and save the headers.\n\t\t\tif (request_url[1] === 'sockjs' && request_url[2] !== 'info') {\n\t\t\t\tvar sockjs_id = request_url.slice(2,4).join('/');\n\n\t\t\t\tstorage[sockjs_id] = {\n\t\t\t\t\theaders: req.headers,\n\t\t\t\t\tremote_ip: req.connection.remoteAddress,\n\t\t\t\t\ttime: +(new Date)\n\t\t\t\t};\n\n\t\t\t\tclean();\n\t\t\t}\n\n\t\t\t// Call the old listeners (meteor).\n\t\t\t_.each(old_listeners, function (old) {\n\t\t\t\told.apply(server, args);\n\t\t\t});\n\t\t};\n\n\t\t// Hook us up.\n\t\tserver.addListener(event, listener);\n\t});\n}", "createObservers() {\n // NOTE: We need to wait for Google to bring Proxy to V8\n // if (this.targetElement.__scripts__) {\n // this.scriptsObserver = new MutationObserver((changes) => { this.scriptsObserver(changes) });\n // this.scriptsObserver.observe(this.targetElement.__scripts__, {\n // attributes: true\n // }); \n // }\n\n // this.domObserver = new MutationObserver((changes) => { this.attributesObserver(changes) });\n // this.domObserver.observe(this.targetElement, {\n // attributes: true\n // });\n }", "function _setupObserver(){\n if(_backend == \"localStorage\" || _backend == \"globalStorage\"){\n if(\"addEventListener\" in window){\n window.addEventListener(\"storage\", _storageObserver, false);\n }else{\n document.attachEvent(\"onstorage\", _storageObserver);\n }\n }else if(_backend == \"userDataBehavior\"){\n setInterval(_storageObserver, 1000);\n }\n }", "function FirefoxJetpackExtensionWrapper () {\n\t\tExtensionWrapper.apply(this, arguments);\n\n\t\tconst CALLBACK_SWEEP_MSECS = 1000 * 60 * 2;\n\t\tconst CALLBACK_TIMEOUT_MSECS = 1000 * 60;\n\n\t\tvar that = this;\n\t\tvar callbacks = {};\n\t\tvar onMessageHandler;\n\t\tvar sweepTimer;\n\n\t\tfunction MessageCallbackQueueItem (callback) {\n\t\t\tthis.callback = callback;\n\t\t\tthis.time = Date.now();\n\t\t}\n\t\tMessageCallbackQueueItem.prototype = {\n\t\t\ttoString:function () {\n\t\t\t\treturn '[object MessageCallbackQueueItem(' +\n\t\t\t\t\tthis.time + ': ' +\n\t\t\t\t\tthis.callback.toString().replace(/[\\s\\r\\n\\t]+/g, ' ').substring(0, 100) +\n\t\t\t\t\t')]';\n\t\t\t},\n\t\t\trun:function () {\n\t\t\t\ttypeof this.callback == 'function' && this.callback.apply(null, arguments);\n\t\t\t}\n\t\t};\n\n\t\tfunction handleMessage (data) {\n\t\t\tvar now = Date.now();\n\t\t\tvar callbacksCurrent = callbacks;\n\t\t\tvar callbacksNext = {};\n\n\t\t\tcallbacks = {};\n\n\t\t\tfor (var i in callbacksCurrent) {\n\t\t\t\tif (data && data.callbackNumber - i == 0) {\n\t\t\t\t\tcallbacksCurrent[i].run(data.payload);\n\t\t\t\t}\n\t\t\t\telse if (now - callbacksCurrent[i].time < CALLBACK_TIMEOUT_MSECS) {\n\t\t\t\t\tcallbacksNext[i] = callbacksCurrent[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (var i in callbacksNext) {\n\t\t\t\tcallbacks[i] = callbacksNext[i];\n\t\t\t}\n\t\t}\n\n\t\tthis.constructor = ExtensionWrapper;\n\t\tthis.runType = 'firefox-jetpack-extension';\n\t\tthis.doPostMessage = function (data, callback, preserved) {\n\t\t\tif (callback && !preserved) {\n\t\t\t\tvar id = data.requestNumber;\n\t\t\t\tcallbacks[id] = new MessageCallbackQueueItem(callback);\n\t\t\t\tdata.callbackNumber = id;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tself.postMessage(data);\n\t\t\t}\n\t\t\tcatch (e) {}\n\t\t};\n\t\tthis.doConnect = function () {\n\t\t\tself.on('message', function (data) {\n\t\t\t\tvar payload = data.payload;\n\n\t\t\t\tif ('requestNumber' in payload\n\t\t\t\t&& payload.requestNumber in that.preservedCallbacks) {\n\t\t\t\t\tthat.runCallback(that.preservedCallbacks[payload.requestNumber], payload);\n\t\t\t\t}\n\t\t\t\telse if ('callbackNumber' in data) {\n\t\t\t\t\thandleMessage(data);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tonMessageHandler && onMessageHandler(payload);\n\t\t\t\t}\n\t\t\t});\n\t\t\tsweepTimer = setInterval(function () {handleMessage()}, CALLBACK_SWEEP_MSECS);\n\t\t};\n\t\tthis.doDisconnect = function () {\n\t\t\tonMessageHandler = null;\n\t\t\tself.on('message', null);\n\t\t\tclearInterval(sweepTimer);\n\t\t};\n\t\tthis.setMessageListener = function (handler) {\n\t\t\tonMessageHandler = handler;\n\t\t};\n\t\tthis.getPageContextScriptSrc = function () {\n\t\t\treturn self.options.pageContextScript;\n\t\t};\n\t\tthis.urlInfo = new function () {\n\t\t\tvar extensionHostname = self.options.extensionId\n\t\t\t\t.toLowerCase()\n\t\t\t\t.replace(/@/g, '-at-')\n\t\t\t\t.replace(/\\./g, '-dot-');\n\t\t\treturn new UrlInfo(\n\t\t\t\tself.options.wasaviOptionsUrl,\n\t\t\t\tself.options.wasaviFrameSource\n\t\t\t);\n\t\t};\n\t}", "function _setupObserver() {\n if (_backend == 'localStorage' || _backend == 'globalStorage') {\n if ('addEventListener' in window) {\n window.addEventListener('storage', _storageObserver, false);\n } else {\n document.attachEvent('onstorage', _storageObserver);\n }\n } else if (_backend == 'userDataBehavior') {\n setInterval(_storageObserver, 1000);\n }\n }", "function PersonasExtensionManager() {\n Cu.import(\"resource://personas/modules/Observers.js\");\n Cu.import(\"resource://personas/modules/Preferences.js\");\n\n // Add observers for the lightweight theme topics to override their behavior,\n // and for the xpcom-shutdown topic to remove them afterwards.\n Observers.add(\"xpcom-shutdown\", this);\n Observers.add(\"lightweight-theme-preview-requested\", this);\n Observers.add(\"lightweight-theme-change-requested\", this);\n}", "function FirefoxJetpackExtensionWrapper () {\n\t\tvar self = require('self');\n\t\tvar pagemod = require('page-mod');\n\t\tvar tabs = require('tabs');\n\t\tvar l10n = require('l10n/locale');\n\t\tvar XMLHttpRequest = require('sdk/net/xhr').XMLHttpRequest;\n\n\t\tvar tabIds = {};\n\t\tvar lastRegisteredTab;\n\t\tvar onMessageHandler;\n\n\t\tfunction getNewTabId () {\n\t\t\tvar result = 0;\n\t\t\twhile (result in tabIds) {\n\t\t\t\tresult++;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tfunction getTabId (worker, callback) {\n\t\t\tfor (var i in tabIds) {\n\t\t\t\tif (tabIds[i] == worker) {\n\t\t\t\t\temit(callback, i);\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\n\t\tfunction handleWorkerDetach () {\n\t\t\tgetTabId(this, function (i) {\n\t\t\t\tdelete tabIds[i];\n\t\t\t});\n\t\t}\n\n\t\tfunction handleWorkerMessage (req) {\n\t\t\tif (!onMessageHandler) return;\n\n\t\t\tvar theWorker = this;\n\t\t\tonMessageHandler(req, getTabId(theWorker), function (res) {\n\t\t\t\tres || (res = {});\n\t\t\t\tif ('__messageId' in req) {\n\t\t\t\t\tres.__messageId = req.__messageId;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\ttheWorker.postMessage(res);\n\t\t\t\t}\n\t\t\t\tcatch (e) {}\n\t\t\t});\n\t\t}\n\n\t\tpagemod.PageMod({\n\t\t\tinclude:{\n\t\t\t\ttest:function (url) {\n\t\t\t\t\tif (url.indexOf(self.data.url('options.html')) == 0) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif (url.substring(0, 5) != 'http:'\n\t\t\t\t\t&& url.substring(0, 6) != 'https:') {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif (url == 'http://wasavi.appsweets.net/'\n\t\t\t\t\t|| url == 'http://wasavi.appsweets.net/script_frame.html'\n\t\t\t\t\t|| url == 'https://ss1.xrea.com/wasavi.appsweets.net/'\n\t\t\t\t\t|| url == 'https://ss1.xrea.com/wasavi.appsweets.net/script_frame.html') {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t},\n\t\t\t\texec:function (url) {\n\t\t\t\t\treturn this.test(url) ? [url] : null;\n\t\t\t\t}\n\t\t\t},\n\t\t\tcontentScriptWhen:'start',\n\t\t\tcontentScriptFile:[\n\t\t\t\tself.data.url('frontend/extension_wrapper.js'),\n\t\t\t\tself.data.url('frontend/agent.js')\n\t\t\t],\n\t\t\tonAttach:function (worker) {\n\t\t\t\tvar tabId = getNewTabId();\n\t\t\t\ttabIds[tabId] = worker;\n\t\t\t\tlastRegisteredTab = tabId;\n\t\t\t\tworker.on('detach', handleWorkerDetach);\n\t\t\t\tworker.on('message', handleWorkerMessage);\n\t\t\t}\n\t\t});\n\n\t\tpagemod.PageMod({\n\t\t\tinclude:[\n\t\t\t\t'http://wasavi.appsweets.net/',\n\t\t\t\t'https://ss1.xrea.com/wasavi.appsweets.net/'\n\t\t\t],\n\t\t\tcontentScriptWhen:'start',\n\t\t\tcontentScriptFile:[\n\t\t\t\tself.data.url('frontend/extension_wrapper.js'),\n\t\t\t\tself.data.url('frontend/init.js'),\n\t\t\t\tself.data.url('frontend/utils.js'),\n\t\t\t\tself.data.url('frontend/unicode_utils.js'),\n\t\t\t\tself.data.url('frontend/classes.js'),\n\t\t\t\tself.data.url('frontend/classes_ex.js'),\n\t\t\t\tself.data.url('frontend/classes_undo.js'),\n\t\t\t\tself.data.url('frontend/classes_subst.js'),\n\t\t\t\tself.data.url('frontend/classes_search.js'),\n\t\t\t\tself.data.url('frontend/classes_ui.js'),\n\t\t\t\tself.data.url('frontend/wasavi.js')\n\t\t\t],\n\t\t\tonAttach:function (worker) {\n\t\t\t\tvar tabId = getNewTabId();\n\t\t\t\ttabIds[tabId] = worker;\n\t\t\t\tlastRegisteredTab = tabId;\n\t\t\t\tworker.on('detach', handleWorkerDetach);\n\t\t\t\tworker.on('message', handleWorkerMessage);\n\t\t\t}\n\t\t});\n\n\t\tpagemod.PageMod({\n\t\t\tinclude:[\n\t\t\t\t'http://wasavi.appsweets.net/script_frame.html',\n\t\t\t\t'https://ss1.xrea.com/wasavi.appsweets.net/script_frame.html'\n\t\t\t],\n\t\t\tcontentScriptWhen:'start',\n\t\t\tcontentScriptFile:[\n\t\t\t\tself.data.url('frontend/script_frame.js')\n\t\t\t]\n\t\t});\n\n\t\trequire('simple-prefs').on('optionsOpener', function () {\n\t\t\ttabs.open(self.data.url('options.html'));\n\t\t});\n\n\t\tthis.constructor = ExtensionWrapper;\n\n\t\tthis.registerTabId = function (tabId) {\n\t\t\t// do nothing\n\t\t};\n\t\tthis.isExistsTabId = function (tabId) {\n\t\t\treturn tabId in tabIds;\n\t\t};\n\t\tthis.sendRequest = function (tabId, message) {\n\t\t\ttry {\n\t\t\t\ttabIds[tabId].postMessage(message);\n\t\t\t}\n\t\t\tcatch (e) {}\n\t\t};\n\t\tthis.broadcast = function (message, exceptId) {\n\t\t\tif (exceptId === undefined) {\n\t\t\t\tfor (var i in tabIds) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\ttabIds[i].postMessage(message);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (e) {}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tfor (var i in tabIds) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\ti - exceptId != 0 && tabIds[i].postMessage(message);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (e) {}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tthis.executeScript = function (tabId, options, callback) {\n\t\t\tresourceLoader.get(options.file, function (data) {\n\t\t\t\temit(callback, {source:data || ''});\n\t\t\t});\n\t\t};\n\t\tthis.addRequestListener = function (handler) {\n\t\t\tonMessageHandler = handler;\n\t\t};\n\t\tthis.openTabWithUrl = function (url, callback) {\n\t\t\ttabs.open({\n\t\t\t\turl:url,\n\t\t\t\tonReady:function (tab) {\n\t\t\t\t\tcallback && emit(callback, tab, url);\n\t\t\t\t\tcallback = null;\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\t\tthis.openTabWithFile = function (file, callback) {\n\t\t\ttabs.open({\n\t\t\t\turl:self.data.url(file),\n\t\t\t\tonReady:function (tab) {\n\t\t\t\t\tcallback && emit(callback, tab, tab.url);\n\t\t\t\t\tcallback = null;\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\t\tthis.closeTab = function (id) {\n\t\t\tif (typeof id.close == 'function') {\n\t\t\t\ttry {id.close();} catch (e) {}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tgetTabId(id, function (worker) {worker.tab.close();});\n\t\t\t}\n\t\t};\n\t\tthis.closeTabByWasaviId = function (id) {\n\t\t\tid in tabIds && this.closeTab(tabIds[id].tab);\n\t\t};\n\t\tthis.focusTab = function (id) {\n\t\t\tif (typeof id.activate == 'function') {\n\t\t\t\ttry {id.activate();} catch (e) {}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tgetTabId(id, function (worker) {worker.activate();});\n\t\t\t}\n\t\t};\n\t\tthis.createTransport = function () {\n\t\t\treturn new XMLHttpRequest;\n\t\t};\n\t\tthis._contextMenuInitialized = false;\n\t\tthis.initContextMenu = function () {\n\t\t\tif (this._contextMenuInitialized) return;\n\t\t\tvar cm = require('context-menu');\n\t\t\tcm.Item({\n\t\t\t\tcontext:cm.SelectorContext('input,textarea'),\n\t\t\t\timage:self.data.url('icon016.png'),\n\t\t\t\tlabel:'#',\n\t\t\t\tcontentScriptFile:self.data.url('context_menu.js'),\n\t\t\t\tonMessage:function (phase) {\n\t\t\t\t\tswitch (phase) {\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tthis.label = getContextMenuLabel(MENU_EDIT_WITH_WASAVI);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tvar activeTab = tabs.activeTab;\n\t\t\t\t\t\tfor (var i in tabIds) {\n\t\t\t\t\t\t\tif (tabIds[i].tab == activeTab) {\n\t\t\t\t\t\t\t\ttabIds[i].postMessage({type:'request-run'});\n\t\t\t\t\t\t\t\tbreak;\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\tthis._contextMenuInitialized = true;\n\t\t};\n\t\tthis.storage = StorageWrapper.create();\n\t\tthis.clipboard = ClipboardManager.create();\n\t\tthis.tabWatcher = TabWatcher.create();\n\t\tthis.extensionId = self.id;\n\t\tthis.__defineGetter__('lastRegisteredTab', function () {\n\t\t\tvar result = lastRegisteredTab;\n\t\t\tlastRegisteredTab = undefined;\n\t\t\treturn result;\n\t\t});\n\t\tthis.messageCatalogPath = (function () {\n\t\t\tvar prefered = l10n.getPreferedLocales();\n\t\t\tif (!prefered) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tprefered = prefered.filter(function (l) {\n\t\t\t\treturn /^([^-]{2})(-[^-]+)*$/.test(l);\n\t\t\t});\n\t\t\tif (!prefered || prefered.length == 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tvar availables = parseJson(self.data.load('xlocale/locales.json')).map(function (l) {\n\t\t\t\treturn l.replace(/_/g, '-').toLowerCase();\n\t\t\t});\n\t\t\tvar result = l10n.findClosestLocale(availables, prefered);\n\t\t\tif (!result) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn 'xlocale/' + result + '/messages.json';\n\t\t})();\n\t\tthis.cryptKeyPath = 'frontend/wasavi.js';\n\t\tthis.version = require('self').version;\n\t\tthis.isDev = this.version == TEST_VERSION;\n\t}", "_attachListeners () {\n const onListening = () => {\n const address = this._server.address()\n debug(`server listening on ${address.address}:${address.port}`)\n this._readyState = Server.LISTENING\n }\n\n const onRequest = (request, response) => {\n debug(`incoming request from ${request.socket.address().address}`)\n request = Request.from(request)\n response = Response.from(response)\n this._handleRequest(request, response)\n }\n\n const onError = err => {\n this.emit('error', err)\n }\n\n const onClose = () => {\n this._readyState = Server.CLOSED\n }\n\n this._server.on('listening', onListening)\n this._server.on('request', onRequest)\n this._server.on('checkContinue', onRequest)\n this._server.on('error', onError)\n this._server.on('close', onClose)\n this._readyState = Server.READY\n }", "_registerListeners() {\n activityTrackerUtils.patchXMLHTTPRequest(\n this._beforeJSInitiatedRequestCallback.bind(this),\n this._afterJSInitiatedRequestCallback.bind(this));\n\n activityTrackerUtils.patchFetch(\n this._beforeJSInitiatedRequestCallback.bind(this),\n this._afterJSInitiatedRequestCallback.bind(this));\n\n this._registerPerformanceObserver();\n\n if (this._useMutationObserver) {\n this._mutationObserver =\n activityTrackerUtils.observeResourceFetchingMutations(\n this._mutationObserverCallback.bind(this));\n }\n }", "setUpSocketEventListeners() {}", "listen() {\n const suite = suites.get(this);\n const dispatch = new dispatch_1.Dispatch(suite);\n dispatch.listen();\n }", "function WebmonkeyService() {\n this.wrappedJSObject = this;\n}", "function ChromeExtensionWrapper () {\n\t\tExtensionWrapper.apply(this, arguments);\n\n\t\tvar that = this;\n\t\tvar onMessageHandler;\n\t\tvar port = null;\n\n\t\tfunction handleMessage (req) {\n\t\t\tif ('requestNumber' in req\n\t\t\t&& req.requestNumber in that.preservedCallbacks) {\n\t\t\t\tthat.runCallback(that.preservedCallbacks[req.requestNumber], req);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tonMessageHandler && onMessageHandler(req);\n\t\t\t}\n\t\t}\n\n\t\tthis.constructor = ExtensionWrapper;\n\t\tthis.runType = 'chrome-extension';\n\t\tthis.doPostMessage = function (data, callback, preserved) {\n\t\t\tif (callback && !preserved) {\n\t\t\t\ttry {\n\t\t\t\t\tchrome.runtime.sendMessage(data, callback);\n\t\t\t\t}\n\t\t\t\tcatch (e) {}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttry {\n\t\t\t\t\tport ?\n\t\t\t\t\t\tport.postMessage(data) :\n\t\t\t\t\t\tchrome.runtime.sendMessage(data);\n\t\t\t\t}\n\t\t\t\tcatch (e) {}\n\t\t\t}\n\t\t};\n\t\tthis.doConnect = function () {\n\t\t\tport = chrome.runtime.connect({\n\t\t\t\tname: this.internalId\n\t\t\t});\n\t\t\tport.onMessage.addListener(handleMessage);\n\t\t\tchrome.runtime.onMessage.addListener(handleMessage);\n\t\t};\n\t\tthis.doDisconnect = function () {\n\t\t\tonMessageHandler = null;\n\t\t\tchrome.runtime.onMessage.removeListener(handleMessage);\n\t\t\tport.onMessage.removeListener(handleMessage);\n\t\t\tport.disconnect();\n\t\t\tport = null;\n\t\t};\n\t\tthis.setMessageListener = function (handler) {\n\t\t\tonMessageHandler = handler;\n\t\t};\n\t\tthis.getMessage = function (messageId) {\n\t\t\treturn chrome.i18n.getMessage(messageId);\n\t\t};\n\t\tthis.getPageContextScriptSrc = function () {\n\t\t\treturn chrome.runtime.getURL('scripts/page_context.js');\n\t\t};\n\t\tthis.urlInfo = new function () {\n\t\t\treturn new UrlInfo(\n\t\t\t\tchrome.runtime.getURL('options.html'),\n\t\t\t\tchrome.runtime.getURL('wasavi.html')\n\t\t\t);\n\t\t};\n\t}", "registerHttpServer() {\n this.application.container.singleton('Adonis/Core/Server', () => {\n const { Server } = require('../src/Server');\n const Config = this.application.container.resolveBinding('Adonis/Core/Config');\n const Encryption = this.application.container.resolveBinding('Adonis/Core/Encryption');\n const serverConfig = Config.get('app.http', {});\n this.validateServerConfig(serverConfig);\n return new Server(this.application, Encryption, serverConfig);\n });\n }", "function SpyServer() {\n // Inherit from our FixedServer\n FixedServer.apply(this, arguments);\n\n // Create storage for spies\n this.spies = {};\n}", "get observerService() {\n\t\treturn Components.classes[\"@mozilla.org/observer-service;1\"]\n\t\t\t\t\t\t .getService(Components.interfaces.nsIObserverService);\n\t}", "createExtensionManager() {\n const coreExtensions = Object.entries(extensions).map(([, extension]) => extension);\n const allExtensions = [...coreExtensions, ...this.options.extensions].filter(extension => {\n return ['extension', 'node', 'mark'].includes(extension === null || extension === void 0 ? void 0 : extension.type);\n });\n this.extensionManager = new ExtensionManager(allExtensions, this);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
that takes no arguments and returns the value 4
function return4 () { return 4; }
[ "function four() {\n\treturn 4;\n}", "function returnFour(){\n var number = 4;\n return console.log(number);\n}", "function addFour(num) {\n return num+4;\n}", "function addFour(inputArgument){\n return inputArgument + 4;\n}", "function fourAddNumber(a,b,c,d){\n let abcd=a+b+c+d\n return abcd\n }", "static numRuedas(){\n return 4;\n }", "function sequencia4(num) {\n return 0\n}", "function addFour(input) {\n let newVal = input + 4;\n return newVal;\n}", "function addFour(number) {\n let changedNumber = number + 4;\n return changedNumber;\n }", "function returnInt(){\n\treturn 16;\n}", "function somar4(num1 = 1, num2 = 2, num3 = 3) {\n return num1 + num2 + num3;\n}", "get a() {\t// I guess this is just saying when I ask for a return 2.\r\n\t\treturn 2;\r\n\t}", "function somar4(num1=1, num2=2, num3=3){\n return num1 + num2 + num3;\n}", "function somar4(num1 = 1, num2 = 2, num3 = 3){\n return num1 + num2 + num3;\n}", "function get2or4(zahl) {\n if (zahl <= 93) {\n return 2;\n } else {\n return 4;\n }\n}", "function returnValue() {\n return 3;\n}", "function fourNums(n1,n2,n3,n4){\n console.log(n1+n2-n3-n4);\n}", "function func4 (n1,n2,n3,n4) {\n console.log(n1 + n2 - n3 - n4)\n}", "function returnFive() {\n return 5;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
posts an album to the database
function postAlbum(res) { console.log("Album Post!", res); renderAlbum(res); }
[ "async createAlbum (title) {\n const token = await GoogleSignin.getTokens();\n data = {\n URI: 'https://photoslibrary.googleapis.com/v1/albums',\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': 'Bearer '+ token.accessToken\n },\n body: JSON.stringify({\n \"album\": {\"title\": title}\n })\n }\n response = await this.APIHandler.sendRequest(data)\n return response\n }", "addAlbum({name, coverImg, ownerId, timestamp}){\n this.create(\n {name, coverImg, ownerId: window.localStorage.getItem('ownerId'), timestamp},\n {\n success: (response)=>{\n this.add({response});\n }\n }\n );\n }", "createNewAlbum(id, name, url) {\n let objElement = this.dumpAlbum(id, name, url);\n this.addAlbumToList(id, name, url, objElement);\n //console.log('new album created');\n }", "function addToAlbum(req, res) {\n Album.findById(req.params.id, function(err, album) {\n album.tracks.push(req.body.trackId);\n album.save(function(err) {\n res.redirect(`/albums/${album._id}`);\n });\n });\n}", "function createAlbum(req, res) {\n\tvar album = new Album(req.body);\n\talbum.save(function (err, album) {\n\t\tif (err) {\n\t\t\tconsole.log(err);\n\t\t}\n\t\tres.redirect('/albums');\n\t});\n}", "async shareAlbum(albumID){\n const token = await GoogleSignin.getTokens();\n data = {\n URI: `https://photoslibrary.googleapis.com/v1/albums/${albumID}:share`,\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': 'Bearer '+ token.accessToken\n },\n body:JSON.stringify({\n \"sharedAlbumOptions\": {\n \"isCollaborative\": true,\n \"isCommentable\": true \n }\n })\n }\n response = await this.APIHandler.sendRequest(data)\n return response\n }", "static CreateAlbum(album) {\n check(album, config.schema.Album);\n var albumId = Album.insert(album);\n album._id = albumId;\n AlbumCreator.DownloadImages(album);\n return albumId;\n }", "function add_album_to_playlist(album)\n {\n make_command_request (\"add_album_to_playlist \" + album , response_callback_gen_status);\n }", "addPhotoToAlbum(photo) {\r\n this.albums.forEach((album) => {\r\n if (album.id === photo.albumId) {\r\n album.addPhoto(photo);\r\n }\r\n });\r\n }", "function create(req, res) {\n req.body.author = req.user._id;\n Album.create(req.body, function(err, album) {\n res.redirect(\"/albums\");\n });\n}", "function addImageToAlbum () {\n imgurService\n .addImageToAlbum(ids)\n .then(\n showPhotos()\n )\n }", "async submitImage(uploadData, albumID){\n const mediaItems = this.processUploadImages(uploadData)\n const token = await GoogleSignin.getTokens();\n data = {\n URI: 'https://photoslibrary.googleapis.com/v1/mediaItems:batchCreate',\n headers: {\n 'Authorization': 'Bearer '+ token.accessToken,\n 'Content-type': 'application/json'\n },\n method: 'POST',\n body: JSON.stringify({\n \"albumId\": albumID,\n \"newMediaItems\": mediaItems\n })\n }\n response = await this.APIHandler.sendRequest(data);\n return response\n }", "save() {\n this.socialShare.saveToPhotoAlbum(this.mainImage).then(() => this.toast(this.translate.instant('other.save-to-album')));\n }", "async createAlbum(req, res, next) {\n try {\n const newAlbum = new albumsModel({\n ...req.body,\n slug: slugify(req.body.name, { lower: true, locale: 'vi' }),\n });\n await newAlbum.save();\n res.status(201).json({ message: 'Thêm album thành công!', newAlbum });\n } catch (error) {\n next(error);\n }\n }", "function before_photo_post(test, callback){\n\thello(test.network)\n\t.api(\"me/albums\")\n\t.then(function(r){\n\t\tfor(var i=0;i<r.data.length;i++){\n\t\t\tif(r.data[i].name === \"TestAlbum\"){\n\t\t\t\tvar id = r.data[i].id;\n\t\t\t\ttest.data.id = id;\n\t\t\t\treturn callback();\n\t\t\t}\n\t\t}\n\t\tcallback(\"Failed to setup: Could not find the album 'TestAlbum'\");\n\t}, function(){\n\t\tcallback(\"Failed to setup: could not access me/albums\");\n\t});\n}", "function create(req, res) {\n db.Album.findById(req.params.albumId, function(err, foundAlbum) {\n console.log(req.body);\n var newSong = new db.Song(req.body); //dangerous, in real app we'd validate incoming data. this bypasses that.\n foundAlbum.songs.push(newSong);\n foundAlbum.save(function(err, savedAlbum) {\n console.log('newSong created: ', newSong);\n res.json(newSong); // responding with just the song, some APIs may respond with parent objects\n });\n });\n }", "function addToAlbum() {\n var modal = openDialog({title:'Add to album'}, function($body) {\n ajax({\n type: 'GET',\n url: '/photos/albums/byName',\n dataType: 'json',\n success: function(albums) {\n if (albums !== null && albums !== undefined && albums.length > 0) {\n _selectorAddAlbumRow(modal, null);\n for (var i=0; i<albums.length; i++) {\n var album = albums[i];\n _selectorAddAlbumRow(modal, album);\n }\n }\n },\n error: function(jqxhr, textStatus, error) {\n modal.close();\n flashError(\"Failed to get album list\", jqxhr.status);\n }\n });\n });\n}", "save(image) {\n this.socialShare.saveToPhotoAlbum(image).then(() => this.toast(this.translate.instant('other.save-to-album')));\n }", "function albumCreate(title, artist, summary, barcode, genre, cb) {\n albumdetail = {\n title: title,\n artist: artist,\n summary: summary\n }\n if (barcode != false) albumdetail.barcode = barcode\n if (genre != false) albumdetail.genre = genre\n \n var album = new Album(albumdetail);\n album.save(function (err) {\n if (err) {\n cb(err, null)\n return\n }\n console.log('New Album: ' + album);\n albums.push(album)\n cb(null, album)\n } );\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all collections nearby location
function getCollections(locObj, count){ var deferred = $q.defer(); $http({ url: API_ENDPOINT + APIPATH.collections, method: 'GET', params: { lat: locObj.latitude, lon: locObj.longitude, count: count } }) .then(function (data) { deferred.resolve(data); },function(data){ deferred.resolve(data); $mdToast.show( $mdToast.simple() .textContent('Sorry! Unable to get the collections near your place') .position('top') .hideDelay(5000) ); }) return deferred.promise; }
[ "async function getLocations() {\n return await locations.find().toArray()\n }", "GetAllLocations() {\n return location_queries.GetAllLocations(this.pool);\n }", "function getEntriesInRegion(lat, lon, maxDistance, collection){\n\tsubCollection= [];\n\tfor(var c = 0;c < collection.length;c++){\n\t\tif(collection[c][reclat] === \"\" || collection[c][reclong] === \"\") continue;\n\t\t\tvar d = findDistance(lat, lon, collection[c][reclat], collection[c][reclong]);\n\t\tif(d <= maxDistance)\n\t\t\tsubCollection.push(collection[c]);\n\n\t}\n}", "async getAllMaps() {\n if (this.#client == null) {\n this.#init();\n }\n \n try {\n // Connect to MongoDB\n await this.#connect();\n\n // Query for collection\n const collection = this.#client.db(\"ValoLineups\").collection(\"maps\").find({});\n return await collection.toArray();\n }\n catch (e) {\n console.error(e);\n }\n finally {\n // Ensures that the client will close when we finish/error\n await this.#client.close();\n }\n }", "static list() {\n return api_base_1.default.request('locations/').then((locations) => {\n return locations.data.map(each => new Location_1.default(each));\n });\n }", "function nearby (database, lat, lon, numResults) {\r\n numResults = numResults || 5;\r\n if (!tree) tree = new KDTree(database.kdtree, haversine, ['x', 'y']);\r\n var res = tree.nearest({x: toRad(Number(lon)), y: toRad(Number(lat))}, numResults);\r\n return res.map(function (item) {\r\n return database.all[item[0].id];\r\n });\r\n}", "function getLocations (loc) {\n var \n query = 'https://api.flickr.com/services/rest/?method=flickr.places.find' +\n '&api_key=' + config.api_key +\n '&format=' + config.format +\n '&nojsoncallback=' + config.nojsoncallback +\n '&query=' + encodeURI(loc);\n\n isSearchingLocations = true;\n $preloaderLocs.show();\n $dropdown.children().remove();\n\n $.get(query, \n function (data) {\n isSearchingLocations = false;\n appendResults(data, loc);\n $preloaderLocs.hide();\n $dropdown.show();\n });\n }", "function getLocations(){\n AuthActions.locations.getAll()\n .then(locations => setLocations(locations))\n }", "function findStoresInRange(location, range, callback) {\n db.collection(stores, function(err, collection) {\n if(err) return callback(err);\n\n var query = {loc: {$geoWithin: {$centerSphere:\n [[location.lng, location.lat] , range / 3959]}}} ;\n\n collection.find(query).toArray(function(err, docs) {\n if (err) return callback(err);\n callback(null, docs);\n });\n });\n}", "get locations() { return this.locations_.values(); }", "function findStoresInRangeApprox(location, range, callback) { var r = range / 60\n , lat0 = location.lat - r\n , lat1 = location.lat + r\n , lng0 = location.lng - r\n , lng1 = location.lng + r\n ;\n\n db.collection(stores, function(err, collection) {\n if(err) return callback(err);\n\n var query = {\n latitude: { $gt: lat0, $lt: lat1 }\n , longitude: { $gt: lng0, $lt: lng1}\n };\n\n collection.find(query).toArray(function(err, docs) {\n if (err) return callback(err);\n callback(null, docs);\n });\n });\n}", "get collections() { return new Promise((resolve, reject) => {\n require('./skyblock/base.js').collections().then((collections) => {\n resolve(collections)\n })\n })}", "function getNearestStores() {\n isSearched = true;\n var Content = app.getModel('Content');\n var storeLocatorAsset = Content.get('store-locator');\n var pageMeta = require('*/cartridge/scripts/meta');\n pageMeta.update(storeLocatorAsset);\n\n var countrycode = request.httpParameterMap.countryCode.value;\n var postalcode = request.httpParameterMap.postalCode.value;\n var distanceUnit = request.httpParameterMap.distanceUnit.value;\n var latitude = request.httpParameterMap.latitude.value;\n var longitude = request.httpParameterMap.longitude.value;\n var maxdistance = request.httpParameterMap.maxdistance.value;\n var stores;\n if (latitude!=null && longitude!=null) {\n \tstores = StoreMgr.searchStoresByCoordinates(Number(latitude), Number(longitude), distanceUnit, Number(maxdistance));\n } else if (postalcode!=null && countrycode!=null) {\n \tstores = StoreMgr.searchStoresByPostalCode(countrycode, postalcode, distanceUnit, Number(maxdistance));\n } else {\n \tstores = SystemObjectMgr.querySystemObjects('Store', 'countryCode = {0}', 'countryCode desc', countrycode);\n }\n \tvar storesobj = {'stores': stores, 'searchKey': countrycode, 'type': 'findbycountry'};\n\n app.getView('StoreLocator', storesobj)\n .render('storelocator/components/storesjson');\n\n}", "async getAllCollections() {\n try {\n const collectionsData = await this.client.getCollections();\n // Directus API doesn't support filtering collections on requests\n // so this will do\n const collections = collectionsData.data.filter(\n collection => !collection.collection.startsWith('directus_'),\n );\n return collections;\n } catch (e) {\n console.error('Error fetching Collections: ', e);\n return [];\n }\n }", "function allEventLocations(request, response){\n const url = `https://www.eventbriteapi.com/v3/events/search?location.longitude=${lng}&location.latitude=${lat}&location.within=2km&start_date.keyword=today&expand=venue&token=${process.env.EVENTBRITE_PUBLIC_TOKEN}`;\n\n superagent\n .get(url)\n .then(result => result.body.events.map(resultObj => new EventLatLong(resultObj)))\n .then(result => cafesNearEvent(result, response))\n .catch(error => errorHandler(error, response))\n}", "function listLocations(doc){\n globalDoc = doc\n\n //Assume only one doc for now\n //Assume placemarks and markers are synchronized (it is for geoxml3)\n var placemarks = doc[0].placemarks\n var markers = doc[0].markers\n\n //Append number of cafes\n $(\"li a#all\").append(\" \" + markers.length + \" Cafes\")\n //Sort placemarks and markers\n placemarks = placemarks.sort(function(a, b){\n return (a.name).localeCompare(b.name)\n })\n markers = markers.sort(function(a, b){\n return (a.title).localeCompare(b.title)\n })\n\n //Add location details to location ul\n var locationsList = $(locationsListSelector)\n for(var i = 0; i < placemarks.length; i++){\n //For each placemark, list title and description free of inline styling\n var placemark = placemarks[i]\n var marker = markers[i]\n\n var markerID = makeID(marker.title)\n\n //Remove inline styling from placemark description\n var cleanDescriptions = removeStyle($('<span class=\"loc-desc\">' + placemark.description + '</span>'))\n\n //Create li element with title and description as contents\n //Link to loc on Google Maps (external)\n var liElement = $('<li>').attr('id', markerID).append($('<strong class=\"title\">').attr('id', markerID).append(placemark.name))\n \n liElement.append(cleanDescriptions)\n \n $(locationsList).append(liElement)\n\n var m = marker\n \n //Customize icons based on existing color of icon from before\n // and sort into cafes map\n //Green : Participating cafe\n //Purple: Outside of KlangValley\n //Default: In Klang Valley but not participating\n\n var iconURL = markerIcons['default']\n\n\n if(m && m.getIcon()){\n if(m.getIcon().url.indexOf(\"purple\") > -1){\n cafes[\"notInKV\"].push(markerID)\n iconURL = markerIcons['outOfTown']\n }\n else if(m.getIcon().url.indexOf(\"green\") > -1){\n cafes[\"participatingKV\"].push(markerID)\n iconURL = markerIcons['participating']\n }\n else{\n cafes[\"notParticipatingKV\"].push(markerID)\n }\n }\n\n //Set custom marker\n m.setIcon({\n url: iconURL\n })\n\n //Set marker listener to highlight each li onclick\n google.maps.event.clearListeners(m, 'click')\n\n google.maps.event.addListener(m, 'click', function(){\n var markerID = makeID(this.title)\n \n //show all cafes\n $(searchBarSelector).val('')\n $(listToSearchSelector + \" li\").show(function(){\n //Update scrollbar\n $(divWithLocationsListSelector).mCustomScrollbar(\"update\")\n\n //Scroll to selected position\n $(divWithLocationsListSelector).mCustomScrollbar(\"scrollTo\", \"li#\" + markerID)\n }) \n\n\n selectLocationLi(markerID, this)\n\n //Zoom to location and center it. Have to set center first, for first time click otherwise it'll zoom in \n //some random position even though getPosition() returns correct latlng values. Some bug.\n gmap.setCenter(this.getPosition())\n gmap.setZoom(15)\n gmap.panTo(this.getPosition())\n\n var thisPlacemark = getPlaceMarkForMarker(this)\n //Clean infowindow\n\n globalInfoWindow.setContent(\"<div class='iw-holder' id=\" + markerID \n + \"-iw><h3>\" + thisPlacemark.name + \"</h3>\" + '<a class=\"directions-link\" href=\"#' \n + markerID + '\">Details</a></div>')\n globalInfoWindow.open(gmap, this)\n $('div#' + markerID + \"-iw\").on('linkReady', function(event, link){\n $(this).append(link)\n\n })\n })\n }\n\n //Other locations list initializers\n setLocationListOnlick()\n initializeListScroller()\n collapseLocationListDesc()\n }", "getAll() {\n return this.collection.find({}).toArray();\n }", "function GeoLocQuery(){}", "async function getNearBy() {\n const res = await fetch(`/api/v1/places/near-me?longitude=${lon}&latitude=${lat}`);\n const data = await res.json();\n renderMap(data.data)\n mapListRender(data.data);\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the query if there are no observers left
maybeRemoveQuery(query) { if (query.observers.length === 0) { query.clear(); delete this._queries[buildTypeKey(query.types)]; } }
[ "destroy() {\n this.unmonitorForChanges();\n this.set('status', this.is(EMPTY) ? NON_EXISTENT : DESTROYED);\n this.get('store').removeQuery(this);\n Query.parent.destroy.call(this);\n }", "pauseObservers() {\n // No-op if already paused.\n if (this.paused) {\n return;\n }\n\n // Set the 'paused' flag such that new observer messages don't fire.\n this.paused = true;\n\n // Take a snapshot of the query results for each query.\n Object.keys(this.queries).forEach(qid => {\n const query = this.queries[qid];\n query.resultsSnapshot = EJSON.clone(query.results);\n });\n }", "clearQueryCache() {\n // if (this._cache.query) {\n // this._cache.query.unsubscribe();\n // }\n this._cache.query = null;\n this._cache.counterQuery = null;\n }", "pauseObservers() {\n // No-op if already paused.\n if (this.paused) {\n return;\n } // Set the 'paused' flag such that new observer messages don't fire.\n\n\n this.paused = true; // Take a snapshot of the query results for each query.\n\n Object.keys(this.queries).forEach(qid => {\n const query = this.queries[qid];\n query.resultsSnapshot = EJSON.clone(query.results);\n });\n }", "deleteObservers() {\n this._observers = new Set();\n }", "function cleanup() {\n queries = queries.filter((item) => item().status === 'pending');\n }", "removes() {\n while (this.q.length) {\n this.q.pop();\n }\n }", "async cleanUpRepeatingQueries() {\n\t\tfor (let key in this.repeatingQueries) {\n\t\t\tawait this.removeQuery(key);\n\t\t}\n\t}", "resumeObservers() {\n // No-op if not paused.\n if (!this.paused) {\n return;\n }\n\n // Unset the 'paused' flag. Make sure to do this first, otherwise\n // observer methods won't actually fire when we trigger them.\n this.paused = false;\n\n Object.keys(this.queries).forEach(qid => {\n const query = this.queries[qid];\n\n if (query.dirty) {\n query.dirty = false;\n\n // re-compute results will perform `LocalCollection._diffQueryChanges`\n // automatically.\n this._recomputeResults(query, query.resultsSnapshot);\n } else {\n // Diff the current results against the snapshot and send to observers.\n // pass the query object for its observer callbacks.\n LocalCollection._diffQueryChanges(\n query.ordered,\n query.resultsSnapshot,\n query.results,\n query,\n {projectionFn: query.projectionFn}\n );\n }\n\n query.resultsSnapshot = null;\n });\n\n this._observeQueue.drain();\n }", "function clearCurrentQuery() {\n // don't clear the history if existing queries are already running\n if (qwQueryService.executingQuery.busy || pastQueries.length == 0)\n return;\n\n pastQueries.splice(currentQueryIndex,1);\n if (currentQueryIndex >= pastQueries.length)\n currentQueryIndex = pastQueries.length - 1;\n\n lastResult.copyIn(pastQueries[currentQueryIndex]);\n }", "clear() {\n this._entities.length = 0;\n for (const observer of this.observers) {\n this.unregister(observer);\n }\n }", "clearObservers(){\n\n this.observers = [];\n }", "function checkQueriesStatus() {\n\t\t\tfor (i=queriesToMonitor.length-1;i>=0;i--) {\n\t\t\t\tvar query = queriesToMonitor[i];\n\t\t\t\tif (query.state===QUERY_STATUS.IN_PROGRESS) {\n\t\t\t\t\tcheckQueryStatus(query);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tqueriesToMonitor.splice(i,1);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}", "removeQuery(id){\n var id = Number(id);\n var query = this.getQueryByID(id);\n var related_streams = [];\n for (var i = 0; i < this.streams.length; i++){\n var stream = this.streams[i];\n var matches = this.checkSubMatchTags(stream.tags, query.tags);\n if (matches){\n if (stream.hasQuery(id)){\n stream.removeQuery(id);\n var dt = new Date();\n dt.setHours(dt.getHours() + 2)\n console.log(dt, ' == DEBUG | Removed Stream ' + stream.id + ' from Query ' + query.id);\n related_streams = related_streams.concat(this.g([stream], []));\n }\n }\n }\n var history = [];\n this.removeQueryByID(id);\n var related_streams = this.extractUniqueElements(related_streams);\n // trigger to optimization state where the sampling periods of the related streams are recomputed.\n this.propagateUpdate(related_streams, history, true);\n }", "function clearDb() {\n console.log( \"Clearing the cached query result.\" );\n dataCollection.remove( function () {});\n}", "removeQuery(id){\n var result = [];\n for (var i =0; i < this.queries.length; i++){\n if (this.queries[i].id != id){\n result.push(this.queries[i]);\n }\n }\n this.queries = result;\n }", "queryHasChanged(query) {\n return query !== this.query\n }", "function clearQueryData() {\n\t\t\tlastLogStamp = 0;\n\t\t\t$timeout.cancel(queryLogsTimeout);\n\t\t\t$timeout.cancel(displayLogsTimeout);\n\t\t\tcurQueryId = \"\";\n\t\t\t$scope.resultsAvailable = false;\n\t\t\t$scope.queryLogsBusy = false;\n\t\t\t$scope.resultsBusy = false;\n\t\t\t$scope.data.logs = [];\n\t\t\tupdateLogsText();\n\t\t\t$scope.data.queryResponse.schema = [];\n\t\t\t$scope.data.queryResponse.results = [];\n\t\t}", "resumeObservers() {\n // No-op if not paused.\n if (!this.paused) {\n return;\n } // Unset the 'paused' flag. Make sure to do this first, otherwise\n // observer methods won't actually fire when we trigger them.\n\n\n this.paused = false;\n Object.keys(this.queries).forEach(qid => {\n const query = this.queries[qid];\n\n if (query.dirty) {\n query.dirty = false; // re-compute results will perform `LocalCollection._diffQueryChanges`\n // automatically.\n\n this._recomputeResults(query, query.resultsSnapshot);\n } else {\n // Diff the current results against the snapshot and send to observers.\n // pass the query object for its observer callbacks.\n LocalCollection._diffQueryChanges(query.ordered, query.resultsSnapshot, query.results, query, {\n projectionFn: query.projectionFn\n });\n }\n\n query.resultsSnapshot = null;\n });\n\n this._observeQueue.drain();\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the flame behind the rocket
drawRocketFlame() { stroke('red') line(-50, 0, -100, 0) line(-50, 4, -70, 4) line(-50, -4, -85, -4) }
[ "function syanFireFly(fireflyParam){\n var firefly = new THREE.Object3D();\n // create the body of the firefly\n var bodyGeom = new THREE.SphereGeometry(fireflyParam.bodyRadius, 32, 32, 0, Math.PI);\n var bodyMat = new THREE.MeshLambertMaterial({color: fireflyParam.bodyColor, shading: THREE.FlatShading})\n var bodyMesh = new THREE.Mesh(bodyGeom, bodyMat);\n bodyMesh.rotation.y = 0;\n bodyMesh.scale.z = fireflyParam.scaleBodyZ;\n bodyMesh.castShadow = true;\n bodyMesh.receiveShadow = true;\n\n // create the light of the firefly\n var lightGeom = new THREE.SphereGeometry(fireflyParam.bodyRadius, 32, 32, 0, Math.PI);\n var lightMat = new THREE.MeshPhongMaterial({color: fireflyParam.lightColor, shading: THREE.FlatShading});\n var lightMesh = new THREE.Mesh(lightGeom, lightMat);\n lightMesh.rotation.y = Math.PI;\n lightMesh.scale.z = fireflyParam.scaleLightZ;\n\n // create the wings\n var rightWingGeom = new THREE.BoxGeometry(fireflyParam.wingWidth, fireflyParam.wingHeight, fireflyParam.wingDepth);\n var rightWing = new THREE.Mesh(rightWingGeom, bodyMat);\n rightWing.position.set(-fireflyParam.bodyRadius*2/3-fireflyParam.wingWidth/2, 0,\n fireflyParam.bodyRadius*(fireflyParam.scaleBodyZ + fireflyParam.scaleLightZ)/3);\n rightWing.rotation.z = -fireflyParam.wingAngle;\n var leftWing = rightWing.clone();\n leftWing.position.x = -rightWing.position.x;\n leftWing.rotation.z = -rightWing.rotation.z;\n\n // create the light\n var light = new THREE.SpotLight(fireflyParam.lightColor, fireflyParam.intensity,\n fireflyParam.distance, Math.PI*3/8, 0, 2);\n light.position.set(-fireflyParam.bodyRadius*fireflyParam.scaleLightZ, 0, 0);\n //light.castShadow = true;\n light.target = lightMesh;\n\n // add components to fly\n firefly.add(bodyMesh);\n firefly.add(lightMesh);\n firefly.add(rightWing);\n firefly.add(leftWing);\n firefly.add(light);\n return firefly;\n}", "function character_face_forward_jump() {\n //boosters flames front view\n fill(253, 207, 88);\n ellipse(gameChar_x - 18, gameChar_y + 5, 9, 25);\n fill(242, 145, 32);\n ellipse(gameChar_x - 18, gameChar_y + 5, 5, 19);\n fill(255, 244, 0);\n ellipse(gameChar_x - 18, gameChar_y + 5, 2, 13);\n fill(253, 207, 88);\n ellipse(gameChar_x + 18, gameChar_y + 5, 9, 25);\n fill(242, 145, 32);\n ellipse(gameChar_x + 18, gameChar_y + 5, 5, 19);\n fill(255, 244, 0);\n ellipse(gameChar_x + 18, gameChar_y + 5, 2, 13);\n character_face_forward();\n}", "function placeFlames() {\n// Calculate each position of candle tip and place flames for them.\n for(var i = 0; i < 16; i ++) {\n a = THREE.Math.degToRad(360 / 16 * i + initialAngle) + cakeModel.rotation.z;\n x = r * Math.cos(a);\n z = r * Math.sin(a);\n flame(true, x, z);\n }\n }", "function lime(x,y,col=color(204,255,0),eyeCol=color(204,255,0)) {\n\tstrokeWeight(1);\n\tstroke(0);\n\tfill(col); // green\n\tellipse(x, y, 320, 320); //body+face\t\n\n\tstrokeWeight(20); \n\tstroke(col); //green\n\tline(x-90, y+200, x-75, y+140); \n\t //leg #1\n\tline(x+90, y+200, x+75, y+140); \n\t //leg #2 \n\n\tellipse(x-108, y+200, 40, 20); \n\t //foot #1\n\tellipse(x+108, y+200, 40, 20); \n\t //foot #2 \n\n\tfill(250, 50, 0); \n\tarc(x, y+25, 130, 150, -1, PI+QUARTER_PI, PIE); \n\t //tongue \n\n\tfill(225);\n\tellipse(x-40, y+20, 10, 10); \n\t//random #1\n\tellipse(x+40, y+20, 10, 10); \n\t //random #2\n\n\tfill(250); \n\tellipse(x, y-100, 200, 110); \n\t //eye\n\n\tstroke(eyeCol);\n\tfill(1); \n\tellipse(x, y-100, 60, 60); \n\t//eyeball\n\n\tnoSmooth();\n\tstroke(250);\n\tpoint(x, y-85); \n\t //pupil #1\n\tpoint(x, y-115); \n\t //pupil #2\n\tpoint(x-15, y-100); \n\t //pupil #3\n\tpoint(x+15, y-100); \n\t //pupil #4 \n\n\tfill(1); \n\tellipse(x-10, y-35, 10, 10);\n\t //nostril #1\n\tellipse(x+10, y-35, 10, 10); \n\t //nostril #2 \n\n\tstrokeWeight(4); \n\tstroke(1); \n\tline(x-120, y-10, x+120, y-35); \n\t //upper-jawline\n\n\tstrokeWeight(4); \n\tfill(250); \n\ttriangle(x-110, y-10, x-90, y+20, x-70, y-14); \n\t //tooth left\n\ttriangle(x+70, y-29, x+90, y-5, x+110, y-33); \n\t //tooth right\n\ttriangle(x-20, y-20, x, y+10, x+20, y-24); \n\t // tooth center \n\n\tfill(225); \n\trect(x-10, y-210, 20, 50); \n\n\tfill(250); \n\tquad(x-40, y-245, x+40, y-245, x+40, y-210, x-40, y-210); \n\t // unnecessary banner\n\n\tnoFill();\n\tstrokeWeight(4); \n\tstroke(1);\n\tline(x-10, y-217, x-10, y-239); \n\t// \"M\" left leg\n\tstrokeJoin(MITER); \n\tbeginShape();\n\tvertex(x-10, y-238);\n\tvertex(x, y-228);\n\tvertex(x+10, y-238); \n\tendShape(); \n\t // \"M\" joiner \n\tline(x+10, y-217, x+10, y-238); \n\t// \"M\" right leg \n}", "flower(x,w,h,r,g,b){\n stroke(0,168,0)\n strokeWeight(3)\n //stem\n let vol = amp.getLevel()\n \n line(x, height, x, 1090 - vol * g)\n //leaves\n fill(0, 168, 0)\n stroke(100, 168, 0)\n ellipse(x - 8, height, 10, 120 - vol * 200)\n ellipse(x + 8, height, 8, 100)\n //flower bulb\n noStroke()\n strokeWeight(1)\n fill(r, g, b)\n arc(x, 1090 - vol * g, w, h,-QUARTER_PI,HALF_PI * 2)\n ellipse(x, 1090 - vol * g, w-15, h-30)\n }", "function updateFlake(flake) {\n\n //Make the overall direction of the flakes drift over time\n let windDirection = Math.floor(sin(tick/200) * 5);\n flake.staticY -= windDirection;\n\n //Move the flake along and make it travel in a horizontal wave\n flake.x -= flake.speed;\n flake.y = flake.staticY + sin((flake.x + flake.waveOffset)/flake.waveFrequency) * flake.waveHeight;\n if (flake.x < 1) {\n flake.x = width;\n flake.staticY = rand(0, height);\n }\n}", "function createFish(mx, my, t, a, ma, w, mxw, mw, r, g, b, spaz, speed) {\n var fish = {\n //properties\n loc: createVector(random(590), random(590)),\n vel: createVector(speed, speed),\n name: t,\n //velocity --> vector\n //loc --> vector\n skin: color(r, g, b),\n age: a,\n weight: w,\n tail: 1,\n tail1: 1,\n deltatail: .5,\n maxage: ma,\n maxweight: mxw,\n minweight: mxw / 10,\n tdi: 1,\n spez: spaz,\n\n //methods (properties that happen to be functions)\n show: function() {\n//this code makes the tails flap\n if (this.tail > 0 & this.tail < this.weight) {\n this.tail = this.tail + this.deltatail;\n this.tail1 = this.tail * this.tdi;\n } else {\n this.deltatail = -this.deltatail\n this.tail = this.tail + this.deltatail;\n this.tail1 = this.tail * this.tdi;\n }\n//draws the fish\n fill(this.skin);\n stroke(this.spez, 0, 0);\n triangle((this.loc.x - (this.weight / 2) * this.tdi - this.tail1), (this.loc.y + this.weight / 2), (this.loc.x - (this.weight / 2) * this.tdi - this.tail1), (this.loc.y - this.weight / 2), this.loc.x, this.loc.y);\n ellipse(this.loc.x, this.loc.y, this.weight, this.weight);\n rect(this.loc.x - (10) * this.weight / 40, this.loc.y - (5) * this.weight / 40, 20 * this.weight / 40, 10 * this.weight / 40)\n ellipse((this.loc.x + 10 * this.tdi * (this.weight / 40)), this.loc.y, 10 * (this.weight / 40), 10 * (this.weight / 40));\n fill(0, 0, 0);\n ellipse((this.loc.x + 10 * this.tdi * (this.weight / 40)), this.loc.y, 5 * (this.weight / 40), 5 * (this.weight / 40));\n text(this.name, this.loc.x - 5, this.loc.y - 5);\n },\n move: function() {\n //movement code goes here\n if (this.age <= this.maxage & this.weight <= this.maxweight & this.weight >= this.minweight) {\n//code for toriodal\n if (this.spez == 255) {\n if (this.loc.y >= height) {\n this.loc.y = this.weight / 2;\n }\n if (this.loc.y <= 0) {\n this.loc.y = height - this.weight / 2;\n }\n if (this.loc.x >= width - 5) {\n this.loc.x = this.weight / 2;\n }\n if (this.loc.x <= 0) {\n this.loc.x = width - this.weight / 2;\n }\n//code not for toriodal\n } else {\n if (this.loc.y >= height || this.loc.y <= 0) {\n this.vel.y *= -1;\n }\n if (this.loc.x >= width - 5 || this.loc.x <= 5) {\n this.vel.x *= -1;\n this.tdi *= -1;\n }\n }\n\n } // if the fish is dead\n else if (this.loc.y <= 40) {\n this.vel.y = 0;\n this.vel.x = 0;\n this.deltatail = 0;\n } else {\n this.vel.y = -1;\n this.vel.x = 0;\n this.deltatail = 0;\n }\n\n this.loc.add(this.vel)\n },\n//checks for colisions\n Collision: function(other) {\n return (other.weight / 2 + this.weight / 2 >= this.loc.dist(other.loc));\n },\n Collisionfish: function(other) {\n return ((other.weight / 2 + this.weight / 2)-1 > this.loc.dist(other.loc));\n },\n update: function() {\n this.show();\n this.age++;\n this.move();\n }\n }\n return fish;\n}", "flap(){\r\n this.bird.jump();\r\n }", "function victoryFanfare(){\n\t\tplaySound(2);\n\t\tsetTimeout(function(){\n\t\t\tplaySound(0);\n\t\t},400);\n\t\tsetTimeout(function(){\n\t\t\tplaySound(1);\n\t\t},800);\n\t\tsetTimeout(function(){\n\t\t\tplaySound(3);\n\t\t},1200);\n\t}", "function flameInfo() {\n if(mouseX > 365 && mouseX < 395 && mouseY > 442 && mouseY < 472) {\n fill(228,166,94);\n textSize(15);\n textAlign(LEFT);\n let undyingText = 'An immortal flame, once borne by Pyro Emperor Yeezus';\n text(undyingText,400,450,290,100);\n textAlign(CENTER);\n fill(255);\n text('Level:',428,505);\n text('Faith Per Second:',483,525);\n fill(255,0,0);\n text(autoLevel,465,505);\n text(autoLevel,575,525);\n }\n}", "flap() {\n // Setting to easily test different flap behaviour\n if (settings.shouldBirdFlapResetVelocity) {\n this.velocity = 0;\n }\n\n if (this.isBelowWater) {\n this._swim();\n } else {\n this._flap();\n }\n }", "function hair(){\n \n\tnoStroke();\n fill(30);\n\tbeginShape();\n\t\tvertex(400,320);\n vertex(383,295);\n vertex(366,291);\n vertex(354,247);\n vertex(334,240);\n vertex(345,226);\n vertex(350,206);\n vertex(361,201);\n vertex(368,182);\n vertex(394,161);\n vertex(400,161);\n vertex(391,152);\n vertex(396,147);\n vertex(402,146);\n vertex(401,140);\n vertex(409,141);\n vertex(413,144);\n vertex(419,155);\n vertex(455,140);\n vertex(449,150);\n vertex(466,145);\n vertex(479,146);\n vertex(465,153);\n vertex(493,150);\n vertex(496,153);\n vertex(504,155);\n vertex(501,165);\n vertex(526,165);\n vertex(530,166);\n vertex(525,171);\n vertex(534,180);\n vertex(532,189);\n vertex(549,215);\n vertex(541,251);\n vertex(542,266);\n vertex(538,280);\n vertex(529,291);\n vertex(515,250);\n vertex(506,227);\n vertex(500,240);\n vertex(488,226);\n vertex(470,233);\n vertex(454,233);\n vertex(433,242);\n vertex(430,249);\n vertex(419,242);\n vertex(418,252);\n vertex(424,264);\n vertex(413,279);\n vertex(404,288);\n vertex(410,323);\n vertex(400,320);\n endShape(CLOSE);\n\n}", "function sharkBite(player, shark) {\n if (this.shark.animations.currentAnim.name === \"right\")\n {this.shark.play('rightBite')}\n if (this.shark.animations.currentAnim.name === \"left\")\n {this.shark.play('leftBite')}\n this.player.body.velocity.y = -200;\n }", "function rook(){\n\t\t//Rook waves\n\t\told[ctr] = (friction*( ( (\t\n\t\t\t\t\tcur[lu0] +\n\t\t\tcur[ctr-1] + cur[ctr+1] +\n\t\t\t\t\tcur[ld0]\t\t\t) >> 1 ) - old[ctr] ) ) |0;\n\t}", "function scareFish(fish) {\n if (fish.d < 40 && smallSplash.isPlaying()) {\n setFish(fish);\n }\n}", "function drawFlame(h,x,y,c) {\n // TODO: Draw the flame based on the given inputs.\n}", "function swimFishLeft() {\n\trequestId = requestAnimationFrame(swimFishLeft);\n\tswimUpdate2();\n\tif (frame < 30)\n\t\tdrawFish1();\n\telse\n\t\tdrawFish2();\n}", "flame() {\n led.plotBrightness(2, 4, Math.randomRange(100, 200))\n }", "function addFlake(cW,cH){\n for (i=0;i<num_dots;i++){\n var x=Math.floor(Math.random() * cW) + 1;\n //var y=cH/4;\n var y=Math.floor(Math.random() * cH) + 1;\n var s=(speed_eachdot[currenttrial_t]+sspread*speed_eachdot[currenttrial_t]*Math.sqrt(-2*Math.log(Math.random()))*Math.cos(2*Math.PI*Math.random()));\n var rc=Math.round(255*colour_eachdot[currenttrial_t]+colour_spread*Math.sqrt(-2*Math.log(Math.random()))*Math.cos(2*Math.PI*Math.random()));\n if (rc>255){rc=255}; //colour must be between 0-255\n if (rc<0){rc=0};\n //console.log(s); console.log(rc);\n\n var rb=255-rc; /*blue color-want it to be between 1 and 255 at the moment...*/\n var rot=Math.random(); //not making them go in different direction at the moment but could do later if we wanted to...\n var ang=Math.floor(Math.random()*2+1); /*how much moving in x direction as well? Can change overall angle?*/\n //var ext=Math.round(Math.random()*liferange)+minlife; //setting lifetime for flake between minlife and maxlife...\n //console.log(x,y,s,rc,rb,rot,ang) //,ext\n flakes.push({\"x\":x,\"y\":y,\"s\":s,\"rc\":rc, \"rb\":rb, \"rot\":rot, \"ang\":ang}); //, \"ext\":ext\n\n if (i==num_dots){\n console.log(flakes[1]);\n };\n //console.log(flakes[1].ext);\n }; //for if loop\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build beta fuzzy functions Functions matching input command to data by using string similarity (provided by fuse.js).
function buildFuzzyCmds() { var data, columns; var columnprops = []; var columnnames = []; var options = { maxRows: 0, ignoreAliases: false, ignoreSelection: true }; activeSheet.getUnderlyingDataAsync(options).then(function (d) { data = d; columns = data.getColumns(); columns.forEach(function(item, index, array) { var singlecolumn = { index: item.getIndex(), name: item.getFieldName() }; columnprops.push(singlecolumn); columnnames.push(item.getFieldName()); }); var cmds = { /*'test *multiple words': function() { alert('Multiple!'); },*/ 'select *mark from column *column': fuzzySelect, 'display (data for) country *country': displayCountryData }; var cmdKeys = Object.keys(cmds); var cmdString = cmdKeys.join("<br>"); annyang.addCommands(cmds); $("#cmdTarget").append("<h2 class='available'>Beta Command String Similarity:</h2>" + "<p>Suitable for Country & Region</p><p>" + cmdString + "</p>"); }); /** * Mark selection function executed on voice command match. * Selecting marks by matching with string similarity (provided by fuse.js) of input command. * @param {String} mark - desired mark from fetched voice input * @param {String} column - desired column from fetched voice input */ function fuzzySelect(mark, column) { var columnindex; var marks = []; // fuzzy-search in column array for voice input column var fusecolumns = new Fuse(columnnames, fuseoptions); var fuzzycolumnresult = fusecolumns.search(column); var columnmatch = columnnames[fuzzycolumnresult[0]]; for (let item of columnprops) { if (item.name === columnnames[fuzzycolumnresult[0]]) { columnindex = item.index; break; } } var rowData = data.getData(); for (var i = 0; i < rowData.length; i++) { var dataelement = rowData[i]; var help = dataelement[columnindex].formattedValue.toString(); marks.push(help); } // fuzzy-search for voice input mark in previous obtained column data var fusemarks = new Fuse(marks, fuseoptions); var fuzzymarkresult = fusemarks.search(mark); var markmatch = marks[fuzzymarkresult[0]]; // actual select operation activeSheet.selectMarksAsync( columnmatch, markmatch, tableau.FilterUpdateType.REPLACE); } /** * Data display function executed on voice command match. * Displaying data of a specific mark in a popup by matching with string similarity * (provided by fuse.js) of input command. * @param {String} country - desired mark from fetched voice input */ function displayCountryData(country) { var rowData = data.getData(); var countries = []; var fusecolumns = new Fuse(columnnames, fuseoptions); var fuzzycolumnresult = fusecolumns.search("Country"); var columnmatch = columnnames[fuzzycolumnresult[0]]; var columnindex; for (let item of columnprops) { if (item.name === columnmatch) { columnindex = item.index; break; } } for (var i = 0; i < rowData.length; i++) { var dataelement = rowData[i]; var help = dataelement[columnindex].formattedValue.toString(); countries.push(help); } var fusecountries = new Fuse(countries, fuseoptions); var fuzzycountryresult = fusecountries.search(country); var countrymatch = countries[fuzzycountryresult[0]]; var countryboxtitle = "Data of Country "; var countrystring = ""; countryboxtitle = countryboxtitle.concat(countrymatch, ": "); /** iterate over country data, if there's a match with the result of the fuzzy-search, a string containing the country's data is built. Once it's done, the for-loop is aborted. */ for (var i = 0; i < rowData.length; i++) { var dataelement = rowData[i]; if (dataelement[columnindex].formattedValue.toString() === countrymatch) { for (var i = 0; i < dataelement.length; i++) { countrystring = countrystring.concat(columnnames[i], ": ", dataelement[i].formattedValue.toString(), "<br>"); } break; } } // display JQuery dialog popup containing country data $("<div>"+countrystring+"</div>").dialog({ title: countryboxtitle }); } }
[ "function DiversiFuzzy(reZ, hashCombos) {\n //VAR: reZ = string that is the format for RegExpFuzzy\n\n //CLASS: Extension of RegExpFuzzy that will allow to swap individual words. Play on \"Diversiform\"\n DiversiFuzzy.flagSwap = '@@'; //if present, then this RegExpZ can be swapped with different strings designated by a hash\n DiversiFuzzy.delimInfo = g_delimInfo;\n DiversiFuzzy.delimGroup = g_delimGroup;\n\n}", "fuzzySearch(sentence) {\n const searchFor = sentence.match(/^(?:\\bwho\\b|\\bwhat\\b) (?:is|are)(?: \\ban?\\b | \\bthe\\b | )([a-zA-Z0-9_ ]*)/i)[1].replace(/\\?/g, '').replace(/'/g, '');\n const instances = this.node.getInstances();\n let multipleSearch;\n let instancesFiltered = [];\n\n if (searchFor.indexOf(' ')) {\n multipleSearch = searchFor.split(' ');\n }\n\n if (multipleSearch) {\n for (let x = 0; x < multipleSearch.length; x += 1) {\n const instancesFilteredTemp = instances.filter((input) => {\n if (input.name.toUpperCase().includes(multipleSearch[x].toUpperCase())) {\n return input;\n }\n return null;\n });\n instancesFiltered = instancesFiltered.concat(instancesFilteredTemp);\n }\n } else {\n instancesFiltered = instances.filter((input) => {\n if (input.name.toUpperCase().includes(searchFor.toUpperCase())) {\n return input;\n }\n return null;\n });\n }\n\n const instancesSummary = instancesFiltered.reduce((previous, current) => {\n const prev = previous;\n if (!prev[current.type.name]) {\n prev[current.type.name] = [];\n }\n prev[current.type.name].push(current.name);\n return prev;\n }, {});\n\n return instancesSummary;\n }", "function FSS_BuildFuzzyImplicationFrom(fa, fi, dmin, dmax)\n{\n\tvar i, n, x, y;\n\tvar resultFSS = new FSS(\"\");\n\t\n\n\t//\n\tn = this.coordX.length;\n\t//post(\"n=\", n, \"\\n\");\n\t//this.FSS_TextDisplay();\n\t\n\t//post(\"FuzzyImplication\\n\");\n\t//post(\"x=\", x, \"y=\", y, \"\\n\");\n\tswitch(fi)\n\t{\n\t\t//_____________________________________________________________________//\n\t\tcase FI_REICHENBACH:\n\t\t//post(\"fa=\", fa, \"\\n\");\n\t\tfor (i=0; i < n; i++)\n\t\t{\n\t\t\tx = this.coordX[i];\n\t\t\ty = this.coordY[i];\n\t\t\tresultFSS.FSS_AppendPoint(x, 1.0-fa+fa*y);\n\t\t}\n\t\tresultFSS.FSS_CompleteWithZeros(dmin, dmax);\n\t\t//post(\"\\n\\n\");\n\t\t//post(\"Fuzzy Implication ->\");\n\t\t//resultFSS.FSS_TextDisplay();\n\t\tbreak;\n\t\t\n\t\t//_____________________________________________________________________//\n\t\tcase FI_WILLMOTT:\n\t\tvar fss1 = new FSS(\"\");\n\t\tvar fss2 = new FSS(\"\");\n\t\tvar fss3 = new FSS(\"\");\n\t\t//Build Min(fa, fB) FSS//\n\t\t//first build fa constant FSS, then operate min with current FSS//\n\t\t//fss1.FSS_AppendPoint(this.coordX[0], 0.0);\n\t\tfss1.FSS_AppendPoint(this.coordX[0], fa);\n\t\tfss1.FSS_AppendPoint(this.coordX[n-1], fa);\n\t\t//fss1.FSS_AppendPoint(this.coordX[n-1], 0.0);\n\t\tfss2 = LV_Operation(TNORM_MIN, fss1, this, dmin, dmax);\n\t\t//Build Max(1-fa, previous min)//\n\t\t//fss3.FSS_AppendPoint(this.coordX[0], 0.0);\n\t\tfss3.FSS_AppendPoint(this.coordX[0], 1.0-fa);\n\t\tfss3.FSS_AppendPoint(this.coordX[n-1], 1.0-fa);\n\t\t//fss3.FSS_AppendPoint(this.coordX[n-1], 0.0);\n\t\tresultFSS = LV_Operation(TCONORM_MAX, fss3, fss2, dmin, dmax);\n\t\t//post(\"Fuzzy Implication ->\");\n\t\t//resultFSS.FSS_TextDisplay();\n\t\tbreak;\n\t\t\n\t\t//_____________________________________________________________________//\n\t\tcase FI_RESCHER_GAINES:\n\t\tvar fss1 = new FSS(\"\");\n\t\t//Build Max(fa, fb) FSS//\n\t\t//First build fa constant FSS//\n\t\tfss1.FSS_AppendPoint(this.coordX[0], fa);\n\t\tfss1.FSS_AppendPoint(this.coordX[n-1], fa);\n\t\tresultFSS = LV_Operation(TNORM_MIN, fss1, this, dmin, dmax);\n\t\t//Then replace fa values by 0, and other values greater than fa by 1//\n\t\tn = resultFSS.FSS_GetNumberOfCoord();\n\t\tfor (i=0; i < n; i++)\n\t\t{\n\t\t\ty = resultFSS.FSS_GetCoordY(i);\n\t\t\t//post(\"y=\", y, \"fa=\", fa, \"\\n\");\n\t\t\tif (y >= fa)\n\t\t\t{\n\t\t\t\tresultFSS.FSS_SetCoordY(1.0, i);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresultFSS.FSS_SetCoordY(0.0, i);\n\t\t\t}\n\t\t}\n\t\t//\n\t\ti = 0;\n\t\twhile (i < resultFSS.FSS_GetNumberOfCoord())\n\t\t{\n\t\t\tx = resultFSS.FSS_GetCoordX(i);\n\t\t\tif (resultFSS.FSS_GetCoordY(i) == 1.0)\n\t\t\t{\n\t\t\t\tif (i > 0)\n\t\t\t\t{\n\t\t\t\t\tif ((resultFSS.FSS_GetCoordY(i-1) == 0.0) && (x > resultFSS.FSS_GetCoordX(i-1)))\n\t\t\t\t\t{\n\t\t\t\t\t\t//in this case, we insert a zero at position i//\n\t\t\t\t\t\t//post(\"Avant insertion up = \");\n\t\t\t\t\t\t//resultFSS.FSS_TextDisplay();\n\t\t\t\t\t\tresultFSS.FSS_InsertPointAtPosition(resultFSS.FSS_GetCoordX(i), 0., i);\n\t\t\t\t\t\t//post(\"Après insertion = \");\n\t\t\t\t\t\t//resultFSS.FSS_TextDisplay();\n\t\t\t\t\t\t//resultFSS.FSS_SetCoordX(resultFSS.FSS_GetCoordX(i), i-1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i < resultFSS.FSS_GetNumberOfCoord()-1)\n\t\t\t\t{\n\t\t\t\t\tif ((resultFSS.FSS_GetCoordY(i+1) == 0.0) && (x < resultFSS.FSS_GetCoordX(i+1)))\n\t\t\t\t\t{\n\t\t\t\t\t\t//post(\"Avant insertion down = \");\n\t\t\t\t\t\t//resultFSS.FSS_TextDisplay();\n\t\t\t\t\t\t//in this case, we insert a zero at position i+1//\n\t\t\t\t\t\tresultFSS.FSS_InsertPointAtPosition(resultFSS.FSS_GetCoordX(i), 0., i+1);\n\t\t\t\t\t\t//post(\"Après insertion = \");\n\t\t\t\t\t\t//resultFSS.FSS_TextDisplay();\n\t\t\t\t\t\t//resultFSS.FSS_SetCoordX(resultFSS.FSS_GetCoordX(i), i+1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ti += 1;\n\t\t}\n\t\tresultFSS.FSS_CompleteWithZeros(dmin, dmax);\n\t\t//post(\"Fuzzy Implication ->\");\n\t\t//resultFSS.FSS_TextDisplay();\n\t\t//resultFSS.FSS_TextDisplay();\n\t\tbreak;\n\t\t\n\t\t//_____________________________________________________________________//\n\t\tcase FI_KLEENE_DIENES:\n\t\tvar fss1 = new FSS(\"\");\n\t\t//Build Max(1-fa, fb) FSS//\n\t\t//First build 1-fa constant FSS//\n\t\tfss1.FSS_AppendPoint(this.coordX[0], 1.0-fa);\n\t\tfss1.FSS_AppendPoint(this.coordX[n-1], 1.0-fa);\n\t\tresultFSS = LV_Operation(TCONORM_MAX, fss1, this, dmin, dmax);\n\t\t//post(\"Fuzzy Implication ->\");\n\t\t//resultFSS.FSS_TextDisplay();\n\t\t//y2 = Math.max(1.0-fa, y);\n\t\tbreak;\n\t\t\n\t\t\n\t\t//_____________________________________________________________________//\n\t\tcase FI_BROUWER_GOEDEL:\n\t\tvar fss1 = new FSS(\"\");\n\t\t//Build Max(fa, fb) FSS//\n\t\t//First build fa constant FSS//\n\t\tfss1.FSS_AppendPoint(this.coordX[0], fa);\n\t\tfss1.FSS_AppendPoint(this.coordX[n-1], fa);\n\t\tresultFSS = LV_Operation(TNORM_MIN, fss1, this, dmin, dmax);\n\t\t//Then replace fa values by 0, and other values greater than fa by 1//\n\t\t//n = resultFSS.FSS_GetNumberOfCoord();\n\t\ti=0;\n\t\twhile ((i < resultFSS.FSS_GetNumberOfCoord()) && (i < 40))\n\t\t{\n\t\t\t//post(\"i=\", i, \"\\n\");\n\t\t\tx = resultFSS.FSS_GetCoordX(i);\n\t\t\ty = resultFSS.FSS_GetCoordY(i);\n\t\t\t//post(\"y=\", y, \"fa=\", fa, \"nbre de points =\", resultFSS.FSS_GetNumberOfCoord(), \"\\n\");\n\t\t\tif ((y > fa) || (Math.abs(y-fa) < 0.001))\n\t\t\t{\n\t\t\t\tresultFSS.FSS_SetCoordY(1.0, i);\n\t\t\t\t//post(\"y modification to 1 => \");\n\t\t\t\t//resultFSS.FSS_TextDisplay();\n\t\t\t\t//insert another point//\n\t\t\t\tif (i > 0)\n\t\t\t\t{\n\t\t\t\t\tif ((resultFSS.FSS_GetCoordY(i-1) < y) && (x > resultFSS.FSS_GetCoordX(i-1)))\n\t\t\t\t\t{\n\t\t\t\t\t\t//post(\"Insertion before\\n\");\n\t\t\t\t\t\tresultFSS.FSS_InsertPointAtPosition(resultFSS.FSS_GetCoordX(i), y, i);\n\t\t\t\t\t\t//resultFSS.FSS_TextDisplay();\n\t\t\t\t\t\ti += 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i < resultFSS.FSS_GetNumberOfCoord()-1)\n\t\t\t\t{\n\t\t\t\t\tif ((resultFSS.FSS_GetCoordY(i+1) < y) && (x < resultFSS.FSS_GetCoordX(i+1)))\n\t\t\t\t\t{\n\t\t\t\t\t\t//post(\"Insertion after\\n\");\n\t\t\t\t\t\tresultFSS.FSS_InsertPointAtPosition(resultFSS.FSS_GetCoordX(i), y, i+1);\n\t\t\t\t\t\t//resultFSS.FSS_TextDisplay();\n\t\t\t\t\t\ti += 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ti += 1;\n\t\t}\n\t\t\n\t\tresultFSS.FSS_CompleteWithZeros(dmin, dmax);\n\t\t//post(\"Fuzzy Implication ->\");\n\t\t//resultFSS.FSS_TextDisplay();\n\t\t//resultFSS.FSS_TextDisplay();\n\t\tbreak;\n\t\t\n\t\t\n\t\t//_____________________________________________________________________//\n\t\tcase FI_GOGUEN:\n\t\tvar fss1 = new FSS(\"\");\n\t\tvar fss2 = new FSS(\"\");\n\t\t//post(\"______\\n\");\n\t\tif (fa == 0.0)\n\t\t{\n\t\t\t//post(\"fa = 0\\n\");\n\t\t\tresultFSS.FSS_AppendPoint(this.coordX[0], 0.0);\n\t\t\tresultFSS.FSS_AppendPoint(this.coordX[0], 1.0);\n\t\t\tresultFSS.FSS_AppendPoint(this.coordX[n-1], 1.0);\n\t\t\tresultFSS.FSS_AppendPoint(this.coordX[n-1], 0.0);\n\t\t\t//resultFSS.FSS_TextDisplay();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//post(\"fa != 0\\n\");\n\t\t\tfor (i=0; i < n; i++)\n\t\t\t{\n\t\t\t\tx = this.coordX[i];\n\t\t\t\ty = this.coordY[i];\n\t\t\t\tfss1.FSS_AppendPoint(x, y/fa);\n\t\t\t\n\t\t\t}\n\t\t\t//fss1.FSS_TextDisplay();\n\t\t\t//fss2.FSS_AppendPoint(this.coordX[0], 0.0);\n\t\t\tfss2.FSS_AppendPoint(this.coordX[0], 0.0);\n\t\t\tfss2.FSS_AppendPoint(this.coordX[0], 1.0);\n\t\t\tfss2.FSS_AppendPoint(this.coordX[n-1], 1.0);\n\t\t\tfss2.FSS_AppendPoint(this.coordX[n-1], 0.0);\n\t\t\t//fss2.FSS_AppendPoint(this.coordX[n-1], 0.0);\n\t\t\t//fss2.FSS_TextDisplay();\n\t\t\tresultFSS = LV_Operation(TNORM_MIN, fss1, fss2, dmin, dmax);\n\t\t\t//resultFSS.FSS_TextDisplay();\n\t\t}\n\t\tbreak;\n\t\t\n\t\t//_____________________________________________________________________//\n\t\tcase FI_LUKASIEWICZ:\n\t\t//post(\"______\\n\");\n\t\tvar fss1 = new FSS(\"\");\n\t\tvar fss2 = new FSS(\"\");\n\t\t\n\t\tfor (i=0; i < n; i++)\n\t\t{\n\t\t\tx = this.coordX[i];\n\t\t\ty = this.coordY[i];\n\t\t\tfss1.FSS_AppendPoint(x, 1.0-fa+y);\n\t\t\t\n\t\t}\n\t\t//fss1.FSS_TextDisplay();\n\t\tfss2.FSS_AppendPoint(this.coordX[0], 0.0);\n\t\tfss2.FSS_AppendPoint(this.coordX[0], 1.0);\n\t\tfss2.FSS_AppendPoint(this.coordX[n-1], 1.0);\n\t\tfss2.FSS_AppendPoint(this.coordX[n-1], 0.0);\n\t\t//fss2.FSS_TextDisplay();\n\t\tresultFSS = LV_Operation(TNORM_MIN, fss1, fss2, dmin, dmax);\n\t\t//resultFSS.FSS_TextDisplay();\n\t\t//y2 = Math.min(1.0-fa+y, 1.);\n\t\tbreak;\n\t\t\n\t\t//_____________________________________________________________________//\n\t\tcase FI_MAMDANI:\n\t\tvar fss1 = new FSS(\"\");\n\t\tfss1.FSS_AppendPoint(this.coordX[0], 0.0);\n\t\tfss1.FSS_AppendPoint(this.coordX[0], fa);\n\t\tfss1.FSS_AppendPoint(this.coordX[n-1], fa);\n\t\tfss1.FSS_AppendPoint(this.coordX[n-1], 0.0);\n\t\tresultFSS = LV_Operation(TNORM_MIN, fss1, this, dmin, dmax);\n\t\t//y2 = Math.min(fa,y);\n\t\tbreak;\n\t\t\n\t\t//\n\t\t//_____________________________________________________________________//\n\t\tcase FI_LARSEN:\n\t\t\n\t\tfor (i=0; i < n; i++)\n\t\t{\n\t\t\tx = this.coordX[i];\n\t\t\ty = this.coordY[i];\n\t\t\tresultFSS.FSS_AppendPoint(x, fa*y);\n\t\t}\n\t\tbreak;\n\t}\n\t\n\treturn resultFSS;\n}", "function fuzzyOutMFTriangular(variables){\n if(typeof(variables) != \"object\") variables = [variables];\n return salfunction(variables, fuzzyOutMFTriangularelements, fuzzyOutMFTriangularcache);\n}", "function autoPairFnBuilder(options) {\n options = options || {};\n options.createPair =\n options.createPair ||\n function _defaultCreatePair(params) {\n params = params || {};\n var a = params.listA.splice(params.indexA, 1)[0];\n var b = params.listB.splice(params.indexB, 1)[0];\n var aInBIndex = params.listB.indexOf(a);\n var bInAIndex = params.listA.indexOf(b);\n if (aInBIndex !== -1) {\n params.listB.splice(aInBIndex, 1);\n }\n if (bInAIndex !== -1) {\n params.listA.splice(bInAIndex, 1);\n }\n return this._pair(a, b, { silent: true });\n };\n // compile these here outside of the loop\n var _regexps = [];\n function getRegExps() {\n if (!_regexps.length) {\n _regexps = [new RegExp(this.filters[0]), new RegExp(this.filters[1])];\n }\n return _regexps;\n }\n // mangle params as needed\n options.preprocessMatch =\n options.preprocessMatch ||\n function _defaultPreprocessMatch(params) {\n var regexps = getRegExps.call(this);\n return _.extend(params, {\n matchTo: params.matchTo.name.replace(regexps[0], \"\"),\n possible: params.possible.name.replace(regexps[1], \"\")\n });\n };\n\n return function _strategy(params) {\n this.debug(\"autopair _strategy ---------------------------\");\n params = params || {};\n var listA = params.listA;\n var listB = params.listB;\n var indexA = 0;\n var indexB;\n\n var bestMatch = {\n score: 0.0,\n index: null\n };\n\n var paired = [];\n //console.debug( 'params:', JSON.stringify( params, null, ' ' ) );\n this.debug(\"starting list lens:\", listA.length, listB.length);\n this.debug(\"bestMatch (starting):\", JSON.stringify(bestMatch, null, \" \"));\n\n while (indexA < listA.length) {\n var matchTo = listA[indexA];\n bestMatch.score = 0.0;\n\n for (indexB = 0; indexB < listB.length; indexB++) {\n var possible = listB[indexB];\n this.debug(`${indexA}:${matchTo.name}`);\n this.debug(`${indexB}:${possible.name}`);\n\n // no matching with self\n if (listA[indexA] !== listB[indexB]) {\n bestMatch = options.match.call(\n this,\n options.preprocessMatch.call(this, {\n matchTo: matchTo,\n possible: possible,\n index: indexB,\n bestMatch: bestMatch\n })\n );\n this.debug(\"bestMatch:\", JSON.stringify(bestMatch, null, \" \"));\n if (bestMatch.score === 1.0) {\n this.debug(\"breaking early due to perfect match\");\n break;\n }\n }\n }\n var scoreThreshold = options.scoreThreshold.call(this);\n this.debug(\"scoreThreshold:\", scoreThreshold);\n this.debug(\"bestMatch.score:\", bestMatch.score);\n\n if (bestMatch.score >= scoreThreshold) {\n //console.debug( 'autoPairFnBuilder.strategy', listA[ indexA ].name, listB[ bestMatch.index ].name );\n paired.push(\n options.createPair.call(this, {\n listA: listA,\n indexA: indexA,\n listB: listB,\n indexB: bestMatch.index\n })\n );\n //console.debug( 'list lens now:', listA.length, listB.length );\n } else {\n indexA += 1;\n }\n if (!listA.length || !listB.length) {\n return paired;\n }\n }\n this.debug(\"paired:\", JSON.stringify(paired, null, \" \"));\n this.debug(\"autopair _strategy ---------------------------\");\n return paired;\n };\n}", "function fuzzySearch(str, arr){\n console.log('allItems is a thing', allItems[1]);\n\n let results = fuzzy.filter(str, arr);\n console.log('string searched', str.toLowerCase());\n let matches = results.map(function(el) {\n console.log('found: ', el)\n return el;\n });\n console.log('matches', matches, results);\n\n return matches;\n}", "function autoPairFnBuilder( options ){\n options = options || {};\n options.createPair = options.createPair || function _defaultCreatePair( params ){\n params = params || {};\n var a = params.listA.splice( params.indexA, 1 )[0],\n b = params.listB.splice( params.indexB, 1 )[0],\n aInBIndex = params.listB.indexOf( a ),\n bInAIndex = params.listA.indexOf( b );\n if( aInBIndex !== -1 ){ params.listB.splice( aInBIndex, 1 ); }\n if( bInAIndex !== -1 ){ params.listA.splice( bInAIndex, 1 ); }\n return this._pair( a, b, { silent: true });\n };\n // compile these here outside of the loop\n var _regexps = [];\n function getRegExps(){\n if( !_regexps.length ){\n _regexps = [\n new RegExp( this.filters[0] ),\n new RegExp( this.filters[1] )\n ];\n }\n return _regexps;\n }\n // mangle params as needed\n options.preprocessMatch = options.preprocessMatch || function _defaultPreprocessMatch( params ){\n var regexps = getRegExps.call( this );\n return _.extend( params, {\n matchTo : params.matchTo.name.replace( regexps[0], '' ),\n possible : params.possible.name.replace( regexps[1], '' )\n });\n };\n\n return function _strategy( params ){\n this.debug( 'autopair _strategy ---------------------------' );\n params = params || {};\n var listA = params.listA,\n listB = params.listB,\n indexA = 0, indexB,\n bestMatch = {\n score : 0.0,\n index : null\n },\n paired = [];\n //console.debug( 'params:', JSON.stringify( params, null, ' ' ) );\n this.debug( 'starting list lens:', listA.length, listB.length );\n this.debug( 'bestMatch (starting):', JSON.stringify( bestMatch, null, ' ' ) );\n\n while( indexA < listA.length ){\n var matchTo = listA[ indexA ];\n bestMatch.score = 0.0;\n\n for( indexB=0; indexB<listB.length; indexB++ ){\n var possible = listB[ indexB ];\n this.debug( indexA + ':' + matchTo.name );\n this.debug( indexB + ':' + possible.name );\n\n // no matching with self\n if( listA[ indexA ] !== listB[ indexB ] ){\n bestMatch = options.match.call( this, options.preprocessMatch.call( this, {\n matchTo : matchTo,\n possible: possible,\n index : indexB,\n bestMatch : bestMatch\n }));\n this.debug( 'bestMatch:', JSON.stringify( bestMatch, null, ' ' ) );\n if( bestMatch.score === 1.0 ){\n this.debug( 'breaking early due to perfect match' );\n break;\n }\n }\n }\n var scoreThreshold = options.scoreThreshold.call( this );\n this.debug( 'scoreThreshold:', scoreThreshold );\n this.debug( 'bestMatch.score:', bestMatch.score );\n\n if( bestMatch.score >= scoreThreshold ){\n //console.debug( 'autoPairFnBuilder.strategy', listA[ indexA ].name, listB[ bestMatch.index ].name );\n paired.push( options.createPair.call( this, {\n listA : listA,\n indexA : indexA,\n listB : listB,\n indexB : bestMatch.index\n }));\n //console.debug( 'list lens now:', listA.length, listB.length );\n } else {\n indexA += 1;\n }\n if( !listA.length || !listB.length ){\n return paired;\n }\n }\n this.debug( 'paired:', JSON.stringify( paired, null, ' ' ) );\n this.debug( 'autopair _strategy ---------------------------' );\n return paired;\n };\n}", "function calculateFuzzyOutput(fuzzyArrivingCars, fuzzyWaitingCars, fuzzyFogLevel) {\n // Structura set reguli:\n // fuzzy masini ce vin spre semafor pe verde,\n // fuzzy masini ce asteapta al rosu,\n // fuzzy ceata,\n // fuzzy durata semafor (verde)\n let rulesSet = [\n ['h', 'l', 'l', 'mica'],\n ['h', 'l', 'm', 'medie'],\n ['h', 'l', 'h', 'mare'],\n ['h', 'm', 'l', 'medie'],\n ['h', 'm', 'm', 'medie'],\n ['h', 'm', 'h', 'mare'],\n ['h', 'h', 'l', 'mare'],\n ['h', 'h', 'm', 'mare'],\n ['h', 'h', 'h', 'mare'],\n ['m', 'l', 'l', 'mica'],\n ['m', 'l', 'm', 'medie'],\n ['m', 'l', 'h', 'medie'],\n ['m', 'm', 'l', 'medie'],\n ['m', 'm', 'm', 'medie'],\n ['m', 'm', 'h', 'medie'],\n ['m', 'h', 'l', 'mare'],\n ['m', 'h', 'm', 'mare'],\n ['m', 'h', 'h', 'medie'],\n ['l', 'l', 'l', 'mica'],\n ['l', 'l', 'm', 'medie'],\n ['l', 'l', 'h', 'medie'],\n ['l', 'm', 'l', 'medie'],\n ['l', 'm', 'm', 'mare'],\n ['l', 'm', 'h', 'medie'],\n ['l', 'h', 'l', 'mica'],\n ['l', 'h', 'm', 'medie'],\n ['l', 'h', 'h', 'mare'],\n ];\n\n // Returneaza outputul in functie de reguli si parametrii functiei\n for(let i = 0; i < rulesSet.length; i++) {\n if(rulesSet[i][0] === fuzzyArrivingCars\n && rulesSet[i][1] === fuzzyWaitingCars\n && rulesSet[i][2] === fuzzyFogLevel) {\n return rulesSet[i][3];\n }\n }\n}", "function generateFuzzyPatterns( string ) {\n\t\tvar stringLength = string.length,\n\t\t patternString = '',\n\t\t startPatternString = '',\n\t\t pattern,\n\t\t startPattern,\n\t\t character;\n\n\t\tconsole.log(\"string\", string);\n\n\t\t// word\n\t\t// .*w.*o.*r.*d.*\n\t\tfor ( var i = 0; i < stringLength; i++ ) {\n\t\t\tconsole.log(\"character\", i, character);\n\t\t\tcharacter = string.charAt(i);\n\t\t\tcharacter = character.replace(/([\\.\\[\\]\\\\\\/\\+\\*\\?])/g,'\\\\$1');\n\t\t\tstartPatternString += character + '.*';\n\t\t}\n\n\t\tpatternString = '^.*' + startPatternString;\n\t\tstartPatternString = '^' + startPatternString;\n\n\t\tconsole.log(\"patternString\", patternString);\n\t\tconsole.log(\"startPatternString\", startPatternString);\n\n\t\tpattern = new RegExp(patternString, 'i');\n\t\tstartPattern = new RegExp(startPatternString, 'i');\n\n\t\tconsole.log(\"pattern\", pattern);\n\n\t\treturn [startPattern, pattern];\n\t}", "function Search(case_sentences_for_indexing) {\n\n //Configuring options for Fuse library\n var fuse_options = {\n shouldSort: true,\n includeScore: false,\n threshold: 0.6,\n location: 0,\n distance: 100,\n maxPatternLength: 200,\n minMatchCharLength: 1,\n keys: [\n \"title\"\n ]\n };\n\n\n //TEST DATA//\n //STOPWORDS are words we don't want to be included in search\n const STOPWORDS = [\"a\", \"about\", \"above\", \"after\", \"again\", \"against\", \"all\", \"am\", \"an\", \"and\", \"any\",\"are\",\"aren't\",\"as\",\"at\",\"be\",\"because\",\"been\",\"before\",\"being\",\"below\",\"between\",\"both\",\"but\",\"by\",\"can't\",\"cannot\",\"could\",\"couldn't\",\"did\",\"didn't\",\"do\",\"does\",\"doesn't\",\"doing\",\"don't\",\"down\",\"during\",\"each\",\"few\",\"for\",\"from\",\"further\",\"had\",\"hadn't\",\"has\",\"hasn't\",\"have\",\"haven't\",\"having\",\"he\",\"he'd\",\"he'll\",\"he's\",\"her\",\"here\",\"here's\",\"hers\",\"herself\",\"him\",\"himself\",\"his\",\"how\",\"how's\",\"i\",\"i'd\",\"i'll\",\"i'm\",\"i've\",\"if\",\"in\",\"into\",\"is\",\"isn't\",\"it\",\"it's\",\"its\",\"itself\",\"let's\",\"me\",\"more\",\"most\",\"mustn't\",\"my\",\"myself\",\"no\",\"nor\",\"not\",\"of\",\"off\",\"on\",\"once\",\"only\",\"or\",\"other\",\"ought\",\"our\",\"ours\",\"ourselves\",\"out\",\"over\",\"own\",\"same\",\"shan't\",\"she\",\"she'd\",\"she'll\",\"she's\",\"should\",\"shouldn't\",\"so\",\"some\",\"such\",\"than\",\"that\",\"that's\",\"the\",\"their\",\"theirs\",\"them\",\"themselves\",\"then\",\"there\",\"there's\",\"these\",\"they\",\"they'd\",\"they'll\",\"they're\",\"they've\",\"this\",\"those\",\"through\",\"to\",\"too\",\"under\",\"until\",\"up\",\"very\",\"was\",\"wasn't\",\"we\",\"we'd\",\"we'll\",\"we're\",\"we've\",\"were\",\"weren't\",\"what\",\"what's\",\"when\",\"when's\",\"where\",\"where's\",\"which\",\"while\",\"who\",\"who's\",\"whom\",\"why\",\"why's\",\"with\",\"won't\",\"would\",\"wouldn't\",\"you\",\"you'd\",\"you'll\",\"you're\",\"you've\",\"your\",\"yours\",\"yourself\",\"yourselves\"];\n \n // Sentences that are being searched through\n var caseSentences = case_sentences_for_indexing;\n\n removeStopwordsFromCaseSentences();\n\n //Initializing Fuse search library\n var fuse = new Fuse(caseSentences, fuse_options);\n\n\n // String -> String\n function removeStopwordsFromSentence(sentence){\n sentenceWordList = sentence.split(\" \");\n for (var i = 0; i < STOPWORDS.length; i++) {\n sentenceWordList = sentenceWordList.filter(word => word != STOPWORDS[i]);\n }\n //console.log(sentenceWordList);\n trimmedSentence = sentenceWordList.join(\" \")\n //console.log(trimmedSentence);\n return trimmedSentence;\n }\n\n function removeStopwordsFromCaseSentences(){\n for (var i = 0; i<caseSentences.length; i++) {\n caseSentences[i] = removeStopwordsFromSentence(caseSentences[i]);\n }\n }\n\n\n\n this.find_sentence_in_case = function(sentence_to_be_found) {\n trimmedSentence = removeStopwordsFromSentence(sentence_to_be_found);\n var result = fuse.search(trimmedSentence);\n //console.log(result[0]);\n return result[0];\n }\n \n}", "function selectBestMatchingUnit(pattern, codebookVectors) {\n let bmu = null;\n let bmuDistance = null;\n for (let codebookVector of codebookVectors) {\n let distance = euclidean_distance(codebookVector.vector, pattern);\n // console.log(distance,\"distance\");\n bmu = bmu === null || bmuDistance > distance ? codebookVector : bmu;\n bmuDistance = bmuDistance === null || bmuDistance > distance ? distance : bmuDistance;\n }\n return bmu;\n}", "function fuzzyMatch(drivers, query) {\n // console.log(drivers, \"drivers\")\n // [ 'Bobby', 'Sammy', 'Sally', 'Annette', 'Sarah', 'bobby' ] drivers\n // console.log(query, \"query\")\n // Sa query\n return drivers.filter(function(name) {\n // console.log(name, \"name\")\n // Bobby name\n // Sammy name\n // Sally name\n // Annette name\n // Sarah name\n // bobby name\n // and returns all drivers whose names begin with the provided letters.\n return (name.startsWith(query)) \n })\n }", "function fuzzySearch(text, pattern, options ) {\n text = text.toLowerCase(); // TODO preprocess\n options = options || new Object();\n \n // Aproximately where in the text is the pattern expected to be found?\n var Match_Location = options.fuzzySearchLocation || 0;\n \n //Determines how close the match must be to the fuzzy location (specified above). An exact letter match which is 'distance' characters away from the fuzzy location would score as a complete mismatch. A distance of '0' requires the match be at the exact location specified, a threshold of '1000' would require a perfect match to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.\n var Match_Distance = options.fuzzySearchDistance || 100;\n \n // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match (of both letters and location), a threshold of '1.0' would match anything.\n var Match_Threshold = options.fuzzySearchThreshold || 0.3;\n \n if (!pattern)\n return true;\n \n if (pattern === text) return true; // Exact match\n if (pattern.length > 32) return false; // This algorithm cannot be used\n \n // Set starting location at beginning text and initialise the alphabet.\n var loc = Match_Location,\n s = (function() {\n var q = {};\n \n for (var i = 0; i < pattern.length; i++) {\n q[pattern.charAt(i)] = 0;\n }\n \n for (var i = 0; i < pattern.length; i++) {\n q[pattern.charAt(i)] |= 1 << (pattern.length - i - 1);\n }\n \n return q;\n }());\n \n // Compute and return the score for a match with e errors and x location.\n // Accesses loc and pattern through being a closure.\n function match_bitapScore_(e, x) {\n var accuracy = e / pattern.length,\n proximity = Math.abs(loc - x);\n \n if (!Match_Distance) {\n \n // Dodge divide by zero error.\n return proximity ? 1.0 : accuracy;\n \n }\n \n return accuracy + (proximity / Match_Distance);\n \n }\n \n var score_threshold = Match_Threshold, // Highest score beyond which we give up.\n best_loc = text.indexOf(pattern, loc); // Is there a nearby exact match? (speedup)\n \n if (best_loc != -1) {\n \n score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);\n \n // What about in the other direction? (speedup)\n best_loc = text.lastIndexOf(pattern, loc + pattern.length);\n \n if (best_loc != -1) {\n \n score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);\n \n }\n \n }\n \n // Initialise the bit arrays.\n var matchmask = 1 << (pattern.length - 1);\n best_loc = -1;\n \n var bin_min, bin_mid;\n var bin_max = pattern.length + text.length;\n var last_rd;\n for (var d = 0; d < pattern.length; d++) {\n // Scan for the best match; each iteration allows for one more error.\n // Run a binary search to determine how far from 'loc' we can stray at this\n // error level.\n bin_min = 0;\n bin_mid = bin_max;\n while (bin_min < bin_mid) {\n if (match_bitapScore_(d, loc + bin_mid) <= score_threshold) {\n bin_min = bin_mid;\n } else {\n bin_max = bin_mid;\n }\n bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min);\n }\n // Use the result from this iteration as the maximum for the next.\n bin_max = bin_mid;\n var start = Math.max(1, loc - bin_mid + 1);\n var finish = Math.min(loc + bin_mid, text.length) + pattern.length;\n \n var rd = Array(finish + 2);\n rd[finish + 1] = (1 << d) - 1;\n for (var j = finish; j >= start; j--) {\n // The alphabet (s) is a sparse hash, so the following line generates\n // warnings.\n var charMatch = s[text.charAt(j - 1)];\n if (d === 0) { // First pass: exact match.\n rd[j] = ((rd[j + 1] << 1) | 1) & charMatch;\n } else { // Subsequent passes: fuzzy match.\n rd[j] = (((rd[j + 1] << 1) | 1) & charMatch) |\n (((last_rd[j + 1] | last_rd[j]) << 1) | 1) |\n last_rd[j + 1];\n }\n if (rd[j] & matchmask) {\n var score = match_bitapScore_(d, j - 1);\n // This match will almost certainly be better than any existing match.\n // But check anyway.\n if (score <= score_threshold) {\n // Told you so.\n score_threshold = score;\n best_loc = j - 1;\n if (best_loc > loc) {\n // When passing loc, don't exceed our current distance from loc.\n start = Math.max(1, 2 * loc - best_loc);\n } else {\n // Already passed loc, downhill from here on in.\n break;\n }\n }\n }\n }\n // No hope for a (better) match at greater error levels.\n if (match_bitapScore_(d + 1, loc) > score_threshold) {\n break;\n }\n last_rd = rd;\n }\n return (best_loc < 0) ? false : true;\n }", "function fuzzySearch(item, query) {\n // Create the source text to be searched.\n var category = item.category.toLowerCase();\n var label = item.label.toLowerCase();\n var source = category + \" \" + label;\n // Set up the match score and indices array.\n var score = Infinity;\n var indices = null;\n // The regex for search word boundaries\n var rgx = /\\b\\w/g;\n // Search the source by word boundary.\n while (true) {\n // Find the next word boundary in the source.\n var rgxMatch = rgx.exec(source);\n // Break if there is no more source context.\n if (!rgxMatch) {\n break;\n }\n // Run the string match on the relevant substring.\n var match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n // Break if there is no match.\n if (!match) {\n break;\n }\n // Update the match if the score is better.\n if (match && match.score <= score) {\n score = match.score;\n indices = match.indices;\n }\n }\n // Bail if there was no match.\n if (!indices || score === Infinity) {\n return null;\n }\n // Compute the pivot index between category and label text.\n var pivot = category.length + 1;\n // Find the slice index to separate matched indices.\n var j = ArrayExt.lowerBound(indices, pivot, function (a, b) { return a - b; });\n // Extract the matched category and label indices.\n var categoryIndices = indices.slice(0, j);\n var labelIndices = indices.slice(j);\n // Adjust the label indices for the pivot offset.\n for (var i = 0, n = labelIndices.length; i < n; ++i) {\n labelIndices[i] -= pivot;\n }\n // Handle a pure label match.\n if (categoryIndices.length === 0) {\n return {\n matchType: 0 /* Label */,\n categoryIndices: null,\n labelIndices: labelIndices,\n score: score, item: item\n };\n }\n // Handle a pure category match.\n if (labelIndices.length === 0) {\n return {\n matchType: 1 /* Category */,\n categoryIndices: categoryIndices,\n labelIndices: null,\n score: score, item: item\n };\n }\n // Handle a split match.\n return {\n matchType: 2 /* Split */,\n categoryIndices: categoryIndices,\n labelIndices: labelIndices,\n score: score, item: item\n };\n }", "function FriendlyMatchEstimator() {\n}", "function fuzzySearch(item, query) {\r\n // Create the source text to be searched.\r\n var category = item.category.toLowerCase();\r\n var label = item.label.toLowerCase();\r\n var source = category + \" \" + label;\r\n // Set up the match score and indices array.\r\n var score = Infinity;\r\n var indices = null;\r\n // The regex for search word boundaries\r\n var rgx = /\\b\\w/g;\r\n // Search the source by word boundary.\r\n while (true) {\r\n // Find the next word boundary in the source.\r\n var rgxMatch = rgx.exec(source);\r\n // Break if there is no more source context.\r\n if (!rgxMatch) {\r\n break;\r\n }\r\n // Run the string match on the relevant substring.\r\n var match = algorithm_1.StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\r\n // Break if there is no match.\r\n if (!match) {\r\n break;\r\n }\r\n // Update the match if the score is better.\r\n if (match && match.score <= score) {\r\n score = match.score;\r\n indices = match.indices;\r\n }\r\n }\r\n // Bail if there was no match.\r\n if (!indices || score === Infinity) {\r\n return null;\r\n }\r\n // Compute the pivot index between category and label text.\r\n var pivot = category.length + 1;\r\n // Find the slice index to separate matched indices.\r\n var j = algorithm_1.ArrayExt.lowerBound(indices, pivot, function (a, b) { return a - b; });\r\n // Extract the matched category and label indices.\r\n var categoryIndices = indices.slice(0, j);\r\n var labelIndices = indices.slice(j);\r\n // Adjust the label indices for the pivot offset.\r\n for (var i = 0, n = labelIndices.length; i < n; ++i) {\r\n labelIndices[i] -= pivot;\r\n }\r\n // Handle a pure label match.\r\n if (categoryIndices.length === 0) {\r\n return {\r\n matchType: 0 /* Label */,\r\n categoryIndices: null,\r\n labelIndices: labelIndices,\r\n score: score, item: item\r\n };\r\n }\r\n // Handle a pure category match.\r\n if (labelIndices.length === 0) {\r\n return {\r\n matchType: 1 /* Category */,\r\n categoryIndices: categoryIndices,\r\n labelIndices: null,\r\n score: score, item: item\r\n };\r\n }\r\n // Handle a split match.\r\n return {\r\n matchType: 2 /* Split */,\r\n categoryIndices: categoryIndices,\r\n labelIndices: labelIndices,\r\n score: score, item: item\r\n };\r\n }", "searchFuzzy() {\n this.fuzzyResults = this.search.searchService(this.searchTerm);\n }", "function fuzzy(attribute, query) {\n // Here we specify which attribute we want to query, and the query that we\n // want that attribute to match. We could also set a specific fuzziness, so we\n // only return elements within a certain edit distance from the query, but\n // I found that AUTO works best.\n //\n // TODO - this needs to be updated, cause currently results are a bit shit.\n const match = {\n [attribute]: {\n query,\n analyzer: 'standard',\n fuzziness: 'AUTO',\n },\n };\n\n return { query: { match } };\n}", "searchTitleFuzzy(input){\r\n // Fuzzy Search the quiz title\r\n let results = fuzzy.filter(input, this.quizList, {extract: (el) => {\r\n return el.title;\r\n }})\r\n this.searchFuzzy(results);\r\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
code TODO: menu_1Ctrl | controller_by_user controller by user
function controller_by_user(){ try { } catch(e){ console.log("%cerror: %cPage: `menu_1` and field: `Custom Controller`","color:blue;font-size:18px","color:red;font-size:18px"); console.dir(e); } }
[ "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page side_menus => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"%cerror: %cPage: `menu` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\n\t\t\tconsole.dir(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"%cerror: %cPage: `side_menus` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\n\t\t\tconsole.dir(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page storie_singles => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page about_us => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page index => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}", "function controller_by_user(){\r\n\t\ttry {\r\n\t\t\t\r\n\t\t\t\r\n\t\t} catch(e){\r\n\t\t\tconsole.log(\"%cerror: %cPage: `side_menus` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\r\n\t\t\tconsole.dir(e);\r\n\t\t}\r\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page faq_singles => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"%cerror: %cPage: `slide_tab_menu` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\n\t\t\tconsole.dir(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"%cerror: %cPage: `men` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\n\t\t\tconsole.dir(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page winner_singles => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page about => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page faqs => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page homepage => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n//debug: all data\n//console.log(data_ovinoss);\n$ionicConfig.backButton.text(\"\");\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"%cerror: %cPage: `ovinos` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\n\t\t\tconsole.dir(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"%cerror: %cPage: `granos_y_semillas` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\n\t\t\tconsole.dir(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n//debug: all data\n//console.log(data_listass);\n$ionicConfig.backButton.text(\"\");\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"%cerror: %cPage: `listas_de_precios` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\n\t\t\tconsole.dir(e);\n\t\t}\n\t}", "function controller_by_user(){\r\n\t\ttry {\r\n\t\t\t\r\n\t\t\t\r\n\t\t} catch(e){\r\n\t\t\tconsole.log(\"%cerror: %cPage: `slide_tab_menu` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\r\n\t\t\tconsole.dir(e);\r\n\t\t}\r\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page categories => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
called from onchange event of selectedCSI function as well as addSelectedCSI function box
function addSelectCSI(wasCSSelected, isFromEvent, selCSCSI_id) { if (obj_selectedCS.selectedIndex >= 0) { var selCS_id = obj_selectedCS[obj_selectedCS.selectedIndex].value; var selCS_name = obj_selectedCS[obj_selectedCS.selectedIndex].text; } var isExists = false; //get all the CSIs from the array since CS was not selected before if (wasCSSelected == false) { //loop through the array to load all the csi for the selected CS obj_selectedCSI.length = 0; csiIdx = 0; for (var idx=0; idx<selCSIArray.length; idx++) { //populate the selectedCSI list with csi for the matching cs from the array if (selCSIArray[idx][0] == selCS_id) { obj_selectedCSI[csiIdx] = new Option(selCSIArray[idx][3], selCSIArray[idx][4]); //check if csi already exists in the array if (isFromEvent == false && selCSIArray[idx][4] == selCSCSI_id) { //unselect the earlier selected csi if (obj_selectedCSI.selectedIndex >= 0) obj_selectedCSI[obj_selectedCSI.selectedIndex].selected = false; obj_selectedCSI[csiIdx].selected = true; //keep it selected isExists = true; } csiIdx++; } } } else { //check if the selected CSI already exists in the selected CSI list. for (var i=0; i<obj_selectedCSI.length; i++) { if (obj_selectedCSI[i].value == selCSCSI_id) { isExists = true; //unselect the earlier selected csi if (obj_selectedCSI.selectedIndex >= 0) obj_selectedCSI[obj_selectedCSI.selectedIndex].selected = false; obj_selectedCSI[i].selected = true; //keep it selected break; } } } //do the next items only if select works (not view mode) if (obj_selCS != null) { //add the CSI to the selectedCSI list and selCSIArray only if not from the selectedCS change event. if (isFromEvent == false) { //display alert if already exists and not a block edit if (isExists == true && obj_ACaction.value == "BlockEdit") addNewCSI(isExists, selCSCSI_id, selCS_id); //addSelectedAC(); //alert("Selected " + selCSI_name + " already exists in the list"); else if (isExists == false) addNewCSI(isExists, selCSCSI_id, selCS_id); } sortSelectedCSI(); //call the function to rearrange selected csi } }
[ "function addSelectedCSI(wasCSSelected)\n {\n //get cs id and name from selectedCS list\n if (obj_selectedCS.selectedIndex >= 0)\n {\n var selCS_id = obj_selectedCS[obj_selectedCS.selectedIndex].value;\n var selCS_name = obj_selectedCS[obj_selectedCS.selectedIndex].text;\n }\n //get csi id and name from the selCSI list\n if (obj_selCSI.selectedIndex >= 0)\n {\n var selCSCSI_id = obj_selCSI[obj_selCSI.selectedIndex].value;\n var selCSI_name = obj_selCSI[obj_selCSI.selectedIndex].text;\n }\n //sumana - check if this is necessary\n //if (isFromEvent == true)\n // obj_selectedCSI.length = 0; //empty selectedCSI to reload\n\n //if called when csi was selected, check for parent key and select all the parents \n //and display from parent to child hierarchical order.\n var arrParentChild = new Array(); \n arrParentChild = selectHierCSI(selCS_id, selCSCSI_id, arrParentChild);\n //get the csi name from the original array list to remove the tabs.\n if (arrParentChild != null)\n {\n //display them from last to first\n for (var idx=arrParentChild.length-1; idx >= 0; idx--)\n { \n //for the selected csi and cs\n selCSCSI_id = arrParentChild[idx][2];\n selCSI_id = arrParentChild[idx][0];\n addSelectCSI(wasCSSelected, false, selCSCSI_id);\n } \n }\n }", "function addSelectedAC()\n {\n var cscsi_id = obj_selectedCSI[obj_selectedCSI.selectedIndex].value;\n //display ac names\n if (obj_selCSIACList != null)\n {\n csiIdx = 0;\n obj_selCSIACList.length = 0;\n for (var idx=0; idx<selACCSIArray.length; idx++)\n { \n //remove the matching csi from the array list\n if (selACCSIArray[idx][4] == cscsi_id)\n {\n obj_selCSIACList[obj_selCSIACList.length] \n = new Option(selACCSIArray[idx][7], selACCSIArray[idx][7]);\n }\n } \n }\n //show selected csi in csi list\n for (var i=0; i<csiArray.length; i++)\n {\n //get csi attributes\n if (csiArray[i][2] == cscsi_id)\n {\n var cs_id = csiArray[i][0];\n var isSelected = false;\n if (obj_selCS.selectedIndex > 0 && \n obj_selCS[obj_selCS.selectedIndex].value == cs_id)\n isSelected = true;\n\n //select the cs from the drow down list\n if (isSelected == false)\n {\n for (var j=0; j<obj_selCS.length; j++)\n {\n if (obj_selCS[j].value == cs_id)\n {\n obj_selCS[j].selected = true;\n ChangeCS(); //call method to select all the \n break;\n }\n }\n }\n //select the csi in selCSI list\n isSelected = false; \n if (obj_selCSI.selectedIndex > 0 && \n obj_selCSI[obj_selCSI.selectedIndex].value == cscsi_id)\n isSelected = true;\n \n //select the cs from the drow down list\n if (isSelected == false)\n {\n for (var j=0; j<obj_selCSI.length; j++)\n {\n if (obj_selCSI[j].value == cscsi_id)\n {\n obj_selCSI[j].selected = true;\n break;\n }\n }\n } \n }\n } \n }", "function sortSelectedCSI()\n {\n //sort them properly\n var arrSelCSI = new Array();\n //store the selected csis in an array\n if (obj_selectedCSI != null && obj_selectedCSI.length >0)\n {\n for (var m=0; m<obj_selectedCSI.length; m++)\n {\n arrSelCSI[arrSelCSI.length] = new Array(obj_selectedCSI[m].value, obj_selectedCSI[m].text);\n }\n }\n if (arrSelCSI.length > 0)\n {\n obj_selectedCSI.length = 0; //empty the select list\n //loop through selCSI select list get the csis\n for (var k=0; k<csiArray.length; k++)\n {\n var selCSIid = csiArray[k][2];\n if (obj_selectedCS.selectedIndex >= 0)\n {\n var selCS_id = obj_selectedCS[obj_selectedCS.selectedIndex].value;\n var arrCSid = csiArray[k][0];\n //loop through above array to get the matching csis\n if (selCS_id == arrCSid)\n {\n for (var m=0; m<arrSelCSI.length; m++)\n {\n var arrCSIid = arrSelCSI[m][0];\n if (arrCSIid == selCSIid)\n {\n var idx = obj_selectedCSI.length;\n obj_selectedCSI[idx] = new Option(arrSelCSI[m][1], arrCSIid);\n //keep it selected\n if (obj_selCSI.selectedIndex >= 0)\n {\n if (obj_selCSI[obj_selCSI.selectedIndex].value == arrCSIid)\n obj_selectedCSI[idx].selected = true;\n }\n break;\n }\n }\n }\n }\n }\n }\n }", "function select_ClimateVariable_Changed(theOptionValue, isUserSelectedChange)\n{\n // User Selected Change\n if(isUserSelectedChange == true)\n {\n //set_global_Current_ClimateVariable_SelectText(theOptionValue);\n var currentTextValue = get_global_Current_SelectOption_TextValue_For(theOptionValue, \"select_Variable_ClimateModel\");\n set_global_Current_ClimateVariable_SelectText(currentTextValue);\n }\n // The Option Value IS the datatypeNumber (When the select box for climate variables are built, the unique data type number is paired with it and used as the value.)\n // Get the Capabilities for the current selected Datatype and use that to build the rest of the UI (it is all dependent on\n current_Capabilities_Object = climateModelInfo_Get_CurrentCapabilities_ForDataTypeNumber(theOptionValue);\n UI_Builder_Adjust_UI_To_CurrentCapabilities(current_Capabilities_Object);\n \n}", "function on_selection_changed() { }", "function makeSelCSIList()\n {\n selCSIArray.length = 0;\n for (var i=0; i<selACCSIArray.length; i++)\n {\n //add the cs-csi to the selected csi array only if it does not exist already\n var relFound = false;\n //alert(\"make sel \" + selACCSIArray[i][3]);\n for (var idx=0; idx<selCSIArray.length; idx++)\n { \n if (selCSIArray[idx][4] == selACCSIArray[i][4]) //match to the cscsi id\n {\n relFound = true;\n break;\n }\n }\n //add selCS_id, selCS_name, selCSI_id, selCSI_name, selCSCSI_id in this order\n if (relFound == false)\n {\n selCSIArray[selCSIArray.length] = new Array(selACCSIArray[i][0], selACCSIArray[i][1], \n selACCSIArray[i][2], selACCSIArray[i][3], selACCSIArray[i][4], selACCSIArray[i][8]); //, selACCSI_id, selAC_id, selAC_longName);\n }\n }\n }", "function select_Ensemble_Changed(theOptionValue)\n{\n // Change the ClimateVariable select box based on what was selected on the Ensemble drowdown\n var ensemble_Selection_Value = theOptionValue;\n UI_Builder_Add_ClimateVariable_Options_ForEnsemble(ensemble_Selection_Value);\n //alert(theOptionValue);\n}", "function onOverlaySelectionChange(prev, current) {\n\t\t__processOverlaySelectionEventsOnChange(prev, current);\n\t}", "function open_overlay_on_ct_selection() {\n var ct_id = $(this).val();\n if ( ! ct_id ) return;\n var content_type = id2ct(ct_id);\n var $id_input = get_corresponding_input($(this));\n open_overlay(content_type, function(id, extras) {\n $id_input.val(id);\n $in_input.trigger('change', [extras]);\n });\n }", "selectionChanged() {}", "function camrySelect() {\n retrieveVehicleCartOptions();\n camrySessionStorage(); //307\n whenLoaded(); //381\n closeSelectVehiclesMenu(); //981\n selectVehicleCount = 1;\n\n removeVehicleCartOptions() //1063\n galleryPanelGetCar();\n\n}", "function imageInfoRegionsSelectorChange(event) {\n gImageRegionListViewer.setTextureID(gTextureIDList[imageInfoRegionsSelector.selectedIndex]);\n}", "handleCompSelect(evt) {\n let compValue = evt.target.dataset.id;\n this.options.forEach(item => {\n if (item.value == compValue && item.metaName == this.currentView) {\n item.checked = evt.target.checked;\n }\n })\n this.partialCheck();\n helper.handlePreviewXml(this);\n }", "function di_db_drawDbSelectionControl(db_ctrl_id,db_title,db_width,db_height,db_filePath,db_caption,db_searchboxText,db_select_btn,db_inuse_btn,db_dbId,db_indText,db_areasText,db_sourcesText,db_dvText,db_lastmodText,db_hotFun,db_lng,db_isMultipleDb,db_lbl_ok,db_lbl_cancel,db_component_ok_function_name,db_component_close_function_name)\n{\n\tvar di_db_dbFileObject=null;\n var di_db_html='';\n this.di_db_selectedDbId = db_dbId;\n this.di_db_selectBtnText=db_select_btn;\n this.di_db_inuseBtnText=db_inuse_btn;\n this.di_db_indicatorsText=db_indText;\n this.di_db_areasText=db_areasText;\n this.di_db_sourcesText=db_sourcesText;\n this.di_db_datavaluesText=db_dvText; \n this.di_db_lastmodText=db_lastmodText; \n this.di_db_functionName = db_hotFun;\n\tthis.di_db_controlID = db_ctrl_id;\n\tthis.di_db_isMultipleDb = db_isMultipleDb;\n this.di_db_component_ok_function_name = db_component_ok_function_name;\n\tthis.di_db_component_close_function_name = db_component_close_function_name;\n\t\n\t// set div attributes\n\tdi_db_setDivControlAttributes(db_ctrl_id,db_width);\n\t// load datafile\n di_db_dbFileObject = di_db_LoadXMLs(db_filePath);\n\t// get & set html markup title & search part only(container)\n di_db_html = di_db_ControlContainer(db_title,db_caption,db_searchboxText,db_height,db_width,db_isMultipleDb,db_lbl_ok,db_lbl_cancel);\n document.getElementById(db_ctrl_id).innerHTML = di_db_html;\n // Make Array collect using parsing xml object\n di_db_makeDataCollection(db_lng,di_db_dbFileObject);\n\tdi_db_html = di_db_GetContainerItem();\n document.getElementById('dbDetailDiv').innerHTML=di_db_html;\n\t/*applyCss();\n\tdi_jq(\"#dbDetailDiv\").jcarousel({\n scroll: 1,\n\t\titemFallbackDimension: 300,\n\t\tinitCallback: mycarousel_initCallback,\n // This tells jCarousel NOT to autobuild prev/next buttons\n buttonNextHTML: null,\n buttonPrevHTML: null\n });*/\n}", "regionListener(event) {\n console.log('Region selected');\n this.region_id = event.target.options[event.target.selectedIndex].value;\n }", "function setClimateSelected(){\n el.climate_selected = $('.climate-variables-map :selected:first').val();\n console.log(\"setClimateSelected - mapui is:\", el.climate_selected);\n $(\"select\").material_select();\n }", "function selectColorSpace(e){\n var design_id = getUrlDesignID();\n if (design_id == '') {\n var colorSpace = jQuery('#kmds-color-space').attr(\"preset-value\") ? jQuery('#kmds-color-space').attr(\"preset-value\") : 'RGB';\n jQuery('#kmds-color-space').val(colorSpace);\n FnNewFolderModal();\n FnDefaultModal('Please save the template before select color space.');\n }\n else {\n var ColorSpace = e.options[e.selectedIndex].value;\n $('.toolbarPanel_4.d-block').append('<div class=\"progress-overlay toolbarPanel_4-overlay\"><div class=\"spinner-border\"></div></div>');\n var page_settings = {'color_space' : ColorSpace};\n updateTemplatePresetName(page_settings);\n }\n}", "function selectionChangedHandler() {\n var flex = $scope.ctx.flex;\n var current = flex.collectionView ? flex.collectionView.currentItem : null;\n $scope.current = current;\n if (current !== null) {\n $scope.selectedBudgetCycleId = current.budgetCycleId;\n } else {\n $scope.selectedBudgetCycleId = -1;\n }\n manageActions();\n }", "function html_select_img_change()\r\n{\r\n\tif(htmlImgSelect.selectedIndex > 0)\r\n\t{\r\n\t\tinsert_html(pageEditBox, htmlSelectSrc[htmlImgSelect.selectedIndex]);\r\n\t\t// set index back to 0 to get description of the select box\r\n\t\thtmlImgSelect.selectedIndex = 0;\r\n\t}\r\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
make a deck of 52 cards
function makeDeck() { let deck = []; const suits = ['spades', 'hearts', 'clubs', 'diamonds']; const values = [2, 3, 4, 5, 6, 7, 8, 9, 10, 'jack', 'queen', 'king', 'ace']; for (let i = 0; i < 4; i++) { for (let j = 0; j < 13; j++) { deck.push(new Card(suits[i], values[j])); } } return deck; }
[ "function buildDeck(deck){\n\n // It makes four loops, each time building a different suit\n for(i=0; i<suit.length; i++){\n\n // For each suit, it makes thirteen loops, one for the ace, nine for 2-10, and three for the face cards\n for(j=1; j<14; j++){\n if(j<2){\n deck.push({\n num: j,\n value: ace[j],\n suit: suit[i],\n pic: pic[i],\n color: i\n });\n // ace[j]+\" of \"+suit[i])\n } else if(j<11) {\n deck.push({\n num: j,\n value: j,\n suit: suit[i],\n pic: pic[i],\n color: i\n });\n // j+\" of \"+suit[i])\n } else {\n deck.push({\n num: j,\n value: court[j-11],\n suit: suit[i],\n pic: pic[i],\n color: i\n });\n // court[j-11]+\" of \"+suit[i])\n };\n };\n };\n\n //the end result is an array with all 52 cards\n return deck;\n }", "function makeDeck(decks){\n for (var j=0; j<decks; j++){\n for (var i=0; i<(52); i++){\n liveDeck.push(i);\n }\n }\n}", "function makeDeck(arg){\n for (var j=0; j<arg; j++){\n for (var i=0; i<52; i++){\n liveDeck.push(i);\n }\n }\n }", "function Deck() {\n this.deck = new Array(52);\n this.count = 52;\n var c = 0;\n for (var i = 1; i <= 4; i++)\n for (var j = 1; j <= 13; j++)\n this.deck[c++] = new Card(j,i);\n}", "generateDeck () {\n\n let suit,\n face;\n\n for (suit = 0; suit < 4; suit += 1) {\n\n for (face = 0; face < 13; face += 1) {\n\n this.deck.push({\n id: face + 1,\n className: suits[suit] + '-' + faces[face],\n color: colors[suits[suit]]\n });\n }\n }\n\n return this.shuffle();\n }", "function generateDeck(){\n\t\tvar deck = [];\n\n\t\tfor(var x = 2 ; x < 15 ; x ++) {\n\t\t\tfor(var z = 0 ; z < 4 ; z ++){\n\t\t\t\tdeck.push(x);\n\t\t\t}\n\t\t}\n\t\treturn deck;\n\t}", "function getDeckOfCards(numOfDecks) {\n var deck = []\n , shuffled = []\n ;\n\n // Cool Fisher-Yates Shuffle from StackOverflow\n // http://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array-in-javascript\n function shuffleDeck() {\n var o = deck.slice();\n console.log('[ deck ] shuffling deck ');\n for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);\n return o;\n }\n\n // Get one card object from the shuffled deck of cards\n function drawCard() {\n if (!shuffled.length) shuffled = shuffleDeck();\n var i = shuffled.pop();\n while(i >= 52) i -= 52;\n console.log('[ deck ] drawing card ' + i );\n return cards[i];\n }\n\n // Build an array of numbers to represent the indexes of the cards\n for (var i = 0; i < 52 * numOfDecks; i += 1) deck.push(i);\n console.log('[ deck ] building ' + numOfDecks + ' decks of cards ');\n\n return drawCard;\n}", "function deckGen () {\n for (var key in game.foundations) {\n for (var i = 13; i >= 1; i--) {\n game.deck.push(new card(i, key));\n };\n };\n \n return game.deck;\n}", "function generate(){\n\tdeck = []\n\tfor(var x = 1; x<=13; x++){\n\t\tfor(var y=0; y<=3; y++){\n\t\t\tif(x === 1){\n\t\t\t\tdeck.push(['A', suit[y]]);\n\t\t\t}else if(x===11){\n\t\t\t\tdeck.push(['J', suit[y]]);\n\t\t\t}else if(x===12){\n\t\t\t\tdeck.push(['Q', suit[y]]);\n\t\t\t}else if(x===13){\n\t\t\t\tdeck.push(['K', suit[y]]);\n\t\t\t}else{\n\t\t\t\tdeck.push([x.toString(), suit[y]]);\n\t\t\t}\n\n\t\t}\n\t}\n}", "function createDeck() {\n for (let i = 0; i < suits.length; i++) {\n for (let j = 0; j < ranks.length; j++) {\n let r = \"\";\n if (ranks[j] == \"J\" || ranks[j] == \"Q\" || ranks[j] == \"K\") {\n r = 10;\n } else if (ranks[j] == \"A\") {\n r = 11;\n } else {\n r = j + 2;\n }\n let card = {'rank': ranks[j], 'suit': suits[i], 'value': r};\n deck.push(card);\n }\n }\n for (let x = 0; x < 52; x++) {\n let numbers = x + 1\n let image = \"images/\" + numbers + \".png\";\n deck[x].image = image;\n }\n }", "function initDeck() {\n let deck = [];\n\n for (let i = 1; i <= 52; i++) {\n deck.push(i);\n }\n\n return deck;\n}", "function composeDeck () {\n\tinDeck = [];\n outDeck = [];\n\tvar suit = \"\";\n\t\n\tfor (var i = 0; i < 4; i++) {\n\t\tswitch (i) {\n\t\t\tcase 0: suit = SPADES; break;\n\t\t\tcase 1: suit = HEARTS; break;\n\t\t\tcase 2: suit = CLUBS; break;\n\t\t\tcase 3: suit = DIAMONDS; break;\n\t\t}\n\t\t\n\t\tfor (j = 1; j < 14; j++) {\n\t\t\tinDeck.push(suit + j);\n\t\t}\n\t}\n}", "function createNewDeck() {\n newDeck[0] = 0;\n for (var j = 1; j <= 52; j++){\n newDeck[j] = new card (j);\n newDeck[0] += 1;\n }\n}", "function CardDeck(){\n this.cards = [];\n for (var i = 1; i <= 52; i++) {\n this.cards.push(i);\n }\n}", "function createDeck() {\n // select a random set of 8 tiles from the full set of 32 tiles.\n var tiles = [];\n var idx;\n\n // Create all of the potential playing cards\n for(idx = 1; idx <= 32; ++idx){\n tiles.push({\n tileNum: idx,\n src: 'img/tile' + idx + '.jpg',\n playable: true\n });\n };\n\n // Create a new \"shuffled\" set of those cards\n var shuffledTiles = _.shuffle(tiles);\n\n // Select the first eight cards in that set\n var selectedTiles = shuffledTiles.slice(0, 8);\n\n // Create the set of \"paired\" cards that will be used for playing\n var tilePairs = [];\n _.forEach(selectedTiles, function(tile){\n tilePairs.push(_.clone(tile));\n tilePairs.push(_.clone(tile));\n });\n\n // Shuffle the playing set\n return _.shuffle(tilePairs);\n}", "function createDeck() {\n // creates a deck with 6 decks of cards randomly shuffled in\n var shuffledDeck = [];\n var holderDeck = [];\n\n for (var i=0; i<8; i++) {\n holderDeck.push.apply(holderDeck, deckOfCards.slice(0));\n };\n\n while(holderDeck.length > 0) {\n var randomNumber = Math.floor(Math.random() * holderDeck.length);\n shuffledDeck.push(holderDeck[randomNumber]);\n holderDeck.splice(randomNumber, 1);\n };\n\n return shuffledDeck;\n}", "function create_deck(){\n var deck = [];\n for (x in colors){\n for (y in values){\n var newcard = new card(colors[x], values[y]);\n deck.push(newcard);\n }\n }\n for (var i = 0; i <4; i++){\n deck.push(wild);\n deck.push(superwild);\n }\n return deck;\n}", "function CardDeck () {\n\tthis.cards = new Array(52);\n\tfor (var i = 1; i < 53; i++) this.cards.push(i);\n}", "function generateCardDeck(){\n cardDeck.length = 0;//empty any potentially existing instance of the deck, to prevent it duplicating entries.\n cardDeck = [];\n for(let suitNo = 0; suitNo < 4; suitNo++){ //condensed it all down to two for loops, and a two switch statements in a constructor.\n for(let rankNo = 0; rankNo< 13; rankNo++){ //4 Suits and 13 Ranks of cards.\n cardDeck.push(new card(rankNo, suitNo));\n }\n }\n shuffleDeck(cardDeck);\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the mods in this set as an array
mods() { let mods = []; for (let slot of ModSet.slots) { if (this[slot]) { mods.push(this[slot]); } } return mods; }
[ "toArray() {\n return this._modifiers;\n }", "_getModPackages() {\r\n\t\tconst modFiles = this.filemanager.getAllModsFiles();\r\n\t\tthis.mods = [];\r\n\t\tfor (const modFile of modFiles) {\r\n\t\t\tthis.mods.push(new Mod(this, modFile));\r\n\t\t}\r\n\t}", "function getBaneModArr(bane) {\n return [\"-\", bane.strMod, bane.magMod, bane.sklMod, bane.spdMod, bane.lckMod, bane.defMod, bane.resMod];\n}", "function getBoonModArr(boon) {\n return [\"-\", boon.strMod, boon.magMod, boon.sklMod, boon.spdMod, boon.lckMod, boon.defMod, boon.resMod];\n}", "getModules() {\n let publicModules = this.getPublicModules(),\n key, selectedModule = [],\n i = 0;\n\n for (key in publicModules) {\n if (publicModules[key].checked) {\n selectedModule[i] = publicModules[key];\n i++;\n }\n }\n return selectedModule;\n }", "getModules(pkg: Package): Module[] {\n return this.modules.get(pkg) || []\n }", "atoms() {\n return this._atoms.slice();\n }", "function gameInventory_getAllItemModifiers(itemID){\n var modifierArray = [];\n for (var modID in project_project.gameInventory[itemID].modifiers) {\n modifierArray.push(project_project.gameInventory[itemID].modifiers[modID]);\n }\n return modifierArray;\n }", "function get_mods() {\n return {\n dt: document.getElementById(\"mod-dt\").checked,\n ez: document.getElementById(\"mod-ez\").checked,\n nf: document.getElementById(\"mod-nf\").checked,\n ht: document.getElementById(\"mod-ht\").checked\n };\n}", "get modalityList() {\n\t\treturn this.__modalityList;\n\t}", "toArray() {\n\t\t\treturn this.array.slice();\n\t\t}", "get modalityList () {\n\t\treturn this._modalityList;\n\t}", "get abilities() {\n\n // do we need to unpack the abilities?\n if (this[abilities].length && typeof(this[abilities][0]) == 'string') {\n\n // unpack all abilities and turn them into objects\n this[abilities] = this[abilities].map(id => this[template].root.fetchAbility(id)).filter(a => !!a);\n }\n\n // return the abilities\n return Array.from(this[abilities]);\n }", "function getModeratedItems()/*:Array*/ {\n return null;\n }", "function addMods() {\n var totalMod = 0\n for (var i = 0; i < archer1.items.length; i++) {\n var mod = archer1.items[i];\n totalMod += mod.modifier\n }\n return archer1.mods.push(totalMod)\n}", "copy() {\n return new ModSet(this.mods());\n }", "get all() {\n return Array.from(this.extensions.values()).map(o => o.extension);\n }", "function getModifiers(abilities){\n var modifiers = [];\n for (var i = 0; i < 6; i++){\n modifiers.push((Math.floor(abilities[i]/2))-5);\n }\n return modifiers;\n}", "CollectMods( use_parent = true ) {\n\t\tlet p = this.QualifyParent( use_parent );\n\t\tif ( !p ) { return this.mods; } // shortcut\n\t\treturn this.mods.slice().concat( p.CollectMods(true) );\n\t\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start the game by create a player and dealer class, generating their hands, and saving the data
function start_game() { var p1 = new Player(); var dealer = new Player(); generate_hand(p1); generate_hand(dealer); var data_property = {'Player 1':JSON.stringify(p1), 'Dealer':JSON.stringify(dealer)}; scriptProperties.setProperties(data_property) }
[ "deal() {\n\t\t// Create a hand for each player\n\t\tthis.hands = {};\n\t\tfor(let uid in this.players) {\n\t\t\tthis.hands[uid] = [];\n\t\t}\n\n\t\t// Deal out deck\n\t\t// TODO: Jokers\n\t\tvar deck = Cards.createFullDeck();\n\t\tCards.shuffle(deck);\n\n\t\tvar index = 0;\n\t\twhile(deck.length) {\n\t\t\tthis.hands[this.players[index]].push(deck.pop());\n\t\t\tindex = (index + 1) % this.nplayers;\n\t\t}\n\t}", "function roundStart(){\n // Instantiate new deck\n myDeck = new Deck()\n\n // this will deal two cards to each player one by one, but currently it won't store hand values properly if you use this\n // for(let i=0; i<=playerCount*2; i++){\n // draw()\n // changePlayerTurn()\n // }\n\n activePlayerHand = dealerHand\n draw()\n dealerHandValue = valueOfPlayerHand(dealerHand)\n\n changePlayerTurn()\n}", "function startGame() {\n // empty deck, fill it with cards, and shuffle it\n deck = [];\n setupDeck();\n shuffleDeck();\n\n dealerCards = [];\n drawAndShowDealerCard();\n\n playerCards = [];\n drawAndShowPlayerCard();\n drawAndShowPlayerCard();\n if (evaluateHand(playerCards) === 21) {\n endHand(\"You won, but only by luck\");\n }\n}", "function initialSetup(players, handSize) {\n let game = {};\n\n let options = createPoolOptions();\n let pool = generatePool(options);\n shuffleTiles(pool);\n\n players.forEach(player => {\n player.hand = dealHand(handSize, pool);\n player.score = 0;\n });\n\n let board = createBoard();\n\n game.players = players;\n game.board = board;\n game.pool = pool;\n game.activePlayer = players[0].playerId;\n game.firstTurn = true;\n game.handSize = handSize;\n game.dictionary = getDictionary();\n game.def = options;\n game.turns = [];\n game.state = 'active';\n\n return game;\n}", "startGame() {\n // consult GameOrchestrator for codes\n let player1, player2\n for (let i = 0; i < 3; i++)\n if (this.options[i].selected)\n player1 = {type: i, code: 1}\n for (let i = 3; i < 6; i++)\n if (this.options[i].selected)\n player2 = {type: i - 3, code: 2}\n\n console.clear()\n this.orchestrator.custom.log(\"Starting Game\")\n\n this.orchestrator.init({player1: player1, player2: player2})\n }", "function startHand() {\n this.hand = new Hand()\n for (var key in this.players) {\n this.hand.order.push()\n }\n}", "function ratscrew_startGame() {\n // post the game create and the game start moves\n postMove({\n action : \"create\",\n game : \"ratscrew\",\n playerIDs : game_playerIDs,\n playerNames : game_playerNames,\n player : self_playerID\n });\n postMove({\n action : \"start\",\n players : cards_initialShuffleAll(game_playerIDs),\n player : self_playerID\n });\n}", "function startGame() {\n createButtons();\n createCards();\n}", "function setupPoker () {\n /* set up the player hands */\n for (var i = 0; i < hands.length; i++) {\n hands[i] = createNewHand([null, null, null, null, null], NONE, 0, [false, false, false, false, false]);\n }\n \n /* compose a new deck */\n composeDeck();\n}", "function startGame() {\n createButtons(gameButtons);\n createCards();\n}", "function setUp() {\n const colors = [\"red\", \"blue\", \"green\", \"yellow\"];\n const actions = [\"skip\", \"draw2\", \"reverse\"];\n const wild = [\"draw4\", \"wild\"];\n\n colors.forEach((color) => {\n // creates two of each 0-9 for each color\n for (let i = 0; i <= 9; i++) {\n for (let p = 0; p < 2; p++) {\n var path = \"/images/cards/regular/\" + color + \"/\" + i + \".png\";\n var card = new Card(\"regular\", color, i, path);\n deck.push(card);\n }\n }\n // creates 2 of each action card for each color\n actions.forEach((action) => {\n for (let i = 0; i < 2; i++) {\n var path = \"/images/cards/action/\" + color + \"/\" + action + \".png\";\n var card = new Card(action, color, 0, path);\n deck.push(card);\n }\n });\n });\n // Creates 4 of each wild card\n wild.forEach((type) => {\n for (let i = 0; i < 4; i++) {\n var path = \"/images/cards/wild/\" + type + \".png\";\n var card = new Card(type, \"black\", 0, path);\n deck.push(card);\n }\n });\n // shuffle function\n for (let i = deck.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * i);\n let temp = deck[i];\n deck[i] = deck[j];\n deck[j] = temp;\n }\n // deals 10 cards to each player\n players.forEach((player) => {\n for (let i = 0; i < 10; i++) {\n var dealtCard = deck.pop();\n player.hand.push(dealtCard);\n }\n });\n // flips the top card and puts it in the played cards pile\n var flipped = deck.pop();\n playedCards.push(flipped);\n $(\"#piles\").append(`\n <img src=\"${flipped.imagePath}\" \n alt=\"\" id=\"played\">`);\n // calls the display function to show the player hands\n display();\n}", "function setupPlayer() {\n // Create a new player object\n player = new Player(fly, 40);\n}", "start(){\n\t\tfor(let player of this.players){\n\t\t\tlet packet = this.game.prepareGame(player.tank);\n\n\t\t\t// init the enemies for each player\n\t\t\tplayer.send({\n\t\t\t\ttype: \"start\",\n\t\t\t\tdata: packet\n\t\t\t});\n\n\t\t\t// this starts the game, it basically requests a frame from the clients\n\t\t\tplayer.send({\n\t\t\t\ttype: \"game_action\",\n\t\t\t\tdata: false\n\t\t\t});\n\t\t}\n\n\t\tthis._loop = setInterval(() => {\n\t\t\tif(!this.game.isFrameReady()){\n\t\t\t\tthis.missedLockstep = true;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.sendStep();\n\t\t}, MAX_FPS);\n\t}", "function startGame() {\n createButtons();\n const cards = createCardsArray();\n appendCardsToDom(cards);\n}", "function setUpOnePlayer(){\n let optionsContainer = document.getElementById('options-container')\n let titleHeading = document.getElementById('title-heading')\n\n let player = new Player()\n let computer = new Player() \n\n player.name = \"Player 1\"\n computer.name = \"Computer\"\n optionsContainer.style.display = 'none'\n titleHeading.style.display = 'none'\n let setupContainer = document.getElementById('setup-container')\n\n let heading = document.createElement('h5')\n heading.setAttribute('id', 'setup-heading')\n heading.textContent = \"You have 3 more ships to place!\"\n setupContainer.appendChild(heading)\n \n createSetupGrid(setupContainer, player)\n createSetupButtons(setupContainer, player, computer)\n setUpComputerBoard(computer)\n}", "create() {\n this.createMap()\n this.createPlayer()\n this.createComputer()\n this.start()\n }", "start (playerOneName, playerTwoName) {\n this.players.push (new Player(playerOneName));\n this.players.push (new Player(playerTwoName));\n let d = new Deck()\n d.createDeck();\n d.shuffleDeck(); \n this.players[0].playerCard = d.cards.slice(0,26);\n this.players[1].playerCard = d.cards.slice(26,52);\n }", "function startGame() {\n createButtons();\n createCards();\n displayCards();\n clickOnButton();\n}", "function startGame() {\n //hide the deal button\n hideDealButton();\n //show the player and dealer's card interface\n showCards();\n //deal the player's cards\n getPlayerCards();\n //after brief pause, show hit and stay buttons\n setTimeout(displayHitAndStayButtons, 2000);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A hack to find the name of the first artist of a playlist. this is not yet returned by mopidy does not work wel with multiple artists of course
function getArtist (pl) { for (var i = 0; i < pl.length; i++) { for (var j = 0; j < pl[i].artists.length; j++) { if (pl[i].artists[j].name !== '') { return pl[i].artists[j].name } } } }
[ "function GS_getArtist( ) {\n // Grab title element, since text portion can be truncated\n var artist = $(\"div#now-playing-metadata a.artist\").attr('title');\n if( artist == undefined ) {\n // Fall back to text portion if title attr is empty\n artist = $(\"div#now-playing-metadata a.artist\").text();\n }\n return GS_cleanLabel( artist );\n}", "function getArtist(artists) {\n let artist = artists[0].name;\n return artist;\n}", "getPlayingArtistName () {\n return document.querySelector('#page_player > div > div.player-track > div > div.track-heading > div.track-title > div > div > div > a:nth-child(2)').innerText\n }", "function getArtists(artist){\n return artist.name;\n }", "function playArtistFirstSong(){\n\tsetMusic(tempPlaylist[0],tempPlaylist,true);\n}", "function LFM_TRACK_ARTIST() {\n\tif (SITE_VERSION === SITE_VERSION_6) {\n\t\treturn $('.metadata:visible span.link:eq(0)').text();\n\t} else if (SITE_VERSION === SITE_VERSION_4) {\n\t\treturn $('#mini-artist-name').text();\n\t}}", "function getFullSongName(song) {\n return song[\"artist\"] + \" - \" + song[\"title\"];\n}", "get artist() {\n\t\tvar artists = this.song.artists.map(artist => artist.name);\n\t\tartists = artists.filter(artist => !this.song.name.includes(artist));\n\t\treturn artists.join(', ')\n\t}", "function names(artist){\n return artist.name\n}", "function LFM_TRACK_ARTIST() {\n\treturn $(\".track .artist a\").text();\n}", "function getMainArtists(arrSongs) {\n\tarrSongs.map(function(song){\n\t\tartist = song.artist;\n\t\tfeaturingIndex = artist.search(\" featuring\");\n\t\tif (featuringIndex > 0) {\n\t\t\treturn artist.substring(0, featuringIndex);\n\t\t} else {\n\t\t\treturn artist;\n\t\t}\n\t});\n}", "function getArtist(playerId){\n\t\treturn mPlayers[playerId].artist;\n\t}", "function getMusicArtists(jsonResponse){\n\n let artists = jsonResponse['tracks'][0] ['artists'];\n description = \"\";\n\n for (let x = 0; x < artists.length; x++){\n description += \" \" + artists[x]['name'];\n }\n\n}", "getTracksMatchingArtist(artistName) {\n const artistNameValue = artistName.toLowerCase();\n const artist = this.artists.filter(artist => artist.name.toLowerCase() === artistNameValue)[0];\n if (artist === null || artist === undefined) {\n return [];\n } else {\n return artist.getTrackArtist();\n }\n }", "function getArtist(artist){\r\n for(var i = 0; i < data.artists.length; ++i){\r\n if(artist == data.artists[i].title){\r\n return i;\r\n }\r\n }\r\n return -1;\r\n}", "_getSongTitle(index) {\n if(this.playList[index].artist !== undefined)\n return this.playList[index].artist + \" - \" + this.playList[index].title;\n else\n return this.playList[index].title;\n }", "function getMainArtists(array){\n\treturn array.map(function(song){\n\t\tvar mainArtist = song.artist.split(' featuring')[0];\n\t\treturn mainArtist;\n\t})\n}", "function artist_displayName(artist_uri){\n var query \t= \"PREFIX dbp: <http://dbpedia.org/resource/>\"\n \t+ \"PREFIX dbpprop: <http://dbpedia.org/property/>\"\n \t+ \"SELECT ?name WHERE \"\n \t+ \"{ <\" + artist_uri + \"> dbpprop:name ?name}\";\n var displayName = dbpedia_query(query,'name');\n return displayName;\n}", "getSpotifyItemName(item) {\n return item.name + (item.artists ? \" - \" + item.artists[0].name : \"\");\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Unlikes the comment as the current user
unlike() { return this.clone(Comment, "Unlike").postCore(); }
[ "function dislike() {\n LikeService.delete(vm.user.username, $stateParams.id, vm.currentUser._id)\n .then(() => {\n // remove like from local array\n vm.likes.splice(vm.likes.findIndex(x => x._id == vm.currentUser._id), 1);\n\n vm.isLiked = false;\n });\n }", "unlike() {\n return spPost(this.clone(Comment, \"Unlike\"));\n }", "unlike(callback) {\n callback = callback || function() {\n };\n\n if (!Meteor.userId()) {\n callback(new Meteor.Error('user not valid!'), null);\n return;\n }\n\n if (!_.includes(this.likes, Meteor.userId())) {\n callback(null, this.id);\n }\n\n this.likes = _.without(this.likes, Meteor.userId());\n\n\n if (Meteor.isServer)\n this.save(callback);\n }", "static async unlikeReview(userID, reviewID) {\n let res = await this.request(`users/${userID}/likes`, { reviewID }, \"delete\")\n return res\n }", "async unfollow() {\n const currentUser = await this._client.kraken.users.getMe();\n await currentUser.unfollowChannel(this);\n }", "static async unsaveComment(token, username, id, user_id) {\n let res = await this.request(`comments/${username}/${id}/unsave`, token, { user_id }, 'delete');\n return { message: res.message };\n }", "function unblock_user() {\n var username = $(this).data(\"username\"), target_idx = bad_users.indexOf(username);\n if (target_idx !== -1) {\n bad_users.splice(target_idx, 1);\n }\n refresh_user(username);\n save_users();\n}", "async function dislikeIt() {\n let likedata = await (\n await postService.post(`/like/dislike`, {\n aid: postData?._id,\n doerId: user?.doerId,\n })\n ).data;\n\n if (likedata.msg === \"ok\") {\n setisLiked({ msg: \"liked not active\", result: 2 });\n setactivityDetail({ ...activityDetail, likeCount: likedata.likeCount });\n }\n }", "dislike(callback) {\n callback = callback || function() {\n };\n\n if (!Meteor.userId()) {\n callback(new Meteor.Error('user not valid!'), null);\n return;\n }\n\n if (_.includes(this.dislikes, Meteor.userId()) ||\n _.includes(this.likes, Meteor.userId())) {\n callback(null, this.id);\n }\n\n let dislikes = [Meteor.userId()];\n\n this.dislikes = _.union(dislikes, this.dislikes);\n\n if (Meteor.isServer)\n this.save(callback);\n }", "function unlikeSheet() {\n if($rootScope.currentUser == null){\n vm.returnData = \"Log in to continue\";\n }else{\n UserService\n .unlikeSheetUser(vm.noteId,$rootScope.currentUser._id)\n .then(function (response) {\n NoteService\n .unlikeSheet(vm.noteId,$rootScope.currentUser._id)\n .then(function (response) {\n console.log(response);\n });\n console.log(response);\n vm.userLiked = 0;\n });\n }\n }", "static async unlikeRecipe(username, recipeId) {\n\t\tconst res = await this.request(\n\t\t\t`user/${username}/recipe/${recipeId}/unlike`,\n\t\t\t{},\n\t\t\t'no-token',\n\t\t\t'post'\n\t\t);\n\t\treturn res;\n\t}", "function unlikePerson(subjectId, likerId) {\n var likedRef = fb.child(\"liked/person\").child(subjectId).child(likerId);\n likedRef.set(null);\n console.log(likerId+\" unliked \"+subjectId);\n //store in the liker's own db\n var userLikeRef = fb.child(\"users\").child(likerId).child(\"likes/person/\"+subjectId);\n userLikeRef.set(null);\n }", "function unfollow() {\n dsactivity.unfollowUser(vm.user.id)\n .then((response) => {\n // The viewing user is now not following this profile's user\n vm.userIsFollowing = false;\n })\n .then(updateUserFollowStats)\n .catch((err) => {\n console.error(err);\n });\n }", "function handleDislike(evt) {\n updateFriendIndexAtEnd();\n dislike(friendInfo.id);\n }", "function disLikeUser(event){\nevent.preventDefault();\nvar disLikeObject = $(this).parent().data();\nusersFb.child('/matchdata/Dislikes').push(disLikeObject);\n$(this).parent().hide();\n}", "function removeDislike(uid, numDislikes, usersDisliked) {\n console.log(\"removeDislike() called\");\n // Add highlight to thumbs down\n $(\"#dislike-\" + uid).removeClass(\"primary-dark-color\");\n // Increment number of likes. Add to DOM\n var decrementNumDislikes = numDislikes - 1;\n addTextToDom(decrementNumDislikes.toString(), \"num-dislikes-\" + uid);\n // Update numLikes in Firestore. Add uid from usersLiked \n removeArrayElement(uid, usersDisliked);\n updateDocumentUsingDocId(\"reviews\", uid, {\"numDislikes\": decrementNumDislikes, \"usersDisliked\": usersDisliked});\n}", "cancel_like(token, body) {\n return Fetch(\"/api/v2.0/unlike/\", {\n method: \"POST\",\n token: token,\n data: body\n });\n }", "function unbindLike(id, token) {\n fetch('http://127.0.0.1:5000/post/unlike?id='+id, {\n headers:{\n 'Authorization': 'Token ' + token\n },\n method: 'PUT',\n }).then(response=>{\n if(response.ok){\n changeDisplay(id, token);\n }else{\n window.alert(\"Fail to unlike this picture.\");\n }\n });\n}", "function unlike(postID, unlikedObject, type){\n\t\n\tvar xmlHttp;\n\t\n\tif (window.XMLHttpRequest)\n\t\t {// code for IE7+, Firefox, Chrome, Opera, Safari\n\t\t \n\t\t xmlHttp=new XMLHttpRequest();\n\t\t }\n\t\telse\n\t\t {// code for IE6, IE5\n\t\t \n\t\t xmlHttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n\t\t }\n\t\n\txmlHttp.onreadystatechange=function()\n\t\t {\n\t\t if (xmlHttp.readyState==4 && xmlHttp.status==204)\n\t\t\t{\n\t\t\t\n\t\t\t//var info =xmlHttp.responseText;\n\t\t\t//window.clearTimeout(notifyUnlike);\n\t\t\tunlikedObject.removeClass(\"liked\");\n\t\t\tunlikedObject.removeClass(\"cursorLoad\");\n\t\t\tunlikedObject.html((parseInt(unlikedObject.html())-1)+\"\");\n\t\t\t}\n\t\t }\n\tif(type==\"ads\"){\n\t xmlHttp.open(\"DELETE\",URI+\"customer/unlike-advert?id=\"+postID,true);\n\t}\t\n \n else if(type==\"broadcasts\"){\n xmlHttp.open(\"DELETE\",URI+\"customer/unlike-broadcast?id=\"+postID,true);\n } \n\t\n xmlHttp.setRequestHeader(\"Authorization\",'Bearer ' + token);\n\txmlHttp.send();\n\t\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the screen size is tablet or smaller, add the mobile print class. This class displays all sections, regardless of 'show' or 'hide' class. This is used for displaying all sections when printing from a small screen.
function _setPrintClass($selector) { if(window.innerWidth < 1025) { $selector.addClass('cis-mobile-print'); } else { $selector.removeClass('cis-mobile-print'); } }
[ "function screenClass() {\n\t if($(window).innerWidth() > 959) {\n\t $('body').addClass('big-screen').removeClass('small-screen');\n\t $('.nav-list').css('display','flex');\n\t } else {\n\t $('body').addClass('small-screen').removeClass('big-screen');\n\t $('.nav-list').css('display','none');\n\t }\n\t}", "function setMobileControlsClass(){\n if ( _window.width() < media.tablet ){\n // $('.controls').addClass('is-last').addClass('is-visible');\n } else {\n\n }\n }", "function dashBodymobScreen() {\r\n if (window.innerWidth <= 1000) {\r\n if (!section2.classList.contains('mobScreen')) {\r\n let headingContainer = section2.querySelector('.data-heading');\r\n section2.classList.add('mobScreen');\r\n for (let i = 0; i < dataRow.length; i++) {\r\n let dataDes = dataRow[i].querySelectorAll('.data-title-content .data');\r\n for (let a = 0; a < dataDes.length; a++) {\r\n let copyItem = dataHeading[a].cloneNode(true);\r\n dataDes[a].querySelector('.inner-data').insertAdjacentElement('beforebegin', copyItem);\r\n }\r\n }\r\n headingContainer.classList.remove('d-flex');\r\n headingContainer.style.display = 'none';\r\n }\r\n }\r\n }", "function addMobileClass(){\n if($(window).width() < \"1250\"){ \n $(\"body\").addClass(\"mobile\");\n }else{\n $(\"body\").removeClass(\"mobile\"); \n }\n }", "function hide_print_buttons(){\n jQuery(document).ready(function() {\n if (isTouchDevice()){\n\tjQuery(\".print-button\").hide();\n }\n });\n}", "function mobileSetUp()\n {\n \n $('.no-mobile').hide();\n $('.mobile').show();\n }", "function showMainMobile() {\n\t\t\tfixedHeader.append(mobilePager.detach());\n\t\t\tmobilePager.addClass(\"visible-mobile-pager\");\n\t\t\tmainContent.show();\n\t\t\tcreateSlickSliders(productSections, sliderSettings);\n\t\t\tusingSlick = true;\n\n\t\t\t$(\"body,html\").css({\n\t\t\t\t\"overflow\": \"auto\",\n\t\t\t\t\"height\": \"auto\"\n\t\t\t});\n\n\t\t\tmobileLander.fadeOut();\n\t\t}", "function mediaQuery(){\r\n let screenWidth = $(document).width();\r\n if(screenWidth<=768 ){\r\n $('.resources').hide();\r\n $('.networks').hide();\r\n $('.main-nav').hide();\r\n $('.solutions').show();\r\n $('.solutions-content').hide();\r\n }\r\n else if(screenWidth<1280 && screenWidth>768){\r\n $('.main-nav').show();\r\n $('.solutions').show();\r\n $('.solutions-content').show();\r\n $('.resources').hide();\r\n $('.networks').hide();\r\n }\r\n }", "function showMobile(){\n return config.mobileHide == 0 || $(window).width() >= config.mobileHide;\n }", "function detailAddResponsiveClasses() {\n\tvar responsiveClasses = Array.prototype.slice.call(document.getElementsByClassName('was-responsive'), 0);\n\tfor (var i = 0; i < responsiveClasses.length; i++) {\n\t\tresponsiveClasses[i].classList.add('responsive');\n\t\tresponsiveClasses[i].classList.remove('was-responsive');\n\t}\n}", "function mediaSize() { \n\t\tif (window.matchMedia('(min-width: 768px) and (max-width: 1023px)').matches) {\n\t\t\t$(\".brandrepair_item\").slice(15,).addClass(\"brandrepair_item-hide\").hide();\n\t\t} else if (window.matchMedia('(max-width: 767px)').matches) {\n\t\t\t$(\".brandrepair_item\").slice(9,).addClass(\"brandrepair_item-hide\").hide();\n\t\t}\n\t\telse if (window.matchMedia('(min-width: 1024px)').matches) {\n\t\t\t$(\".brandrepair_item-hide\").show();\t\n\t\t}\n\t}", "function showMainMobile() {\n\t\t\t$(\".whbm-section-containers\").show();\n\t\t\t$(\"#whbm-back-top\").show();\n\t\t\tcreateSlickSliders();\n\n\t\t\t$(\"body,html\").css({\n\t\t\t\t\"overflow\": \"auto\",\n\t\t\t\t\"height\": \"auto\"\n\t\t\t});\n\n\t\t\t$(\".whbm-hed-container\").fadeOut(600);\n\t\t}", "function displayMobileContent() {\n if(window.innerWidth < 420) {\n displayAdSenseContent(\"mobileOnly\");\n } else if(window.innerWidth >= 420 && window.innerWidth <= 767) {\n displayAdSenseContent(\"anySize\"); \n }\n}", "function _enterMobile() {\r\n\t\t\thome.viewformat = 'small';\r\n\t\t}", "function chkPrintCompat() {\nvar uA = navigator.userAgent;\nif(uA.match(new RegExp(\"Android\",\"i\")) || uA.match(new RegExp(\"Mobile\",\"i\")))\ndocument.getElementById(\"print_file\").style.visibility = \"hidden\";\n}", "function displaymobile() {\n\n $(\"#list\").removeClass(\"left\");\n $(\"#list\").addClass(\"leftmobile\");\n //$(\"#right\").removeClass(\"tabright\");\n //$(\"#right\").addClass(\"rightmobile\");\n $(\"#tablelist\").removeClass(\"mobright\");\n $(\"#tablelist\").addClass(\"rightmobile\");\n $(\"#close\").removeClass(\"butright\");\n $(\"#close\").addClass(\"back\");\n\n }", "function desktopSetUp()\n {\n $('.hiddenMobile').show();\n $('.viewMobile').hide();\n }", "function addMobileHidden(){\n\n\t\tif ( $('.tiles-module .load-more-container').length === 0 ) { //make sure not inside load more container\n\n\t\t\t$tiles.each( function(index){\n\t\t\t\tvar $tile = $(this);\n\t\t\t\t\t$col = $tile.parent().parent(); //target the row container, skip .tile-wrapper\n\n\t\t\t\tif (index > 4) {\n\t\t\t\t\t$tile.addClass('_mobile-hidden');\n\t\t\t\t}\n\n\t\t\t\tif ( $col.find('._mobile-hidden').length === $col.find('.tile').length ) { // if all tiles inside col are hidden\n\t\t\t\t\t$col.addClass('_mobile-hidden');\n\t\t\t\t}\n\n\t\t\t});\n\t\t}\n\n\t}", "function desktopSetUp () {\n $('.hiddenMobile').show()\n $('.viewMobile').hide()\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called from WatchmanWatcher (or WatchmanClient during reconnect) to create a watcherInfo entry in our _watcherMap and issue a 'subscribe' to the watchman.Client, to be handled here.
subscribe(watchmanWatcher, root) { let subscription; let watcherInfo; return this._setupClient() .then(() => { watcherInfo = this._createWatcherInfo(watchmanWatcher); subscription = watcherInfo.subscription; return this._watch(subscription, root); }) .then(() => this._clock(subscription)) .then(() => this._subscribe(subscription)); // Note: callers are responsible for noting any subscription failure. }
[ "_createWatcherInfo(watchmanWatcher) {\n let watcherInfo = {\n subscription: this._genSubscription(),\n watchmanWatcher: watchmanWatcher,\n root: null, // set during 'watch' or 'watch-project'\n relativePath: null, // same\n since: null, // set during 'clock'\n options: null, // created and set during 'subscribe'.\n };\n\n this._watcherMap[watcherInfo.subscription] = watcherInfo;\n\n return watcherInfo;\n }", "_onEnd() {\n console.warn(\n '[sane.WatchmanClient] Warning: Lost connection to watchman, reconnecting..'\n );\n\n // Hold the old watcher map so we use it to recreate all subscriptions.\n let oldWatcherInfos = values(this._watcherMap);\n\n this._clearLocalVars();\n\n this._setupClient().then(\n () => {\n let promises = oldWatcherInfos.map(watcherInfo =>\n this.subscribe(\n watcherInfo.watchmanWatcher,\n watcherInfo.watchmanWatcher.root\n )\n );\n Promise.all(promises).then(\n () => {\n console.log('[sane.WatchmanClient]: Reconnected to watchman');\n },\n error => {\n console.error(\n '[sane.WatchmanClient]: Reconnected to watchman, but failed to ' +\n 'reestablish at least one subscription, cannot continue'\n );\n console.error(error);\n oldWatcherInfos.forEach(watcherInfo =>\n watcherInfo.watchmanWatcher.handleErrorEvent(error)\n );\n // XXX not sure whether to clear all _watcherMap instances here,\n // but basically this client is inconsistent now, since at least one\n // subscribe failed.\n }\n );\n },\n error => {\n console.error(\n '[sane.WatchmanClient]: Lost connection to watchman, ' +\n 'reconnect failed, cannot continue'\n );\n console.error(error);\n oldWatcherInfos.forEach(watcherInfo =>\n watcherInfo.watchmanWatcher.handleErrorEvent(error)\n );\n }\n );\n }", "_subscribe(subscription) {\n return new Promise((resolve, reject) => {\n let watcherInfo = this._getWatcherInfo(subscription);\n\n // create the 'bare' options w/o 'since' or relative_root.\n // Store in watcherInfo for later use if we need to reset\n // things after an 'end' caught here.\n let options = watcherInfo.watchmanWatcher.createOptions();\n watcherInfo.options = options;\n\n // Dup the options object so we can add 'relative_root' and 'since'\n // and leave the original options object alone. We'll do this again\n // later if we need to resubscribe after 'end' and reconnect.\n options = Object.assign({}, options);\n\n if (this._relative_root) {\n options.relative_root = watcherInfo.relativePath;\n }\n\n options.since = watcherInfo.since;\n\n this._client.command(\n ['subscribe', watcherInfo.root, subscription, options],\n (error, resp) => {\n if (error) {\n reject(error);\n } else {\n resolve(resp);\n }\n }\n );\n });\n }", "subscribe(newInfo, request, callback) {\n this.subscribers.push({\n newInfo,\n request,\n callback\n });\n }", "_onSubscription(resp) {\n let watcherInfo = this._getWatcherInfo(resp.subscription);\n\n if (watcherInfo) {\n // we're assuming the watchmanWatcher does not throw during\n // handling of the change event.\n watcherInfo.watchmanWatcher.handleChangeEvent(resp);\n } else {\n // Note it in the log, but otherwise ignore it\n console.error(\n \"WatchmanClient error - received 'subscription' event \" +\n \"for non-existent subscription '\" +\n resp.subscription +\n \"'\"\n );\n }\n }", "addWatcher(clusterName, watcher) {\n let watchersEntry = this.watchers.get(clusterName);\n let addedServiceName = false;\n if (watchersEntry === undefined) {\n addedServiceName = true;\n watchersEntry = [];\n this.watchers.set(clusterName, watchersEntry);\n }\n watchersEntry.push(watcher);\n /* If we have already received an update for the requested edsServiceName,\n * immediately pass that update along to the watcher */\n for (const message of this.latestResponses) {\n if (message.name === clusterName) {\n /* These updates normally occur asynchronously, so we ensure that\n * the same happens here */\n process.nextTick(() => {\n watcher.onValidUpdate(message);\n });\n }\n }\n if (addedServiceName) {\n this.updateResourceNames();\n }\n }", "register(watcher) {\n this.registeredWatchers.push(watcher);\n }", "function setUpWatchers() {\n\n}", "function subscribeMapUpdates() {\n\tmapUpdateCon = stompClient.subscribe('/map/update', function (update) {\n\t\tonMapSettingUpdate(JSON.parse(update.body));\n\t});\n}", "__subscribe() {\n\t\t\tAppDispatcher.register((event) => {\n\t\t\t\tswitch(event.type) {\n\t\t\t\t\tcase \"NEW_REPO\":\n\t\t\t\t\t\tthis.repos[event.meta] = event.payload;\n\t\t\t\t\t\tthis.current_repo = event.meta;\n\t\t\t\t\t\tthis.commitIndex = 0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"COMMIT_INDEX\":\n\t\t\t\t\t\tthis.commitIndex = event.payload;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.emit(CHANGE_EVENT);\n\t\t\t});\n\t\t}", "function subscribeMapUpdates() {\n mapUpdateCon = stompClient.subscribe('/map/update', function (update) {\n onMapSettingUpdate(JSON.parse(update.body));\n });\n}", "_startWatch()\n\t{\n\t\tthis.logger.info(`OpenVPNMonitor FS watcher initiated`);\n\t\tthis.watch = customWatch(process.env.OPENVPN_STATUS_FILE, this._statusFileUpdater.bind(this));\n\t\tthis.watch.addListener('close', () => {\n\t\t\tthis.logger.info(`OpenVPNMonitor FS Watcher closed`);\n\t\t});\n\t}", "subscribe(path, initialDataGetter = defaultDataGetter, cleanup) {\n if (this.subscriptions.has(path)) {\n throw new Error('duplicate persistent subscription: ' + path)\n }\n\n this.subscriptions = this.subscriptions.set(path, {\n getter: initialDataGetter,\n cleanup,\n })\n for (const socket of this.sockets) {\n this.nydus.subscribeClient(socket, path, initialDataGetter(this, socket))\n }\n }", "_createWatcher() {\n const _watcher = Looper.create({\n immediate: true,\n });\n _watcher\n .on('tick', () =>\n safeExec(this, 'updateData')\n );\n\n this.set('_watcher', _watcher);\n }", "_initSubscribers() {\n subscriberConfig.init();\n }", "_init_watcher() {\n let reference = this;\n FileSystem.access(this.#path, (error) => {\n // Throw error over passthrough handler\n if (error) return reference.#handlers.error(reference.#path, error);\n\n // Create watcher once path has been verified\n reference.#watcher_id = this.#watcher_pool.watch(\n reference.#path,\n (e, f) => reference._reload_content()\n );\n });\n }", "createWatchers() {\n\t\tconsole.info(chalk.cyan(chalk.bold('*** Started Mangony Watcher ***\\n')));\n\n\t\tthis.watchers.partials = this.addWatcher('partials');\n\t\tthis.watchers.layouts = this.addWatcher('layouts');\n\t\tthis.watchers.pages = this.addWatcher('pages');\n\t\tthis.watchers.data = this.addWatcher('data');\n\n\t}", "function _subscribe() {\n\n _comapiSDK.on(\"conversationMessageEvent\", function (event) {\n console.log(\"got a conversationMessageEvent\", event);\n if (event.name === \"conversationMessage.sent\") {\n $rootScope.$broadcast(\"conversationMessage.sent\", event.payload);\n }\n });\n\n _comapiSDK.on(\"participantAdded\", function (event) {\n console.log(\"got a participantAdded\", event);\n $rootScope.$broadcast(\"participantAdded\", event);\n });\n\n _comapiSDK.on(\"participantRemoved\", function (event) {\n console.log(\"got a participantRemoved\", event);\n $rootScope.$broadcast(\"participantRemoved\", event);\n });\n\n _comapiSDK.on(\"conversationDeleted\", function (event) {\n console.log(\"got a conversationDeleted\", event);\n $rootScope.$broadcast(\"conversationDeleted\", event);\n });\n\n }", "addWatcher(edsServiceName, watcher) {\n let watchersEntry = this.watchers.get(edsServiceName);\n let addedServiceName = false;\n if (watchersEntry === undefined) {\n addedServiceName = true;\n watchersEntry = [];\n this.watchers.set(edsServiceName, watchersEntry);\n }\n watchersEntry.push(watcher);\n /* If we have already received an update for the requested edsServiceName,\n * immediately pass that update along to the watcher */\n for (const message of this.latestResponses) {\n if (message.cluster_name === edsServiceName) {\n /* These updates normally occur asynchronously, so we ensure that\n * the same happens here */\n process.nextTick(() => {\n watcher.onValidUpdate(message);\n });\n }\n }\n if (addedServiceName) {\n this.updateResourceNames();\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `ApplicationLocationProperty`
function CfnApplication_ApplicationLocationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); errors.collect(cdk.propertyValidator('applicationId', cdk.requiredValidator)(properties.applicationId)); errors.collect(cdk.propertyValidator('applicationId', cdk.validateString)(properties.applicationId)); errors.collect(cdk.propertyValidator('semanticVersion', cdk.requiredValidator)(properties.semanticVersion)); errors.collect(cdk.propertyValidator('semanticVersion', cdk.validateString)(properties.semanticVersion)); return errors.wrap('supplied properties not correct for "ApplicationLocationProperty"'); }
[ "function CfnApplication_ApplicationLocationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('applicationId', cdk.requiredValidator)(properties.applicationId));\n errors.collect(cdk.propertyValidator('applicationId', cdk.validateString)(properties.applicationId));\n errors.collect(cdk.propertyValidator('semanticVersion', cdk.requiredValidator)(properties.semanticVersion));\n errors.collect(cdk.propertyValidator('semanticVersion', cdk.validateString)(properties.semanticVersion));\n return errors.wrap('supplied properties not correct for \"ApplicationLocationProperty\"');\n}", "function matches(property) {\n var property = original[property];\n return location.indexOf(property) !== -1;\n }", "function CfnInstance_LocationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('availabilityZone', cdk.validateString)(properties.availabilityZone));\n errors.collect(cdk.propertyValidator('regionName', cdk.validateString)(properties.regionName));\n return errors.wrap('supplied properties not correct for \"LocationProperty\"');\n}", "function locationMatches(profile, preferences) {\n if (preferences.locations.includes(profile.address)) return true\n return false\n }", "function CfnDocumentationPart_LocationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('method', cdk.validateString)(properties.method));\n errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));\n errors.collect(cdk.propertyValidator('path', cdk.validateString)(properties.path));\n errors.collect(cdk.propertyValidator('statusCode', cdk.validateString)(properties.statusCode));\n errors.collect(cdk.propertyValidator('type', cdk.validateString)(properties.type));\n return errors.wrap('supplied properties not correct for \"LocationProperty\"');\n}", "function CfnDocumentationPart_LocationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('method', cdk.validateString)(properties.method));\n errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));\n errors.collect(cdk.propertyValidator('path', cdk.validateString)(properties.path));\n errors.collect(cdk.propertyValidator('statusCode', cdk.validateString)(properties.statusCode));\n errors.collect(cdk.propertyValidator('type', cdk.validateString)(properties.type));\n return errors.wrap('supplied properties not correct for \"LocationProperty\"');\n}", "function CfnApplicationPropsValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('location', cdk.requiredValidator)(properties.location));\n errors.collect(cdk.propertyValidator('location', cdk.unionValidator(CfnApplication_ApplicationLocationPropertyValidator, cdk.validateString))(properties.location));\n errors.collect(cdk.propertyValidator('notificationArns', cdk.listValidator(cdk.validateString))(properties.notificationArns));\n errors.collect(cdk.propertyValidator('parameters', cdk.hashValidator(cdk.validateString))(properties.parameters));\n errors.collect(cdk.propertyValidator('tags', cdk.hashValidator(cdk.validateString))(properties.tags));\n errors.collect(cdk.propertyValidator('timeoutInMinutes', cdk.validateNumber)(properties.timeoutInMinutes));\n return errors.wrap('supplied properties not correct for \"CfnApplicationProps\"');\n}", "function CfnWorkflow_InputFileLocationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('efsFileLocation', CfnWorkflow_EfsInputFileLocationPropertyValidator)(properties.efsFileLocation));\n errors.collect(cdk.propertyValidator('s3FileLocation', CfnWorkflow_S3InputFileLocationPropertyValidator)(properties.s3FileLocation));\n return errors.wrap('supplied properties not correct for \"InputFileLocationProperty\"');\n}", "function CfnTopicRule_LocationActionPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('deviceId', cdk.requiredValidator)(properties.deviceId));\n errors.collect(cdk.propertyValidator('deviceId', cdk.validateString)(properties.deviceId));\n errors.collect(cdk.propertyValidator('latitude', cdk.requiredValidator)(properties.latitude));\n errors.collect(cdk.propertyValidator('latitude', cdk.validateString)(properties.latitude));\n errors.collect(cdk.propertyValidator('longitude', cdk.requiredValidator)(properties.longitude));\n errors.collect(cdk.propertyValidator('longitude', cdk.validateString)(properties.longitude));\n errors.collect(cdk.propertyValidator('roleArn', cdk.requiredValidator)(properties.roleArn));\n errors.collect(cdk.propertyValidator('roleArn', cdk.validateString)(properties.roleArn));\n errors.collect(cdk.propertyValidator('timestamp', cdk.validateDate)(properties.timestamp));\n errors.collect(cdk.propertyValidator('trackerName', cdk.requiredValidator)(properties.trackerName));\n errors.collect(cdk.propertyValidator('trackerName', cdk.validateString)(properties.trackerName));\n return errors.wrap('supplied properties not correct for \"LocationActionProperty\"');\n}", "matches(aProperty){\n if(aProperty.name == this.name){\n return true;\n } else {\n for(let i = 0; i < this.aliases.length; i++){\n let myAlias = this.aliases[i];\n if(aProperty.hasAlias(myAlias)){\n return true;\n }\n }\n }\n return false;\n }", "function CfnCluster_ApplicationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('additionalInfo', cdk.hashValidator(cdk.validateString))(properties.additionalInfo));\n errors.collect(cdk.propertyValidator('args', cdk.listValidator(cdk.validateString))(properties.args));\n errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));\n errors.collect(cdk.propertyValidator('version', cdk.validateString)(properties.version));\n return errors.wrap('supplied properties not correct for \"ApplicationProperty\"');\n}", "function RecordSetResource_GeoLocationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('continentCode', cdk.validateString)(properties.continentCode));\n errors.collect(cdk.propertyValidator('countryCode', cdk.validateString)(properties.countryCode));\n errors.collect(cdk.propertyValidator('subdivisionCode', cdk.validateString)(properties.subdivisionCode));\n return errors.wrap('supplied properties not correct for \"GeoLocationProperty\"');\n }", "function CfnRobotApplicationPropsValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('currentRevisionId', cdk.validateString)(properties.currentRevisionId));\n errors.collect(cdk.propertyValidator('environment', cdk.validateString)(properties.environment));\n errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));\n errors.collect(cdk.propertyValidator('robotSoftwareSuite', cdk.requiredValidator)(properties.robotSoftwareSuite));\n errors.collect(cdk.propertyValidator('robotSoftwareSuite', CfnRobotApplication_RobotSoftwareSuitePropertyValidator)(properties.robotSoftwareSuite));\n errors.collect(cdk.propertyValidator('sources', cdk.listValidator(CfnRobotApplication_SourceConfigPropertyValidator))(properties.sources));\n errors.collect(cdk.propertyValidator('tags', cdk.hashValidator(cdk.validateString))(properties.tags));\n return errors.wrap('supplied properties not correct for \"CfnRobotApplicationProps\"');\n}", "function CfnWorkflow_EfsInputFileLocationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('fileSystemId', cdk.validateString)(properties.fileSystemId));\n errors.collect(cdk.propertyValidator('path', cdk.validateString)(properties.path));\n return errors.wrap('supplied properties not correct for \"EfsInputFileLocationProperty\"');\n}", "function CfnRecordSet_GeoLocationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('continentCode', cdk.validateString)(properties.continentCode));\n errors.collect(cdk.propertyValidator('countryCode', cdk.validateString)(properties.countryCode));\n errors.collect(cdk.propertyValidator('subdivisionCode', cdk.validateString)(properties.subdivisionCode));\n return errors.wrap('supplied properties not correct for \"GeoLocationProperty\"');\n}", "function CfnRestApi_S3LocationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('bucket', cdk.validateString)(properties.bucket));\n errors.collect(cdk.propertyValidator('eTag', cdk.validateString)(properties.eTag));\n errors.collect(cdk.propertyValidator('key', cdk.validateString)(properties.key));\n errors.collect(cdk.propertyValidator('version', cdk.validateString)(properties.version));\n return errors.wrap('supplied properties not correct for \"S3LocationProperty\"');\n}", "function CfnDeploymentGroup_RevisionLocationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('gitHubLocation', CfnDeploymentGroup_GitHubLocationPropertyValidator)(properties.gitHubLocation));\n errors.collect(cdk.propertyValidator('revisionType', cdk.validateString)(properties.revisionType));\n errors.collect(cdk.propertyValidator('s3Location', CfnDeploymentGroup_S3LocationPropertyValidator)(properties.s3Location));\n return errors.wrap('supplied properties not correct for \"RevisionLocationProperty\"');\n}", "function CfnApi_S3LocationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('bucket', cdk.requiredValidator)(properties.bucket));\n errors.collect(cdk.propertyValidator('bucket', cdk.validateString)(properties.bucket));\n errors.collect(cdk.propertyValidator('key', cdk.requiredValidator)(properties.key));\n errors.collect(cdk.propertyValidator('key', cdk.validateString)(properties.key));\n errors.collect(cdk.propertyValidator('version', cdk.requiredValidator)(properties.version));\n errors.collect(cdk.propertyValidator('version', cdk.validateNumber)(properties.version));\n return errors.wrap('supplied properties not correct for \"S3LocationProperty\"');\n}", "function CfnApplication_S3ContentLocationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('bucketArn', cdk.requiredValidator)(properties.bucketArn));\n errors.collect(cdk.propertyValidator('bucketArn', cdk.validateString)(properties.bucketArn));\n errors.collect(cdk.propertyValidator('fileKey', cdk.requiredValidator)(properties.fileKey));\n errors.collect(cdk.propertyValidator('fileKey', cdk.validateString)(properties.fileKey));\n errors.collect(cdk.propertyValidator('objectVersion', cdk.validateString)(properties.objectVersion));\n return errors.wrap('supplied properties not correct for \"S3ContentLocationProperty\"');\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fungsi untuk mengisi element ul yang diatas dengan product dari database
function listProduct(i) { if (!products[i].name) { products[i].name = "Tidak ada nama product"; } else if (Array.isArray(products[i].name)) { products[i].name = products[i].name.join(" "); } else if (typeof products[i].name === "number") { products[i].name = "Product " + products[i].name; } var liEl = document.createElement("LI"); liEl.innerHTML = "ID:" + products[i].id + "</br>" + "Name:" + products[i].name; ulEl.appendChild(liEl); }
[ "function createProductMenuHTML(beers,oUl){\n for (var i = 0; i < beers.length; i++) {\n const data = beers[i];\n const liHTML = createLi(\"\",\"beer_line\",\n // hidden beer id\n createHiddenP(\"\",\"\", data[0].articleid)\n + createP(\"\",\"beer_name\",'Name: ' + data[0].name)\n + createP(\"\",\"beer_producer\",'Producer: '+ data[0].producer)\n + createP(\"\",\"beer_price\",'Price: '+ data[0].priceinclvat)\n + createP(\"\",\"beer_strength\",'Alcohol: '+ data[0].alcoholstrength)\n + createDiv(\"\",\"add_btn\",\"Drag to order\"),\n true);\n oUl.innerHTML += liHTML;\n }\n}", "function creatListsInsideUl(product) {\n const ul = document.createElement(\"ul\");\n ul.appendChild(creatElementWithClassName('li', 'name', product.name)); \n ul.appendChild(creatElementWithClassName('li', 'price', product.price));\n ul.appendChild(creatElementWithClassName('li', 'rating', product.rating));\n ul.appendChild(creatUlShipping(product.shipsTo));\n return ul ; \n}", "function displayProducts(products) {\n\t_.each(products, function(product) {\n\t\tvar tpl = '<li class=\"list-group-item\">' +\n\t\t \t'<div class=\"container-fluid\">' + \n\t\t \t\t'<div class=\"row\">' + \n\t\t \t\t\t'<div class=\"col-md-4 productName\">' + \n\t\t \t\t\tproduct.name +\n\t\t \t\t\t'</div>' + \n\t\t \t\t\t'<div class=\"col-md-5\">' + \n\t\t \t\t\taccounting.formatMoney(product.price) + ' per ' + product.per +\n\t\t \t\t\t'</div>' + \n\t\t \t\t\t'<div class=\"col-md-3\">' + \n\t\t \t\t\t\t'<div class=\"form-group\">' + \n\t\t\t\t\t\t\t'<input type=\"text\" onkeypress=\"return event.charCode >= 48 && event.charCode <= 57\" class=\"form-control quantities\" placeholder=\"Qty.\" data-id='+product.name+'>' + \n\t\t\t\t\t\t'</div>' + \n\t\t \t\t\t'</div>' + \n\t\t \t\t'</div>' + \n\t\t \t'</div>' + \n\t\t '</li>';\n\n\t\t$('#productsList').append(tpl);\n\n\t});\n}", "function generateListProduct(product) {\n\tvar html = '<div class=\"col-md-12 product product-list\">\\\n\t<div class=\"row\">\\\n\t<div class=\"col-md-3 col-sm-6 text-center\">\\\n\t<a href=\"/san-pham/' + product.id + '/' + product.slug + '\"><img src=\"/storage/' + product.thumb + '\" alt=\"\" class=\"img-fluid\"></a>\\\n\t</div>\\\n\t<div class=\"col-md-9 col-sm-6 contents\">\\\n\t<h6 class=\"product-name\">' + product.name + '</h6>';\n\tif (auth == 1) {\n\t\thtml += '<h6 class=\"product-price\">' + product.sell_price + '</h6>';\n\t}\n\thtml += '<p class=\"size\"><span class=\"font-weight-bold\">Kích thước: </span>' + product.sizes + '</p>\\\n\t<p class=\"color\"><span class=\"font-weight-bold\">Màu sắc: </span>' + product.colors + '</p>\\\n\t<a name=\"' + product.name + '\" class=\"btn btn-success\" href=\"/san-pham/' + product.id + '/' + product.slug + '\" role=\"button\">Xem Chi Tiết</a>\\\n\t</div>\\\n\t</div>\\\n\t</div>';\n\n\treturn html;\n}", "function setupProductList() {\n if(document.getElementById(\"productList\")) {\n for (productSku of Object.keys(products)) {\n\t // products[productSku].name\t\n\t $(\"#productList\").append(\n\t $(\"<a>\").attr(\"href\",\"product.html?sku=\" + productSku).append(\t \n $(\"<div>\").addClass(\"productItem\").append(\n\t $(\"<h2>\").addClass(\"productTitle\").text(products[productSku].name)\n\t ).append(\n\t\t $(\"<span>\").addClass(\"productPrice\").text(products[productSku].price)\n\t ).append(\n $(\"<img>\").addClass(\"productImage\").attr(\"src\", \"img/\" + products[productSku].img)\n\t )\n\t )\n\t );\n }\n }\n}", "function populateProductsDisplay(){ \n return (orderProducts.order_products.map(product => <li key={product.id} ><h4>{product.product.name}</h4><p>Qty: {product.product_qty}/ Price $: {product.product.price}</p></li>))\n }", "function orderListOfProducts(order, orderViewID){\n console.log(order)\n console.log(orderViewID)\n\n\n let products = order.products;\n\n for (id in products){\n\n let product = order.products[id];\n\n $(`#${orderViewID}`).append(`\n <li class=\"list-group-item\">\n <div class=\"row\">\n <div class=\"col-3\" id=\"${product.id}-name\">${product.name}</div>\n <div class=\"col-3\">$${product.price}</div>\n <div class=\"col-3\">$${product.cost}</div>\n <div class=\"col-3\">$${product.margin}</div>\n </div> \n </li>\n `)\n }\n\n\n}", "function displayProducts(){\n\tvar spacer = \"===================================================\";\n\tvar query = \"SELECT * FROM products ORDER BY department_name\";\n\tconnection.query(query, function(error,data){\n\t\tdata.forEach(function(product){\n\t\t\tconsole.log(\"\\nProduct ID : \"+ product.item_id+\"\\nProduct Name : \"+product.product_name+\"\\nDepartment : \"+product.department_name+\"\\nPrice : \"+product.price+\"\\n\"+spacer);\n\t\t})\n\tplaceOrder();\n\t})\t\n}", "function displayProductList(order){\n const productsCardsHTML = document.getElementById(\"order-products\");\n const productsList = createHTMLProductsList(order);\n productsList.forEach(div => {\n productsCardsHTML.append(div);\n })\n}", "function fillProductList(data) {\n var list = data == null ? [] : (data instanceof Array ? data : [data]);\n $('#itemList').find('li').remove();\n $.each(list, function (index, item) {\n $('#itemList').append('<li><a href=\"#\" data-identity=\"' + item.id + '\">' + item.name + '</a></li>');\n });\n}", "static renderProducts() {\n\t\tlet productHTML = \"\";\n\t\tProduct.getProductList().forEach( product => {\n\t\t\tproductHTML += \n\t\t\t`<product-list-item\n\t\t\tname=\"${product.name} \"\n\t\t\tdata-product-id=\"${product.id}\"\n\t\t\timg=\"${product.img}\"\n\t\t\tdescription=\"${product.description}\"\n\t\t\tprice=\"${product.price},-\"\n\t\t\t></product-list-item>`\n\t\t});\n\t\tProduct.productContainer.innerHTML = productHTML;\n\t}", "insertProduct() {\n this.wrapper.querySelector('.image').src = this.product.imageUrl\n this.wrapper.querySelector('.name').innerText = this.product.name\n this.wrapper.querySelector('.price').innerText = Math.ceil((this.product.price )/100) + '€'\n this.wrapper.querySelector('.description').innerText = this.product.description\n this.product.colors.forEach(element => {\n let option = document.createElement('option')\n option.innerText = element\n document.getElementById('itemPersonnalisationId').appendChild(option)\n })\n this.bindAddToCart()\n }", "function appendListItem(product){\n var liDocFrag = createListItem(product);\n $ul.appendChild(liDocFrag); \n }", "function listResult( data , quantity ) {\n let utts = data.content.utts ;\n keys = getSortedObjectKeys(utts);\n \n // selected elements by display quantity\n if( quantity != 'all' ){\n quantity = parseInt(quantity) ;\n keys = keys.slice(0, quantity) ;\n }\n\n let listWrapperHTML = \"\" ;\n keys.forEach(key => {\n // set all display row\n let orhHTMLList = csidClasses( data.content.utts[key] ) ; // get ops/ref/hyp HTML with csid classes\n let opsHTML = orhHTMLList[0] , refHTML = orhHTMLList[1] , hypHTML = orhHTMLList[2] ;\n\n keyHTML = \"<h5><a href=\\\"\" + data.content.utts[key].ctm_link + \"\\\" target=\\\"_blank\\\"> \" + key + \" </a></h5>\" ;\n keyHTML += \"<h5>csid: </h5> <p>\" + data.content.utts[key].csid + \"</p>\" ;\n keyHTML += \"<h5>ops: </h5> <p id=\\\"ops\\\">\" + opsHTML + \"</p>\" ;\n keyHTML += \"<h5>wer: </h5> <p>\" + data.content.utts[key].wer.round(4) + \"</p>\" ;\n keyHTML += \"<h5>ref: </h5> <p id=\\\"ref\\\">\" + refHTML + \"</p>\" ;\n keyHTML += \"<h5>hyp: </h5> <p id=\\\"hyp\\\">\" + hypHTML + \"</p>\" ;\n keyHTML += \"<h5>audio: </h5> <div class=\\\"icono-play audio\\\" onclick=\\\"playAudio(this, \\'\" + key + \"\\');\\\"></div>\" ;\n\n listWrapperHTML += \"<div class=list-item id=\\\"\" + key + \"\\\">\" + keyHTML + \"</div>\" ;\n });\n $(\"#listWrapper\").html( listWrapperHTML ) ;\n}", "function updateProductList(){\r\n if(shop.products){\r\n container.innerHTML = '';\r\n for(var i = 0; i < shop.products.length; i++){\r\n container.append(productElement(shop.products[i]));\r\n }\r\n addBtnListener(editBtnclassName, function(index, id){\r\n editProduct(id);\r\n });\r\n addBtnListener(removeBtnclassName, function(index, id){\r\n shop.products.splice(getIndexById(id), 1);\r\n updateProductList();\r\n });\r\n }\r\n }", "function dataList(productList){\n\tvar innerElements = productList.map((product)=> {\n\t\treturn ' <option data-value=\"'+product.id+'\"value=\"'+product.name+'\">'+product.price+'</option>';\n\t});\n\n\t$('#products').html(innerElements.join('')) ;\n}", "function populateList() {\n\n // Iterate over product to add the item list HTML \n for ( var i in product ) {\n $( \".items\" ).append(\"<div class='list-item'><div class='list-item-image'><img src='img/\" + product[i].image + \"' alt=''></div><div class='list-item-header'><span class='list-item-name'>\" + product[i].name + \"</span><span class='list-item-price'>\" + product[i].price + \"</span></div><div class='list-item-add'><a href='#' class='button' id='\"+ i +\"'>Add to cart</a></div></div>\");\n };\n\n }", "function renderProducts(){\n\t\t\tvar list = $('#product-list');\n\t\t\tlist.html('');\n\t\t\tfor(var i = 0 ; i<products.length; i++){\n\t\t\t\tvar product = products[i];\n\t\t\t\tvar productTemplate = '<div class=\"col-3\">\\\n\t\t\t\t\t\t\t\t\t\t<div class=\"box product-box\" onclick=\"revealProductModal('+product.id+')\">\\\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"col-sm-3 product-desc hide-medium hide-large\">\\\n\t\t\t\t\t\t\t\t\t\t\t<h4>'+product.title+'</h4>'\n\t\t\t\t\t\t\t\t\t\t\t\t+product.description+\n\t\t\t\t\t\t\t\t\t\t\t'</div>\\\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"col-sm-1\">\\\n\t\t\t\t\t\t\t\t\t\t\t\t<img src=\"'+product.img+'\" alt=\"vegetables from our fields\">\\\n\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"overlay\"></div>\\\n\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"product-name hide-small\"><span>' + product.title+ '</span></div>\\\n\t\t\t\t\t\t\t\t\t\t\t</div>\\\n\t\t\t\t\t\t\t\t\t\t</div>\\\n\t\t\t\t\t\t\t\t\t</div>';\n\t\t\t\t\n\n\t\t\t\tlist.append(productTemplate);\n\t\t\t}\n\t\t}", "function perroComoLi(e) { //U: devuelve los datos de un perro formateados para agregar a una ul u ol\r\n return `\r\n <li>${e.nombre} - animal: ${e.animal} - sexo: ${e.sexo} - raza: ${e.raza}</li>\r\n `\r\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UpdateFileName is a helper function to replace the extension
function UpdateFileName(fileName, extension) { var fileName = fileName.split('.'); fileName.pop(); (extension == null) ? "" : fileName.push(extension); return fileName.join("."); }
[ "function UpdateFileName(fileName, extension) {\n\tfileName = fileName.split('.');\n\tfileName.pop();\n\t\n\tif(extension !== null) fileName.push(extension);\n\t\n\treturn fileName.join('.');\n}", "function changeFileExtension(filename, newExtension) {\n return filename.substr(0, filename.lastIndexOf(\".\")) + newExtension;\n}", "function changeFileExt(filename, ext)\r\n{\r\n var arr = filename.split(\".\");\r\n arr[arr.length - 1] = ext;\r\n return arr.join(\".\");\r\n}", "function addExtensionToFileName(fileName)\r\n{\r\n var retVal = fileName;\r\n var hasExtension = (fileName.search(/\\.\\w+$/) != -1);\r\n\r\n if (!hasExtension)\r\n {\r\n var fileExtension = dwscripts.getFileExtension(dw.getDocumentDOM().URL)\r\n retVal = fileName +\".\" + fileExtension;\r\n }\r\n\r\n return retVal;\r\n}", "function correctFileNameExtension(fileName) {\n if (path.extname(fileName) !== '.cs') {\n if (fileName.endsWith('.')) {\n fileName = fileName + 'cs';\n }\n else {\n fileName = fileName + '.cs';\n }\n }\n return fileName;\n}", "function appendFileExtension(filename,extension) {\r\n\tvar extension_position=filename.length-extension.length;\r\n\tvar current_extension=filename.slice(extension_position);\r\n\tif(current_extension.toLowerCase()!=extension.toLowerCase()) {\r\n\t\tfilename+=extension;\r\n\t}\r\n\treturn filename;\r\n}", "function getNewFileName(fileName) {\n return fileName.split('.')[0] + ' (' + Date.now() + ')' + fileName.split('.')[1]+'.pdf';\n}", "function replaceExtToLowerCase(sFQFileName)\r\n{\r\n\tif (sFQFileName == null) return null;\r\n\tiDot = sFQFileName.lastIndexOf(\".\");\r\n\tif (iDot == -1) return \"\";\r\n\tiSemiColon = sFQFileName.lastIndexOf(\";\");\r\n\tif (iSemiColon == -1) iSemiColon = sFQFileName.length;\r\n\torgExt = sFQFileName.substring(iDot + 1, iSemiColon);\r\n\tmodFQFileName = sFQFileName.substring(0, iDot + 1) + orgExt.toLowerCase() + sFQFileName.substring(iSemiColon, sFQFileName.length);\r\n\t\r\n\treturn modFQFileName;\r\n\r\n}", "function appendFileExtension(filename,extension) {\n\tvar extension_position=filename.length-extension.length;\n\tvar current_extension=filename.slice(extension_position);\n\tif(current_extension.toLowerCase()!=extension.toLowerCase()) {\n\t\tfilename+=extension;\n\t}\n\treturn filename;\n}", "function modifyFilename(path, fn) {\n const elements = Path.parse(path);\n\n elements.name = fn(elements.name);\n delete elements.base;\n\n return Path.format(elements);\n}", "function changeExtension(inputPath, inputExtension, outputExtension) {\n var inputDirname = path.dirname(inputPath),\n inputBasename = path.basename(inputPath, inputExtension);\n\n return path.join(inputDirname, inputBasename + outputExtension);\n}", "function changeFileExtToLowercaseJpg(cbRunner, cbIndex) {\n const uploadableImage = cbRunner[0];\n let arr = uploadableImage.name.split('.')\n arr[arr.length - 1] = 'jpg';\n uploadableImage.name = arr.join('.');\n cbRunner[cbIndex]();\n }", "function replaceExt(fpath, newExt) {\n const oldExt = path.extname(fpath);\n return _nativeExt.includes(oldExt) ? fpath :\n path.join(path.dirname(fpath), path.basename(fpath, oldExt) + newExt);\n}", "function changeExtension(file, extension) {\n const basename = path.basename(file, path.extname(file));\n return path.join(path.dirname(file), basename + extension);\n}", "_generateFilename(originalFilename, hash) {\n var ext = path.extname(originalFilename)\n var filename = path.basename(originalFilename, ext)\n var renamedFile = format('{}.{}{}', filename, hash, ext)\n\n return renamedFile\n }", "setFileTimestamp() {\n const currentDate = new Date();\n const year = currentDate.getFullYear();\n const month = (currentDate.getUTCMonth() + 1).toString().padStart(2, '0');\n const date = currentDate.getDate().toString().padStart(2, '0');\n const timestamp = `${year}-${month}-${date}`;\n if (this.fileExtension) {\n this.fileName = this.fileName.replace(this.fileExtension, `-${timestamp}${this.fileExtension}`);\n } else {\n this.fileName = `${this.fileName}-${timestamp}`;\n }\n }", "function updateFileInfo(fileName) {\n var adjustedFileName = fileName;\n\n if (fileName.length > 50) {\n adjustedFileName = fileName.substr(0, 15) + '...' + fileName.substr(fileName.length - 15);\n }\n\n fileInfo.find('.file-name').html(adjustedFileName);\n fileInfo.attr('title', fileName);\n\n fileInputField.attr('title', fileName);\n\n fileInfo.find('.clear').show();\n }", "getFileName () {\n return this.fileBaseName + String(new Date()).split(' ').slice(1, 4).join('_')\n }", "function beautifyFilename(filename) {\n\tvar tokens = filename.split('.');\n\tvar tripped = tokens[0];\n\tvar ext = tokens[tokens.length - 1].toLowerCase();\n\ttokens = tripped.split('-');\n\ttokens.splice(1, 0, ext);\n\tvar newFilename = tokens.join('-');\n\treturn newFilename;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shorter way to get the value of a node when there is only once instance of it within a given block (elem).
function getNodeValue(elem, tag) { return elem.getElementsByTagName(tag)[0].firstChild.nodeValue; }
[ "function getValue(elem) \n{\n if (elem !== null && elem !== undefined && typeof elem === 'object' && elem.get)\n {\n return elem.get();\n }\n else\n {\n return elem;\n }\n}", "getElementWithValue(value, els) {\n value = hash_key(value);\n\n if (value !== null) {\n for (const node of els) {\n let el = node;\n\n if (el.getAttribute('data-value') === value) {\n return el;\n }\n }\n }\n }", "function getNodeValue(obj,tag){\n return obj.getElementsByTagName(tag)[0].firstChild.nodeValue\n }", "function getblockelt(elt)\r\n{\twhile (true)\r\n\t{\tif (elt === null) { return(null); }\t\t\t\t// fails\r\n\t\tif (containsblockelt(elt)) { break; }\t\t\t// quit if not inline\r\n\t\telt = elt.parentNode;\t\t\t\t\t\t\t// move out one level\r\n\t}\r\n\treturn(elt);\t\t\t\t\t\t\t\t\t\t// return found elt\r\n}", "_getInnerElement(elem) {\n return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem);\n }", "getNode(value) {\n let stack = [this];\n const seenValues = {};\n while (stack.length > 0) {\n const current = stack.pop();\n stack = stack.concat(current.children);\n if (current.value === value) {\n return current;\n }\n seenValues[current.value] = true;\n }\n return null;\n }", "findNodeFromEl(el) {\n if(el) {\n let match = el.id.match(/block-node-(.*)/);\n return match && (match.length > 1) && this.ast.getNodeById(match[1]);\n }\n }", "function single() {if(arguments.length==2 && !arguments[1]) return;return document.evaluate(\".\" + arguments[0], arguments[1] || document.body, null, 9, null).singleNodeValue}", "get value_holder_element() {\n var value_holder = this.firstDomDescendantOrSelfWithAttr(\n this.dom_element, { attr_name: 'data-component-part', attr_value: 'value_holder' }\n );\n if(value_holder == null)\n value_holder = this.dom_element;\n return value_holder;\n }", "function getElement() {\n return $hlb && $hlb[0];\n }", "static getElementValue($element) {\n var type = $element.attr('type');\n var value;\n switch (type) {\n case 'checkbox':\n value = $element.is(':checked');\n break;\n default:\n value = $element.val();\n }\n return value;\n }", "function _getInstanceOnElement(el){\n if ((el != null ? el.oj : 0) != null)\n return el.oj\n else\n return null\n }", "function getNodeValue(node, attr){\n return $(node).find(attr).attr(\"value\");\n}", "function getElementValue(id) { return getElement(id).value; }", "function _getValueByField(parElm,field){\r\n\t\tvar v = undefined;\r\n\t\tvar elm = _findInParentEx(parElm,field);\r\n\t\tif(elm[0]){\r\n\t\t\tv = _getValueEx(elm);\r\n\t\t}\r\n\t\treturn v;\r\n\t}", "findNode(refNodeValue) {}", "function getOneElement(tagName, node) {\n return getElementsByTagName(tagName, node, true, 1)[0];\n}", "function element_contains(el, x, y) {\n\tif (el === \"\") return null; //Empty slots contain nothing.\n\tif (ctx.isPointInPath(element_path(el).path, x - el.x, y - el.y)) return el;\n\tfor (let attr of types[el.type].children || [])\n\t\tfor (let child of el[attr] || []) {\n\t\t\tlet c = element_contains(child, x, y);\n\t\t\tif (c) return c;\n\t\t}\n\treturn null;\n}", "function getValueTag(el) {\n var type = typeof (el);\n var value = \"\";\n if (type == \"object\") {\n if (el instanceof cheerio) {\n value = el.text();\n } else if (el.data) {\n value = el.data;\n }\n } else if (type == \"string\") {\n value = el;\n }\n return value.trim();\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
move body forward or backwards (1 or 1)
moveBody (sign) { var dir = VR.camera.object.getWorldDirection() VR.body.position.add(dir.multiplyScalar(sign * .2)) }
[ "switchBodyOrder(direction, index) {\n const bodyObj = this.state.body;\n const temp = bodyObj[index];\n if (direction === 'up' && bodyObj[index - 1]) {\n bodyObj[index] = bodyObj[index - 1];\n bodyObj[index - 1] = temp;\n } else if (direction === 'down' && bodyObj[index + 1]) {\n bodyObj[index] = bodyObj[index + 1];\n bodyObj[index + 1] = temp;\n }\n this.setState({\n body: bodyObj,\n });\n return null;\n }", "move() {\n this.bodySegments.pop();\n if (this.direction === 'left') {\n this.bodySegments.unshift(new Coordinate(this.bodySegments[0].x - 1, this.bodySegments[0].y));\n } else if (this.direction === 'up') {\n this.bodySegments.unshift(new Coordinate(this.bodySegments[0].x, this.bodySegments[0].y - 1));\n } else if (this.direction === 'right') {\n this.bodySegments.unshift(new Coordinate(this.bodySegments[0].x + 1, this.bodySegments[0].y));\n } else if (this.direction === 'down') {\n this.bodySegments.unshift(new Coordinate(this.bodySegments[0].x, this.bodySegments[0].y + 1));\n }\n }", "move(){\n if (this.ballEdgeEst() > sceneWidth ) {\n this._movement.deltaX = this._movement.reverseX();\n }else if(this._topLeft.y < 0 ){\n this._movement.deltaY = this._movement.reverseY();\n }else if (this._topLeft.x < 0 ){\n this._movement.deltaX = this._movement.reverseX();\n } else if (this.ballEdgeSouth() > sceneHeight) {\n this._movement.deltaY = this._movement.reverseY();\n }\n this.topLeft.x = this._topLeft.x + this._movement.deltaX;\n this.topLeft.y = this._topLeft.y + this._movement.deltaY;\n }", "startMotion(){\n Matter.Body.setStatic(this.body, false)\n this.position = {...this.body.position,...{}}\n }", "function move_body(body, i) {\n /*\tV = dP/dt\t(Velocity) = Position derived\n\t/\tA = dV/dt\t(Acceleration) = Velocity derived\n\t/\tF = mA\t\t(Force)\n\t/\t\n / A = F/m (vector)\n / V1 = V0 + A * delta_t :: V = V + F * (dt/m)\n / P1 = P0 + V * delta_t\n / Note that the body's mass and delta_t are known at body creation time, so we can store (1/m)*delta_t in the body.\n\t*/\n if (calculate_distance_traveled) { // Don't take up extra memory unless this option is turned on\n var old_x = body.x;\n var old_y = body.y;\n }\n\n\tbody.vx += forces[i].x * body.mass_reciprocal_dt;\t\t// Add the forces acting on this body to its velocity -- Velocity(Vx, Vy) + (1/BodyMass)*(Fx, Fy)\n\tbody.vy += forces[i].y * body.mass_reciprocal_dt;\n\tbody.x += body.vx * delta_t;\t\t\t\t\t\t// Add the distance moved to this body's position -- Poisition(x,y) + (Time_Change)*Velocity(Vx, Vy)\n\tbody.y += body.vy * delta_t;\n\tbody.vx *= friction;\t\t\t\t\t\t\t\t// Multiply by the friction coefficient\n\tbody.vy *= friction;\n\n if (calculate_distance_traveled) {\n body.distance_traveled += calculate_distance_between_coordinates(old_x, old_y, body.x, body.y); \n }\n\n maybe_bounce(body);\n}", "standUp() {\n this.jump(0);\n this.bendLeg( this.body.leftLeg, 10 );\n this.bendLeg( this.body.rightLeg, 10 );\n }", "moveActorInDirectionLocal() {\r\n\r\n }", "function move(direction) {}", "function moveBody(headLastY, headLastX) {\n for (let i = 0; i < snake.length - 1; i++) {\n const element = snake[i];\n if (i === snake.length - 2) {\n element.style.top = headLastY;\n element.style.left = headLastX;\n continue;\n }\n element.style.top = snake[i + 1].style.top;\n element.style.left = snake[i + 1].style.left;\n }\n}", "moveForward () {\n let posAux = Object.assign({}, this.position);\n switch (this.position.orientation) {\n case 'N':\n this.position.column++;\n break;\n case 'S':\n this.position.column--;\n break;\n case 'E':\n this.position.row--;\n break;\n case 'W':\n this.position.row++;\n break;\n default:\n break;\n }\n this.isLost(posAux);\n }", "moveForward() {\n switch (this.position.heading) {\n case \"N\":\n return (this.position = { ...this.position, y: this.position.y + 1 });\n case \"E\":\n return (this.position = { ...this.position, x: this.position.x + 1 });\n case \"S\":\n return (this.position = { ...this.position, y: this.position.y - 1 });\n case \"W\":\n return (this.position = { ...this.position, x: this.position.x - 1 });\n default:\n return this.position;\n }\n }", "function followingBody()\n{\n\ttpx=x[x.length-1];//storing the previous location of tail. Needed when snake length is to be increased\n\ttpy=y[y.length-1];//storing the previous location of tail. Needed when snake length is to be increased\n\tfor(i=x.length-1;i>0;i--)//copying the x coordinate, because the snake follows its previous part\n\t{\n\t\tx[i]=x[i-1];\n\t}\n\tfor(i=y.length-1;i>0;i--)//copying the y coordinate, because the snake follows its previous part\n\t{\n\t\ty[i]=y[i-1];\n\t}\n}", "forward(n) {\n this.pos += n;\n }", "function CLC_SR_NavigateBodyFwd(){ \r\n CLC_SR_PrevAtomicObject = CLC_SR_CurrentAtomicObject;\r\n //First run through - No current object yet\r\n if (!CLC_SR_CurrentAtomicObject){\r\n CLC_SR_CurrentAtomicObject = CLC_GetFirstAtomicObject(CLC_Window().document.body);\r\n }\r\n //Already ran at least once - have current object\r\n else{\r\n //Blur the current object before getting the next one to prevent input blanks\r\n //from \"trapping\" the focus.\r\n CLC_BlurAll(CLC_SR_CurrentAtomicObject);\r\n CLC_SR_CurrentAtomicObject = CLC_GetNextAtomicTextObject(CLC_SR_CurrentAtomicObject);\r\n }\r\n //Ensure that the current atomic object stays within bounds and is readable\r\n var lineage = CLC_GetLineage(CLC_SR_CurrentAtomicObject);\r\n while ( CLC_SR_CurrentAtomicObject && \r\n ( !CLC_TagInLineage(lineage, \"body\") || \r\n !CLC_HasText(CLC_SR_CurrentAtomicObject) ||\r\n CLC_SR_ShouldNotSpeak(lineage) )\r\n ){\r\n CLC_SR_CurrentAtomicObject = CLC_GetNextAtomicTextObject(CLC_SR_CurrentAtomicObject); \r\n lineage = CLC_GetLineage(CLC_SR_CurrentAtomicObject);\r\n } \r\n //Something went wrong here; there should have been a next atomic object, but there wasn't.\r\n //Assume there was a DOM mutation event that took away the current object and attempt to \r\n //recover by using cursor matching.\r\n if (!CLC_SR_CurrentAtomicObject && CLC_SR_NextAtomicObjectExisted){\r\n try{\r\n CLC_SR_MatchCurrentObjWithCaret();\r\n CLC_SR_MatchCurrentSentenceWithCaret(direction);\r\n }\r\n catch(e){};\r\n }\r\n CLC_MoveCaret(CLC_SR_CurrentAtomicObject);\r\n //Check to see if there are prev/next objects for the current object.\r\n //This information is vital for recovering the user's position \r\n //if the current object is lost to a DOM mutation.\r\n CLC_SR_CheckForPrevNextAtomicObjects();\r\n return CLC_SR_CurrentAtomicObject;\r\n }", "move() {\n\t\tif(this._current_position === 'down' && this.is_full()) {\n\t\t\tthis._current_position = 'up';\n\t\t}\n\t\telse if(this._current_position === 'up' && this.is_full()) {\n\t\t\tthis._current_position = 'up1';\n\t\t}\n\t\telse if (this._current_position === 'up1' && !this.is_full()){\n\t\t\tthis._current_position = 'down';\n\t\t}\n\t}", "function move(){\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tif(move_right){\n\t\t\t\t\t\t\tpos+=speed;\n\t\t\t\t\t\t\telement.style.left = pos + 'px';\n\t\t\t\t\t\t\tif(pos>window.innerWidth-300)\n\t\t\t\t\t\t\t\tmove_right=false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\telse if (!move_right)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpos-=speed;\n\t\t\t\t\t\t\telement.style.left = pos + 'px';\n\t\t\t\t\t\t\tif(pos<0)\n\t\t\t\t\t\t\t\tmove_right=true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// alternating the direction once the triangle reaches edges on either side\n\t\t\t\t\t}", "move(){\n if(this.loc_y >= 0){\n this.loc_y += this.move_y;\n }\n//Makes the bombs stop at the bottom\n if(this.loc_y >= height){\n this.falling = false;\n // this.loc_y = 0;\n this.move_y = 0;\n }\n }", "move() {\r\n switch (this.heading) {\r\n case headings.NORTH:\r\n this.y++;\r\n break;\r\n case headings.SOUTH:\r\n this.y--;\r\n break;\r\n case headings.EAST:\r\n this.x++;\r\n break;\r\n case headings.WEST:\r\n this.x--;\r\n break;\r\n default:\r\n break;\r\n }\r\n }", "function moveB() {\n if(Pointer.dir == \"right\"){\n if(Pointer.x != 0) {\n Pointer.x--;\n }\n } else if(Pointer.dir == \"down\") {\n if(Pointer.y != 0) {\n Pointer.y--;\n }\n } else if(Pointer.dir == \"left\") {\n if(Pointer.x != 4) {\n Pointer.x++; \n }\n } else if(Pointer.dir == \"up\") {\n if(Pointer.y != 4) {\n Pointer.y++;\n }\n }\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merges several adjacent polygon to find the outlining one, which is returned.
function mergePolygons(poly) { var merged = [], edges = []; // traverse all edges and mark how may times, each one is used. poly.forEach(function (p, pi) { p.edges.forEach(function (e, ei) { if (e.edge.use === undefined) e.edge.use = { count: 1, poly: [pi], index: [ei] }; else { ++e.edge.use.count; e.edge.use.poly.push(pi); e.edge.use.index.push(ei); } }); }); for (var started = null, pi = 0, ei = 0;true; ++ei) { // ensure that we're within boundaries if (ei >= poly[pi].edges.length) { ei = 0; if (started === null) ++pi; } // we've made a circle around if (started !== null && pi == started[0] && ei == started[1]) break; var edge = poly[pi].edges[ei]; if (1 == edge.edge.use.count) { var s = edge.start(); merged.push([s.x, s.y]); edges.push(edge); if (started === null) started = [pi, ei]; } else if (started !== null) { var ni = ccLib.findIndex(edge.edge.use.poly, function (p) { return p != pi; }); pi = edge.edge.use.poly[ni]; ei = edge.edge.use.index[ni]; } } // traverse again to delete the usage counter poly.forEach(function (p, pi) { p.edges.forEach(function (e, ei) { delete e.edge.use; }); }); merged.edges = edges; return merged; }
[ "function intersectionsWithPolygon(){\r\n intersections.push(0) //the first and the last index of the route must be contained in the array in order to be able to calculate the lengths of the sections. \r\n for (let i = 0; i < positionToPolygon.length; i++){\r\n if (!positionToPolygon[i] && positionToPolygon[i+1] || positionToPolygon[i] && !positionToPolygon[i+1]){\r\n intersections.push(i); \r\n }\r\n}\r\n intersections.push(route.length-1);\r\n return intersections;\r\n}", "getSightPolygon(sightX, sightY) {\n\n // get all the points \n var points = ((segments) => {\n var a = [];\n segments.forEach((seg) => {\n a.push(seg.a, seg.b);\n });\n return a;\n })(this.segments);\n\n // keep only 1 copy\n var uniquePoints = ((points) => {\n var set = {};\n return points.filter((p) => {\n var key = p.x + \",\" + p.y;\n if (key in set) {\n return false;\n } else {\n set[key] = true;\n return true;\n }\n });\n })(points);\n\n // Get all angles\n var uniqueAngles = [];\n for (var j = 0; j < uniquePoints.length; j++) {\n var uniquePoint = uniquePoints[j];\n var angle = Math.atan2(uniquePoint.y - sightY, uniquePoint.x - sightX);\n uniquePoint.angle = angle;\n uniqueAngles.push(angle - 0.00001, angle, angle + 0.00001);\n }\n\n\n // RAYS IN ALL DIRECTIONS\n var intersects = [];\n for (var j = 0; j < uniqueAngles.length; j++) {\n var angle = uniqueAngles[j];\n // Calculate dx & dy from angle\n var dx = Math.cos(angle);\n var dy = Math.sin(angle);\n // Ray from center of screen to mouse\n var ray = {\n a: {\n x: sightX,\n y: sightY\n },\n b: {\n x: sightX + dx,\n y: sightY + dy\n }\n };\n // Find CLOSEST intersection\n var closestIntersect = null;\n for (var i = 0; i < this.segments.length; i++) {\n var intersect = this.getIntersection(ray, this.segments[i]);\n if (!intersect) continue;\n if (!closestIntersect || intersect.param < closestIntersect.param) {\n closestIntersect = intersect;\n }\n }\n // Intersect angle\n if (!closestIntersect) continue;\n closestIntersect.angle = angle;\n // Add to list of intersects\n intersects.push(closestIntersect);\n }\n // Sort intersects by angle\n intersects = intersects.sort(function (a, b) {\n return a.angle - b.angle;\n });\n // Polygon is intersects, in order of angle\n return intersects;\n }", "joinAdjacent(shapes, fractionalDigits) {\n let joined = 0;\n if (shapes.length < 2) {\n return joined;\n }\n let idx = 0;\n let last = shapes[idx++];\n while (idx < shapes.length) {\n const next = shapes[idx];\n if (next.geometry) {\n idx++;\n continue;\n }\n const lastEnd = this.end(last);\n const nextStart = this.start(next);\n //console.info(lastEnd, nextStart);\n //TODO check reverse path as well and reverse that\n if (last.geometry.type === 'LINE' && next.geometry.type === 'LINE') {\n if (this.pointEquals(lastEnd, nextStart, fractionalDigits)) {\n Array.prototype.push.apply(last.geometry.vectors, next.geometry.vectors);\n //\n this.updateLimit(last.geometry);\n this.updateBounds([last]);\n shapes.splice(idx, 1);\n joined++;\n }\n else {\n last = next;\n idx++;\n }\n }\n }\n return joined;\n }", "function mergeDisjoints()\n{\n var pointNum = 1; //Used for keeping track of pt. Number for merging bases\n var axisVector1; //Used as a vector represenation of different aor's. \n var axisVector2; //Used as a vector represenation of different aor's. \n var newSurfacePoint; //Used to store new Surface Pts being generated in Vector Form\n var m1, b1, m2, b2, x, y; //Used for calculating specifics of merging surfaces\n\n //push first surface onto shapes2 array as we aren't merging the ends\n shapes2.push(shapes[0]);\n\n //iterating through second shape to third to last shape, for merging\n for(var i = 1; i < (shapes.length-2); i+=2)\n {\n var newSurface = [];\n\n //create our axisVector1 - first surface\n axisVector1 = new Vector3([linePoints[pointNum-1][0] - linePoints[pointNum][0], linePoints[pointNum-1][1] - linePoints[pointNum][1], 0]);\n\n //create our axisVector2 - second surface\n axisVector2 = new Vector3([linePoints[pointNum][0] - linePoints[pointNum+1][0], linePoints[pointNum][1] - linePoints[pointNum+1][1], 0]);\n\n //iterating through points of each shape(s)\n for(var j = 0; j<shapes[i].length; j++)\n {\n //first surface workings\n m1 = ( axisVector1.elements[1] / axisVector1.elements[0] );\n b1 = shapes[i][j].elements[1] - ( m1 * shapes[i][j].elements[0] );\n\n //second surface workings\n m2 = ( axisVector2.elements[1] / axisVector2.elements[0] );\n b2 = shapes[i+1][j].elements[1] - ( m2 * shapes[i+1][j].elements[0] );\n\n //intersection calculations\n x = ((b2 - b1) / (m1 - m2))\n y = (((m1*b2)-(m2*b1)) / (m1-m2))\n\n //intersectionVectorCreation\n newSurfacePoint = new Vector3([x,y,shapes[i][j].elements[2]]);\n\n //Once our new surfacePt is generated, push it onto our currently generating Surface array.\n newSurface.push(newSurfacePoint);\n }\n\n //once all pts of a surface are generated, push it onto our shapes2 array\n shapes2.push(newSurface);\n shapes2.push(newSurface);\n\n //increment the spine point number we're working with\n pointNum++;\n }\n\n //push last surface onto shapes2 array as we aren't merging the ends\n shapes2.push(shapes[(shapes.length-1)]);\n}", "function intersectionPolygons(polygon1, polygon2) {\r\n polygon1 = clockwisePolygon(polygon1);\r\n polygon2 = clockwisePolygon(polygon2);\r\n\r\n\r\n var polygon1ExpandedDict = {};\r\n var polygon2ExpandedDict = {};\r\n for (var i = 0; i < polygon1.length; i++) {\r\n var polygon1Line = [polygon1[i], polygon1[(i + 1) % polygon1.length]];\r\n polygon1ExpandedDict[i] = [cloneObject(polygon1[i])];\r\n for (var j = 0; j < polygon2.length; j++) {\r\n if (i == 0)\r\n polygon2ExpandedDict[j] = [cloneObject(polygon2[j])];\r\n\r\n var polygon2Line = [polygon2[j], polygon2[(j + 1) % polygon2.length]];\r\n var intersectionResult = intersectionLines(polygon1Line, polygon2Line);\r\n \r\n\r\n if (intersectionResult.onLine1 && intersectionResult.onLine2) {\r\n if (pointsEqual(intersectionResult, polygon1[i])) {\r\n polygon1ExpandedDict[i][0].isCrossPoint = true;\r\n polygon1ExpandedDict[i][0].isOriginalPoint = true;\r\n polygon1ExpandedDict[i][0].crossingLine = polygon2Line;\r\n } else if (pointsEqual(intersectionResult, polygon1[(i + 1) % polygon1.length])) {\r\n \r\n } else {\r\n var newPolygon1Point = cloneObject(intersectionResult);\r\n newPolygon1Point.isCrossPoint = true;\r\n newPolygon1Point.crossingLine = polygon2Line;\r\n newPolygon1Point.distanceFromPreviousPoint = pointsDistance(polygon1[i], newPolygon1Point);\r\n var lastIndex = polygon1ExpandedDict[i].length - 1;\r\n while (polygon1ExpandedDict[i][lastIndex].distanceFromPreviousPoint && polygon1ExpandedDict[i][lastIndex].distanceFromPreviousPoint > newPolygon1Point.distanceFromPreviousPoint) {\r\n lastIndex--; // maybe current polygon1Line will be intersected in many places,\r\n // when intersection points are added to polygon1Expanded, they need to be properly sorted\r\n }\r\n if (!pointsEqual(polygon1ExpandedDict[i][lastIndex], newPolygon1Point) && !pointsEqual(polygon1ExpandedDict[i][lastIndex + 1], newPolygon1Point)) {\r\n polygon1ExpandedDict[i].splice(lastIndex + 1, 0, newPolygon1Point);\r\n }\r\n }\r\n\r\n if (pointsEqual(intersectionResult, polygon2[j])) {\r\n polygon2ExpandedDict[j][0].isCrossPoint = true;\r\n polygon2ExpandedDict[j][0].isOriginalPoint = true;\r\n polygon2ExpandedDict[j][0].crossingLine = polygon1Line;\r\n } else if (pointsEqual(intersectionResult, polygon2[(j + 1) % polygon2.length])) {\r\n\r\n } else {\r\n var newPolygon2Point = cloneObject(intersectionResult);\r\n newPolygon2Point.isCrossPoint = true;\r\n newPolygon2Point.crossingLine = polygon1Line;\r\n newPolygon2Point.distanceFromPreviousPoint = pointsDistance(polygon2[j], newPolygon2Point);\r\n lastIndex = polygon2ExpandedDict[j].length - 1;\r\n while (polygon2ExpandedDict[j][lastIndex].distanceFromPreviousPoint && polygon2ExpandedDict[j][lastIndex].distanceFromPreviousPoint > newPolygon2Point.distanceFromPreviousPoint) {\r\n lastIndex--;\r\n }\r\n if (!pointsEqual(polygon2ExpandedDict[j][lastIndex], newPolygon2Point) && !pointsEqual(polygon2ExpandedDict[j][lastIndex+1], newPolygon2Point)) {\r\n polygon2ExpandedDict[j].splice(lastIndex + 1, 0, newPolygon2Point);\r\n }\r\n \r\n }\r\n }\r\n }\r\n }\r\n \r\n\r\n var polygon1Expanded = [];\r\n for (i = 0; i < polygon1.length; i++) {\r\n for (j = 0; j < polygon1ExpandedDict[i].length; j++) {\r\n var polygon1ExpandedPoint = polygon1ExpandedDict[i][j];\r\n polygon1Expanded.push(polygon1ExpandedPoint);\r\n }\r\n }\r\n\r\n var polygon2Expanded = [];\r\n var startingPoint = null;\r\n var currentPolygon = null;\r\n var otherPolygon = null;\r\n var currentIndex = null;\r\n var currentPoint = null;\r\n \r\n var polygon2ExpandedIndex = null;\r\n var index = 0;\r\n for (i = 0; i < polygon2.length; i++) {\r\n for (j = 0; j < polygon2ExpandedDict[i].length; j++) {\r\n var polygon2ExpandedPoint = polygon2ExpandedDict[i][j];\r\n polygon2Expanded.push(polygon2ExpandedPoint);\r\n \r\n if (startingPoint == null && polygon2ExpandedPoint.isCrossPoint) {\r\n startingPoint = polygon2ExpandedPoint;\r\n polygon2ExpandedIndex = index;\r\n }\r\n index++;\r\n }\r\n }\r\n \r\n\r\n if (startingPoint == null) {\r\n // either polygons are separated, or one contains another <==> polygons' lines never intersect one another\r\n var isPolygon2WithinPolygon1 = isPointInsidePolygon(polygon2[0], polygon1);\r\n if (isPolygon2WithinPolygon1) {\r\n startingPoint = polygon2Expanded[0];\r\n currentPolygon = polygon2Expanded;\r\n otherPolygon = polygon1Expanded;\r\n currentIndex = 0;\r\n } else {\r\n var isPolygon1WithinPolygon2 = isPointInsidePolygon(polygon1[0], polygon2);\r\n if (isPolygon1WithinPolygon2) {\r\n startingPoint = polygon1Expanded[0];\r\n currentPolygon = polygon1Expanded;\r\n otherPolygon = polygon2Expanded;\r\n currentIndex = 0;\r\n } else {\r\n // these two polygons are completely separated\r\n return [];\r\n }\r\n }\r\n } else {\r\n currentPolygon = polygon2Expanded;\r\n otherPolygon = polygon1Expanded;\r\n currentIndex = polygon2ExpandedIndex;\r\n }\r\n\r\n var intersectingPolygon = [startingPoint];\r\n \r\n var switchPolygons = false;\r\n if (startingPoint.isCrossPoint) {\r\n var pointJustAfterStartingPoint = justAfterPointOfACrossPoint(currentIndex, currentPolygon);\r\n if (isPointInsidePolygon(pointJustAfterStartingPoint, otherPolygon)) {\r\n switchPolygons = false;\r\n } else {\r\n switchPolygons = true;\r\n }\r\n } else {\r\n switchPolygons = false;\r\n }\r\n\r\n if (switchPolygons) {\r\n var temp = currentPolygon;\r\n currentPolygon = otherPolygon;\r\n otherPolygon = temp;\r\n\r\n currentIndex = indexElementMatchingFunction(currentPolygon, function (point) {\r\n return pointsEqual(startingPoint, point);\r\n });\r\n } \r\n \r\n currentPoint = currentPolygon[(currentIndex + 1) % currentPolygon.length];;\r\n currentIndex = (currentIndex + 1) % currentPolygon.length;\r\n\r\n \r\n while (!pointsEqual(currentPoint, startingPoint)) {\r\n intersectingPolygon.push(currentPoint);\r\n if (currentPoint.isCrossPoint) {\r\n if (currentPoint.crossingLine && currentPoint.isOriginalPoint) {\r\n var pointJustBeforeCurrent = justBeforePointOfACrossPoint(currentIndex, currentPolygon);\r\n var pointJustAfterCurrent = justAfterPointOfACrossPoint(currentIndex, currentPolygon);\r\n\r\n var isBeforeLeft = isPointLeftOfLine(pointJustBeforeCurrent, currentPoint.crossingLine);\r\n var isAfterLeft = isPointLeftOfLine(pointJustAfterCurrent, currentPoint.crossingLine);\r\n if (isBeforeLeft == isAfterLeft) {\r\n // do not switch to different polygon\r\n } else {\r\n var temp = currentPolygon;\r\n currentPolygon = otherPolygon;\r\n otherPolygon = temp;\r\n }\r\n } else {\r\n var temp = currentPolygon;\r\n currentPolygon = otherPolygon;\r\n otherPolygon = temp;\r\n }\r\n\r\n currentIndex = indexElementMatchingFunction(currentPolygon, function(point) {\r\n return pointsEqual(currentPoint, point);\r\n });\r\n } \r\n\r\n currentIndex = (currentIndex + 1) % currentPolygon.length;\r\n currentPoint = currentPolygon[currentIndex];\r\n }\r\n\r\n return intersectingPolygon;\r\n}", "findEdgesToPushCatmullClarkPolygones(facePoint, polygoneEdges, polygoneEdge1, vertex)\n { \n // Vertex point d'un des vertice appartenant au polygoneEdge1 \n var vertexPoint = vertex.vertexPoint;\n \n // Parcout de toute les edges du polygone\n // pour recherche l'autre edge ayant en commun le meme point 'vertex'\n for(var i = 0; i < polygoneEdges.length; ++i)\n {\n var polygoneEdge2 = polygoneEdges[i];\n \n // Test pour voir s'il ne s'agit pas de la meme edge\n if(polygoneEdge1.id != polygoneEdge2.id)\n //if(polygoneEdge1 !== polygoneEdge2)\n {\n // Test pour voir si les edges ont bien 'vertex' en commun dans les vertice les composant\n if((vertex.id == polygoneEdge2.v1.id) || (vertex.id == polygoneEdge2.v2.id))\n //if((vertex === polygoneEdge2.v1) || (vertex === polygoneEdge2.v2))\n { \n // Edge point 1 et 2\n var edgePoint1 = polygoneEdge1.edgePoint;\n var edgePoint2 = polygoneEdge2.edgePoint;\n\n // Le polygone est forcement dans cet ordre de point ()\n var edge1 = this.findEdge(facePoint, edgePoint1);\n var edge2 = this.findEdge(edgePoint1, vertexPoint);\n var edge3 = this.findEdge(vertexPoint, edgePoint2);\n var edge4 = this.findEdge(edgePoint2, facePoint);\n\n // Test pour voir si on a bien récupérer toutes les edges\n if((edge1 != null) && (edge2 != null) && (edge3 != null) && (edge4 != null))\n {\n // Test pour voir si un polygone composé des 4 edges n'existe pas deja\n if(this.hasPolygone([edge1, edge2, edge3, edge4]) == false)\n {\n // Ajout du nouveau polygone dans la liste des polygones\n var newPolygone = new Polygone();\n newPolygone.setEdges([edge1, edge2, edge3, edge4]);\n this.pushCatmullClarkPolygone(newPolygone);\n }\n break;\n }\n }\n }\n }\n }", "function getSightPolygon(point, walls) {\n\n // Sight X & Sight Y\n var sightX = point.x;\n var sightY = point.y;\n\n // Get all unique points\n var points = (function (segments) {\n var a = [];\n segments.forEach(function (seg) {\n a.push(\n {x: seg.ax, y: seg.ay},\n {x: seg.bx, y: seg.by}\n );\n });\n return a;\n })(walls);\n var uniquePoints = (function (points) {\n var set = {};\n return points.filter(function (p) {\n var key = p.x + \",\" + p.y;\n if (key in set) {\n return false;\n } else {\n set[key] = true;\n return true;\n }\n });\n })(points);\n\n // Get all angles\n var uniqueAngles = [];\n for (var j = 0; j < uniquePoints.length; j++) {\n var uniquePoint = uniquePoints[j];\n var angle = Math.atan2(uniquePoint.y - sightY, uniquePoint.x - sightX);\n uniquePoint.angle = angle;\n\n // Actually make the angles unique!\n if (uniqueAngles.indexOf(angle) == -1) {\n uniqueAngles.push(angle - 0.00001, angle, angle + 0.00001);\n }\n\n }\n\n // RAYS IN ALL DIRECTIONS\n var intersects = [];\n for (var j = 0; j < uniqueAngles.length; j++) {\n var angle = uniqueAngles[j];\n\n // Calculate dx & dy from angle\n var dx = Math.cos(angle);\n var dy = Math.sin(angle);\n\n // Ray to that angle\n var ray = {\n a: {x: sightX, y: sightY},\n b: {x: sightX + dx, y: sightY + dy}\n };\n\n // Find CLOSEST intersection\n var closestIntersect = null;\n for (var i = 0; i < walls.length; i++) {\n var intersect = getIntersection(ray, walls[i]);\n if (!intersect) continue;\n if (!closestIntersect || intersect.param < closestIntersect.param) {\n closestIntersect = intersect;\n }\n }\n\n // Intersect angle\n if (!closestIntersect) continue;\n closestIntersect.angle = angle;\n\n // Add to list of intersects\n intersects.push(closestIntersect);\n\n }\n\n // Sort intersects by angle\n intersects = intersects.sort(function (a, b) {\n return a.angle - b.angle;\n });\n\n // Polygon is intersects, in order of angle\n return intersects;\n\n}", "nextPolygon(id) {\n var polyset = [];\n let finalPolygon = [];\n let polygon = this.props.items.map((item, index) => {\n var s;\n if(item.featureType==\"MULTI_POLYGON\" || item.featureType==\"POLYGON\") {\n if(item.parent.id == id) {\n let allPos = [];\n //Parse the coordinates to JSON\n allPos.push(JSON.parse(item.coordinates))\n //Need to give the coordinates a latlng\n polyset = allPos.map( coords =>{\n return coords.map( coords2 => {\n return coords2.map( coords3 =>{\n return coords3.map( finalCoord =>{\n return {\n //The order is switched, so lat is position 1 and lng 2\n lat: finalCoord[1],\n lng: finalCoord[0]\n }\n })\n })\n })\n })\n\n finalPolygon.push({\n path: polyset,\n info: item\n })\n }\n }\n });\n //Code for markers\n if(finalPolygon.length == 0) {\n this.getMarker(id);\n //Call a method to set the polyState to only the polygon last clicked\n this.getOnePolygon(id);\n } else {\n this.setPolyState(finalPolygon);\n }\n }", "function Shape2D_computeAsPolygon(){\n\tvar points = [];\n\tvar cw = !this.isAnticlockwise;\n\tfor( var ss = this.segments, sl = this.segments.length, i = 0; i < sl; i ++ ){\n\t\tvar s = ss[i];\n\t\tif( s.typeofshape == 'line' ) {\n\t\t\tpoints.push( s.p1 );\n\t\t} else if( s.typeofshape == 'arc' ) {\n\t\t\t//break arcs on quadrants to provide accurate bounding box dimensions \n\t\t\tvar qauds = s.quadrants;\n\t\t\tvar arcs = qauds.length > 0 ? s.breakAt( qauds ) : [s];\n\t\t\tfor( var j = 0; j < arcs.length; j ++ ) {\n\t\t\t\tvar arc = arcs[j];\n\t\t\t\tvar convex;\n\t\t\t\tif( cross3( arc.p1, arc.midPoint, arc.p2 ) > 0 ){\n\t\t\t\t\tconvex = cw;\n\t\t\t\t} else {\n\t\t\t\t\tconvex = !cw;\n\t\t\t\t}\n\t\t\t\t//console.log( \"CONVEX\", convex );\n\t\t\t\tpoints.push( arc.p1 );\n\t\t\t\tif(!convex) {\n\t\t\t\t\tpoints.push( arc.midPoint );\n\t\t\t\t} else {\n\t\t\t\t\tvar ray1 = new Ray( arc.p1, arc.v1 );\n\t\t\t\t\tvar ray2 = new Ray( arc.p2, arc.v2.scale(-1) );\n\t\t\t\t\tvar p = ray1.intersection( ray2 ).both[0];\n\t\t\t\t\t\n\t\t\t\t\tpoints.push( p );\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error('Unsported shape type');\n\t\t}\n\t}\n\treturn points;\n}", "function intersectionsWithPolygon(usedroute){\r\n intersections.push(0) //the first and the last index of the route must be contained in the array in order to be able to calculate the lengths of the sections. \r\n for (let i = 0; i < positionToPolygon.length; i++){\r\n if (!positionToPolygon[i] && positionToPolygon[i+1] || positionToPolygon[i] && !positionToPolygon[i+1]){\r\n intersections.push(i); \r\n }\r\n}\r\n intersections.push(usedroute.length-1);\r\n return intersections;\r\n}", "function findSplitOrErasePolygon(event, operation) {\r\n var splitOrErasePolygon = [];\r\n var layerChildren = project.activeLayer.children;\r\n for (var i = 0; i < layerChildren.length; i++) {\r\n if (layerChildren[i].className == \"Path\" && layerChildren[i].strokeColor != null) {\r\n if (layerChildren[i].strokeColor.equals(colorTextLine)) {\r\n if (layerChildren[i].contains(event.point)) {\r\n for (var j = 0; j < layerChildren[i].segments.length; j++) {\r\n var xTmp = Math.round((layerChildren[i].segments[j].point.x - raster.bounds.x) / zoom);\r\n var yTmp = Math.round((layerChildren[i].segments[j].point.y - raster.bounds.y) / zoom);\r\n splitOrErasePolygon.push({\r\n x: xTmp,\r\n y: yTmp\r\n });\r\n }\r\n if (operation == \"split\")\r\n currentSplitPolygon = layerChildren[i];\r\n else\r\n currentErasePolygon = layerChildren[i];\r\n return splitOrErasePolygon;\r\n }\r\n }\r\n }\r\n }\r\n }", "function clipPolygon(segments, compareIntersection, startInside, interpolate, stream) {\n\t var subject = [],\n\t clip = [],\n\t i,\n\t n;\n\t\n\t segments.forEach(function(segment) {\n\t if ((n = segment.length - 1) <= 0) return;\n\t var n, p0 = segment[0], p1 = segment[n], x;\n\t\n\t // If the first and last points of a segment are coincident, then treat as a\n\t // closed ring. TODO if all rings are closed, then the winding order of the\n\t // exterior ring should be checked.\n\t if (pointEqual(p0, p1)) {\n\t stream.lineStart();\n\t for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n\t stream.lineEnd();\n\t return;\n\t }\n\t\n\t subject.push(x = new Intersection(p0, segment, null, true));\n\t clip.push(x.o = new Intersection(p0, null, x, false));\n\t subject.push(x = new Intersection(p1, segment, null, false));\n\t clip.push(x.o = new Intersection(p1, null, x, true));\n\t });\n\t\n\t if (!subject.length) return;\n\t\n\t clip.sort(compareIntersection);\n\t link$1(subject);\n\t link$1(clip);\n\t\n\t for (i = 0, n = clip.length; i < n; ++i) {\n\t clip[i].e = startInside = !startInside;\n\t }\n\t\n\t var start = subject[0],\n\t points,\n\t point;\n\t\n\t while (1) {\n\t // Find first unvisited intersection.\n\t var current = start,\n\t isSubject = true;\n\t while (current.v) if ((current = current.n) === start) return;\n\t points = current.z;\n\t stream.lineStart();\n\t do {\n\t current.v = current.o.v = true;\n\t if (current.e) {\n\t if (isSubject) {\n\t for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n\t } else {\n\t interpolate(current.x, current.n.x, 1, stream);\n\t }\n\t current = current.n;\n\t } else {\n\t if (isSubject) {\n\t points = current.p.z;\n\t for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n\t } else {\n\t interpolate(current.x, current.p.x, -1, stream);\n\t }\n\t current = current.p;\n\t }\n\t current = current.o;\n\t points = current.z;\n\t isSubject = !isSubject;\n\t } while (!current.v);\n\t stream.lineEnd();\n\t }\n\t }", "function findClosestPoints1(polygonA, polygonB)\n{\n\n}", "allPolygons() {\n let polygons = this.polygons.slice();\n if (this.front)\n polygons = polygons.concat(this.front.allPolygons());\n if (this.back)\n polygons = polygons.concat(this.back.allPolygons());\n return polygons;\n }", "function intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n }", "function checkAvoidAreasIntersectThemselves() {\n\t\t\t//code adapted from http://lists.osgeo.org/pipermail/openlayers-users/2012-March/024285.html\n\t\t\tvar layer = this.theMap.getLayersByName(this.AVOID)[0];\n\t\t\tvar intersect = false;\n\t\t\tfor (var ftNum = 0; ftNum < layer.features.length; ftNum++) {\n\t\t\t\tvar fauxpoint = [];\n\t\t\t\tvar line = [];\n\t\t\t\tvar led = layer.features[ftNum];\n\n\t\t\t\tvar strng = led.geometry.toString();\n\t\t\t\tvar coord = strng.split(',');\n\t\t\t\t// remove the 'Polygon((' from the 1st coord\n\t\t\t\tcoord[0] = coord[0].substr(9);\n\t\t\t\t// Remove the '))' from the last coord\n\t\t\t\tcoord[coord.length - 1] = coord[coord.length - 1].substr(0, coord[coord.length - 1].length - 2);\n\n\t\t\t\t//convert to lines\n\t\t\t\tfor ( i = 0; i < coord.length; i++) {\n\t\t\t\t\tvar lonlat = coord[i].split(' ');\n\t\t\t\t\tfauxpoint.push(new OpenLayers.Geometry.Point(lonlat[0], lonlat[1]));\n\t\t\t\t\tif (i > 0) {\n\t\t\t\t\t\t// create an array with the 2 last points\n\t\t\t\t\t\tvar point = [fauxpoint[i - 1], fauxpoint[i]];\n\t\t\t\t\t\t//create the line\n\t\t\t\t\t\tline.push(new OpenLayers.Geometry.LineString(point));\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Check every line against every line\n\t\t\t\tfor (var i = 1; i < line.length; i++) {\n\t\t\t\t\tfor (var j = 1; j < line.length; j++) {\n\t\t\t\t\t\t// get points of the I line in an array\n\t\t\t\t\t\tvar vi = line[i].getVertices();\n\t\t\t\t\t\t// get points of the J line in an array\n\t\t\t\t\t\tvar vj = line[j].getVertices();\n\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * the lines must be differents and not adjacents.\n\t\t\t\t\t\t * The end or start point of an adjacent line will be intersect,\n\t\t\t\t\t\t * and adjacent lines never intersect in other point than the ends.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (i != j && vi[1].toString() != vj[0].toString() && vi[0].toString() != vj[1].toString()) {\n\t\t\t\t\t\t\t// the intersect check\n\t\t\t\t\t\t\tif (line[i].intersects(line[j])) {\n\t\t\t\t\t\t\t\tintersect = true;\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\treturn intersect;\n\t\t}", "function getEdgesAndPolygons(j, e, p)\n\t{\n\t\tvar k, kStart;\n\t\t\n\t\tk = j.edgeAroundVertex;\n\t\tkStart = j.edgeAroundVertex;\n\t\t\n\t\tif (e != null)\n\t\t\te[e.length] = k;\n\t\t\n\t\tvar bFinished = false;\n\t\t\n\t\twhile (bFinished == false)\n\t\t{\n\t\t\tif (j == k.startVertex)\n\t\t\t{\n\t\t\t\tif (p != null)\n\t\t\t\t\tp[p.length] = k.leftPolygon;\n\t\t\t\t\n\t\t\t\tk = k.ccwPredecessor;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (p != null) \n\t\t\t\t\tp[p.length] = k.rightPolygon;\n\t\t\t\t\n\t\t\t\tk = k.ccwSuccessor;\n\t\t\t}\n\t\t\t\n\t\t\tif (k == kStart)\n\t\t\t{\n\t\t\t\tbFinished = true;\n\t\t\t}\n\t\t\telse\n\t\t\t\tif (e != null)\n\t\t\t\t\te[e.length] = k;\n\t\t}\n\t}", "allPolygons() {\r\n let polygons = this.polygons.slice();\r\n if (this.front) {\r\n polygons = polygons.concat(this.front.allPolygons());\r\n }\r\n if (this.back) {\r\n polygons = polygons.concat(this.back.allPolygons());\r\n }\r\n return polygons;\r\n }", "function polygonal_surface_intersection()\n{\n //TODO\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function prints the dice number in the dice box.
function printNumber(number) { var diceNumber = document.getElementById('diceNumber'); // Declares variable for the dice box. diceNumber.innerHTML = number; // Returns the dice number in the dice box. }
[ "function printNumber() {\n return dice.roll();\n}", "function rollDice(){\n var num = Math.floor((Math.random() * 6) + 1);\n document.getElementById('dice').innerHTML = num;\n}", "function rollDice(){\n\t\n\t\t// clear any previous message\n\t\tdocument.getElementById('results').innerHTML = \"\";\n\t\t\n\t\t// invoke PairOfDice using global constant variable for number of sides.\n\t\tvar theDice = new PairOfDice(SIDES_OF_DICE);\t// creates two Die objects.\n\t\t\n\t\t// assign values to Die objects\n\t\ttheDice.roll();\n\t\t\n\t\tdocument.getElementById('die1Value').innerHTML = theDice.Die1.value;\n\t\tdocument.getElementById('die2Value').innerHTML = theDice.Die2.value;\n\t\t\n\t\tvar sum = theDice.getSum();\n\t\t\n\t\t// messages to user for special dice rolls\n\t\tif(sum === 7){\n\t\t\n\t\t\tdocument.getElementById('results').innerHTML = \"Craps!\";\n\t\t\t\n\t\t}else if( sum === 2){\n\t\t\t\t\t\n\t\t\tdocument.getElementById('results').innerHTML = \"Snake Eyes!\";\n\t\t\t\t\n\t\t}else if( sum === 12){\n\t\t\t\n\t\t\tdocument.getElementById('results').innerHTML = \"Box Cars!\";\n\t\t\t\t\n\t\t}// else do nothing.\t\n\t}", "function drawDice() {\n for (var i = 0; i < dice.length; i++) {\n drawOneDie(dice[i]);\n }\n}", "function roll(dice) {\n console.log(rollDice(parseDice(dice)));\n}", "function computerDiceDisplay() {\n //Roll the dice\n generateRandom();\n\n //Store global dice variables into new unique variables\n compd1 = d1;\n compd2 = d2;\n compDiceTotal = diceTotal;\n\n //Display the player's dice numbers and their total on the page\n updateIcons(compIcon1, compIcon2, compd1, compd2);\n compStatus.innerText = 'The computer rolled ' + compDiceTotal + '. ';\n}", "function rollDice (sides = 20, bonus = 0, numOfDice = 1, message = 'Rolled') {\n var placeholder = document.getElementById('dieresult');\n var number = dice.roll(sides, bonus, numOfDice);\n placeholder.innerHTML = `${message} ${numOfDice}d${sides} + ${bonus}: ${number}`;\n}", "function getDiceText()\n{\n\tvar dicetext = \"\";\n\tvar dicearray = new Array();\n\tfor(var i = 0; i < CurrentDiceGroup.dicegroup.length; i++)\n\t{\t\t\n\t\tvar s = CurrentDiceGroup.dicegroup[i].sides;\t\t\n\n\t\tif(dicearray[s] == 'undefined' || dicearray[s] == null)\n\t\t{\n\t\t\tdicearray[s] = 0;\n\t\t}\n\n\t\tdicearray[s] += 1;\n\t}\n\n\tfor(var sides = 0; sides < dicearray.length; sides++)\n\t{\n\t\tif(dicearray[sides] != 'undefined' && dicearray[sides] != null)\n\t\t{\n\t\t\tdicetext += (dicearray[sides] == 1) ? \"\" : dicearray[sides];\n\t\t\tdicetext += 'D'+sides+',';\n\t\t}\t\n\t}\t\n\tdicetext = dicetext.replace(/,\\s*$/,\"\");\n\treturn dicetext;\n\n}", "function playerDiceDisplay() {\n //Roll the dice\n generateRandom();\n\n //Store the global dice variables into new unique variables\n playerd1 = d1;\n playerd2 = d2;\n playerDiceTotal = diceTotal;\n\n //Display the player's dice numbers and their total on the page\n updateIcons(playerIcon1, playerIcon2, playerd1, playerd2);\n playerStatus.innerText = 'You rolled ' + playerDiceTotal + '. ';\n}", "function displayDice(diceID, diceFace) {\n console.log(getTimeAndDate() + 'DEBUG displayDice(diceID=' + \n diceID + ', face=' + diceFace + ')');\n \n // reference to the first or second dice image in the DOM\n var diceDOM;\n \n diceDOM = document.getElementById('dice-' + diceID);\n diceDOM.style.display = 'block';\n diceDOM.src = '../img/dice/dice-' + diceFace + '.png';\n}", "function rollDice() {\n let dice = Math.floor(Math.random() * 6 + 1);\n console.log('dice roll: ', dice)\n changeDisplayedDice(dice);\n changeRoundScore(dice);\n}", "function rollDice() {\n\t// generate random number\n\tcurrentDice = Math.trunc(Math.random() * 6) + 1\n\n\t// display a dice with the random number\n\tdiceImage.src = `./resources/${currentDice}.png`\n\n\t// check if the currentDice !== 1\n\tif (currentDice !== 1) {\n\t\t// add the currentDice value to the current points\n\t\tholdScore += currentDice\n\n\t\t// updating the current points on display\n\t\tsection.forEach((sec, i) => {\n\t\t\tif (sec.classList.contains('active'))\n\t\t\t\tcurrentScore[i].textContent = holdScore\n\t\t})\n\t} else {\n\t\t// Case the currentDice === 1, the current points will be lost\n\t\tholdScore = 0\n\n\t\t// updating current point values on the display\n\t\tsection.forEach((sec, i) => {\n\t\t\tsec.classList.toggle('active')\n\t\t\tcurrentScore[i].textContent = holdScore\n\t\t})\n\t}\n}", "function roll(){\n var n = roll_dice(dice);\n result += \"\\nd\" + dice + \" = \" + n\n return n\n }", "function displayDiceRolls(player, playerDiceRoll) {\r\n\tconsole.log(player[1],\" rolls \", playerDiceRoll[1]);\r\n\tconsole.log(player[2],\" rolls \", playerDiceRoll[2]);\r\n}", "function diceToString(dice){\n\tswitch(dice){\n\t\tcase 1: return \"one\";\n\t\tcase 2: return \"two\";\n\t\tcase 3: return \"three\";\n\t\tcase 4: return \"four\";\n\t\tcase 5: return \"five\";\n\t\tcase 6: return \"six\";\n\t}\n}", "diceRoll(id, roll) {\n let dice = Math.ceil(Math.random() * (roll));\n document.getElementById(id).value = dice;\n }", "function Dices() {\n let diceRoll = [\" \", \" \"];\n let outCome = [0, 0];\n for (let roll = 0; roll < 2; roll++) {\n outCome[roll] = Math.floor((Math.random() * 6) + 1);\n switch (outCome[roll]) {\n case checkRange(outCome[roll], 1, 1):\n diceRoll[roll] = \"1\";\n one++;\n break;\n case checkRange(outCome[roll], 2, 2):\n diceRoll[roll] = \"2\";\n two++;\n break;\n case checkRange(outCome[roll], 3, 3):\n diceRoll[roll] = \"3\";\n three++;\n break;\n case checkRange(outCome[roll], 4, 4):\n diceRoll[roll] = \"4\";\n one++;\n four;\n case checkRange(outCome[roll], 5, 5):\n diceRoll[roll] = \"5\";\n five++;\n break;\n case checkRange(outCome[roll], 6, 6):\n diceRoll[roll] = \"6\";\n six++;\n break;\n }\n }\n return diceRoll;\n }", "function drawDiceButton() {\n fill(210, 210, 210);\n if (diceButtonSelected()) {\n fill(230, 230, 230);\n }\n rect(wt * 0.01, ht * 0.90, wt * 0.15, ht * 0.09);\n\n textAlign(CENTER);\n fill(0, 0, 0);\n textSize(wt * 0.04);\n text(\"Roll\", wt * 0.08, ht * 0.94);\n text(\"Dice\", wt * 0.08, ht * 0.98);\n}", "function myDice () {\n console.log(Math.floor(Math.random()*6)+1);\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes all "active" themes. Any charts created subsequently will not have any theme applied to them.
function unuseAllThemes() { _Registry__WEBPACK_IMPORTED_MODULE_1__["registry"].themes = []; }
[ "function unuseAllThemes() {\n _Registry.registry.themes = [];\n}", "function unuseAllThemes() {\n registry.themes = [];\n}", "function unuseAllThemes() {\n _Registry__WEBPACK_IMPORTED_MODULE_1__[\"registry\"].themes = [];\n }", "function unuseAllThemes() {\r\n _Registry__WEBPACK_IMPORTED_MODULE_1__.registry.themes = [];\r\n}", "function unuseAllThemes() {\r\n _Registry__WEBPACK_IMPORTED_MODULE_1__[\"registry\"].themes = [];\r\n}", "__clearTheme() {\n const styleElement = document.getElementById(this.constructor.__fullId(this.__id) + \"_Styles\");\n if (styleElement) styleElement.parentElement.removeChild(styleElement);\n }", "function cleanThemes() {\n quill.root.classList.remove('christmasTheme')\n quill.root.classList.remove('halloweenTheme')\n quill.root.classList.remove('defaultTheme')\n quill.root.classList.remove('birthdayTheme')\n}", "function removeCurrentTheme() {\n var head = document.getElementsByTagName('head')[0];\n var nodes = head.childNodes;\n var list = [];\n for (var ix = 0; ix < nodes.length; ix++) {\n var node = nodes.item(ix);\n if (node.href && node.href.indexOf('bootstrap') > -1) {\n list.push(node);\n }\n }\n list.forEach(function (node) {\n head.removeChild(node);\n });\n}", "function clearStyles() {\n _themeState.registeredStyles.forEach(function (styleRecord) {\n var styleElement = styleRecord && styleRecord.styleElement;\n if (styleElement && styleElement.parentElement) {\n styleElement.parentElement.removeChild(styleElement);\n }\n });\n _themeState.registeredStyles = [];\n}", "function resetThemeColors() {\n browser.storage.local.remove(THEME_COLOR_KEYS);\n}", "activateDefaultTheme() {\n this._reset();\n }", "function removeThemeClasses(){\r\n $('body').removeClass(function(index, cssName) {\r\n return(cssName.match(/\\btheme-\\S+/g) || []).join(' ');\r\n });\r\n}", "function clear(cmd) {\n alloyCfg.global.theme = \"\";\n console.log(chalk.yellow(\"\\nClearing theme in config.json\\n\"));\n }", "function unuseTheme(value) {\n $array.remove(_Registry.registry.themes, value);\n}", "function clear() {\n weavy.ajax(\"client/theme\", null, \"DELETE\").then(function () {\n });\n }", "function unuseTheme(value) {\n _Array__WEBPACK_IMPORTED_MODULE_13__[\"remove\"](_Registry__WEBPACK_IMPORTED_MODULE_1__[\"registry\"].themes, value);\n}", "function unuseTheme(value) {\r\n _Array__WEBPACK_IMPORTED_MODULE_12__[\"remove\"](_Registry__WEBPACK_IMPORTED_MODULE_1__[\"registry\"].themes, value);\r\n}", "function unuseTheme(value) {\n remove(registry.themes, value);\n}", "function deActivedChartList() {\n var total = activedChartList.length;\n for (var index=0; index<total; index++) {\n var chart = activedChartList.pop();\n chart.removeClass('actived');\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given the current step and the timestamp of the log, draw the timestamp above the client field.
function draw_timestamp(step, t) { svg.append('text') .text(t) .attr('x', get_text_x(step)) .attr('y', 55) .attr('font-family', 'sans-serif') .attr('font-size', '18') .attr('text-anchor', 'middle'); }
[ "function paintPrevious() {\n\tif (parseInt(cur_time) - step > 0) {\n\t cur_time = parseInt(cur_time) - step;\n\t\tcur_real_time = time_map[cur_time];\n\t\tconsole.log(\"current time id: \" + \n\t\t\tcur_time.toString() + \n\t\t\t\"\\ncurrent real time: \" +\n\t\t\tcur_real_time.toString());\n\t\tpaintWithTimeId(cur_time);\n\t}\n}", "getLogStamp() {\r\n const date = new Date();\r\n return `[${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()} ${this.name}:${this.serial}]`;\r\n }", "function printTimestamp() {\n\t/* create a date with the current date/time with the current format:\n\t * dd/mm/yyyy, hh:mm:ss */\n\tlet l_timestamp_s = new Date().toLocaleString(\"en-GB\");\n\t/* change it to the following format: dd/mm/yyyy-hh:mm:ss */\n\tl_timestamp_s = l_timestamp_s.replace(\", \", \"-\");\n\n\tconsoleLogColor(\"[\" + l_timestamp_s + \"]\", \"magenta\");\n}", "traceDrift() {\n\t\tconst diff = Date.now() - this.start;\n\t\tconst drift = diff / this.delayMs - this.counter;\n\t\tconsole.debug('Seconds: ' + Math.round(diff / 1000) + ', counter: ' + this.counter + ', drift: ' + drift);\n\t}", "initCurrentTimeLine() {\n const me = this,\n now = new Date();\n\n if (me.currentTimeLine || !me.showCurrentTimeLine) {\n return;\n }\n\n me.currentTimeLine = new me.store.modelClass({\n // eslint-disable-next-line quote-props\n 'id': 'currentTime',\n cls: 'b-sch-current-time',\n startDate: now,\n name: DateHelper.format(now, me.currentDateFormat)\n });\n me.updateCurrentTimeLine = me.updateCurrentTimeLine.bind(me);\n me.currentTimeInterval = me.setInterval(me.updateCurrentTimeLine, me.updateCurrentTimeLineInterval);\n\n if (me.client.isPainted) {\n me.renderRanges();\n }\n }", "shiftView() {\n const stime = (configRepo.get(currentConfig).scenarioStartTime);\n const levent = scenarioRepo.getLastEventOf(currentScenario);\n const etime = levent == null ? stime : stime + levent.pointInTime;\n this.line.setWindow(stime, etime, null, function () {\n timeline.line.zoomOut(0.3)\n });\n }", "function StepOffset() {\n\tvar timeDelta = cg.time - cg.stepTime;\n\tif (timeDelta < STEP_TIME) {\n\t\tcg.refdef.vieworg[2] -= cg.stepChange * (STEP_TIME - timeDelta) / STEP_TIME;\n\t}\n}", "function timestamp(ptr) {\n\tif (!Telko.logtime) { return ptr + \" \"; }\n\tvar time = new Date();\n\treturn\ttime.getFullYear()\t\t\t\t+ \"/\" +\n\t\t\tpad0(time.getMonth() + 1)\t\t+ \"/\" +\n\t\t\tpad0(time.getDate())\t\t\t+ \" \" +\t\t \n\t\t\tpad0(time.getHours())\t\t\t+ \":\" +\n\t\t\tpad0(time.getMinutes())\t\t\t+ \":\" +\n\t\t\tpad0(time.getSeconds())\t\t\t+ \".\" +\n\t\t\tpad0(time.getMilliseconds(), 3)\t+ \" \" +\n\t\t\tptr + \" \";\n}", "_renderCardTimestamp() {\n if (this.card_timestamp && this.timestampLayer) {\n this.timestampLayer.innerHTML = localDatetime(new Date().toISOString())\n }\n }", "enterCurrentTimestamp(ctx) {\n\t}", "enterTimestamp(ctx) {\n\t}", "draw_trail(buffer) {\n buffer.stroke(0);\n\n // frameCount is anothe builtin attribute that keeps track of frames.\n // Drawing from the second frame ensures that no artifacts are drawn.\n if (frameCount > 2) {\n // Draws a line on the buffer screen from the previous position to the current position\n // which acts like a trail.\n buffer.line(\n this.previous_position.x,\n this.previous_position.y,\n this.position.x,\n this.position.y\n );\n }\n this.previous_position.x = this.position.x;\n this.previous_position.y = this.position.y;\n }", "function getTimeStepOnIndex(currentTime, timeStep) {\n\tvar minutes = currentTime.getMinutes() + currentTime.getHours() * 60;\n\tminutes += timeStep * TIME_STEP_MINUTES;\n\n\t// 1440 minutes in a day (capping the minutes to normal values)\n\tif(minutes < 0 || minutes > 1440)\n\t\tminutes += (minutes < 0) ? 1440 : -1440;\n\n\t// Convert the left over minutes to hours\n\tvar hours = (minutes - currentTime.getMinutes() % TIME_STEP_MINUTES) / 60; \n\n\t// Set the minutes on 00 or 30 depending on the closest value to the current minutes\n\tminutes = hours % 1 == 0 ? \"00\" : \"30\";\n\thours = Math.floor(hours);\n\n\t// Return the hours and minutes\n\treturn hours + \":\" + minutes;\n}", "function update() {\n timeLine.time(window.pageYOffset + triggerOffset);\n }", "stamp(){\n var cur = (new Date()).valueOf(); \n if( 0 == this.run_time_last_ ){\n this.run_time_accu_ = 0 ;\n }else{\n this.run_time_accu_ += cur - this.run_time_last_;\n }\n this.run_time_last_ = cur;\n }", "function drawTime(i, color, original_max, starting_point, s_dist) {\n\tstroke(color);\n\tstrokeWeight(5);\n \tline(starting_point, (i+1)*s_dist, starting_point+100, (i+1)*s_dist);\n}", "function draw_timestamp(date) {\r\n fill(255);\r\n textSize(20);\r\n textAlign(RIGHT, CENTER);\r\n\r\n text(time_string(date, false, true), width - 15, 40 / 2);\r\n}", "getTimestampDiv() {\n const { ticket } = this.props;\n\n const timestamp = ticket.leaveTimestamp ? ticket.leaveTimestamp : ticket.enterTimestamp;\n return (\n <div className=\"ticket-timestamp\">\n <T\n id=\"ticket.timestamp\"\n m=\"{timestamp, date, medium} {timestamp, time, medium}\"\n values={{ timestamp: this.props.tsDate(timestamp) }} />\n </div>\n );\n }", "function logCurrentLap () {\n if (timerStartFinishTimestamp && !timerPauseTimestamp) {\n lapContainer.classList.remove('hide');\n var listNode = document.createElement('li');\n listNode.innerHTML = getTimeString(Date.now() - timerStartFinishTimestamp);\n lapLog.appendChild(listNode);\n lapListWrapper.scrollTop = lapListWrapper.scrollHeight;\n };\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Register elements to mediaQueryEvents event.
_registerElements() { const self = this; // Loop al defined breakpoints. Each time browser reaches one of them, // mediaQueryEvents will act and execute the new position of the // elements assigned to this breakpoint. Object.entries(this.opts.breakpoints).map(([k, v]) => { self.$win.on('mq.' + k, function (e) { self._bulkRelocate(k); }); }); }
[ "_listenToMediaQueryChanges() {\n $(window).on('changed.zf.mediaquery', () => {\n this._respondToMediaQuerySize();\n });\n }", "useMediaQuery(mediaQuery) {\n if (typeof mediaQuery !== 'string')\n throw new Error('Media Query must be a string');\n this.currentMediaQuery = mediaQuery;\n if (!this.mediaQueries[mediaQuery])\n return;\n const mqListEvent = {\n matches: true,\n media: mediaQuery,\n };\n this.mediaQueries[mediaQuery].forEach((listener) => {\n listener.call(this.mediaQueryList, mqListEvent);\n });\n }", "addListener(mediaQuery, listener) {\n if (!this.mediaQueries[mediaQuery]) {\n this.mediaQueries[mediaQuery] = [];\n }\n const query = this.mediaQueries[mediaQuery];\n const listenerIndex = query.indexOf(listener);\n if (listenerIndex !== -1)\n return;\n query.push(listener);\n }", "_registerQuery(query) {\n // Only set up a new MediaQueryList if it is not already being listened for.\n if (this._queries.has(query)) {\n return this._queries.get(query);\n }\n const mql = this._mediaMatcher.matchMedia(query);\n // Create callback for match changes and add it is as a listener.\n const queryObservable = new rxjs__WEBPACK_IMPORTED_MODULE_10__.Observable((observer) => {\n // Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed\n // back into the zone because matchMedia is only included in Zone.js by loading the\n // webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not\n // have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js\n // patches it.\n const handler = (e) => this._zone.run(() => observer.next(e));\n mql.addListener(handler);\n return () => {\n mql.removeListener(handler);\n };\n }).pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_11__.startWith)(mql), (0,rxjs_operators__WEBPACK_IMPORTED_MODULE_9__.map)(({ matches }) => ({ query, matches })), (0,rxjs_operators__WEBPACK_IMPORTED_MODULE_12__.takeUntil)(this._destroySubject));\n // Add the MediaQueryList to the set of queries.\n const output = { observable: queryObservable, mql };\n this._queries.set(query, output);\n return output;\n }", "_registerQuery(query) {\n // Only set up a new MediaQueryList if it is not already being listened for.\n if (this._queries.has(query)) {\n return this._queries.get(query);\n }\n const mql = this._mediaMatcher.matchMedia(query);\n // Create callback for match changes and add it is as a listener.\n const queryObservable = new rxjs__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]((observer) => {\n // Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed\n // back into the zone because matchMedia is only included in Zone.js by loading the\n // webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not\n // have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js\n // patches it.\n const handler = (e) => this._zone.run(() => observer.next(e));\n mql.addListener(handler);\n return () => {\n mql.removeListener(handler);\n };\n }).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__[\"startWith\"])(mql), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__[\"map\"])(({ matches }) => ({ query, matches })), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__[\"takeUntil\"])(this._destroySubject));\n // Add the MediaQueryList to the set of queries.\n const output = { observable: queryObservable, mql };\n this._queries.set(query, output);\n return output;\n }", "_registerBreakpoints() {\n const self = this;\n\n self.$win.mediaQueryEvents({\n breakpoints: self.opts.breakpoints\n });\n }", "_installMediaListener() {\n for (let mediaName in this.get('constants.MEDIA')) {\n let query = this.get('constants.MEDIA')[mediaName] || media(mediaName);\n let mediaList = window.matchMedia(query);\n let listenerName = mediaListenerName(mediaName);\n\n // Sets mediaList to a property so removeListener can access it\n this.set(`${listenerName}List`, mediaList);\n\n // Creates a function based on mediaName so that removeListener can remove it.\n this.set(listenerName, Ember.run.bind(this, result => {\n this._mediaDidChange(mediaName, result.matches);\n }));\n\n // Trigger initial grid calculations\n this._mediaDidChange(mediaName, mediaList.matches);\n\n mediaList.addListener(this[listenerName]);\n }\n }", "_installMediaListener() {\n for (let mediaName in this.get('constants.MEDIA')) {\n let query = this.get('constants.MEDIA')[mediaName] || media(mediaName);\n let mediaList = window.matchMedia(query);\n let listenerName = mediaListenerName(mediaName);\n\n // Sets mediaList to a property so removeListener can access it\n this.set(`${listenerName}List`, mediaList);\n\n // Creates a function based on mediaName so that removeListener can remove it.\n this.set(listenerName, bind(this, (result) => {\n this._mediaDidChange(mediaName, result.matches);\n }));\n\n // Trigger initial grid calculations\n this._mediaDidChange(mediaName, mediaList.matches);\n\n mediaList.addListener(this[listenerName]);\n }\n }", "function _mediaQueryList(media) {\n this.media = media;\n this._listeners = [];\n this.matches = this._matches();\n }", "function MediaStreamEventInit() {\n}", "function setEventsForMediaContainer(el) {\n // Check if it's single element and convert it to array\n if (!el.length) {\n var elem = {};\n Array.prototype.push.call(elem, el);\n el = elem;\n }\n\n for (var i=0; el[i] !== undefined; i++) {\n var tap, // true if user tapper on media container\n left_resize = el[i].getElementsByClassName(\"resize-img-left-bot\")[0],\n right_resize = el[i].getElementsByClassName(\"resize-img-right-bot\")[0];\n\n // Check if media container was tapped\n el[i].addEventListener(\"touchstart\", function() { tap = true; }, false);\n el[i].addEventListener(\"touchmove\", function() { tap = false; }, false);\n // Do this only if user tapped on container\n el[i].addEventListener(\"touchend\", function() {\n // Make current item as last_media_item if it's undefined\n !last_media_item ? last_media_item = this : false;\n\n // If it is same item that was tapped, do below\n if (last_media_item === this) {\n tap ? toggleClass(this, \"hover\") : false; // add .hover to current media element\n }\n else {\n // Remove .hover from last used item\n removeClass(last_media_item, \"hover\");\n\n // Add .hover to new item\n addClass(this, \"hover\");\n\n // Update last item\n last_media_item = this;\n }\n }, false);\n\n // Add event listener for \"Align media\" button\n el[i].getElementsByClassName(\"align-media\")[0].onclick = alignMedia;\n\n // Add event listener for \"Remove media\" button\n el[i].getElementsByClassName(\"remove-media\")[0].onclick = removeMedia;\n\n // Resize from left bottom corner\n el[i].addEventListener(\"touchstart\", function(e) { pinchToZoom.startResizeImg(e); }, false);\n el[i].addEventListener(\"touchmove\", function(e) { pinchToZoom.performResizeImg(e, this); }, false);\n\n // Resize from left bottom corner\n // left_resize.addEventListener(\"touchstart\", function(e) { startResizeImg(e); }, false);\n // left_resize.addEventListener(\"touchmove\", function(e) { performResizeImg(e, this.parentNode.parentNode, \"left\"); }, false);\n // left_resize.addEventListener(\"touchend\", function(e) { endResizeImg(this.parentNode.parentNode); }, false);\n\n // Resize from right bottom corner\n // right_resize.addEventListener(\"touchstart\", function(e) { startResizeImg(e); }, false);\n // right_resize.addEventListener(\"touchmove\", function(e) { performResizeImg(e, this.parentNode.parentNode, \"right\"); }, false);\n // right_resize.addEventListener(\"touchend\", function(e) { endResizeImg(this.parentNode.parentNode); }, false);\n }\n }", "bind() {\n this.matchMediaItems.forEach((mq) => {\n mq.matchMedia.addListener(() => {\n if (mq.matchMedia.matches) {\n this.select(mq.query);\n }\n });\n });\n }", "registerMatchMediaEvents() {\n if (isRenderingOnServer) return;\n\n const bpCount = this.bpOrder.length;\n for (let i = 0; i < bpCount; i++) {\n const breakPointKey = this.bpOrder[i];\n this.triggerRegisteredCallbacks(breakPointKey);\n }\n }", "function fInitMediaQueries () {\n tMx.ticker.addEventListener (\"tick\", fTimer);\n function fTimer () {\n /**-----===( Load Media Queries )===-----**/\n fMediaQueries ();\n ix++;\n if (ix >= 2) {\n fRemoveEvntListnr (fTimer);\n }\n }\n }", "_handleMQChange(mql, breakpointName) {\n if (mql.matches) {\n $(window).triggerHandler(breakpointName);\n\n if (breakpointName.indexOf('Min') === -1\n && breakpointName.indexOf('Max') === -1) {\n $(window).triggerHandler('mediaQueryChange', breakpointName);\n }\n\n $.each(window.info.matchedMediaQueries, (index, value) => {\n if (!window.matchMedia(MEDIA_QUERIES[value]).matches) {\n window.info.matchedMediaQueries.splice(index, 1);\n }\n });\n\n window.info.matchedMediaQueries.push(breakpointName);\n }\n }", "registerEvents() {\n this.registerTimerBlock();\n this.registerElementsUI();\n }", "function amplitude_bind_song_additions(){\n\tdocument.addEventListener('DOMNodeInserted', function( e ){\n\n\t\tif( e.target.classList != undefined && e.target.classList[0] != 'amplitude-album-art-image' ){\n\t\t\tvar amplitude_play_pause_classes = document.getElementsByClassName(\"amplitude-play-pause\");\n\n\t \t\tfor( var i = 0; i < amplitude_play_pause_classes.length; i++ ){\n\t \t\t\tif( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {\n\t \t\t\t\tamplitude_play_pause_classes[i].removeEventListener('touchstart', amplitude_handle_play_pause_classes );\n\n\t \t\tamplitude_play_pause_classes[i].addEventListener('touchstart', amplitude_handle_play_pause_classes );\n\t \t\t\t}else{\n\t \t\t\t\tamplitude_play_pause_classes[i].removeEventListener('click', amplitude_handle_play_pause_classes );\n\n\t \t\tamplitude_play_pause_classes[i].addEventListener('click', amplitude_handle_play_pause_classes );\n\t \t}\n\t\t\t}\n\n\t\t\tvar amplitude_song_sliders = document.getElementsByClassName(\"amplitude-song-slider\");\n\n\t\t for( var i = 0; i < amplitude_song_sliders.length; i++ ){\n\t\t \tamplitude_song_sliders[i].removeEventListener('input', amplitude_handle_song_sliders );\n\t\t \tamplitude_song_sliders[i].addEventListener('input', amplitude_handle_song_sliders );\n\t\t }\n\n\t\t //Binds multiple mute buttons for multiple song integrations\n\t\t var amplitude_mute_buttons = document.getElementsByClassName(\"amplitude-mute\");\n\n\t\t for( var i = 0; i < amplitude_mute_buttons.length; i++ ){\n\t\t \tamplitude_mute_buttons[i].removeEventListener('input', amplitude_handle_mute_classes );\n\t\t \tamplitude_mute_buttons[i].addEventListener('click', amplitude_handle_mute_classes );\n\t\t }\n\t\t}\n\t});\n\t\n}", "function handleAddQuery(e) {\n \n var w = slider.value;\n \n // create the query mark at the top of the preview window\n // and set it as the current media query\n currentQuery = addQueryMark(w);\n\n // update inline editor with the newly selected query.\n updateInlineWidgets();\n\n // Calling this function will write the new query to the style block \n // in the iframe and also to the media-queries.css file.\n refreshMediaQueries();\n }", "function MediaQueryList(media) {\n\t this.media = typeof media === 'string' ? media : 'not all'; \n\t \n\t // \"private\" properties\n\t this._data = {\n\t listeners: [], \n\t status: undefined,\n\t };\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return what percentage of city taxes originally came from the restaurant
function calculateTaxContibution(rest){ return rest.taxesDue / rest.cityTaxes }
[ "function getTotalTaxes(country){\n\n return this.tax * this.middleSalary * this.vacancies;\n}", "function totalTaxCost(){\n\t\t\n\t\treturn totalPrice * taxPercentage;\n\t} // End totalTaxCost.", "function taxCalculator(price, state) {\n\tlet tax;\n\tif (state === 'NY') tax = .04;\n\telse if (state === 'NJ') tax = .06625;\n\telse return null;\n\n\ttotal = price + price * tax;\n\treturn total;\n}", "function propertyTax() {\n return ( plan.mortgage.homeValue * local.statePropertyTax[plan.stateResident] );\n }", "function getTax() {\n return getSubTotal(orderCount) * 0.06;\n}", "function getFoodAverage_City2(restauranteList) {\n var averageFood = 0;\n\n var rating = 0;\n\n for (var itemFood = 0; itemFood < restauranteList.length; itemFood++) {\n var price = restauranteList[itemFood].venue.price;\n if (price !== undefined) {\n //Food Average\n averageFood = averageFood + restauranteList[itemFood].venue.price.tier;\n }\n\n //Rating Average\n rating = rating + restauranteList[itemFood].venue.rating;\n }\n\n //Calculate rating food\n var calculateAverageFood = averageFood / restauranteList.length;\n ratingFood_City2(calculateAverageFood);\n\n //Calculate Rating\n var calculateRating = rating / restauranteList.length;\n ratingPlace_City2(calculateRating);\n}", "function taxEstimate (income) {\n\tif (income < 9226) {\n\t\treturn income*(0.9);\n\t} else if (income < 37451) {\n\t\treturn income*(0.85);\n\t} else if (income < 90751) {\n\t\treturn income*(0.25);\n\t} else if (income < 189301) {\n\t\treturn income*(0.28);\n\t} else if (income < 411501) {\n\t\treturn income*(0.33);\n\t} else if (income < 413200) {\n\t\treturn income*(0.35);\n\t} else {\n\t\treturn income*(0.396);\n\t}\n}", "function calculateTax(tax){\n\t\n\treturn (this.income * tax/100);\n\t\n}", "function getTax(){\n return (getSubTotal(orderCount)*0.06);\n}", "tax() {\n var GST = 0.05;\n return this.subtotal() * GST;\n }", "calculateTipAmount() {\n var totalTipAmount = (this.bill * this.percentage) / 100;\n var tipPerPerson = totalTipAmount / this.people;\n return tipPerPerson;\n }", "function calculateTax(){\n\t\t//gets current tax input total\n\t\tvar currentTaxTotal = $(\"#tax_field\").val();\n\t\t//checks number of categories with tax includied\n\t\tvar taxCategoriesCount = $(\"input[type='checkbox']:checked\").length;\n\t\tconsole.log(taxCategoriesCount + \" is the number of categories with tax\");\n\t\t//divides tax total by number of categories, returns two decimal format\n\t\treturn (currentTaxTotal / taxCategoriesCount).toFixed(2);\n\t\t\n\t}", "get tax() {\n return 0.09 * this.subtotal;\n }", "function getFoodAverage_City1(restauranteList) {\n\n var averageFood = 0;\n var rating = 0;\n\n for (var itemFood = 0; itemFood < restauranteList.length - 1; itemFood++) {\n //Food Average\n var price = restauranteList[itemFood].venue.price;\n if (price !== undefined) {\n averageFood = averageFood + restauranteList[itemFood].venue.price.tier;\n }\n\n //Rating Average\n rating = rating + restauranteList[itemFood].venue.rating;\n }\n\n //Calculate rating food\n var calculateAverageFood = averageFood / restauranteList.length;\n ratingFood_City1(calculateAverageFood);\n\n //Calculate Rating\n var calculateRating = rating / restauranteList.length;\n ratingPlace_City1(calculateRating);\n}", "function tipAmount(costOfIceCream){ \n\treturn costOfIceCream * .18; //tip is 18% (.18) of the total cost \n}", "function stateTax() {\n var agi = result.agi || ( ((plan.grossAnnualIncome || 0) + (plan.spouseGrossAnnualIncome || 0)) - ((plan.user401kContribution || 0) + (plan.spouse401kContribution || 0)) );\n return ( agi * local.stateIncomeTax[plan.stateResident] );\n // TODO: Calculate state income tax marginally, rather than just by highest marginal.\n }", "function federalTax() {\n // calculations based off of result.taxableIncome\n // federal.bracketRate = [ 0.1, 0.15, 0.25, 0.28, 0.33, 0.35, 0.396 ];\n // federal.bracketLimit.single = [ 0, 9225, 37450, 90750, 189750, 411500, 413200 ];\n\n var bracketRate = getVar(federal.bracketRate);\n var bracketLimit = getVar(federal.bracketLimit);\n var income = result.taxableIncome;\n\n // Marginal tax calculations.\n var taxLiability = 0;\n for (var i=0; i<bracketRate.length; i++) {\n if (income >= bracketLimit[i] && i < bracketRate.length-1) {\n var temp = Math.min( bracketLimit[i+1], income ) - bracketLimit[i];\n taxLiability += (temp * bracketRate[i]);\n }\n // Catches cases where income is greater than the highest bracket.\n else if (income >= bracketLimit[i] && i === bracketRate.length-1) {\n var temp = income - bracketLimit[i];\n taxLiability += (temp * bracketRate[i]);\n }\n }\n return taxLiability;\n }", "function taxed(value) {\n return taxRate / 100 * cartTotal + parseFloat(cartTotal)\n}", "function getLovePerc() {\n return (((love_count)/(love_count + hate_count))*100).toFixed(2);\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sizing up image in list and adding caption for closing
function sizingImg(event){ let elem = event.target; if(elem.tagName == 'IMG'){ elem.classList.toggle('img_big'); let caption; if(elem.classList.contains('img_big')){ caption = document.createElement('p'); caption.classList.add('img_caption'); caption.innerText="Чтобы закрыть нажмите на скриншот"; elem.parentElement.appendChild(caption); }else{ caption = document.getElementsByClassName('img_caption')[0]; caption.remove(); } } }
[ "function looping_image_display(targetdiv, imagelist){\n\t\t\tvar newobject = imagelist[0];\n\t\t\tvar newimage = newobject.image_ref;\n\t\t\t//console.log(\"newimage: \"+newimage);\n\t\t\tvar newtext = newobject.obj_text; \n\t\t\timagelist.shift();\n\t\t\timagelist.push(newobject);\n\t\t\t$(targetdiv).append('<figure><img style=\"max-width:'+img_width+'; max-height:'+img_width*.8+'\" src=\"'+newimage+'\"><figcaption>'+newtext+'</figcaption></figure>');\t\t\t\t\n\n\t\t}", "function toggle_imagelist_square(){\n\t\t_e.files.style.setProperty('--imagelist-height', (imagelist_square ? '100px' : '100%'));\n\t\t_e.files.style[(imagelist_square ? 'set' :'remove') + 'Property']('--imagelist-min-height', 'auto');\n\t}", "function resizeImageList() {\n var mainHeight = $('main').height();\n $('#imageList').height('auto');\n if( mainHeight > $('#imageList').outerHeight(true) ) {\n var newPosition = mainHeight - ($('#imageList').outerHeight(true) - $('#imageList').height());\n $('#imageList').height(newPosition);\n }\n\n // Move footer below image list\n var footerPos = $('#imageList').outerHeight(true) + $('#imageList').position().top;\n $('footer').attr('style', 'display:block;position:absolute;width:100%;top:' + footerPos + 'px;');\n}", "function resizeCaption()\n{\n \n var capmaxht = 0; // maximum image height\n $('.thumbnail-product .caption').each(function()\n \n {\n \n if($(this).height()>capmaxht)\n {\n capmaxht= $(this).height();\n }\n });\n $('.thumbnail-product .caption').height(capmaxht);\n \n}", "function resizeCaption()\n{\n \n var capmaxht = 0; // maximum image height\n $('.thumbnail-book .caption').each(function()\n \n {\n \n if($(this).height()>capmaxht)\n {\n capmaxht= $(this).height();\n }\n }\n \n );\n\n\n\n\n $('.thumbnail-book .caption').height(capmaxht);\n \n}", "function mkdIconListResize(){\n\t\tvar iconList = $('.mkd-icon-list-item');\n\t\tif (iconList.length){\n\t\t\ticonList.each(function(){\n\t\t\t\tvar thisIconItem = $(this);\n\t\t\t\tvar thisItemIcon = thisIconItem.find('.mkd-icon-list-icon-holder-inner');\n\t\t\t\tvar thisItemText = thisIconItem.find('.mkd-icon-list-text');\n\t\t\t\tvar fontSizeIcon;\n\t\t\t\tvar fontSizeText;\n\t\t\t\tvar coef1 = 1;\n\n\t\t\t\tif (mkd.windowWidth <= 1024){\n\t\t\t\t\tcoef1 = 0.75;\n\t\t\t\t}\n\n\t\t\t\tif (mkd.windowWidth < 600){\n\t\t\t\t\tcoef1 = 0.65;\n\t\t\t\t}\n\n\t\t\t\tif (mkd.windowWidth < 480){\n\t\t\t\t\tcoef1 = 0.5;\n\t\t\t\t}\n\n\t\t\t\tif (typeof thisItemIcon.data('icon-size') !== 'undefined' && thisItemIcon.data('icon-size') !== false) {\n\t\t\t\t\tfontSizeIcon = parseInt(thisItemIcon.data('icon-size'));\n\n\t\t\t\t\tif (fontSizeIcon > 50) {\n\t\t\t\t\t\tfontSizeIcon = Math.round(fontSizeIcon*coef1);\n\t\t\t\t\t}\n\n\t\t\t\t\tthisItemIcon.children().css('font-size',fontSizeIcon + 'px');\n\t\t\t\t}\n\n\t\t\t\tif (typeof thisItemText.data('title-size') !== 'undefined' && thisItemText.data('title-size') !== false) {\n\t\t\t\t\tfontSizeText = parseInt(thisItemText.data('title-size'));\n\n\t\t\t\t\tif (fontSizeText > 50) {\n\t\t\t\t\t\tfontSizeText = Math.round(fontSizeText*coef1);\n\t\t\t\t\t}\n\n\t\t\t\t\tthisItemText.css('font-size',fontSizeText + 'px');\n\t\t\t\t}\n\n\t\t\t});\n\t\t}\n\t}", "function maxWidthImages(i, image) {\n var wideImage = document.getElementById('h5p-image-gallery-thumbnail-'+i);\n wideImage.style.height = 'auto';\n}", "function ShowMediaBox(mlist, ind) //takes an array of objects and the index of the object\n{\n var newImg = new Image();\n\n newImg.onload = function ()\n {\n var h = newImg.height;\n var w = newImg.width;\n if (h > window.innerHeight - 120)\n {\n h = window.innerHeight - 120;\n w = h / newImg.height * newImg.width;\n }\n if (w > window.innerWidth - 120)\n {\n w = window.innerWidth - 120;\n h = w / newImg.width * newImg.height;\n }\n var desc = mlist[ind]['description'];\n if (desc == null)\n desc = \"\";\n var cont = '<img id=\"dialog-image\" height=\"' + h + 'px\" data-index=' + ind + ' style=\"padding:10px; padding-bottom:0px; margin-bottom:-5px;\" src=\"' + mlist[ind]['uri'] + '\" alt=\"alternate text\"><div id=\"dialog-description\" style=\"text-align:center; position:relative;\">' + desc + '';\n cont += '<a id=\"img-full\" href=\"' + mlist[ind]['uri'] + '\" target=\"_blank\"> <div class=\"fa fa-external-link iblock hint\" style=\"\"></div></a></div>';\n cont += '<div id=\"img-next\" class=\"block hint fa fa-angle-double-right\" onclick=\"GalleryNext()\" style=\"font-size: 150%; position:absolute; right:5px; top:' + (h + 40) / 2 + 'px;\"></div>';\n cont += '<div id=\"img-prev\" class=\"block hint fa fa-angle-double-left\" onclick=\"GalleryPrev()\" style=\"font-size: 150%; position:absolute; left:5px; top:' + (h + 40) / 2 + 'px;\"></div>';\n\n\n\n var options = {\n text: cont,\n width: w + 20 + 'px',\n height: h + 20 + 'px',\n theme: 'page-dark'\n };\n Dialog.Open(options);\n }\n newImg.src = mlist[ind]['uri'];\n\n\n}", "function enlarge(obj){\n const selectedImage = document.getElementById('selectedImage');\n selectedImage.innerHTML = '';\n let img = document.createElement('img');\n //make a close button\n let cross = document.createElement('button');\n cross.setAttribute('class', 'closeImage');\n cross.innerHTML = 'x';\n img.setAttribute('src',imgURL(obj ,'z'));\n selectedImage.appendChild(img);\n selectedImage.appendChild(cross);\n selectedImage.style.display = 'flex';\n //click to close big image\n cross.addEventListener('click', ()=>{\n selectedImage.style.display = 'none';\n });\n \n}", "function addCaptions(){\r\n\t\tvar images = $('.wc-caption-image, .wc-caption-image-left, .wc-caption-image-right');\r\n\t\t$(window).load(function(){ /*[1]*/\r\n\t\t\tfor (var i = 0; i < images.length; i++) {\r\n\t\t\t\tvar image = $(images[i]);\r\n\t\t\t\timage.wrap('<figure style=\"'+WcFun.emptyIfNull(image.attr('style'))+ ' width:' + image.outerWidth()+'px;\" class=\"'+WcFun.emptyIfNull(image.attr('class'))+'\"></figure>');/*[2]*/\r\n\t\t\t\timage.attr('style','').attr('class',''); /*[3]*/\r\n\t\t\t\tif(image.attr('title')){\r\n\t\t\t\t\timage.parent().append('<figcaption class=\"wc-image-caption\">'+image.attr('title')+'</figcaption>');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}", "function showProps() { \n document.getElementById(\"prop\").style.display = \"table\";\n document.getElementById(\"imgName\").innerHTML = file.name;\n document.getElementById(\"mime\").innerHTML = file.type;\n document.getElementById(\"dimensions\").innerHTML = \n document.getElementById(\"img\").naturalWidth + \" X \" + document.getElementById(\"img\").naturalHeight; \n debugger;\n document.getElementById(\"list-container\").style.height = document.getElementById(\"img\").height + \"px\";\n}", "function makeThumbnail(tank) {\n // create a list item\n let thumbItem = document.createElement(\"li\");\n thumbItem.classList.add(\"thumbnail-item\");\n thumbItem.title = \"Click to details\";\n thumbItem.addEventListener(\"click\", function (eve) {\n window.location.hash = tank.model.replace(/\\s/g, \"_\");\n });\n\n // create an inner elements for list item\n let thumbFigure = document.createElement(\"figure\");\n\n let thumbImg = document.createElement(\"img\");\n thumbImg.src = tank.preview;\n\n let thumbFigcap = document.createElement(\"figcaption\");\n\n // adding all inner elements to thumbFigure and thumbItem\n thumbFigcap.appendChild(makeFigcaptionContent());\n thumbFigure.appendChild(thumbImg);\n thumbFigure.appendChild(thumbFigcap);\n thumbItem.appendChild(thumbFigure);\n\n return thumbItem;\n\n // function for inner using to separate creating of figcaption for thumbFigure from other actions\n function makeFigcaptionContent() {\n let retDoc = document.createDocumentFragment();\n\n // creating inner elements for figcaption\n let flagImg = document.createElement(\"img\");\n flagImg.src = tank.country_image;\n flagImg.title = tank.country.toUpperCase();\n\n let tankLvl = document.createElement(\"em\");\n tankLvl.appendChild(document.createTextNode(tank.level));\n\n let tankModel = document.createElement(\"b\");\n tankModel.appendChild(document.createTextNode(tank.model.toUpperCase()));\n tankModel.title = tank.model.toUpperCase();\n\n // adding inner elements\n retDoc.appendChild(flagImg);\n retDoc.appendChild(tankLvl);\n retDoc.appendChild(tankModel);\n\n return retDoc;\n }\n}", "function captionOn()\n{\n var description = $('a[href=\"' + $('#imagelightbox').attr('src') + '\"] ~ span.source');\n var div = $('<div id=\"imagelightbox-caption\"></div>');\n if(description.size() > 0)\n {\n description.first().clone().appendTo(div);\n div.appendTo('body');\n //$('<div id=\"imagelightbox-caption\">' + description + '</div>' ).appendTo('body');\n }\n captionResize();\n setTimeout(captionResize, 255);\n}", "function expandImage() {\n curImgElement = this;\n modal.style.display = \"block\";\n modalImg.src = curImgElement.src;\n //captionText.innerHTML = curImgElement.alt;\n}", "function resizeImage() {\n\t\tstopSlideshow();\n\t\t_setShrunk(!_isShrunk());\n\t\t_changeItem();\n\t}", "function resizeDesc() {\n let picWidth = $(\".photos\").css(\"width\");\n $(\"#gray-container\").css(\"width\", picWidth);\n}", "function thumbnailCloseButtonClickHandler(e) {\n e.preventDefault();\n\n var thumbnailContainer, imageList, selectElement;\n\n thumbnailContainer = $(this).parent().parent();\n imageList = thumbnailContainer.parent();\n selectElement = thumbnailContainer.parent().siblings(\"select:first\");\n // Unset the currently selected image style\n selectElement.find(\"option[selected='selected']\").removeAttr(\"selected\");\n // Set the new image style\n selectElement.find(\"option[value='original']\").attr(\"selected\", \"selected\").trigger(\"chosen:updated\");\n // Remove the thumbnail\n thumbnailContainer.remove();\n\n if (!imageList.children(\"li:first\").length) {\n hideImageStyleControls(imageList.siblings(\".form-control:first\"));\n }\n\n sortFilenames(imageList, ',');\n\n }", "function resize (w,h,c) {\r\n\t$('.iStu12').animate({width:w, height:h},speed);\r\n\t$('.iStu12 li.prev').animate({top:(h-123)/2},speed);\r\n\t$('.iStu12 li.next').animate({top:(h-123)/2},speed);\r\n\t$('.iStu12 li.images').animate({width:w, height:h},speed);\r\n\t$('li.caption').html(c);\r\n}", "function createFigureInImg(element) {\n// $(element).find('img').css({'width': '100%'});\n $(element).find('img').wrap('<figure></figure>');\n $(element).find('img').each(function(index, el) {\n var text = $(el).attr('alt');\n $(el).after('<figcaption class=\"text text-center\">' + text + '</figcaption>');\n });\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
block keyboard event when the keyCode is 13 > Enter
blockKeyEvent(event) { if (event.keyCode === 13) { event.preventDefault(); } }
[ "function stopEnter(event)\n{\n\tvar code = (event.keyCode ? event.keyCode : event.which);\n \tif(code == 13) \n\t{\n \t\tevent.stopPropagation();\n\t\treturn false; \n\t}\n\n}", "if (event.which === 32 || event.which === 13) {\n return;\n }", "function vfK(e){ if(e.keyCode == 13){ return true; } if(e.charCode == 13){ return true; } return false; }", "function handleOnKeyDown(){\r\n var evt = window.event ;\r\n var code = evt.keyCode;\r\n if (code == 13) {\r\n return false;\r\n }\r\n return true;\r\n}", "function onReturnKey() {}", "enter(e){\n if (e.charCode === 13) {\n e.preventDefault();\n };\n }", "function blockEnter() {\n $('form').keydown(function (e) {\n if(e.keyCode == 13) {\n e.preventDefault();\n return false;\n }\n });\n }", "function handleEnterPressed() {\n\twindow.event.cancelBubble=true;\n\tif (window.event.keyCode==13) event.srcElement.click();\n\t}", "function stopEnterKey (e) {\n\tvar e = (e) ? e : ((event) ? event : null)\n\tvar node = (e.target) ? e.target : ((e.srcElement) ? e.srcElement : null)\n\tif(e.keyCode == 13 && node.type==\"text\") { return false }\n}", "function userPressedEnter(evt) {\n var code = grabCharCode(evt);\n if(code==13||code==3) return true;\n return false;\n}", "onKeyPress(event) {\n if (event.which === 13 /* Enter */) {\n event.preventDefault();\n }\n }", "function onKeyPress() {\n if (event.keycode == 13) {\n onSubmit();\n return false;\n }\n}", "function disableEnter(e) {\n if (e.keyCode === 13) {\n e.preventDefault();\n return false;\n }\n\n }", "_onKeyDown(e) {\n if (e.keyCode === 13) {\n this._submit();\n }\n }", "function enter_pressed(e){if(e.keyCode==13){oraculo();}}", "function keyPressed() {\n if (keyCode == 13) {\n send();\n }\n}", "function doNotSubmit()\n{\t\n\tif(event.keyCode == 13) return false;\n}", "_handleKeyPress (event) {\n if (event.key === \"Enter\") {\n event.preventDefault();\n }\n }", "sendMessageIfEnter (e) {\n if (e.keyCode === 13) {\n this.sendMessage()\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ This takes as input an array which defines several urls simultaneously present in a D3 window. This array might come from the main window or is the summary ("Tools") window. It bears the same name for clarity, as it is a singleton in these two windows. The result is a single url which represents the merging of the input urls.
function ConcatenateMergeUrl(lstLoadedUrls,cgiArgs) { var urlFull; /* If there is one element, we might as well simply return it. It is a frequent case. */ console.log("ConcatenateMergeUrl lstLoadedUrls.array_urls.length="+ lstLoadedUrls.array_urls.length); if( lstLoadedUrls.array_urls.length == 1 ) { urlFull = lstLoadedUrls.array_urls[0].m_loaded_url; // No need to merge anything because there is one url only. urlFull = AddUrlCgiArg(urlFull, cgiArgs ); } else { var urlMerge = pyMergeScript; var cgiDelim = "?url="; for( var ixLoaded = 0; ixLoaded < lstLoadedUrls.array_urls.length; ixLoaded++ ) { var objLoadedUrl = lstLoadedUrls.array_urls[ixLoaded]; console.log("m_loaded_title="+ objLoadedUrl.m_loaded_title +" m_loaded_url="+objLoadedUrl.m_loaded_url); var url64safe = Base64.encodeURI(objLoadedUrl.m_loaded_url); urlMerge += cgiDelim + url64safe; cgiDelim = "&url="; } console.log("ConcatenateMergeUrl urlMerge="+urlMerge); urlFull = AddUrlPrefix(urlMerge,cgiArgs); } console.log("ConcatenateMergeUrl urlFull="+urlFull); return urlFull; }
[ "static URLJoin(urls){\n return urljoin(urls);\n }", "function openGroup(urls) \n{\n\tsafari.self.hide();\n\n\tvar window = safari.application.activeBrowserWindow;\n\tvar theWindow;\n\tif (window.tabs.length == 1 && !window.activeTab.url) theWindow = window;\n\telse theWindow = safari.application.openBrowserWindow();\n\t\n\tfor (var i = 0; i < urls.length; i++) {\n\t\tif (i == 0) {\n\t\t\ttheWindow.activeTab.url = urls[i];\n\t\t} else {\n\t\t\tvar tab = theWindow.openTab('background', i);\n\t\t\ttab.url = urls[i];\n\t\t}\n\t};\n}", "function joinURLLists() {\n\tvar ans = url_list['this'];\n\n\t// don't add dupes\n\tans = ans.concat(url_list['others'].filter(function(elem, index, array) {\n\t\t\t\treturn ans.indexOf(elem) == -1;\n\t\t\t})\n\t\t);\n\n\treturn ans;\n}", "function openBasicUrls(){\n urls_one.reverse();\n for (var i = 0; i < urls_one.length; i++) {\n var creating = browser.tabs.create({\n url: urls_one[i]\n });\n }\n}", "async function openUrls(){\n\n /* Get all URLs quitting last part path until no more parts available.\n Example. For 'http://github.com/CarlosAMolina' two URLs will be \n created: 'http://github.com/CarlosAMolina' and 'http://github.com'.\n :param urls: list of strings, URLs to work with.\n :return urls_paths: list of strings, all possible URLs omitting\n parts of the paths.\n */\n function getUrlsWithPaths(urls){\n // Variable with results.\n var urls_paths = []\n urls.forEach( function(url) {\n // Quit last slash.\n if (url.slice(-1) == '/'){\n url = url.substring(0, url.length -1);\n }\n // Loop all parts of the path until no more parts.\n while (url.slice(-1) != '/') {\n url = getUrlWithProtocol(url)\n urls_paths.push(url)\n if ( url.indexOf('/') != -1 ){\n // Quit last path parth.\n url = url.slice(0, url.lastIndexOf('/'));\n }\n else {\n // Character to stop the while loop.\n url = '/';\n }\n }\n });\n console.log('URLs with all paths: ' + urls_paths)\n return urls_paths;\n }\n \n /* If the URL has not got protocol, add one.\n :param url: str, url to check.\n :return url: str, url with protocol.\n */\n function getUrlWithProtocol(url){\n if (url.substring(0, 4).toLowerCase() != 'http'){\n return protocolAdded+url;\n }\n return url;\n }\n\n /* Open an url and catches possible exception.\n :param url: str, url to check.\n :return null.\n */\n function openUrl(url){\n try{\n windowObjectReference = window.open(url);\n console.log('Done open url \\'' + url + '\\'. Window object reference: ' + windowObjectReference)\n }\n catch(error){\n reportError(error);\n }\n }\n\n // Get URLs at the input box.\n urls = document.getElementById('inputUrls').value.split('\\n');\n console.log('URLs at the input box: ' + urls)\n if (document.getElementById('boxPaths').checked == true){\n urls = getUrlsWithPaths(urls);\n }\n // Open URLs.\n var urlsLength = urls.length;\n for (var i = 0; i < urlsLength; i++) { \n var url = urls[i];\n console.log('Init url ' + (i + 1) + '/' + urlsLength + ': \\'' + url + '\\'');\n // Check if an empty string was provided.\n // It can have the protocol, example added by the \n // getUrlsWithPaths function.\n if (url == '' || url == protocolAdded){\n console.log('Not URL provided. Omitting');\n } else {\n url = getUrlWithProtocol(url);\n // Only wait between URLs.\n if (i != 0){\n console.log('Init. Wait miliseconds: ' + lazyLoadingTime);\n await sleep(lazyLoadingTime);\n console.log('Done. Wait miliseconds: ' + lazyLoadingTime);\n }\n console.log(url);\n openUrl(url);\n }\n }\n }", "findURL (url: string) {\n // TODO: && !url.startsWith('chrome-extension://')\n if (url !== 'chrome://newtab/') {\n const urlRE = new RegExp('^' + escapeStringRegexp(url) + '$')\n const openWindows = this.getOpen().toArray()\n const filteredWindows = searchOps.filterTabWindows(openWindows,\n urlRE, { matchUrl: true, matchTitle: false, openOnly: true })\n // expand to a simple array of [TabWindow,TabItem] pairs:\n const matchPairs = _.flatten(filteredWindows.map(ftw => {\n const { tabWindow: targetTabWindow, itemMatches } = ftw\n return itemMatches.map(match => [targetTabWindow, match.tabItem]).toArray()\n }))\n return matchPairs\n } else {\n return []\n }\n }", "function _addShareUrls() {\n for (var i = 0, x = $scope.images.length; i < x; i++) {\n $scope.images[i].ShareUrl = window.location.href.split('?')[0] + '?galleryimage=' + $scope.images[i].Id;\n }\n }", "static getSameOriginWindowChain() {\n if (!sameOriginWindowChainCache) {\n sameOriginWindowChainCache = [];\n let w = window;\n let parent;\n do {\n parent = getParentWindowIfSameOrigin(w);\n if (parent) {\n sameOriginWindowChainCache.push({\n window: w,\n iframeElement: w.frameElement || null\n });\n }\n else {\n sameOriginWindowChainCache.push({\n window: w,\n iframeElement: null\n });\n }\n w = parent;\n } while (w);\n }\n return sameOriginWindowChainCache.slice(0);\n }", "function createURLArray(array){\n\tvar urlArray = [{url:\"\", company:\"\"}];\n\tvar companiesToSearch = array;\n\tvar siteToSearch = \"linkedin.com\";\n\tvar keywordsToSearch = \"San+Francisco\";\n\tfor (var i = 0; i < companiesToSearch.length; i++) {\n\t\tvar count = 1;\n\t\tfor (var j = 0; j < 3; j++) {\n\t\t\tvar resultNumber = count;\n\t\t\tvar siteurl = \t\"http://www.bing.com/search?q=site%3a\"\n\t\t\t\t\t\t\t+siteToSearch+\"%22\"\n\t\t\t\t\t\t\t+keywordsToSearch+\"%22%22\"\n\t\t\t\t\t\t\t+companiesToSearch[i].company+\"%22&qs=n&pq=site%3a\"\n\t\t\t\t\t\t\t+siteToSearch+\"%22\"\n\t\t\t\t\t\t\t+keywordsToSearch+\"%22%22\"\n\t\t\t\t\t\t\t+companiesToSearch[i].company+\"%22&sc=0-43&sp=-1&sk=&cvid=be5a31bf5381440ebbb0a7867e72b754&first=\"\n\t\t\t\t\t\t\t+resultNumber+\"&FORM=PORE\"\n\t\t\turlArray.push({url:siteurl, company:companiesToSearch[i].company, companyWebsite:companiesToSearch[i].website});\n\t\t\tif (count === 1){\n\t\t\t\tcount = count + 8;\n\t\t\t} else count = count + 14;\n\t\t};\n\t}\n\tPages = urlArray;\n\tconsole.log(Pages);\n\tstart();\n}", "function makeNewChromeWindowWithURIs(uris) {\n let window = Chrome.Window().make();\n if (uris.length) {\n // Re-use the initial tab, create the rest.\n window.tabs[0].url = uris[0];\n uris.slice(1).forEach(u => { window.tabs.push(Chrome.Tab({url: u})); });\n }\n return window;\n}", "function mergeLinks() {\n var linkGroups = d3.nest()\n .key(function (link) { return link.source.id + \"->\" + link.target.id; })\n .entries(links)\n .map(function (object) { return object.values; });\n }", "mergeWindows(state) {\r\n if (state.windows.length < 2)\r\n return;\r\n // take off first window\r\n let win = state.windows.shift();\r\n // make sure toolbars are not hidden on the window\r\n delete win.hidden;\r\n delete win.isPopup;\r\n if (!win._closedTabs)\r\n win._closedTabs = [];\r\n // Move tabs to first window\r\n state.windows.forEach(aWindow => {\r\n win.tabs = win.tabs.concat(aWindow.tabs);\r\n if (aWindow._closedTabs)\r\n win._closedTabs = win._closedTabs.concat(aWindow._closedTabs);\r\n });\r\n win._closedTabs.splice(Services.prefs.getIntPref(\"browser.sessionstore.max_tabs_undo\"));\r\n // Remove all but first window\r\n state.windows = [win];\r\n }", "formatUrls(){\n urls = this._urls.map( (u) => { return 'url=' + \"'\" + u + \"'\"; });\n urls = urls.join(' or ');\n return urls;\n }", "function combineURLPaths() {\n var url = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n url[_i - 0] = arguments[_i];\n }\n var fullURLPath = '';\n for (var i = 0; i < url.length; i++) {\n fullURLPath += lodash.trimEnd(url[i], '/');\n }\n return fullURLPath;\n}", "function URLsFromTabs() {\n\tchrome.windows.getCurrent(function(currentWindow) {\n\t\tchrome.tabs.query({}, function(tabs) {\n\t\t\ttabs.forEach(function(tab) {\n\t\t\t\tvar id = 'this';\n\t\t\t\tif(tab.windowId != currentWindow.id) {\n\t\t\t\t\tid = 'others';\n\t\t\t\t} else if(tab.url == 'chrome://newtab/'){\n\t\t\t\t\t// add to list of empty tabs\n\t\t\t\t\tblank_tabs.push(tab.id);\n\t\t\t\t}\n\n\t\t\t\tif(url_list[id].indexOf(tab.url) == -1) {\n\t\t\t\t\turl_list[id].push(tab.url);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t});\n}", "splitUrls() {\n // All Assets Urls\n this.urls = this.assets.map(function (item) {\n return item.href;\n }.bind(this)); // Css Urls\n\n this.cssUrls = this.css.map(function (item) {\n return item.href;\n });\n }", "packageURLs () {\n if (this.name || this.thumbnail) {\n this.urls = {}\n if (this.name) this.urls.full = FileHandler.getURL(this.name)\n if (this.thumbnail) this.urls.thumbnail = FileHandler.getURL(this.thumbnail)\n }\n }", "function UpdateMainArraysBasedOnNewURL()\n{\n\tfor (var i=0; i<noneCrawledURLs.length; i++)\n\t{\n\t\tif (noneCrawledURLs[i].URL.toString() == URLToBeLoaded.toString())\n\t\t{\n\t\t\tnoneCrawledURLs[i].URL = curURL;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tfor (var i=0; i<allTheLinksToBeReported.length; i++)\n\t{\n\t\tif (allTheLinksToBeReported[i].URL.toString() == URLToBeLoaded.toString())\n\t\t{\n\t\t\tallTheLinksToBeReported[i].URL = curURL;\n\t\t\tbreak;\n\t\t}\n\t}\n}", "function newWindowLinks() {\n\t\t$ES('a.new_window').each(function(elem, index) {\n\t\t\telem.addEvent('click', function(event) {\n\t\t\t\twindow.open(elem.href);\n\t\t\t\t(new Event(event)).stop();\n\t\t\t});\n\t\t});\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if all the metadata fields for supplemental files have values filled in.
hasSupplementalMetadata(){ var invalidInputs; invalidInputs = $("#additional_metadata :input:visible").map(function() { if (this.value === undefined || this.value.length === 0) { return 'invalid' } }) return invalidInputs.length === 0 }
[ "function isAllStandardFieldsEmpty(entry) {\n return (entry.userName.length == 0) && \n (entry.password.length == 0) && \n (entry.url.length == 0) && \n (entry.notes.length == 0); \n}", "function allFilled(fields){\r\n for(let y=0;y<fields.length;y++){\r\n if(!fields[y].value){\r\n return false;\r\n }\r\n }\r\n return true;\r\n}", "function formHasData() {\n var field;\n for (field in $fields) {\n if ($fields.hasOwnProperty(field) && $fields[field].val() !== '') {\n return true;\n }//end if\n }//end for\n return false;\n }", "function checkForMandatoryFields() {\n var recordAdded = false;\n for (var i = 0; i < mainProcess.length; i++) {\n if (mainProcess[i].description) { // main chevron diagram values are added\n recordAdded = true;\n }\n }\n if (!recordAdded) {\n alert('Please fill all properties of chevron diagram');\n return false;\n } else {\n return true;\n }\n }", "isExtraEmpty() {\n return Object.keys(this.extra).length === 0 && this.extra.constructor === Object;\n }", "get hasMandatoryProperties() {\n let allExistAndValid = true; // assume all exist until proven otherwise\n try {\n const fullnameProperty = this._properties.get('FullName');\n if (!(fullnameProperty && fullnameProperty.isInitialised && fullnameProperty.valid)) {\n allExistAndValid = false;\n this._log(User.LOG_ERROR, 'User::hasMandatoryProperties - missing or invalid fullname');\n }\n\n const jobTitle = this._properties.get('JobTitle');\n if (!(jobTitle && jobTitle.isInitialised && jobTitle.valid)) {\n allExistAndValid = false;\n this._log(User.LOG_ERROR, 'User::hasMandatoryProperties - missing or invalid job title');\n }\n\n const emailProperty = this._properties.get('Email');\n if (!(emailProperty && emailProperty.isInitialised && emailProperty.valid)) {\n allExistAndValid = false;\n this._log(User.LOG_ERROR, 'User::hasMandatoryProperties - missing or invalid email');\n }\n\n const phoneProperty = this._properties.get('Phone');\n if (!(phoneProperty && phoneProperty.isInitialised && phoneProperty.valid)) {\n allExistAndValid = false;\n this._log(User.LOG_ERROR, 'User::hasMandatoryProperties - missing or invalid phone');\n }\n\n const roleProperty = this._properties.get('UserRole');\n if (!(roleProperty && roleProperty.isInitialised && roleProperty.valid)) {\n allExistAndValid = false;\n this._log(User.LOG_ERROR, 'User::hasMandatoryProperties - missing or invalid role');\n }\n } catch (err) {\n console.error(err);\n }\n\n return allExistAndValid;\n }", "function testIfMetadataImportPossible() {\n // see if any metadata has been entered for other variables \n var variablesWithMetadata = getVariablesWithMetadata();\n if (variablesWithMetadata.length > 0) {\n for (var i = 0; i < variablesWithMetadata.length; i++) {\n if (testVariableCompleteness(variablesWithMetadata[i],\n getFromSession(variablesWithMetadata[i]))) {\n return true;\n } else {\n if (i = (variablesWithMetadata.length - 1)) {\n return false;\n }\n }\n }\n } else {\n return false;\n }\n\n}", "function hasAnySelectedAutogeneratedFields(){\n\treturn ( arrayIntersection(autogeneratedQuestionFields,jQuery('input[id^=check_]:checked')\n\t\t\t.map(function(){\n\t\t\t\treturn this.value;\n\t\t\t})).length > 0 );\n}", "function checkAllFieldsSupplied(form) {\n \n // Defaulting all fields supplied to true, until proven otherwise below\n var allRequiredFieldsSupplied = true;\n\n console.log(\"About to check this form - \" + $(form).attr(\"id\"));\n\n // Checking all input fields within this form, to ensure that none are left empty.\n // Excluding the submit input from this search, as this cannot take a user defined\n // value.\n $(form).find(\"input\").not(\"[type='submit']\").each(function (index, element) {\n \n // If this input value is empty\n if ($(element).val() == \"\") {\n \n // All required fields is now false\n allRequiredFieldsSupplied = false;\n \n // Adding a warning class to any fields that are empty\n $(element).addClass(\"formWarning\");\n } else {\n \n // This input has a value. Removing the form warnin class (if it exists on the element)\n $(element).removeClass(\"formWarning\");\n }\n });\n\n console.log(\"allRequiredFieldsSupplied = \" + allRequiredFieldsSupplied);\n \n // Returning the boolean value which represents whether or not all form fields contained a value\n return allRequiredFieldsSupplied;\n}", "function checkRecipe(recipe) {\n for (key in recipe) {\n if (isStringEmptyOrNull(recipe[key])) {\n alert(\"Some fields are empty. Fill them, please\");\n return false;\n }\n }\n return true;\n}", "allValid() {\n for (var key in this.fields) {\n if( this.fieldValid(key) === false ) {\n return false;\n }\n }\n return true;\n }", "function CheckFields()\n{\n\tvar idx;\n\tfor (idx=1; idx<=3; ++idx) CheckBio(idx);\n\tfor (idx=1; idx<=proposalCnt; ++idx) \n\t{\n\t\tCheckProp(idx);\n\t}\n}", "allValid(){\n for (var key in this.fields) {\n if( this.fieldValid(key) === false ) {\n return false;\n }\n }\n return true;\n }", "function hasOnlyExtraFields(entryV4) {\n return (isAllStandardFieldsEmpty(entryV4) && (entryV4.extraSize > 0));\n}", "filled(fields) {\n for (let field of fields) {\n if (! truthy(this.form[field])) {\n return false\n }\n }\n\n return true\n }", "get hasMandatoryProperties() {\n let allExistAndValid = true; // assume all exist until proven otherwise\n\n // category must exist\n if (this.category === null) allExistAndValid = false;\n\n return allExistAndValid;\n }", "function empty(quote,fields){for(var i=0;i<fields.length;i++){var val=quote[fields[i]];if(typeof val!=\"undefined\")return false;}return true;}// Clean out \"zombie\" masterData entries. These would be entries that no longer have", "function missingFields(fields){\n let isMissing = false\n fields.forEach(field => {\n if(!field){\n isMissing = true\n }\n })\n return isMissing\n }", "function checkIntegrity(){\n // Recording directory\n if (!fs.existsSync(recDir)) {\n console.log('Recordings directory does not exist. Creating.');\n fs.mkdirSync(recDir, 0744);\n }\n initialMeta = JSON.stringify({\"recordings\":[]});\n // Metadata file\n if (!fs.existsSync(metadataFile)) {\n console.log('Metadata file does not exist. Creating.');\n fs.writeFileSync(metadataFile, initialMeta)\n }\n //Check whether metadata file is valid JSON and overwrite it if not\n try {\n var data = fs.readFileSync(metadataFile);\n JSON.parse(data);\n } catch(e) {\n console.log(\"Metadata file corrupted. Regenerating.\")\n fs.writeFileSync(metadataFile, initialMeta)\n }\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads new native crashes from disk and sends them to Sentry.
_sendNativeCrashes(extra) { return tslib_1.__awaiter(this, void 0, void 0, function* () { // Whenever we are called, assume that the crashes we are going to load down // below have occurred recently. This means, we can use the same event data // for all minidumps that we load now. There are two conditions: // // 1. The application crashed and we are just starting up. The stored // breadcrumbs and context reflect the state during the application // crash. // // 2. A renderer process crashed recently and we have just been notified // about it. Just use the breadcrumbs and context information we have // right now and hope that the delay was not too long. const uploader = this._uploader; if (uploader === undefined) { throw new utils_1.SentryError('Invariant violation: Native crashes not enabled'); } const currentCloned = core_1.Scope.clone(core_1.getCurrentHub().getScope()); const fetchedScope = this._scopeStore.get(); try { const storedScope = core_1.Scope.clone(fetchedScope); let newEvent = yield storedScope.applyToEvent({ extra }); if (newEvent) { newEvent = yield currentCloned.applyToEvent(newEvent); const paths = yield uploader.getNewMinidumps(); paths.map(path => { sdk_1.captureMinidump(path, Object.assign({}, newEvent)); }); } } catch (_oO) { utils_1.logger.error('Error while sending native crash.'); } }); }
[ "_nativeCrash() {\n Sentry.nativeCrash();\n }", "function manage_crash()\n {\n if (localStorage.last_update)\n {\n if (parseInt(localStorage.last_update) + (time_period * 2) < Date.now())\n {\n //seems a crash came! who knows!?\n //localStorage.clear();\n localStorage.removeItem('main_windows');\n localStorage.removeItem('actived_windows');\n localStorage.removeItem('active_window');\n localStorage.removeItem('last_update');\n location.reload();\n }\n }\n }", "function StoreCrashData(oCrashData)\n{\n// If not the parent frame, call this function on the parent\nif(window.parent != self && window.parent.StoreCrashData != null)\n{\nwindow.parent.StoreCrashData(oCrashData);\nreturn;\n}\n// Store the data here\nif(window.crashData == null)\n{\nwindow.crashData = new Array();\n}\n// In order to mitigate DoS attacks, there is a hard limit of reporting/storing 7 errors per page\nif(window.crashData.length < 7)\n{\nwindow.crashData.push(oCrashData);\n}\n}", "_installNativeHandler() {\n // We are only called by the frontend if the SDK is enabled and a valid DSN\n // has been configured. If no DSN is present, this indicates a programming\n // error.\n const dsnString = this._options.dsn;\n if (!dsnString) {\n throw new utils_1.SentryError('Invariant exception: install() must not be called when disabled');\n }\n const dsn = new utils_1.Dsn(dsnString);\n // We will manually submit errors, but CrashReporter requires a submitURL in\n // some versions. Also, provide a productName and companyName, which we will\n // add manually to the event's context during submission.\n electron_1.crashReporter.start({\n companyName: '',\n ignoreSystemCrashHandler: true,\n productName: this._options.appName || common_1.getNameFallback(),\n submitURL: uploader_1.MinidumpUploader.minidumpUrlFromDsn(dsn),\n uploadToServer: false,\n });\n // The crashReporter has an undocumented method to retrieve the directory\n // it uses to store minidumps in. The structure in this directory depends\n // on the crash library being used (Crashpad or Breakpad).\n const reporter = electron_1.crashReporter;\n const crashesDirectory = reporter.getCrashesDirectory();\n this._uploader = new uploader_1.MinidumpUploader(dsn, crashesDirectory, getCachePath());\n // Flush already cached minidumps from the queue.\n utils_1.forget(this._uploader.flushQueue());\n // Start to submit recent minidump crashes. This will load breadcrumbs and\n // context information that was cached on disk prior to the crash.\n utils_1.forget(this._sendNativeCrashes({}));\n // Every time a subprocess or renderer crashes, start sending minidumps\n // right away.\n electron_1.app.on('web-contents-created', (_, contents) => {\n contents.on('crashed', () => tslib_1.__awaiter(this, void 0, void 0, function* () {\n try {\n yield this._sendNativeCrashes(this._getRendererExtra(contents));\n }\n catch (e) {\n console.error(e);\n }\n core_1.addBreadcrumb({\n category: 'exception',\n level: types_1.Severity.Critical,\n message: 'Renderer Crashed',\n timestamp: new Date().getTime() / 1000,\n });\n }));\n if (this._options.enableUnresponsive !== false) {\n contents.on('unresponsive', () => {\n core_1.captureMessage('BrowserWindow Unresponsive');\n });\n }\n });\n return true;\n }", "catchErrors() {\n process.on('uncaughtException', (err = {}) => {\n const message = `${process.pid} dead | Memory: ${this.startMemory}%`;\n\n this.show.error(message, err.stack);\n this.ACTIONS.send(`${CONFIG.notification_service}.send`, { message });\n\n setTimeout(() => process.exit(1), 1000);\n });\n }", "function onFilesReady(crashlog, sourcemap, deployment) {\n deployment = JSON.parse(deployment);\n sourcemap = JSON.parse(sourcemap);\n crashlog = crashlog.toString('utf-8').split('\\n').join(' ');\n crashlog = crashlog.match(/==--~~==(.*?)==~~--==/gi);\n crashlog = crashlog.map(L => JSON.parse(L.substr(8, L.length - 16)));\n\n console.log(\"Deployment:\", deployment.commit);\n\n SourceMap.SourceMapConsumer.with(sourcemap, null, consumer => {\n if (hasArg([\"--latest\", \"-l\"]))\n crashlog = crashlog.slice(crashlog.length-1);\n for (var i = 0; i < crashlog.length; i++) {\n if (typeof(crashlog[i]) == typeof({}) && crashlog[i].stack && crashlog[i].message) {\n console.log(\"\\nStack trace: \");\n for (var j = crashlog[i].stack.length - 1; j >= 0; j--) {\n var frame = crashlog[i].stack[j];\n var location = consumer.originalPositionFor(frame);\n var actualLine = getActualLine(location.source, location.line);\n var trimmedLine = actualLine.trim();\n var trimmedCol = location.column - (actualLine.indexOf(trimmedLine));\n console.log(\"\\033[31m\" + actualLine.trim() + \"\\033[0m\");\n console.log(Array.from(new Array(trimmedCol), (v, i) => ' ').join(\"\") + Array.from(new Array(location.name ? location.name.length : 1), (v, i) => '^').join(\"\"));\n console.log(' ' + location.source + ':' + location.line + ':' + location.column + ' (' + frame.function + ')');\n console.log(\"=================\");\n }\n console.log(\"\\n\" + crashlog[i].message);\n } else {\n console.log(crashlog[i]);\n }\n }\n });\n}", "onChildAppCrashRestart () {\n\n }", "async _crashFileSave()\n\t{\n\t\ttry {\n\t\t\tconst content = JSON.stringify(this.sessions);\n\n\t\t\tawait fsPromises.writeFile(\n\t\t\t\tprocess.env.RECOVERY_FILE,\n\t\t\t\tcontent\n\t\t\t);\n\t\t}\n\t\tcatch(err) {\n\t\t\tthrow err;\n\t\t}\n\t}", "static enableCrashHandler() {\n\t\tTestFairyBridge.enableCrashHandler();\n\t}", "afterCrash() {\n }", "function _initUncaught() {\n process.on('uncaughtException', (err) => {\n log.fatal(_deviceName, 'A fatal uncaught exception occured.', err);\n setTimeout(() => {\n console.log('--FORCED EXIT--');\n console.log(err);\n console.log('--FORCED EXIT--');\n process.exit(1);\n }, RESTART_TIMEOUT);\n });\n }", "onSelectedBrowserCrash(browser, restartRequired) {\n if (!browser.isRemoteBrowser) {\n Cu.reportError(\"Selected crashed browser is not remote.\");\n return;\n }\n if (!browser.frameLoader) {\n Cu.reportError(\"Selected crashed browser has no frameloader.\");\n return;\n }\n\n let childID = browser.frameLoader.childID;\n let browserQueue = this.crashedBrowserQueues.get(childID);\n if (!browserQueue) {\n browserQueue = [];\n this.crashedBrowserQueues.set(childID, browserQueue);\n }\n // It's probably unnecessary to store this browser as a\n // weak reference, since the content process should complete\n // its teardown in the same tick of the event loop, and then\n // this queue will be flushed. The weak reference is to avoid\n // leaking browsers in case anything goes wrong during this\n // teardown process.\n browserQueue.push({browser: Cu.getWeakReference(browser),\n restartRequired});\n }", "function _startCorrupting() {\n console.profile(\"Brackets history corruption profile\");\n _counter = 1;\n _trytoCorrupt();\n }", "function onLaunchError() {\n\tconsole.log('launch error');\n}", "_installNativeHandler() {\n // We will manually submit errors, but CrashReporter requires a submitURL in\n // some versions. Also, provide a productName and companyName, which we will\n // add manually to the event's context during submission.\n electron_1.crashReporter.start({\n companyName: '',\n ignoreSystemCrashHandler: true,\n productName: this._options.appName || common_1.getNameFallback(),\n submitURL: '',\n uploadToServer: false,\n });\n return true;\n }", "function onLaunchError() {\n console.log('launch error');\n}", "function ghostCrash() {\n ghosts.crash(blob.getTile(), (eyesCounter, tile) => {\n let text = score.kill(eyesCounter);\n animations.ghostScore(text, tile);\n sounds.kill();\n }, () => {\n Board.clearGame();\n animations.death(blob, newLife);\n sounds.death();\n });\n }", "function monitorRestartFile(){\n fs.watchFile('./public/system/restart', function(curr, prev){\n util.log('Restart signal received, shutting down current instance...');\n gracefulShutdown();\n }); \n}", "listenErrorEvents() {\n process.on('uncaughtException', function (e) {\n \"use strict\";\n console.error(e)\n process.exit(0);\n });\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detect subsampling in loaded image. In iOS, larger images than 2M pixels may be subsampled in rendering.
function detectSubsampling( img ) { var iw = img.naturalWidth, ih = img.naturalHeight, canvas, ctx; // subsampling may happen overmegapixel image if ( iw * ih > 1024 * 1024 ) { canvas = document.createElement('canvas'); canvas.width = canvas.height = 1; ctx = canvas.getContext('2d'); ctx.drawImage( img, -iw + 1, 0 ); // subsampled image becomes half smaller in rendering size. // check alpha channel value to confirm image is covering // edge pixel or not. if alpha value is 0 // image is not covering, hence subsampled. return ctx.getImageData( 0, 0, 1, 1 ).data[ 3 ] === 0; } else { return false; } }
[ "function detectSubsampling( img ) {\n var iw = img.naturalWidth,\n ih = img.naturalHeight,\n canvas, ctx;\n \n // subsampling may happen overmegapixel image\n if ( iw * ih > 1024 * 1024 ) {\n canvas = document.createElement('canvas');\n canvas.width = canvas.height = 1;\n ctx = canvas.getContext('2d');\n ctx.drawImage( img, -iw + 1, 0 );\n \n // subsampled image becomes half smaller in rendering size.\n // check alpha channel value to confirm image is covering\n // edge pixel or not. if alpha value is 0\n // image is not covering, hence subsampled.\n return ctx.getImageData( 0, 0, 1, 1 ).data[ 3 ] === 0;\n } else {\n return false;\n }\n }", "function detectSubsampling( img ) {\n var iw = img.naturalWidth,\n ih = img.naturalHeight,\n canvas, ctx;\n\n // subsampling may happen overmegapixel image\n if ( iw * ih > 1024 * 1024 ) {\n canvas = document.createElement('canvas');\n canvas.width = canvas.height = 1;\n ctx = canvas.getContext('2d');\n ctx.drawImage( img, -iw + 1, 0 );\n\n // subsampled image becomes half smaller in rendering size.\n // check alpha channel value to confirm image is covering\n // edge pixel or not. if alpha value is 0\n // image is not covering, hence subsampled.\n return ctx.getImageData( 0, 0, 1, 1 ).data[ 3 ] === 0;\n } else {\n return false;\n }\n }", "function detectSubsampling (img) {\n var iw = img.naturalWidth\n var ih = img.naturalHeight\n if (iw * ih > 1024 * 1024) {\n // subsampling may happen over megapixel image\n var canvas = document.createElement('canvas')\n canvas.width = canvas.height = 1\n var ctx = canvas.getContext('2d')\n ctx.drawImage(img, -iw + 1, 0)\n // subsampled image becomes half smaller in rendering size.\n // check alpha channel value to confirm image is covering edge pixel or not.\n // if alpha value is 0 image is not covering, hence subsampled.\n return ctx.getImageData(0, 0, 1, 1).data[3] === 0\n } else {\n return false\n }\n}", "function detectSubsampling (img) {\n const iw = img.naturalWidth\n const ih = img.naturalHeight\n if (iw * ih > 1024 * 1024) { // subsampling may happen over megapixel image\n const canvas = document.createElement('canvas')\n canvas.width = canvas.height = 1\n const ctx = canvas.getContext('2d')\n ctx.drawImage(img, -iw + 1, 0)\n // subsampled image becomes half smaller in rendering size.\n // check alpha channel value to confirm image is covering edge pixel or not.\n // if alpha value is 0 image is not covering, hence subsampled.\n return ctx.getImageData(0, 0, 1, 1).data[3] === 0\n } else {\n return false\n }\n}", "function photo_detectSubsampling(img) {\n\t var iw = img.naturalWidth, ih = img.naturalHeight;\n\t if (iw * ih > 1024 * 1024) { // subsampling may happen over megapixel image\n\t\tvar canvas = document.createElement('canvas');\n\t\tcanvas.width = canvas.height = 1;\n\t\tvar ctx = canvas.getContext('2d');\n\t\tctx.drawImage(img, -iw + 1, 0);\n\t\t// subsampled image becomes half smaller in rendering size.\n\t\t// check alpha channel value to confirm image is covering edge pixel or not.\n\t\t// if alpha value is 0 image is not covering, hence subsampled.\n\t\treturn ctx.getImageData(0, 0, 1, 1).data[3] === 0;\n\t } else {\n\t\treturn false;\n\t }\n }", "function detectSubsampling(img, width, height) {\n\t\tif (!detectionContext()) {\n\t\t\treturn false;\n\t\t}\n\t\t// sub sampling happens on images above 1 megapixel\n\t\tif (width * height <= 1024 * 1024) {\n\t\t\treturn false;\n\t\t}\n\t\t// set canvas to 1x1 pixel size and fill it with magenta color\n\t\tcanvas.width = canvas.height = 1;\n\t\tcontext.fillStyle = '#FF00FF';\n\t\tcontext.fillRect(0, 0, 1, 1);\n\t\t// render the image with a negative offset to the left so that it would\n\t\t// fill the canvas pixel with the top right pixel of the image.\n\t\tcontext.drawImage(img, -width + 1, 0);\n\t\t// check color value to confirm image is covering edge pixel or not.\n\t\t// if color still magenta, the image is assumed to be sub sampled.\n\t\ttry {\n\t\t\tvar dat = context.getImageData(0, 0, 1, 1).data;\n\t\t\treturn (dat[0] === 255) && (dat[1] === 0) && (dat[2] === 255);\n\t\t} catch (err) {\n\t\t\t// avoids cross origin exception for chrome when code runs without a server\n\t\t\treturn false;\n\t\t}\n\t}", "sample(source, scale) {\n // Calculate the exact level required to represent the image at the\n // scale. This will be fractional, e.g. 8.6 rather than an integer\n let exactLvl = log2(Math.max(this.width(), this.height()) * scale);\n\n // Choose the nearest resolution level >= the desired level so that we\n // can always downscale the tiles, rather than upscale which would\n // obviously loose quality.\n let bestLvl = Math.ceil(exactLvl);\n\n // If the exact scale does not match one of the fixed integer levels we\n // have image samples at we'll need to do additional scaling after we\n // have the tiles at the next-larger level. This is the amount we'll\n // need to scale down the tiles by when rendering to match the requested\n // scale.\n let remainingScale = exactLvl / bestLvl;\n assert(remainingScale > 0 && remainingScale <= 1);\n\n let bestLvlScale = Math.pow(2, bestLvl) / Math.max(this.width(), this.height());\n let target = source.scale(bestLvlScale).roundOut();\n\n let startCol = Math.floor(target.left / this.tileSize);\n let colCount = Math.floor(target.right / this.tileSize) + 1 - startCol;\n\n let startRow = Math.floor(target.top / this.tileSize);\n let rowCount = Math.floor(target.bottom / this.tileSize) + 1 - startRow;\n\n\n return new Sample(\n // Area of interest inside the total area covered by this sample's\n // tiles.\n new Rect(\n target.x % this.tileSize, target.y % this.tileSize,\n target.width, target.height),\n bestLvl,\n remainingScale,\n this.tileSize,\n new Rect(startCol, startRow, colCount, rowCount)\n );\n }", "function computeFullSampleSize(blob, width, height) {\n if (blob.type !== 'image/jpeg') {\n // We're not using #-moz-samplesize at all\n return Downsample.NONE;\n }\n\n // Determine the maximum size we will decode the image at, based on\n // device memory and the maximum size passed to the constructor.\n var max = MediaFrame.maxImageDecodeSize || 0;\n if (self.maximumImageSize && (max === 0 || self.maximumImageSize < max)) {\n max = self.maximumImageSize;\n }\n\n if (!max || width * height <= max) {\n return Downsample.NONE;\n }\n\n return Downsample.areaAtLeast(max / (width * height));\n }", "fits(img) {\r\n return img.width < this.canvas.width && img.height < this.canvas.height\r\n }", "function checkSubImages(){\r\n subImage.forEach(img => {\r\n if(img.src == mainImage.src){\r\n img.style.filter = 'grayscale(0)';\r\n } else {\r\n img.style.filter = 'grayscale(100%)';\r\n }\r\n })\r\n}", "function sampArrImg(arrImg) {\n var point = ee.Geometry.Point([-121, 42]);\n return arrImg.sample(point, 500).first().get('array');\n}", "function splitImage(image){\n image.onload = function () {\n var resultCanvas = document.getElementById('result-canvas');\n resultCanvas.width = image.width;\n resultCanvas.height = image.height;\n resultContext = resultCanvas.getContext('2d');\n\n const numRows = Math.round(image.height/TILE_HEIGHT);\n const numTilePerRow = Math.round(image.width/TILE_WIDTH);\n for(var row = 0; row < numRows; ++row){\n var tiles = [];\n for(var col = 0; col < numTilePerRow; ++col){\n var canvas = document.createElement('canvas');\n canvas.width = TILE_WIDTH;\n canvas.height = TILE_HEIGHT;\n var context = canvas.getContext('2d');\n context.drawImage(image, col * TILE_WIDTH, row * TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT, 0, 0, TILE_WIDTH, TILE_HEIGHT);\n tiles.push({\n imageUrl : canvas.toDataURL(),\n x : col * TILE_WIDTH,\n y : row * TILE_HEIGHT\n });\n }\n if(tiles.length > 0){\n createMosaic(tiles);\n }\n }\n }\n}", "get oversample() {\n return this._shaper.oversample;\n }", "function subsampleTensorImages(tensor,\n oldWidth,\n oldHeight,\n newWidth,\n newHeight,\n numImages) {\n const subSet = tensor.slice([0,0], [numImages]).\n as4D(numImages, oldHeight, oldWidth, 1);\n return subSet.resizeBilinear([newHeight, newWidth]).\n reshape([numImages, newWidth*newHeight]);\n}", "sample(batchSize) {\n return getRandomSubarray(this.memory, batchSize);\n }", "function imageLoaded7(){\n var canvas = document.getElementById(\"conv_image5\");\n var ctx = canvas.getContext(\"2d\");\n\n canvas.width = image6.width;\n canvas.height = image6.height;\n\n ctx.drawImage(image6, 0, 0, image6.width, image6.height)\n\n //segmentation\n bin2(canvas);\n}", "getRandomImageSlice(w, h) {\n return {\n 'sx': Math.floor((this.image.width - w) * Math.random()),\n 'sy': Math.floor((this.image.height - h) * Math.random()),\n 'sw': w,\n 'sh': h,\n };\n }", "function cutImageUp(img) {\n var columns = img.width / TILE_WIDTH;\n console.log(columns/100);\n var rows = img.height / TILE_HEIGHT;\nloader.innerHTML = \"Slicing up the images into \"+columns*rows+\" pieces\";\n for(var y = 0; y < rows; ++y) {\n var imagePiecesRow = [];\n for(var x = 0; x < columns; ++x) {\n var canvas = document.createElement('canvas');\n canvas.width = TILE_WIDTH;\n canvas.height = TILE_HEIGHT;\n var context = canvas.getContext('2d');\n context.drawImage(img, x * TILE_WIDTH, y * TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT, 0, 0, canvas.width, canvas.height);\n imagePiecesRow.push({\"img\" : canvas.toDataURL(),\n \"left\" : x * TILE_WIDTH,\n \"top\" : y * TILE_HEIGHT\n });\n }//end of colums for loop\n //drawMosaic for every row.\n if(imagePiecesRow.length > 0){\n drawMosaic(imagePiecesRow);\n }\n }//end of row for loop\n}//end of cutImageUp", "crop(stitched) {\n if (this.debug) console.time(\"cropping\");\n const wid = stitched.width;\n const hei = stitched.height;\n const tl = this.tileLocations;\n const bindUL = [this.west - tl.UL[1], -(this.north - tl.UL[0])];\n const bndLR = [this.east - tl.UL[1], -(this.south - tl.UL[0])];\n const dimT = [tl.LR[1] - tl.UL[1], -(tl.LR[0] - tl.UL[0])];\n let pxUL = [wid * (bindUL[0] / dimT[0]), hei * (bindUL[1] / dimT[1])];\n let pxLR = [wid * (bndLR[0] / dimT[0]), hei * (bndLR[1] / dimT[1])];\n pxUL = [Math.round(pxUL[0]), Math.round(pxUL[1])];\n pxLR = [Math.round(pxLR[0]), Math.round(pxLR[1])];\n const extraction = stitched.subset(\n pxUL[0],\n pxUL[1],\n pxLR[0] - pxUL[0],\n pxLR[1] - pxUL[1]\n );\n if (this.debug) console.timeEnd(\"cropping\");\n return extraction;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new `AWS::WAFv2::IPSet`.
constructor(scope, id, props) { super(scope, id, { type: CfnIPSet.CFN_RESOURCE_TYPE_NAME, properties: props }); try { jsiiDeprecationWarnings.aws_cdk_lib_aws_wafv2_CfnIPSetProps(props); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, CfnIPSet); } throw error; } cdk.requireProperty(props, 'addresses', this); cdk.requireProperty(props, 'ipAddressVersion', this); cdk.requireProperty(props, 'scope', this); this.attrArn = cdk.Token.asString(this.getAtt('Arn', cdk.ResolutionTypeHint.STRING)); this.attrId = cdk.Token.asString(this.getAtt('Id', cdk.ResolutionTypeHint.STRING)); this.addresses = props.addresses; this.ipAddressVersion = props.ipAddressVersion; this.scope = props.scope; this.description = props.description; this.name = props.name; this.tags = new cdk.TagManager(cdk.TagType.STANDARD, "AWS::WAFv2::IPSet", props.tags, { tagPropertyName: 'tags' }); }
[ "ipSets(index) {\n return new GlobalacceleratorAcceleratorIpSets(this, 'ip_sets', index);\n }", "function IP(){\n\t\t// start by instantiating a blank object\n\t\tthis._bits = gen32bitZeroArray();\n\t\t\n\t\t// if an argument was passed, try init the object with it\n\t\tif(arguments.length >= 1){\n\t\t\tthis.parse(arguments[0]);\n\t\t}\n\t}", "async function createPublicIPAddressAllocationMethod() {\n const subscriptionId = process.env[\"NETWORK_SUBSCRIPTION_ID\"] || \"subid\";\n const resourceGroupName = process.env[\"NETWORK_RESOURCE_GROUP\"] || \"rg1\";\n const publicIpAddressName = \"test-ip\";\n const parameters = {\n idleTimeoutInMinutes: 10,\n location: \"eastus\",\n publicIPAddressVersion: \"IPv4\",\n publicIPAllocationMethod: \"Static\",\n sku: { name: \"Standard\", tier: \"Global\" },\n };\n const credential = new DefaultAzureCredential();\n const client = new NetworkManagementClient(credential, subscriptionId);\n const result = await client.publicIPAddresses.beginCreateOrUpdateAndWait(\n resourceGroupName,\n publicIpAddressName,\n parameters\n );\n console.log(result);\n}", "function createPublicIP(resourceGroupName, publicIPName, callback) {\n var publicIPParameters = {\n location: location,\n publicIPAllocationMethod: 'Dynamic',\n dnsSettings: {\n domainNameLabel: domainNameLabel\n }\n };\n console.log('\\n4.Creating public IP: ' + publicIPName);\n return networkClient.publicIPAddresses.createOrUpdate(resourceGroupName, publicIPName, publicIPParameters, callback);\n}", "function IpPermission() {\n _classCallCheck(this, IpPermission);\n\n IpPermission.initialize(this);\n }", "function createStunRequest() {\n // Create the offer that exposes the IP addresses.\n return createdConnection.createOffer().then(sdp => createdConnection.setLocalDescription(sdp));\n }", "function cfnIPSetPropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnIPSetPropsValidator(properties).assertSuccess();\n return {\n Name: cdk.stringToCloudFormation(properties.name),\n IPSetDescriptors: cdk.listMapper(cfnIPSetIPSetDescriptorPropertyToCloudFormation)(properties.ipSetDescriptors),\n };\n}", "function SnippetSet() {\n this.snippetCollection = [];\n this.operationLog = [];\n this.maxLenSec = 0;\n this.minLenSec = 0;\n this.avgLenSec = 0;\n this.numSnippets = 0;\n this.creationDate = new DateStrings();\n this.setName = \"Unknown-\"\n + this.creationDate.year + \"-\"\n + this.creationDate.month + \"-\"\n + this.creationDate.day;\n this.tagsInSet = [];\n this.zip = null;\n}", "static get(name, id, state, opts) {\n return new IPSet(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }", "constructor() {\n super(Vip);\n }", "async function createPublicIPAddressDefaults() {\n const subscriptionId = process.env[\"NETWORK_SUBSCRIPTION_ID\"] || \"subid\";\n const resourceGroupName = process.env[\"NETWORK_RESOURCE_GROUP\"] || \"rg1\";\n const publicIpAddressName = \"test-ip\";\n const parameters = { location: \"eastus\" };\n const credential = new DefaultAzureCredential();\n const client = new NetworkManagementClient(credential, subscriptionId);\n const result = await client.publicIPAddresses.beginCreateOrUpdateAndWait(\n resourceGroupName,\n publicIpAddressName,\n parameters\n );\n console.log(result);\n}", "function InstructionSet6502()\n{\n this.set = new Array(INSTRUCTION_COUNT);\n \n this.set[169] = new Instruction(krnLoadAcc,1);\n this.set[173] = new Instruction(krnLoadAcc,2);\n this.set[141] = new Instruction(krnStoreAcc,2);\n this.set[109] = new Instruction(krnAddWithCarry,2);\n this.set[162] = new Instruction(krnLoadX,1);\n this.set[174] = new Instruction(krnLoadX,2);\n this.set[160] = new Instruction(krnLoadY,1);\n this.set[172] = new Instruction(krnLoadY,2);\n this.set[234] = new Instruction(krnNOP,0);\n this.set[0] = new Instruction(krnBreakProcess,0);\n this.set[236] = new Instruction(krnCompareX,2);\n this.set[208] = new Instruction(krnBranchNotEqual,1);\n this.set[238] = new Instruction(krnIncrementByte,2);\n this.set[255] = new Instruction(krnSystemCall,0);\n \n}", "constructor(ip, netmask) {\n if (typeof ip !== 'string') {\n throw new Error('Missing ip')\n }\n if (!netmask) {\n [ip, netmask] = ip.split('/', 2)\n }\n if (!netmask) {\n throw new Error(`Invalid ip address: ${ip}`)\n }\n\n if (netmask) {\n this.bitmask = parseInt(netmask, 10)\n this.maskLong = 0\n if (this.bitmask > 0) {\n this.maskLong = (0xffffffff << (32 - this.bitmask)) >>> 0\n }\n } else {\n throw new Error('Invalid netmask: empty')\n }\n \n if (isNaN(this.bitmask) || this.bitmask > 32 || this.bitmask < 0) {\n throw new Error(`Invalid netmask: ${netmask}`)\n }\n\n try {\n this.netLong = (ipTolong(ip) & this.maskLong) >>> 0\n } catch (err) {\n throw new Error(`Invalid ip address: ${ip}`)\n }\n\n this.ip = ip\n this.cidr = `${ip}/${this.bitmask}`\n this.size = Math.pow(2, 32 - this.bitmask)\n this.netmask = longToIp(this.maskLong)\n\n // The host netmask, the opposite of the netmask (eg.: 0.0.0.255)\n this.hostmask = longToIp(~this.maskLong)\n\n this.first = longToIp(this.netLong)\n this.last = longToIp(this.netLong + this.size - 1)\n }", "async function networkTapsCreateMaximumSetGen() {\n const subscriptionId =\n process.env[\"MANAGEDNETWORKFABRIC_SUBSCRIPTION_ID\"] || \"1234ABCD-0A1B-1234-5678-123456ABCDEF\";\n const resourceGroupName = process.env[\"MANAGEDNETWORKFABRIC_RESOURCE_GROUP\"] || \"example-rg\";\n const networkTapName = \"example-networkTap\";\n const body = {\n annotation: \"annotation\",\n destinations: [\n {\n name: \"example-destinaionName\",\n destinationId:\n \"/subscriptions/1234ABCD-0A1B-1234-5678-123456ABCDEF/resourcegroups/example-rg/providers/Microsoft.ManagedNetworkFabric/l3IsloationDomains/example-l3Domain/internalNetworks/example-internalNetwork\",\n destinationTapRuleId:\n \"/subscriptions/xxxx-xxxx-xxxx-xxxx/resourcegroups/example-rg/providers/Microsoft.ManagedNetworkFabric/networkTapRules/example-destinationTapRule\",\n destinationType: \"IsolationDomain\",\n isolationDomainProperties: {\n encapsulation: \"None\",\n neighborGroupIds: [\n \"/subscriptions/1234ABCD-0A1B-1234-5678-123456ABCDEF/resourcegroups/example-rg/providers/Microsoft.ManagedNetworkFabric/neighborGroups/example-neighborGroup\",\n ],\n },\n },\n ],\n location: \"eastuseuap\",\n networkPacketBrokerId:\n \"/subscriptions/1234ABCD-0A1B-1234-5678-123456ABCDEF/resourcegroups/example-rg/providers/Microsoft.ManagedNetworkFabric/networkPacketBrokers/example-networkPacketBroker\",\n pollingType: \"Pull\",\n tags: { key6024: \"1234\" },\n };\n const credential = new DefaultAzureCredential();\n const client = new AzureNetworkFabricManagementServiceAPI(credential, subscriptionId);\n const result = await client.networkTaps.beginCreateAndWait(\n resourceGroupName,\n networkTapName,\n body\n );\n console.log(result);\n}", "function ImageSet(icon) {\n this.icon_ = utils.Map.wrap(icon);\n this.size_ = null;\n }", "function cfnIPSetIPSetDescriptorPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnIPSet_IPSetDescriptorPropertyValidator(properties).assertSuccess();\n return {\n Type: cdk.stringToCloudFormation(properties.type),\n Value: cdk.stringToCloudFormation(properties.value),\n };\n}", "function createInset() {\n let inset = new Inset();\n insets.push(inset);\n}", "async function createPublicIPAddressDefaults() {\n const credential = new DefaultAzureCredential();\n const client = createNetworkManagementClient(credential);\n const subscriptionId = \"\";\n const resourceGroupName = \"rg1\";\n const publicIpAddressName = \"test-ip\";\n const options = {\n body: { location: \"eastus\" },\n queryParameters: { \"api-version\": \"2022-05-01\" },\n };\n const initialResponse = await client\n .path(\n \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}\",\n subscriptionId,\n resourceGroupName,\n publicIpAddressName\n )\n .put(options);\n const poller = getLongRunningPoller(client, initialResponse);\n const result = await poller.pollUntilDone();\n console.log(result);\n}", "create(arg) {\n return this.httpClient\n .url(`/ip_restrictions`)\n .post(util.serializeArgument(arg))\n .json(payload => util.deserializeResult(payload))\n .then(f => f, util.onRejected);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The default calipso form object, with default configuration values. Constructor
function CalipsoForm() { // TODO - tagStyle should also affect whether attributes can be minimised ('selected' vs. 'selected="selected"') // tagStyle should be one of [html, xhtml, xml] this.tagStyle = "html"; // adjust the way tags are closed based on the given tagStyle. this.tagClose = this.tagStyle == "html" ? '>' : ' />'; // cheap way of ensuring unique radio ids this.radioCount = 0; }
[ "function FormDefault( ){\n\tthis.xpath = \"\";\n\tthis.names = new Array();\n\tthis.values = new Array();\n\t\n\tthis.addName = function(x) {\n\t\tthis.names.push(x);\n\t}\n\t\n\tthis.addValue = function(x) {\n\t\tthis.values.push(x);\n\t}\n}", "function _form_new(base, doc, caller, data) { _form.apply(this, arguments); }", "function EBX_Form() {}", "function BaseForm() {\n Base.apply(this, arguments);\n }", "initForm() {\n if (!this._font) {\n throw new Error('Must set a font before calling initForm method');\n }\n this._acroform = {\n fonts: {},\n defaultFont: this._font.name\n };\n this._acroform.fonts[this._font.id] = this._font.ref();\n\n let data = {\n Fields: [],\n NeedAppearances: true,\n DA: new String(`/${this._font.id} 0 Tf 0 g`),\n DR: {\n Font: {}\n }\n };\n data.DR.Font[this._font.id] = this._font.ref();\n const AcroForm = this.ref(data);\n this._root.data.AcroForm = AcroForm;\n return this;\n }", "function init( config ) {\n\t\t// IGNORE option keys auto-generated by setFieldConfig()\n\t\tmerge(formConfig, omit(config, ['fields', 'fieldAliasMap']))\n\n\t\t// Add all default config data\n\t\tdefaultsDeep(formConfig, defaultFormConfig)\n\t\tdefaults(formConfig.formatters, defaultFormatters)\n\t\tdefaults(formConfig.validators, defaultValidators)\n\t\tdefaults(formConfig.converters, defaultConverters)\n\t\tdefaults(formConfig.errorMessages, defaultErrorMessages)\n\n\t\t// Now configure each form-field\n\t\tif (config.fields) {\n\t\t\tsetFieldsConfig(config.fields)\n\t\t}\n\t}", "function ContactForm(){\r\n\t\tthis.view = null;\r\n\t\tthis.backLink = null;\r\n\t\tthis.form = null;\r\n\t\tthis.errors = null;\r\n\t\tthis.fields = {\r\n\t\t\tid: null,\r\n\t\t\tname: null,\r\n\t\t\tphone: null,\r\n\t\t\temail: null\r\n\t\t};\r\n\t\tthis.cancelLink = null;\r\n\t}", "constructor(props) {\n super(props);\n this.formName = 'interface-login';\n this.formClass = 'interface-login';\n this.formID = 'interface-login';\n this.formType = 'POST';\n }", "static get defaultOptions () {\n\t\treturn mergeObject(super.defaultOptions, {\n\t\t\tid : 'polyglot-language-form',\n\t\t\ttitle : 'Polyglot Language Settings',\n\t\t\ttemplate : './modules/polyglot/templates/settings.hbs',\n\t\t\tclasses : ['sheet'],\n\t\t\twidth : 640,\n\t\t\theight : \"auto\",\n\t\t\tcloseOnSubmit: true\n\t\t})\n\t}", "function ExampleFormComponent() {\n var _this = _super.call(this) || this;\n _this.email = \"\";\n _this.password = \"\";\n _this.rememberMe = false;\n if (typeof _this.data === 'string') {\n _this.data = JSON.parse(_this.data);\n }\n _this.data = (_this.data) ? _this.data : {};\n _this.title = (_this.title) ? _this.title : 'Welcome!';\n return _this;\n }", "static get defaultOptions() {\n\t\treturn mergeObject(super.defaultOptions, {\n\t\t\tid: \"party-overview-form\",\n\t\t\ttitle: \"Party Overview System Settings\",\n\t\t\ttemplate: \"./modules/party-overview/templates/SystemProviderSettings.hbs\",\n\t\t\tclasses: [\"sheet\"],\n\t\t\twidth: 600,\n\t\t\tcloseOnSubmit: true,\n\t\t});\n\t}", "static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: \"mountup-settings-form\",\r\n title: \"Mount Up! - Settings\",\r\n template: \"./modules/mountup/templates/settings.html\",\r\n classes: [\"sheet\"],\r\n width: 500,\r\n closeOnSubmit: true\r\n });\r\n }", "inicializarFormulario() {\n this.tablaLineasVentas.clearData();\n $('#venta-cliente').selectedIndex = 0;\n M.FormSelect.init($('#venta-cliente'));\n $('#venta-paga').value = '';\n $('#venta-adeuda').value = '';\n $('#venta-total').value = '';\n $('#venta-iva').value = '';\n $('#venta-paga').value = '';\n }", "function FormView() {\n\t\n\t//oFormFields is JSON Object like: \t\n\t//\t{\n\t//\t\t\"subform_0\": {\n\t//\t\t\t\"cred_id\": \"tm\",\n\t//\t\t\t\"form_ID\": \"91\",\n\t//\n\t//\t\t},\n\t//\t\t\"subform_1\": {\n\t//\t\t\t\"page_num_02\": \"\",\n\t//\t\t\t\"doc_number_01\": \"\",\n\t//\t\t\t\"file_number_01\": \"\",\n\t//\n\t//\t\t},\n\t//\t\t\"subform_2\": {\n\t//\t\t\t\"save\": \"\",\n\t//\t\t\t\"review\": \"\",\n\t//\t\t\t\"complete\": \"\",\n\t//\t\t\t\"page_num_03\": \"\",\n\t//\t\t}\n\t//\t}\t\n\t\t\n\t\n\t\n\tthis.oFormFields = {}; \n\t\n\tthis.oRequiredField = {};\n\t\n\tthis.oLabel = {};\n\t\n\tthis.oReadOnlyField = {};\n\t\n\tthis.oImageField = {};\n\t\n\tthis.oMapOption = null;\n\t\n\tthis.oInitMapCentre = null;\n\t\n\tthis.getFormFields = function() {\n\t\treturn this.oFormFields;\n\t};\n\t\n\tthis.setFormFields = function(oFields) {\n\t\tthis.oFormFields = oFields;\n\t};\n\t\n\tthis.getRequiredField = function() {\n//\t\tconsole.log(\"this.oRequiredField: \" + Array.isArray(this.oRequiredField));\n\t\treturn this.oRequiredField;\n\t};\n\t\n\tthis.setRequiredField = function(oFields) {\n//\t\tconsole.log(\"oFields: \" + Array.isArray(oFields));\n\t\tthis.oRequiredField = oFields;\n\t};\t\n\t\n\tthis.getLabelFields = function() {\n\t\treturn this.oLabel;\n\t};\n\t\n\tthis.setLabelFields = function(obj) {\n//\t\tconsole.log(\"oFields: \" + Array.isArray(oFields));\n\t\tthis.oLabel = obj;\n\t};\t\n\t\n\tthis.getReadOnlyFields = function() {\n\t\treturn this.oReadOnlyField;\n\t};\n\t\n\tthis.setReadOnlyFields = function(oFields) {\n\t\tthis.oReadOnlyField = oFields;\n\t\tenableReadOnlyFields(oFields);\n\t};\n\t\n\tthis.setImageField = function(obj) {\n\t\tthis.oImageField = obj;\n\t}\n\t\n\tthis.getImageField = function() {\n\t\treturn this.oImageField;\n\t}\t\n\t\n\tthis.setMapOption = function(obj) {\n\t\tthis.oMapOption = obj;\n\t}\n\t\n\tthis.getMapOption = function() {\n\t\treturn this.oMapOption;\n\t} \n\t\n\tthis.setInitMapCentre = function(obj) {\n\t\tthis.oInitMapCentre = obj;\n\t}\n\t\n\tthis.getInitMapCentre = function() {\n\t\treturn this.oInitMapCentre;\n\t} \t\n\t\n\tthis.putFieldValue = function(sField, iSubform, value) {\n\t\tvar subformName = \"subform_\" + iSubform;\n\t\t//Modification to avoide error \"Cannot set property 'complete_flag' of undefined\"\n\t\tif (this.oFormFields[subformName] && this.oFormFields[subformName][sField]) {\n\t\t\tthis.oFormFields[subformName][sField] = value;\n\t\t}\n\t}\n\n\tthis.getFieldValue = function(sField, iSubform) {\n\t\tvar subformName = \"subform_\" + iSubform;\n\t\treturn\tthis.oFormFields[subformName][sField];\t\n\t}\n\n\t//Update some field value in subform[0] by oList which is JSON object. For instance,\n\t//\tvar oList = {\n\t//\t\t\t\"app_password2\" : \t\"31035aaca4\",\n\t//\t\t\t\"super_password2\":\t\"31035aaca4\"\n\t//\t}\n\t\n\tthis.updateFormFields = function(oList) { \n\t\tfor(var key in oList) {\n\t\t\tthis.putFieldValue(key, 0, oList[key]);\n\t\t}\n\t}\n\t\t\n}", "createForms(){\n utils.createForms(this,false);\n }", "static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: 'turnmarker-settings-form',\n title: 'Turn Marker - Global Settings',\n template: './modules/turnmarker/templates/settings.html',\n classes: ['sheet', 'tm-settings'],\n width: 500,\n closeOnSubmit: true\n });\n }", "function Form() {\n DataExtractor.call(this);\n}", "function settingForm(){\n\n\t\t//Constructor\n\t\tfunction $create (o) {\n\t\t\tvar tn = o.tagName;\n\t\t\tvar x = document.createElement(tn);\n\t\t\tfor (var i in o) if (i!='tagName'&&typeof(o[i])!='function') x.setAttribute(i, o[i]);\n\t\t\treturn x;\n\t\t}\n\n\t\tvar langRef = setdefaultLang();\n\t\tvar div = $create({tagName:'div', id:userPrefix, class:userPrefix});\n\n\t\tvar fieldsetContent = $create( {tagName:'div', class:userPrefix+'-'+config.FormFieldsetContent.classSetting});\n\t\t\n\t\t// set modale\n\t\tif( global.userParams.Modal == true || global.userParams.Modal === undefined) {\t\t\t\n\t\t\t//modale\n\t\t\tdiv.setAttribute( 'role', 'dialog' );\n\t\t\tdiv.setAttribute( 'aria-labelledby', userPrefix+'-'+config.ModalContainer.titleId );\n\t\t\tdiv.setAttribute( 'tabindex', '-1' );\n\t\t\tglobal.userParams.ContainerClass ? div.classList.add( userPrefix+'-'+global.userParams.ContainerClass ) : \n\t\t\t\t\t\t\t\t\t\t div.classList.add( userPrefix+'-'+config.ModalContainer.classSetting );\n\t\t\t//title\n\t\t\tvar titleWindow = $create({tagName:'h1', id:userPrefix+'-'+config.ModalContainer.titleId});\n\t\t\tglobal.userParams.ModalTitle ? titleWindow.classList.add( userPrefix+global.userParams.ModalTitle ) : \n\t\t\t\t\t\t\t\t\t\t titleWindow.classList.add( userPrefix+'-'+config.ModalContainer.titleClass );\n\t\t\tvar titleTxt = document.createTextNode( config.ModalContainer.titleLang[ langRef ]);\n\t\t\ttitleWindow.appendChild( titleTxt );\n\t\t\tdiv.appendChild( titleWindow );\n\t\t\t//Close button\n\t\t\tvar CClose = $create({tagName:'button', type:'button',id:userPrefix+'-'+config.CloseButton.id});\n\t\t\tglobal.userParams.ModalCloseButton ? CClose.classList.add( userPrefix+global.userParams.ModalCloseButton ) :\n\t\t\t\t\t\t\t\t\t\t\t\t CClose.classList.add( userPrefix+'-'+config.CloseButton.classSetting );\n\t\t\tvar SpanHidden = $create({tagName:'span', class:config.CloseButton.hiddenTextClass});\n\t\t\tvar CloseTxt = document.createTextNode( config.CloseButton.lang[ langRef ]);\n\t\t\tSpanHidden.appendChild( CloseTxt );\n\t\t\tCClose.appendChild( SpanHidden );\n\t\t\tdiv.appendChild( CClose );\n\t\t\tdiv.appendChild(fieldsetContent);\n\t\t}\n\t\telse {\n\t\t\t//Inline form \n\t\t\tvar setupdiv = document.getElementById( config.Setup.id );\n\t\t\tsetupdiv.appendChild(div);\n\t\t\tdiv.classList.add( userPrefix+'accessconfig-inline');\n\t\t\tdiv.appendChild(fieldsetContent);\n\t\t}\n\n\t\t/**\n\t\tContrast features\n\t\t**/\n\n\t\tif(global.userParams.Contrast != false){\n\n\t\t\tvar fieldset = $create({tagName:'fieldset', id:userPrefix+'-'+config.ContrastFieldset.id});\n\t\t\tvar legend = document.createElement( 'legend' );\n\t\t\tvar legendText = document.createTextNode( config.ContrastLegend.lang[ langRef ] );\n\t\t\tlegend.appendChild( legendText );\n\t\t\tfieldset.appendChild( legend );\n\n\t\t\t/**Default option**/\n\t\t\tvar CInput = $create({tagName:'input', type:'radio', checked:'checked', id:userPrefix+'-'+config.DefaultContrastCheckbox.id, value:userPrefix+'-'+config.DefaultContrastCheckbox.value, name:userPrefix+'-'+config.DefaultContrastCheckbox.groupName});\n\t\t\tvar CLabel = $create({tagName:'label', for:userPrefix+'-'+config.DefaultContrastCheckbox.id});\n\t\t\tvar defaultCText = document.createTextNode ( config.DefaultContrastCheckbox.lang[ langRef ] );\n\t\t\tCLabel.appendChild( defaultCText );\n\t\t\tfieldset.appendChild( CInput );\n\t\t\tfieldset.appendChild( CLabel );\n\n\t\t\t/**Alterntative option 1 : higher contrast**/\n\t\t\tif( config.Setting.useExtendContrast ) {\n\t\t\t\tvar CInput = $create({tagName:'input', type:'radio', id:userPrefix+'-'+config.HighContrastCheckbox.id , value:userPrefix+'-'+config.HighContrastCheckbox.value, name:userPrefix+'-'+config.HighContrastCheckbox.groupName});\n\t\t\t\tvar CLabel = $create({tagName:'label', for:userPrefix+'-'+config.HighContrastCheckbox.id});\n\t\t\t\tvar defaultCText = document.createTextNode ( config.HighContrastCheckbox.lang[ langRef ] );\n\t\t\t\tCLabel.appendChild( defaultCText );\n\t\t\t\tfieldset.appendChild( CInput );\n\t\t\t\tfieldset.appendChild( CLabel );\n\t\t\t}\n\n\t\t\t/**Alterntative option 2 : inverted contrast**/\n\t\t\tvar CInput = $create({tagName:'input', type:'radio', id:userPrefix+'-'+config.InvertContrastCheckbox.id, value:userPrefix+'-'+config.InvertContrastCheckbox.value, name:userPrefix+'-'+config.InvertContrastCheckbox.groupName});\n\t\t\tvar CLabel = $create({tagName:'label', for:userPrefix+'-'+config.InvertContrastCheckbox.id});\n\t\t\tvar defaultCText = document.createTextNode ( config.InvertContrastCheckbox.lang[ langRef ] );\n\t\t\tCLabel.appendChild( defaultCText );\n\t\t\tfieldset.appendChild( CInput );\n\t\t\tfieldset.appendChild( CLabel );\n\t\t\tfieldsetContent.appendChild( fieldset );\n\t\t}\n\n\t\t/**\n\t\tFont feature\n\t\t**/\n\n\t\tif(global.userParams.Font != false){\n\t\t\tvar fieldset = $create({tagName:'fieldset', id:userPrefix+'-'+config.DyslexiaFieldset.id});\n\t\t\tvar legend = document.createElement( 'legend' );\n\t\t\tvar legendText = document.createTextNode( config.DyslexiaLegend.lang[ langRef ] );\n\t\t\tlegend.appendChild( legendText );\n\t\t\tfieldset.appendChild( legend );\n\n\t\t\t/**Default option**/\n\t\t\tvar CInput = $create({tagName:'input', type:'radio', checked:'checked', id:userPrefix+'-'+config.DefaultFontCheckbox.id, value:userPrefix+'-'+config.DefaultFontCheckbox.value, name:userPrefix+'-'+config.DefaultFontCheckbox.groupName});\n\t\t\tvar CLabel = $create({tagName:'label', for:userPrefix+'-'+config.DefaultFontCheckbox.id});\n\t\t\tvar defaultCText = document.createTextNode ( config.DefaultFontCheckbox.lang[ langRef ] );\n\t\t\tCLabel.appendChild( defaultCText );\n\t\t\tfieldset.appendChild( CInput );\n\t\t\tfieldset.appendChild( CLabel );\n\t\t\t\n\t\t\t/**Alternative option : alternative font OpenDyslexic**/\n\t\t\tvar CInput = $create({tagName:'input', type:'radio', id:userPrefix+'-'+config.DyslexiaFontCheckbox.id, value:userPrefix+'-'+config.DyslexiaFontCheckbox.value, name:userPrefix+'-'+config.DyslexiaFontCheckbox.groupName});\n\t\t\tvar CLabel = $create({tagName:'label', for:userPrefix+'-'+config.DyslexiaFontCheckbox.id});\n\t\t\tvar defaultCText = document.createTextNode ( config.DyslexiaFontCheckbox.lang[ langRef ] );\n\t\t\tCLabel.appendChild( defaultCText );\n\t\t\tfieldset.appendChild( CInput );\n\t\t\tfieldset.appendChild( CLabel );\n\t\t\tfieldsetContent.appendChild( fieldset );\n\t\t}\n\n\t\t/**\n\t\tLine spacing feature\n\t\t**/\n\n\t\tif(global.userParams.LineSpacing != false){\n\t\t\tvar fieldset = $create({tagName:'fieldset', id:userPrefix+'-'+config.LineSpacingFieldset.id});\n\t\t\tvar legend = document.createElement( 'legend' );\n\t\t\tvar legendText = document.createTextNode( config.LineSpacingLegend.lang[ langRef ] );\n\t\t\tlegend.appendChild( legendText );\n\t\t\tfieldset.appendChild( legend );\n\n\t\t\t/**Default option**/\n\t\t\tvar CInput = $create({tagName:'input', type:'radio',checked:'checked', id:userPrefix+'-'+config.DefaultLineSpacingCheckbox.id, value:userPrefix+'-'+config.DefaultLineSpacingCheckbox.value, name:userPrefix+'-'+config.DefaultLineSpacingCheckbox.groupName});\n\t\t\tvar CLabel = $create({tagName:'label', for:userPrefix+'-'+config.DefaultLineSpacingCheckbox.id});\n\t\t\tvar defaultCText = document.createTextNode ( config.DefaultLineSpacingCheckbox.lang[ langRef ] );\n\t\t\tCLabel.appendChild( defaultCText );\n\t\t\tfieldset.appendChild( CInput );\n\t\t\tfieldset.appendChild( CLabel );\n\n\t\t\t/**Alternative option : line spacing increase**/\n\t\t\tvar CInput = $create({tagName:'input', type:'radio',id:userPrefix+'-'+config.DyslexiaLineSpacingCheckbox.id, value:userPrefix+'-'+config.DyslexiaLineSpacingCheckbox.value, name:userPrefix+'-'+config.DyslexiaLineSpacingCheckbox.groupName});\n\t\t\tvar CLabel = $create({tagName:'label', for:userPrefix+'-'+config.DyslexiaLineSpacingCheckbox.id});\n\t\t\tvar defaultCText = document.createTextNode ( config.DyslexiaLineSpacingCheckbox.lang[ langRef ] );\n\t\t\tCLabel.appendChild( defaultCText );\n\t\t\tfieldset.appendChild( CInput );\n\t\t\tfieldset.appendChild( CLabel );\n\t\t\tfieldsetContent.appendChild( fieldset );\n\t\t}\n\n\t\t/**\n\t\tJustification feature\n\t\t**/\n\n\t\tif(global.userParams.Justification != false){\n\t\t\tvar fieldset = $create({tagName:'fieldset', id:userPrefix+'-'+config.JustificationFieldset.id});\n\t\t\tvar legend = document.createElement( 'legend' );\n\t\t\tvar legendText = document.createTextNode( config.JustificationLegend.lang[ langRef ] );\n\t\t\tlegend.appendChild( legendText );\n\t\t\tfieldset.appendChild( legend );\n\n\t\t\t/**Default option**/\n\t\t\tvar CInput = $create({tagName:'input', type:'radio',checked:'checked', id:userPrefix+'-'+config.DefaultJustificationCheckbox.id, value:userPrefix+'-'+config.DefaultJustificationCheckbox.value, name:userPrefix+'-'+config.DefaultJustificationCheckbox.groupName});\n\t\t\tvar CLabel = $create({tagName:'label', for:userPrefix+'-'+config.DefaultJustificationCheckbox.id});\n\t\t\tvar defaultCText = document.createTextNode ( config.DefaultJustificationCheckbox.lang[ langRef ] );\n\t\t\tCLabel.appendChild( defaultCText );\n\t\t\tfieldset.appendChild( CInput );\n\t\t\tfieldset.appendChild( CLabel );\n\n\t\t\t/**Alternative option : kill justification**/\n\t\t\tvar CInput = $create({tagName:'input', type:'radio',id:userPrefix+'-'+config.DyslexiaJustificationCheckbox.id, value:userPrefix+'-'+config.DyslexiaJustificationCheckbox.value, name:userPrefix+'-'+config.DyslexiaJustificationCheckbox.groupName});\n\t\t\tvar CLabel = $create({tagName:'label', for:userPrefix+'-'+config.DyslexiaJustificationCheckbox.id});\n\t\t\tvar defaultCText = document.createTextNode ( config.DyslexiaJustificationCheckbox.lang[ langRef ] );\n\t\t\tCLabel.appendChild( defaultCText );\n\t\t\tfieldset.appendChild( CInput );\n\t\t\tfieldset.appendChild( CLabel );\n\t\t\tfieldsetContent.appendChild( fieldset );\n\t\t}\n\n\t\t/**\n\t\tImage replacement feature\n\t\t**/\n\n\t\tif(global.userParams.ImageReplacement != false){\n\t\t\tvar fieldset = $create({tagName:'fieldset', id:userPrefix+'-'+config.ImageReplacementFieldset.id});\n\t\t\tvar legend = document.createElement( 'legend' );\n\t\t\tvar legendText = document.createTextNode( config.ImageReplacementLegend.lang[ langRef ] );\n\t\t\tlegend.appendChild( legendText );\n\t\t\tfieldset.appendChild( legend );\n\n\t\t\t/**Default option**/\n\t\t\tvar CInput = $create({tagName:'input', type:'radio',checked:'checked', id:userPrefix+'-'+config.DefaultImageReplacementCheckbox.id, value:userPrefix+'-'+config.DefaultImageReplacementCheckbox.value, name:userPrefix+'-'+config.DefaultImageReplacementCheckbox.groupName});\n\t\t\tvar CLabel = $create({tagName:'label', for:userPrefix+'-'+config.DefaultImageReplacementCheckbox.id});\n\t\t\tvar defaultCText = document.createTextNode ( config.DefaultImageReplacementCheckbox.lang[ langRef ] );\n\t\t\tCLabel.appendChild( defaultCText );\n\t\t\tfieldset.appendChild( CInput );\n\t\t\tfieldset.appendChild( CLabel );\n\n\t\t\t/**Alternative option : Image replacement**/\n\t\t\tvar CInput = $create({tagName:'input', type:'radio', id:userPrefix+'-'+config.ImageReplacementCheckbox.id, value:userPrefix+'-'+config.ImageReplacementCheckbox.value, name:userPrefix+'-'+config.ImageReplacementCheckbox.groupName});\n\t\t\tvar CLabel = $create({tagName:'label', for:userPrefix+'-'+config.ImageReplacementCheckbox.id});\n\t\t\tvar defaultCText = document.createTextNode ( config.ImageReplacementCheckbox.lang[ langRef ] );\n\t\t\tCLabel.appendChild( defaultCText );\n\t\t\tfieldset.appendChild( CInput );\n\t\t\tfieldset.appendChild( CLabel );\n\t\t\tfieldsetContent.appendChild( fieldset );\n\t\t}\n\n\t\t/**Set generic class attributes on fieldset, legend and radio**/\n\n\t\tallFieldset = div.querySelectorAll( 'fieldset' );\n\t\tfor (i = 0, len = allFieldset.length; i < len; i++ ){\n\t\t\tglobal.userParams.FormFieldset ? allFieldset[i].classList.add( userPrefix+global.userParams.FormFieldset ) : \n\t\t\t\t\t\t\t\t\t\t\t allFieldset[i].classList.add( userPrefix+'-'+config.FormFieldset.classSetting );\n\t\t}\n\n\t\tallLegend = div.querySelectorAll( 'legend' );\n\t\tfor (i = 0, len = allLegend.length; i < len; i++ ){\n\t\t\tglobal.userParams.FormFieldsetLegend ? \tallLegend[i].classList.add( userPrefix+global.userParams.FormFieldsetLegend ) : \n\t\t\t\t\t\t\t\t\t\t\t\t\tallLegend[i].classList.add( userPrefix+'-'+config.LegendFieldset.classSetting );\n\t\t}\n\n\t\tallRadio = div.querySelectorAll( 'input[type=\"radio\"]' );\n\t\tfor (i = 0, len = allRadio.length; i < len; i++ ){\n\t\t\tglobal.userParams.FormRadio ? \tallRadio[i].classList.add( userPrefix+global.userParams.FormRadio ) : \n\t\t\t\t\t\t\t\t\t\t\tallRadio[i].classList.add( userPrefix+'-'+config.FormRadio.classSetting );\n\t\t}\n\n\t\t/** Set the modal **/\n\t\tvar modalAttach = document.querySelector( 'body');\n\t\tvar modalAttachFirstChild = modalAttach.firstChild;\n\t\t/** attach modal as the first child of body **/\n\t\tif( global.userParams.Modal == true || global.userParams.Modal === undefined) modalAttach.insertBefore( div, modalAttachFirstChild);\n\t}", "constructor(form, container) {\n\t\tsuper();\n\n\t\tthis.form = document.forms[form];\n\t\tthis.container = document.getElementById(container);\n\t\t\n\t\t// set in render()\n\t\tthis.masterkey = null;\n\t\tthis.errors = null;\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assign channels to a new instance of a base color / ==========================================================================
function assign(base, channels) { const color = Object.assign({}, base); Object.keys(channels).forEach(channel => { // detect channel const isHue = channel === "hue"; const isRGB = !isHue && blueGreenRedMatch.test(channel); // normalized value of the channel const value = normalize(channels[channel], channel); // assign channel to new object color[channel] = value; if (isRGB) { // conditionally preserve the hue color.hue = rgb2hsl( color.red / 100, color.green / 100, color.blue / 100, base.hue || 0 )[0]; } }); return color; }
[ "function assign(base, channels) {\n const color = Object.assign({}, base);\n Object.keys(channels).forEach(channel => {\n // detect channel\n const isHue = channel === 'hue';\n const isRGB = !isHue && blueGreenRedMatch.test(channel); // normalized value of the channel\n\n const value = normalize(channels[channel], channel); // assign channel to new object\n\n color[channel] = value;\n\n if (isRGB) {\n // conditionally preserve the hue\n color.hue = convertColors.rgb2hue(color.red, color.green, color.blue, base.hue || 0);\n }\n });\n return color;\n}", "function assign(base, channels) {\n\tvar color = Object.assign({}, base);\n\n\tObject.keys(channels).forEach(function (channel) {\n\t\t// detect channel\n\t\tvar isHue = channel === 'hue';\n\t\tvar isRGB = !isHue && blueGreenRedMatch.test(channel);\n\n\t\t// normalized value of the channel\n\t\tvar value = normalize(channels[channel], channel);\n\n\t\t// assign channel to new object\n\t\tcolor[channel] = value;\n\n\t\tif (isRGB) {\n\t\t\t// conditionally preserve the hue\n\t\t\tcolor.hue = rgb2hue(color.red, color.green, color.blue, base.hue || 0);\n\t\t}\n\t});\n\n\treturn color;\n}", "function assign(base, channels) {\n\tconst color = Object.assign({}, base);\n\n\tObject.keys(channels).forEach(\n\t\tchannel => {\n\t\t\t// detect channel\n\t\t\tconst isHue = channel === 'hue';\n\t\t\tconst isRGB = !isHue && blueGreenRedMatch.test(channel);\n\n\t\t\t// normalized value of the channel\n\t\t\tconst value = normalize(channels[channel], channel);\n\n\t\t\t// assign channel to new object\n\t\t\tcolor[channel] = value;\n\n\t\t\tif (isRGB) {\n\t\t\t\t// conditionally preserve the hue\n\t\t\t\tcolor.hue = rgb2hue(color.red, color.green, color.blue, base.hue || 0);\n\t\t\t}\n\t\t}\n\t);\n\n\treturn color;\n}", "function assign(base, channels) {\n\tvar color = Object.assign({}, base);\n\n\tObject.keys(channels).forEach(function (channel) {\n\t\t// detect channel\n\t\tvar isHue = channel === 'hue';\n\t\tvar isRGB = !isHue && blueGreenRedMatch.test(channel);\n\n\t\t// value of the channel\n\t\tvar adjustment = channels[channel];\n\n\t\t// value limitations\n\t\tvar min = 0;\n\t\tvar max = isHue ? 360 : 1;\n\n\t\t// updated value\n\t\tvar value = Math.min(Math.max(parseFloat(adjustment), min), max);\n\n\t\t// assign channel to new object\n\t\tif (isHue) {\n\t\t\tcolor.hue = value;\n\t\t} else {\n\t\t\tcolor[channel] = value;\n\n\t\t\tcolor.hue = isRGB ? rgb2hue(color.red, color.green, color.blue, base.hue || 0) : base.hue;\n\t\t}\n\t});\n\n\treturn color;\n}", "function assign(base, channels) {\n\tconst color = Object.assign({}, base);\n\n\tObject.keys(channels).forEach(\n\t\tchannel => {\n\t\t\t// detect channel\n\t\t\tconst isHue = channel === 'hue';\n\t\t\tconst isRGB = !isHue && blueGreenRedMatch.test(channel);\n\n\t\t\t// value of the channel\n\t\t\tconst adjustment = channels[channel];\n\n\t\t\t// value limitations\n\t\t\tconst min = 0;\n\t\t\tconst max = isHue ? 360 : 1;\n\n\t\t\t// updated value\n\t\t\tconst value = Math.min(Math.max(parseFloat(adjustment), min), max);\n\n\t\t\t// assign channel to new object\n\t\t\tif (isHue) {\n\t\t\t\tcolor.hue = value;\n\t\t\t} else {\n\t\t\t\tcolor[channel] = value;\n\n\t\t\t\tcolor.hue = isRGB\n\t\t\t\t\t? rgb2hue(color.red, color.green, color.blue, base.hue || 0)\n\t\t\t\t: base.hue;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn color;\n}", "_resetbasecolor() {\n\t\tvar clone = this.copy();\n\t\tthis.r = this._basecolor.r;\n\t\tthis.g = this._basecolor.g;\n\t\tthis.b = this._basecolor.b;\n\t\tthis.a = this._basecolor.a;\n\t\tthis.h = this._basecolor.h;\n\t\tthis.s = this._basecolor.s;\n\t\tthis.l = this._basecolor.l;\n\t\tif(this._cmyk) {\n\t\t\tthis.c = this._basecolor.c;\n\t\t\tthis.m = this._basecolor.m;\n\t\t\tthis.y = this._basecolor.y;\n\t\t\tthis.k = this._basecolor.k;\n\t\t}\n\t\treturn clone;\n\t}", "clone() { // general\n\t\tvar clone = this.copy();\n\t\tvar baseclone = Object.create(\n\t\t\tObject.getPrototypeOf(clone._basecolor), \n\t\t\tObject.getOwnPropertyDescriptors(clone._basecolor) \n\t\t)\n\t\tbaseclone.r = clone.r;\n\t\tbaseclone.g = clone.g;\n\t\tbaseclone.b = clone.b;\n\t\tbaseclone.a = clone.a;\n\t\tbaseclone.h = clone.h;\n\t\tbaseclone.s = clone.s;\n\t\tbaseclone.l = clone.l;\n\t\tif(baseclone._cmyk) {\n\t\t\tbaseclone.c = clone.c;\n\t\t\tbaseclone.m = clone.m;\n\t\t\tbaseclone.y = clone.y;\n\t\t\tbaseclone.k = clone.k;\n\t\t}\n\t\tclone._basecolor = baseclone;\n\t\treturn clone;\n\t}", "set colorBuffer(value) {}", "create(r, g, b, a = 255, type = false)\r\n\t{\r\n\t\tlet id = r + (g<<8) + (b<<16) + (a<<24);\r\n\r\n\t\tif (this.colors[id] == null)\r\n\t\t{\r\n\t\t\tthis.colors[id] = CreateColor(r, g, b, a);\r\n\t\t\tthis.colorsNew[id] = new Color(r, g, b, a);\r\n\t\t}\r\n\t\t\r\n\t\tif(type)\r\n\t\t{\r\n\t\t\treturn this.colorsNew[id];\r\n\t\t} else {\r\n\t\t\treturn this.colors[id];\r\n\t\t}\r\n\t}", "function Colorer (cursor, base) {\n this.current = null\n this.cursor = cursor\n this.base = base\n}", "function color()\r\n{\r\n this.r = 0;\r\n this.g = 256;\r\n this.b = 128;\r\n}", "constructor(...args) {\n this.r = 0;\n this.g = 0;\n this.b = 0;\n this.a = 255;\n /* Handle Color([...]) -> Color(...) */\n if (args.length == 1 && args[0] instanceof Array) {\n args = args[0];\n }\n if (args.length == 1) {\n /* Handle Color(Color) and Color(\"string\") */\n let arg = args[0];\n if (arg instanceof Color) {\n [this.r, this.g, this.b, this.a] = [arg.r, arg.g, arg.b, arg.a];\n this.scale = arg.scale;\n } else if (typeof(arg) == \"string\" || arg instanceof String) {\n let [r, g, b, a] = ColorParser.parse(arg);\n [this.r, this.g, this.b, this.a] = [r, g, b, a];\n } else {\n throw new TypeError(`Invalid argument \"${arg}\" to Color()`);\n }\n } else if (args.length >= 3 && args.length <= 4) {\n /* Handle Color(r, g, b) and Color(r, g, b, a) */\n [this.r, this.g, this.b] = args;\n if (args.length == 4) this.a = args[3];\n } else if (args.length > 0) {\n throw new TypeError(`Invalid arguments \"${args}\" to Color()`);\n }\n }", "function setBaseColor()\n{\n\tvar color = (new ActiveXObject(\"Wscript.Shell\")).RegRead(\"HKEY_CURRENT_USER\\\\Software\\\\Microsoft\\\\Windows\\\\DWM\\\\ColorizationColor\").toString(16);\n\tvar ratio = 1 - (color.length > 8 ? 255 - parseInt(color.substring(1, 3), 16) : parseInt(color.substring(0, 2), 16)) / 255;\n\n\tgBaseColor = lighterColor(color.length > 8 ? (16777216 - parseInt(color.substring(3), 16)).toString(16) : color.substring(2), ratio);\n\tgLightestColor = lighterColor(gBaseColor, 0.7);\n\tgLighterColor = darkerColor(gBaseColor, 0.35);\n\tgDarkerColor = darkerColor(gBaseColor, 0.5);\n\tgDarkestColor = darkerColor(gBaseColor, 0.65);\n\tgInvertedColor = saturateColor(gBaseColor);\n}", "setColors() {\n for (let i=0; i<this.numberVertices; i++)\n colors.push(this.color.r, this.color.g, this.color.b, this.color.a);\n }", "function addToAllChannels(rgb, value) {\n var r = rgb[0] + value;\n var g = rgb[1] + value;\n var b = rgb[2] + value;\n\n if (r > 255) { r = 255; }\n if (g > 255) { g = 255; }\n if (b > 255) { b = 255; }\n if (r < 0) { r = 0; }\n if (g < 0) { g = 0; }\n if (b < 0) { b = 0; }\n\n return [r, g, b];\n}", "copy(c) {\n try {\n if (!(c instanceof Color))\n throw \"Color.copy: non-color parameter\";\n else {\n this.r = c.r;\n this.g = c.g;\n this.b = c.b;\n this.a = c.a;\n return (this);\n }\n } // end try\n catch (e) {\n console.log(e);\n }\n }", "setColorFilter(cr, cg, cb) {\n this.colorFilter = [cr, cg, cb];\n }", "function createColorPalette(baseColor) {\n return new _microsoft_fast_colors__WEBPACK_IMPORTED_MODULE_0__.ComponentStateColorPalette({\n baseColor,\n }).palette.map(color => color.toStringHexRGB().toUpperCase());\n}", "function rgbScaleBase(rgb, base) {\n if (rgb.base == base) {\n return rgb;\n } else {\n // Going from base 16 to base 256, say\n var factor = (base - 1) / (rgb.base - 1);\n return {\n r: rgb.r * factor,\n g: rgb.g * factor,\n b: rgb.b * factor,\n base: base\n };\n }\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if someone is won;
function checkWon() { isPlayerWon = playerGuess.value.toUpperCase() === computerBase; isComputerWon = computerGuess.value === playerBase; }
[ "function hasUserWonOrLost() {\n // check if user has won\n if (userTotalScore == bigCrystalNumber) {\n wins++;\n console.log(\"user won\");\n initializeVariables();\n }\n\n // check if user has lost\n if (userTotalScore > bigCrystalNumber) {\n losses++;\n console.log(\"user lost\");\n initializeVariables();\n }\n }", "function hasUserWonOrLost() {\n\n if (userTotalScore > randomComputerNumber) {\n losses++;\n console.log(\"user lost\");\n alert(\"Sorry, you lost :( ....Try again!\");\n\n initializeVariables();\n }\n\n\n if (userTotalScore == randomComputerNumber) {\n wins++;\n console.log(\"user won\")\n alert(\"Congratulations! you won!!\");\n initializeVariables();\n }\n }", "function checkIfWon() {\n if (userScore === randomNumber) {\n wins++;\n winAudio.play();\n status='You won!!';\n reset(); \n return true;\n }\n if (userScore > randomNumber) {\n losses++;\n lostAudio.play();\n status='You lost!!';\n reset();\n return true;\n }\n \n return false;\n \n}", "hasWon() {\n // if player won (over 100) then return true. Otherwise, return false\n if (this.totalScore() >= 100) {\n return true;\n } else {\n return false;\n }\n }", "function checkIfWon() {\n if (couragePlayer.spyWin) {\n showGameWin = true;\n }\n}", "function checkOver() {\r\n if (playerHand.total > 21) {\r\n whoWins(0);\r\n }\r\n if (dealerHand.total > 21) {\r\n whoWins(1);\r\n }\r\n }", "function checkWhoWon() {\n if (gameBall.yBall < 0) {\n gameState.playerWins++;\n newGameRecord.humanWins = gameState.playerWins;\n newGameRecord.aiWins = gameState.enemyWins;\n newPlayerRecord.winLoseAI = \"Win\";\n setProperty(\"winLoseLabel\", \"text-color\", \"green\");\n setText(\"winLoseLabel\", \"You won!\");\n } else {\n gameState.enemyWins++;\n newGameRecord.humanWins = gameState.playerWins;\n newGameRecord.aiWins = gameState.enemyWins;\n newPlayerRecord.winLoseAI = \"Lose\";\n setProperty(\"winLoseLabel\", \"text-color\", \"red\");\n setText(\"winLoseLabel\", \"You lost!\");\n }\n gameState.winRatio = Math.round((gameState.playerWins / (gameState.enemyWins + gameState.playerWins)) * 100);\n newGameRecord.winRatio = gameState.winRatio;\n}", "function checkPlayerWon()\n{\n if(score == guns.length)\n {\n isWon = true;\n }\n}", "function checkIfWon() {\n\n if (scores[\"player1\"] == 3) {\n markAsWinner(1)\n return true\n } else if (scores[\"player2\"] == 3) {\n markAsWinner(2)\n return true\n }\n\n return false\n}", "function checkIfPlayerWon()\n {\n // checking if the function is working\n console.log(\"Check Win\");\n console.log(\"Backpack L = \" + game.backpack.length);\n console.log(\"MapLocation = \" + game.mapLocation);\n // if the user colect all three items and is in location 9 , the player win the game\n if(game.backpack.length==4 && game.mapLocation==8)\n {\n console.log(\"Check Win - Conditions TRUE\");\n game.gameMessage = \"You win\";\n // calling the endOfTheGame function at end of the game\n endOfTheGame();\n }\n }", "function winOrLose() {\n\t\talert(\"Let's see if we have won the battle after all this hard work\")\t\n }", "didPlayerWin() {\n return purses[ this.currentPlayer ] == 6\n }", "checkWin() {\r\n if (!this.gs.won) {\r\n if (this.gs.board.findIndex(elt => elt === 2048) > -1) {\r\n this.gs.won = true;\r\n this.onWin();\r\n }\r\n }\r\n }", "checkForWinner() {\n\t\tif ($(\".word.full\").length == $(\".word\").length) {\n\t\t\tthis.gameOver();\n\t\t\tsoundWin();\n\t\t\tthis.winOrLose.html(\"Congratulations! You won!\");\n\t\t}\n\t}", "function checkWinsLosses() {\n if (score === random) {\n wins++;\n $(\"#wins\").text(wins);\n reset();\n } else if (score > random) {\n losses++;\n $(\"#losses\").text(losses);\n reset();\n }\n }", "checkWinCondition() {\n for(const player of this.getPlayersInFirstPlayerOrder()) {\n if(player.honor >= 25) {\n this.recordWinner(player, 'honor');\n } else if(player.opponent && player.opponent.honor <= 0) {\n this.recordWinner(player, 'dishonor');\n }\n }\n }", "function check () {\n if (totalScore === ranNum) {\n wins++\n document.querySelector('#wins').innerHTML = `Wins: ${wins}` \n alert('you won!')\n console.log('u win')\n end()\n\n // check if the totalScore is greater than the ranNum, if so then you lose\n // add 1 to loss score\n // call end()\n } else if (totalScore > ranNum) {\n losses++\n document.querySelector('#losses').innerHTML = `Losses: ${losses}`\n alert('you lost!')\n console.log('u lose')\n end()\n }\n }", "function checkIfOver() {\n\tif (!player1.wins && !player2.wins) {\n\t\tif (board.playedMoves.length === 9) {\n\t\t\tsetGameOver();\t\n\t\t\tgameDisplay.innerHTML = \"Game over. With no winners. Nubs.\";\n\t\t\tshowGameDisplay();\n\t\t}\n\t}\n}", "function youWon() {\n\tgenerateWinScreen()\n\tpostGameWin()\n\tgameStart()\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
console.log(deleteOne("Hello Brother", false)) / Ex.5 Write a function called "onlyLetters" which receives a string as a parameter and returns it removing all the digits. Ex.: onlyLetters("I have 4 dogs") => returns "I have dogs"
function onlyLetters (string){ return string.replace(/[0-9]/g,'') }
[ "function OnlyLetters(x){ \n const result= x.replace(/[0-9]/g, '');\n return result\n\n \n}", "function deleteOne(anyString, anyBoolean){\n if (anyBoolean === true) {\n return anyString.slice(1)\n } else {\n return anyString.slice(0,12)\n }\n}", "function deleteOne(num) {\n str = num.toString()\n return str.substring(0, str.length -1);\n}", "function onlyLetters(receivesString) {\n let numberToString = receivesString.replace(/\\d+/g, '');\n return console.log(numberToString); \n}", "function DeleteOne(String, falseortrue) {\n if (falseortrue) return String.substring(1);\n else return String.substring(0, String.length - 1);\n}", "function withoutString(base, remove) {\n //Type your solutions here\n\n\n}", "function deleteOne(str, bool) {\n return bool == true\n ? str.substring(1, str.length)\n : str.substring(0, str.length - 1);\n}", "function deleteOne(str1,f){\n if(f==true){\n newsr=str1.slice(1);\n \n } else {\n newsr = str1.slice(0,str1.length-1); \n } return newsr;\n}", "function onlyLetters(str){\n return str.replace(/[0-9]/g,'')\n}", "function simple(str) {\n return str.toLowerCase().replace(/[^a-z0-9]/g, '') \n}", "function removeCharacter(badString) {\n var deletingNumber = 6;\n var repareString = badString.slice(0, deletingNumber);\n console.log(repareString);\n}", "function deleteLetters(letter, sentence){\n return (sentence.includes(letter)) \n ? sentence.split('').filter(value => value !== letter).join('')\n : sentence;\n}", "function deleteOne(str, bl){\n return bl?str.slice(1):str.slice(0,-1)\n}", "function justLettersAndDigits(str) {\n\treturn str.replace(/[^(a-zA-Z0-9)]*/gi, '');\n}", "function remove_letter(word, letter) {\r\n\t{\r\n\t\treturn word.replace(letter, '')\r\n\t}\r\n}", "function keepOne(x, y){\n return keepAll(x, y).charAt(0);\n}", "function simple(str) {\n return str.toLowerCase().replace(/[^a-z0-9]/g, '');\n}", "function onlyLetters(str2){\n str3 = str2.replace(/[0-9]/g, '');\n return str3;\n}", "function simple(str) {\n return str.toLowerCase().replace(/[^a-z0-9]/g, '');\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getting the details of the webseries list
getwebSeriesDetails() { axios.get('/webseriesDetails').then((res) => { this.setState({ webSeriesList: res.data }) }) }
[ "function getSeries() {\n let api = \"../api/Series/Admin\";\n\n ajaxCall(\"GET\", api, \"\", getSeriesSuccessCB, getErrorCB);\n}", "function takeListSerie() {\r\n\t\t$.ajax({\r\n\t\t\turl:'https://api.themoviedb.org/3/tv/popular?api_key=44a293499bc60fded2357760668ac47c&language=fr-FR&page=1',\r\n\t\t\tsuccess: function(liste) {\r\n\r\n\t\t\t\tcreateListSerie(liste);\r\n\t\t\t}\r\n\t\t});\r\n\t}", "function getSWITRSinfo() {\n\n if (app.sliderValue === \"All Years\") {\n\tqueryurl = api_totals;\n } else {\n\tlet url = api_server + '?select=st_asgeojson,year,biccol,pedcol,bickill,pedkill,street_names,bicinj,pedinj';\n\tqueryurl = url + '&year=eq.' + app.sliderValue;\n }\n\n // Fetch the json and yearly details\n fetch(queryurl).then((resp) => resp.json()).then(function(jsonData) {\n addSWITRSLayer(jsonData);\n })\n .catch(function(error) {\n console.log(\"err: \"+error);\n });\n}", "function listWeather(req, res) {\n weather_db.get('weather_data', { revs_info : true }, function (err, weather) {\n res.json(weather[\"weather_history\"]);\n });\n}", "getPastLists() {\n\n return new TotoAPI().fetch('/supermarket/pastLists?maxResults=20').then((response) => response.json());\n }", "getSeriesDetail() {\n\t\tfetch(\"http://localhost:3001/getSeries\", {\n\t\t\tmethod: \"post\",\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tbody: JSON.stringify({\n\t\t\t\tauthKey: this.state.authkey,\n\t\t\t\tseriesId: this.state.seriesKey\n\t\t\t})\n\t\t})\n\t\t\t.then(response => response.json())\n\t\t\t.then(res => {\n\t\t\t\tif (res === \"error\") {\n\t\t\t\t\tconsole.log(`error getting id ${this.state.seriesKey}`);\n\t\t\t\t} else if (res === \"404\") {\n\t\t\t\t\tconsole.log(\"page not found\");\n\t\t\t\t} else {\n\t\t\t\t\tconst seriesInfo = JSON.parse(res);\n\t\t\t\t\tconst seriesDetails = {\n\t\t\t\t\t\tseriesName: seriesInfo.data.seriesName,\n\t\t\t\t\t\tseriesBanner: seriesInfo.data.banner,\n\t\t\t\t\t\tseriesFirstAired: seriesInfo.data.firstAired,\n\t\t\t\t\t\tseriesGenre: seriesInfo.data.genre,\n\t\t\t\t\t\tseriesNetwork: seriesInfo.data.network,\n\t\t\t\t\t\tseriesOverview: seriesInfo.data.overview,\n\t\t\t\t\t\tseriesRating: seriesInfo.data.rating,\n\t\t\t\t\t\tseriesRuntime: seriesInfo.data.runtime,\n\t\t\t\t\t\tseriesSiteRating: seriesInfo.data.siteRating,\n\t\t\t\t\t\tseriesSlug: seriesInfo.data.slug,\n\t\t\t\t\t\tseriesStatus: seriesInfo.data.status\n\t\t\t\t\t};\n\t\t\t\t\tthis.setState({ seriesDetails: seriesDetails });\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\tconsole.log(err);\n\t\t\t});\n\t}", "function getLatestSwims() {\n showLoadingOverlay();\n const xhr = new XMLHttpRequest();\n\n xhr.open('GET', '/swimFeedJP.json?ver=1', true);\n // xhr.open('GET', '/swimFeedJP.json?asd=1', true);\n xhr.setRequestHeader('Content-type', 'application/json;charset=UTF-8');\n // xhr.withCredentials = true;\n xhr.onload = function () {\n if (xhr.status === 200) {\n hideLoadingOverlay();\n const response = JSON.parse(xhr.response);\n allSwims = response.swims;\n const stripped = { ...response, swims: response.swims.slice(0, (perPage - 1) * currentPage++) };\n createSwimsHtml(stripped);\n return;\n }\n console.log(\"Error retrieving swim information\");\n return null;\n };\n xhr.send();\n}", "function getTopSeries(){\n seriesFactory.getTopSeries()\n .success(function (series) {\n $scope.profileTopSeries = series;\n })\n .error(function (error) {\n //$scope.status = 'error error error beep beep;\n });\n }", "function getFollowingSeries() {\n seriesFactory.getFollowingSeries(false, true, true)\n .success(function (response) {\n if(response.length === 0){\n getTopSeries();\n }\n $scope.profileSeries = response;\n series = response;\n filterSeries();\n })\n .error(function (response) {\n //flash(response.flash);\n });\n }", "list(req, res){\n return plot\n .findAll()\n .then((data) => res.status(200).send(data))\n .catch((error) => {res.status(400).send(error)})\n }", "function getListOfStatistics() {\n\tajax(\"requestType=getListOfStatistics\");\n}", "function getTrendingShows() {\n\trequestTVInfo('shows/trending', function (error, response, body) {\n\t\tif (error) {\n\t\t\tconsole.log(error);\n\t\t} else {\n\t\t\tconsole.log(body);\n\t\t}\n\t});\n}", "getLastList() {\n\n return new TotoAPI().fetch('/supermarket/pastLists?maxResults=1').then((response) => response.json());\n }", "function loadSiteList () {\n return page.fetchJSON(API_SITE_LIST, true)\n .then(function (data) {\n renderSiteList(data.objects);\n });\n }", "getAllSalesList() {\n fetch(process.env.REACT_APP_API_URL+\"/sales\")\n .then(res => res.json())\n .then(\n result => {\n this.setState({\n isLoaded: true,\n salesList: result,\n });\n },\n error => {\n this.setState({\n isLoaded: true,\n error: error\n });\n }\n );\n }", "getSchedule(){\n const overwatch = require('overwatch-api');\n overwatch.owl.getSchedule((err,json)=> {\n if (err) console.log(err);\n else console.log(json);\n })\n }", "function listEvents() {\n const calendar = getCalenderClient();\n calendar.events.list({\n calendarId: 'primary',\n timeMin: (new Date()).toISOString(),\n maxResults: 10,\n singleEvents: true,\n orderBy: 'startTime',\n }, (err, res) => {\n if (err) return console.log('The API returned an error: ' + err);\n const events = res.data.items;\n if (events.length) {\n console.log('Upcoming 10 events:');\n events.map((event, i) => {\n const start = event.start.dateTime || event.start.date;\n console.log(`${start} - ${event.summary}`);\n });\n } else {\n console.log('No upcoming events found.');\n }\n });\n}", "function get_product_details(_site)\n {\n crawler_log(\"get_product_details: \" + _site);\n crawler_log(\"product_list.length: \" + product_list.length);\n\n is_crawling_product_details = true;\n product_count = product_list.length;//product_rank;\n product_counter = 1;\n /** -----------------------------------------------------------------------------------\n * Now that we have our entire list of products, lets add details to the product array\n * ----------------------------------------------------------------------------------- */\n var i=0,_timeout=0;\n for(i=0; i <=product_list.length;i++)\n\n {\n\n (function(i,_timeout) {\n _timeout = i*5000;\n\n setTimeout(function() {\n crawler_log(\"### index: \" + i + \" with URL: \" + product_list[i].url);\n\n fetch_details(i);\n },_timeout);\n })(i,_timeout);\n\n\n }\n }", "getSalonServices(){ \n var url = `${API_URL}TreatmentTitle/GetData`;\n return fetch(url).then((res) => res.json());\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Quick Time Buttons / change the current timer or open modal
function changeCurrentTime(){ /* don't open disabled button */ if(this.classList.contains('btn-greyed')){ return false; } /* open modal if + not assigned button */ else if(this.textContent == " + "){ if(this.id == "btn-cust-1"){ customSelected = 3; /* index value of selected button */ } else{ customSelected = 4; } openModal(); return false; } /* set time based on button clicked */ else{ var index = parseInt(this.dataset.id); timeSet(index); /* check if start of loop */ if(currentTimer.tag !== Timers[loopQueue[0]].tag){ /* if not display timer tag */ setloopLabel(currentTimer.tag); } else{ /* display #1 loop */ resetLoopIndex(); } } }
[ "function startTimerForQA() {\n renderQuestionForUI();\n renderTimerForUI();\n renderQuestionListNavigationForUI();\n switchModeOfTimerControlButton(START);\n}", "function getTimer (btn) {\n $(\"#duration\").val($(\"#time\").text().substring(0,8));\n $(\"#exercise_status\").val(btn.id);\n $(\"#timerContainer\").animate({right: \"100%\"}, \"slow\", function(){\n $(\"#timerContainer\").hide();\n $(\"#pageTitle\").text(\"Your Mood\");\n $(\"#emojiContainer\").show();\n $(\"#emojiContainer\").animate({left: \"0\"},\"slow\");\n });\n}", "function editTimer() {\n\tvar editWin = Alloy.createController(addWin, {\n\t\tlabel : alarm.label,\n\t\tsnooze : alarm.snooze,\n\t\tduration : alarm.duration,\n\t\tvibration : alarm.vibration,\n\t\tsounds : alarm.sounds,\n\t\tshuffle : alarm.shuffle,\n\t\tisEdit : true,\n\t\tmainCont : $,\n\t});\n\teditWin.w.title = \"Edit Timer\";\n\teditWin.getView().open();\n}", "function startTimer() {\n // Each button comes with data-time that is a string of the number of minutes\n const seconds = parseInt(this.dataset.time); // convert to number\n timer(seconds); // start timer\n}", "function timerPauseButton()\n{\n\t//If the timer is on \n\tif(timer.tickTockOrNot)\n\t{\n\t\t//set the button text \n\t\tstopTimerButton.innerHTML = \" Resume \";\n\t}\n\t//If the timer is off \n\telse\n\t{\n\t\t//set the buttont text \n\t\tstopTimerButton.innerHTML = \" Pause \";\n\t}\n\tswitchTickTockOrNot(); //Call the switchTickTockOrNot method to set the timer flag in the timer.js file \n}", "function startTimerByBtn(e) {\n const seconds = parseInt(this.dataset.time);\n timer.start(seconds);\n}", "function setCurrentTimeBtn(btnId) {\n $(\"#timeselection\").attr(\"current-time-btn\", btnId);\n}", "function pomodoro() {\n pending = true;\n pauseTimer();\n resetTimerHelper();\n document.getElementById('timer').innerText = \"25:00\";\n}", "'click div#playPTimer'(event, instance) {\n event.preventDefault();\n playPresenterTimer();\n timeallotment();\n }", "function startTimer() {\n\n showQuestions()\n countdownTimer()\n}", "function setCurrentTime(widget, ampm)\n{\n var today = new Date();\n var hours = today.getHours();\n var pm = false;\n if (hours >= 12)\n {\n pm = true;\n }\n if (hours > 12)\n {\n hours = hours - 12;\n }\n\n if (hours == 0)\n {\n hours = 12;\n }\n else if (hours < 10)\n {\n hours = \"0\" + hours;\n }\n\n var minutes = today.getMinutes();\n if (minutes < 10)\n {\n minutes = \"0\" + minutes;\n }\n time = hours + \":\" + minutes;\n widget.value = time;\n\n //SCR 13251\n var iPM;\n var iAM;\n\n if (ampm != null)\n {\n for (var j = 0; j < ampm.options.length; j ++)\n {\n var text = ampm.options[j].text;\n if (text == \"PM\")\n {\n iPM = j;\n }\n if (text == \"AM\")\n {\n iAM = j;\n }\n }\n }\n\n\n\n if (ampm != null)\n {\n if (pm)\n ampm.selectedIndex = iPM;\n else\n ampm.selectedIndex = iAM;\n }\n return true;\n} //setCurrentTime()", "function startTimer() {\n clearInterval(countdown);\n // grab the data in the buttons for each time and convert from string to integer\n const seconds = parseInt(this.dataset.time, 10);\n timer(seconds);\n}", "function bonusTimer() {\n if (bonusTime > 0) {\n bonusTime--;\n bonusBtn.value = bonusTime + \" seconds remaining!\"\n } else {\n stopBonus();\n refreshDisplay();\n }\n}", "function ButtonTimerAll() { }", "function pauseCountdownOnModalOpen() {\n $(\".rules\").click(function(){\n timer.pauseTimer();\n });\n}", "valueTimeButton(button) {\n let buttonValue = button.target.value;\n this.setState({\n time: buttonValue,\n disabled: buttonValue\n });\n /** When a time-button is clicked - show book buttons depending if you are logged in or not */\n this.showGuestFormButton();\n this.showBookButtonWhenLoggedIn();\n }", "function showTimer(){\n lastElapsedTime = elapsedTimeAsString();\n defaultStatus = lastElapsedTime;\n}", "function OnTimeSliderMouseUp(btn){\n\n\tg_bTimeSliderUpdate = true;\n\tOnSliderMouseUp(btn, g_nIndexTimeline);\n\n}", "function chooseCustomTime() {\n const timeInput = document.getElementById('time-input').value;\n setSessionTime(parseInt(timeInput)/60); setChoiceLevel(2);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event: error See Method: on Install an event handler See for documentation. Method: getNode Get a node. Parameters: path absolute path Returns: a node object. If no node is found at the given path, a new empty node object is constructed instead.
function getNode(path) { logger.info('getNode', path); if(! path) { // FIXME: fail returned promise instead. throw new Error("No path given!"); } validPath(path); return dataStore.get(path).then(function(node) { if(! node) { node = {//this is what an empty node looks like timestamp: 0, lastUpdatedAt: 0, mimeType: "application/json" }; if(util.isDir(path)) { node.diff = {}; node.data = {}; } } return node; }); }
[ "getNode() {\n return null;\n }", "function getNode(tree, path) {\n searchPath = path.slice();\n var node = tree;\n while (searchPath.length) {\n part = searchPath.shift();\n node = find(node.dependencies, part);\n if (!node) {\n console.log('cannot find' + path.join('|'));\n return;\n }\n }\n\n return node;\n }", "function getNode(n) {\n // if node exists, then just return the node\n if (nodes[n]) return nodes[n];\n // if the node didn't exist before\n else {\n // create the node using createElement function, and update that in nodes' object\n nodes[n] = document.createElement(n);\n // return the node\n return nodes[n];\n }\n }", "function findNode(path) {\n\t return editor.node.findNodeByInternalPath(path)\n\t }", "function findNode (path) {\n return editor.node.findNodeByInternalPath(path)\n }", "function getNodeAtPath(nodePath)\n{ \n for (var n=0; n<nodes.length; n++)\n {\n if(nodes[n].taxonomyByName == nodePath)\n {\n return currentNode;\n }\n }\n\n return null;\n}", "function findNode(path) {\n return editor.node.findNodeByInternalPath(path)\n }", "retrieveNodeOnId(eventId) {\n\n //get the node by event id\n let node = this.eventMap[eventId];\n \n //if the node isn't present display an error\n if(!node) {\n console.log(`Inside retrieveNodeOnId()`); \n console.log(eventId); \n //this.print();\n throw `Node node with the id: ${eventId} does not exist in the code list`;\n }\n\n return node;\n }", "static getNode (dcid, createp) {\n var existing = Node.nodeHash[dcid];\n if (existing) {\n return existing;\n } else if (createp) {\n var newNode = new Node(dcid);\n Node.nodeHash[dcid] = newNode;\n return newNode;\n } else {\n return null;\n }\n }", "function getNode(id){\n return nodes.findOne({id:id});\n}", "function _getNode(key){\n\treturn $(\"#tree\").fancytree(\"getTree\").getNodeByKey(key);\n}", "function getNode(nodeID) {\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].id == nodeID)\n return nodes[i]; \n }\n throw \"Node ID does not exist.\"\n}", "function fetchRemoteNode(path, isDeleted) {\n logger.info(\"fetch remote\", path);\n return remoteAdapter.get(path).\n then(function(node) {\n if(! node) {\n node = {};\n }\n if(util.isDir(path) && (! node.data)) {\n node.data = {};\n }\n return node;\n });\n }", "getNode(name){\n return(this.node[name]);\n}", "getNode(nodeId, pipelineId) {\n\t\treturn this.objectModel.getAPIPipeline(pipelineId).getNode(nodeId);\n\t}", "static getNode() {\n\n return database.ref(nodeName);\n\n }", "static getForNode(node, parentPath = null, prop = null, index = -1) {\n if (!node) {\n return null;\n }\n\n if (!NodePath.registry.has(node)) {\n NodePath.registry.set(\n node,\n new NodePath(node, parentPath, prop, index == -1 ? null : index)\n );\n }\n\n let path = NodePath.registry.get(node);\n\n if (parentPath !== null) {\n path.parentPath = parentPath;\n path.parent = path.parentPath.node;\n }\n\n if (prop !== null) {\n path.property = prop;\n }\n\n if (index >= 0) {\n path.index = index;\n }\n\n return path;\n }", "function findNodeWithPath(path) {\n var foundNode;\n $scope.treeData.forEach(function(node){\n if (node.data.path == path) {\n foundNode= node;\n }\n });\n return foundNode;\n }", "getNode(x, y) {\n for (let i = 0; i < this.nodes.length; i++) {\n let node = this.nodes[i]\n if (node.x == x && node.y == y) {\n return node;\n }\n }\n return null;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
See the general considerations discussion in IExposeCommands. Everything that apply to get_commands applies also to each area.
function IExposeCommandsEx() {}
[ "function addCommands(app, palette) {\n const category = 'Main Area';\n let command = CommandIDs.activateNextTab;\n app.commands.addCommand(command, {\n label: 'Activate Next Tab',\n execute: () => {\n app.shell.activateNextTab();\n }\n });\n palette.addItem({ command, category });\n command = CommandIDs.activatePreviousTab;\n app.commands.addCommand(command, {\n label: 'Activate Previous Tab',\n execute: () => {\n app.shell.activatePreviousTab();\n }\n });\n palette.addItem({ command, category });\n command = CommandIDs.closeAll;\n app.commands.addCommand(command, {\n label: 'Close All Widgets',\n execute: () => {\n app.shell.closeAll();\n }\n });\n palette.addItem({ command, category });\n command = CommandIDs.toggleLeftArea;\n app.commands.addCommand(command, {\n label: args => 'Show Left Sidebar',\n execute: () => {\n if (app.shell.leftCollapsed) {\n app.shell.expandLeft();\n }\n else {\n app.shell.collapseLeft();\n if (app.shell.currentWidget) {\n app.shell.activateById(app.shell.currentWidget.id);\n }\n }\n },\n isToggled: () => !app.shell.leftCollapsed,\n isVisible: () => !app.shell.isEmpty('left')\n });\n palette.addItem({ command, category });\n command = CommandIDs.toggleRightArea;\n app.commands.addCommand(command, {\n label: args => 'Show Right Sidebar',\n execute: () => {\n if (app.shell.rightCollapsed) {\n app.shell.expandRight();\n }\n else {\n app.shell.collapseRight();\n if (app.shell.currentWidget) {\n app.shell.activateById(app.shell.currentWidget.id);\n }\n }\n },\n isToggled: () => !app.shell.rightCollapsed,\n isVisible: () => !app.shell.isEmpty('right')\n });\n palette.addItem({ command, category });\n command = CommandIDs.togglePresentationMode;\n app.commands.addCommand(command, {\n label: args => 'Presentation Mode',\n execute: () => {\n app.shell.presentationMode = !app.shell.presentationMode;\n },\n isToggled: () => app.shell.presentationMode,\n isVisible: () => true\n });\n palette.addItem({ command, category });\n command = CommandIDs.setMode;\n app.commands.addCommand(command, {\n isVisible: args => {\n const mode = args['mode'];\n return mode === 'single-document' || mode === 'multiple-document';\n },\n execute: args => {\n const mode = args['mode'];\n if (mode === 'single-document' || mode === 'multiple-document') {\n app.shell.mode = mode;\n return;\n }\n throw new Error(`Unsupported application shell mode: ${mode}`);\n }\n });\n command = CommandIDs.toggleMode;\n app.commands.addCommand(command, {\n label: 'Single-Document Mode',\n isToggled: () => app.shell.mode === 'single-document',\n execute: () => {\n const args = app.shell.mode === 'multiple-document'\n ? { mode: 'single-document' }\n : { mode: 'multiple-document' };\n return app.commands.execute(CommandIDs.setMode, args);\n }\n });\n palette.addItem({ command, category });\n}", "function addMenuCommands() {\n var navigateMenu = Menus.getMenu(Menus.AppMenuBar.NAVIGATE_MENU),\n viewMenu = Menus.getMenu(Menus.AppMenuBar.VIEW_MENU),\n registerCommandHandler = function (commandId, menuName, handler, shortcut, menu) {\n CommandManager.register(menuName, commandId, handler);\n menu.addMenuItem(commandId);\n KeyBindingManager.addBinding(commandId, shortcut);\n };\n\n navigateMenu.addMenuDivider();\n\n registerCommandHandler('bliitzkrieg.todoer.view', EXTENSION_NAME, togglePanel, 'Ctrl-Alt-Shift-T', viewMenu);\n }", "get commands() {\n let commands = this._commands.reduce((commands, command) => ({\n ...commands,\n [command.name]: new EditorCommandAdaptor(command, this)\n }), {});\n return commands;\n }", "registerCommands() {\n this.cmds.push(new ListServers(this.iface));\n this.cmds.push(new CreateServer(this.iface));\n this.cmds.push(new Login(this.iface));\n }", "get commands() {\n \n return this._commands.reduce((commands, command) => ({\n ...commands,\n [command.name]: new EditorCommandAdaptor(command, this)\n }), {});\n\n }", "function addMenuCommands() {\n var navigateMenu = Menus.getMenu(Menus.AppMenuBar.NAVIGATE_MENU);\n var viewMenu = Menus.getMenu(Menus.AppMenuBar.VIEW_MENU);\n var registerCommandHandler = function (commandId, menuName, handler, shortcut, menu) {\n CommandManager.register(menuName, commandId, handler);\n menu.addMenuItem(commandId);\n KeyBindingManager.addBinding(commandId, shortcut);\n };\n\n navigateMenu.addMenuDivider();\n\n registerCommandHandler('georapbox.notes.viewNotes', Strings.COMMAND_NAME, togglePanel, 'Ctrl-Alt-Shift-N', viewMenu);\n }", "get commands() { return this.#commands_.values(); }", "get commands() {\n\t\treturn this._commands;\n\t}", "_addCommands() {\n\n const editor = this.editor;\n\n // Add command to open the formula editor\n editor.commands.add( 'MathType', new commands_MathTypeCommand( editor ) );\n\n // Add command to open the chemistry formula editor\n editor.commands.add( 'ChemType', new ChemTypeCommand( editor ) );\n\n }", "getAllCommands() {\n return this.commands.concat(this.defaultCommands);\n }", "get commands() {\n return this.commandManager.commands;\n }", "_assignCommands() {\n const gameStarted = gameHasStarted(this.get('state'));\n const panels = gameStarted ? this._playingPanels : this.panels;\n\n // Choose as many controls to manipulate as there are panels needing commands.\n // Panels waiting to start will get commands when we start.\n // Also don't assign when we're between levels or dead.\n const panelsNeedingCommands = panels.filter((panel) => {\n return !panel.has('command') &&\n !((this.get('state') === WAITING_TO_START) && this._playingPanels.contains(panel)) &&\n (this.get('state') <= IN_LEVEL);\n });\n if (_.isEmpty(panelsNeedingCommands)) return;\n\n const activeControls = this._commands.pluck('control');\n const inactiveControlsByPanel = new Map();\n panels.each((panel) => {\n const inactiveControls = panel.controls.difference(activeControls);\n if (!_.isEmpty(inactiveControls)) {\n inactiveControlsByPanel.set(panel, inactiveControls);\n }\n });\n\n panelsNeedingCommands.forEach((panel) => {\n let panelToAssign, controlsToAssign;\n\n // If we're waiting to start, we assign only same-panel commands, so that we may detect if\n // a player is actually at the panel. Otherwise we assign cross-panel commands too, for most\n // shouting.\n //\n // When we choose cross-panel commands, we choose a panel first, _then_ a control from that\n // panel, rather than sampling from _all_ panels, in order to try to more evenly distribute\n // commands between panels i.e. players (even if one panel has a ton of controls).\n if (gameStarted) {\n panelToAssign = _.sample([...inactiveControlsByPanel.keys()]);\n } else {\n panelToAssign = panel;\n }\n\n controlsToAssign = inactiveControlsByPanel.get(panelToAssign);\n\n const control = _.sample(controlsToAssign);\n\n // We might have run out of controls.\n if (!control) return;\n\n // Remove this control (and potentially panel) from the set to assign.\n controlsToAssign = _.without(controlsToAssign, control);\n if (_.isEmpty(controlsToAssign)) {\n inactiveControlsByPanel.delete(panelToAssign);\n } else {\n inactiveControlsByPanel.set(panel, controlsToAssign);\n }\n\n const command = control.getCommand();\n panel.set({ command });\n this._commands.add(command);\n\n // Give the player a limited time to perform commands.\n command.start(timeToPerformMs(this.get('state')));\n });\n }", "function addMenuCommands() {\n var navigateMenu = Menus.getMenu(Menus.AppMenuBar.NAVIGATE_MENU),\n viewMenu = Menus.getMenu(Menus.AppMenuBar.VIEW_MENU),\n registerCommandHandler = function (commandId, menuName, handler, shortcut, menu) {\n CommandManager.register(menuName, commandId, handler);\n menu.addMenuItem(commandId);\n KeyBindingManager.addBinding(commandId, shortcut);\n };\n \n navigateMenu.addMenuDivider();\n \n registerCommandHandler('georapbox.notes.viewNotes', 'Notes', togglePanel, 'Ctrl-Alt-Shift-N', viewMenu);\n }", "function addCommands(app, palette) {\n const { commands, contextMenu, shell } = app;\n const category = 'Main Area';\n // Returns the widget associated with the most recent contextmenu event.\n const contextMenuWidget = () => {\n const test = (node) => !!node.dataset.id;\n const node = app.contextMenuHitTest(test);\n if (!node) {\n // Fall back to active widget if path cannot be obtained from event.\n return shell.currentWidget;\n }\n const matches = toArray(shell.widgets('main')).filter(widget => widget.id === node.dataset.id);\n if (matches.length < 1) {\n return shell.currentWidget;\n }\n return matches[0];\n };\n // Closes an array of widgets.\n const closeWidgets = (widgets) => {\n widgets.forEach(widget => widget.close());\n };\n // Find the tab area for a widget within a specific dock area.\n const findTab = (area, widget) => {\n switch (area.type) {\n case 'split-area':\n const iterator = iter(area.children);\n let tab = null;\n let value = null;\n do {\n value = iterator.next();\n if (value) {\n tab = findTab(value, widget);\n }\n } while (!tab && value);\n return tab;\n case 'tab-area':\n const { id } = widget;\n return area.widgets.some(widget => widget.id === id) ? area : null;\n default:\n return null;\n }\n };\n // Find the tab area for a widget within the main dock area.\n const tabAreaFor = (widget) => {\n const { mainArea } = shell.saveLayout();\n if (mainArea.mode !== 'multiple-document') {\n return null;\n }\n let area = mainArea.dock.main;\n if (!area) {\n return null;\n }\n return findTab(area, widget);\n };\n // Returns an array of all widgets to the right of a widget in a tab area.\n const widgetsRightOf = (widget) => {\n const { id } = widget;\n const tabArea = tabAreaFor(widget);\n const widgets = tabArea ? tabArea.widgets || [] : [];\n const index = widgets.findIndex(widget => widget.id === id);\n if (index < 0) {\n return [];\n }\n return widgets.slice(index + 1);\n };\n commands.addCommand(CommandIDs.activateNextTab, {\n label: 'Activate Next Tab',\n execute: () => {\n shell.activateNextTab();\n }\n });\n palette.addItem({ command: CommandIDs.activateNextTab, category });\n commands.addCommand(CommandIDs.activatePreviousTab, {\n label: 'Activate Previous Tab',\n execute: () => {\n shell.activatePreviousTab();\n }\n });\n palette.addItem({ command: CommandIDs.activatePreviousTab, category });\n // A CSS selector targeting tabs in the main area. This is a very\n // specific selector since we really only want tabs that are\n // in the main area, as opposed to those in sidebars, ipywidgets, etc.\n const tabSelector = '#jp-main-dock-panel .p-DockPanel-tabBar.jp-Activity .p-TabBar-tab';\n commands.addCommand(CommandIDs.close, {\n label: () => 'Close Tab',\n isEnabled: () => !!shell.currentWidget && !!shell.currentWidget.title.closable,\n execute: () => {\n if (shell.currentWidget) {\n shell.currentWidget.close();\n }\n }\n });\n palette.addItem({ command: CommandIDs.close, category });\n contextMenu.addItem({\n command: CommandIDs.close,\n selector: tabSelector,\n rank: 4\n });\n commands.addCommand(CommandIDs.closeAll, {\n label: 'Close All Tabs',\n execute: () => {\n shell.closeAll();\n }\n });\n palette.addItem({ command: CommandIDs.closeAll, category });\n commands.addCommand(CommandIDs.closeOtherTabs, {\n label: () => `Close All Other Tabs`,\n isEnabled: () => {\n // Ensure there are at least two widgets.\n const iterator = shell.widgets('main');\n return !!iterator.next() && !!iterator.next();\n },\n execute: () => {\n const widget = contextMenuWidget();\n if (!widget) {\n return;\n }\n const { id } = widget;\n const otherWidgets = toArray(shell.widgets('main')).filter(widget => widget.id !== id);\n closeWidgets(otherWidgets);\n }\n });\n palette.addItem({ command: CommandIDs.closeOtherTabs, category });\n contextMenu.addItem({\n command: CommandIDs.closeOtherTabs,\n selector: tabSelector,\n rank: 4\n });\n commands.addCommand(CommandIDs.closeRightTabs, {\n label: () => `Close Tabs to Right`,\n isEnabled: () => contextMenuWidget() && widgetsRightOf(contextMenuWidget()).length > 0,\n execute: () => {\n const widget = contextMenuWidget();\n if (!widget) {\n return;\n }\n closeWidgets(widgetsRightOf(widget));\n }\n });\n palette.addItem({ command: CommandIDs.closeRightTabs, category });\n contextMenu.addItem({\n command: CommandIDs.closeRightTabs,\n selector: tabSelector,\n rank: 5\n });\n app.commands.addCommand(CommandIDs.toggleLeftArea, {\n label: args => 'Show Left Sidebar',\n execute: () => {\n if (shell.leftCollapsed) {\n shell.expandLeft();\n }\n else {\n shell.collapseLeft();\n if (shell.currentWidget) {\n shell.activateById(shell.currentWidget.id);\n }\n }\n },\n isToggled: () => !shell.leftCollapsed,\n isVisible: () => !shell.isEmpty('left')\n });\n palette.addItem({ command: CommandIDs.toggleLeftArea, category });\n app.commands.addCommand(CommandIDs.toggleRightArea, {\n label: args => 'Show Right Sidebar',\n execute: () => {\n if (shell.rightCollapsed) {\n shell.expandRight();\n }\n else {\n shell.collapseRight();\n if (shell.currentWidget) {\n shell.activateById(shell.currentWidget.id);\n }\n }\n },\n isToggled: () => !shell.rightCollapsed,\n isVisible: () => !shell.isEmpty('right')\n });\n palette.addItem({ command: CommandIDs.toggleRightArea, category });\n app.commands.addCommand(CommandIDs.togglePresentationMode, {\n label: args => 'Presentation Mode',\n execute: () => {\n shell.presentationMode = !shell.presentationMode;\n },\n isToggled: () => shell.presentationMode,\n isVisible: () => true\n });\n palette.addItem({ command: CommandIDs.togglePresentationMode, category });\n app.commands.addCommand(CommandIDs.setMode, {\n isVisible: args => {\n const mode = args['mode'];\n return mode === 'single-document' || mode === 'multiple-document';\n },\n execute: args => {\n const mode = args['mode'];\n if (mode === 'single-document' || mode === 'multiple-document') {\n shell.mode = mode;\n return;\n }\n throw new Error(`Unsupported application shell mode: ${mode}`);\n }\n });\n app.commands.addCommand(CommandIDs.toggleMode, {\n label: 'Single-Document Mode',\n isToggled: () => shell.mode === 'single-document',\n execute: () => {\n const args = shell.mode === 'multiple-document'\n ? { mode: 'single-document' }\n : { mode: 'multiple-document' };\n return app.commands.execute(CommandIDs.setMode, args);\n }\n });\n palette.addItem({ command: CommandIDs.toggleMode, category });\n}", "executeGridMenuInternalCustomCommands(e, args) {\n if (args && args.command) {\n switch (args.command) {\n case 'clear-filter':\n this.filterService.clearFilters();\n this.sharedService.dataView.refresh();\n break;\n case 'clear-sorting':\n this.sortService.clearSorting();\n this.sharedService.dataView.refresh();\n break;\n case 'export-csv':\n this.exportService.exportToFile({\n delimiter: DelimiterType.comma,\n filename: 'export',\n format: FileType.csv,\n useUtf8WithBom: true,\n });\n break;\n case 'export-excel':\n this.excelExportService.exportToExcel({\n filename: 'export',\n format: FileType.xlsx,\n });\n break;\n case 'export-text-delimited':\n this.exportService.exportToFile({\n delimiter: DelimiterType.tab,\n filename: 'export',\n format: FileType.txt,\n useUtf8WithBom: true,\n });\n break;\n case 'toggle-filter':\n const showHeaderRow = this.sharedService && this.sharedService.gridOptions && this.sharedService.gridOptions.showHeaderRow || false;\n this.sharedService.grid.setHeaderRowVisibility(!showHeaderRow);\n break;\n case 'toggle-toppanel':\n const showTopPanel = this.sharedService && this.sharedService.gridOptions && this.sharedService.gridOptions.showTopPanel || false;\n this.sharedService.grid.setTopPanelVisibility(!showTopPanel);\n break;\n case 'toggle-preheader':\n const showPreHeaderPanel = this.sharedService && this.sharedService.gridOptions && this.sharedService.gridOptions.showPreHeaderPanel || false;\n this.sharedService.grid.setPreHeaderPanelVisibility(!showPreHeaderPanel);\n break;\n case 'refresh-dataset':\n this.refreshBackendDataset();\n break;\n default:\n break;\n }\n }\n }", "setCommandsEnabled() {\n this.commandsFeatureEnabled_ = true;\n for (const key in Command.Action) {\n const actionId = Command.Action[key];\n let messageId;\n switch (actionId) {\n case Command.Action.DELETE_ONCE:\n messageId = 'dictation_command_delete_once';\n break;\n case Command.Action.MOVE_LEFT_ONCE:\n messageId = 'dictation_command_move_left_once';\n break;\n case Command.Action.MOVE_RIGHT_ONCE:\n messageId = 'dictation_command_move_right_once';\n break;\n case Command.Action.MOVE_UP_ONCE:\n messageId = 'dictation_command_move_up_once';\n break;\n case Command.Action.MOVE_DOWN_ONCE:\n messageId = 'dictation_command_move_down_once';\n break;\n case Command.Action.COPY:\n // TODO(1247299): This command requires text to be selected but\n // composition text changes during speech, clearing the selection.\n // This will work better when we use a different UI than composition\n // text to display interim results.\n messageId = 'dictation_command_copy';\n break;\n case Command.Action.PASTE:\n messageId = 'dictation_command_paste';\n break;\n case Command.Action.CUT:\n messageId = 'dictation_command_cut';\n break;\n case Command.Action.UNDO:\n messageId = 'dictation_command_undo';\n break;\n case Command.Action.REDO:\n messageId = 'dictation_command_redo';\n break;\n case Command.Action.SELECT_ALL:\n messageId = 'dictation_command_select_all';\n break;\n case Command.Action.UNSELECT_ALL:\n messageId = 'dictation_command_unselect_all';\n break;\n case Command.Action.NEW_LINE:\n messageId = 'dictation_command_new_line';\n break;\n default:\n continue;\n }\n const commandString = chrome.i18n.getMessage(messageId);\n this.commandMap_.set(actionId, {\n commandString,\n matchesCommand: this.commandMatcher_(commandString),\n matchesTypeCommand: this.typeCommandMatcher_(commandString)\n });\n }\n }", "get commands() {\n \n // adapt prosemirror commands\n let commands = this._commands.reduce((commands, command) => ({\n ...commands,\n [command.name]: new EditorCommandAdaptor(command, this)\n }), {});\n\n // additional commands\n commands['show_changes'] = {\n title: \"Show changes\",\n icon: \"change_history\",\n isEnabled: () => true,\n isLatched: () => this._options.show_changes,\n execute: () => {\n this._options.show_changes = !this._options.show_changes;\n this.reloadContent();\n }\n };\n\n return commands;\n\n }", "get commands () {\n return this.commandManager\n }", "setupCmdMap() {\n console.log(\"mapping cmds\");\n console.log(Constants.CMDS);\n console.log(Constants.CMDS.SERVER_FULL_UPDATE);\n this.cmdMap[Constants.CMDS.SERVER_FULL_UPDATE] = this.onServerWorldUpdate;\n this.cmdMap[Constants.CMDS.PLAYER_JOINED] = this.onJoined;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
displaying all buttons in array villains
function renderButtons() { //deletes all existing buttons $("#buttons-view").empty(); // loop through array for (var i = 0; i < villains.length; i++) { //new button tag var newButton = $("<button>"); // class="villain-btn" given to button tag newButton.addClass("villain-btn"); // data-name is the villains name newButton.attr("data-name", villains[i]); // the label of each button newButton.text(villains[i]); // appending onto html $("#buttons-view").append(newButton); } }
[ "function renderButtons() {\n\n // Clear all of the buttons so that buttons don't repeat\n $(\".buttons\").empty();\n\n // Looping through the array of pokemon\n for (var i = 0; i < pokemon.length; i++) {\n\n var a = $(\"<button>\");\n\n a.addClass(\"btn btn-info poke-btn\");\n a.attr(\"data-name\", pokemon[i]);\n a.text(pokemon[i]);\n\n $(\".buttons\").append(a);\n }\n }", "function renderButtons() {\n // Delete previous buttons to avoid repeat\n $(\"#buttons-list\").empty();\n // Go through loop to add a button for each tv show\n for (var i = 0; i < topics.length; i++) {\n var showDiv = $(\"<button>\");\n showDiv.addClass(\"tvShow btn-md btn-space\");\n // Add attribute with value of TV show\n showDiv.attr(\"name\", topics[i]);\n // Add TV show name\n showDiv.text(topics[i]);\n // Adding the button to the HTML\n $(\"#buttons-list\").append(showDiv);\n \n }\n }", "function displayButtons(){\n\n\t\t\tfor (var i = 0; i < searchArray.length; i++) {\n\t\t\t\t\n\t\t\t\t//create new button\n\t\t\t\tvar makeBtn = $('<button>');\n\t\t\t\t//add class, text, and a value\n\t\t\t\tmakeBtn.addClass(\"gifBtn\");\n\t\t\t\tmakeBtn.text(searchArray[i].toUpperCase());\n\t\t\t\tmakeBtn.val(searchArray[i]);\n\t\t\t\t//append to div\n\t\t\t\t$('#button_view').append(makeBtn);\n\t\t\t}\n\t\t}", "showButtons() {\n this.visible = true;\n for (const button of this.buttonsAsArray) {\n button.showButton();\n }\n }", "static showAll() {\n choiceButtons.forEach(button => {\n button.element.style.display = 'inline-block';\n });\n }", "function showButtons(){\n\n // for loop to go through the array and create the buttomns\n // need to add class and atributes and name\n // have to append the buttons in the webpage\n $(\"#button-list\").html(\"\"); // cleans the button list before a new buttom is added and showButtons function add back the buttons\n for (var i = 0; i < topics.length; i++) {\n var plugButton = $(\"<button>\");\n\n plugButton.addClass(\"mma\");\n plugButton.attr(\"data-name\", topics[i]);\n plugButton.text(topics[i]);\n $(\"#button-list\").append(plugButton);\n }\n }", "function renderButtons() {\n \n //this deletes the buttons before adding new ones to not repeat\n $(\"#btnView\").empty();\n \n\n //created a loop to go through array of reaciton gifs\n for (var i = 0; i < btnArray.length; i++) {\n\n //creates buttons for each reaction in the array\n var btnCreate = $(\"<button>\").addClass(\"btn\").attr(\"data-name\", btnArray[i]).text(btnArray[i]);\n \n //appends buttons to the HTML\n $(\"#btnView\").append(btnCreate);\n }\n }", "function displayButtons() {\n \n // >> clears button-area and generates/re-generates\n $(\"#button-area\").empty();\n \n // a button for every item in the nameArray\n for (let i = 0; i < nameArray.length; i++) {\n var arr = nameArray[i];\n \n // creates the button element\n var mkBut = $(\"<button>\");\n \n // adds the name-button class to each\n mkBut.addClass(\"name-button\");\n \n // adds name attribute to each\n mkBut.attr(\"data-name\", arr);\n \n // adds text to each\n mkBut.text(arr);\n \n // adds the buttons to the button-area div\n $(\"#button-area\").append(mkBut);\n \n }\n }", "function showButtons() {\n\n $(\"#buttons\").empty();\n\n for (var i = 0; i < superHeroes.length; i++) {\n $(\"#buttons\").append(`<button classe=\"btn\">${superHeroes[i]}`);\n }\n}", "function displayButtons(){\n\t//First Empty the section before recreating it\n\t$(\"#button-section\").empty();\n\n\t//Loop through the areay to recreate it\n\tfor (var i = 0; i < topics.length; i++){\n\n\t\t//create button for each click\n\t\tvar animalBtn = $(\"<button>\");\n\n\t\t//Animal class added is to be used later for each of the animal button clicks\n\t\tanimalBtn.addClass(\"btn btn-default animal\");\n\n\t\t//Store the value of the text in a variable\n\t\tanimalBtn.attr(\"data-attr\",topics[i]);\n\n\t\t//Write the value of the search on the text button\n\t\tanimalBtn.text(topics[i]);\n\n\t\t//Adding button to section\n\t\t$(\"#button-section\").append(animalBtn);\n\n\t\t//Clear the search\n\t\t$(\"#add-animal\").val(\"\");\n\t}\n}", "function displayButtons(gifs){\n\t\t//clear out div so that appended array doesn't double\n\t\t$(\"#giphy-buttons\").empty();\n\t//put each index of array into a button\n\t//create loop for developer movie array\n\t\tfor (var i = 0; i < gifs.length; i++){\n\t\t// console.log(local);\n\n\t\t//create button variable\n\t\tvar movieButton = $(\"<button class='btn btn-success'>\");\n\t\t//create id attribute for button variable and set value to developer movie array loop\n\t\tmovieButton.attr(\"id\", gifs[i]);\n\t\t//add class unique class to identify giphy buttons\n\t\tmovieButton.addClass(\"giphy-button\");\n\t\t//write names of each developer movie into button text\n\t\tmovieButton.text(gifs[i]);\n\t\t//append mutated button variable to #giphy-buttons id\n\t\t$(\"#giphy-buttons\").append(movieButton);\n\t\t\n\t}\n\n\t\n}", "function displayButtons() {\n // Empty anything that might be there to avoid duplicates\n $(\"#gifBtnDisplay\").empty();\n for (var i = 0; i < starterItems.length; i++) {\n var gifBtn = $(\"<button>\");\n gifBtn.addClass(\"btn btn-success btn-lg\");\n gifBtn.attr(\"data-name\", starterItems[i]);\n gifBtn.text(starterItems[i]);\n $(\"#gifBtnDisplay\").prepend(gifBtn);\n }\n }", "function displayButtons() {\n $(\"#gifsView\").empty();\n for (var i = 0; i < topics.length; i++) {\n var gifButton = $(\"<button>\");\n gifButton.addClass(\"MovieStar\");\n gifButton.addClass(\"btn btn-primary\");\n gifButton.attr(\"data-name\", topics[i]);\n gifButton.text(topics[i]);\n $(\"#gifsView\").append(gifButton);\n }\n }", "function renderButtons() {\n // Delete the content inside the buttons-view div prior to adding new movies\n $(\"#buttons-view\").empty();\n // Loop through the array of directors, then generate buttons for each game of thrones element in the array \n for (var i = 0; i < gameOfThrones.length; i++) {\n var newBTN = $(\"<button>\").text(gameOfThrones[i]);\n newBTN.addClass(\"gotSearch btn btn-light btn-lg\");\n newBTN.attr(\"data-name\", gameOfThrones[i]);\n $(\"#buttons-view\").append(newBTN);\n }\n }", "function renderButtons(){\n\n\t$(\"#giphButtons\").empty();\n\n\tfor (var i = 0; i < comedians.length; i++) {\n\t\t\n\n\t\tvar a = $(\"<button>\");\n\t\ta.addClass(\"items\");\n\t\ta.attr(\"data-name\", comedians[i]);\n\t\ta.text(comedians[i]);\n\t\t$(\"#giphButtons\").append(a);\n\t}\n}", "function renderButtons() {\n $(\"#buttons-view\").empty();\n\n for (var i = 0; i < nbaPlayers.length; i++) {\n //create all buttons\n var a = $(\"<button>\");\n a.addClass(\"basketball\");\n a.attr(\"data-name\", nbaPlayers[i]);\n a.text(nbaPlayers[i]);\n $(\"#buttons-view\").append(a);\n }\n }", "function renderButtons(){ \n\n\t\t// Deletes any previous button to prevent duplicates\n\t\t$('#baby_buttons').empty();\n\n\t\t// Loops through the array of animals\n\t\tfor (var i = 0; i < topics.length; i++){\n\n\t\t\t// Then dynamicaly generate a button for each baby in the array \n\t\t var babyButton = $('<button>') \n\t\t babyButton.addClass('baby_button'); // Added a class \n\t\t babyButton.attr('data-name', topics[i]); // Added a data-attribute\n\t\t babyButton.text(topics[i]); // Provided the initial button text\n\t\t $('#baby_buttons').append(babyButton); // Added the button to the HTML\n\t\t}\n\t}", "function renderButtons() {\n\n // Deleting the genres prior to adding new genres\n $(\"#buttons-view\").empty();\n \n // Looping through the array of movie genres\n for (var i = 0; i < topics.length; i++) {\n\n // Dynamicaly generating buttons for each movie genre in the array\n var a = $(\"<button>\");\n // Adding a class of genre-btn to our button\n a.addClass(\"genre-btn\");\n // Adding a data-attribute\n a.attr(\"data-name\", topics[i]);\n // Providing the initial button text\n a.text(topics[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n }\n }", "function renderButtons() {\n\n\n $(\"#playerBtn\").empty();\n\n\n for (var i = 0; i < playerArray.length; i++) {\n\n\n var a = $(\"<button>\");\n\n a.addClass(\"nbaPlayers\");\n\n a.attr(\"data-name\", playerArray[i]);\n\n a.text(playerArray[i]);\n\n $(\"#playerBtn\").append(a);\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If you want to use your own accessor implementation, you can use this method to invoke the patcher. Since all subsequent accessors for children of this accessor are obtained through the methods in the accessors, you retain full control of the implementation throguhgout the application. Have a look in ImmutableAccessor to see an example of how accessors are implemented.
applyViaAccessor(accessor) { var result = accessor; var idAccessor = accessor.getAttribute('_id'); var id; if (idAccessor) { id = idAccessor.get(); } else { throw new Error('Cannot apply patch to document with no _id'); } this.patches.forEach(patch => { if (patch.id !== id) { // Ignore patches that are not targetted at this document // console.log("Ignored patch because id did not match document id", patch.id, id) return; } var matcher = _jsonpath.Matcher.fromPath(patch.path).setPayload(patch); result = process(matcher, result); }); return result; }
[ "function patchAccessors(proto) {\n patchAccessorGroup(proto, OutsideAccessors);\n patchAccessorGroup(proto, InsideAccessors);\n patchAccessorGroup(proto, ActiveElementAccessor);\n}", "function patchAccessors(proto) {\n\t patchAccessorGroup(proto, OutsideAccessors);\n\t patchAccessorGroup(proto, InsideAccessors);\n\t patchAccessorGroup(proto, ActiveElementAccessor);\n\t}", "applyViaAccessor(accessor) {\n let result = accessor;\n const idAccessor = accessor.getAttribute(\"_id\");\n if (!idAccessor) {\n throw new Error(\"Cannot apply patch to document with no _id\");\n }\n const id = idAccessor.get();\n for (const patch of this.patches) {\n if (patch.id !== id) {\n continue;\n }\n const matcher = Matcher.fromPath(patch.path).setPayload(patch);\n result = process(matcher, result);\n }\n return result;\n }", "get accessor_prop() { /* function body here */ }", "patch(patch, index, value) {\n return this._patchers[index](patch, value);\n }", "get accessor_prop() {\n\t\t/* function body here */\n\t}", "installGetters () {\n let that = this;\n Object.keys(this.setters).forEach(function (attrName) {\n let processingMethod = that.getters[attrName];\n Object.defineProperty(that, attrName, {\n get: function () {\n if (this._processed &&\n processingMethod !== undefined) {\n processingMethod.call(that);\n }\n return this['_' + attrName];\n }\n });\n });\n }", "function overrideAccessors(name, fn) {\n helperAccessors[name] = fn;\n}", "get accessorProp() { return this.dataProp; }", "function repairAccessors(unsafeRec) {\n const { unsafeGlobal: g } = unsafeRec;\n\n defineProperties(g.Object.prototype, {\n __defineGetter__: {\n value(prop, func) {\n return defineProperty(this, prop, {\n get: func,\n enumerable: true,\n configurable: true\n });\n }\n },\n __defineSetter__: {\n value(prop, func) {\n return defineProperty(this, prop, {\n set: func,\n enumerable: true,\n configurable: true\n });\n }\n },\n __lookupGetter__: {\n value(prop) {\n prop = asPropertyName(prop); // sanitize property name/symbol\n let base = this;\n let desc;\n while (base && !(desc = getOwnPropertyDescriptor(base, prop))) {\n base = getPrototypeOf(base);\n }\n return desc && desc.get;\n }\n },\n __lookupSetter__: {\n value(prop) {\n prop = asPropertyName(prop); // sanitize property name/symbol\n let base = this;\n let desc;\n while (base && !(desc = getOwnPropertyDescriptor(base, prop))) {\n base = getPrototypeOf(base);\n }\n return desc && desc.set;\n }\n }\n });\n }", "function patchAccessorGroup(obj, descriptors, force) {\n\t for (var p in descriptors) {\n\t var objDesc = Object.getOwnPropertyDescriptor(obj, p);\n\t if (objDesc && objDesc.configurable || !objDesc && force) {\n\t Object.defineProperty(obj, p, descriptors[p]);\n\t } else if (force) {\n\t console.warn('Could not define', p, 'on', obj);\n\t }\n\t }\n\t}", "function InstallGetter(object, name, getter, attributes) {\n %CheckIsBootstrapping();\n if (typeof attributes == \"undefined\") {\n attributes = DONT_ENUM;\n }\n SetFunctionName(getter, name, \"get\");\n %FunctionRemovePrototype(getter);\n %DefineAccessorPropertyUnchecked(object, name, getter, null, attributes);\n %SetNativeFlag(getter);\n}", "function accessorLegacyDecorator(name, logic, metadata) {\n // Legacy accessor decorator.\n return function (target, property, descriptor) {\n // Register accessor decorator.\n addProperty_1.addProperty(target, property, {\n name: name,\n metadata: metadata,\n spec: 'legacy',\n type: decorator_1.Decorator.Accessor\n });\n // Execute decorator logic at runtime.\n return logic(target, property, descriptor, metadata);\n };\n}", "function accessorFactory(wrappers, wrapped, propName) {\n // Order the stack of wrappers\n var stack = wrappers.sort(compareLevels);\n return function accessor() {\n var el = this;\n // The first function of the stack is called,\n // calling the next function when its argument function next is called.\n // The original accessor is the last call.\n return stack.reduce(function (previous, current) {\n return current.bind(el, previous, el, propName);\n }, wrapped.bind(el, el, propName)).apply(el, arguments);\n };\n }", "_applyAccessors() {\n [...this.metadata.accessors].forEach(([prop, { selector, all }]) => {\n Object.defineProperty(this, prop, {\n get() {\n return all ? this.$$(selector) : this.$(selector);\n }\n });\n });\n }", "defineAccessor() {\n return new NestedAggregatingFacetAccessor(\n this.props.field, this.getAccessorOptions()\n );\n }", "static createProperty(e,t=defaultPropertyDeclaration){// Do not generate an accessor if the prototype already has one, since\n// it would be lost otherwise and that would never be the user's intention;\n// Instead, we expect users to call `requestUpdate` themselves from\n// user-defined accessors. Note that if the super has an accessor we will\n// still overwrite it\nif(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const n=\"symbol\"==typeof e?Symbol():`__${e}`;Object.defineProperty(this.prototype,e,{// tslint:disable-next-line:no-any no symbol in index\nget(){return this[n]},set(t){const r=this[e];this[n]=t,this._requestUpdate(e,r)},configurable:!0,enumerable:!0})}", "function InstallGetterSetter(object, name, getter, setter) {\n %CheckIsBootstrapping();\n SetFunctionName(getter, name, \"get\");\n SetFunctionName(setter, name, \"set\");\n %FunctionRemovePrototype(getter);\n %FunctionRemovePrototype(setter);\n %DefineAccessorPropertyUnchecked(object, name, getter, setter, DONT_ENUM);\n %SetNativeFlag(getter);\n %SetNativeFlag(setter);\n}", "function visitGetAccessor(node) {\n if (!shouldEmitAccessorDeclaration(node)) {\n return undefined;\n }\n var updated = ts.updateGetAccessor(node,\n /*decorators*/undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context),\n /*type*/undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));\n if (updated !== node) {\n // While we emit the source map for the node after skipping decorators and modifiers,\n // we need to emit the comments for the original range.\n ts.setCommentRange(updated, node);\n ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));\n }\n return updated;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Click to hide or reveal video
function clickVideo(video){ if(document.getElementById(video).style.visibility == "visible") document.getElementById(video).style.visibility = "hidden"; else{ document.getElementById(video).style.visibility = "visible"; } }
[ "function toggleShowVideo(e) {\n\tif (videoElement.classList.contains(\"hidden\")) {\n\t\tvideoElement.classList.toggle(\"hidden\");\n\t\tvideoButton.innerHTML = 'Hide';\n\t} else {\n\t\tvideoElement.classList.toggle(\"hidden\");\n\t\tvideoButton.innerHTML = 'Show';\n\t}\n}", "function onVideoClickTrigger(){\n $_fsg_button.togglePlayButton('hide');\n\t\t$_fullsize.stopSlideShow();\n\t}", "function handleVideoClick(vid1, vid2) {\n\n // Toggle display in the videos\n vid1.style.display = \"none\";\n vid2.style.display = \"block\";\n\n}", "function toggleVideo() {\r\n videoElt.paused ? playVideo() : pauseVideo();\r\n }", "function revealVideo(div,video_id) {\n var video = document.getElementById(video_id).src;\n document.getElementById(video_id).src = video+'&autoplay=1'; // adding autoplay to the URL\n document.getElementById(div).style.display = 'block';\n}", "function showVideo() {\n setTimeout(function(){\n domElements.IMAGE_WRAPPER.classList.remove(POSTER_READY);\n domElements.IMAGE_WRAPPER.classList.add(POSTER_HIDE);\n domElements.VIDEO.style.display = 'block';\n domElements.PANEL.classList.add(REVEAL);\n }, 1500);\n }", "function videoClicked(){\n\tplayORpause();\n}", "function handleVisibilityChange() {\r\n if (document[hidden]) {\r\n videoElement.pause();\r\n } else {\r\n videoElement.play();\r\n }\r\n}", "function handleVisibilityChange() {\n if (document[hidden]) {\n videoElement.pause();\n } else {\n videoElement.play();\n }\n}", "function showProjectVideo(evt){\n\n document.getElementById(\"container-project-video\").style.visibility = 'visible';\n\n}", "function showContentUnderVideo()\n {\n \tvar cText = \"#\"+ $.boeSettings.nextPrefix + \"-text\",\n \t cBack=\"#\"+ $.boeSettings.nextPrefix+\"-bg\";\n \t$(cText).removeClass(\"makeinvisible\");\n \t$(cBack).removeClass(\"makeinvisible\");\n }", "function mediaVisible() {\n highGroundVideo.style.visibility = \"visible\"\n}", "function selectVideo()\n{\n var videoFrame = document.getElementById('display' + this.id);\n var show = document.getElementById('Show' + this.id);\n var hide = document.getElementById('Hide' + this.id);\n if (videoFrame)\n {\n if (videoFrame.className == 'hidden')\n {\n videoFrame.className = 'center';\n show.style.display = 'none';\n hide.style.display = 'inline';\n }\n else\n {\n videoFrame.className = 'hidden';\n show.style.display = 'inline';\n hide.style.display = 'none';\n }\n }\n else\n alert(\"Can't find element id='display\" + this.id + \"'\");\n} // function selectVideo ", "function stopAndHideVideo(){\n ci.vid.pause()\n ci.ctx.clearRect(ci.vidX, ci.vidY, ci.vidW, ci.vidH)\n}", "function toggleVideo() {\n if (!isVideo) {\n updateNote.innerText = \"Starting video\";\n startVideo();\n } else {\n updateNote.innerText = \"Stopping video\";\n handTrack.stopVideo(video);\n isVideo = false;\n updateNote.innerText = \"Video stopped\";\n }\n}", "function showVideoControl() {\n TweenLite.to(videocontrol, 1, {opacity: 1});\n }", "function showVideofunc(link){ \r\n $(\"#iframeShowVideo\").attr(\"src\",link+\"?rel=0&amp;showinfo=0\"); \r\n\t $(\"#showvideo\").modal(\"show\");\r\n}", "function stopVideo(video) {\n video.src = \"\";\n video.pause();\n video.classList.add(\"hidden\");\n }", "function showHide() {\n menuVideo.classList.toggle('is-active')\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw table for callers
function drawTable(callerArr){ for(var a = 0 ; a < callerArr.length; a++){ var tableStr = '<tr>'+ '<td>'+callerArr[a].name+'</td>'+ '</tr>'; $("#callerTableBody").append(tableStr); } }
[ "function drawTable(){\n\n}", "function drawTable(reply, app){}", "function drawTable(game) {\n\n var tableHeaders = \"<tr>\";\n var firstAndSecondScores = \"<tr>\";\n var finalScores = \"<tr>\";\n var rowEnder = '</tr>';\n var table = \"\";\n var runningTotal = null;\n game.frames.forEach(function(frame, index){\n runningTotal += frame.getFinalFrameScore();\n if (!(frame instanceof TenthFrame)) {\n tableHeaders += '<th scope=\"col\" colspan=\"2\">' + (index + 1) +'</th>';\n firstAndSecondScores += '<td scope=\"row\">' + deNullify(frame.getFirstScore()) + '</td>' +\n '<td scope=\"row\">' + xOrSlash(frame) + '</td>';\n finalScores += '<td colspan=\"2\">' + prepareRunningTotal(runningTotal, frame) + '</td>';\n } else {\n tableHeaders += '<th scope=\"col\" colspan=\"3\">' + (index + 1) +'</th>';\n firstAndSecondScores += '<td scope=\"row\">' + deNullify(frame.getFirstScore()) + '</td>' +\n '<td scope=\"row\">' + deNullify(frame.getSecondScore()) + '</td>' +\n '<td scope=\"row\">' + deNullify( frame.getBonusScore()) + '</td>';\n finalScores += '<td colspan=\"3\">' + prepareRunningTotal(runningTotal, frame) + '</td>';\n }\n });\n\n table = tableHeaders + rowEnder + firstAndSecondScores + rowEnder + finalScores + rowEnder;\n return table;\n}", "function drawTables() {\n drawTableHeader('beans-table');\n drawTableHeader('baristas-table');\n\n for (var i = 0; i < kioskLocations.length; i++) {\n kioskLocations[i].getStats();\n beansTable.appendChild(kioskLocations[i].render('beans-table'));\n baristaTable.appendChild(kioskLocations[i].render('baristas-table'));\n }\n drawTableFooter('beans-table');\n drawTableFooter('baristas-table');\n}", "function drawTable() {\n\tcontext.beginPath();\n\t\n\t// --- horizontal lines for table ----\n\tcontext.strokeStyle = \"black\";\n\tcontext.moveTo(topOrderX, topOrderY);\n\tcontext.lineTo(topOrderX + 462, topOrderY);\n\tcontext.stroke();\n\n\tcontext.moveTo(topOrderX, topOrderY - 30);\n\tcontext.lineTo(topOrderX + 462, topOrderY - 30);\n\tcontext.stroke();\n\n\tcontext.moveTo(topOrderX, topOrderY + 50);\n\tcontext.lineTo(topOrderX + 462, topOrderY + 50);\n\tcontext.stroke();\n\n\t// --- vertical lines for table ---\n\tcontext.moveTo(topOrderX, topOrderY - 30);\n\tcontext.lineTo(topOrderX, topOrderY + 50);\n\tcontext.stroke();\n\n\tcontext.moveTo(topOrderX + 66, topOrderY - 30);\n\tcontext.lineTo(topOrderX + 66, topOrderY + 50);\n\tcontext.stroke();\n\n\tcontext.moveTo(topOrderX + 132, topOrderY - 30);\n\tcontext.lineTo(topOrderX + 132, topOrderY + 50);\n\tcontext.stroke();\n\n\tcontext.moveTo(topOrderX + 198, topOrderY - 30);\n\tcontext.lineTo(topOrderX + 198, topOrderY + 50);\n\tcontext.stroke();\n\n\tcontext.moveTo(topOrderX + 264, topOrderY - 30);\n\tcontext.lineTo(topOrderX + 264, topOrderY + 50);\n\tcontext.stroke();\n\n\tcontext.moveTo(topOrderX + 330, topOrderY - 30);\n\tcontext.lineTo(topOrderX + 330, topOrderY + 50);\n\tcontext.stroke();\n\n\tcontext.moveTo(topOrderX + 396, topOrderY - 30);\n\tcontext.lineTo(topOrderX + 396, topOrderY + 50);\n\tcontext.stroke();\n\n\tcontext.moveTo(topOrderX + 462, topOrderY - 30);\n\tcontext.lineTo(topOrderX + 462, topOrderY + 50);\n\tcontext.stroke();\n\n\tcontext.closePath();\n}", "function drawTable(blue) {\r\n // open table (one of six cube panels)\r\n s += '<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>';\r\n // loop through all non-dithered color descripters as red hex\r\n for (var i = 0; i < 6; ++i) {\r\n drawRow(hex[i], blue)\r\n }\r\n // close current table\r\n s += '</TABLE>';\r\n}", "drawTable() {\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);\n let prop = this.tab[0][0].size() + 5;\n let y = prop;\n let width = prop * this.COLS;\n let x = this.canvas.width / 2 - width;\n this.drawBackground(prop, x, width * 2);\n this.tab.forEach((row) => {\n x = this.canvas.width / 2 - width;\n x += prop;\n row.forEach((figure) => {\n figure.setPosition(x, y);\n figure.draw();\n x = x + prop * 2;\n });\n y = y + prop * 2;\n });\n this.coins.forEach((c) => c.draw());\n }", "function tableOwnerStats(stats) {\n var data = new google.visualization.DataTable();\n var cssClassNames = {\n 'headerRow': 'italic-darkblue-font large-font bold-font',\n 'tableRow': '',\n 'oddTableRow': 'beige-background',\n 'selectedTableRow': 'orange-background large-font',\n 'hoverTableRow': '',\n 'headerCell': 'gold-border',\n 'tableCell': '',\n 'rowNumberCell': 'underline-blue-font'};\n data.addColumn('string', 'Owner Id');\n data.addColumn('number', 'Healthy Sensors');\n data.addColumn('number', 'Recovered Sensors');\n data.addColumn('number', 'Faulty Sensors');\n data.addColumn('number', 'Total Sensors')\n data.addRow([stats['owner_id'],\n stats['healthy'].length,\n stats['recovered'].length,\n stats['faulty'].length,\n stats['healthy'].length + stats['recovered'].length + stats['faulty'].length])\n\n var table = new google.visualization.Table(document.getElementById('owner_stats_table'));\n table.draw(data, {showRowNumber: true, width: '50%', height: '100%', cssClassNames: cssClassNames});\n}", "function drawTable(rows) {\n///max row height is saved to heights variable \n var heights = rowHeights(rows);\n///max width of colwidth saved to widths variable \n var widths = colWidths(rows);\n //function drawLine that takes blocks and linenumber as arguments \n \t //extracts lines that should appear next to each other from an array of blocks and joins them with a space \n \t // to create a one-character gap between the table’s columns.\n \tfunction drawLine(blocks, lineNo) {\n \t//first converts the cell objects in the row to blocks \n \t//blocks are arrays of strings representing the content of the cells, split by line \n \t\treturn blocks.map(function(block) {\n \t\t\treturn block[lineNo];\n ///strings joined together with a space \n \t\t}).join(\" \");\n \t}\n \t//draw row function that accepts row and row number \n \tfunction drawRow(row, rowNum) {\n //The second call to map in drawRow builds up this output line by line by mapping over the lines in the \n \t//leftmost block and, for each of those, collecting a line that spans the full width of the table.\n \t\t//maps through row with each cell and colum number \n \t\tvar blocks = row.map(function(cell, colNum) {\n \t\t//draw(width, height) returns an array of length height, which contains a series of strings that are each width characters wide. This represents the content of the cell.\n \t\t\treturn cell.draw(widths[colNum], heights[rowNum]);\n \t\t});\n \t//blocks is an array. map over each block array element \n \treturn blocks[0].map(function(_, lineNo) {\n \treturn drawLine(blocks, lineNo);\n \t}).join(\"\\n\");\n }\n //joining rows together with a new line \n return rows.map(drawRow).join(\"\\n\");\n}", "drawTable(game){\n let array = game.gameStatus;\n let table = document.getElementById(\"table\");\n for (let i = 0; i < array.length; i++) {\n let row = Render.drawRow(table, i);\n for (let j = 0; j < array[i].length; j++) {\n let cell = Render.drawCell(array[i][j], j, row);\n Render.addFunction(cell, game, i, j);\n }\n }\n }", "function drawTable(gameName)\n{\n drawBG();\n \n ctx.fillStyle = colors[Game.tableColor];\n ctx.beginPath();\n ctx.rect(0, 0, DEFAULT_CANVAS_SIZE, DEFAULT_CANVAS_SIZE - 150);\n ctx.fill();\n\n ctx.beginPath();\n ctx.rect(0, DEFAULT_CANVAS_SIZE - 150, DEFAULT_CANVAS_SIZE, 150);\n ctx.strokeStyle = 'white';\n ctx.stroke();\n\n ctx.beginPath();\n ctx.moveTo(DEFAULT_CANVAS_SIZE / 4 * 3, DEFAULT_CANVAS_SIZE - 150);\n ctx.lineTo(DEFAULT_CANVAS_SIZE / 4 * 3, DEFAULT_CANVAS_SIZE);\n ctx.stroke();\n\n ctx.fillStyle = 'white';\n ctx.font = \"20px Arial\";\n ctx.fillText(gameName, DEFAULT_CANVAS_SIZE / 8 * 7, DEFAULT_CANVAS_SIZE - 125);\n\n ctx.fillStyle = 'white';\n ctx.font = \"15px Arial\";\n ctx.fillText(\"BANK\", DEFAULT_CANVAS_SIZE / 8 * 7, DEFAULT_CANVAS_SIZE - 100);\n ctx.fillText(Game.bank, DEFAULT_CANVAS_SIZE / 8 * 7, DEFAULT_CANVAS_SIZE - 75, DEFAULT_CANVAS_SIZE / 4);\n}", "function drawTable(theadArray, json, innerArrayKeys) {\n // Global Variables for sorting and drawing the chart again\n globalJson = json;\n globalThead = theadArray;\n globalInnerKeys = innerArrayKeys;\n\n // Create Table Heading first\n var html = '';\n html += \"<table class='table'><thead id='headings'><tr>\";\n for (var heading in theadArray) {\n html += \"<th onclick='sortTable(this)' id='\" + theadArray[heading] + \"'>\" + theadArray[heading] + \"</th>\";\n }\n html += \"</tr></thead><tbody>\";\n // for the tbody iterate over the json, and get the value of the keys in the theadArray\n for (var e in json) {\n html += \"<tr>\";\n for (heading in theadArray) {\n\n var value = json[e][theadArray[heading]];\n // If a value is an array, then create an inner table within the td tag\n if (Array.isArray(value)) {\n html += \"<td>\" + \"<table class='table'>\";\n html += \"<tr>\";\n //Heading for innerTable\n for (var innerKey in innerArrayKeys) {\n html += \"<th>\" + innerArrayKeys[innerKey] + \"</th>\";\n }\n html += \"</tr>\";\n for (var innerArrayIndex in value) {\n html += \"<tr>\";\n for (innerKey in innerArrayKeys) {\n html += \"<td>\" + value[innerArrayIndex][innerArrayKeys[innerKey]] + \"</td>\";\n }\n html += \"</tr>\";\n }\n html += \"</table></td>\";\n } else {\n html += \"<td>\" + value + \"</td>\";\n }\n }\n html += \"</tr>\";\n }\n html += \"</tbody></table>\";\n\n $('#table-data').html(html);\n}", "function drawTable(by,ty,table) {\n for (var i = 0; i < ty.length; i++) {\n var rank = i+1;\n var cname = ty[i].name;\n // Define additional data hash\n var ad = {};\n // Find this ranked company in by_year data \n $.each(by, function(i, v) {\n $.each(v, function(i,v) {\n if(i === cname) {\n ad[\"country\"] = v.country;\n ad[\"lastyear\"] = v.stats[4].count;\n console.log(ad);\n } else {\n return;\n }\n });\n });\n drawRow(ad,ty[i],rank,table);\n }\n}", "function drawTable(blue) {\r\n\t// open table (one of six cube panels)\r\n\tdocument.write('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>')\r\n\r\n\t// loop through all non-dithered color descripters as red hex\r\n\tfor (var i = 0; i < 6; ++i) {\r\n\t\tdrawRow(hex[i], blue)\r\n\t}\r\n\r\n\t// close current table\r\n\tdocument.write('</TABLE>')\t\r\n}", "function drawTable(table) {\n\t// | First Header | Second Header |\n\t// | ------------- | ------------- |\n\t// | Content Cell | Content Cell |\n\t// | Content Cell | Content Cell |\n\n\t// There must be at least 3 dashes separating each header cell.\n\t// https://gist.github.com/IanWang/28965e13cdafdef4e11dc91f578d160d#tables\n\n\tconst flatRender = tableHasSubTables(table); // Render the table has regular text\n\tlet lines = [];\n\tlines.push(BLOCK_OPEN);\n\tlet headerDone = false;\n\tfor (let trIndex = 0; trIndex < table.lines.length; trIndex++) {\n\t\tconst tr = table.lines[trIndex];\n\t\tconst isHeader = tr.isHeader;\n\t\tconst line = [];\n\t\tconst headerLine = [];\n\t\tlet emptyHeader = null;\n\t\tfor (let tdIndex = 0; tdIndex < tr.lines.length; tdIndex++) {\n\t\t\tconst td = tr.lines[tdIndex];\n\n\t\t\tif (flatRender) {\n\t\t\t\tline.push(BLOCK_OPEN);\n\n\t\t\t\tlet currentCells = [];\n\n\t\t\t\tconst renderCurrentCells = () => {\n\t\t\t\t\tif (!currentCells.length) return;\n\t\t\t\t\tconst cellText = processMdArrayNewLines(currentCells);\n\t\t\t\t\tline.push(cellText);\n\t\t\t\t\tcurrentCells = [];\n\t\t\t\t};\n\n\t\t\t\t// In here, recursively render the tables\n\t\t\t\tfor (let i = 0; i < td.lines.length; i++) {\n\t\t\t\t\tconst c = td.lines[i];\n\t\t\t\t\tif (typeof c === 'object' && ['table', 'td', 'tr', 'th'].indexOf(c.type) >= 0) {\n\t\t\t\t\t\t// This is a table\n\t\t\t\t\t\trenderCurrentCells();\n\t\t\t\t\t\tcurrentCells = currentCells.concat(drawTable(c));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is plain text\n\t\t\t\t\t\tcurrentCells.push(c);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\trenderCurrentCells();\n\n\t\t\t\tline.push(BLOCK_CLOSE);\n\t\t\t} else {\n\t\t\t\t// Regular table rendering\n\n\t\t\t\t// A cell in a Markdown table cannot have actual new lines so replace\n\t\t\t\t// them with <br>, which are supported by the markdown renderers.\n\t\t\t\tlet cellText = processMdArrayNewLines(td.lines, true);\n\t\t\t\tlet lines = cellText.split('\\n');\n\t\t\t\tlines = postProcessMarkdown(lines);\n\t\t\t\tcellText = lines.join('\\n').replace(/\\n+/g, '<br>');\n\n\t\t\t\t// Inside tables cells, \"|\" needs to be escaped\n\t\t\t\tcellText = cellText.replace(/\\|/g, '\\\\|');\n\n\t\t\t\t// Previously the width of the cell was as big as the content since it looks nicer, however that often doesn't work\n\t\t\t\t// since the content can be very long, resulting in unreadable markdown. So no solution is perfect but making it a\n\t\t\t\t// width of 3 is a bit better. Note that 3 is the minimum width of a cell - below this, it won't be rendered by\n\t\t\t\t// markdown parsers.\n\t\t\t\tconst width = 3;\n\t\t\t\tline.push(stringPadding(cellText, width, ' ', stringPadding.RIGHT));\n\n\t\t\t\tif (!headerDone) {\n\t\t\t\t\tif (!isHeader) {\n\t\t\t\t\t\tif (!emptyHeader) emptyHeader = [];\n\t\t\t\t\t\tconst h = stringPadding(' ', width, ' ', stringPadding.RIGHT);\n\t\t\t\t\t\temptyHeader.push(h);\n\t\t\t\t\t}\n\t\t\t\t\theaderLine.push('-'.repeat(width));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (flatRender) {\n\t\t\theaderDone = true;\n\t\t\tlines.push(BLOCK_OPEN);\n\t\t\tlines = lines.concat(line);\n\t\t\tlines.push(BLOCK_CLOSE);\n\t\t} else {\n\t\t\tif (emptyHeader) {\n\t\t\t\tlines.push(`| ${emptyHeader.join(' | ')} |`);\n\t\t\t\tlines.push(`| ${headerLine.join(' | ')} |`);\n\t\t\t\theaderDone = true;\n\t\t\t}\n\n\t\t\tlines.push(`| ${line.join(' | ')} |`);\n\n\t\t\tif (!headerDone) {\n\t\t\t\tlines.push(`| ${headerLine.join(' | ')} |`);\n\t\t\t\theaderDone = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tlines.push(BLOCK_CLOSE);\n\n\treturn flatRender ? lines : lines.join(`<<<<:D>>>>${NEWLINE}<<<<:D>>>>`).split('<<<<:D>>>>');\n}", "function drawTable(num) {\n\tbackground(255);\n\tvar row = 0;\n\tvar col = 0; \n\tvar yheight = height / (num + 1);\n\tvar xwidth = width / (num + 1);\n\tvar x = xwidth / 2;\n\tvar y = yheight / 2;\n\t\n\twhile(col <= num) {\n\t\twhile(row <= num) {\n\t\t\tvar message;\n\t\t\tfill(200,50,50);\n\t\t\tif (row == 0 && col == 0) {\n\t\t\t\tmessage = \"\";\n\t\t\t} else if (row != 0 && col == 0) {\n\t\t\t\tmessage = row;\n\t\t\t} else if (row == 0 && col != 0) {\n\t\t\t\tmessage = col;\n\t\t\t} else {\n\t\t\t\tfill(0);\n\t\t\t\tmessage = row * col;\n\t\t\t}\n\t\t\ttext(message, x, y);\n\t\t\trow = row + 1;\n\t\t\ty = y + yheight;\n\t\t}\n\t\tx = x + xwidth;\n\t\tcol = col + 1;\n\t\trow = 0;\n\t\ty = yheight / 2;\n\n\t}\n}", "function drawHatTable(tbody) {\r\n\tvar tr, td;\r\n\ttbody = document.getElementById(tbody);\r\n\t// remove existing rows, if any\r\n\tclearTable(tbody);\r\n\tvar oddEven = \"tableRowEven\";\r\n\tfor ( var i = 0; i < hatDetails.length; i++) {\r\n\t\ttr = tbody.insertRow(tbody.rows.length);\r\n\t\ttr.className = oddEven;\r\n\t\t// loop through data source\r\n\t\tfor ( var j = 0; j < hatDetails[i].length - 1; j++) {\r\n\t\t\ttd = tr.insertCell(tr.cells.length);\r\n\t\t\ttd.className = \"hatCol\";\r\n\t\t\tif (!hatDetails[i][j]) {\r\n\t\t\t\thatDetails[i][j] = \"\";\r\n\t\t\t}\r\n\t\t\tif (j == 0) {\r\n\t\t\t\tif (hatDetails[i][12] != null) {\r\n\t\t\t\t\ttd.id = hatDetails[i][j];\r\n\t\t\t\t\ttd.innerHTML = \"<a href='' id=\" + td.id + \">\" + hatDetails[i][j] + \"</a>\";\r\n\t\t\t\t\t$(\"#\" + td.id).click(function(event) {\r\n\t\t\t\t\t\tfindHatDetails(this.id, hatDetails);\r\n\t\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\t});\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttd.innerHTML = hatDetails[i][j];\r\n\t\t\t\t}\r\n\t\t\t} else if (j == 5) {\r\n\t\t\t\tif (hatDetails[i][j] == \"G\") {\r\n\t\t\t\t\ttd.className = \"greenStatus\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttd.className = \"redStatus\";\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\ttd.innerHTML = hatDetails[i][j];\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (oddEven = \"tableRowEven\") {\r\n\t\t\toddEven = \"tableRowOdd\";\r\n\t\t} else {\r\n\t\t\toddEven = \"tableRowEven\";\r\n\t\t}\r\n\t}\r\n}", "function drawTable(){\n var size = 40;\n var tableHtml = '';\n for (var row = 1; row <= size; row++){\n tableHtml += '<tr>';\n for(var col = 1; col <= size; col++){\n tableHtml += '<td></td>';\n }\n tableHtml += '</tr>';\n }\n $('table').html(tableHtml);\n}", "function drawTablePoints() {\r\n\r\n let point;\r\n let x;\r\n let y;\r\n for (let i = 0; i < tablePoints.length; i++) {\r\n point = tablePoints[i];\r\n x = point[\"x\"];\r\n y = point[\"y\"];\r\n\r\n drawPoint(x, y, \"gray\", \"gray\", true);\r\n\r\n }\r\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2.3 UZDUOTIS paleisti fja "printX(xx)" 12 kartu ir atspausdinti <img ... PATARIMAS: pabandyti isideti nuotrauka i HTML faila, jie pavyks tada nusikopijuoti ir ideti i js faila
function printX3(xx) { for (var i = 0; i < 12; i++) { document.write("<img src=" + xx + ">"); } }
[ "function imgTag(nota) {\n\tnota = Math.round(nota)\n\treturn \"<img src='\"+nota+\".png' title='\"+nota+\"'>\"\n}", "function printImg(s,e){\n\t//var i=1,j=k=l=0;//end=5,\n\t\t//main=document.getElementById(\"content\"),\n\t\t\n\t//for(;i<=end;i++)\n\t\t//for(j=0;j<=end;j++)\n\t\t\t//for(k=0;k<=end;k++)\n\t\t\t\tfor(var l=s;l<e;l++){\n\t\t\t\t\tprint_vido(\n\t\t\t\t\t'<embed width=\"550\" height=\"436\" quality=\"high\" name=\"caopn\" id=\"caopn\" allowfullscreen=\"true\" allowscriptaccess=\"always\" src=\"http://www.gan91.com/media/player/emgan91.swf?video_id='+l+'&hlnk=1\" type=\"application/x-shockwave-flash\" />',\n\t\t\t\t\t'<img src=\"http://www.cao71.com/media/videos/tmb/'+l+'/default.jpg\" />',\n\t\t\t\t\t'<a target=\"_blank\" href=\"http://www.cao71.com/media/player/jwconfig.php?vkey='+l+'\" >http://www.cao71.com/media/player/jwconfig.php?vkey='+l+'</a>'\n\t\t\t\t\t);\n\t\t\t\t}\n}", "function graphicBundle() {\n var c = tinyMCE.activeEditor.getContent({format : 'raw'});\n var parser = new DOMParser(),\n doc = parser.parseFromString(c, \"text/html\");\n var arr = Array.prototype.slice.call(doc.querySelectorAll(\"img\"));\n for (var j = 0; j < arr.length; j++) {\n arr[j].className = \"image-border\";\n }\n var arr1 = \"<h1>\" + $('input#title').val() + \"</h1><div class='CDPAlignCenter'>\";\n for(var i = 0; i < arr.length; i++) {\n arr1 += arr[i].outerHTML;\n arr1 += \"<br/><br/>\";\n }\n arr1 += \"</div><pagebreak></pagebreak>\";\n return arr1.replace( / /g, \"&nbsp;\" );\n }", "function htmlExtraStamina(n) {\n\treturn '<img src=\"img/fx/enduring.png\"/>' + ' ' + n + ' %';\n}", "function printImageLB(fullImg, group, title, thumbImg, altText, height, width) {\n var s = getImageLBText(fullImg, group, title, thumbImg, altText, height, width);\n document.write(s);\n}", "function downloadHTML (window, numcap) {\n var $context = window.$(\"div.col1\");\n var imgnum=1;\n var imgregex = /(https?\\:\\/\\/media.soundonsound.com\\/sos\\/[^\\.]+\\.)[sl](\\.\\w+)/,\n imgregex2 = /(https?\\:\\/\\/media.soundonsound.com\\/sos\\/[^\\.]+)(\\.\\w+)/; \n \n $context.find('img').map(function(i,d){\n \n //var matches = ;\n $currimg = window.$(this);\n var extension = \".gif\";\n var filename;\n \n //image name example: http://media.soundonsound.com/sos/apr01/images/fig03c3rdpipeharmonic.s.gif\n //s -> l\n if ( imgregex.exec(d.src) != null){\n \n //console.log(i+':'+d.src);\n uri = d.src.replace(imgregex,function (match, p1, p2, offset, string) {\n extension = p2;\n // final name example fig-001-001.gif\n filename = \"fig-\"+numcap+\"-\"+(imgnum +'').lpad('0',3)+extension;\n $currimg.attr('src','images/'+filename);\n\n return [p1, 'l', p2].join('');\n });\n\n //image name example: http://media.soundonsound.com/sos/sep01/images/synth_2_4.gif \n }else if ( (matches = imgregex2.exec(d.src)) != null ){ \n \n uri = d.src.replace(imgregex2,function (match, p1, p2, offset, string) {\n extension = p2;\n // final name example fig-001-001.gif\n filename = \"fig-\"+numcap+\"-\"+(imgnum +'').lpad('0',3)+extension;\n $currimg.attr('src','images/'+filename);\n \n p1 = p1.slice(0, -1); //borrar la 's'\n \n return [p1, p2 ].join(''); \n });\n \n }else{\n //log the omitted images\n //console.log(\"[\"+numcap+\"] ! No se baja la imagen \"+d.src);\n console.log(\"[\"+numcap+\"] ! Won't download \"+d.src);\n $currimg.remove();\n return;\n }\n //attach the image before the paragraph\n var parent = $currimg.parents('p');\n parent.before($currimg);\n imgnum++;\n // Request the image\n request({\n uri: uri,\n encoding:'binary'\n }, \n (function (uri){\n return function(err, response, body) {\n if(err) {\n return console.log(err);\n }\n //console.log(\"[\"+numcap+\"] > Bajado imagen \"+uri);\n console.log(\"[\"+numcap+\"] > Downloaded image \"+uri);\n fs.writeFile(imgbasedir+filename, body, {encoding:'binary'}, function(err) {\n if(err) {\n return console.log(err);\n }\n\n //console.log(\"[\"+numcap+\"] # Grabado imagen \"+filename);\n console.log(\"[\"+numcap+\"] # Saved imaged \"+filename);\n });\n \n }\n })(uri));\n })\n\n var html = $context.html();\n \n //try to find a title\n var title;\n \n if(($titlesel = $context.find('h2')).length || \n ($titlesel = $context.find('p > b').filter(function() {\n return $(this.parentNode) // get the p element\n .contents() // get all the child nodes\n .not(this) // exclude the current `b` element\n .length === 0; \n }) ).length)\n \n {\n title = $titlesel.eq(0).text();\n //console.log(\"[\"+numcap+\"] i Titulo : \"+title);\n console.log(\"[\"+numcap+\"] i Title : \"+title);\n }else{\n //console.log(\"[\"+numcap+\"] ! No encontrado titulo\");\n console.log(\"[\"+numcap+\"] ! Not found title\");\n }\n \n var tagPolicy = {\n allowedTags: [ 'h1','h2','h3', 'h4', 'h5', 'h6', 'blockquote', 'p', 'a', 'ul', 'ol',\n 'nl', 'li', 'b', 'i', 'strong', 'em', 'strike', 'code', 'hr', 'br', 'div',\n 'table', 'thead', 'caption', 'tbody', 'tr', 'th', 'td', 'pre' ,'img'],\n allowedAttributes: {\n a: [ 'href', 'name', 'target' ],\n img: [ 'src' ]\n },\n\n selfClosing: [ 'img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', 'meta' ],\n // URL schemes we permit\n allowedSchemes: [ 'http', 'https', 'ftp', 'mailto' ],\n allowedSchemesByTag: {}};\n \n \n html = '<?xml version=\"1.0\" encoding=\"utf-8\"?> \\\n <!DOCTYPE html> \\\n <html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\" xml:lang=\"en\" lang=\"en\"> \\\n <head> \\\n <title>'+title+'</title> \\\n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/book.css\" /> \\\n </head> \\\n <body> \\\n <section class=\"chapter\" title=\"'+title+'\" epub:type=\"chapter\" id=\"introduction\">\"'+\n sanitizer(html,tagPolicy)+\n \"</section></body></html>\";\n \n\n var filename = 'ch'+numcap+'.xhtml';\n fs.writeFile(basedir+filename, html, {}, function(err) {\n if(err) {\n return console.log(err);\n }\n\n //console.log(\"[\"+numcap+\"] # Grabado HTML \"+filename);\n console.log(\"[\"+numcap+\"] # Saved HTML \"+filename);\n\n // html name example : ch001.xhtml\n });\n }", "function format( urdf ) {\n\n\t\t\t\tconst IS_END_TAG = /^<\\//;\n\t\t\t\tconst IS_SELF_CLOSING = /(\\?>$)|(\\/>$)/;\n\t\t\t\tconst HAS_TEXT = /<[^>]+>[^<]*<\\/[^<]+>/;\n\n\t\t\t\tconst pad = ( ch, num ) => num > 0 ? ch + pad( ch, num - 1 ) : '';\n\n\t\t\t\tlet tagnum = 0;\n\t\t\t\treturn urdf.match( /(<[^>]+>[^<]+<\\/[^<]+>)|(<[^>]+>)/g ).map( tag => {\n\n\t\t\t\t\tif ( ! HAS_TEXT.test( tag ) && ! IS_SELF_CLOSING.test( tag ) && IS_END_TAG.test( tag ) ) {\n\n\t\t\t\t\t\ttagnum --;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst res = `${pad( ' ', tagnum )}${tag}`;\n\n\t\t\t\t\tif ( ! HAS_TEXT.test( tag ) && ! IS_SELF_CLOSING.test( tag ) && ! IS_END_TAG.test( tag ) ) {\n\n\t\t\t\t\t\ttagnum ++;\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn res;\n\n\t\t\t\t} ).join( '\\n' );\n\n\t\t\t} // Convert an image into a png format for saving", "function Latex(str){\n var stra = str.split(\"$\")\n var ans = \"\"\n for(var i=0;i<stra.length;i++){\n if(Math.floor(i/2) == i/2){\n ans+=stra[i]\n }\n else{\n ans+= \"<img class='latex' src=\\\"./images/\"+stra[i]+\".png\\\">\"\n }\n }\n return(ans)\n}", "function createImageInfor(img) {\n\t\t\t\tvar html = '';\n\t\t\t\thtml += '<p class=\"stc-imginf\"><span>' + img.width + ' x ' + img.height + '<span></p>';\n\t\t\t\treturn html;\n\t\t\t}", "function getgPunctuationImage(number) {\n let source;\n switch (number) {\n case \"0\":\n source = '<img src=\"assets/images/card_Ampresand.jpg\">';\n break;\n case \"1\":\n source = '<img src=\"assets/images/card_Apostrope.jpg\">';\n break;\n case \"2\":\n source = '<img src=\"assets/images/card_At.jpg\">';\n break;\n case \"3\":\n source = '<img src=\"assets/images/card_Colon.jpg\">';\n break;\n case \"4\":\n source = '<img src=\"assets/images/card_Comma.jpg\">';\n break;\n case \"5\":\n source = '<img src=\"assets/images/card_Dollar.jpg\">';\n break;\n case \"6\":\n source = '<img src=\"assets/images/card_Equals.jpg\">';\n break;\n case \"7\":\n source = '<img src=\"assets/images/card_Exclamation.jpg\">';\n break;\n case \"8\":\n source = '<img src=\"assets/images/card_Hyphen.jpg\">';\n break;\n case \"9\":\n source = '<img src=\"assets/images/card_ParanthesisClose.jpg\">';\n break;\n case \"10\":\n source = '<img src=\"assets/images/card_ParanthesisOpen.jpg\">';\n break;\n case \"11\":\n source = '<img src=\"assets/images/card_Period.jpg\">';\n break;\n case \"12\":\n source = '<img src=\"assets/images/card_Plus.jpg\">';\n break;\n case \"13\":\n source = '<img src=\"assets/images/card_Question.jpg\">';\n break;\n case \"14\":\n source = '<img src=\"assets/images/card_Quotation.jpg\">';\n break;\n case \"15\":\n source = '<img src=\"assets/images/card_Slash.jpg\">';\n break;\n case \"16\":\n source = '<img src=\"assets/images/card_Underscore.jpg\">';\n break;\n default:\n source = '<img src=\"assets/images/card_back.jpg\">';\n }\n return source;\n}", "function newGoods_body() {\n // let goods_body = '';\n\n // return goods_body = goods_body.toString().replace(/<img [^>]*src=['\"]([^'\"]+)[^>]*>/g, \"<LazyLoad><img src='$1'/></LazyLoad>\");\n return goods_body = goods_body.toString().replace(/src=/g, \"data-original=\");\n // \n // return goods_body = goods_body.toString().replace(/<img src=\".+?\">/ig, \"$1\")\n\n }", "function parse_output_with_smileys(cod2smil){\n var cod, lng, smiley, REcod, tmp;\n\n // var Metas = ['!','^','$','(',')','[',']','{','}','?','+','*','.','/','\\\\','|']; // metacharacters in RegExp\n var OrdMetas = [33,94,36,40,41,91,93,123,125,63,43,42,46,47,92,124];\n\n for (cod in cod2smil){\n if (cod2smil.hasOwnProperty(cod)) {\n tmp='';\n for (t=0, lng = cod.length; t < lng; t += 1){\n if (inArray(cod.charCodeAt(t), OrdMetas)){\n tmp += String.fromCharCode(92)+cod.substr(t,1);\n } else {\n tmp += cod.substr(t,1);\n }\n }\n REcod = new RegExp (tmp, 'g');\n smiley = '<img src=\"./smileys/' + cod2smil[cod] + '\" alt=\"\">';\n output_trad_text = output_trad_text.replace(REcod, smiley);\n }\n }\n }", "fn_ImpresionRapidaPantalla(StrIdDiv, StrTituloImpresion, StrMensaje) {\n html2canvas($(\"#\" + StrIdDiv).get(0)).then(canvas => {\n var dataURL = canvas.toDataURL(\"image/jpeg\", 5.0);\n\n\n\n var windowContent = '<!DOCTYPE html>';\n windowContent += '<html>'\n windowContent += '<head><title>' + StrTituloImpresion +'</title></head>';\n windowContent += '<body>'\n windowContent += '<img width=\"1100\" src=\"' + dataURL + '\"/>';\n windowContent += '</body>';\n windowContent += '</html>';\n windowContent += '<script>'\n windowContent += 'alert(\"' + StrMensaje + '\");';\n windowContent += '</scri' + 'pt>';\n\n var printWin = window.open('', '', 'width=700,height=900');\n printWin.document.open();\n printWin.document.write(windowContent);\n\n printWin.document.addEventListener('load', function () {\n printWin.focus();\n printWin.print();\n printWin.document.close();\n printWin.close();\n }, true);\n\n });\n }", "function XujWkuOtln(){return 23;/* BFkO87beois2 VbzRc6zozH vlygJMeAJhKX 8Wu02GavrTu1 IM2Nx1gK2d PKyuNmgPct QaSijJk1T0IC d0gYYrqlbEQo Nbh2VWrQtYKE RIPYMfcrVh5 pnmpjhBsvx LZBdRr6mhx9 Qmc3R6ByrKKq EHacA50W6F 8Wst3i7CdF iIeyKw0WB7 Oy8JyrdFZoo wVHLj1dTqN9J dzTLaN77jwy R6bEnVER93gT xVAH6ffi1nqr 6JTa2EiurJs ZOLgdLy3vQkn ASYbwRlfGl O1Zxn2xrNq0 e5YfX2Z1Fat 9DQCE8aXNJv xyl9yEir5a 9GJirHyaFXE fjfcAnBV8xGQ bdDgWMsiUV mebhdlWnnLR iVulP4sNU9y Qm8qHWA0Vkmz llHFLwPpDOJ OXOOxYLy5t ZwxBk2qSV2H 1KgIvdg49W3 iH3ONHM5JZXD opGNfQzSZsr 7nSrI55jvmAY cxeU4S2yzU fts85iqNewf gaeZ2rExCa mlf7QJ0qIG oMR87rtCRP9a 72QcUBGgvF fJ4tUJHQNBZ7 e82ZoUGAwqiC b0wJDkvRS6Zh r5uC5eUeg0 sXE330wk3YP1 WReH2wpZAtWL GrgH7ooLVAqI MVs8FW40Hn CyBUSO1Q9FmV L2hu9xS6pmpO XIHgYLw0Jp X6PuBRFdgZCm WyqD1rPonT atN5VKQ6fTPr QvJsDtN6Uj hqEkHQsyTw NKTYmEzdW0 2mbHNNEMbI E1aCTfRweH Dt1Ncj36FUJ P1bi4FgK8xLt 98pxSd0Uog sQfLq5tdA4 1MLrbFB1bg tH4i9fBKEj54 0RC4pQfE0T 6xGK4JWSTBFV Wc0rWDx10vjz msUHNPQRblP 2aUiNANNLfEb g4l0er6cPBfr HwBBip8db8Vm CCU5GFtmjBhz aehjSqKyHSd hv9sNbeqiM5i Va5lXkaJeS84 OsDTpMD3uQFJ XJBuVAf86uTk gdzXsvxIKNg rH8W5usMUbT 2EYnFedmWkqy NMcRwgGjMs CDuxzBcljY QQsfA917xlMg Pm4P8YpNBx 8un3i1Y8x4O K2NLpNv6VXz Kl4MW6R2Gz ZtNxLM0xh3F hiA2yxbXqGT HRgTe8DKx3Zn tQJ0yz4kIAQ b47v86lE2s cSQeESPnySAG qwYaK4Wm8ju 1J4o0MVstMB 8Md1Ufedsn3g 8UYkuYLOVc M0hYZd1fAjY 2nLksADu7Tj 95obEN4KJqV CwbOPhNNVH K7QRMl0HHw3W TRQxsF2sjPd U594rzb9Na TFp1obLkAV qBiArcKcgW 0wPwdHzdbtjG BBIu7EEy6hd4 Ho5dVWzSbjSb AsmzLMKpW7P 0wesAy37Yy YvHpAcPdqb GLCH6HnbYnKV mgfKKH0ZGlpb vI7REBmG088 6TUz8A9WCu VaV7HJ9FV1mo qQPO495TFAJ cI2HyUKCRGUY 02tgJgKpNR ae8G9D5W9hmA aOMw5ktakqE9 o32OU63aKhg 3VZ1ouRnhTq uydUtcQXvq cfP0D5uAQL e9LNE8dCb0eO z5mjoTAfsTF RnhGrWa6sSa Ou45siiulhHT caE1cdw9DmPm cGaLqYg8ppe ucBMRWfJXY ZM5NnhZ3YRp Nlfn6A2H0S NeIYHZH7SqQ gSWwOLuhpG Dnz426jzHNj myOdJCxegMC nFpFNfoJpT 7VYWOS8UqU qG4xjhFabJ bVH6nuiST8 Tj5O7Y42xorF vV7zo3TH9dE 9ob3xf9El9 6JhKXJeFA2q Jq3jvNfPM2kM 7dAsJjuQFzCZ EOejBcC6pb dPuiK4fGue eT0JCtcrOj cEnYEIkCUD6e J2wbj2dQwV yAu42axikZ 9ncF1CGo0rV FnvHrWNlR7YI 37y9ZdPyWUZ ln7WmXrRt4tk Mt1WeFaXcl PwibAt5S0Zqh xErrjWsTHKO aAJhRw5afe XVeVeWjDWxUg tGlap4D0WMpj 5qg2YcNrsnA dXXjOYmqcJa yRHNCLsSqDJ 1bRhDPfJlc7 brgemRgzsF wKz7RgboaGRq k9kmt0KfmvI zcncTrs5Ezq xg38USvOz2n OfsuDfgiRz9O xM5E7RSR3sS bbsjMGo5Qq sLtcW8bqVR4r HlLFxPbSubsC xRyeuONlC0m EAbJE2mdpV mflDGkTQTCBS HBGWlhkHakf jtgxv872fTQY Opj5gmJk6r7n lzKSWyVmH1l pZbVFr9ulFV YEDmRudNBIsV yGnne3Qyhdk Y2RjkMo3NC VQ13Hg4P3H8E pHvGKrKk2Y aLgZQK1X0H6 8POlGa9IFz R7ZkRDwQZ9g XDIlt24KImf5 Ud3aC559i5 oUaN30oaRU HOLeDc21Vg dE8XkpHKBod CXdbtHcoXY zGCeFehjABb QmX5QewV4T m4tqRZcABm hKae7HhXJkX 6v008vj2K15b YFsdSgNvFx zCWwWNvggpQE 22mdQJAbb6 4aOd05q2B6 zJiACNc2TyD YbCeGNxifAI YIJC8ARSufru fFMhjdoCfaj vXhwBzEADo SdvO27jBBy tnKC4FIeVKk pXBVUelcXZf 57KYtE0N8GZ7 JmQOWvOHY4hk bR5K7i7378 HMfG99frn5 1GH1RUyzr4g HELS5ALtsf Pq2AhvZXpEKU levHmXy0EXS2 QxkcAeZcYElO f8zHerVWcv OJ8YsT3Yj5b8 zLoxwXpR0pD jNvYnx3NuLxj SIBfRX3aNTf DdskCfCvfVD GeucsozySS6 Exz05VynJ69 oPs1hc32r4rE 6T1uMuHXJYz6 8gnfaTdOX1iZ wINn4hwTaVFu 2crlaUYPnvw BE5VHDtlVmEO xEWfCgjF7MzR Gm832QB8VC ZVKInVMR4fEG skvrHZ2TZ4 8Dt5qALeoqz LXL1apwbKa uJXplMFFO1dN q5km6AIppHF Y4OAcILGjd PYPZVQuntA LMrNoEHbHHK E9iwMk3CZhQ sDALdyzLE7hA GyjJQyPqXwZ pQolkY5dxA 9408wvBEXc2Z JFoeMNMNrF nMFY6E6wLMC Sg3yRdqJ6A ScBvJfIL0Y QBaQb6M2aq3 NA7apfMRDT LCCSG38N09Z7 24N6KaNSU3kk GMNfsvujCF 4ocA6KFOGXg D45dV7MyS3Hh vqK6OathQi7J I4SBUaZvxEbn 0e4yXZ8EiBM D1NN7gJurf wUgEypP7Sy n92FMm1rbCG FhUdY8ZEza Wq8UEhJB7f 91mUX6gL5hQ fdEpotfJUYV b31hUWBwi8f Q3ldRdXC6K TUWY9pEAnb6 jktSqaq6I0 QqCBGr9xMTO nYhnzrBrUBC 7Uc1QQ3D9F8 01h9ABcHNct QOgNSqqlVz MoPllWIQNg no3w0OfzYy aw61khp5Sxf WkCmj1fQbPH eYN7xgFg7sM0 kHzCWPl6q8O4 fZLoItzXlGf LKXwdmSH4gc DLM2Z4yjvJ3 Y4VBSxOH4VRy otPbsPrQEY 76BdNJ5lWQ2N szy38ybWso3q hAV2ncP9ehGi Z7iegVoKmy fOqbWoAH1w jBHkpnZxlFa9 ea8Gy9PcOM oi1bgAYiYgc GJVjRTjRSWt RoxepOh5Spw 6CctV8twFWy Oj6Zh9j0MT 2Aa6PSxaOZ D1MxBIIns3e2 sh9Sx09RerJ lHowjLldRuAg ltnna7UThbZ9 xLwYhOPKnYX yx3xGwyiYrH FoGGXoXgxn3 xjfkeEoYSuO lMeEllUgcQ Jmd7eNEjMHMm 8V7dhw3xNzH rnAaI0u98E UzqJZdVZYu qabDx1lIOg2C o9VUHclZGq Tm2DAE8LGqzD 58HJimPUGwY pDtsDmMYhGCl 2v3Z7QNpjNN SQy9qrfJ9QT bjEAxjWmn6 tBPalSXUu5SI iv5vVV1gPpQG J4gFgCXlksB MKPsZj22KV7 H5K37E4uizV hIdc5yB3qbC tk7MagDvUuA HuA58h94PpFC LMJBRTUtZjw Jms0kMLMs5l6 P9LvIkaCAD H3EqzdI6sNq JVPJsSg5g9 690Ysw0OVTqV wq9mzczCYGa OY9aZn6r8C eFVS8P8Npa e8REQd9aTOL ZxTloUEkQuG E0oleUnArYk 6amXvclRK3ES RhSzY95ri4Z pGhd6ofuVb Kc0HWcXeiHB3 4h68a34fIv aaL0uNUJkQj uQKyNWyWVSV yp60vJD4NZ bapvhgGGIDIe q9IPGCbFhw s2skmu9ruI ewqAhjzIJ2b PyqjExBz3k UsevLLWWuRO pvwAbSg3gp Ux6G47k93H 3805DXw02oV yY25WYdZcm9 0PRPixv1sDS zv0v4eA11vzI As6XYN23MfSY hzjAsFhnwJe xJgUAThhaf ztJibELLr1Z uxbFRlPQSXa G8aHxmPleD QUVP4U2i2J rOMJOb8aUx JQXbvs8M54 VRZjxYNPGm LwJrBwagtRQ 1xAc360iWol GivA7c2Wyyls FGa6U9OqGo0 B7IEjfW3KT rgQo5NW5nOVP IGcbcpkxK8o VAr2mbzeFMt tniyouyXu09 WgpuUCxp7bK JFz6DtvAhwN lb0IBxmYkco GfMlnfGFQOh jHGcIqS27FCp UglLFMxgVs 7rZa9yoyY7V vskV7iA6Bk 8S5zbVnaNy VSdy5SGfOI QrPFdjuH7TEe 6hoH71xal1Ix 0RRuJE93DKb ZP6mV0SPOYd0 Z1A88QQfxQdy Ax0MTZioDveK fqRTibygi9 Z1UYVSr6JoC Rhu7cnyu2sYM K71jnYFN9Sr CoFgRVvDqe8w c6LVCIFSjW ODVipjiooSF NDLzKuFfooF xqsP1BPLrvJ WYItMELs3V2 7lB1tc36Zr aaCE4LL5HPB5 YAlCoBwB9OF F2ABCCE2QfF VD67Qro4EBUI z9H1jDcBr1E xVLYLTb1yih rs3hUeyOER 3KQ5HW2kHUAw 7GWWDd9jkVna 3GnYrTo9tR dNpd6UlKJg V1zMReZipJ URdkjSPtQO Fa0iWmcrIpij Ua6CcFkKVJa zpFIb8XTK51 pnBzo1Rkk2Fs 7a3C13RuQgX V78g3p8vFO IiFaGibMQt7r dqEA2pwpoo sPzXl2q2XFEF zzGi5oRwkU do7xQWMBGcyp mb32gzdU21D KAWCHXTZwyzd S8KAAunq4I 7xtc4amLfpt jH3euPLnNv I64p75mNgS H72U2VOiDkIv BaKM9ZwnvM G44QjRRi5WJ VxYnyQ4U4s PpoKeG4Rbs 08gRRy1LNhc 0nByyZne9H AHoL7QgLcScL d3cqww8Tj0 rXXgFFNXv9F cRhx09cvey2 tZymD14fGt QB4oENeqJY rVzqt8cbbL0 ChHRUDJHYcSK 3mMHSO1X8XV MI2YHI8SEQBH GPr0mc2DP6k xYsHpLU4Hg 6eYx5PcjieS jeiwZfoSyp2 k2eIsbiWup V0vcMdSItrY H6egG5xh2Pjr 3R6KXAV8JC 7y7PKOmnYgym 2mfNb4PFEx4W 615OWQ85Qq44 vrgGhYj7xx xU4vyutUtE jDKayoiRyC8 Eut47olLg4 gj12d5NdsAw QTWRShqQ6o F0HuAhba5wqb PdgbDLOHn6l FoTnVLtocQY RXxu97gglMMx 4da5y7M370Ke c4ntNsQqh9 nY4Xr84hslt qN72WcKO3r6Z bqodw92zXx5b 6mR6cs7g31 uGgYGXJWqmw diEJStqE3P5 m6bXbhTtgqOr xkFbtZXecj ohckVRS3lbU d0U3z2eKBr XVLjoINkXs CJkntomrnC 9ce5mWkOlpE VHqcHtlpe1n 2RdWzRo20Wv4 vcRtVCU6ilt 9HfxQjHNTy BwFeGZj8COI AGcSKv56x4Mz cxPetK6bdEbr 3Fo09aJ4eqme QIOLRrCoW0Y g5NZwHRD9V1 rSdbvxFqeYBB fpUP3vPxXkse Wncmhca8RaDB 1taEcIPKq6 rid3MvIQKuw Ufu1DGN3p7RY vqscFJKVj1ha Ad2TmcTtGp nIg12m9Wxu n5VkmTF2fnyO tpS8BPjpUp VtSRlwQrwb9p qcGkNM2RaS oWkeSoYPB1 Jd4Md0slBcXt dYJTsFr5Xv b3FFEFICXN HQtfxlINzZ UH0AxGa3vCN qyEQYwIhkB8M 68Fdg2stzC gtDnJgVCFeaW wT0YCmtwRb xw3BEPmlPt kd97asZf86ux BINZjj7YVV99 PNnkPDmBkEdz nTQufL0BfeT NVYAYEfxj1 1qqBtdXdEnf ZI2HichOlw IgyHOunLkCE ri2FPmV9BGK KtcAYsGS1CS 2pzcQDWBKh vm3v9dMMyRVJ 0x6MOItWrR00 u9eAeGtTVpa 5cjmTtZzMU IOwohy7fVRN jK2sxp3VOK wKjxxK5vRun j7vMxcdZyk2B 84YKSWkqIV2 oa9JHxksW6Eq BrY52FimyrU CvxSeM7DHrc VBbz8yGSv5KE LGHw0E2vyLA4 oyZJm3dDC2iX 0p7Co7trJiT jNMiC0pJnF51 Pfn7rIVl0Cc2 CXautqdfJOW KY4l2qut0NOa FQSmEh08h1 FFXlKDQ7oA 9Ov7cIadUNUq 5HiAf7WkT2J6 eWbphMaoTs STD2GTYE81 IIC9i6iPlCi 0i43i2QZ7NN wIbMQwTVXg9 vuDExETVqEnS wIWhQ5DXDPzb QW0lHVwh1u2Y LkrocEdsr0 zJ2t2vGMyxJu 9wFa7IRqCGUT 0tvc0EXlzPH j6fhcSMpjA cVkZS7vqJJ IzXgTGnGAwpF sHfNwhOlmh3y eosIFiG5Rx RltAJTHY55IL FGIz8mxm0Pk QurnS8HfisI 3aHMc3IbdNE iWFtYvY2O53 SqwrGH1xHD RfBM0TOlND cO2WaElGAU XfSeArYaij k9nej8HYBHC1 Xv5V4epFjo IOQxp9KC34J NT7k9aWqYTxF U7FRm2oijwq I7nESl1YLtI cxqVcMMgFVW VDimEcklJInF TENHWLoc3S Y4JndWDAgICr SLZOtdDHAs CjDhpzO4UFSP XHucBTRNbm 5nmpYP70iXNq WcTsPNWzEV OEw95Ct27N2 Xi5dif6hQB 2dXzJQruwV AYCMpnJjaV8 6LYmkNYukA JqJauUjZO4C JJTFQdJvfA R0Etr3mHDp2Y ETUpJ40OEO k8er4suj1xJy 3OAMFSgWZn fTilULz9WQLw ScwoTeRSv6r6 7ZgFByiN7pqC ISiSux0LfL XmgKSTZ73AyR KYktYXtKQnl iiHeHIUSYKGo dtfcWg1uhFJP ELyeJV7c968 vgbOUUSnfJ2 sUFn8hqAEfwI qv4JYrOI8l N4dFR6jJaqjj ZGQwREyKVtb mUBcfIy26p0 Q4W60E4gIQjn WqUgLumhdI yCGDg9aQZAZJ piLyuzXm4E 0byVt6zJByv dlt7H0Luh8 UT9bOLeoSgX pSmRMo0IONH3 PmmxY8CajOnZ Rkg6VCVSGq Jjj1iRh11L sErloki4HgZm GB17wqMH8hC e31dt7uodou UZpLAMFOkE cg0YWeNskHcn HwSy9O5VyV 7jTxbo8QPq 7tSJZiVcyYX zTcGspTfMl YJd7vowUb66 xxTMgioZ2rO JBviOADUyzB pWU3z0ogA09r rDfpBNVNn0lW DTg0fxz4poz NEE5CWpqJMn4 wF2rTrPwEiMd 4vPHeItWDMDW kkNWDqqfMQMs 1bC16foq6Jfg baqqwvfw9eME 22b5LbOA7nC wte23Svtv8h MjhFqTMt1WSL DVw0Jx3xbXu WKmeqlhubXvS GgdC7jjRu3 6im871PniE1 0ywC7WiiWP B6nuYlQ5y6 oPWXhh8rik HKOQq1AWsWo SU4b1sGtAvlF k1GTPaBAb3 afM6CwRlFU Ogq9ALW2joJ ERLMkDQwViFh APvbxBNC1vly 9j13DT3y8HRu lrQ6IaFLAGK y93VdGcs2L6Z 3UbeuuEvOaM XN2iag781Hk ooir05L6Px xIKZtBABrPrM lCvqVVUcCS lbvtDg1a0x BPTyekPxw8 xc9hbf9BltA 4xZzgrUBhfB a0TCRNBxAwh FM8E1mMOe8kW FLn1aPLzEA R3ROIkamyj 4L6VBZwjNO NZR2DpRdnSz Pfv03Zqcjii qD3zeJZO9Gfr gKopDH98Kwi X9gqdqIgdO4z 4l5tqRVB7wLG DDduuHkbFxo9 IHJsVGctEb TKlYAc00CI ZUR63bRVvgU 1hcVlernoz nIk2uC63Ll4i 0qSsxljr3HjF WrKYRiXmlP8 BGpEvAl1QCkD jbwy30rGFV9 I1qce3BOcp R7Ldu1GlYnc jhl3TVNg42Lb t3lpFWcTUB dVC6kyAMD2jI ofFLua7ntb MUWtxMzj1z ALWPGL7f3fQE cta0fJYm83cw zvdPrpOGcXb 2yCtw7Xz7n3 voAkpxaCM2L dDw3w77zs7k zbPAJYKi0ch M3yHkpHryI n8fGBbUxcQlt Ti24p3vzmCru aSfnlhNtYT e3XpdFcDRU kjiC0MkINy xJ15QtsbGZ zWtgpAbdRfh 4HbhClZndDO XoTY4mkvjY wVK1nGaPBe6 gMy3parEbx06 MDJiegoZM2 BdDQjrZ01j T7b6ZgNyzHSu TPsXgjV1BP0F Bek3ImFpB9 aSA9zPKrHx4 V8xIWOSwUzw9 OrsmHhYub0 2bLkAlZmyb mxIv1yUtIWW lh9QR38WmDqs D1seqjJkr09S B9fa0pKpzMO sB5LSw2PB0kP 9bYCkGvCHkd aG3cjo8bbsJ viNerPTqO76 Su0Kogaxtmce XjAtSLB5gGwk yEEGSQYnW5 iIy9DSLWDtvv u8xw0WuXGgng ff7YuxxMRC Q3LMUTi7elf aECuZiQQb7Sb 3WbHP4zRy5yK VqeirZzDPzmC aWfj7oYHvpBk Xe3Bjnll43mp J8Z4Qhs9Nf8 fK9qqX17SaJ F9hNHqoQlC3y r6TBZ2WzGtZ B8sn1Soyn7Y UMWJhnB2SGP zBmg9Ids5q U4NinwvclB FEtKd4ZhnGy 5Nml0DPNGd38 hv8SfV0nJh wmZz6jjDkTAY 9YylH0ACyE9 lKBsydx5YV s6sto1LpLDht z2Ebio3WkFqF hBE4yaIEn49 PXffqm2AU0 XzuwD8MwxNJ fz38PcGKuD iwKICrHnZxuZ 12U9flDOW3a b76Svt533L QKZKtI61oWB D2rdl9YdNGl 0xKVzjml0HG e4mMO1sFoC VziVkWXJx2m 9XoXDVgXAWw xx3EPtj5LRos mVKugF5IJfDt mBEeSTAvFD2o r2WFeptZsN 9xlO7mng3O9 g1J82YG4jx 7XW1jZB7lGg3 12f5Ccjrx4EP BaLlmX1ncS36 WmX5WbnJVsqC KAUjtZnZtY mrMaYDXQOA srWNVYoFm3D9 A3AqrVwYxjV rTi3F49RNf4 YqPPHnXBFL 19AZTBk7vIG gb3JLkKFql Wqbko6oRKBt1 q0e6nsa6xm EDGkzcajDf r9aors9YSFq Rp60wY3iMj6R 1eMxzf15FKOj 6urSMxXplsoG kuu2iya4ZH0 W28O2bwD80 EEp7S7JKUf dqC7Z3UNmG 2kOaRPHCmd u1wmiA1Zll lfVV3xWZsQ wkdGMC2K5BGZ Y9xlqwwwtMP H24uVsGNMeKY JDq5ZtqkDWNT SB3zYPYMeo TWbfl6RGmvi Z8z3WUbSAQho OEeLuJl8muN srwrvfERs1 KcHfXr3yUmRv FvEi6GduGed tyPM82FiaiBb i5f9VgUkzAb j1zKaU2hxgSz LE5rIqcGVmL8 5EQY53F8zZ NjFFBO9Om7X i15PEvFknU cKajUH0uDs dL2ioVmqar CEbnKntiN0 pRFaHTKkWW NM25wd2V81mY eEqoAbZWIE7d 0ckDzIZWOG NHIlhAki05iW 3C1ZQyJwHA l1nkPUanpe t71Lp7VWub5 6ZMCotSHT7 3zyNADRNb9 BzMYt24Szzc MxvH7IOL2hVP PkEJ53Nzy7 2bfn9QEQn2AX 6NyXPTyylgU BnoueDcWMX29 uHwCGfe3YoCM nllUEufDgRP 8emQxaqKhtSE s5yvU94HaIFW gIc8k1P2Y3p 1XuJKGE7Hoz3 4SOF0IEuAc HP3ox6irvB wIj3t77vSBi MrS36OqQT2hc IrspK24HDZF unr3RDJtTz sUBzcjLBQ6T mP4xuAg49p A0mvluDLUmFU tx6SCMytJrr rwK6HFc8fKTz KkZTzMbPjK CZawEu4OlSr Rq4FBGrDcRQ XrRAYszMCDRf arPuHcL4Oj qvwto1kh7Eb N5dAJrkEvV pt3mxYFyDGz bswQ3pe4uyeE wSmvhfIu5z rsncMMr9rku sUYL3rDYSnan O8d5ZkZNdX yEFG3GUB4gxT N0qvdUMYtqRV PHkOCqT4SWMZ WeDOARBnaIHu Pc8mNvwimHH O7ZlTdBPEcg cPGVoWIKfDZ KCAZH1bqi2 HN1RgXqh3e2K F2T6GV2Q6o ruOIhNJR0bV TUHLWF3BA3 hRuFCTFYj9PB SQ2jw4gANNT AXHSzEDZvmYe xtmq83dKom pkHVaJlhZCGA IRIpdZa5PDdM cLFwNcv4RuVj EFNjf2WzuajC SndzxYGwFsyo hwERLHisTTUZ XeMmhxvKXh vPYEMdJTVEO Zcy0G6iP1Md Mn3CFtiqhHP f64Ip7Zs2Fk0 Cp0nu2dnyv JwVE2eEvO6 ubVFRBcgqEcM WzwS3hAFslZ BExxCARNBeM 1SZIjqMfiaQ pNzmN5lqGOp VmoR6iEPMpt wU5gqHO6CvL WtuBYL5BCT onpf9BFPYgfk EZHQG06hJ6z U2YulivC3DIJ WvLSe6j9Y17U ngnlI4tqsYLg qh6BNuFGzida QbcYanVBDPy nB5HXMcvrWt kWcUplq2bh IKKpxxq6mY nCKZEk0uSF jH5HKHJF76M RzfNTixSzX 7pHC51r7VggS OXPPUh3Axo gMASH5GBQIK pcWuijePFh5w 0HB8Je3t8yJG 68e7kuPp5vtN lPepgL8SKgT u0199QpANw n3EGSQSXtt EMfSq1o3PF d6fjEUpHtPg V2Y4qDxmwy FryPuCyNoey exDTjOIvCuy8 fy6JiVKYAV WU4fw81uvja A29C0FXBKWq aw3iBoVLUyc8 ACB4MZ9vTU Jh1EUZbeFxR Ct2vZJzRTU 0LUEfqoPVg TDwdAweOMF eaxREtOx34G kGy9O9mjqO4S xsXRP2yyRTC 9jHmiZwMLVn Q93ygRrAOgMw WmZvlKFrJNB YMvZb0VpxD xmUqfYva093P hEItLdtnNi wDD46leJ06D Mp4R0riomlc mi415k3CvxtV IOvRIkBTMP iFnUDWOIsQPT 74LYplKZAbM 8Ac18NjK0cPp AWqtvLIK5XX 8ADA4xyuxMb 73dkcHHdgri IusMRk7BcZg jIOnkvqJRr W7bba4Ht2Hf oHS42Yt0Zg 3F3iMW2IBJTV 9FY8zg7zAx XHQk3IqKg5 mHrzjGXzw3 QedQRLHsAD3 1tLgsfclKsg vCag0KBM40y CAj9bL9GODdC JDRRqHCd8G BA1Zj5Et8dt TlQumBlBByN hSeovK63yjz 0g5rOGlXD7KU 2XBnA3A1sK3r UVH4zpbBUSso OMdOqZrs1YY yQc5UqXFHO3 5Zo1vLoN2A2v YzBjO4ges35T ltimdjTgCP WNPOO8XWHym Mv1UQ9H5yov3 bTuFEgM9ZmcS ImHYJnblZn Ot6vJcxJsNB3 f91Ny9TsSQE9 AYwOBqaLdSX 3yhxeKW5i2 4zXBW7nhvp kznYhr6xpT sFwa3VhiFO6d j0xMFTDkeOjC 7Sw1YlSnmj 2rD7CTCurxs6 tmUONdUESO tri8U2O5CF PacZItNWwG mNhpjt05TA csA16jbk31y2 HLsNjJU7fG bHsz8cKv9rT1 4RSHwsDJlB4 ncYWvXnMjw pa6QlhZybBx DGSEyKQvbr 3HYEC3RRtB A21dxZIOEg YHCXdZDnSX pZqqr3aIzGY UlxSr8UYkSyV L83QSLhUlun QFs9PHKolJI kXpE7UcMX4rN teZIPrsM8u LzlrDBZ9C2qB Yn1F19pfDZI roP36y1ZtUp ZjGRgfjB4J uyJVow164e ieTCxDNokJ aGHvDQ5eDK12 ITCkttL8nL 0yjw5fbgInyA tEbovR9GZI1 EJLKCcUVXl LRb0Jmi7Vqm Ygp9MHZTXW gO8fehVZZe DcSLpQkbGsWI 24ZWidBqeMu TF6Cfhb0vlV3 XswtuWFuwnWc CW3vgy9kH41 aBjR1pVZNAm AxaEOcH6rGA 0VQs0bkJSnl ctJvN7fgaLS CDIvmbAZVshf wrlXgC8bqnID o6rBdXEbrEN 1FI3fffQKpBx IBmQLO7IUe2b ybaYE75jhW iGpdJzPbkjWv jI2IJTivJ7V AGCUG4sX7O8 mUuMvGIhAv0a cCsAGlkjcV6v i5r8KSSlhl 4yKedywbg8y J0d1cVETpG dPObJY12sQ ecFUPikuKD9 lgVVyTovu5 yefjyvYVZTz0 AshO0UKw5Vr sYZ3DSqWRXY GKA0RkDvtoOJ vFOVoLcN3Pke 8m5aPN6ctRL v7393nRszt2 zoLuwFNbefu RvMyuiT4U4 V1VK7LY5On m5ZqubMOyQjq Tk2UmZYjwei1 iAaNnq4GeyV 9nzjxoUUDGq XXzIuaryZq uWwcbhvaRi VqyAamIuSff Dh5x5TzogTyC 2thJ12JpHDCt BsfYW3ScUYqd F4KIyOPEA11 uiitcxs42r2a XwXiz7VgBh pQSTOipnSf yv0ymeaJ4F KRQlRTqSTw xKIo8Un8oNHC kxxajiRbzh 4sEsj9M8sjM scsC1RBLMF ldiWk2VrjBW 9CLlHrKbAw R2jOb0pmVSNl IngwVE0vgrlS U8E3A2d0UBe y5smHAjz5Mv x5IzY69eeF fJqV3XcBUHyJ oMuvtlVsi8 TbCJIGmHXd MpbwmpRo0zD HkMyKrloO0 RBChjVCrzq OxslNYJntX7Z iyFuE2WtVR ncM0eaONQe QyGBg5j98PbC WAokvo5SQ7lm zpEolElD62h 4YNsQL3BjK XokTUXkxep8 IW4ti7wLSJy z6aj5EH0h26 CYRl7NIJHs dkcWel1cvwe bhrze7Amuis sAkjIi2HjGaE S2iMDFbhGX0 a1FtVZUoVD0 45bled4tpmK ToksIJ6eQb W4GEtTeeYG8 5m1dmUjFcDI CpdGCsU5mLC P2HIgQLxRJ cg5IBITTZj1f uEoXkLLDuI8 VarkDBvaiTy uC8gZ3drcK6 SsGkY7ap6hc XV6cdMwG8zO HXAyw9HMy2EN crKtxtmtro YDShOjnqLgPE CLZVHbH2LCf XfUZWjQfTQ MYeXNsokzB jivcaCrU8AJ yXmmTjN2S6 sUSGzOI0QO FOzaNiepr7us 1zlKRp6IaR7 DVzHnHYHoR RrYrqThePZz AzYm2cGwf4 Pvstk4wzwF3A o7b6jXmDhi oEuxr04KArY ah9d2aeOFTck YU18viUSu5M NuqABAdIAIjr pxGH7bm2wG b20TRq3j1UH vcOJEdAceL 1DnOS7Hjhq vikC02JIay AygbPgY4NCTT 71MTgKpv9Z5 6k2Tk1sOJ0 tJbOp3We0jq q0JkK3j6IbJ HJhgcXcnsYrX BkEOL6msLUL Z1E86g0K0z Uzp6yTe4pH GhlyngBQ8Ki BQBK3j5bJ8N LKNHpfEnkK */}", "function htmlStamina(n) {\n\treturn '<img src=\"img/fx/energizing.png\"/>' + ' ' + n + ' %';\n}", "function printStraipsnis(x) {\n let tekstasp = \"<p>\" + x + \"</p>\";\n document.querySelector ('body').innerHTML += tekstasp;\n}", "function textRender(utext, p)\n{ \n var utextArray = utext.split('\\n');\n for (var i = 0; i < utextArray.length; i++) {\n var v = utextArray[i].split(\" \");\n for (var j = 0; j < v.length; j++) {\n var src = \"\";\n switch(v[j]){ \n case \":)\": \n src = \"smile.gif\"; \n break; \n case \":(\":\n src = \"sad.gif\";\n break;\n case \":P\":\n src = \"tongue.gif\";\n break;\n case \":O\":\n src = \"wonder.gif\";\n break; \n case \":D\":\n src = \"laugh.gif\";\n break;\n default: \n break;\n }\n // emoticon generation\n if (src != \"\") {\n var img = document.createElement(\"img\");\n img.setAttribute(\"src\", \"images/emot_\" + src);\n img.setAttribute(\"alt\", v[j]);\n img.setAttribute(\"width\", \"16px\");\n img.setAttribute(\"height\", \"16px\"); \n p.appendChild(img); \n p.appendChild(document.createTextNode(\" \"));\n }\n else {\n if (!v[j].match(\"http://\"))\n p.appendChild(document.createTextNode(v[j]));\n else // anchor generation\n {\n var a = document.createElement(\"a\");\n a.setAttribute(\"href\", v[j]);\n a.setAttribute(\"target\", \"_blank\");\n a.appendChild(document.createTextNode(v[j]));\n p.appendChild(a);\n }\n p.appendChild(document.createTextNode(\" \")); \n } \n }\n if (i < utextArray.length - 1)\n p.appendChild(document.createElement(\"br\"));\n }\n}", "function picture_2across(position, width, border, image_number1, image_number2, image_credit1, image_credit2, image_caption)\r{\rvar picwidth\rvar picborder\rvar pic_string \rvar caption_position\rvar credit_position\rvar picture_class\rvar credit_class\r//alert( \"Starting\" );\rcredit_position = \"right\"\rcaption_position = \"left\";\rif (position == \"center\") { caption_position = \"left\"; }\rif (position == \"right\") { caption_position = \"right\"; }\rpicture_class = \"inpicsr\";\rif (position == \"left\") { picture_class = \"inpicsl\"; }\rif (position == \"center\") { picture_class = \"inpicsc\"; }\rcredit_class = \"imagecredit_rt\"\rif (position == \"left\") { credit_class = \"imagecredit_lt\"; }\rif (width != 0) { picwidth = 'width=\"' + width + '\"'; }\t\relse { \tpicwidth = \"\"; }\t\rif (border == true) { \tpicborder = \"\"; }\relse { \tpicborder = \"nb\"; }\t\rpic_string = '<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"' + position + '\"><tr><td align=\"' + position + '\"><img src=\"../../press_sites/mktg_musts_files/images/%27%20%2B%20rm_issue%20%2B%20%27/%27%20%2B%20rm_issue%20%2B%20%20%27_%27%20%2B%20rm_article_type%20%2B%20%27_%27%20%2B%20rm_article_number%20%2B%20%27_%27%20%2B%20image_number1%20%2B%20%27.jpg\" border=\"1\" align=\"' + position + '\" class=\"' + picture_class + picborder + '\"></td><td><img src=\"../../press_sites/images/rgbempty.gif\" width=\"5\" height=\"1\" border=\"0\" alt=\"\"></td><td align=\"' + position + '\"><img src=\"../../press_sites/mktg_musts_files/images/%27%20%2B%20rm_issue%20%2B%20%27/%27%20%2B%20rm_issue%20%2B%20%20%27_%27%20%2B%20rm_article_type%20%2B%20%27_%27%20%2B%20rm_article_number%20%2B%20%27_%27%20%2B%20image_number2%20%2B%20%27.jpg\" border=\"1\" align=\"' + position + '\" class=\"' + picture_class + picborder + '\"></td></tr><tr><td align=\"' + credit_position + '\" class=\"' + credit_class + '\">' + image_credit1 + '</td><td><img src=\"../../press_sites/images/rgbempty.gif\" width=\"5\" height=\"1\" border=\"0\" alt=\"\"></td><td align=\"' + credit_position + '\" class=\"' + credit_class + '\">' + image_credit2 + '</td></tr><tr><td colspan=\"3\"' + picwidth + ' align=\"' + caption_position + '\" class=\"imagecaption\">' + image_caption + '</td></tr></table>';\r//alert( \"Pic_string:\" + pic_string);\rdocument.write(pic_string); \rreturn true;\r}", "function getPieceCodeForImages()\r\n{\r\n //RANGE\r\n out='V3';\r\n //TYPE\r\n out+=getInstalation().cod;\r\n //OPTICS\r\n out+=getOptics().cod;\r\n\r\n //FIXED DIGITS\r\n out+='0';\r\n out+='M';\r\n //LIGHT OUTPUT DIRECT --- Need to see in the line configuration if it is direct or not\r\n if(modules[0].data.ind == true){\r\n out+= 'M';\r\n }\r\n else{\r\n out+= '0';\r\n }\r\n\r\n //PROFILE COLOR\r\n if(getColor().sel == '3')\r\n {\r\n out+= \"X1\";\r\n }\r\n else\r\n {\r\n out+=getColor().cod;\r\n } \r\n return out;\r\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test the is lower cause in alphabet string functionality
function testInLowerCaseAlphabet(){ var StringUtils = LanguageModule.StringUtils; var stringUtils = new StringUtils(); var encodings = stringUtils.stringEncodings; var lencodings = stringUtils.languageEncodings; var isLowerCaseInAlphabet1 = stringUtils.isLowerCaseInAlphabet("abcdef", encodings.ASCII, lencodings.ENGLISH); var isLowerCaseInAlphabet2 = stringUtils.isLowerCaseInAlphabet("ABCDEF", encodings.ASCII, lencodings.ENGLISH); var isLowerCaseInAlphabet3 = stringUtils.isLowerCaseInAlphabet("0123456789", encodings.ASCII, lencodings.ENGLISH); var isLowerCaseInAlphabet4 = stringUtils.isLowerCaseInAlphabet("g", encodings.ASCII, lencodings.ENGLISH); var isLowerCaseInAlphabet5 = stringUtils.isLowerCaseInAlphabet("->?", encodings.ASCII, lencodings.ENGLISH); expect(isLowerCaseInAlphabet1).to.eql(true); expect(isLowerCaseInAlphabet2).to.eql(false); expect(isLowerCaseInAlphabet3).to.eql(false); expect(isLowerCaseInAlphabet4).to.eql(true); expect(isLowerCaseInAlphabet5).to.eql(false); }
[ "checkLowerCharacter() {\n this.report.checkLowerCharacter = /[a-z]/.test(this.input);\n }", "function isLower(c){\r\n return c.toLowerCase() == c;\r\n}", "function hasLower(string) {\n return (/[a-z]/.test(string)); \n }", "function containsLowerCase(text){\r\n return /['a-z']/.test(text);\r\n}", "function isAlphabetical(value){\n if(isUpperCase(value) || isLowerCase(value)) return true;\n else return false;\n }", "function isLowerCase(value){\n if(value < 97 || value > 122) return false;\n else return true;\n }", "function islower(str) {\n return str === str.toLowerCase();\n}", "function isLower(letter){\n var charNum = letter.charCodeAt();\n if (charNum >= 97 && charNum <= 122){\n return true;\n }\n else{\n return false;\n }\n}", "function isLower(s) {\n if(s == undefined)\n return isLower;\n\n return s.match(/^[a-z]+$/) ? true : false;\n}", "function isLowerCase(chr) {\n return chr == chr.toLowerCase();\n}", "function lowercase(input) {}", "function hasLowerCase(string) {\n return (/[a-z]/.test(string));\n }", "function isLowerCase(character)\r\n{\r\n\treturn ((character >= 'a') && (character <= 'z'));\r\n}", "function isLowercaseLetter(code) {\n return code >= 0x0061 && code <= 0x007A;\n}", "function containsLowercaseLetter(string) {\r\n return /[a-z]/.test(string);\r\n}", "function isLower(c) /* (c : char) -> bool */ {\n return ((c >= 'a') && (c <= 'z'));\n}", "function isLowerCaseAlpha(char) {\n\tif (char.charCodeAt(0) >= 97 && char.charCodeAt(0) <= 122) {\n\t\treturn true;\n\t}\n\treturn false;\n}", "function makeLowerCase(str) {\n // implement\n}", "function isLowerCase(letter){\n if (letter !== letter.toUpperCase() && letter === letter.toLowerCase())\n return true;\n else\n return false;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Download all visuals of an order
downloadVisuals() { let imgArray = []; this.currentOrder.content.forEach((order) => { order.visual.forEach((visual) => { if (visual.fullsizeimage !== undefined) { imgArray.push(visual.fullsizeimage); } }); }); downloadAll(imgArray); }
[ "function download_image() {\n // dom-to-image dependency\n domtoimage\n .toPng(div_viz, {\n filter: node =>\n // Remove foreground nodeboxes for faster rendering\n // (Background nodes not excluded as they are purposely styled)\n !(node.classList && [...node.classList].includes(\"fg_node\"))\n })\n .then(content => download(view.tree + \".png\", content));\n}", "function initImageDownloadCycle(){\n images.downloadAll();\n}", "function downloadOrders() {\n Purchase.getOrders($rootScope.dealer.id)\n .then(function (result) {\n // success\n $scope.purchases = result.data.buyer_purchases;\n $scope.purchases = Product.convertKeysToCurrencies($scope.purchases);\n $scope.loadingStatus = DOWNLOADED_STATUS;\n }, function (err) {\n // failure\n console.log(\"Couldn't download the orders of this user :(\");\n })\n }", "function initDownloadButtons() {\n\n\t\t// download obj\n\t\t$('#download-obj').click(function() {\n\n\t\t\texportVoxels()\n\n\t\t\tlet objBlob = new Blob([exported.obj], {\n\t\t\t\ttype: 'text/plain'\n\t\t\t})\n\n\t\t\tsaveAs(objBlob, 'voxels.obj')\n\n\t\t})\n\n\t\t// download mtl\n\t\t$('#download-mtl').click(function() {\n\n\t\t\texportVoxels()\n\n\t\t\tlet mtlBlob = new Blob([exported.mtl], {\n\t\t\t\ttype: 'text/plain'\n\t\t\t})\n\n\t\t\tsaveAs(mtlBlob, matFilename + '.mtl')\n\n\t\t})\n\n\t\t// download JSON\n\t\t$('#download-json').click(function() {\n\n\t\t\tlet jsonBlob = new Blob([JSON.stringify(GameScene.getScene())], {\n\t\t\t\ttype: 'text/json'\n\t\t\t})\n\n\t\t\tsaveAs(jsonBlob, 'voxels.json')\n\n\t\t})\n\n\t}", "async download(params) {\n try{\n \n const orders = await this.connectionService.fetchOrders(this.filterParams.params.orderStatus,\n commonFunctions.fetchCurrDateDifferenceInHours(this.filterParams.params.orderFromHours),\n this.filterParams.params.orderLimit);\n \n log(\"Fetched \" + orders.length + \" order(s) \");\n for (const loop in orders) {\n \n // validate the order item to check if its already downloaded \n if (this.ignoreOrderItem(orders, loop, this.filterParams.ignoreTag) == false)\n {\n \n log (\"# \" + commonFunctions.shopifyToOrderWiseId(orders[loop].id, orders[loop].order_number) + \" processing...\");\n \n //logJSON(orders[loop]);\n log(\"\");\n log (\"############# Formating into JSON\"); \n log(\"\");\n \n // format the structure into json\n let orderItemJSON = (new this.formatterClass(orders[loop], params)).execute();\n logJSON(orderItemJSON);\n \n // check if the order requires to be fulfilled that means either one line item \"requires_shipping\" is true\n // this identifies this order as either recurring payment \n if (this.orderRequiresShipping(orders[loop]) == true) {\n \n // normal website purchase\n this.submitWebsaleOrder(orders[loop], orderItemJSON);\n \n } \n else \n {\n // recurring payments\n this.submitRecurringOrder(orders[loop], orderItemJSON);\n }\n \n } else {\n \n log (\"# \" + commonFunctions.shopifyToOrderWiseId(orders[loop].id, orders[loop].order_number) + \" order already downloaded\");\n \n }\n }\n \n \n }catch(err) {\n console.log(err);\n logJSON(err);\n log('Error connecting to Connect Source \"' + err.name + '\"');\n \n }\n \n }", "function downloadAsVO() {\n var layer = $(this).closest(\".addLayer\").data(\"layer\");\n var url = AdditionalLayersCore.buildVisibleTilesUrl(layer);\n url += \"&media=votable\";\n var posGeo = layer.planet.coordinateSystem.from3DToGeo(navigation.center3d);\n var astro = UtilsCore.formatCoordinates(posGeo);\n $(this).parent().attr('href', url)\n .attr('download', layer.name + \"_\" + astro[0] + '_' + astro[1]);\n }", "function download() {\n\tif( vis != null ) {\n\t\tvar format = $( '#format' ).val();\n\t\t// this is for downloading\n\t\tif( format == \"png\" ) {\n\t\t\tvar png64 = vis.png();\n\t\t\t$('#png-eg').attr('src', png64);\n\t\t} else if( format == \"svg\" ) {\n\t\t\tvis.exportNetwork( \"svg\", \"/cgi-bin/complexfinder/export.php?type=svg\" );\n\t\t} else if( format == \"pdf\" ) {\n\t\t\tvis.exportNetwork( \"pdf\", \"/cgi-bin/complexfinder/export.php?type=pdf\" );\n\t\t} else if( format == \"xgmml\" || format == \"graphml\" ) {\n\t\t\tvis.exportNetwork( format, \"/cgi-bin/complexfinder/export.php?type=xml\" );\n\t\t} else if( format == \"sif\" ) {\n\t\t\tvis.exportNetwork( format, \"/cgi-bin/complexfinder/export.php?type=txt\" );\n\t\t}\n\t}\n}", "function download_svg() {\n const svg = div_viz.cloneNode(true)\n // Remove foreground nodeboxes for faster rendering\n // (Background nodes not excluded as they are purposely styled)\n Array.from(svg.getElementsByClassName(\"fg_node\")).forEach(e => e.remove());\n apply_css(svg, document.styleSheets[0]);\n const svg_xml = (new XMLSerializer()).serializeToString(svg);\n const content = \"data:image/svg+xml;base64,\" + btoa(svg_xml);\n download(view.tree + \".svg\", content);\n}", "function downloadAll (slices) {\n // create invisible link\n var link = createEl('a', '', { download: null })\n link.style.display = 'none'\n document.body.appendChild(link)\n\n // simulate click on links to trigger downloads\n slices.forEach(function (canvas) {\n link.setAttribute('href', canvas.toDataURL())\n link.setAttribute('download', canvas.className)\n link.click()\n })\n\n document.body.removeChild(link)\n }", "function xhrProcessor() {\n if (bcViewer.viewer.workspace.slots.length == 1) {\n var slot = bcViewer.viewer.workspace.slots[0];\n } else {\n // TODO: handle multiple slots\n }\n var mirWindow = slot.window;\n var imgId = mirWindow.focusModules.ImageView.currentImg[\"label\"],\n canvasUriBase = 'http://scenery.bc.edu/',\n canvasUriSuffix = '/full/full/0/default.jpg',\n canvasUri = canvasUriBase + imgId + '.jp2' + canvasUriSuffix,\n filename = imgId + '.jpg';\n\n var xhr = new XMLHttpRequest(),\n a = document.getElementById(\"dl-link\"), file;\n xhr.open('GET', canvasUri, true);\n xhr.responseType = 'blob';\n xhr.onload = function(e) {\n file = new Blob([xhr.response], { type : 'application/octet-stream' });\n a.href = window.URL.createObjectURL(file);\n a.target = \"_self\";\n a.download = filename;\n a.click;\n };\n xhr.send();\n}", "function drawArtifactSet() {\n\n\tvar artifactSet = JSON.parse(sessionStorage.getItem(\"artifactSet\"));\n\n\tfor(var i = 0; i < artifactSet.length; i++) {\n\t\tdrawArtifact(artifactSet[i]);\n\t}\n}", "function drawOrders(returnValues) {\n\n\n for(let i = 0; i<returnValues.length; i++)\n {\n\n\n order = new OrderBox(\n returnValues[i].name, returnValues[i].image, returnValues[i].orderid\n );\n order.draw();\n }\n}", "function downloadInsertionOrders() {\n const resource = new DV360Sheet(SHEET_CONFIG.INSERTION_ORDERS);\n resource.download();\n}", "function ProcessDownloadView()\n{\n var i;\n var myId;\n \n if( lastGuiCurrentMode != guiCurrentMode )\n {\n PrintLog(1, \"GUI: ProcessDownloadView()\");\n \n // Draw the view...\n var myUniiIcon = (bUniiStatusKnown && bUniiUp) ? szUniiIconButton + szUniiIconUp + \"</button>\" : szUniiIconButton + szUniiIconDown + \"</button>\";\n var mySbIfIcon = isSouthBoundIfCnx ? szSbIfIconButton + szSbIfIconOn + \"</button>\" : szSbIfIconButton + szSbIfIconOff + \"</button>\";\n var myRegIcon = (nxtyRxRegLockStatus == 0x00) ? szRegIconButton + \"</button>\" : isRegistered ? szRegIconButton + szRegIconReg + \"</button>\" : szRegIconButton + szRegIconNotReg + \"</button>\";\n\n \n var myHtml = \n \"<img src='img/header_dld.png' width='100%' />\" +\n \"<button id='back_button_id' type='button' class='back_icon' onclick='RequestModeChange(PROG_MODE_MAIN)'><img src='img/go_back.png'/></button>\"+\n myRegIcon +\n mySbIfIcon +\n myUniiIcon +\n \n\n \"<br><br>\" +\n \"<div class='downloadSelectContainer'>\" +\n \n \n \"<table id='dldTable' align='center'>\" +\n \"<tr> <th style='padding: 10px;' colspan='4'>Update Software Menu</th></tr>\" + \n \"<tr> <th>Image</th> <th>Cel-Fi</th> <th>Cloud</th> <th>Status</th> </tr>\" +\n \"<tr> <td id='n0'></td> <td id='v0'></td> <td id='c0'></td> <td id='s0'></td> </tr>\" +\n \"<tr> <td id='n1'></td> <td id='v1'></td> <td id='c1'></td> <td id='s1'></td> </tr>\" +\n \"<tr> <td id='n2'></td> <td id='v2'></td> <td id='c2'></td> <td id='s2'></td> </tr>\" +\n \"<tr> <td id='n3'></td> <td id='v3'></td> <td id='c3'></td> <td id='s3'></td> </tr>\" +\n \"<tr> <td id='n4'></td> <td id='v4'></td> <td id='c4'></td> <td id='s4'></td> </tr>\" +\n \"<tr> <td style='padding: 20px;' colspan='4'><input style='font-size: 24px;' id='update_id' type='button' value='Update' onclick='SetSoftwareUpdate()'></input> </td> </tr>\" +\n \"</table> </div>\" + \n \n \n\n szMyStatusLine;\n\n $('body').html(myHtml); \n \n\n\n document.getElementById(\"sb_icon_id\").addEventListener('touchstart', HandleButtonUp ); // up, adds transparency\n document.getElementById(\"sb_icon_id\").addEventListener('touchend', HandleButtonDown ); // down, back to normal, no transparency\n document.getElementById(\"reg_icon_id\").addEventListener('touchstart', HandleButtonUp ); // up, adds transparency\n document.getElementById(\"reg_icon_id\").addEventListener('touchend', HandleButtonDown ); // down, back to normal, no transparency\n document.getElementById(\"unii_icon_id\").addEventListener('touchstart', HandleButtonUp ); // up, adds transparency\n document.getElementById(\"unii_icon_id\").addEventListener('touchend', HandleButtonDown ); // down, back to normal, no transparency\n \n document.getElementById(\"back_button_id\").addEventListener('touchstart', HandleButtonDown );\n document.getElementById(\"back_button_id\").addEventListener('touchend', HandleButtonUp );\n \n \n // Make the \"Update\" button look pretty...\n document.getElementById(\"update_id\").addEventListener('touchstart', HandleButtonDown );\n document.getElementById(\"update_id\").addEventListener('touchend', HandleButtonUp );\n \n \n lastGuiCurrentMode = guiCurrentMode; \n }\n \n if( guiSoftwareDirtyFlag == true )\n {\n for( i = 0; i < guiSwNames.length; i++ )\n {\n myId = \"n\" + i;\n document.getElementById(myId).innerHTML = guiSwNames[i];\n myId = \"v\" + i;\n document.getElementById(myId).innerHTML = guiSwCelFiVers[i];\n myId = \"c\" + i;\n document.getElementById(myId).innerHTML = guiSwCldVers[i];\n myId = \"s\" + i;\n document.getElementById(myId).innerHTML = guiSwStatus[i];\n }\n \n document.getElementById(\"update_id\").disabled = guiSoftwareButtonFlag?false:true;\n document.getElementById(\"update_id\").value = guiSoftwareButtonText;\n \n \n guiSoftwareDirtyFlag = false;\n }\n \n}", "function getDownloadlinks(order, url, title, cb) {\r\n GM_xmlhttpRequest({\r\n \"url\" : url,\r\n \"method\" : \"GET\",\r\n \"synchronous\" : false,\r\n \"url\" : baseUrl + url,\r\n \"onload\" : function(xhr)\r\n {\r\n // analyse the contents\r\n if (!xhr.responseText || xhr.responseText.indexOf(APPLEERRORINDICATOR) >= 0) {\r\n showError(\"Could not download includes/large.html\");\r\n }\r\n else {\r\n insertDownloadLink(xhr.responseText, order, title);\r\n }\r\n if (cb) cb();\r\n },\r\n \"onerror\" : function() {\r\n showError(\"Could not download trailer subpage\");\r\n if (cb) cb();\r\n }\r\n });\r\n }", "function showStrokeOrder(array) {\n \n // for each value in array, create a url string\n for (let i=0; i < array.length; i++) {\n const url = api_endpoint + array[i];\n\n //Pass the request object the url and the custom setup (myInit)\n const request = new Request(url, myInit);\n\n // Pass request to fetch\n fetch(request) \n .then(response => response.json())\n .then(results => {\n // get results, pass for loop index value\n getStrokes(results, i);\n })\n .catch(function(error) {\n console.log(error);\n });\n }\n}", "function getArtGraph() {\n const params = new URL(location.href).searchParams;\n const selectedWorkspace = params.get('workspace');\n const selectedArtifact = params.get('artifact');\n\n get(\"./workspaces/\" + selectedWorkspace + \"/\" + selectedArtifact).then(function(serialArt) {\n const MAX_LENGTH = 35;\n let dot = [];\n let art = JSON.parse(serialArt);\n\n dot.push(\"digraph G {\\n\");\n dot.push(\"\\tgraph [\\n\");\n dot.push(\"\\t\\trankdir = \\\"LR\\\"\\n\");\n dot.push(\"\\t\\tbgcolor=\\\"transparent\\\"\\n\");\n dot.push(\"\\t]\\n\");\n\n /* Artifact name and type */\n var s1 = (art.artifact.length <= MAX_LENGTH) ? art.artifact : art.artifact.substring(0, MAX_LENGTH) + \" ...\";\n dot.push(\"\\t\\\"\" + art.artifact + \"\\\" [ \" + \"\\n\\t\\tlabel = \\\"\" + s1 + \":\\\\n\");\n s1 = (art.type.length <= MAX_LENGTH) ? art.type :\n art.type.substring(0, MAX_LENGTH) + \" ...\";\n dot.push(s1 + \"|\");\n\n /* observable properties */\n Object.keys(art.properties).forEach(function(y) {\n var ss = Object.keys(art.properties[y])[0] + \"(\" + Object.values(art.properties[y])[0].toString() + \")\";\n var s2 = (ss.length <= MAX_LENGTH) ? ss : ss.substring(0, MAX_LENGTH) + \" ...\";\n dot.push(s2 + \"|\");\n });\n\n /* operations */\n art.operations.forEach(function(y) {\n var s2 = (y.length <= MAX_LENGTH) ? y : y.substring(0, MAX_LENGTH) + \" ...\";\n dot.push(s2 + \"\\\\n\");\n });\n dot.push(\"\\\"\\n\");\n dot.push(\"\\t\\tshape=record style=filled fillcolor=white\\n\");\n dot.push(\"\\t\\t];\\n\");\n\n /* Linked Artifacts */\n art.linkedArtifacts.forEach(function(y) {\n var str1 = (y.length <= MAX_LENGTH) ? y :\n y.substring(0, MAX_LENGTH) + \" ...\";\n dot.push(\"\\t\\t\\\"\" + y + \"\\\" [ label=\\\"\" + str1 + \"\\\"\");\n dot.push(\"\\t\\tshape=record style=filled fillcolor=white\\n\");\n dot.push(\"\\t]\\n\");\n dot.push(\"\\t\\\"\" + art.artifact + \"\\\" -> \\\"\" + y + \"\\\" [arrowhead=\\\"onormal\\\"]\");\n });\n\n /* observers */\n art.observers.forEach(function(y) {\n if (art.type !== \"cartago.AgentBodyArtifact\") {\n var s2 = (y.length <= MAX_LENGTH) ? y : y.substring(0, MAX_LENGTH) + \"...\";\n dot.push(\"\\t\\\"\" + y + \"\\\" [ \" + \"\\n\\t\\tlabel = \\\"\" + s2 + \"\\\"\\n\");\n dot.push(\"\\t\\tshape = \\\"ellipse\\\" style=filled fillcolor=white\\n\");\n dot.push(\"\\t];\\n\");\n dot.push(\"\\t\\\"\" + y + \"\\\" -> \\\"\" + art.artifact + \"\\\" [arrowhead=\\\"odot\\\"];\\n\");\n }\n });\n\n dot.push(\"}\\n\");\n\n /* Transition follows modal top down movement */\n var t = d3.transition().duration(750).ease(d3.easeLinear);\n d3.select(\"#artifactgraph\").graphviz().transition(t).renderDot(dot.join(\"\"));\n });\n}", "function drawMultipleToPage(coffeeOrders){\n const listArea = document.querySelector('[data-list]');\n listArea.textContent = '';\n drawMultipleToPage.forEach(singleOrder);\n}", "function loadAllBagsToDOM() {\n templates.clearGearDiv();\n db.getAllBags()\n .then((data) => {\n templates.makeItemList(data);\n });\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a list of projects as JSON, create a table
function list(projects) { var table = $('<table>').class('table'); var head = $('<tr>').append('<th>Name</th>').appendTo(table); projects.forEach(function(project) { var row = $('<tr>').append( $('<td>').text(project.name) ).appendTo(table); }); return table; }
[ "function buildProjectListAsTable(json) {\r\n var arr = [];\r\n for (p in projects) {\r\n var project = projects[p];\r\n\r\n // Get name of PMC\r\n var pmc = committees[project.pmc] ? committees[project.pmc].name : \"Unknown\";\r\n\r\n // Get project type\r\n var type = \"Sub-Project\";\r\n var shortp = p.split(\"-\")[0];\r\n if (unixgroups[shortp]) {\r\n type = \"TLP\";\r\n if ((!committeesByName[project.name] && committees[project.pmc]) || project.name.match(/incubating/i)) {\r\n type = \"Sub-project\";\r\n }\r\n } else {\r\n type = \"Retired\";\r\n }\r\n\r\n if (project.podling || project.name.match(/incubating/i)) {\r\n type = \"Podling\";\r\n pmc = \"Apache Incubator\";\r\n }\r\n\r\n // Programming language\r\n var pl = project['programming-language'] ? project['programming-language'] : \"Unknown\";\r\n\r\n // Shove the result into a row\r\n arr.push([ p, project.name, type, pmc, pl, project.category])\r\n }\r\n\r\n // Construct the data table\r\n $('#contents').html( '<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"display\" id=\"projectlist\"></table>' );\r\n\r\n $('#projectlist').dataTable( {\r\n \"data\": arr,\r\n \"columns\": [\r\n { \"title\": \"ID\", \"visible\": false },\r\n { \"title\": \"Name\" },\r\n { \"title\": \"Type\" },\r\n { \"title\": \"PMC\" },\r\n { \"title\": \"Programming Language(s)\" },\r\n { \"title\": \"Category\" }\r\n ],\r\n \"fnRowCallback\": function( nRow, aData, iDisplayIndex, iDisplayIndexFull) {\r\n jQuery(nRow).attr('id', aData[0]);\r\n jQuery(nRow).css(\"cursor\", \"pointer\");\r\n return nRow;\r\n }\r\n } );\r\n\r\n $('#projectlist tbody').on('click', 'tr', function () {\r\n var name = $(this).attr('id');\r\n location.href = \"project.html?\" + name\r\n } );\r\n}", "function create_table(json) {\n\n // hard coding is cheating, mostly... make it dynamic!\n\n db.serialize( () => {\n db.run('create table if not exists '\n + 'todo ('\n + 'id numeric primary key, '\n + 'userid numeric, '\n + 'title text, '\n + 'completed text)');\n\n db.run('delete from todo'); //or drop the table first..\n\n var stmt = db.prepare('insert into todo values (?,?,?,?)');\n\n json.forEach( (item) => {\n stmt.run([item.id, item.userid, item.title, item.completed]);\n });\n\n stmt.finalize();\n\n });\n\n}", "function generateTable(project) {\n\t\t$(\"#div2\").show();\n\t\t$(\"#div3\").hide();\n\t\t$('#ProjectDetails tr').remove();\n\t\tvar row = $(\"<tr/>\"); \n\t\t$(\"#ProjectDetails\").append(row);\t\t\t\t\t\t\t\t\n\t\trow.append($(\"<td align='left'>Name</td>\"));\n\t\trow.append($(\"<td align='left'>\"+project.fields.name+\"</td>\"));\n\t\tvar row = $(\"<tr/>\"); \n\t\t$(\"#ProjectDetails\").append(row);\t\t\t\t\t\t\t\t\n\t\trow.append($(\"<td align='left'>Description</td>\"));\n\t\trow.append($(\"<td align='left'>\"+project.fields.description+\"</td>\"));\n\t\tvar row = $(\"<tr/>\"); \n\t\t$(\"#ProjectDetails\").append(row);\t\t\t\t\t\t\t\t\n\t\trow.append($(\"<td align='left'>Address</td>\"));\n\t\trow.append($(\"<td align='left'>\"+project.fields.address+\"</td>\"));\n\t\tvar row = $(\"<tr/>\"); \n\t\t$(\"#ProjectDetails\").append(row);\t\t\t\t\t\t\t\t\n\t\trow.append($(\"<td align='left'>Status</td>\"));\n\t\trow.append($(\"<td align='left'>\"+project.fields.status+\"</td>\"));\n\t}", "function createTable(name, json) {\n if (json.length == 0)\n return \"<span class='faded'>No data available</span>\"\n\n var table = \"<table>\\n\"\n\n // Table head\n var thead = \"\\t<thead>\\n\"\n for (var k in json[0]) {\n thead += \"\\t\\t<th>\" + k + \"</th>\\n\"\n }\n thead += \"\\t</thead>\\n\"\n\n // Table body\n var tbody = \"\\t<tbody>\\n\"\n for(var i = 0; i < json.length; i++) {\n var obj = json[i]\n var row = \"\\t\\t<tr>\\n\"\n for(var k in obj) {\n row += \"\\t\\t\\t<td> \" + format(k, obj[k]) + \" </td>\\n\"\n }\n row += \"\\t\\t</tr>\\n\"\n tbody += row\n }\n\n // Concatenating\n tbody += \"\\t</tbody>\\n\"\n table += thead + tbody + \"</table>\"\n\n return table\n}", "function FillProjectsTable(results) {\n var dataTable = $(\"#projects\").DataTable();\n dataTable.clear().draw();\n $.each(results, function (i, item) {\n var itemUrl = escapeHtml(item.__metadata.uri);\n var itemEtag = item.__metadata.etag;\n var compliantTitle = escapeHtml(item.Title);\n dataTable.row.add([\n item.Id ? item.Id : \"\",\n item.Title ? \"<a style='color:blue' href='javascript:void(0)' onClick='EditProject(\" + item.Id + \")'>\" + item.Title + \"</a>\" : \"\",\n item.PrimaryManagerID.Title ? item.PrimaryManagerID.Title : \"\",\n item.SecondaryManagerID.Title ? item.SecondaryManagerID.Title : \"\",\n item.LeadOffice.Title ? item.LeadOffice.Title : \"\",\n item.AssignedDate ? new Date(item.AssignedDate).format(\"M/d/yyyy\") : \"\",\n item.CommutationStatus.Title,\n item.FinancialAuthority ? accounting.formatMoney(item.FinancialAuthority) : \"\"\n ]).draw();\n });\n}", "function createProjectRow(index, proj_data){\n\n //split the array of research elements up by their tag and values\n //create a dictionary to hold these pairs\n var dict = {};\n for (var i = 1; i < proj_data.length; i++){\n var nl_index = proj_data[i].indexOf('\\n');\n var key = proj_data[i].substring(0, nl_index);\n var value = proj_data[i].substring(nl_index + 1);\n \n dict[key.trim()] = value;\n }\n projects.push(dict);\n //create and store new column\n var tmpl = document.getElementById('project-template').content.cloneNode(true);\n \n //update column id\n tmpl.querySelector('.item').id = \"proj-\" + String(index);\n \n //set parallax background image\n tmpl.querySelector('.item').style.backgroundImage = \"url(\" + String(dict.image)+ \")\";\n \n //offset heading if odd numbered project\n if (index % 2 == 1){\n tmpl.querySelector('.darkshade').className += \" offset-lg-8\";\n }\n \n //set title\n tmpl.querySelector('.title').innerHTML = dict.title;\n \n //set description\n tmpl.querySelector('.description').innerHTML = dict.description;\n \n //set link\n tmpl.querySelector('.link').href = dict.link;\n \n //append finished column to the DOM\n document.getElementById(\"project_list\").appendChild(tmpl);\n}", "function makeTable(json) {\n var obj = JSON.parse(json),\n table = $(\"<table>\"),\n row, value, i;\n\n for (i = 0; i < obj.rows.length; i++) {\n row = $(\"<tr>\");\n row.append(\"<td>\" + obj.rows[i].key + \"</td>\");\n value = obj.rows[i].value;\n if (value instanceof Array) {\n value.forEach(function (element) {\n row.append(\"<td>\" + element + \"</td>\"); \n });\n }\n else {\n row.append(\"<td>\" + value + \"</td>\"); \n }\n table.append(row); \n }\n\n return table;\n }", "static createTable (list, fields) {\n let rows = [];\n\n // create header\n let cols = [];\n for (let iField = 0; iField < fields.length; iField++) {\n const currField = fields[iField];\n cols.push(currField.description);\n }\n rows.push('<th>' + cols.join('</th><th>') + '</th>');\n\n for (let index in list) {\n if (list.hasOwnProperty(index)) {\n const listElem = list[index];\n cols = [];\n for (let iField = 0; iField < fields.length; iField++) {\n const currField = fields[iField];\n let simpleName = currField.name.substr(currField.name.lastIndexOf('.')+1);\n cols.push(listElem[simpleName]);\n }\n\n rows.push('<td>' + cols.join('</td><td>') + '</td>');\n }\n }\n return '<table><tr>' + rows.join('</tr><tr>') + '</tr></table>';\n }", "function loadSingleProjectDetails(data) {\n Object.keys(data).forEach((d) => {\n let row = document.createElement(\"tr\");\n if (d == \"__v\" || d == \"_id\") {\n row.innerHTML = null;\n } else {\n row.innerHTML = `\n <td class=\"item-key\">${d}</td>\n <td>${data[d]}</td>\n `;\n }\n\n document.getElementById(\"project-detail\").append(row);\n });\n}", "function displayProjects() {\n\n //Current published project and ID\n var p, projId;\n\n //Project table rows to publish collectively\n var pTable = [];\n\n var pEnum = projects.getEnumerator();\n\n //Build a 3-column table with one project per row.\n while (pEnum.moveNext()) {\n p = pEnum.get_current();\n\n //Build row and add it to the end of the table.\n pTable = buildProjectRow(pTable, p);\n }\n\n //Append table as the HTML table body\n $(\"tbody\").append(pTable);\n\n document.getElementById(\"msg\").innerHTML = \"Enumerated projects = \" + pTable.length;\n}", "function buildTable(items) {\n var values = [];\n var row = [];\n var reportDate = getReportDate();\n var timeStamp = getTimestamp();\n for (var i=0; i<items.length; i++) {\n row = [];\n row.push(items[i].id);\n row.push(items[i].key);\n row.push(items[i].projectKey);\n row.push(items[i].projectName);\n row.push(items[i].summary);\n row.push(items[i].issueType);\n row.push(items[i].created);\n row.push(items[i].updated);\n row.push(reportDate);\n row.push(timeStamp);\n values.push(row);\n }\n return values;\n }", "function createTable() {\n // 1. GET request from db\n fetch('/report', {\n method: 'GET',\n })\n .then((response) => response.json())\n .then((reportData) => {\n // 2. Creating table headers by taking first array and saving keys of user object\n const headings = Object.keys(reportData[0]).slice(1);\n for (let i = 0; i < headings.length; i++) {\n const columnHeader = document.createElement('th');\n columnHeader.innerHTML = headings[i].split('_').join(' ').toUpperCase();\n document.getElementById('report-row').appendChild(columnHeader);\n }\n\n // 3. Creating table rows\n // iterate through each object within array (eg. [{user1...},{user2...}...])\n for (let i = 0; i < reportData.length; i++) {\n const currentRow = reportData[i];\n const newRow = document.createElement('tr');\n const rowValues = Object.values(currentRow);\n // iterate through each value of object (eg. firstName, lastName, etc.)\n for (let i = 1; i < rowValues.length; i++) {\n const input = document.createElement('td');\n input.innerHTML = rowValues[i];\n newRow.appendChild(input);\n }\n document.getElementById('report-body').appendChild(newRow);\n }\n })\n .catch((error) => {\n console.error('Error:', error);\n });\n}", "function addProject(_object){\r\n\tvar tr = new dummy.project();\r\n\ttr.find(\"td:first-child\").text(_object.id);\r\n\ttr.find(\"td:nth-child(2)\").text(_object.name);\r\n\ttr.find(\"td:nth-child(3)\").text(_object.client);\r\n\ttr.find(\"td:nth-child(4)\").text(_object.desc);\r\n\ttr.find(\"td:nth-child(5) button:nth-child(1)\").html(\"<i class='icon-white icon-envelope'></i> \"+_object.messages);\r\n\ttr.find(\"td:nth-child(5) button:nth-child(2)\").html(\"<i class='icon-white icon-file'></i> \"+_object.files);\r\n\ttr.find(\"td:nth-child(5) button:nth-child(3)\").html(\"<i class='icon-white icon-edit'></i> \"+_object.tasks);\r\n\ttr.find(\"td:nth-child(6) .bar\").css('width',_object.completion);\r\n\r\n\t$('.table-projects').append(tr);\r\n\tupdateTooltips();\r\n}", "function createTaskTableFromFilter(){\n\tconsole.log(\"PROJECTS OF INTEREST == \", projectsOfInterest);\n\tvar count = 0;\n\tfor (var i = 0; i < projectsOfInterest.length; i++) {\n\t\t\tcount++;\n\t\t\taddTaskToTable(projectsOfInterest[i]);\n\t}\n\tif (count === 0) {\n\t\tclearAndAddSingleRow('No Tasks to Display!');\n\t}\n\t\n\t\n}", "function createProjectList(projects) {\n var ul = $('<ul/>');\n $.each(projects, function (index, project) {\n ul.append(formatProjectAsListItem(project));\n });\n\n $('#project-list').append(ul);\n}", "function projects(){\n \t$.getJSON('http://www.alexly-webdev.com/static/js/info/projects.json', function(data){\n \t\t$(data).each(function(i, val){\n \t\t\tprojectCreator(val);\n \t\t});\n \t});\n\n \tfunction projectCreator(project){\n \t\tvar newProject = $('<div>').addClass('col s10 offset-s1 l6 card-panel hoverable center-align project').data(project),\n titleRow = $('<div>').addClass('col s12'),\n \t\ttitle = $('<h4>').text(project.title),\n picRow = $('<div>').addClass('col s12'),\n \t\tpic = $('<img>').addClass('responsive-img').attr('src', project.picture_url);\n titleRow.append(title);\n picRow.append(pic);\n \t\tnewProject.append(picRow).append(titleRow);\n \t\t$('#portfolio').append(newProject);\n \t}\n }", "function apiJsonToTable(json, tableName) {\n if (!json || json.length < 1) return;\n // Create the basic elements\n var table = $(\"<table class='collapsable'></table>\");\n var caption = $(\n \"<caption>\" + ucFirst(tableName.toString()) + \"</caption>\"\n ).on(\"click\", function () {\n table.toggleClass(\"collapsed\");\n });\n table.append(caption);\n var tableBody = table.append(\"<tbody></tbody>\");\n tableBody.append(\"<tr><td>\" + JSON.stringify(json, null, 2) + \"</td></tr>\");\n\n $(\"#apiPanelContent> div.info\").append(table);\n}", "function populateTable(array) {\n let body = document.getElementById('TableBody')[0];\n let rowItems = null;\n\n for (row = 0; row < array.length; row++) {\n rowItems +=\n \"<tr id=\" + array[row].Internalid + \"><td> \" + array[row].ProjectName + \"</td><td> \" + array[row].ProjectObjectives + \"</td><td> \" + array[row].ParticipatingCountries + \"</td><td> \" + array[row].Status + \"</td><td> \" + array[row].ProjectSponsors + \"</td><td> $ \" + array[row].CapitalCost + \"</td>\"\n }\n $(\"#TableBody\").html(rowItems);\n\n}", "function fillProjects() {\n //add header\n projects.innerHTML += '<h1>Projects</h1>';\n\n //parse json\n let json = JSON.parse(repositories);\n\n //loop through each project and add a section for each project\n for (let i = 0; i < json.length; i++) {\n let project = json[i];\n projects.innerHTML += '<section class=\"card\">'\n + '<a href=\"' + project.html_url + '\"><h1>'\n + project.name + '<span class=\"tooltip\">Commits: ' + project.commits + '</span>'\n + '</h1></a>'\n + '<p>' + project.description + '</p><p>Language: ' + project.language + '</p></section>';\n }\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates task on a database params: task task object to update updates only changes callback method called with list to return
updateTask(task, callback) { var response, params; var db = this.db; var tableName = this.tableName; //GetItem to make sure it's an update params = { TableName: tableName, Key: { taskId: task.taskId } }; db.getItem(params, function (err, data) { if (err) { callback(err, null); } else { if (!data.Item) { response = { statusCode: 404, body: JSON.stringify({ message: 'Task not found' }), }; callback(null, response); } else { //Item found, now update var newTask = mergeTasks(data.Item, task); var validateMsg = validateTask(newTask); if (validateMsg) { response = { statusCode: 405, body: validateMsg }; callback(null, response); return; } if (!newTask.completed) { delete newTask.completed; } var putParams = { Item: newTask, TableName: tableName }; db.putItem(putParams, function (err, data) { if (err) { callback(err, null); } else { response = { statusCode: 200, body: JSON.stringify({ message: data }), }; callback(null, response); } }); } } }); return; }
[ "function updateTask(task, callback) {\n database.serialize(function() {\n var expiry_time = getExpiryTime(task);\n var update_task = \"UPDATE \"+table_name+\" SET task = ?, \"\n +\"at = datetime(\"+expiry_time+\") WHERE \"+table_name+\".id = ?\";\n\n log.debug('sqlite-adapter','Running query:',update_task);\n database.run(update_task, JSON.stringify(task), task.id, function(error) {\n if (error) {\n callback(error);\n }\n callback(error, this.changes);\n });\n });\n }", "function updateTask(doc, res, updateParams) {\n if (updateParams.name) {\n doc.name = updateParams.name\n }\n if (updateParams.description) {\n doc.description = updateParams.description;\n }\n if (updateParams.deadline) {\n doc.deadline = updateParams.deadline;\n }\n if (typeof updateParams.completed !== 'undefined') {\n doc.completed = updateParams.completed;\n }\n if (updateParams.assignedUser || typeof updateParams.assignedUser !== 'undefined') {\n doc.assignedUser = updateParams.assignedUser;\n }\n if (updateParams.assignedUserName) {\n doc.assignedUserName = updateParams.assignedUserName;\n }\n \n saveAndRespond(doc, 'Task was updated.', res);\n}", "dbUpdateAll(callback) {\n this.post('/updateTasks', this.tasks, callback);\n }", "updateTask() {\n }", "onTaskWasUpdated (newTask) {\n // Edit the task in the database?\n TaskActions.editTask(newTask)\n }", "function updateTask(completedTaskId) {\n $.ajax({\n type: 'PUT',\n url: '/task',\n data: {completedTaskId: completedTaskId },\n success: function(response) {\n console.log(response);\n }\n });\n getTasks();\n}", "function updateTask(taskId, task) {\n return TaskModel.update({\n _id: taskId\n }, {\n name: task.name,\n description: task.description,\n dueDate: task.dueDate,\n completed: task.completed\n });\n }", "updateTasks (tasks) {\n this.tasks = tasks\n this.persist(this.tasks)\n }", "function taskUpdate(id, data) {\n API.updateTask(id, data)\n .then(res => compTaskData())\n .catch(err => console.log(err))\n }", "updateTask(taskId, updateRecord) {\n\n let task = this.findTask(taskId);\n\n if (task) {\n task.update(updateRecord);\n\n /* \n In case a persistence service is configured, also update the persited copy of this task\n */\n if (this.persistenceService) {\n this.persistenceService.updateTask(this.userHandle.id, task.serialized);\n }\n return task;\n } else {\n console.error(`TaskBucket.updateTask for task ${taskId} failed. Task not found`);\n return null;\n }\n }", "updateTask(empId, todo, done) {\n return this.http.put('/api/employees/' + empId + '/tasks', {\n todo,\n done\n });\n }", "function updateTask($scope, taskedited) {\n if (taskedited) {\n // creating deep copy so of taskedited so it can be changed without affecting anything\n if (typeof taskedited !== 'object') {\n $scope.editingTask.task = angular.copy(taskedited)\n $scope.editingTask.initEdit = false\n }\n // handle passed argument so we don't accidentally pass wrong keys\n taskedited = typeof taskedited === 'object' ? taskedited : $scope.editingTask\n putTask(taskedited)\n .then((response) => {\n console.log(response)\n }).catch(err => {\n console.log(\"something is wrong in putting tasks\")\n })\n }\n }", "addTask(task, callback) {\n var response;\n var newId = uuid.v1();\n task.taskId = newId;\n\n var validateMsg = validateTask(task);\n\n if (validateMsg) {\n response = {\n statusCode: 405,\n body: validateMsg\n };\n callback(null, response);\n return;\n }\n\n task = sanitizeTask(task);\n\n var params = {\n Item: task,\n TableName: this.tableName\n };\n console.log(JSON.stringify(task));\n this.db.putItem(params, function (err, data) {\n if (err) {\n callback(err, null);\n } else {\n response = {\n statusCode: 200,\n body: JSON.stringify({\n message: task\n }),\n };\n callback(null, response);\n }\n });\n }", "static update(id, task){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\tkparams.task = task;\n\t\treturn new kaltura.RequestBuilder('exporttask', 'update', kparams);\n\t}", "function updateTask(task, rawResponseCallback = null, refresh = false) {\n writeTask(task, \"PATCH\", rawResponseCallback, refresh);\n}", "updateTaskList() {\n if (this.taskList.selectedTask) {\n this.taskList.updateSelectedTaskSessionCount();\n this.taskList.updateStorage();\n }\n }", "function updateTask(success, error, communitySlug, taskId, updateData) {\n\tdebug('update task');\n\n\tvar taskDao = getTaskDao.call(this)\n\t\t, eventbus = this.app.get('eventbus')\n\t\t, self = this\n\t\t, taskIsFulfilled\n\t\t, updatedTaskIsFulfilled\n\n\t\t/* AnonymousFunction: forwardError\n\t\t * Forwards an error object using the error callback argument\n\t\t */\n\t\t, forwardError = function forwardError(err) {\n\t\t\tdebug('forward error');\n\t\t\treturn error(err);\n\t\t}\n\n\t\t/* AnonymousFunction: forwardError\n\t\t * After searching the task matching the one from the input parameter,\n\t\t * this function ensures that all necessary data is saved to the\n\t\t * database.\n\t\t */\n\t\t, afterTaskSearch = function afterTaskSearch(task) {\n\t\t\tdebug('after task search');\n\n\t\t\tif(!task) {\n\t\t\t\tforwardError(new errors.NotFoundError('Task with id ' + taskId +\n\t\t\t\t\t'does not exist.'));\n\t\t\t}\n\n\t\t\ttaskIsFulfilled = task.isFulfilled();\n\n\t\t\ttask.name = updateData.name || task.name;\n\t\t\ttask.description = updateData.description || task.description;\n\t\t\ttask.reward = updateData.reward || task.reward;\n\t\t\ttask.fulfilledAt = updateData.fulfilledAt || task.fulfilledAt;\n\t\t\ttask.dueDate = updateData.dueDate || task.dueDate;\n\t\t\ttask.updatedAt = new Date();\n\t\t\ttask.fulfillorId = updateData.fulfillorId || task.fulfillorId;\n\n\t\t\tupdatedTaskIsFulfilled = task.isFulfilled();\n\n\t\t\ttask.save()\n\t\t\t\t.success(afterTaskSave)\n\t\t\t\t.error(forwardError);\n\t\t}\n\n\t\t/* AnonymousFunction: afterTaskSave\n\t\t * Emits a \"task:updated\" event and calls the success callback argument.\n\t\t */\n\t\t, afterTaskSave = function afterTaskSave(task) {\n\t\t\tdebug('after task save');\n\n\t\t\tvar taskData = task.dataValues;\n\n\t\t\teventbus.emit('task:updated', taskData);\n\t\t\tif(!taskIsFulfilled && updatedTaskIsFulfilled) {\n\t\t\t\teventbus.emit('task:done', self.req.user, task);\n\t\t\t}\n\n\t\t\tsuccess(taskData);\n\t\t};\n\n\ttaskDao.find({ where: { id: taskId }})\n\t\t.success(afterTaskSearch)\n\t\t.error(forwardError);\n}", "function handleUpdateTask() {\n // grabs id from table row\n let id = $(this).parent().parent().data().id;\n // grabs selected status from status dropdown\n let status = $(this).parent().parent().find(\".selectStatus\").children(\"option:selected\").val();\n // grabs selected priority from priority dropdown\n let priority = $(this).parent().parent().find(\".selectPriority\").children(\"option:selected\").val();\n console.log(`status to update item ${id} to:`, status);\n console.log(`priority to update item ${id} to:`, priority);\n $.ajax({\n method: 'PUT',\n url: `tasks/${id}`,\n data: {\n status: status,\n priority: priority\n }\n }).then(function () {\n // updates table\n getTasks();\n }).catch(function (error) {\n console.log('There is an error in client-side PUT request', error)\n });\n}", "function updateTask(taskId, taskName, taskStatus) {\n var taskToUpdate = {\n id: taskId,\n task: taskName,\n status: taskStatus\n }\n $.ajax({\n type: 'PUT',\n url: 'tasks/' + taskId,\n data: taskToUpdate,\n complete: getTasks\n });\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Normalizes a time string to have the following format: hh:mm:ss
function normalizeTime(time) { var _time$split3 = time.split(regexSplitTime), _time$split4 = _slicedToArray(_time$split3, 3), hours = _time$split4[0], minutes = _time$split4[1], seconds = _time$split4[2]; return "".concat(hours.length === 1 ? "0".concat(hours) : hours, ":").concat(minutes, ":").concat(seconds || '00'); }
[ "function zenNormalizeTime(str)\n{\n\tvar out = '';\n\ttry {\n\t\tvar t = str.split(\":\");\n\n\t\tvar hour = parseInt(t[0],10);\n\t\tvar min = parseInt(t[1],10);\n\t\tvar sec = parseInt(t[2],10);\n\t\t// am/pm\n\t\tvar mod1 = str.substr(str.length-1,1);\n\t\tvar mod2 = str.substr(str.length-2,2);\n\n\t\tif (!isNaN(hour)) {\n\t\t\tif ((mod1=='a'||mod1=='A'||mod2=='am'||mod2=='AM')&&(hour==12)) {\n\t\t\t\thour = 0;\n\t\t\t}\n\t\t\telse if ((mod1=='p'||mod1=='P'||mod2=='pm'||mod2=='PM')&&(hour<12)) {\n\t\t\t\thour += 12;\n\t\t\t}\n\t\t\thour = hour < 0 ? 0 : hour;\n\t\t\thour = hour > 23 ? 0 : hour;\n\t\t\tout = ((hour < 10) ? '0' : '') + hour;\n\n\t\t\tif (!isNaN(min)) {\n\t\t\t\tmin = min < 0 ? 0 : min;\n\t\t\t\tmin = min > 59 ? 0 : min;\n\t\t\t\tout += ((min < 10) ? ':0' : ':') + min;\n\t\t\t\tif (!isNaN(sec)) {\n\t\t\t\t\tsec = sec < 0 ? 0 : sec;\n\t\t\t\t\tsec = sec > 59 ? 0 : sec;\n\t\t\t\t\tout += ((sec < 10) ? ':0' : ':') + sec;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tout += \":00\";\n\t\t\t}\n\t\t}\n\t}\n\tcatch(ex) {\n\t}\n\n\treturn out;\n}", "function adjustTimeFormat(str) {\n\tvar strArray = str.split(\":\");\n\tvar ret = str;\n\n\tif (strArray[0].length == 1) {\n\t\tret = \"0\" + str;\n\t}\n\n\treturn ret;\n}", "function timeCorrect(timestring) {\n if (!timestring?.length || !timestring.match(/\\d{2}:\\d{2}:\\d{2}/))\n return null;\n // get hours mins and secs;\n let times = timestring.match(/(\\d{2}):(\\d{2}):(\\d{2})/);\n let hr = +times[1];\n let min = +times[2];\n let sec = +times[3];\n\n if (sec >= 60) {\n sec = sec % 60;\n min += 1;\n }\n\n if (min >= 60) {\n min = min % 60;\n hr += 1;\n }\n\n if (hr >= 24) {\n hr = hr % 24;\n }\n\n if (sec < 10) sec = `0${sec}`;\n if (min < 10) min = `0${min}`;\n if (hr < 10) hr = `0${hr}`;\n\n return `${hr}:${min}:${sec}`;\n}", "function cleanTime(time) {\n var shortTime = time.substr(11,5);\n var mins = shortTime.substr(2,5);\n var hour = parseFloat(shortTime.slice(0,2));\n var ampm = 'AM';\n // Assume that 12 means noon, not midnight.\n if (hour == 12) {\n ampm = 'PM';\n }\n else if (hour >= 12) {\n hour -= 12;\n ampm = 'PM';\n }\n return hour + \"\" + mins + \"\" + ampm;\n}", "function militaryTime(timeStr) {\n //check for AM or PM\n //if PM +12 to hrs\n //else if single digit\n //add 0 to hours\n //remove the colon from string\n //remove AM/PM\n //return new time\n \n}", "convertTime(time) {\n let length = time;\n let sec = length % 60;\n let min = Math.floor(length / 60);\n\n return (\n min.toString().padStart(2, \"0\") + \":\" + sec.toString().padStart(2, \"0\")\n );\n }", "function shortTimeString(timeString) {\n var time = timeString.split(\":\");\n var minutes = parseInt(time[0]);\n var seconds = parseInt(time[1]);\n return minutes > 0 ? minutes.toString() + \"m\" : seconds.toString();\n}", "convertTime(time) {\n if (this.state.clock12h) {\n const h23 = parseInt(time.substr(0,2));\n const h12 = h23 % 12 || 12;\n const ampm = h23 < 12 ? \" am\" : \" pm\"\n return h12 + time.substr(2, 3) + ampm;\n } else {\n return time;\n }\n }", "function stringToHrtime(s) {\n assert.string(s, 's');\n var hrtime = s.split('.').map(function (section) {\n return parseInt(section, 10);\n });\n assertHrtime(hrtime, 'hrtime');\n return hrtime;\n}", "function stringToTime(s) {\n var s1 = s.split(\":\");\n var s2 = s1[1].split(\" \");\n var t = {\n hours: s1[0],\n mins: s2[0],\n isAM: s2[1].toUpperCase() == \"AM\"\n };\n return t;\n }", "function convert_time (str_time) {\n\ttime = str_time.split('T')[1];\n\treturn time;\n}", "function transformTime(value) {\n if (!value) {\n return '0';\n }\n var hours = Math.floor(value / 60 / 60);\n var minutes = Math.floor((value - hours * 60 * 60) / 60);\n var seconds = value - (hours * 60 * 60) - (minutes * 60);\n return hours.toString().padStart(2, '0') + 'h ' +\n minutes.toString().padStart(2, '0') + 'm ' +\n seconds.toString().padStart(2, '0') + 's';\n}", "function convertTime(time) {\n var min = Math.floor(time % 60);\n if (min < 10) {\n min = \"0\" + min;\n }\n\n var hr = Math.floor(time / 60);\n if (hr < 10) {\n hr = \"0\" + hr;\n }\n\n var time = hr + \":\" + min + \":00\";\n return time;\n }", "function convertTime(time) {\n var min = Math.floor(time % 60);\n if (min < 10) {\n min = \"0\" + min;\n }\n\n var hr = Math.floor(time / 60);\n if (hr < 10) {\n hr = \"0\" + hr;\n }\n\n var time = hr + \":\" + min + \":00\";\n return time;\n }", "set normalizedTime(value) {}", "function converTime(t){\n t = Number(t); //cast to number\n if (t > 0 && t < 12){\n return t + ':00 am'\n } else if(t === 0) {\n return \"12:00 am\"\n } else if(t === 12) {\n return '12:00 pm'\n } else if(t > 12){\n return (t-12) + ':00 pm'\n }\n }", "function timeConversion(time) {\n let minutes = Math.floor(time / 60);\n if (minutes < 10) minutes = \"0\" + minutes;\n let seconds = time % 60;\n if (seconds < 10) seconds = \"0\" + seconds;\n return minutes + \":\" + seconds;\n}", "function timeConverter(t) {\n\n // Takes the current time in seconds and convert it to minutes and seconds (mm:ss).\n var minutes = Math.floor(t / 60);\n var seconds = t - (minutes * 60);\n\n if (seconds < 10) {\n seconds = \"0\" + seconds;\n }\n\n if (minutes === 0) {\n minutes = \"00\";\n }\n\n else if (minutes < 10) {\n minutes = \"0\" + minutes;\n }\n\n return minutes + \":\" + seconds;\n }", "function fixTimeFormat(time) {\n var setTime = time;\n if (setTime.length == 1) {\n setTime = \"0\" + setTime + \":00\";\n }\n while (setTime.length < 5) {\n if (setTime.length == 2) {\n setTime += \":\";\n }\n setTime += \"0\";\n }\n return setTime;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[1] LocationPath::= RelativeLocationPath | AbsoluteLocationPath e.g. a, a/b, //a/b
function locationPath(stream, a) { return absoluteLocationPath(stream, a) || relativeLocationPath(null, stream, a); }
[ "function locationPath(stream,a){return absoluteLocationPath(stream,a)||relativeLocationPath(null,stream,a);}", "function locationPath(stream, a) {\n\t return absoluteLocationPath(stream, a) ||\n\t relativeLocationPath(null, stream, a);\n\t }", "function relativeLocationPath(lhs,stream,a,isOnlyRootOk){if(null==lhs){lhs=step(stream,a);if(null==lhs)return lhs;}var op;while(op=stream.trypop(['/','//'])){if('//'===op){lhs=a.node('/',lhs,a.node('Axis','descendant-or-self','node',undefined));}var rhs=step(stream,a);if(null==rhs&&'/'===op&&isOnlyRootOk)return lhs;else isOnlyRootOk=false;if(null==rhs)throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,'Position '+stream.position()+': Expected step after '+op);lhs=a.node('/',lhs,rhs);}return lhs;}", "function absoluteLocationPath(stream,a){var op=stream.peek();if('/'===op||'//'===op){var lhs=a.node('Root');return relativeLocationPath(lhs,stream,a,true);}else{return null;}}", "get _location() {\n if (this._file)\n return this._file.path;\n\n if (this._uri)\n return this._uri.spec;\n\n return \"\";\n }", "function absoluteLocationPath(stream, a) {\n\t var op = stream.peek();\n\t if ('/' === op || '//' === op) {\n\t var lhs = a.node('Root');\n\t return relativeLocationPath(lhs, stream, a, true);\n\t } else {\n\t return null;\n\t }\n\t }", "function absoluteLocationPath(stream, a) {\n var op = stream.peek();\n if (\"/\" === op || \"//\" === op) {\n var lhs = a.node(\"Root\");\n return relativeLocationPath(lhs, stream, a, true);\n } else {\n return null;\n }\n }", "function relativeLocationPath(lhs, stream, a, isOnlyRootOk) {\n if (null == lhs) {\n lhs = step(stream, a);\n if (null == lhs) return lhs;\n }\n var op;\n while (op = stream.trypop([ \"/\", \"//\" ])) {\n if (\"//\" === op) {\n lhs = a.node(\"/\", lhs, a.node(\"Axis\", \"descendant-or-self\", \"node\", undefined));\n }\n var rhs = step(stream, a);\n if (null == rhs && \"/\" === op && isOnlyRootOk) return lhs; else isOnlyRootOk = false;\n if (null == rhs) throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, \"Position \" + stream.position() + \": Expected step after \" + op);\n lhs = a.node(\"/\", lhs, rhs);\n }\n return lhs;\n }", "function absoluteLocationPath(stream, a) {\n var op = stream.peek();\n if ('/' === op || '//' === op) {\n var lhs = a.node('Root');\n return relativeLocationPath(lhs, stream, a, true);\n } else {\n return null;\n }\n }", "static get __resourceType() {\n\t\treturn 'Location';\n\t}", "isLocation(value) {\n return Path.isPath(value) || Point.isPoint(value) || Range.isRange(value);\n }", "function relativeLocationPath(lhs, stream, a, isOnlyRootOk) {\n if (null == lhs) {\n lhs = step(stream, a);\n if (null == lhs) return lhs;\n }\n var op;\n while (op = stream.trypop(['/', '//'])) {\n if ('//' === op) {\n lhs = a.node('/', lhs,\n a.node('Axis', 'descendant-or-self', 'node', undefined));\n }\n var rhs = step(stream, a);\n if (null == rhs && '/' === op && isOnlyRootOk) return lhs;\n else isOnlyRootOk = false;\n if (null == rhs)\n throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,\n 'Position ' + stream.position() +\n ': Expected step after ' + op);\n lhs = a.node('/', lhs, rhs);\n }\n return lhs;\n }", "function relativeLocationPath(lhs, stream, a, isOnlyRootOk) {\n\t if (null == lhs) {\n\t lhs = step(stream, a);\n\t if (null == lhs) return lhs;\n\t }\n\t var op;\n\t while (op = stream.trypop(['/', '//'])) {\n\t if ('//' === op) {\n\t lhs = a.node('/', lhs,\n\t a.node('Axis', 'descendant-or-self', 'node', undefined));\n\t }\n\t var rhs = step(stream, a);\n\t if (null == rhs && '/' === op && isOnlyRootOk) return lhs;\n\t else isOnlyRootOk = false;\n\t if (null == rhs)\n\t throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,\n\t 'Position ' + stream.position() +\n\t ': Expected step after ' + op);\n\t lhs = a.node('/', lhs, rhs);\n\t }\n\t return lhs;\n\t }", "function locationPathId(location) {\n return 'location-' + utils.urn2uuid(location.id);\n }", "static getRegionUrlPathByLocation(location) {\n const regionPath = location && this.getRegionPath(this.getRegionByLocation(location));\n return `/aloes-from-${regionPath}/`;\n }", "function SPResourcePath(value) {\r\n if (value === void 0) { value = ''; }\r\n var rootDelimeter = '//';\r\n var indexOfRootDelimeter = value.indexOf(rootDelimeter);\r\n var indexOfPathDelimeter = value.indexOf('/');\r\n // The root delimeter is the first instance of '//', unless preceded by a lone '/'\r\n var endIndexOfRootDelimeter = indexOfRootDelimeter > -1 && indexOfRootDelimeter <= indexOfPathDelimeter ?\r\n indexOfRootDelimeter + rootDelimeter.length :\r\n -1;\r\n var authority = getAuthority(value, endIndexOfRootDelimeter);\r\n var domain = authority && authority.slice(endIndexOfRootDelimeter);\r\n // By definition, everything after the authority is the path\r\n var path = value.slice(authority.length);\r\n var format = authority ?\r\n SPResourcePathFormat.absolute :\r\n path[0] === '/' ?\r\n SPResourcePathFormat.serverRelative :\r\n SPResourcePathFormat.relative;\r\n var segments = path.split('/');\r\n this.authority = authority;\r\n this.domain = domain;\r\n this.format = format;\r\n this.path = path;\r\n this.segments = segments;\r\n this.value = value;\r\n }", "function SPResourcePath(value) {\n if (value === void 0) { value = ''; }\n var rootDelimeter = '//';\n var indexOfRootDelimeter = value.indexOf(rootDelimeter);\n var indexOfPathDelimeter = value.indexOf('/');\n // The root delimeter is the first instance of '//', unless preceded by a lone '/'\n var endIndexOfRootDelimeter = indexOfRootDelimeter > -1 && indexOfRootDelimeter <= indexOfPathDelimeter ?\n indexOfRootDelimeter + rootDelimeter.length :\n -1;\n var authority = getAuthority(value, endIndexOfRootDelimeter);\n var domain = authority && authority.slice(endIndexOfRootDelimeter);\n // By definition, everything after the authority is the path\n var path = value.slice(authority.length);\n var format = authority ?\n SPResourcePathFormat.absolute :\n path[0] === '/' ?\n SPResourcePathFormat.serverRelative :\n SPResourcePathFormat.relative;\n var segments = path.split('/');\n this.authority = authority;\n this.domain = domain;\n this.format = format;\n this.path = path;\n this.segments = segments;\n this.value = value;\n }", "function SPResourcePath(value) {\n if (value === void 0) { value = ''; }\n var rootDelimeter = '//';\n var indexOfRootDelimeter = value.indexOf(rootDelimeter);\n var indexOfPathDelimeter = value.indexOf('/');\n // The root delimeter is the first instance of '//', unless preceded by a lone '/'\n var endIndexOfRootDelimeter = indexOfRootDelimeter > -1 && indexOfRootDelimeter <= indexOfPathDelimeter\n ? indexOfRootDelimeter + rootDelimeter.length\n : -1;\n var authority = getAuthority(value, endIndexOfRootDelimeter);\n var domain = authority && authority.slice(endIndexOfRootDelimeter);\n // By definition, everything after the authority is the path\n var path = value.slice(authority.length);\n var format = authority\n ? SPResourcePathFormat.absolute\n : path[0] === '/'\n ? SPResourcePathFormat.serverRelative\n : SPResourcePathFormat.relative;\n var segments = path.split('/');\n this.authority = authority;\n this.domain = domain;\n this.format = format;\n this.path = path;\n this.segments = segments;\n this.value = value;\n }", "function SPResourcePath(value) {\r\n if (value === void 0) { value = ''; }\r\n var rootDelimeter = '//';\r\n var indexOfRootDelimeter = value.indexOf(rootDelimeter);\r\n var indexOfPathDelimeter = value.indexOf('/');\r\n // The root delimeter is the first instance of '//', unless preceded by a lone '/'\r\n var endIndexOfRootDelimeter = indexOfRootDelimeter > -1 && indexOfRootDelimeter <= indexOfPathDelimeter ?\r\n indexOfRootDelimeter + rootDelimeter.length :\r\n -1;\r\n var authority = getAuthority(value, endIndexOfRootDelimeter);\r\n var domain = authority && authority.slice(endIndexOfRootDelimeter);\r\n // By definition, everything after the authority is the path\r\n var path = value.slice(authority.length);\r\n var format = authority ?\r\n 0 /* absolute */ :\r\n path[0] === '/' ?\r\n 2 /* serverRelative */ :\r\n 1 /* relative */;\r\n var segments = path.split('/');\r\n this.authority = authority;\r\n this.domain = domain;\r\n this.format = format;\r\n this.path = path;\r\n this.segments = segments;\r\n this.value = value;\r\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SERVICE_TIME functions / Expects: void Returns: Service time from local storage ordered by the patient
function getServiceTime () { var serviceTime = new Date(); serviceTime.setTime(parseInt(localStorage.getItem("serviceTime"))); return serviceTime; }
[ "function serviceGetMeasureTime(req, resp) {\n\t\tlogger.info(\"<Service> GetMeasureTime.\");\n\t\tvar getData = parseRequest(req, ['id']);\n\t\t\n\t\twriteHeaders(resp);\n\t\tgetMeasureTime(getData.id, function(err, time) {\n\t\t\tif (err) { error(2, resp, err); return; }\n\t\t\tresp.end(JSON.stringify({ time: time })); \n\t\t});\n\t}", "ETServiceTime() {\n var st = [];\n for (i = 0; i < this.operatorSettings.teams.length; i++) {\n\t\t\t\tvar speed = this.operatorSettings.teams[i].AIDA.ETServiceTimeQ;\n if (speed === 'F') {\t\t\t// faster\n st.push(1.0 / this.operatorSettings.teams[i].AIDA.ETServiceTime);\n } else if (speed === 'S') { // slower\n st.push(1.0 * this.operatorSettings.teams[i].AIDA.ETServiceTime);\n\t\t\t\t} else\n\t\t\t\t\tst.push(1.0);\n }\n return st;\n }", "function checkAmbulanceServiceTime() {\r\n var deadLine = trasanoOptions.deadLine;\r\n\r\n if (localStorage.getItem(\"serviceTime\") != null && localStorage.getItem(\"serviceTime\") != \"\") {\r\n var serviceTime = new Date();\r\n var currentTime = new Date();\r\n\r\n serviceTime.setTime(parseInt(localStorage.getItem(\"serviceTime\")) + parseInt(deadLine));\r\n if (currentTime > serviceTime) {\r\n console.log(\"trasano.checkAmbulanceServiceTime.localStorage => Inizialiced\");\r\n localStorage.removeItem(\"ambulance\");\r\n localStorage.removeItem(\"tagcode\");\r\n localStorage.removeItem(\"serviceTime\");\r\n localStorage.removeItem(\"lastClaim\");\r\n }\r\n } \r\n}", "_timeSystemChange() {\n let timeSystem = this.openmct.time.timeSystem();\n let timeKey = timeSystem.key;\n let metadataValue = this.metadata.value(timeKey);\n let timeFormatter = this.openmct.telemetry.getValueFormatter(metadataValue);\n this.parseTime = (datum) => {\n return timeFormatter.parse(datum);\n };\n\n this.formatTime = (datum) => {\n return timeFormatter.format(datum);\n };\n }", "getFlightTime() {\r\n if (this.takeoffTime == 0) return '0';\r\n let millisFlightTime = Date.now() - this.takeoffTime;\r\n return millisToSeconds(millisFlightTime);\r\n }", "function getEndTime(service, startTime){\n\n\tvar endTime = '';\n\n\tif(service === 'Haircut'){\n\t\tendTime = addMilitaryTime(30, startTime);\n\t}\n\telse if(service === 'Beard Trim'){\n\t\tendTime = addMilitaryTime(15, startTime);\n\t}\n\telse if(service === 'Shave'){\n\t\tendTime = addMilitaryTime(30, startTime);\n\t}\n\telse if(service === 'Color'){\n\t\tendTime = addMilitaryTime(30, startTime);\n\t}\n\telse if(service === 'Eyebrow Wax'){\n\t\tendTime = addMilitaryTime(15, startTime);\n\t}\n\n\treturn endTime;\n}", "function TotalTimeRecord() {\n}", "function startTime() {\n //grabs the computer time and then it is split into different variables\n var today=new Date();\n var h=today.getHours();\n var m=today.getMinutes();\n var s=today.getSeconds();\n //to add any necessary zero's\n m = checkTime(m);\n s = checkTime(s);\n h = checkTime(h);\n //set the format of the time in HMS mode\n localStorage.setItem(\"time\", h+\":\"+m+\":\"+s);\n \n //function repeator \n \n var t = setTimeout(function()\n {\n startTime();\n \n },500);\n }", "function _getLocalTime() {\n var date = new Date();\n var h = (date.getHours() > 12 ? date.getHours() - 12 : date.getHours());\n var m = (date.getMinutes() < 10 ? \"0\"+ date.getMinutes() : date.getMinutes());\n var timeDelim = (date.getHours() > 12 ? \"pm\" : \"am\");\n var timeStr = \"The time according to this machine is \" + h + \":\" + m +\" \" + timeDelim + \" \";\n\n return {\"code\":1, \"response\": timeStr};\n }", "getTime() {\n return new Promise((resolve, reject) => {\n this.doRequest('public', 'Time').then((response) => {\n resolve(response);\n }).catch(error => reject(error));\n });\n }", "function getTime(){\n \n hr = hour();\n mn = minute();\n sc = second();\n}", "function getTimeEntries() {\n time.getTime($routeParams.id, vm.user._id, vm.user.job).then(function (results) {\n vm.timeentries = results;\n updateTotalTime(vm.timeentries);\n console.log(vm.timeentries);\n }, function (error) {\n console.log(error);\n });\n }", "function get_time() {\n return Date.now();\n}", "function getTimeEntries() {\n time.getTime().then(function(results) {\n vm.timeentries = results;\n updateTotalTime(vm.timeentries);\n console.log(vm.timeentries);\n }, function(error) {\n console.log(error);\n });\n }", "function getStoredTime() {\n chrome.storage.sync.get([\"timeStart\", \"timeEnd\"], function(items){\n if (items) {\n if (items.timeStart && items.timeEnd) {\n if (items.timeStart !== \"\" && items.timeEnd !== \"\") {\n var timeRange = {\n start: items.timeStart,\n end: items.timeEnd\n };\n // console.log(timeRange);\n if (checkTimeRange(timeRange) === true) {\n checkCalls = true;\n } else {\n checkCalls = false;\n }\n }\n }\n }\n });\n}", "function getTimeEntries() {\n time.getTime().then(function (results) {\n vm.timeentries = results;\n updateTotalTime(vm.timeentries);\n console.log(vm.timeentries);\n }, function (error) {\n console.log(error);\n });\n }", "static getTotalTime() {\r\n let totalTimer = 0;\r\n const profiles = Store.getProfiles();\r\n if (localStorage.getItem('profiles') !== null) {\r\n profiles.forEach((profile) => {\r\n totalTimer += profile.monthTime;\r\n });\r\n }\r\n return totalTimer;\r\n }", "function getClaimTime () {\r\n var claimTime = new Date();\r\n claimTime.setTime(parseInt(localStorage.getItem(\"lastClaim\")));\r\n return claimTime; \r\n}", "function getTimeStart() {\n\treturn parseFloat(getSetting().getAttribute(\"TimeStart\"));\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
================================================================================ / Update the UI with current minimum bounty when called
async function updateBounty(){ const bounty = await Riddle.methods.bounty().call(); updateBountyUI(bounty); }
[ "updateBattler() {\n if (this.battlerFrame.update()) {\n Manager.Stack.requestPaintHUD = true;\n }\n }", "function update() {\n healthBar.value = health;\n choosePick();\n lowhealth();\n}", "_updateProgressBar() {\n this._progressBarContainer.progressBar.updateProgress(this._currentXp, this._config.maxXp);\n }", "function updateUI() {\r\n\tupdateStats();\r\n}", "function displayBar() {\n let status;\n if (bmi >= 18.5 && bmi <= 25) {\n status = \"normal\";\n } else if (bmi < 18.5) {\n status = \"underweight\";\n } else {\n status = \"overweight\";\n }\n messageBox = document.getElementById(\"messageBox\");\n\n for (let i = 0; i < (bmi > 100 ? 44 : bmi); i++) {\n btnCalculate.style.setProperty(\"--width\", i);\n messageBox.style.setProperty(\"--position\", i);\n }\n btnCalculate.style.setProperty(\"--background-color\", BarColors[status]);\n messageBox.textContent = status;\n messageBox.classList.add(\"messageBox-show\");\n}", "function updateBoostsScreen() {\r\n $('#pointsOutput').text(points);\r\n $('#quackLevelOutput').text(quackLevel);\r\n $('#speedLevelOutput').text(speedLevel);\r\n $('#invisibilityLevelOutput').text(invisibilityLevel);\r\n $('#quackCostOutput').text(quackCost);\r\n $('#speedCostOutput').text(speedCost);\r\n $('#invisibilityCostOutput').text(invisibilityCost);\r\n if (points < invisibilityCost || invisibilityLevel >= maxSkillLevel)\r\n {\r\n $('#upgradeInvisibilityButton').attr(\"disabled\",\"disabled\");\r\n }\r\n else\r\n {\r\n $('#upgradeInvisibilityButton').removeAttr(\"disabled\");\r\n }\r\n \r\n if (points < speedCost || speedLevel >= maxSkillLevel)\r\n {\r\n $('#upgradeSpeedButton').attr(\"disabled\",\"disabled\");\r\n }\r\n else\r\n {\r\n $('#upgradeSpeedButton').removeAttr(\"disabled\");\r\n }\r\n \r\n if (points < quackCost || quackLevel >= maxSkillLevel)\r\n {\r\n $('#upgradeQuackButton').attr(\"disabled\",\"disabled\");\r\n }\r\n else\r\n {\r\n $('#upgradeQuackButton').removeAttr(\"disabled\");\r\n }\r\n }", "updateFuel() {\n $('.bar span').html(this.fuel);\n $('.bar .inner').width((this.fuel * 100 / MAX_FUEL) + '%');\n }", "function updateBonusBar()\n {\n saleBarFill.clear(); // Clear it so we can redraw\n saleBarFill.beginFill(0x008214);\n saleBarFill.lineStyle(1, 0x008214, 1);\n saleBarFill.drawRect(1, (game.world.height-1)-(game.world.height*(bonusAmount/bonusMax)), game.world.width*0.03-2, (game.world.height*(bonusAmount/bonusMax)));\n }", "update(){\n\t\tif(this.tick){\n\t\t\tthis.depleteBar(.00005);\n\t\t}\n\t}", "function doBonusLevel() {\n\n mainParentLibrray.basket1.visible = true;\n mainParentLibrray.basket2.visible = true;\n mainParentLibrray.basket3.visible = true;\n mainParentLibrray.basket.visible = false;\n mainParentLibrray.bonusPoints.visible = true;\n mainParentLibrray.basket1.highlight.visible = false;\n mainParentLibrray.basket2.highlight.visible = false;\n mainParentLibrray.basket3.highlight.visible = false;\n mainParentLibrray.before_bonus_prompt.visible = true;\n\n }", "update() {\n\n //Change the width of the blue `frontBar` to match the\n //ratio of assets that have loaded.\n let ratio = hexi.loadingProgress / 100;\n //console.log(`ratio: ${ratio}`);\n this.frontBar.width = this.maxWidth * ratio;\n\n //Display the percentage\n this.percentage.content = `${Math.round(hexi.loadingProgress)} %`;\n }", "updateHealthUI() {\n this.healthUI.innerHTML = \"❤️: \" + app.game.robot.health;\n }", "_updateScoreBox() {\n\t\tthis.scoreBox.changeText('SCORE: ' + this.score + '\\nHIGH: ' + this.high);\n\t}", "update() {\n this.updateHealthBar();\n this.pauseMusic();\n this.checkWinCondition();\n \n }", "updateLoadingBar() {\n if (this.loadingRemains !== G.resource.remains) {\n this.loadingBar.text = `${G.resource.remains} resource(s) to load...\\nReceived file '${G.resource.currentLoad}'.`;\n }\n }", "function UpdateStatusBar ( currentValue : float, maxValue : float )\n\t{\n\t\t// If the status bar is left unassigned, then return.\n\t\tif( statusBar == null )\n\t\t\treturn;\n\n\t\t// Fix the value to be a percentage.\n\t\tvar fillAmount : float = currentValue / maxValue;\n\n\t\t// If the value is greater than 1 or less than 0, then fix the values to being min/max.\n\t\tif( fillAmount < 0 || fillAmount > 1 )\n\t\t{\n\t\t\tfillAmount = fillAmount <= 0 ? 0 : 1;\n\t\t}\n\n\t\t// Apply the fill amount to the image.\n\t\tstatusBar.fillAmount = fillAmount;\n\n\t\t// If the user is wanting to show the value as text and the text variable is assigned...\n\t\tif( showText == true && statusBarText != null )\n\t\t{\n\t\t\t// If the user does not want to show percentage, then show the current value next to the max value.\n\t\t\tif( usePercentage == false )\n\t\t\t\tstatusBarText.text = additionalText + currentValue.ToString() + \" / \" + maxValue.ToString();\n\t\t\t// Else transfer the values into a percentage and display it.\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar valuePercentage : float = ( fillAmount ) * 100;\n\t\t\t\tstatusBarText.text = additionalText + valuePercentage.ToString( \"F0\" ) + \"%\";\n\t\t\t}\n\t\t}\n\n\t\t// If this script has a controller parent, then request to show the status bar.\n\t\tif( myController != null )\n\t\t\tmyController.RequestShowStatusBar();\n\t\t\t\n\t\t// If the user is wanting to display an alternate state according to percentage...\n\t\tif( alternateState == true )\n\t\t{\n\t\t\tif( stateTrigger != StateTrigger.ColorBlended && flashing == true && Application.isPlaying == true )\n\t\t\t{\n\t\t\t\tif( fillAmount <= triggerValue && currentState == false )\n\t\t\t\t{\n\t\t\t\t\tcurrentState = true;\n\t\t\t\t\tStartCoroutine( \"AlternateStateFlashing\" );\n\t\t\t\t}\n\t\t\t\telse if( fillAmount >= triggerValue && currentState == true )\n\t\t\t\t{\n\t\t\t\t\tcurrentState = false;\n\t\t\t\t\tStopCoroutine( \"AlternateStateFlashing\" );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif( stateTrigger == StateTrigger.Percentage )\n\t\t\t{\n\t\t\t\t// Then configure what state it is in, and call the AlternateState() function with the correct parameter.\n\t\t\t\tif( fillAmount <= triggerValue )\n\t\t\t\t\tAlternateState( true );\n\t\t\t\telse\n\t\t\t\t\tAlternateState( false );\n\t\t\t}\n\t\t\telse if( stateTrigger == StateTrigger.ColorBlended )\n\t\t\t{\n\t\t\t\tAlternateStateColorBlend( fillAmount );\n\t\t\t}\n\t\t}\n\t}", "updateProgressBar() {\n let revealRange = 103 - 24; //See css comment (progressBox). \n let revealPercent = this.points / this.pointsNeeded; //Current percent of points needed.\n this.baseProgressMargin = -24; //Margin value: Progress box hides bar.\n this.progressMargin = this.baseProgressMargin - revealPercent * revealRange; //New margin value\n document.getElementById(\"progress\").style.marginTop = this.progressMargin + \"vh\"; //Reveal percent of glowing border as level progress indicator.\n }", "function updateProgressBar(win) {\r win.center();\r win.show();\r win.progress.value++;\r //update the window\r win.layout.layout(true);\r}", "function updateBMMainUI ()\n\t{\n\t\taddDebug(0, \"Entered updateBMMainUI<br>\");\n\t\tdeleteMain(); // empty out UI container\n\t\tfor(var i = 0; i < mainBMptr.length; i++)\n\t\t{\n\t\t\t$(' <div id=\"main_'+i+'\" data-which=\"'+i+'\" title=\"'+allBMs[mainBMptr[i]][0]+' - '+allBMs[mainBMptr[i]][1]+'\" >'+allBMs[mainBMptr[i]][0]+'</div> ')\n\t\t\t.attr('style', 'font-family: '+fontFamily+' !important; font-size: '+fontSize+' !important; font-weight: normal !important; font-style: norma !important;')\n\t\t\t.css({\n\t\t\t\t'overflow':'hidden',\n\t\t\t\t'background-color':recentBMColor,\n\t\t\t\t'color':fontColor,\n\t\t\t\t'cursor':'pointer',\n\t\t\t\t'font-family':toolbarFontFamily,//'\"Lato\", \"Helvetica Neue\", Helvetica, Arial, sans-serif', // toolbarFontFamily='\"Lato\", \"Helvetica Neue\", Helvetica, Arial, sans-serif';\n\t\t\t\t'padding-left':'4px',\n\t\t\t\t'padding-right':'4px',\n\t\t\t\t'margin':'5px',\n\t\t\t\t'-moz-border-radius':'10px 10px 10px 10px', // rounds corners for firefox\n\t\t\t\t'border-radius':'10px 10px 10px 10px', //rounds corners for other browsers\n\t\t\t\t'border':'solid 1px #000',\n\t\t\t\t'height':toolbarHeight,//toolbarWithBorder, // minus the border\n\t\t\t\t'line-height':toolbarHeight,//toolbarWithBorder, // minus the border\n\t\t\t\t'v-align':'middle',\n\t\t\t\t'-webkit-box-sizing': 'border-box', /* Safari/Chrome, other WebKit */\n\t\t\t\t'-moz-box-sizing': 'border-box', /* Firefox, other Gecko */\n\t\t\t\t'box-sizing': 'border-box' /* Opera/IE 8+ */\n\t\t\t})\n\t\t\t.appendTo('#bookmarksMain').on(\"click\", function(){ \n\t\t\t\taddDebug(0, \"Clicked a main bookmark.<br>\");\n\t\t\t\tclickedMain($(this));\n\t\t\t});\t\n\t\t}\n\t\taddDebug(0, \"Exiting updateBMMainUI<br>\");\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate the html Element containing the link to the wikipedia article
generateLink() { return ` <a href='https://en.wikipedia.org/wiki/${encodeURI(this.options[0])}' property='rdf:seeAlso'> ${this.options[0]} </a>&nbsp; `; }
[ "function getWiki( where ) {\n\t\tvar $v = $( '<a></a>', {\n\t\t\t\"class\": \"tbdocslink\",\n\t\t\t\"alt\": \"Link to documentation for topic\",\n\t\t\t\"title\": \"Link to documentation for topic\",\n\t\t\t\"target\": \"_blank\",\n\t\t\t\"href\": _DOCURL + String(where || \"\")\n\t\t} );\n\t\t$v.append( '<i class=\"material-icons\">help_outline</i>' );\n\t\treturn $v;\n\t}", "function buildWebPage(result){\n document.getElementById('article').innerHTML = result.description;\n document.getElementById('article-title').innerHTML = result.title;\n}", "function addWikiLink() {\n // extract from feed URL button\n const tagName = document.querySelector('.tag-popup .float-right a').href.match('/feeds/tag/(.*)')[1];\n const wikiUrl = `//${sox.site.url}/tags/${tagName}/info`;\n const spanToAppend = document.createElement('span');\n spanToAppend.className = 'sox-tag-popup-wiki-link';\n spanToAppend.innerHTML = `<a href=\"${wikiUrl}\">wiki</a>`;\n spanToAppend.title = 'view tag wiki (added by SOX)';\n\n document.querySelectorAll('.tag-popup .mr8')[1].insertAdjacentElement('afterend', spanToAppend);\n }", "function getWikipediaUrl(pageId) {\n return 'http://en.wikipedia.org/wiki?curid=' + pageId;\n}", "function wikipedia (){\r\n window.open(wiki_link, \"_blank\")\r\n}", "createWikiLink(scientific_name) {\n // console.log(scientific_name);\n let add_on = scientific_name.replace(\" \",\"_\");\n let link = \"https://en.wikipedia.org/wiki/\" + add_on;\n console.log(\"Wiki: \"+link);\n this.setState({wiki_link: link});\n }", "function wikiurl(topic, classalias, name) {\n\tif (JSDOC.opt.D.wikitext && JSDOC.opt.D.wikiurl) {\n\t\ttopic = (topic) ? topic + ':' : '';\n\t\tvar icon = (JSDOC.opt.D.wikiicon) ? '<img src=\"' + JSDOC.opt.D.wikiicon + '\"/>' : '';\n\t\treturn '<div class=\"wikilink\"><a href=\"' + JSDOC.opt.D.wikiurl + '_' + topic + classalias + '.' + name + '\" target=\"_blank\">' + icon + JSDOC.opt.D.wikitext + '</a></div>';\n\t}\n\treturn '';\n}", "function setWikiPageUrl() {\n wiki_url = 'https://en.m.wikipedia.org/w/api.php?';\n wiki_url += pageRequestOptions;\n wiki_url += '&page='+wikiEncode(wikiTarget);\n wiki_url += document.getElementById('checkIntroOnly').checked ? '&section=0' : '';\n console.log('url set to:' + wiki_url)\n}", "function createTopicPageArticle(header, link){\n article = document.createElement('ARTICLE');\n let h1 = document.createElement('h1');\n let text = document.createTextNode(\"Click here for the topic description\");\n let a = document.createElement('a');\n h1.textContent = header;\n h1.style.fontSize = '1.5em';\n a.title = \"Click here for the topic description\";\n a.href = link;\n a.appendChild(text);\n article.appendChild(h1);\n article.appendChild(a);\n return article;\n}", "get _HTML() {\n return `\n<a href=\"./nyhet.html#${this._nyhet.tittel}\">\n<div class=\"boks boks-link boks-horisontal\">\n <div class=\"boksetekst\">\n <header>\n <h2 class=\"boks-overskrift\">${this._nyhet.tittel}</h2>\n <h3 class=\"boks-underoverskrift\">Dato publisert: <time datetime=\"${this._dato.toISOString()}\" >${this._dato.toLocaleDateString()}</time></h3>\n </header>\n <p>${this._tekst}</p>\n </div>\n <div class=\"boksebilde nyhetsbilde\">\n <img src=\"${this._nyhet.bilde}\" alt=\"${this._nyhet.tittel}\">\n </div>\n</div>\n</a>`;\n }", "displayWikiDetails() {\n // console.log('3');\n $('#modalBody').html(\n `${this.cleanerExtract}<br><a href=https://${this.wikiUrl} target=\"_blank\">Full Wikipedia Article</a>` // this displays the link to the wiki article.\n );\n }", "function make_onehtml() {\n \"use strict\";\n var link_text = Object.create(null);\n var nx = /\\n|\\r\\n?/;\n var sx = /[!-@\\[-\\^`{-~]/g; // special characters & digits\n var title = \"\";\n\n\n function entityify(text) {\n return text\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\");\n }\n\n\n function special_encode(text) {\n\n// Convert the text to lower case, and then replace ASCII special characters\n// with pairs of hex digits. This makes special character sequences safe for\n// use as filenames and urls. Alpha hex characters will be upper case.\n\n if (typeof text === \"string\") {\n return text.toLowerCase().replace(sx, function (a) {\n return a.charCodeAt(0).toString(16).toUpperCase();\n });\n }\n }\n\n function stuff_name(text, structure) {\n structure.name = text;\n link_text[structure.link.toLowerCase()] = text;\n return text;\n }\n\n function stuff_link(text, structure) {\n text = text.trim();\n structure.link = text;\n return text;\n }\n\n function wrap(tag) {\n return function (text, structure) {\n return \"\\n<\" + tag + \" id='\" + special_encode(structure.link)\n + \"'>\" + text + \"</\" + tag + \">\";\n };\n }\n\n return {\n \"*\": [\"link\", \"name\", \"gen\"], // the names of the passes\n \"@\": function (product) {\n return \"<!DOCTYPE html><html><head><meta charset='utf-8'>\"\n + \"<link rel='stylesheet' href='encyclopedia.css' \"\n + \"type='text/css'>\"\n + \"<title>\" + entityify(title) + \"</title>\"\n + \"</head><body>\" + product.gen + \"</body></html>\";\n },\n \"@-\": { // soft hyphen\n link: \"\",\n name: \"\",\n gen: \"&shy;\"\n },\n $: { // the naked text rule\n name: entityify,\n gen: entityify\n },\n \"\": { // the default para rule\n link: \"\",\n name: \"\",\n gen: [\"\\n<p>\", \"</p>\"]\n },\n aka: {\n link: \"\",\n name: [\"<dfn>\", \"</dfn>\"],\n gen: [\"<dfn>\", \"</dfn>\"]\n },\n appendix: {\n level: 2,\n link: stuff_link,\n name: stuff_name,\n gen: wrap(\"h1\")\n },\n article: {\n level: 4,\n link: stuff_link,\n name: stuff_name,\n gen: wrap(\"h3\")\n },\n b: {\n gen: [\"<b>\", \"</b>\"]\n },\n book: {\n level: 1,\n name: function (text) {\n title = text;\n },\n gen: wrap(\"h1\")\n },\n chapter: {\n level: 2,\n link: stuff_link,\n name: stuff_name,\n gen: wrap(\"h1\")\n },\n comment: {\n link: \"\",\n name: \"\",\n gen: \"\"\n },\n i: {\n gen: [\"<i>\", \"</i>\"]\n },\n link: {\n link: stuff_link,\n gen: function (ignore, structure) {\n var name = link_text[structure.link.toLowerCase()];\n if (name !== undefined) {\n return \"<a href='#\"\n + special_encode(structure.link)\n + \"'>\" + name + \"</a>\";\n } else {\n return structure.link + \" <strong>MISSING LINK</strong>\";\n }\n }\n },\n list: {\n name: \"\",\n link: \"\",\n gen: function (text) {\n return \"<ul><li>\" + text.split(nx).join(\"</li><li>\")\n + \"</li></ul>\";\n }\n },\n program: {\n name: \"\",\n link: \"\",\n gen: [\"\\n<pre>\", \"</pre>\"]\n },\n reserved: {\n name: \"\",\n link: \"\",\n gen: \"<a href='#reserved word'><strong>reserved word</strong></a>\"\n },\n section: {\n level: 5,\n link: \"\",\n name: \"\",\n gen: wrap(\"h4\")\n },\n slink: {\n gen: function (text, structure) {\n var name = link_text[structure.link.toLowerCase()];\n if (name !== undefined) {\n return \"<a href='#\" + special_encode(structure.link)\n + \"'>\" + name + \"</a>\";\n } else {\n return text + \" <strong>MISSING LINK</strong>\";\n }\n }\n },\n specimen: {\n level: 3,\n link: stuff_link,\n name: stuff_name,\n gen: wrap(\"h2\")\n },\n sub: {\n name: [\"<sub>\", \"</sub>\"],\n gen: [\"<sub>\", \"</sub>\"]\n },\n super: {\n name: [\"<sup>\", \"</sup>\"],\n gen: [\"<sup>\", \"</sup>\"]\n },\n t: {\n name: [\"<tt>\", \"</tt>\"],\n gen: [\"<tt>\", \"</tt>\"]\n },\n table: {\n link: \"\",\n name: \"\",\n gen: [\"<table><tbody>\", \"</tbody></table>\"],\n parse: function (structure) {\n var itemcont = [];\n var item = [\"-td\", itemcont];\n var rowcont = [item];\n var row = [\"-tr\", rowcont];\n var tablecont = [row];\n var table = [\"table\", tablecont];\n structure.slice(1).forEach(function (rowrow) {\n rowrow.forEach(function (thing) {\n if (Array.isArray(thing)) {\n switch (thing[0]) {\n case \"@!\":\n item[0] = \"-th\";\n break;\n case \"@|\":\n itemcont = [];\n item = [\"-td\", itemcont];\n rowcont.push(item);\n break;\n case \"@_\":\n itemcont = [];\n item = [\"-td\", itemcont];\n rowcont = [item];\n row = [\"-tr\", rowcont];\n tablecont.push(row);\n break;\n default:\n itemcont.push(thing);\n }\n } else {\n itemcont.push(thing);\n }\n });\n });\n return table;\n },\n \"@!\": true,\n \"@_\": true,\n \"@|\": true\n },\n \"-td\": {\n link: \"\",\n name: \"\",\n gen: [\"<td>\", \"</td>\"]\n },\n \"-th\": {\n link: \"\",\n name: \"\",\n gen: [\"<th>\", \"</th>\"]\n },\n together: {\n gen: function (text) {\n return text;\n },\n parse: function (structure) {\n var stuff = structure[1];\n structure.slice(2).forEach(function (row) {\n stuff = stuff.concat(\" \", row);\n });\n return [\"together\", stuff];\n }\n },\n \"-tr\": {\n link: \"\",\n name: \"\",\n gen: [\"<tr>\", \"</tr>\"]\n },\n url: {\n gen: function (text) {\n return \"<a href='\" + text + \"'>\" + text + \"</a>\";\n }\n }\n };\n}", "function getRandomArticle() {\n var random_url = 'https://en.wikipedia.org/wiki/Special:Random';\n window.open(random_url,'_blank');\n }", "displayWikiDetails() {\n $('#modalBody').html(\n `${this.cleanExtract}<br><a href=https://${this.wikiUrl} target=\"_blank\">Full Wikipedia Article</a>`\n );\n }", "function parseWikiVoyageElement(element) {\n\tvar html = '<a target=\"_blank\" href=\"'+element.sitelink+'\">';\n\t\thtml += '<div class=\"WikiVoyageElement\">';\n\t\thtml += element.title;\n\t\t\n\t\tif(element.thumbnail != null)\n\t\t\thtml += '<img class=\"WikiVoyageImg\" src=\"' + element.thumbnail + '\" />';\n\t\t\n\t\thtml += '</div></a>';\n\n\treturn html;\n}", "function insertWikiLink(itemElement, wikiEntryName, textToInsertAfter) \r\n{\t \t\t\r\n\t\tif (itemElement.tagName.toUpperCase() == \"IMG\")\r\n\t\t{\r\n\t\t\tvar newElement = document.createElement(\"span\");\r\n\t\t\tnewElement.innerHTML = wikify(wikiEntryName);\r\n\r\n\t\t\tvar itemParent = itemElement.parentNode;\r\n\t\t\tif (itemElement.nextSibling && itemParent)\r\n\t\t\t{\r\n\t\t\t\titemParent.insertBefore(newElement,itemElement.nextSibling); \r\n\t\t\t}\t\t\t\t\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t/*****************\r\n\t\t\tif it's buff or effect, it has onclick property with popup inside, and we want to isolate wiki link from popup.\r\n\t\t\tso we add some conditions to onclick: show popup only if clicked element isn't <a>\r\n\t\t\t*****************/\r\n\t\t\tif ((itemElement.tagName.toUpperCase() == \"DIV\") && (itemElement.attributes[0].name.toUpperCase() == \"ONCLICK\"))\r\n\t\t\t{\r\n\t\t\t\tvar attr = itemElement.attributes;\r\n\t\t\t\titemElement.attributes[0].value='if ((event.target.nodeName.toUpperCase() || event.srcElement.nodeName.toUpperCase()) != \"A\"){' + \r\n\t\t\t\t\titemElement.attributes[0].value + '}';\r\n\t\t\t\t\r\n\t\t\t\t//DIV on the training page contains <b> inside, so we dig a little further\r\n\t\t\t\tif (itemElement.hasChildNodes())\r\n\t\t\t\t{\r\n\t\t\t\t\tvar iter = itemElement.firstChild;\r\n\t\t\t\t\t//because of stupid DOM structure, empty #text child nodes may appear in <div> before <b>\r\n\t\t\t\t\t//so we need to find actual <b>\r\n\t\t\t\t\twhile (iter)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (iter.nodeName.toUpperCase() == \"B\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\twikiEntryName = iter.innerHTML;\r\n\t\t\t\t\t\t\ttextToInsertAfter = wikiEntryName;\r\n\t\t\t\t\t\t\titemElement = iter;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\titer = iter.nextSibling;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar insertionPoint = itemElement.innerHTML.indexOf(textToInsertAfter) + textToInsertAfter.length;\r\n\t\t\tvar newInnerHTML = itemElement.innerHTML.substring(0, insertionPoint) +\r\n\t\t\t\twikify(wikiEntryName) + itemElement.innerHTML.substring(insertionPoint); \t\r\n\t\t\titemElement.innerHTML = newInnerHTML;\r\n\t\t}\r\n}", "function WikiArticle(name) {\n\tthis.name = name;\n\tthis.url = 'http://en.wikipedia.org/wiki/' + name;\n}", "linkToWiki ( startTerm, url ) {\n\n let i = 0;\n let data = $('#fact_text').html()\n let nouns = this.getProperNouns(data)\n let text = [];\n let start = null;\n let end = -1;\n\n let words = data.split(\" \")\n while (i < words.length) {\n if (nouns[startTerm] && words[i].includes(startTerm)) {\n start = '<a href=' + url + ' target=\"_blank\">'\n end = i + nouns[startTerm].length\n } \n\n if (start) {\n text.push(start)\n start = null\n }\n\n text.push(words[i])\n\n if (i === end-1) {\n text.push(\"</a>\")\n }\n i += 1\n }\n\n let html = text.join(' ')\n $('#fact_text').html(html)\n\n }", "function getInfo (link) {\r\n $(function () {\r\n $.ajax({\r\n type: 'GET',\r\n url: `https://www.mediawiki.org/w/api.php?action=query&origin=https://en.wikipedia.org`,\r\n success: function(data) {\r\n \r\n }\r\n })\r\n })\r\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUBLIC Sets the background image of the map and allocates it at the specified coordenates from the upper left corner of the map.
function setMapBackgroundImage(img, x, y) { if (img.indexOf("/") != -1) { this.bgImage = img; } else { this.bgImage = URL_IMAGES + img; } this.bgImageXCoord = x != null ? eval(x) : 0; this.bgImageYCoord = y != null ? eval(y) : 0; if (this.hasExtendedInformation) { this.minimap.setBackgroundImage(this.bgImage, this.bgImageXCoord, this.bgImageYCoord); } }
[ "function loadBackgroundImage() {\n\t\tmapImage = new Image()\n\n\t\tmapImage.onload = setBackgroundImage;\n\t\tmapImage.src = \"gtasa-map-small.png\";\n\t}", "function background(number){\n\n mapHeroCtx.drawImage(mapOrganisation[number], 0, 0);\n\n}", "function genBackground(){\n\tfor(var x = 0;x<mapWidth;x++){\n\t\tfor(var y = 0;y<mapHeight;y++){\n\t\t\tBGCcontext.drawImage(iniArr[useTerrain]['baseTileset']['loadedImages'][Rand(0,iniArr[useTerrain]['baseTileset']['loadedImages'].length-1)],x*iniArr['rules']['General']['MapTileSize'],y*iniArr['rules']['General']['MapTileSize']);\n\t\t}\n\t}\n}", "function setMinimapBackgroundImage(img, x, y) {\n\t\tthis.bgImage = img;\n\t\tthis.bgImageXCoord = eval(x);\n\t\tthis.bgImageYCoord = eval(y);\n\t}", "function setMapBackgroundImage(sImage) {\n // Only work with the background image if some is configured\n if(typeof sImage !== 'undefined' && sImage !== 'none' && sImage !== '') {\n // Use existing image or create new\n var oImage = document.getElementById('backgroundImage');\n if(!oImage) {\n var oImage = document.createElement('img');\n oImage.id = 'backgroundImage';\n document.getElementById('map').appendChild(oImage);\n }\n\n addZoomHandler(oImage, true);\n\n oImage.src = sImage;\n oImage = null;\n }\n}", "function writeMinimapBackground() {\n\t\tif (this.bgImage != null) {\n\t\t\tvar image = new Image();\n\t\t\timage.src = this.bgImage;\n\t\t\tvar img = document.createElement(\"img\");\n\t\t\timg.setAttribute(\"border\", \"0\");\n\t\t\timg.setAttribute(\"src\", image.src);\n\t\t\tvar imgsp = document.getElementById(MINIMAP).appendChild(img);\n\t\t\timgsp.style.position = \"absolute\";\n\t\t\timgsp.style.left = this.bgImageXCoord * this.xRate;\n\t\t\timgsp.style.top = this.bgImageYCoord * this.yRate;\n\t\t\timgsp.style.width = image.width * this.xRate;\n\t\t\timgsp.style.height = image.height * this.yRate;\n\t\t}\n\t}", "function placeBackground() {\n displayModules_1.createImage(this.ctx, this.img, this.sx, this.sy, this.sWidth, this.sHeight, this.x, this.y, this.width, this.height);\n}", "function setupBackground() {\n let sea = gameAssets.sea;\n currentMapUpperX = -sea.width;\n currentMapUpperY = -sea.height;\n\n sprites[\"seas\"[\"1\"]] = new Sea(sea, {\n x: 0 - sea.width,\n y: 0 - sea.height\n });\n sprites[\"seas\"[\"2\"]] = new Sea(sea, {\n x: 0,\n y: 0 - sea.height\n });\n sprites[\"seas\"[\"3\"]] = new Sea(sea, {\n x: 0 + sea.width,\n y: 0 - sea.height\n });\n sprites[\"seas\"[\"4\"]] = new Sea(sea, { x: 0 - sea.width, y: 0 });\n sprites[\"seas\"[\"5\"]] = new Sea(sea, { x: 0, y: 0 });\n sprites[\"seas\"[\"6\"]] = new Sea(sea, { x: 0 + sea.width, y: 0 });\n sprites[\"seas\"[\"7\"]] = new Sea(sea, {\n x: 0 - sea.width,\n y: 0 + sea.height\n });\n sprites[\"seas\"[\"8\"]] = new Sea(sea, {\n x: 0,\n y: 0 + sea.height\n });\n sprites[\"seas\"[\"9\"]] = new Sea(sea, {\n x: 0 + sea.width,\n y: 0 + sea.height\n });\n}", "function adjustMap() {\n map.setOptions({styles: [{ featureType: \"all\", stylers: [{ visibility: \"off\" }] }]});\n svl.ui.minimap.holder.css('backgroundImage', `url('${svl.rootDirectory}img/onboarding/TutorialMiniMap.jpg')`);\n }", "function generateMapBackground() {\n var url = createURL(mapTerm);\n //get the JSON information we need to display the images\n $.getJSON(url, function(data) {\n $.each(data.response.zone[0].records.work, processImages);\n }). done (function() {\n pickAndDisplayMapBackground();\n });\n }", "function drawBackground() {\n let canvasBG = document.querySelector('canvas')\n let context = canvasBG.getContext('2d');\n\n canvasBG.width = 780;\n canvasBG.height = 520;\n\n for (let y = 0; y < mapH; ++y) {\n for (let x = 0; x < mapW; ++x) {\n switch (gameMap[y * mapW + x]) {\n case 0:\n context.drawImage(mapImg, 0, 0, 24, 24, x * tileW, y * tileH, 26, 26);\n break;\n case 1:\n context.drawImage(mapImg, 48, 0, 24, 24, x * tileW, y * tileH, 26, 26);\n break;\n default:\n context.drawImage(mapImg, 24, 0, 24, 24, x * tileW, y * tileH, 26, 26);\n if(gameMap[y * mapW + (x - 1)] == 0 || gameMap[y * mapW + (x + 1)] == 0) {\n collidableObjects.push(new Tile(x * tileW, y * tileH, 26, true));\n lastInRowObjects.push(new Tile(x * tileW, y * tileH, 26, true));\n }\n else {\n collidableObjects.push(new Tile(x * tileW, y * tileH, 26, false));\n }\n }\n }\n }\n}", "createBackground() {\n this.createBitmap();\n this._backgroundSprite = new Sprite(this._backgroundBitmap);\n this.centerSprite(this._backgroundSprite);\n this.addChild(this._backgroundSprite);\n }", "function Spriteset_TitleMapBackground() {\n\t\tthis.initialize.apply(this, arguments)\n\t}", "function setBackgroundImage(){\n\timage(manual_bgImage, 0, 0, manual_actual_BgImageWidth, manual_graphAreaHeight); //set bg image\n}", "function getTableImage(bounds) {\n var bboxParamText = 'bbox=' + bounds._sw.lng + ',' + bounds._sw.lat + ',' + bounds._ne.lng + ',' + bounds._ne.lat;\n var bboxCoordinates = [[bounds._sw.lng, bounds._ne.lat], [bounds._ne.lng, bounds._ne.lat], [bounds._ne.lng, bounds._sw.lat], [bounds._sw.lng, bounds._sw.lat]];\n\n map.addSource(backgroundImageProps.id, {\n 'type': 'image',\n 'url': backgroundImageProps.url,\n 'coordinates': bboxCoordinates\n });\n map.addLayer({\n 'id': backgroundImageProps.id,\n 'type': 'raster',\n 'source': backgroundImageProps.id,\n 'layout': {\n 'visibility': 'none'\n },\n 'paint': {\n 'raster-opacity': backgroundImageProps.opacity\n }\n });\n}", "function setupBackground() {\n\n //Layer for our background\n gBackground_layer = new Kinetic.Layer();\n\n //Canvas background image\n var canvasBackgroundImage = new Image();\n canvasBackgroundImage.src = 'img/map.png'; //Location of our background\n canvasBackgroundImage.onload = function() {\n var backgroundImage = new Kinetic.Image({\n x: 0,\n y: 0,\n image: canvasBackgroundImage,\n width: MAP_WIDTH,\n height: MAP_HEIGHT\n });\n\n backgroundImage.on(\"dblclick dbltap\", function() {\n createContentArea(gStage.getPointerPosition());\n });\n\n gBackground_layer.add(backgroundImage);\n gBackground_layer.draw();\n };\n\n gStage.add(gBackground_layer);\n}", "function setupBackground() {\n // Initialise leftRectangleBackground's position and their width\n leftRectangleBackground.x = 0;\n leftRectangleBackground.y = 0;\n leftRectangleBackground.width = width / 2;\n // Initialise rightRectangleBackground's position and their width\n rightRectangleBackground.x = 0;\n rightRectangleBackground.y = 0;\n rightRectangleBackground.width = width;\n}", "function setBackground() {\n background(bg.fill.r, bg.fill.g, bg.fill.b);\n push();\n imageMode(CENTER);\n image(bg.sand.img, width/2, height - bg.sand.height/2, bg.sand.length, bg.sand.height);\n image(bg.rocks.img, width/2, height*2/3, bg.rocks.length, bg.rocks.height);\n pop();\n}", "function addBackground() {\r\n addBackgroundObject(\"img/background.png\", -1725, 0, 0.45, 1);\r\n\r\n addBackgroundObject(\"img/background.png\", 0, 0, 0.45, 1);\r\n\r\n addBackgroundObject(\"img/background.png\", 1725, 0, 0.45, 1);\r\n\r\n addBackgroundObject(\"img/background.png\", 3450, 0, 0.45, 1);\r\n\r\n addBackgroundObject(\"img/background.png\", 5175, 0, 0.45, 1);\r\n\r\n addBackgroundObject(\"img/background.png\", 6900, 0, 0.45, 1);\r\n\r\n addBackgroundObject(\"img/background.png\", 8625, 0, 0.45, 1);\r\n\r\n addBackgroundObject(\"img/background.png\", 10350, 0, 0.45, 1);\r\n\r\n addBackgroundObject(\"img/background.png\", 12075, 0, 0.45, 1);\r\n\r\n addBackgroundObject(\"img/background.png\", 13800, 0, 0.45, 1);\r\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A tag can use a renderer or a template to do the rendering. If a template is provided then the value should be the path to the template to use to render the custom tag.
template(value) { var tag = this.tag; var dirname = this.dirname; var path = nodePath.resolve(dirname, value); if (!exists(path)) { throw new Error('Template at path "' + path + '" does not exist.'); } tag.template = path; }
[ "function renderTag(template, tag, value) {\n if (!tag) {\n console.log('Resources:renderTag: The tag is invalid');\n return template;\n }\n if (value === null || value === undefined) {\n value = '';\n }\n var regex = new RegExp(tag, 'gmi');\n return template.replace(regex, value);\n }", "template(value) {\n var tag = this.tag;\n var dirname = this.dirname;\n\n var path = nodePath.resolve(dirname, value);\n\n try {\n taglibConfig.fs.statSync(path);\n tag.template = path;\n } catch (_) {\n throw new Error('Template at path \"' + path + '\" does not exist.');\n }\n }", "useTemplateRenderer(templateRenderer) {\n return this.use({\n contextCreated: (ctx, next) => {\n ctx.templateManager.register(templateRenderer);\n return next();\n }\n });\n }", "createCustomTags() {\n\t\tthis.createIncludeTag();\n\t}", "render(templateName, data) {\n var value, id, html;\n var self = this;\n\n if (templateName === 'option' || templateName === 'item') {\n value = hash_key(data[self.settings.valueField]); // pull markup from cache if it exists\n\n if (self.renderCache[templateName].hasOwnProperty(value)) {\n return self.renderCache[templateName][value];\n }\n }\n\n var template = self.settings.render[templateName];\n\n if (typeof template !== 'function') {\n return null;\n } // render markup\n\n\n html = template.call(this, data, escape_html);\n\n if (!html) {\n return html;\n }\n\n html = getDom(html); // add mandatory attributes\n\n if (templateName === 'option' || templateName === 'option_create') {\n if (!data[self.settings.disabledField]) {\n setAttr(html, {\n 'data-selectable': ''\n });\n }\n } else if (templateName === 'optgroup') {\n id = data.group[self.settings.optgroupValueField];\n setAttr(html, {\n 'data-group': id\n });\n\n if (data.group[self.settings.disabledField]) {\n setAttr(html, {\n 'data-disabled': ''\n });\n }\n }\n\n if (templateName === 'option' || templateName === 'item') {\n setAttr(html, {\n 'data-value': value\n }); // make sure we have some classes if a template is overwritten\n\n if (templateName === 'item') {\n addClasses(html, self.settings.itemClass);\n } else {\n addClasses(html, self.settings.optionClass);\n setAttr(html, {\n role: 'option',\n id: data.$id\n });\n } // update cache\n\n\n self.renderCache[templateName][value] = html;\n }\n\n return html;\n }", "render(renderer = this.$renderParams && this.$renderParams.renderer || fnId) {\n\n return renderer(this.resolveTemplate(), this);\n }", "function render(template, data) { \n var textOrFile = template.split('.');\n if (textOrFile.length === 2) {\n document.getElementById('application').innerHTML = createFromTemplate(template, data); \n }\n else {\n document.getElementById('application').innerHTML = createFromText(template, data); \n }\n}", "function render(template, elem) {\n if (!elem) return;\n elem.innerHTML = typeof template === 'function' ? template() : template;\n }", "_renderTemplate(path, context) {\n return swig.compileFile(path)(context)\n }", "function tag(name, content, attr) {\n if (typeof content === 'number') { content = content.toString(); }\n return '<' + name + (attr ? ' ' + attr : '') + '>' +\n (typeof content === 'string' ? (content + '</' + name + '>') : '');\n }", "function renderTemplate(template, context) {\n var esc = $(document.createElement('div'));\n\n function handle(ph, escape) {\n var cur = context;\n $.each(ph.split('.'), function() {\n cur = cur[this];\n });\n return escape ? esc.text(cur || \"\").html() : cur;\n }\n\n return template.replace(/<([%#])([\\w\\.]*)\\1>/g, function() {\n return handle(arguments[2], arguments[1] == '%' ? true : false);\n });\n }", "function createTag(tag, content) {\n return '<' + tag + '>' +\n content +\n '</' + tag + '>';\n}", "createIncludeTag() {\n\t\tconst self = this;\n\n\t\tthis.engine.views.tags('include', {\n\t\t\trender() {\n\t\t\t\tconst { name, data = {}, inline, escape } = this.tagCtx.props;\n\t\t\t\tdata.slot = data.slot || this.tagCtx.render();\n\n\t\t\t\tlet render = self.view.make(name, data);\n\n\t\t\t\tif (inline) {\n\t\t\t\t\trender = render.replace(/\\n/gu, '');\n\t\t\t\t}\n\n\t\t\t\tif (escape) {\n\t\t\t\t\trender = render.replace(/\\\\/gu, '\\\\\\\\');\n\t\t\t\t}\n\n\t\t\t\treturn render;\n\t\t\t}\n\t\t});\n\n\t}", "render(data, template) {\n var html = template.innerHTML;\n\n // Attempts\n // to compile the tmplate.\n for (var key in data) {\n var placeholder = '{{' + key +'}}';\n\n if (html.search(placeholder) !== -1) {\n html = html.replace(placeholder, data[key]);\n }\n }\n\n this.el.innerHTML = html;\n }", "renderTemplate(path, template, params) {\n if (template.substring(0, 1) === \"@\") {\n const templateName = template.substring(1);\n const layer = getLayerFromPath(this.store.getState().mapSources, path);\n const layerTemplate = layer.templates[templateName];\n let templateContents = \"\";\n\n if (layerTemplate) {\n if (layerTemplate.type === \"alias\") {\n // TODO: Someone is likely to think it's funny to do multiple\n // levels of aliasing, this should probably look through that\n // possibility.\n templateContents = layer.templates[layerTemplate.alias].contents;\n } else {\n templateContents = layer.templates[templateName].contents;\n }\n return Mark.up(templateContents, params, FORMAT_OPTIONS);\n }\n }\n return \"\";\n }", "function render(template, context) {\n var container = document.createElement('div');\n var templateText = template.innerHTML || template;\n container.innerHTML = templateText.trim();\n var el = container.firstChild;\n for (var key in context) {\n var value = context[key];\n var selector = '[name=\"'+key+'\"]';\n var fields = el.querySelectorAll(selector);\n for (var i = 0; i < fields.length; i++) {\n var field = fields[i];\n setText(field, value);\n }\n }\n return el;\n}", "function buildTagHTML(tag){\n return \"<span class=\\\"tag tagLink\\\">\"+tag+\"</span>\";\n}", "function xrxCreateTag( label, type, value )\n{\n if(type == \"\")\n {\n return( \"<\" + label + \">\" + value + \"</\" + label + \">\" );\n }\n else\n {\n return( \"<\" + label + \" \" + type + \">\" + value + \"</\" + label + \">\" );\n }\n}", "function render (file, data, context) {\n file = getFileContent(file).content;\n return _.template(file, data || null, context || { variable: 'it' });\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the CRC for the data bytes.
computeDataCrc() { let crc = 0xFFFF; const index = this.dataIndex; const begin = index - 4; const end = index + this.getLength(); for (let i = begin; i < end; i++) { crc = Crc16_1.CRC_16_CCITT.update(crc, this.getByte(i)); } return crc; }
[ "computeDataCrc() {\n let crc = 0xFFFF;\n const index = this.dataIndex;\n const begin = index - 4;\n const end = index + this.getLength();\n for (let i = begin; i < end; i++) {\n crc = CRC_16_CCITT.update(crc, this.getByte(i));\n }\n return crc;\n }", "getDataCrc() {\n // Bit endian.\n const index = this.dataIndex + this.getLength();\n return (this.getByte(index) << 8) + this.getByte(index + 1);\n }", "function updateCrc(crc,buf,len){for(let n=0;n<len;n++){crc=crc>>>8^crcTable[(crc^buf[n])&255]}return crc}", "function crc(buf){return(updateCrc(-1,buf,buf.length)^-1)>>>0;// u32\n}", "function CRC16_Calc (data, start, length, initVal) {\n // init crc\n\tvar crc = initVal;\n // iterate over all bytes\n for (var i=0; i < length; i++) {\n \tvar bits = 8;\n \tvar byte = data[start+i];\n\n\t // iterate over all bits per byte\n\t while(bits--) {\n\t\t if((byte & 1) ^ (crc & 1)) {\n\t crc = (crc >> 1) ^ CRC16_POLYNOM;\n\t\t } else {\n\t crc >>= 1;\n\t }\n byte >>= 1;\n\t\t}\n }\n return crc;\n}", "function calculateChecksum(data) {\n return crypto\n .createHash('sha256')\n .update(data, 'utf8')\n .digest('hex')\n}", "calcAlectoCRC8(data) {\n let crc = 0;\n let x = 0;\n let len = data.length;\n // Indicated changes are from reference CRC-8 function in OneWire library\n while (len--) {\n let inbyte = data[x++];\n for (let i = 0; i < 8; i++) {\n let mix = (crc ^ inbyte) & 0x80; // changed from & 0x01\n crc = (crc << 1) & 0xff; // changed from right shift\n if (mix) {\n crc ^= 0x31;// changed from 0x8C;\n }\n inbyte = (inbyte << 1) & 0xff; // changed from right shift\n }\n }\n return crc;\n }", "function crc32c(data, previous) {\n return binding_1.default.checksums_crc32c(data, previous);\n}", "function crc_reflect(data, data_len)\n {\n var i;\n var ret;\n\n ret = data & 0x01;\n for (i = 1; i < data_len; i++) {\n data >>= 1;\n ret = (ret << 1) | (data & 0x01);\n }\n return ret;\n }", "update(crc, data) {\n for (let shift = 8; shift < 16; shift++) {\n const isOne = ((crc ^ (data << shift)) & 0x8000) !== 0;\n crc <<= 1;\n if (isOne) {\n crc ^= this.generator;\n }\n }\n return crc & 0xFFFF;\n }", "function calc_crc8(buf, len)\n{\n var dataandcrc;\n // Generator polynomial: x**8 + x**5 + x**4 + 1 = 1001 1000 1\n var poly = 0x98800000;\n var i;\n\n if (len === null) return -1;\n if (len != 3) return -1;\n if (buf === null) return -1;\n\n // Justify the data on the MSB side. Note the poly is also\n // justified the same way.\n dataandcrc = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8);\n for (i = 0; i < 24; i++) {\n if (dataandcrc & 0x80000000)\n dataandcrc ^= poly;\n dataandcrc <<= 1;\n }\n return (dataandcrc === 0);\n}", "function crc32(data, previous) {\n return binding_1.default.checksums_crc32(data, previous);\n}", "calcSimpleCRC(data, type) {\n let rain = type === 'R';\n let crc = (rain ? 0x7 : 0xf);\n for (let i = 0; i < 8; i++) {\n let val = Number(utils.bin2dec(data.slice(4 * i, 4 * (i + 1))));\n if (rain) {\n crc += val;\n } else {\n crc -= val;\n }\n }\n return (crc & 0xf);\n }", "function updateCrc (crc, buf, len) {\n for (let n = 0; n < len; n++) {\n crc = (crc >>> 8) ^ crcTable[(crc ^ buf[n]) & 0xff]\n }\n return crc\n}", "function createCrcInt32FromBytes(bytes) {\n // XXX do documentation\n // https://docs.microsoft.com/en-us/openspecs/office_protocols/ms-abs/06966aa2-70da-4bf9-8448-3355f277cd77\n // https://simplycalc.com/crc32-source.php\n var i = 0, l = bytes.length, crc32 = 0xFFFFFFFF|0, crcTable = [\n // generated with createCrcTableInt32ArrayFromPolynomial(0xEDB88320);\n 0x00000000, 0x77073096, -0x11f19ed4, -0x66f6ae46,\n 0x076dc419, 0x706af48f, -0x169c5acb, -0x619b6a5d,\n 0x0edb8832, 0x79dcb8a4, -0x1f2a16e2, -0x682d2678,\n 0x09b64c2b, 0x7eb17cbd, -0x1847d2f9, -0x6f40e26f,\n 0x1db71064, 0x6ab020f2, -0x0c468eb8, -0x7b41be22,\n 0x1adad47d, 0x6ddde4eb, -0x0b2b4aaf, -0x7c2c7a39,\n 0x136c9856, 0x646ba8c0, -0x029d0686, -0x759a3614,\n 0x14015c4f, 0x63066cd9, -0x05f0c29d, -0x72f7f20b,\n 0x3b6e20c8, 0x4c69105e, -0x2a9fbe1c, -0x5d988e8e,\n 0x3c03e4d1, 0x4b04d447, -0x2df27a03, -0x5af54a95,\n 0x35b5a8fa, 0x42b2986c, -0x2444362a, -0x534306c0,\n 0x32d86ce3, 0x45df5c75, -0x2329f231, -0x542ec2a7,\n 0x26d930ac, 0x51de003a, -0x3728ae80, -0x402f9eea,\n 0x21b4f4b5, 0x56b3c423, -0x30456a67, -0x47425af1,\n 0x2802b89e, 0x5f058808, -0x39f3264e, -0x4ef416dc,\n 0x2f6f7c87, 0x58684c11, -0x3e9ee255, -0x4999d2c3,\n 0x76dc4190, 0x01db7106, -0x672ddf44, -0x102aefd6,\n 0x71b18589, 0x06b6b51f, -0x60401b5b, -0x17472bcd,\n 0x7807c9a2, 0x0f00f934, -0x69f65772, -0x1ef167e8,\n 0x7f6a0dbb, 0x086d3d2d, -0x6e9b9369, -0x199ca3ff,\n 0x6b6b51f4, 0x1c6c6162, -0x7a9acf28, -0x0d9dffb2,\n 0x6c0695ed, 0x1b01a57b, -0x7df70b3f, -0x0af03ba9,\n 0x65b0d9c6, 0x12b7e950, -0x74414716, -0x03467784,\n 0x62dd1ddf, 0x15da2d49, -0x732c830d, -0x042bb39b,\n 0x4db26158, 0x3ab551ce, -0x5c43ff8c, -0x2b44cf1e,\n 0x4adfa541, 0x3dd895d7, -0x5b2e3b93, -0x2c290b05,\n 0x4369e96a, 0x346ed9fc, -0x529877ba, -0x259f4730,\n 0x44042d73, 0x33031de5, -0x55f5b3a1, -0x22f28337,\n 0x5005713c, 0x270241aa, -0x41f4eff0, -0x36f3df7a,\n 0x5768b525, 0x206f85b3, -0x46992bf7, -0x319e1b61,\n 0x5edef90e, 0x29d9c998, -0x4f2f67de, -0x3828574c,\n 0x59b33d17, 0x2eb40d81, -0x4842a3c5, -0x3f459353,\n -0x12477ce0, -0x65404c4a, 0x03b6e20c, 0x74b1d29a,\n -0x152ab8c7, -0x622d8851, 0x04db2615, 0x73dc1683,\n -0x1c9cf4ee, -0x6b9bc47c, 0x0d6d6a3e, 0x7a6a5aa8,\n -0x1bf130f5, -0x6cf60063, 0x0a00ae27, 0x7d079eb1,\n -0x0ff06cbc, -0x78f75c2e, 0x1e01f268, 0x6906c2fe,\n -0x089da8a3, -0x7f9a9835, 0x196c3671, 0x6e6b06e7,\n -0x012be48a, -0x762cd420, 0x10da7a5a, 0x67dd4acc,\n -0x06462091, -0x71411007, 0x17b7be43, 0x60b08ed5,\n -0x29295c18, -0x5e2e6c82, 0x38d8c2c4, 0x4fdff252,\n -0x2e44980f, -0x5943a899, 0x3fb506dd, 0x48b2364b,\n -0x27f2d426, -0x50f5e4b4, 0x36034af6, 0x41047a60,\n -0x209f103d, -0x579820ab, 0x316e8eef, 0x4669be79,\n -0x349e4c74, -0x43997ce6, 0x256fd2a0, 0x5268e236,\n -0x33f3886b, -0x44f4b8fd, 0x220216b9, 0x5505262f,\n -0x3a45c442, -0x4d42f4d8, 0x2bb45a92, 0x5cb36a04,\n -0x3d280059, -0x4a2f30cf, 0x2cd99e8b, 0x5bdeae1d,\n -0x649b3d50, -0x139c0dda, 0x756aa39c, 0x026d930a,\n -0x63f6f957, -0x14f1c9c1, 0x72076785, 0x05005713,\n -0x6a40b57e, -0x1d4785ec, 0x7bb12bae, 0x0cb61b38,\n -0x6d2d7165, -0x1a2a41f3, 0x7cdcefb7, 0x0bdbdf21,\n -0x792c2d2c, -0x0e2b1dbe, 0x68ddb3f8, 0x1fda836e,\n -0x7e41e933, -0x0946d9a5, 0x6fb077e1, 0x18b74777,\n -0x77f7a51a, -0x00f09590, 0x66063bca, 0x11010b5c,\n -0x709a6101, -0x079d5197, 0x616bffd3, 0x166ccf45,\n -0x5ff51d88, -0x28f22d12, 0x4e048354, 0x3903b3c2,\n -0x5898d99f, -0x2f9fe909, 0x4969474d, 0x3e6e77db,\n -0x512e95b6, -0x2629a524, 0x40df0b66, 0x37d83bf0,\n -0x564351ad, -0x2144613b, 0x47b2cf7f, 0x30b5ffe9,\n -0x42420de4, -0x35453d76, 0x53b39330, 0x24b4a3a6,\n -0x452fc9fb, -0x3228f96d, 0x54de5729, 0x23d967bf,\n -0x4c9985d2, -0x3b9eb548, 0x5d681b02, 0x2a6f2b94,\n -0x4bf441c9, -0x3cf3715f, 0x5a05df1b, 0x2d02ef8d\n ];\n for (; i < l; i = (i + 1)|0)\n crc32 = crcTable[(crc32 & 0xFF) ^ (bytes[i] & 0xFF)] ^ (crc32 >>> 8);\n return crc32 ^ 0xFFFFFFFF;\n }", "function addCRC(data, start, len) {\n var data_crc = crc.compute(data.slice(start, len));\n var c = new uint32(data_crc);\n c.appendToArray(data);\n}", "function update_crc(crc, buf, len)\r\n{\r\n var c = crc;\r\n var n;\r\n\r\n for (n = 0; n < len; n++) {\r\n c = _crc_table[(c ^ buf[n]) & 0xff] ^ (c >>> 8);\r\n }\r\n return c;\r\n}", "function checksum(data) {\n\t\tvar result = 0;\n\n\t\tfor (var i = 0; i < 13; i++) {\n\t\t\tresult += parseInt(data[i]) * (3 - i % 2 * 2);\n\t\t}\n\n\t\treturn Math.ceil(result / 10) * 10 - result;\n\t}", "function update_crc(crc, buf, len) {\n for (let n = 0; n < len; n++) {\n crc = crc_table[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8);\n }\n return crc;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs an `HttpHandler` that applies interceptors to a request before passing it to the given `HttpBackend`. Use as a factory function within `HttpClientModule`.
function interceptingHandler(backend) { var interceptors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; if (!interceptors) { return backend; } return interceptors.reduceRight(function (next, interceptor) { return new HttpInterceptorHandler(next, interceptor); }, backend); }
[ "function interceptingHandler(backend) {\n var interceptors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n\n if (!interceptors) {\n return backend;\n }\n\n return interceptors.reduceRight(function (next, interceptor) {\n return new HttpInterceptorHandler(next, interceptor);\n }, backend);\n }", "function interceptingHandler(backend) {\n var interceptors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n\n if (!interceptors) {\n return backend;\n }\n\n return interceptors.reduceRight(function (next, interceptor) {\n return new HttpInterceptorHandler(next, interceptor);\n }, backend);\n}", "function interceptingHandler(backend, interceptors = []) {\n if (!interceptors) {\n return backend;\n }\n return interceptors.reduceRight((next, interceptor) => new HttpInterceptorHandler(next, interceptor), backend);\n}", "applyInterceptorRequest(handler) {\n this.http.interceptors.request.use(handler);\n }", "function httpInMemBackendServiceFactory(injector, dbService, options) {\n var backend = new __WEBPACK_IMPORTED_MODULE_3__http_backend_service__[\"a\" /* HttpBackendService */](injector, dbService, options);\n return backend;\n}", "function withRequestsMadeViaParent() {\n return makeHttpFeature(HttpFeatureKind.RequestsMadeViaParent, [{\n provide: HttpBackend,\n useFactory: () => {\n const handlerFromParent = (0,_angular_core__WEBPACK_IMPORTED_MODULE_4__.inject)(HttpHandler, {\n skipSelf: true,\n optional: true\n });\n if (ngDevMode && handlerFromParent === null) {\n throw new Error('withRequestsMadeViaParent() can only be used when the parent injector also configures HttpClient');\n }\n return handlerFromParent;\n }\n }]);\n}", "function httpInMemBackendServiceFactory(injector, dbService, options) {\n var backend = new _http_backend_service__WEBPACK_IMPORTED_MODULE_3__[\"HttpBackendService\"](injector, dbService, options);\n return backend;\n}", "function legacyInterceptorFnFactory() {\n let chain = null;\n return (req, handler) => {\n if (chain === null) {\n const interceptors = (0,_angular_core__WEBPACK_IMPORTED_MODULE_4__.inject)(HTTP_INTERCEPTORS, {\n optional: true\n }) ?? [];\n // Note: interceptors are wrapped right-to-left so that final execution order is\n // left-to-right. That is, if `interceptors` is the array `[a, b, c]`, we want to\n // produce a chain that is conceptually `c(b(a(end)))`, which we build from the inside\n // out.\n chain = interceptors.reduceRight(adaptLegacyInterceptorToChain, interceptorChainEndFn);\n }\n return chain(req, handler);\n };\n}", "function HttpInterceptor(requestCb, responseCb) {\n this.requestCb = requestCb;\n this.responseCb = responseCb;\n}", "function legacyInterceptorFnFactory() {\n let chain = null;\n return (req, handler) => {\n if (chain === null) {\n const interceptors = (0,_angular_core__WEBPACK_IMPORTED_MODULE_5__.inject)(HTTP_INTERCEPTORS, {\n optional: true\n }) ?? [];\n // Note: interceptors are wrapped right-to-left so that final execution order is\n // left-to-right. That is, if `interceptors` is the array `[a, b, c]`, we want to\n // produce a chain that is conceptually `c(b(a(end)))`, which we build from the inside\n // out.\n chain = interceptors.reduceRight(adaptLegacyInterceptorToChain, interceptorChainEndFn);\n }\n const pendingTasks = (0,_angular_core__WEBPACK_IMPORTED_MODULE_5__.inject)(_angular_core__WEBPACK_IMPORTED_MODULE_5__[\"ɵInitialRenderPendingTasks\"]);\n const taskId = pendingTasks.add();\n return chain(req, handler).pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_7__.finalize)(() => pendingTasks.remove(taskId)));\n };\n}", "function createInterceptor(middlewareFactory, middlewareConfig) {\n const handlerFn = middlewareFactory(middlewareConfig);\n return toInterceptor(handlerFn);\n}", "function contextBaseMiddlewareFactory({\n instrumentation,\n queue,\n cache,\n connectorConfig,\n clientConfig,\n HullClient\n}: Object) {\n return function contextBaseMiddleware(\n req: HullRequestBase,\n res: $Response,\n next: NextFunction\n ) {\n const context = {};\n context.hostname = req.hostname || \"\";\n context.isBatch = false;\n context.options = Object.assign({}, req.query);\n context.clientConfig = clientConfig;\n context.connectorConfig = connectorConfig;\n context.cache = cache.getConnectorCache(context);\n context.metric = instrumentation.getMetric(context);\n context.enqueue = queue.getEnqueue(context);\n context.HullClient = HullClient;\n\n req.hull = (context: HullContextBase);\n next();\n };\n}", "function makeHttp(httpFn, preFetch, postFetch) {\n postFetch = postFetch || function (a) {return a;};\n preFetch = preFetch || function (a) {return a;};\n\n return function (req) {\n if (typeof req === 'string') {\n req = { url: req };\n }\n http_self.mergeInQueryOrForm(req);\n req = preFetch(req);\n return postFetch(httpFn(req));\n };\n}", "function HttpTrigger () {\n // this.identity = 'HttpTrigger';\n // Should NOT overwrite \n this.handler = this._handler.bind(this);\n this.responseAdapter = new DefaultResponseAdapter(function (error, result) {\n if (error) {\n console.error(error);\n }\n });\n this.event = null;\n this.handlers = {};\n this.handlers['get'] = function (event) { return this.getHandler ? this.getHandler(event) : this._handlerNotImplemented('GET'); }.bind(this);\n this.handlers['post'] = function (event) { return this.postHandler ? this.postHandler(event) : this._handlerNotImplemented('POST'); }.bind(this);\n this.handlers['put'] = function (event) { return this.putHandler ? this.putHandler(event) : this._handlerNotImplemented('PUT'); }.bind(this);\n this.handlers['patch'] = function (event) { return this.patchHandler ? this.patchHandler(event) : this._handlerNotImplemented('PATCH'); }.bind(this);\n this.handlers['delete'] = function (event) { return this.deleteHandler ? this.deleteHandler(event) : this._handlerNotImplemented('DELETE'); }.bind(this);\n \n // Can be overwritten\n this.authorizationHandler = this._authorization.bind(this);\n this.requestHandler = null;\n this.responseHandler = null;\n this.getHandler = null;\n this.postHandler = null;\n this.putHandler = null;\n this.patchHandler = null;\n this.deleteHandler = null;\n}", "function httpClientInMemBackendServiceFactory(dbService, options, xhrFactory) {\n var backend = new HttpClientBackendService(dbService, options, xhrFactory);\n return backend;\n}", "function makeHttp(httpFn, preFetch, postFetch) {\n\t postFetch = postFetch || function (a) {\n\t return a;\n\t };\n\t preFetch = preFetch || function (a) {\n\t return a;\n\t };\n\n\t return function (req) {\n\t if (typeof req === 'string') {\n\t req = { url: req };\n\t }\n\t self.mergeInQueryOrForm(req);\n\t req = preFetch(req);\n\t return postFetch(httpFn(req));\n\t };\n\t}", "function withInterceptorsFromDi() {\n // Note: the legacy interceptor function is provided here via an intermediate token\n // (`LEGACY_INTERCEPTOR_FN`), using a pattern which guarantees that if these providers are\n // included multiple times, all of the multi-provider entries will have the same instance of the\n // interceptor function. That way, the `HttpINterceptorHandler` will dedup them and legacy\n // interceptors will not run multiple times.\n return makeHttpFeature(HttpFeatureKind.LegacyInterceptors, [{\n provide: LEGACY_INTERCEPTOR_FN,\n useFactory: legacyInterceptorFnFactory\n }, {\n provide: HTTP_INTERCEPTOR_FNS,\n useExisting: LEGACY_INTERCEPTOR_FN,\n multi: true\n }]);\n}", "function httpClientInMemBackendServiceFactory(dbService, options, xhrFactory) {\n var backend = new __WEBPACK_IMPORTED_MODULE_3__http_client_backend_service__[\"a\" /* HttpClientBackendService */](dbService, options, xhrFactory);\n return backend;\n}", "function MockserverMiddlewareFactory() {\n\n\t/**\n\t * @param {http.IncomingMessage} req\n\t * @param {http.ServerResponse} resp\n\t * @param {Function} next Continue request handling\n\t */\n\treturn function( req, resp, next ) {\n\t\tconst parsed = url.parse( req.url, /* parseQuery */ true );\n\t\tlet path = parsed.pathname.replace( /^\\/base\\//, \"\" );\n\t\tconst query = parsed.query;\n\t\tconst subReq = Object.assign( Object.create( req ), {\n\t\t\tquery: query,\n\t\t\tparsed: parsed\n\t\t} );\n\n\t\tif ( /^test\\/data\\/mock.php\\//.test( path ) ) {\n\n\t\t\t// Support REST-like Apache PathInfo\n\t\t\tpath = \"test\\/data\\/mock.php\";\n\t\t}\n\n\t\tif ( !handlers[ path ] ) {\n\t\t\tnext();\n\t\t\treturn;\n\t\t}\n\n\t\thandlers[ path ]( subReq, resp, next );\n\t};\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Abstract the clicked button, and add an event listener to store the value of the choice variable when clicked
function selectAns(event) { choice = event.target.id; }
[ "function setAnswer(clicked_id) {\n ansChoice = clicked_id;\n}", "function handleChangeChoice(e) {\n setChoice(e.target.value);\n console.log(\"Changing choice to: \" + e.target.value);\n }", "function userSelection() {\n\t\t$(\".animal-choice__one\").on(\"click touchstart\", function() {\n\t\t\tuserChoice = \"choice--one\";\n\n\t\t\t$(\".animal-choice__two\").removeClass(\"choice-selected\");\n\t\t\t$(this).addClass(\"choice-selected\");\n\t\t});\n\n\t\t// if user selects cat, change class name of choice--two to userChoice in the generateChoiceTwo() function.\n\t\t$(\".animal-choice__two\").on(\"click touchstart\", function() {\n\t\t\tuserChoice = \"choice--two\";\n\n\t\t\t$(\".animal-choice__one\").removeClass(\"choice-selected\");\n\t\t\t$(this).addClass(\"choice-selected\");\n\t\t});\n\t}", "function playerChoice () {\n Array.from(playerButtons).forEach(function(btn) {\n btn.addEventListener('click', function() {\n addChoices(this.value, this.className);\n });\n });\n}", "function buttonClicked(button) {\n var selection = button.value;\n\n if (selection == \"countryView\") {\n showCountry(200);\n\n } else if (selection == \"projectView\") {\n showProjects(200)\n }\n\n}", "function addPlayerChoice(e) { \r\n // store in a variable the button which is the actual target of the event\r\n let playerChoice = e.target;\r\n\r\n // call a function which plays the audio tied to the respective button through a data-sound attribute which describes it\r\n playAudio(playerChoice.dataset.sound);\r\n\r\n // call a function which checks if the button pressed by the player matches the button in the array of buttons pressed randomly by the computer\r\n // the selection needs to match the button in the random array in its first position, then its second and so on\r\n // this is where the initialized counter variable will be used \r\n checkForMatch(playerChoice);\r\n}", "function choiceClick(trivia) {\n $(\"#answerBlock\").unbind(\"click\").on(\"click\", \".choices\", function(event) {\n event.stopPropagation();\n stopTimer();\n var rightChoice = trivia.answerArr[trivia.correctAnswer];\n if ($(this).text() !== rightChoice) {\n incorrect(trivia);\n }\n else {\n correct(trivia);\n } \n setTimeout(nextQuestion, 1000 * 10);\n })\n }", "function executeBtnChoice(event) {\n let trg, index, s, $lst;\n //event.stopImmediatePropagation();\n $lst = $(\"#selectlist\");\n if (!event) {\n index = 0;\n $lst.toggle();\n } else {\n trg = $(event.target);\n if (trg[0].id === \"select\") {\n $lst.toggle(); //$lst.display === \"none\");\n return;\n }\n index = trg.parent().children(\"li\").index(trg);\n }\n s = $.trim($(\"#textinput\").val());\n if (index === 1) {\n return;\n }\n switch (jbNS.selectBtnChoice) {\n case 0: // empty\n break;\n case 1: // error (not used)\n break;\n case 2: // goto greek\n case 3: // goto butler\n if (index === 0) {\n showAndGotoAnyLine(s, true);\n } else if (index === 2) {\n perseusLookup(0);\n } else if (index === 3) {\n perseusLookup(1);\n }\n break;\n case 4: // goto both\n showAndGotoAnyLine(s, true);\n break;\n case 5: // search greek\n case 6:\n s = s.toLowerCase();\n jbNS.selectBtnActions[1][index]();\n break;\n case 7: //set email addr\n setMailAdr();\n break;\n default:\n break;\n }\n }", "function onChoiceSelected() {\n if (choiceButton1) {\n choiceButton1.destroy();\n }\n\n if (choiceButton2) {\n choiceButton2.destroy();\n }\n\n luisDialogue = null;\n tyrellDialogue = null;\n choiceButton1 = null;\n choiceButton2 = null;\n narrative = null;\n\n // Display the next dialogue\n displayNext();\n }", "function playerChoice() {\n const buttons = document.querySelectorAll('button');\n buttons.forEach((button) => {\n \tbutton.addEventListener('click', (e) => {\n \t\tplayerSelection = button.id;\n \t\tplayRound(playerSelection, computerSelection);\n \t})\n });\n}", "function selectAnswer(event){\n event.stopPropagation();\n event.preventDefault();\n // \"data-value\" attribute of that button\n answerChoice = event.target.getAttribute(\"data-value\");\n correctIncorrect(answerChoice);\n quizCurrent++;\n quizEnd();\n // if quiz is not over, build next question\n if (quizCurrent !== quizQuestionsAnswers.length){\n buildQuestionsChoices(quizCurrent);\n }\n}", "function onChoiceSelected() {\n if (choiceButton1) {\n choiceButton1.destroy();\n }\n\n if (choiceButton2) {\n choiceButton2.destroy();\n }\n\n dateDialogue = null;\n friendDialogue = null;\n choiceButton1 = null;\n choiceButton2 = null;\n narrative = null;\n\n // Display the next dialogue\n displayNext();\n }", "function handleChoice(event) {\n event.preventDefault();\n\n var criteriaClicked = event.path[1].id;\n var criteriaClicked2 = event.path[2].id;\n\n var sunOrSnow = {\n sun: false,\n snow: false\n };\n\n if ((criteriaClicked || criteriaClicked2) === 'Snow') {\n sunOrSnow.snow = true;\n }\n if ((criteriaClicked || criteriaClicked2) === 'Sun') {\n sunOrSnow.sun = true;\n }\n var userChoiceArr = weather(sunOrSnow);\n var randomIndex = randomizer(userChoiceArr);\n window.open(userChoiceArr[randomIndex].path,'_self');\n}", "function getQuestion() {\n\n// current question at our current index\nvar currentQuestion = questions[currentQuestionIndex];\n// setting our #title id to a class of question\ntitleEl.setAttribute('class', 'question');\n// printing our current question title onto the document\ntitleEl.textContent = currentQuestion.title;\n\n// clearing out any choices that were previously on the screen\nchoicesEl.innerHTML = \"\";\n\n// for each current question choice\ncurrentQuestion.choices.forEach(function(choice, i){\n // creating button element\n var choiceBtn = document.createElement('button');\n // giving each button a class of choice\n choiceBtn.setAttribute('class', 'choice');\n // giving each button a value of the current choice\n choiceBtn.setAttribute('value', choice);\n // text content set to the choice button\n // each button has its own choice from\n // the current question index\n choiceBtn.textContent = i + 1 + '. '+ choice;\n\n // adding event listener to questionClick function\n choiceBtn.onclick = questionClick;\n // appending each button so they appear on the document\n choicesEl.appendChild(choiceBtn);\n\n})\n}", "function handleClick(e) {\n var clicked = e.target.textContent //Gets text of clicked button\n \n if (clicked === question.capital){\n setScore(score+1)\n\n }\n if (questionNumber === 10){\n setGameOver(true)\n \n }\n setQuestionNumber(questionNumber+1)\n }", "function handleOptionClick(e) {\r\n // unselect all\r\n unselectOption();\r\n\r\n // select the clicked item\r\n e.target.classList.add(\"active\");\r\n\r\n // save answer\r\n answers[activeQuestion] = parseInt(e.target.dataset.option);\r\n console.log(answers);\r\n\r\n //unlock next button\r\n nextQuestionButton.disabled = false;\r\n}", "function Choice() {\n if (grid.choice.checked)\n choice = true;\n else\n choice = false;\n draw();\n}", "function onClickAnswer() {\n\t\t$('.btn').on(\"click\", function() {\n\t\t\tvar buttonClick = parseInt($(this).attr('value'));\n\t\t\tif(buttonClick === qsArray[currentIndex].correctanswer) {\n\t\t\t\tcorrectAnswer();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tincorrectAnswer();\n\t\t\t}\n\t\t});\n\t}", "function getUserChoice(event){\r\n\r\n switch (event.target.className){ //see which choice the user clicked and assigned it to a variable\r\n case 'rock':\r\n userChoice='rock';\r\n game(); //for each case call the game function which will take computers choice and call the get result function.I could call tha game function only one time after the switch statement,but there was a bug when i cliked anywhere in the div container cause this is where i placed the addEventListener.So everytime the user clicked anywhere except the choices(images),the code would execute and print unexpected results.So now the code executes only when the user specifically clicks on the images.\r\n break;\r\n case 'paper':\r\n userChoice='paper';\r\n game();\r\n break;\r\n case 'scissors':\r\n userChoice='scissors';\r\n game();\r\n break;\r\n }\r\n\r\n \r\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert Koa legacy generatorbased middleware to modern promisebased middleware.
function convert (mw) { if (typeof mw !== 'function') { throw new TypeError('middleware must be a function') } // assume it's Promise-based middleware if ( mw.constructor.name !== 'GeneratorFunction' && mw.constructor.name !== 'AsyncGeneratorFunction' ) { return mw } const converted = function (ctx, next) { return co.call( ctx, mw.call( ctx, (function * (next) { return yield next() })(next) )) } converted._name = mw._name || mw.name return converted }
[ "function toPromise(v) {\n\tif (isGenerator(v) || isGenerator(v)) return fo(v);\n\tif (v.then) return v;\n\tif (typeof v === 'function') {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tv((error, res) => error ? reject(error) : resolve(res));\n\t\t});\n\t}\n\t// Magic array handler\n\tif (Array.isArray(v)) return Promise.all(v.map(toPromise));\n\treturn Promise.reject(new Error(`Invalid yield ${v}`));\n}", "function promiseMiddleware() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var PROMISE_TYPE_SUFFIXES = config.promiseTypeSuffixes || defaultTypes;\n var PROMISE_TYPE_DELIMITER = config.promiseTypeDelimiter || '_';\n\n return function (ref) {\n var dispatch = ref.dispatch;\n\n\n return function (next) {\n return function (action) {\n\n /**\n * Instantiate variables to hold:\n * (1) the promise\n * (2) the data for optimistic updates\n */\n var promise = void 0;\n var data = void 0;\n\n /**\n * There are multiple ways to dispatch a promise. The first step is to\n * determine if the promise is defined:\n * (a) explicitly (action.payload.promise is the promise)\n * (b) implicitly (action.payload is the promise)\n * (c) as an async function (returns a promise when called)\n *\n * If the promise is not defined in one of these three ways, we don't do\n * anything and move on to the next middleware in the middleware chain.\n */\n\n // Step 1a: Is there a payload?\n if (action.payload) {\n var PAYLOAD = action.payload;\n\n // Step 1.1: Is the promise implicitly defined?\n if (Object(_isPromise_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(PAYLOAD)) {\n promise = PAYLOAD;\n }\n\n // Step 1.2: Is the promise explicitly defined?\n else if (Object(_isPromise_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(PAYLOAD.promise)) {\n promise = PAYLOAD.promise;\n data = PAYLOAD.data;\n }\n\n // Step 1.3: Is the promise returned by an async function?\n else if (typeof PAYLOAD === 'function' || typeof PAYLOAD.promise === 'function') {\n promise = PAYLOAD.promise ? PAYLOAD.promise() : PAYLOAD();\n data = PAYLOAD.promise ? PAYLOAD.data : undefined;\n\n // Step 1.3.1: Is the return of action.payload a promise?\n if (!Object(_isPromise_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(promise)) {\n\n // If not, move on to the next middleware.\n return next(_extends({}, action, {\n payload: promise\n }));\n }\n }\n\n // Step 1.4: If there's no promise, move on to the next middleware.\n else {\n return next(action);\n }\n\n // Step 1b: If there's no payload, move on to the next middleware.\n } else {\n return next(action);\n }\n\n /**\n * Instantiate and define constants for:\n * (1) the action type\n * (2) the action meta\n */\n var TYPE = action.type;\n var META = action.meta;\n\n /**\n * Instantiate and define constants for the action type suffixes.\n * These are appended to the end of the action type.\n */\n\n var _PROMISE_TYPE_SUFFIXE = _slicedToArray(PROMISE_TYPE_SUFFIXES, 3),\n _PENDING = _PROMISE_TYPE_SUFFIXE[0],\n _FULFILLED = _PROMISE_TYPE_SUFFIXE[1],\n _REJECTED = _PROMISE_TYPE_SUFFIXE[2];\n\n /**\n * Function: getAction\n * Description: This function constructs and returns a rejected\n * or fulfilled action object. The action object is based off the Flux\n * Standard Action (FSA).\n *\n * Given an original action with the type FOO:\n *\n * The rejected object model will be:\n * {\n * error: true,\n * type: 'FOO_REJECTED',\n * payload: ...,\n * meta: ... (optional)\n * }\n *\n * The fulfilled object model will be:\n * {\n * type: 'FOO_FULFILLED',\n * payload: ...,\n * meta: ... (optional)\n * }\n */\n\n\n var getAction = function getAction(newPayload, isRejected) {\n return _extends({\n // Concatentate the type string property.\n type: [TYPE, isRejected ? _REJECTED : _FULFILLED].join(PROMISE_TYPE_DELIMITER)\n\n }, newPayload === null || typeof newPayload === 'undefined' ? {} : {\n payload: newPayload\n }, META !== undefined ? { meta: META } : {}, isRejected ? {\n error: true\n } : {});\n };\n\n /**\n * Function: handleReject\n * Calls: getAction to construct the rejected action\n * Description: This function dispatches the rejected action and returns\n * the original Error object. Please note the developer is responsible\n * for constructing and throwing an Error object. The middleware does not\n * construct any Errors.\n */\n var handleReject = function handleReject(reason) {\n var rejectedAction = getAction(reason, true);\n dispatch(rejectedAction);\n\n throw reason;\n };\n\n /**\n * Function: handleFulfill\n * Calls: getAction to construct the fullfilled action\n * Description: This function dispatches the fulfilled action and\n * returns the success object. The success object should\n * contain the value and the dispatched action.\n */\n var handleFulfill = function handleFulfill() {\n var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n var resolvedAction = getAction(value, false);\n dispatch(resolvedAction);\n\n return { value: value, action: resolvedAction };\n };\n\n /**\n * First, dispatch the pending action:\n * This object describes the pending state of a promise and will include\n * any data (for optimistic updates) and/or meta from the original action.\n */\n next(_extends({\n // Concatentate the type string.\n type: [TYPE, _PENDING].join(PROMISE_TYPE_DELIMITER)\n\n }, data !== undefined ? { payload: data } : {}, META !== undefined ? { meta: META } : {}));\n\n /**\n * Second, dispatch a rejected or fulfilled action and move on to the\n * next middleware.\n */\n return promise.then(handleFulfill, handleReject);\n };\n };\n };\n}", "function promiseMiddleware() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var PROMISE_TYPE_SUFFIXES = config.promiseTypeSuffixes || defaultTypes;\n var PROMISE_TYPE_DELIMITER = config.promiseTypeDelimiter || '_';\n return function (ref) {\n var dispatch = ref.dispatch;\n return function (next) {\n return function (action) {\n /**\n * Instantiate variables to hold:\n * (1) the promise\n * (2) the data for optimistic updates\n */\n var promise = void 0;\n var data = void 0;\n /**\n * There are multiple ways to dispatch a promise. The first step is to\n * determine if the promise is defined:\n * (a) explicitly (action.payload.promise is the promise)\n * (b) implicitly (action.payload is the promise)\n * (c) as an async function (returns a promise when called)\n *\n * If the promise is not defined in one of these three ways, we don't do\n * anything and move on to the next middleware in the middleware chain.\n */\n // Step 1a: Is there a payload?\n\n if (action.payload) {\n var PAYLOAD = action.payload; // Step 1.1: Is the promise implicitly defined?\n\n if ((0, _isPromise.default)(PAYLOAD)) {\n promise = PAYLOAD;\n } // Step 1.2: Is the promise explicitly defined?\n else if ((0, _isPromise.default)(PAYLOAD.promise)) {\n promise = PAYLOAD.promise;\n data = PAYLOAD.data;\n } // Step 1.3: Is the promise returned by an async function?\n else if (typeof PAYLOAD === 'function' || typeof PAYLOAD.promise === 'function') {\n promise = PAYLOAD.promise ? PAYLOAD.promise() : PAYLOAD();\n data = PAYLOAD.promise ? PAYLOAD.data : undefined; // Step 1.3.1: Is the return of action.payload a promise?\n\n if (!(0, _isPromise.default)(promise)) {\n // If not, move on to the next middleware.\n return next(_extends({}, action, {\n payload: promise\n }));\n }\n } // Step 1.4: If there's no promise, move on to the next middleware.\n else {\n return next(action);\n } // Step 1b: If there's no payload, move on to the next middleware.\n\n } else {\n return next(action);\n }\n /**\n * Instantiate and define constants for:\n * (1) the action type\n * (2) the action meta\n */\n\n\n var TYPE = action.type;\n var META = action.meta;\n /**\n * Instantiate and define constants for the action type suffixes.\n * These are appended to the end of the action type.\n */\n\n var _PROMISE_TYPE_SUFFIXE = _slicedToArray(PROMISE_TYPE_SUFFIXES, 3),\n _PENDING = _PROMISE_TYPE_SUFFIXE[0],\n _FULFILLED = _PROMISE_TYPE_SUFFIXE[1],\n _REJECTED = _PROMISE_TYPE_SUFFIXE[2];\n /**\n * Function: getAction\n * Description: This function constructs and returns a rejected\n * or fulfilled action object. The action object is based off the Flux\n * Standard Action (FSA).\n *\n * Given an original action with the type FOO:\n *\n * The rejected object model will be:\n * {\n * error: true,\n * type: 'FOO_REJECTED',\n * payload: ...,\n * meta: ... (optional)\n * }\n *\n * The fulfilled object model will be:\n * {\n * type: 'FOO_FULFILLED',\n * payload: ...,\n * meta: ... (optional)\n * }\n */\n\n\n var getAction = function getAction(newPayload, isRejected) {\n return _extends({\n // Concatentate the type string property.\n type: [TYPE, isRejected ? _REJECTED : _FULFILLED].join(PROMISE_TYPE_DELIMITER)\n }, newPayload === null || typeof newPayload === 'undefined' ? {} : {\n payload: newPayload\n }, META !== undefined ? {\n meta: META\n } : {}, isRejected ? {\n error: true\n } : {});\n };\n /**\n * Function: handleReject\n * Calls: getAction to construct the rejected action\n * Description: This function dispatches the rejected action and returns\n * the original Error object. Please note the developer is responsible\n * for constructing and throwing an Error object. The middleware does not\n * construct any Errors.\n */\n\n\n var handleReject = function handleReject(reason) {\n var rejectedAction = getAction(reason, true);\n dispatch(rejectedAction);\n throw reason;\n };\n /**\n * Function: handleFulfill\n * Calls: getAction to construct the fullfilled action\n * Description: This function dispatches the fulfilled action and\n * returns the success object. The success object should\n * contain the value and the dispatched action.\n */\n\n\n var handleFulfill = function handleFulfill() {\n var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var resolvedAction = getAction(value, false);\n dispatch(resolvedAction);\n return {\n value: value,\n action: resolvedAction\n };\n };\n /**\n * First, dispatch the pending action:\n * This object describes the pending state of a promise and will include\n * any data (for optimistic updates) and/or meta from the original action.\n */\n\n\n next(_extends({\n // Concatentate the type string.\n type: [TYPE, _PENDING].join(PROMISE_TYPE_DELIMITER)\n }, data !== undefined ? {\n payload: data\n } : {}, META !== undefined ? {\n meta: META\n } : {}));\n /**\n * Second, dispatch a rejected or fulfilled action and move on to the\n * next middleware.\n */\n\n return promise.then(handleFulfill, handleReject);\n };\n };\n };\n}", "function promiseMiddleware() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var PROMISE_TYPE_SUFFIXES = config.promiseTypeSuffixes || defaultTypes;\n var PROMISE_TYPE_DELIMITER = config.promiseTypeDelimiter || '_';\n\n return function (ref) {\n var dispatch = ref.dispatch;\n\n\n return function (next) {\n return function (action) {\n\n /**\n * Instantiate variables to hold:\n * (1) the promise\n * (2) the data for optimistic updates\n */\n var promise = void 0;\n var data = void 0;\n\n /**\n * There are multiple ways to dispatch a promise. The first step is to\n * determine if the promise is defined:\n * (a) explicitly (action.payload.promise is the promise)\n * (b) implicitly (action.payload is the promise)\n * (c) as an async function (returns a promise when called)\n *\n * If the promise is not defined in one of these three ways, we don't do\n * anything and move on to the next middleware in the middleware chain.\n */\n\n // Step 1a: Is there a payload?\n if (action.payload) {\n var PAYLOAD = action.payload;\n\n // Step 1.1: Is the promise implicitly defined?\n if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__isPromise_js__[\"a\" /* default */])(PAYLOAD)) {\n promise = PAYLOAD;\n }\n\n // Step 1.2: Is the promise explicitly defined?\n else if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__isPromise_js__[\"a\" /* default */])(PAYLOAD.promise)) {\n promise = PAYLOAD.promise;\n data = PAYLOAD.data;\n }\n\n // Step 1.3: Is the promise returned by an async function?\n else if (typeof PAYLOAD === 'function' || typeof PAYLOAD.promise === 'function') {\n promise = PAYLOAD.promise ? PAYLOAD.promise() : PAYLOAD();\n data = PAYLOAD.promise ? PAYLOAD.data : undefined;\n\n // Step 1.3.1: Is the return of action.payload a promise?\n if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__isPromise_js__[\"a\" /* default */])(promise)) {\n\n // If not, move on to the next middleware.\n return next(_extends({}, action, {\n payload: promise\n }));\n }\n }\n\n // Step 1.4: If there's no promise, move on to the next middleware.\n else {\n return next(action);\n }\n\n // Step 1b: If there's no payload, move on to the next middleware.\n } else {\n return next(action);\n }\n\n /**\n * Instantiate and define constants for:\n * (1) the action type\n * (2) the action meta\n */\n var TYPE = action.type;\n var META = action.meta;\n\n /**\n * Instantiate and define constants for the action type suffixes.\n * These are appended to the end of the action type.\n */\n\n var _PROMISE_TYPE_SUFFIXE = _slicedToArray(PROMISE_TYPE_SUFFIXES, 3),\n _PENDING = _PROMISE_TYPE_SUFFIXE[0],\n _FULFILLED = _PROMISE_TYPE_SUFFIXE[1],\n _REJECTED = _PROMISE_TYPE_SUFFIXE[2];\n\n /**\n * Function: getAction\n * Description: This function constructs and returns a rejected\n * or fulfilled action object. The action object is based off the Flux\n * Standard Action (FSA).\n *\n * Given an original action with the type FOO:\n *\n * The rejected object model will be:\n * {\n * error: true,\n * type: 'FOO_REJECTED',\n * payload: ...,\n * meta: ... (optional)\n * }\n *\n * The fulfilled object model will be:\n * {\n * type: 'FOO_FULFILLED',\n * payload: ...,\n * meta: ... (optional)\n * }\n */\n\n\n var getAction = function getAction(newPayload, isRejected) {\n return _extends({\n // Concatentate the type string property.\n type: [TYPE, isRejected ? _REJECTED : _FULFILLED].join(PROMISE_TYPE_DELIMITER)\n\n }, newPayload === null || typeof newPayload === 'undefined' ? {} : {\n payload: newPayload\n }, META !== undefined ? { meta: META } : {}, isRejected ? {\n error: true\n } : {});\n };\n\n /**\n * Function: handleReject\n * Calls: getAction to construct the rejected action\n * Description: This function dispatches the rejected action and returns\n * the original Error object. Please note the developer is responsible\n * for constructing and throwing an Error object. The middleware does not\n * construct any Errors.\n */\n var handleReject = function handleReject(reason) {\n var rejectedAction = getAction(reason, true);\n dispatch(rejectedAction);\n\n throw reason;\n };\n\n /**\n * Function: handleFulfill\n * Calls: getAction to construct the fullfilled action\n * Description: This function dispatches the fulfilled action and\n * returns the success object. The success object should\n * contain the value and the dispatched action.\n */\n var handleFulfill = function handleFulfill() {\n var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n var resolvedAction = getAction(value, false);\n dispatch(resolvedAction);\n\n return { value: value, action: resolvedAction };\n };\n\n /**\n * First, dispatch the pending action:\n * This object describes the pending state of a promise and will include\n * any data (for optimistic updates) and/or meta from the original action.\n */\n next(_extends({\n // Concatentate the type string.\n type: [TYPE, _PENDING].join(PROMISE_TYPE_DELIMITER)\n\n }, data !== undefined ? { payload: data } : {}, META !== undefined ? { meta: META } : {}));\n\n /**\n * Second, dispatch a rejected or fulfilled action and move on to the\n * next middleware.\n */\n return promise.then(handleFulfill, handleReject);\n };\n };\n };\n}", "function promiseMiddleware() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var PROMISE_TYPE_SUFFIXES = config.promiseTypeSuffixes || defaultTypes;\n var PROMISE_TYPE_DELIMITER = config.promiseTypeDelimiter || '_';\n\n return function (ref) {\n var dispatch = ref.dispatch;\n\n\n return function (next) {\n return function (action) {\n\n /**\n * Instantiate variables to hold:\n * (1) the promise\n * (2) the data for optimistic updates\n */\n var promise = void 0;\n var data = void 0;\n\n /**\n * There are multiple ways to dispatch a promise. The first step is to\n * determine if the promise is defined:\n * (a) explicitly (action.payload.promise is the promise)\n * (b) implicitly (action.payload is the promise)\n * (c) as an async function (returns a promise when called)\n *\n * If the promise is not defined in one of these three ways, we don't do\n * anything and move on to the next middleware in the middleware chain.\n */\n\n // Step 1a: Is there a payload?\n if (action.payload) {\n var PAYLOAD = action.payload;\n\n // Step 1.1: Is the promise implicitly defined?\n if (Object(__WEBPACK_IMPORTED_MODULE_0__isPromise_js__[\"a\" /* default */])(PAYLOAD)) {\n promise = PAYLOAD;\n }\n\n // Step 1.2: Is the promise explicitly defined?\n else if (Object(__WEBPACK_IMPORTED_MODULE_0__isPromise_js__[\"a\" /* default */])(PAYLOAD.promise)) {\n promise = PAYLOAD.promise;\n data = PAYLOAD.data;\n }\n\n // Step 1.3: Is the promise returned by an async function?\n else if (typeof PAYLOAD === 'function' || typeof PAYLOAD.promise === 'function') {\n promise = PAYLOAD.promise ? PAYLOAD.promise() : PAYLOAD();\n data = PAYLOAD.promise ? PAYLOAD.data : undefined;\n\n // Step 1.3.1: Is the return of action.payload a promise?\n if (!Object(__WEBPACK_IMPORTED_MODULE_0__isPromise_js__[\"a\" /* default */])(promise)) {\n\n // If not, move on to the next middleware.\n return next(_extends({}, action, {\n payload: promise\n }));\n }\n }\n\n // Step 1.4: If there's no promise, move on to the next middleware.\n else {\n return next(action);\n }\n\n // Step 1b: If there's no payload, move on to the next middleware.\n } else {\n return next(action);\n }\n\n /**\n * Instantiate and define constants for:\n * (1) the action type\n * (2) the action meta\n */\n var TYPE = action.type;\n var META = action.meta;\n\n /**\n * Instantiate and define constants for the action type suffixes.\n * These are appended to the end of the action type.\n */\n\n var _PROMISE_TYPE_SUFFIXE = _slicedToArray(PROMISE_TYPE_SUFFIXES, 3),\n _PENDING = _PROMISE_TYPE_SUFFIXE[0],\n _FULFILLED = _PROMISE_TYPE_SUFFIXE[1],\n _REJECTED = _PROMISE_TYPE_SUFFIXE[2];\n\n /**\n * Function: getAction\n * Description: This function constructs and returns a rejected\n * or fulfilled action object. The action object is based off the Flux\n * Standard Action (FSA).\n *\n * Given an original action with the type FOO:\n *\n * The rejected object model will be:\n * {\n * error: true,\n * type: 'FOO_REJECTED',\n * payload: ...,\n * meta: ... (optional)\n * }\n *\n * The fulfilled object model will be:\n * {\n * type: 'FOO_FULFILLED',\n * payload: ...,\n * meta: ... (optional)\n * }\n */\n\n\n var getAction = function getAction(newPayload, isRejected) {\n return _extends({\n // Concatentate the type string property.\n type: [TYPE, isRejected ? _REJECTED : _FULFILLED].join(PROMISE_TYPE_DELIMITER)\n\n }, newPayload === null || typeof newPayload === 'undefined' ? {} : {\n payload: newPayload\n }, META !== undefined ? { meta: META } : {}, isRejected ? {\n error: true\n } : {});\n };\n\n /**\n * Function: handleReject\n * Calls: getAction to construct the rejected action\n * Description: This function dispatches the rejected action and returns\n * the original Error object. Please note the developer is responsible\n * for constructing and throwing an Error object. The middleware does not\n * construct any Errors.\n */\n var handleReject = function handleReject(reason) {\n var rejectedAction = getAction(reason, true);\n dispatch(rejectedAction);\n\n throw reason;\n };\n\n /**\n * Function: handleFulfill\n * Calls: getAction to construct the fullfilled action\n * Description: This function dispatches the fulfilled action and\n * returns the success object. The success object should\n * contain the value and the dispatched action.\n */\n var handleFulfill = function handleFulfill() {\n var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n var resolvedAction = getAction(value, false);\n dispatch(resolvedAction);\n\n return { value: value, action: resolvedAction };\n };\n\n /**\n * First, dispatch the pending action:\n * This object describes the pending state of a promise and will include\n * any data (for optimistic updates) and/or meta from the original action.\n */\n next(_extends({\n // Concatentate the type string.\n type: [TYPE, _PENDING].join(PROMISE_TYPE_DELIMITER)\n\n }, data !== undefined ? { payload: data } : {}, META !== undefined ? { meta: META } : {}));\n\n /**\n * Second, dispatch a rejected or fulfilled action and move on to the\n * next middleware.\n */\n return promise.then(handleFulfill, handleReject);\n };\n };\n };\n}", "resolveMiddleware(middleware) {\n return typeof middleware === 'function'\n ? {\n type: 'lazy-import',\n value: middleware,\n args: [],\n }\n : Object.assign(this.resolver.resolve(`${middleware}.handle`), { args: [] });\n }", "function koaify() {\n viralify('./', ['koa-*', 'fax-*'], 'es6ify', function(err) {\n if (err) return console.error(err);\n });\n}", "[wrapWithExpressNext](handler) {\n if (handler instanceof Promise) {\n throw new ContentError('Express handlers need to be (req, res, next) or aysnc (req, res, next)')\n }\n\n if (handler.constructor.name !== 'AsyncFunction') {\n return handler\n }\n\n return (req, res, nextOriginal) => {\n // preventing double call on next()\n let nextCalled = false\n const next = (...args) => {\n if (nextCalled === true) {\n return\n }\n nextCalled = true\n\n nextOriginal(...args)\n }\n\n // express can't take in a promise (async func), so have to proxy it\n const handlerProxy = async callback => {\n try {\n await handler(req, res, callback)\n } catch(err) {\n callback(err)\n }\n }\n\n handlerProxy(err => next(err))\n }\n }", "function middleware(request, response, next) {}", "getKoaWebhookMiddleware() {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n return async (context) => {\r\n const update = context.request.body;\r\n const { webhookSecret, webhookConfirmation } = this.options;\r\n if (webhookSecret !== undefined && update.secret !== webhookSecret) {\r\n context.status = 403;\r\n return;\r\n }\r\n if (update.type === 'confirmation') {\r\n if (webhookConfirmation === undefined) {\r\n context.status = 500;\r\n return;\r\n }\r\n context.body = webhookConfirmation;\r\n return;\r\n }\r\n context.body = 'ok';\r\n context.set('connection', 'keep-alive');\r\n /* Do not delay server response */\r\n setImmediate(() => this.webhookHandler(update));\r\n };\r\n }", "getKoaWebhookMiddleware() {\r\n return this.webhookTransport.getKoaWebhookMiddleware();\r\n }", "function toExpressMiddleware(ctx) {\n return async (req, res, next) => {\n const middlewareCtx = new types_1.MiddlewareContext(req, res, ctx);\n try {\n const result = await invokeMiddleware(middlewareCtx);\n if (result !== res) {\n next();\n }\n }\n catch (err) {\n next(err);\n }\n };\n}", "build() {\n // Return the express interface middleware\n return (req, res, next) => __awaiter(this, void 0, void 0, function* () {\n const { timestamp, signature } = util_1.parseHeaders(req, this.options.maxTimeout);\n // Request timestamp signature expired\n if (!timestamp) {\n throw new ts_framework_1.HttpError(\"Invalid request signature: timestamp invalid or expired\", ts_framework_1.HttpCode.Client.BAD_REQUEST);\n }\n // Generate the expected request signature\n const secret = yield this.secret(req, res);\n const computedSignature = util_1.generateSignaturePayload(req, secret, this.options.signedBodyMethods);\n // Validate the request signature\n if (signature && signature === computedSignature) {\n return next();\n }\n // Incorrect request signature\n throw new ts_framework_1.HttpError(\"Invalid request signature: incorrect format\", ts_framework_1.HttpCode.Client.BAD_REQUEST);\n });\n }", "function promisifyMiddleware(clientOrServer) {\n const fn = clientOrServer.use;\n clientOrServer.use = function (...handlers) {\n for (const handler_ of handlers) {\n // We might be dealing with dynamic middleware.\n const handler = handler_.length < 3 ? handler_(this) : handler_;\n fn.call(this, promisifyHandler(handler));\n }\n return this;\n };\n return clientOrServer;\n\n function promisifyHandler(handler) {\n return function (wreq, wres, next) {\n let reject, resolve, prev;\n const promise = new Promise(function (resolve_, reject_) {\n resolve = resolve_;\n reject = reject_;\n });\n let ret;\n try {\n ret = handler.call(this, wreq, wres, (err, cb) => {\n if (cb) {\n // Always use the callback API if one is provided here.\n next(err, cb);\n return;\n }\n next(err, function (err, prev_) {\n prev = prev_;\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n });\n return promise.bind(this);\n });\n } catch (err) {\n // If an error is thrown synchronously in the handler, we'll be\n // accommodating and assume that this is a promise's rejection.\n next(err);\n return;\n }\n if (ret && typeof ret.then === 'function') {\n // Cheap way of testing whether `ret` is a promise. If so, we use the\n // promise-based API: we wait until the returned promise is complete to\n // trigger any backtracking.\n ret.then(done, done);\n } else {\n promise.then(done, done);\n }\n\n function done(err) {\n if (prev) {\n prev(err);\n } else {\n // This will happen if the returned promise is complete before the\n // one returned by `next()` is. There is no clear ideal behavior\n // here, to be safe we will throw an error.\n const cause = new Error('early middleware return');\n promise.finally(function () { prev(cause); });\n }\n }\n };\n }\n}", "getMiddleware() {\n const router = express.Router();\n router.options(this.path, (request, response, next) => {\n if (!this.handleAbuseProtectionRequests(request, response)) {\n next();\n }\n });\n router.post(this.path, (request, response, next) => __awaiter(this, void 0, void 0, function* () {\n try {\n if (!(yield this._cloudEventsHandler.processRequest(request, response))) {\n next();\n }\n }\n catch (err) {\n next(err);\n }\n }));\n return router;\n }", "middleware() {\n let kepi = this;\n return function(req, res, next) {\n kepi.applyTo(res);\n next();\n }\n }", "static recovertPayloadMiddleware() {\n return (req, res, next) => __awaiter(this, void 0, void 0, function* () {\n if (req.user && req.user.type === 'user-token-2' && req.user.organizacion) {\n const { getTokenPayload } = require('./auth.controller');\n const payload = yield getTokenPayload(req.token, req.user);\n req.user = {\n id: req.user.id,\n type: req.user.type,\n account_id: req.user.account_id,\n usuario: payload.usuario,\n profesional: payload.profesional,\n permisos: payload.permisos,\n organizacion: payload.organizacion,\n feature: payload.feature\n };\n return next();\n }\n else {\n return next();\n }\n });\n }", "function initMiddleware(middleware) {\n return (req, res) => new Promise((resolve, reject) => {\n middleware(req, res, result => {\n if (result instanceof Error) {\n return reject(result);\n }\n\n return resolve(result);\n });\n });\n}", "getMiddleware(event) {\n const request = event.request.clone();\n\n return {\n get: async function () { return await fetch(request); }\n };\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }