query
stringlengths 9
14.6k
| document
stringlengths 8
5.39M
| metadata
dict | negatives
sequencelengths 0
30
| negative_scores
sequencelengths 0
30
| document_score
stringlengths 5
10
| document_rank
stringclasses 2
values |
---|---|---|---|---|---|---|
Example binToHex(["0111110", "1000000", "1000000", "1111110", "1000001", "1000001", "0111110"]) | function binToHex(bins) {
return bins.map(bin => ("00" + (parseInt(bin, 2).toString(16))).substr(-2).toUpperCase()).join("");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function binToHex(a) {\r\n\tvar newVal = \"\";\r\n\tfor (i = 0; i < a.length/8; i++) \r\n\t\tnewVal += (\"00\" + parseInt(a.slice(8*i, 8*i+8),2).toString(16)).slice(-2);\r\n\treturn newVal;\r\n}",
"function binToHex(bin) {\n for (var fourBitChunks = [], c = 0; c < bin.length; c += 4)\n fourBitChunks.push(parseInt(bin.substr(c, 4), 2).toString(16).toUpperCase());\n return fourBitChunks;\n}",
"function hex(x) {\n for (var i = 0; i < x.length; i++)\n x[i] = makeHex(x[i]);\n return x.join('');\n}",
"function binl2hex(binarray) \n{ \n var hex_tab = \"0123456789abcdef\" \n var str = \"\" \n for(var i = 0; i < binarray.length * 4; i++) \n { \n str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + \n hex_tab.charAt((binarray[i>>2] >> ((i%4)*8)) & 0xF) \n } \n return str \n}",
"function binl2hex(binarray) \n{ \nvar hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\"; \nvar str = \"\"; \nfor(var i = 0; i < binarray.length * 4; i++) \n{ \nstr += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + \nhex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); \n} \nreturn str; \n}",
"function binaryToHexString(bin) {\n let result = \"\";\n binToHex(bin).forEach(str => {result += str});\n return result;\n}",
"function hexlify (arr) {\n return arr.map(function (byte) {\n return ('0' + (byte & 0xFF).toString(16)).slice(-2);\n }).join('');\n}",
"function binHexa(obj) {\r\n var hexaVal =[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"];\r\n var decVal =[\"0000\",\"0001\",\"0010\",\"0011\",\"0100\",\"0101\",\"0110\",\"0111\",\"1000\",\"1001\",\"1010\",\"1011\",\"1100\",\"1101\",\"1110\",\"1111\"];\r\n var pas0;\r\n var valeurHex=\"\";\r\n var valeurDec1=obj[0]+obj[1]+obj[2]+obj[3];\r\n var valeurDec2=obj[4]+obj[5]+obj[6]+obj[7];\r\n for(pas0=0;pas0<hexaVal.length;pas0++){\r\n if (valeurDec1==decVal[pas0]){\r\n valeurHex=hexaVal[pas0];\r\n }\r\n }\r\n for(pas0=0;pas0<hexaVal.length;pas0++){\r\n if (valeurDec2==decVal[pas0]){\r\n valeurHex+=hexaVal[pas0];\r\n }\r\n }\r\n return valeurHex;\r\n}",
"function binb2hex(binarray){\n\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n\n var str = \"\";\n\n for (var i = 0; i < binarray.length * 4; i++) {\n\n str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) +\n\n hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);\n\n }\n\n return str;\n\n }",
"function asHex(value) {\n return Array.from(value).map(function (i) {\n return (\"00\" + i.toString(16)).slice(-2);\n }).join('');\n}",
"function binl2hex(binarray)\r\n{\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for(var i = 0; i < binarray.length * 4; i++)\r\n {\r\n str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +\r\n hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);\r\n }\r\n return str;\r\n}",
"function binl2hex(binarray)\r\n{\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for(var i = 0; i < binarray.length * 4; i++)\r\n {\r\n str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +\r\n hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);\r\n }\r\n return str;\r\n}",
"function binl2hex(binarray)\r\n{\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for(var i = 0; i < binarray.length * 4; i++)\r\n {\r\n str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +\r\n hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);\r\n }\r\n return str;\r\n}",
"function hexToBin(a) {\r\n\tvar newVal = \"\";\r\n\tfor (i = 0; i < a.length; i++) \r\n\t\tnewVal += (\"0000\" + parseInt(a.charAt(i),16).toString(2)).slice(-4);\r\n\treturn newVal;\r\n}",
"function binb2hex( data )\n{\n for( var hex='', i=0; i<data.length; i++ )\n {\n while( data[i] < 0 ) data[i] += 0x100000000;\n hex += ('0000000'+(data[i].toString(16))).slice( -8 );\n }\n return hex.toUpperCase();\n}",
"function asHex(value) {\n return Array.from(value)\n .map(function (i) { return (\"00\" + i.toString(16)).slice(-2); })\n .join('');\n}",
"function binl2hex(binarray) {\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for (var i = 0; i < binarray.length * 4; i++) {\n str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) +\n hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 )) & 0xF);\n }\n return str;\n}",
"function binb2hex(binarray) {\n\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n\n var str = \"\";\n\n for (var i = 0; i < binarray.length * 4; i++) {\n\n str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) +\n\n hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);\n\n }\n\n return str;\n\n}",
"function binb2hex(binarray) {\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for (var i = 0; i < binarray.length * 4; i++) {\r\n str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) + hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);\r\n }\r\n return str;\r\n}",
"function binl2hex(binarray) {\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for (var i = 0; i < binarray.length * 4; i++) {\n str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) +\n hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 )) & 0xF);\n }\n return str;\n }",
"function binb2hex(binarray)\r\n{\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for(var i = 0; i < binarray.length * 4; i++)\r\n {\r\n str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +\r\n hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);\r\n }\r\n return str;\r\n}",
"function binl2hex(binarray) {\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n\n for (var i = 0; i < binarray.length * 4; i++) {\n str += hex_tab.charAt(binarray[i >> 2] >> i % 4 * 8 + 4 & 0xF) + hex_tab.charAt(binarray[i >> 2] >> i % 4 * 8 & 0xF);\n }\n\n return str;\n}",
"function binb2hex(binarray) {\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for (var i = 0; i < binarray.length * 4; i++) {\n str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) + hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);\n }\n return str;\n}",
"function binl2hex(binarray) {\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for (var i = 0; i < binarray.length * 4; i++) {\r\n str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) +\r\n hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 )) & 0xF);\r\n }\r\n return str;\r\n }",
"function binb2hex(binarray) {\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for (var i = 0; i < binarray.length * 4; i++) {\r\n str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) +\r\n hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);\r\n }\r\n return str;\r\n}",
"function binl2hex(binarray)\n{\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for(var i = 0; i < binarray.length * 4; i++)\n {\n str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +\n hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);\n }\n return str;\n}",
"function binl2hex(binarray)\n{\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for(var i = 0; i < binarray.length * 4; i++)\n {\n str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +\n hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);\n }\n return str;\n}",
"function arrayOfHexaColors() {\n let output = [];\n let arglength = arguments.length;\n if (arglength > 0) {\n let input = arguments;\n for (let i = 0; i < arglength; i++) {\n output.push(arguments[i].toString(16));\n }\n }\n return output;\n}",
"function toHexString(arr) {\n return Array.prototype.map.call(arr, (x) => (\"00\" + x.toString(16)).slice(-2)).join(\"\");\n}",
"function array_to_hex(x){\r\n var hexstring = \"0123456789ABCDEF\";\r\n /* var hexstring = \"0123456789abcdef\"; */\r\n var output_string = \"\";\r\n \r\n for (var i = 0; i < x.length * 4; i++) {\r\n var tmp_i = shift_right(i, 2);\r\n \r\n output_string += hexstring.charAt((shift_right(x[tmp_i], ((i % 4) * 8 + 4))) & 0xF) +\r\n hexstring.charAt(shift_right(x[tmp_i], ((i % 4) * 8)) & 0xF);\r\n }\r\n return output_string;\r\n}"
] | [
"0.7413676",
"0.70409733",
"0.7034735",
"0.6969076",
"0.69535136",
"0.69194937",
"0.68874204",
"0.6870118",
"0.6826296",
"0.6817666",
"0.680198",
"0.680198",
"0.680198",
"0.67952865",
"0.67902726",
"0.67830145",
"0.6762924",
"0.6740234",
"0.67265904",
"0.6723809",
"0.67170584",
"0.67115045",
"0.670939",
"0.6707228",
"0.67068",
"0.67042863",
"0.67042863",
"0.66927475",
"0.6653412",
"0.66495794"
] | 0.74536294 | 0 |
Build a list of configuration (custom launcher names). | function buildConfiguration(type, target) {
const targetBrowsers = Object.keys(browserConfig)
.map(browserName => [browserName, browserConfig[browserName][type]])
.filter(([, config]) => config.target === target)
.map(([browserName]) => browserName);
// For browsers that run locally, the browser name shouldn't be prefixed with the target
// platform. We only prefix the external platforms in order to distinguish between
// local and remote browsers in our "customLaunchers" for Karma.
if (target === 'local') {
return targetBrowsers;
}
return targetBrowsers.map(browserName => {
return `${target.toUpperCase()}_${browserName.toUpperCase()}`;
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static Configurators() {\n const customizeNothing = []; // no customization steps\n return [ customizeNothing ];\n }",
"function updateArgProcessorList() {\n var argProcessorList = new commandLineUtils.ArgProcessorList();\n\n // App type\n addProcessorFor(argProcessorList, 'apptype', 'Enter your application type (native, hybrid_remote, or hybrid_local):', 'App type must be native, hybrid_remote, or hybrid_local.', \n function(val) { return ['native', 'hybrid_remote', 'hybrid_local'].indexOf(val) >= 0; });\n\n // App name\n addProcessorFor(argProcessorList, 'appname', 'Enter your application name:', 'Invalid value for application name: \\'$val\\'.', /^\\S+$/);\n\n // Output dir\n addProcessorForOptional(argProcessorList, 'outputdir', 'Enter the output directory for your app (defaults to the current directory):');\n return argProcessorList;\n}",
"configLocator (options = {}) {\n let goinstallation = atom.config.get('go-config.goinstallation')\n let stat = this.statishSync(goinstallation)\n if (isTruthy(stat)) {\n let d = goinstallation\n if (stat.isFile()) {\n d = path.dirname(goinstallation)\n }\n return this.findExecutablesInPath(d, this.executables, options)\n }\n\n return []\n }",
"function configureRuntime () {\n return (\n build()\n // Brand is used for default config files (if any).\n .brand(BRAND)\n // The default plugin is the directory we're in right now, so\n // the commands sub-directory will contain the first right of\n // refusal to handle user's requests.\n .loadDefault(__dirname)\n // TODO: maybe there's other places you'd like to load plugins from?\n // .load(`~/.${BRAND}`)\n\n // These are the magic tokens found inside command js sources\n // which plugin authors use to specify the command users can type\n // as well as the help they see.\n .token('commandName', `${BRAND}Command`)\n .token('commandDescription', `${BRAND}Description`)\n // let's build it\n .createRuntime()\n )\n}",
"generateLaunchAgentPlist() {\n const programArguments = ['/usr/local/bin/gsts']\n\n for (let [key, value] of Object.entries(this.args)) {\n if (key.includes('daemon') || value === undefined) {\n continue;\n }\n\n programArguments.push(`--${key}${typeof value === 'boolean' ? '' : `=${value}`}`);\n }\n\n const payload = {\n Label: PROJECT_NAMESPACE,\n EnvironmentVariables: {\n PATH: '/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin'\n },\n RunAtLoad: true,\n StartInterval: 600,\n StandardErrorPath: this.args['daemon-out-log-path'],\n StandardOutPath: this.args['daemon-error-log-path'],\n ProgramArguments: programArguments\n };\n\n return plist.build(payload);\n }",
"get miniConfig() {\n return [\n {\n type: \"button-group\",\n buttons: [\n this.boldButton,\n this.italicButton,\n this.removeFormatButton,\n ],\n },\n this.linkButtonGroup,\n this.scriptButtonGroup,\n {\n type: \"button-group\",\n buttons: [this.orderedListButton, this.unorderedListButton],\n },\n ];\n }",
"processConfig() {\n /** merge type for arrays */\n const action = actions.importConfig(this.config);\n this.store.dispatch(action);\n const { config: storedConfig } = this.store.getState();\n\n storedConfig.windows.forEach((miradorWindow, layoutOrder) => {\n const windowId = `window-${uuid()}`;\n const manifestId = miradorWindow.manifestId || miradorWindow.loadedManifest;\n\n this.store.dispatch(actions.addWindow({\n // these are default values ...\n id: windowId,\n layoutOrder,\n manifestId,\n thumbnailNavigationPosition: storedConfig.thumbnailNavigation.defaultPosition,\n // ... overridden by values from the window configuration ...\n ...miradorWindow,\n }));\n });\n }",
"list() {\n let config = this.readSteamerConfig();\n\n for (let key in config) {\n if (config.hasOwnProperty(key)) {\n this.info(key + '=' + config[key] || '');\n }\n }\n\n }",
"_splitConfig() {\n const res = [];\n if (typeof (this.options.targetXPath) !== 'undefined') {\n // everything revolves around an xpath\n if (Array.isArray(this.options.targetXPath)) {\n // group up custom classes according to index\n const groupedCustomClasses = this._groupCustomClasses();\n // need to ensure it's array and not string so that code doesnt mistakenly separate chars\n const renderToPathIsArray = Array.isArray(this.options.renderToPath);\n // a group should revolve around targetXPath\n // break up the array, starting from the first element\n this.options.targetXPath.forEach((xpath, inner) => {\n // deep clone as config may have nested objects\n const config = cloneDeep(this.options);\n // overwrite targetXPath\n config.targetXPath = xpath;\n // sync up renderToPath array\n if (renderToPathIsArray && typeof (this.options.renderToPath[inner]) !== 'undefined') {\n config.renderToPath = this.options.renderToPath[inner] ? this.options.renderToPath[inner] : null;\n } else {\n // by default, below parent of target\n config.renderToPath = '..';\n }\n // sync up relatedElementActions array\n if (this.options.relatedElementActions\n && typeof (this.options.relatedElementActions[inner]) !== 'undefined'\n && Array.isArray(this.options.relatedElementActions[inner])) {\n config.relatedElementActions = this.options.relatedElementActions[inner];\n }\n // sync up customClasses\n if (typeof (groupedCustomClasses[inner]) !== 'undefined') {\n config.customClasses = groupedCustomClasses[inner];\n }\n // duplicate ignoredPriceElements string / array if exists\n if (this.options.ignoredPriceElements) {\n config.ignoredPriceElements = this.options.ignoredPriceElements;\n }\n // that's all, append\n res.push(config);\n });\n } else {\n // must be a single string\n res.push(this.options);\n }\n }\n return res;\n }",
"getActiveConfigurations() {\n return __awaiter(this, void 0, void 0, function* () {\n return yield Gestalt_1.Gestalt.get(`/bots/${this.bot.id}/clients/${this.type}`);\n });\n }",
"function loadConfigs() {\n if (allthings.configs !== null) {\n for (let i = 0; i < allthings.configs.length; i++) {\n let opt = `Team:${allthings.configs[i].team} Name:${\n\tallthings.configs[i].name\n }`;\n var el = document.createElement(\"option\");\n el.name = opt;\n el.textContent = opt;\n el.value = opt;\n document.getElementById(\"selectConfig\").appendChild(el);\n }\n }\n}",
"generateConfigs() {\n this._createDirs();\n this._readFiles(this.source)\n .then(files => {\n console.log('Loaded ', files.length, ' files');\n const configs = this._loadConfigs(files);\n const common = this._getCommonJson(configs);\n\n this._writeData(common, 'default', 'json');\n this._generateFilesWithoutCommon(configs, common);\n this._generateCustomEnvironmentVariablesJson();\n })\n .catch(error => console.log(error));\n }",
"getEntries(configurationFiles) {\n let entries = [];\n try {\n if (!configurationFiles['angular-config'].generated) {\n const { parsed } = configurationFiles['angular-config'];\n entries = entries.concat(getAngularJSONEntries(parsed));\n } else {\n const { parsed } = configurationFiles['angular-cli'];\n entries = entries.concat(getAngularCLIEntries(parsed));\n }\n } catch (e) {\n console.warn(\n `${configurationFiles['angular-config'].path} is malformed: ${e.message}`\n );\n }\n if (\n configurationFiles.package.parsed &&\n configurationFiles.package.parsed.main\n ) {\n entries.push(path_1.absolute(configurationFiles.package.parsed.main));\n }\n entries.push('/src/main.ts');\n entries.push('/main.ts');\n return entries;\n }",
"function configureEntries (entryBase) {\n return function (entries, dir) {\n var app = path.basename(dir);\n var targets = glob.sync(dir + \"/**/target.js\");\n\n targets.forEach(function(target) {\n var targetName = path.basename(path.dirname(target));\n entries[app + \"__\" + targetName] = entryBase.slice().concat([target]);\n });\n\n return entries;\n }\n}",
"function createConfiguration() {\r\n switch (selected_layout_id) {\r\n case CONFIGS.ONE_DEVICE:\r\n _configManager.setConfig('test-1d', 'test-1d', 'bob', 'dev', 1, 1, device_array.slice(0));\r\n break;\r\n case CONFIGS.TWO_DEVICES_1:\r\n _configManager.setConfig('test-2d1', 'test-2d', 'bob', 'dev', 2, 1, device_array.slice(0));\r\n break;\r\n case CONFIGS.TWO_DEVICES_2:\r\n _configManager.setConfig('test-2d2', 'test-2d2', 'bob', 'dev', 1, 2, device_array.slice(0));\r\n break;\r\n case CONFIGS.THREE_DEVICES_3:\r\n _configManager.setConfig('test-3d1', 'test-3d1', 'bob', 'dev', 3, 1, device_array.slice(0));\r\n break;\r\n case CONFIGS.THREE_DEVICES_4:\r\n _configManager.setConfig('test-3d2', 'test-3d2', 'bob', 'dev', 1, 3, device_array.slice(0));\r\n break;\r\n case CONFIGS.FOUR_DEVICES_5:\r\n _configManager.setConfig('test-4d1', 'test-4d1', 'bob', 'dev', 2, 2, device_array.slice(0));\r\n break;\r\n case CONFIGS.FOUR_DEVICES_6:\r\n _configManager.setConfig('test-4d2', 'test-4d2', 'bob', 'dev', 4, 1, device_array.slice(0));\r\n break;\r\n case CONFIGS.FIVE_DEVICES_7:\r\n _configManager.setConfig('test-5d', 'test-5d', 'bob', 'dev', 3, 2, device_array.slice(0));\r\n break;\r\n case CONFIGS.SIX_DEVICES_8:\r\n _configManager.setConfig('test-6d', 'test-6d', 'bob', 'dev', 3, 2, device_array.slice(0));\r\n break;\r\n }\r\n }",
"function listAllConfigs() {\n\n\t// list the title\n\tconsole.log( \"Available .gitconfig files:\\n\" );\n\n\t// return the symbolic link value\n\tfs.readlink( GITCONFIG, ( err, linkString ) => {\n\n\t\t// get the symbolic link value\n\t\t// -- returns the actual file name\n\t\tlinkString = linkString && path.basename( linkString );\n\n\t\t// read the contents of the directory\n\t\tfs.readdirSync( GITCONFIGS ).forEach( ( configurations ) => {\n\t\t\tif( configurations[ 0 ] !== '.' ) {\n\n\t\t\t\t// list the file names\n\t\t\t\t// -- if the active config mark it\n\t\t\t\tconsole.log(\n\t\t\t\t\t' %s %s',\n\t\t\t\t\tlinkString == configurations ? '>' : ' ',\n\t\t\t\t\tconfigurations\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t});\n}",
"function LoadConfig(){\n var cfg = fs.readFileSync(path.join(app.getPath('userData'), '../../Local/Crashday/config/launcher.config'))\n var colls = fs.readFileSync(path.join(app.getPath('userData'), '../../Local/Crashday/config/collections.config'), {flag: 'a+'})\n try{\n cfg = JSON.parse(cfg)\n } catch(e){\n cfg = {}\n }\n\n if(!cfg.hasOwnProperty('WorkshopItems'))\n cfg['WorkshopItems'] = []\n\n\n try{\n \tcolls = JSON.parse(colls)\n } catch(e){\n \tcolls = {}\n }\n\n if(!colls.hasOwnProperty('Collections'))\n colls['Collections'] = {}\n\n if(!colls.hasOwnProperty('CrashdayPath')){\n colls['CrashdayPath'] = ''\n }\n else{\n if(!fs.existsSync(colls['CrashdayPath'])) {\n colls['CrashdayPath'] = ''\n }\n }\n\n if(colls['CrashdayPath'] == '')\n $.toast({title: 'crashday.exe not found',\n content: 'Specify crashday.exe path in settings to enable auto scanning for newly subscribed mods. Otherwise default launcher has to be started after subscribing to new mods.',\n type: 'error', delay: 5000, container: $('#toaster')})\n\n //check for new mods in the workshop folder\n var p = path.join(colls['CrashdayPath'], '../../workshop/content/508980')\n var unlistedMods = 0\n var listedMods = 0\n var emptyFolders = 0\n var otherFiles = 0\n if(fs.existsSync(p)){\n fs.readdirSync(p).forEach(file => {\n var foundFile = false\n var name = parseInt(file, 10)\n //skip not numbered folder names\n if(name == NaN) {\n otherFiles++\n return\n }\n \n folder = fs.statSync(path.join(p, file))\n if(!folder.isDirectory()) {\n otherFiles++\n return\n }\n //check there is a mod file in mod folder\n files = fs.readdirSync(path.join(p, file))\n if(files.length == 0) {\n emptyFolders++\n return\n }\n\n for(n in cfg['WorkshopItems'])\n {\n if(cfg['WorkshopItems'][n][0] == name)\n {\n listedMods++\n foundFile = true\n }\n }\n if(!foundFile){\n cfg['WorkshopItems'].push([name, false])\n unlistedMods++\n }\n })\n }\n\n console.log(`Found ${listedMods} listed mods, ${unlistedMods} unlisted mods, ${emptyFolders} empty folders and ${otherFiles} other files in Workshop folder`)\n\n if(unlistedMods > 0){\n $.toast({title: 'New mods found',\n content: 'Launcher found and added ' + unlistedMods + ' new mods.',\n type: 'info', delay: 5000, container: $('#toaster')})\n }\n\n return [cfg, colls]\n}",
"_setLabels () {\n const target = '\"labels\":[\"os=linux\"';\n const labels = this._opts.Labels;\n if (!labels || !labels.length) {\n return;\n }\n\n const labelsStr = labels\n .map(str => `\"${str}\"`)\n .join(',');\n\n let newLaunchConfig = this\n ._getLaunchConfigCode()\n .map(str => {\n if (!(typeof str === 'string' || str instanceof String)) {\n return str\n }\n\n if (str.indexOf(target) == -1) {\n return str\n }\n\n return str.replace(target, `${target},${labelsStr}`)\n });\n\n this._setLaunchConfigCode(newLaunchConfig);\n }",
"function makeConfig() {\n\tif (config)\n\t\tthrow new Error('Config can only be created once');\n\n\toptions = project.custom.webpack || {}\n\t_.defaultsDeep(options,defaultOptions);\n\n\tif (options.config) {\n\t\tconfig = options.config;\n\t} else {\n\t\tlet configPath = path.resolve(options.configPath);\n\t\tif (!fs.existsSync(configPath)) {\n\t\t\tthrow new Error(`Unable to location webpack config path ${configPath}`);\n\t\t}\n\n\t\tlog(`Making compiler with config path ${configPath}`);\n\t\tconfig = require(configPath);\n\n\t\tif (_.isFunction(config))\n\t\t\tconfig = config()\n\t}\n\n\n\tconfig.target = 'node';\n\n\t// Output config\n\toutputPath = path.resolve(process.cwd(),'target');\n\tif (!fs.existsSync(outputPath))\n\t\tmkdirp.sync(outputPath);\n\n\tconst output = config.output = config.output || {};\n\toutput.library = '[name]';\n\n\t// Ensure we have a valid output target\n\tif (!_.includes([CommonJS,CommonJS2],output.libraryTarget)) {\n\t\tconsole.warn('Webpack config library target is not in',[CommonJS,CommonJS2].join(','))\n\t\toutput.libraryTarget = CommonJS2\n\t}\n\n\t// Ref the target\n\tlibraryTarget = output.libraryTarget\n\n\toutput.filename = '[name].js';\n\toutput.path = outputPath;\n\n\tlog('Building entry list');\n\tconst entries = config.entry = {};\n\n\tconst functions = project.getAllFunctions();\n\tfunctions.forEach(fun => {\n\n\t\t// Runtime checks\n\t\t// No python or Java :'(\n\n\t\tif (!/node/.test(fun.runtime)) {\n\t\t\tlog(`${fun.name} is not a webpack function`);\n\t\t\treturn\n\t\t}\n\n\n\t\tconst handlerParts = fun.handler.split('/').pop().split('.');\n\t\tlet modulePath = fun.getRootPath(handlerParts[0]), baseModulePath = modulePath;\n\t\tif (!fs.existsSync(modulePath)) {\n\t\t\tfor (let ext of config.resolve.extensions) {\n\t\t\t\tmodulePath = `${baseModulePath}${ext}`;\n\t\t\t\tlog(`Checking: ${modulePath}`);\n\t\t\t\tif (fs.existsSync(modulePath))\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (!fs.existsSync(modulePath))\n\t\t\tthrow new Error(`Failed to resolve entry with base path ${baseModulePath}`);\n\n\t\tconst handlerPath = require.resolve(modulePath);\n\n\t\tlog(`Adding entry ${fun.name} with path ${handlerPath}`);\n\t\tentries[fun.name] = handlerPath;\n\t});\n\n\tlog(`Final entry list ${Object.keys(config.entry).join(', ')}`);\n}",
"function generateBuildConfig(){\n var jsBaseDir = './js';\n var lessBaseDir = './less';\n var fontsBaseDir= './fonts';\n\n var buildConfig = {\n jsBaseDir: jsBaseDir,\n fontsBaseDir: fontsBaseDir,\n fontsDestDir: './dist',\n jsDistDir: './dist',\n lessDistDir: './dist',\n lessBaseDir: lessBaseDir,\n //tell browserify to scan the js directory so we don't have to use relative paths when referencing modules (e.g. no ../components).\n paths:['./js'],\n //assume these extensions for require statements so we don't have to include in requires e.g. components/header vs components/header.jsx\n extensions:['.js'],\n\n //http://jshint.com/docs/options/\n jshintThese:[\n \"core/**/*\"\n ],\n jshint:{\n curly: true,\n strict: true,\n browserify: true\n },\n\n //http://lisperator.net/uglifyjs/codegen\n uglify:{\n mangle:true,\n output:{ //http://lisperator.net/uglifyjs/codegen\n beautify: false,\n quote_keys: true //this is needed because when unbundling/browser unpack, the defined modules need to be strings or we wont know what their names are.\n }\n //compress:false // we can refine if needed. http://lisperator.net/uglifyjs/compress\n }\n };\n\n\n return buildConfig;\n}",
"getWebpackConfig() {\n // Now it can be a single compiler, or multicompiler\n // In any case, figure it out, create the compiler options\n // and return the stuff.\n // If the configuration is for multiple compiler mode\n // Then return an array of config.\n if (this.isMultiCompiler()) {\n // Return an array of configuration\n const config = [];\n this.projectConfig.files.forEach(file => {\n config.push(this.getSingleWebpackConfig(file));\n });\n return config;\n } // Otherwise, just return a single compiler mode config\n\n\n return this.getSingleWebpackConfig(this.projectConfig.files[0]);\n }",
"function generateGulpResponsiveConfiguration(){\n\n // Loop the sizes array and create an object that fits the gulp-responsive reference\n var responsiveImages = sizes.map(function(item){\n var object = {\n width: item.width,\n rename: function(path) {\n path.dirname += `/${item.name}`;\n return path;\n }\n }\n if(item.height) {\n object.height = item.height;\n }\n return object;\n });\n\n // Loop the sizes array and create an object that fits the gulp-responsive reference\n // and is a retina version of the former\n var responsiveImages2x = sizes.map(function(item){\n var object = {\n width: item.width * 2,\n rename: function(path) {\n path.dirname += `/${item.name}`;\n path.basename += '@2x';\n return path;\n }\n }\n if(item.height) {\n object.height = item.height * 2;\n }\n return object;\n });\n \n return [ ...responsiveImages, ...responsiveImages2x ];\n}",
"function createConfigList() {\n var hostUrl = decodeURIComponent(getQueryStringParameter(\"SPHostUrl\"));\n var currentcontext = new SP.ClientContext.get_current();\n var hostcontext = new SP.AppContextSite(currentcontext, hostUrl);\n var hostweb = hostcontext.get_web();\n\n //Set ListCreationInfomation()\n var listCreationInfo = new SP.ListCreationInformation();\n listCreationInfo.set_title('spConfig');\n listCreationInfo.set_templateType(SP.ListTemplateType.genericList);\n var newList = hostweb.get_lists().add(listCreationInfo);\n newList.set_hidden(true);\n newList.set_onQuickLaunch(false);\n newList.update();\n\n //Set column data\n var newListWithColumns = newList.get_fields().addFieldAsXml(\"<Field Type='Note' DisplayName='Value' Required='FALSE' EnforceUniqueValues='FALSE' NumLines='6' RichText='TRUE' RichTextMode='FullHtml' StaticName='Value' Name='Value'/>\", true, SP.AddFieldOptions.defaultValue);\n\n //final load/execute\n context.load(newListWithColumns);\n context.executeQueryAsync(function () {\n console.log('spConfig list created successfully!');\n },\n function (sender, args) {\n console.error(sender);\n console.error(args);\n alert('Failed to create the spConfig list. ' + args.get_message());\n });\n }",
"createConfig() {\n return {\n facets: [{ key: 'main', fixedFactSheetType: 'Application' }],\n ui: {\n elements: createElements(this.settings),\n timeline: createTimeline(),\n update: (selection) => this.handleSelection(selection)\n }\n };\n }",
"commonOptions() {\n let config = this.config;\n let cmd = [];\n\n if (config.datadir) {\n cmd.push(`--datadir=${config.datadir}`);\n }\n\n if (Number.isInteger(config.verbosity) && config.verbosity >= 0 && config.verbosity <= 5) {\n switch (config.verbosity) {\n case 0:\n cmd.push(\"--lvl=crit\");\n break;\n case 1:\n cmd.push(\"--lvl=error\");\n break;\n case 2:\n cmd.push(\"--lvl=warn\");\n break;\n case 3:\n cmd.push(\"--lvl=info\");\n break;\n case 4:\n cmd.push(\"--lvl=debug\");\n break;\n case 5:\n cmd.push(\"--lvl=trace\");\n break;\n default:\n cmd.push(\"--lvl=info\");\n break;\n }\n }\n\n return cmd;\n }",
"static getExtraConfig () {\n return {}\n }",
"function list(appName, callback) {\n var uri = format('/%s/apps/%s/config/', deis.version, appName);\n commons.get(uri, function onListResponse(err, result) {\n callback(err, result ? result.values : null);\n });\n }",
"function get_config() {\n // This is a placeholder, obtaining values from command line options.\n // Subsequent developments may access a configuration file\n // and extract an initial default configuration from that.\n //\n // See also: https://nodejs.org/api/process.html#process_process_env\n if (program.debug) {\n meld.CONFIG.debug = program.debug;\n } \n if (program.verbose) {\n meld.CONFIG.verbose = program.verbose;\n } \n if (program.author) {\n meld.CONFIG.author = program.author;\n } \n if (program.baseurl) {\n meld.CONFIG.baseurl = program.baseurl;\n }\n if (program.stdinurl) {\n meld.CONFIG.stdinurl = program.stdinurl;\n }\n}",
"function getConfiguration(stats) {\n\tconst production = [getProductionModules(stats)]\n\tconst fermenting = getFermentingModules(stats, production[0])\n\tconst addons = getAddonsModules(stats)\n\n\t// concatinating arrays\n\t// const all = production.concat(fermenting).concat(addons)\n\tconst all = (production.concat(fermenting)).concat(addons)\n\n\treturn { production, fermenting, addons, all }\n}",
"getConfig() {\n // NOTE(cais): We override the return type of getConfig() to `any` here,\n // because the `Sequential` class is a special case among `Container`\n // subtypes in that its getConfig() method returns an Array (not a\n // dict).\n const layers = [];\n for (const layer of this.layers) {\n const dict = {};\n dict['className'] = layer.getClassName();\n dict['config'] = layer.getConfig();\n layers.push(dict);\n }\n return { name: this.name, layers };\n }"
] | [
"0.5952684",
"0.54929423",
"0.5462945",
"0.54263645",
"0.53882575",
"0.5377423",
"0.534919",
"0.5339271",
"0.53169733",
"0.53052163",
"0.5300868",
"0.5283008",
"0.5272032",
"0.52457243",
"0.5242057",
"0.5235154",
"0.52095884",
"0.5202356",
"0.5185812",
"0.5145657",
"0.51259655",
"0.5096008",
"0.50841707",
"0.507554",
"0.5056314",
"0.50410324",
"0.50401795",
"0.5036896",
"0.5025826",
"0.49988222"
] | 0.5686087 | 1 |
There are two things needed to place a beacon: the position and a name TO DO: name will have to be unique. At this point, if there are two entries with the same name, it will return the first it finds (a) position: currently, the position is the PLAYER'S position when player places the marker block, so use 'self.position' (b) name: enter a name in quotation marks, like "beacon1" or "pool" | function beacon(me, beaconName){
//we place a marker at the position we want:
box(blocks.beacon,1,2,1);
//In the next lines, we build the beacon object:
var loc = me.getLocation();
//the next line appends the beacon's name to the array that contains only the tag key (the name the player gives to the beacon)
beaconNameArray.push(beaconName);
//the position is returned as an object which has coordinates as properties (keys). We are extracting the properties x, y and z
//and puting them in an array whic we call locx. Since I want the numbers to be easy to read, and extreme precision is not
//important for this plugin, I also round the numbers
var locx = [Math.round(loc.getX()),Math.round(loc.getY()),Math.round(loc.getZ())];
//The beacon object is then assembled and appended to the beaconArray array
var beaconObj = {tag: beaconName, position: locx};
beaconArray.push(beaconObj);
//finally, we display the result to the player, showing the name of the beacon and its coordinates.
//TO DO: TAB list of beacons' names
echo('You are at ' + beaconName + ' at position ' + locx[0] + ", " + locx[1] + ", " + locx[2]);
/*
these were used to debug:
echo(beaconObj.tag + beaconObj.position);
echo(beaconArray.length);
echo(beaconArray[0]);
echo(beaconNameArray[0]);
*/
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getNewdidFromPos(position) {\n\t//flag ( \"getNewdidFromPos():: Started! Called for position: \" + position );\n\t//a=GM_getValue(myacc())\n\tvar allVillagePos = GM_getValue(myacc() + \"_allVillagePos2\").split(\",\");\n\t//flag ( \"getNewdidFromPos: allVillagePos=\"+allVillagePos+\";\");\n\tfor (var i = 0; i < allVillagePos.length; i++) {\n\t\tvar tt = allVillagePos[i].split(\":\");\n\t\tif ( tt[1] == position) {\n\t\t\treturn tt[0];\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn null;\n}",
"function findBeacons() {\n\tvar room = \"\";\n\t/*[] values;\n\tfor(var i=0;i>10;i++) {*/\n\t\tBeacon.rangeForBeacons(\"B9407F30-F5F8-466E-AFF9-25556B57FE6D\")\n\t\t.then(function(beacons_found) {\n\t\t // $(\"#beacon-list\").empty();\n\t\t var maxRSSI = 100;\n\t\t for(beaconIndex in beacons_found) {\n\t\t var beacon = beacons_found[beaconIndex]; \n\t\t /* var beaconDiv = $(\"<div />\").html(\"Major: \" + beacon.major + \n\t\t \"; Minor: \" + beacon.minor + \n\t\t \"; RSSI: \" + (beacon.rssi*-1));\n\t\t\n\t\t $(\"#beacon-list\").append(beaconDiv);*/\n\t\t if(beacon.rssi*-1 < maxRSSI) {\n\t\t \t room = getRoomName(beacon.minor);\n\t\t \t maxRSSI = beacon.rssi*-1;\n\t\t }\n\t\t }\n\t\t $(\"#myLocation\").text(/*\"Ole Johan Dahls Hus\" + */room);\n\t\t if(room == \"\") {\n\t\t\t setOffline();\n\t\t }\n\t\t newLocation(room);\n\t\t})\n\t\t.fail(function() {\n\t\t alert(\"failed serching for beacons!\");\n\t\t setOffline();\n\t\t});\n\t//}\n}",
"function searchObject(type){\n\tvar target;\n console.log(\"123\");\n\tif(type==\"beacon\"){\n\t\t target=beaconMap[document.getElementById('beaconSearch').value];\n\t}else{\n\t\t target=reporterMap[document.getElementById('reporterSearch').value];\n console.log(target);\n\t}\n\t toggleBounce(target.marker);\n map.panTo(target.getPosi(),3000);\n if(map.getZoom()<17){\n\t map.setZoom(17);\n\t}\n var date = new Date(target.time*1000);\n\t\n document.getElementById(\"beaconInfo\").innerHTML=\"<h3 class='InfoTitle'>Loggy: \"+target.mac+\"</h3>\"+\"<p class='InfoBody'>Latitude: \"+target.lat+\"<br>\"+\"Longitude: \"+target.lng+\"<br>Last Update: \"+date.getFullYear()+\"-\"+(date.getMonth()+1)+\"-\"+date.getDate()+\" \"+date.getHours()+\":\"+date.getMinutes()+\":\"+date.getSeconds()+\"</p>\";\n \n}",
"function locate_iBeacons() {\n kony.print(\"--Start locate_iBeacons--\");\n if (beaconManager === null) {\n kony.print(\"--creating beaconManager--\");\n beaconManager = new com.kony.BeaconManager(monitoringCallback, rangingCallback, errorCallback);\n kony.print(\"--beaconManager = new com.kony.BeaconManager(monitoringCallback, rangingCallback, errorCallback)--\");\n beaconManager.setMonitoringStartedForRegionCallback(monitoringStartedForRegionCallback);\n kony.print(\"--beaconManager.setMonitoringStartedForRegionCallback(monitoringStartedForRegionCallback);--\");\n beaconManager.setAuthorizationStatusChangedCallback(authorizationStatusChangedCallback);\n }\n if (beaconManager.authorizationStatus() != \"BeaconManagerAuthorizationStatusAuthorized\") {\n kony.print(\"Unathorized to use location services\");\n }\n if (!beaconManager.isMonitoringAvailableForBeaconRegions()) {\n kony.print(\"Monitoring not available\");\n return;\n }\n if (!beaconManager.isRangingAvailableForBeaconRegions()) {\n kony.print(\"Ranging not available\");\n return;\n }\n var proximityUUID = \"CAD6ACBA-9D1C-4772-90AA-0FEEF6868D30\";\n var identifier = \"com.kone.LatestKMSDemo\"\n var beaconRegion = new com.kony.BeaconRegion(proximityUUID, null, null, identifier);\n beaconRegion.setNotifyEntryStateOnDisplay(true);\n beaconManager.startMonitoringBeaconRegion(beaconRegion);\n}",
"findFriendIdByName( nameToSearch ) {\n let friendId = this.ItemNotFound;\n let list = this.state[this.townName];\n \n for( let indx=0; indx<list.length; ++indx ) {\n if( list[indx].name === nameToSearch ) {\n friendId = list[indx].id;\n break;\n }\n }\n return friendId;\n }",
"function bringPlayer(playerName,playerLocation) {\n\tvar playersIndex = players.indexOf(playerName);\t\n\t//first check to see if playerName exists\n\tif(playersIndex!==-1) {\n\n\t\t//need to update the playersLocations to bring the player from other location to playerLocation\n\t\tif(isMoveAllowed(playerLocation)) {\n\t\t\tplayersLocations[playersIndex]=playerLocation;\n\t\t} else {\n\t\t\tconsole.log(playerName+\" cannot be placed there.\");\n\t\t}\n\t} else {\n\t\tconsole.log(playerName+\" does not exist!\");\n\t}\n}",
"function assignName() {\n var locationNameHolder = scope.querySelectorAll(\"[data-vf-js-location-nearest-name]\");\n if (!locationNameHolder) {\n // exit: container not found\n return;\n }\n if (locationNameHolder.length == 0) {\n // exit: content not found\n return;\n }\n // console.log('assignName','pushing the active location to the dom')\n locationNameHolder[0].innerHTML = locationName;\n }",
"function getLocCode() {\r\n\tplayerLocCode = playerDetails.locCode;\r\n}",
"function FindSpawn(index){\n\tif(!index.search){\n\t\tlet a=Math.floor(Math.random()*sX);\n\t\tlet b=Math.floor(Math.random()*sY);\n\t\tif(grid[a][b]==0){\n\t\t\tindex.x=a;\n\t\t\tindex.y=b;\n\t\t\tindex.search=true;\n\t\t}\n\t}\n}",
"function examine(word) {\n let lookAt = itemLookUp[word]\n if (player.location.inv.includes(word)) {\n console.log(lookAt.desc)\n }\n}",
"async function getPlayerbasicDetailsByPosition(player_name, position_name){\n const all_player_with_same_name = await axios.get(`${api_domain}/players/search/${player_name}`, {\n params: {\n api_token: process.env.api_token,\n include: \"team.league, position\", \n },\n })\n return all_player_with_same_name.data.data.map((player_info) => {\n if(player_info != undefined && player_info.team != undefined && player_info.position != undefined)\n {\n const { player_id, fullname, image_path, position_id } = player_info;\n if(fullname.includes(player_name))\n {\n if( player_info.position.data.name == position_name)\n {\n const { name } = player_info.team.data;\n if(player_info.team.data.league != undefined)\n {\n const {id} = player_info.team.data.league.data;\n if(id == 271) \n {\n return {\n id: player_id,\n name: fullname,\n image: image_path,\n position: position_id,\n position_name: player_info.position.data.name,\n team_name: name, \n };\n }\n }\n }\n } \n }\n }); \n }",
"searchByName( nameToSearch ) {\n let itemId = this.ItemNotFound;\n let list = this.state[this.townName];\n let nameToSearchLowerCase = nameToSearch.toLocaleLowerCase();\n let nameToSearchSplit = nameToSearchLowerCase.split(' ');\n let name0ToSearch = nameToSearchSplit[0];\n let name1ToSearch = nameToSearchSplit[1];\n \n \n for( let indx=0; indx<list.length; ++indx ) {\n let name = list[indx].name.toString().toLocaleLowerCase();\n let nameSplit= name.split(' ');\n let name0 = nameSplit[0];\n let name1 = nameSplit[1];\n \n if( name0ToSearch && name1ToSearch && nameToSearchLowerCase === name ) {\n itemId = list[indx].id;\n break;\n } else\n if( !name1ToSearch && name0ToSearch && (name0 === name0ToSearch || name1 === name0ToSearch) ) {\n itemId = list[indx].id;\n break;\n }\n }\n console.log('searchByName :',itemId);\n \n return itemId;\n }",
"function Player(name, marker) {\n this.name = name\n this.marker = marker\n}",
"function spanNewPlayer(name : String, info : NetworkMessageInfo){\n\tvar lastPlayer = false;\n\t//Remove items from spawn array\n\tplayerArray.Remove(info);\n\tplayerNameArray.Remove(name);\n\t\n\tif (playerArray.Count == 0){\n\t\tlastPlayer = true;\n\t}\n\t\n\tvar player = info.sender;\n\n\tDebug.Log(\"SPAWNING the player, since I am the server\");\n\tvar playerIsMole : boolean = false;\n\t\n\tfor (molePos in MolePosition){\n\t\tif (playerList.length+1 == molePos){\n\t\t\tplayerIsMole = true;\n\t\t}\n\t} \n\n\tnetworkView.RPC(\"initPlayer\", player, player);\n\tnetworkView.RPC(\"spawnPlayer\", RPCMode.All, player, playerIsMole, name, lastPlayer);\n}",
"function get_npc(name) {\r\n\tvar npc = parent.G.maps[character.map].npcs.filter(npc => npc.id == name);\r\n\r\n\tif (npc.length > 0) {\r\n\t\treturn npc[0];\r\n\t}\r\n\r\n\treturn null;\r\n}",
"function searchByName(name) {\n var testName = name.toLowerCase();\n if (testName===\"bar\"||\"bars\"||\"restaurant\"||\"restaurants\"||\"food\"||\"beer\") {\n var request = {\n location: pos,\n radius: '500',\n type: ['bar', 'restaurant']\n };\n service = new google.maps.places.PlacesService(map);\n service.nearbySearch(request, callback);\n } else {\n var request = {\n query: name,\n fields: ['photos', 'formatted_address', 'name', 'rating', 'opening_hours', 'geometry'],\n locationBias: {radius: 50, center: pos}\n };\n service = new google.maps.places.PlacesService(map);\n service.findPlaceFromQuery(request, callback);\n };\n}",
"function get_npc(name) {\n var npc = parent.G.maps[character.map].npcs.filter(npc => npc.id == name);\n\n if (npc.length > 0) {\n return npc[0];\n }\n\n return null;\n}",
"function find_closest_asset_address(player_enter_x, player_enter_z) {\n var closest_distance = 9999999;\n\n var closet_coor = null;\n\n // for each coordinate our coordinate map\n for (var i = 0; i < coordinate_map.length; i++) {\n var coor = coordinate_map[i]\n\n // determine the distance from that coordinate to the player enter position\n var distance = find_distance(player_enter_x, player_enter_z, coor.x, coor.z)\n\n // if this coordinate is closer set it as our closest\n if (distance < closest_distance) {\n closest_distance = distance\n closet_coor = coor;\n }\n }\n\n // return the address of the closest coordinate\n if (closet_coor != null) {\n return closet_coor.address\n } else {\n return \"\";\n }\n}",
"function getBpFromName(name) {\n\tconsole.log(storyCardFaceUp);\n\tconsole.log(storyCardFaceUp.foe);\n\tconsole.log(name);\n\tfor (var i = 0; i < cardTypeList.length; i++) {\n\t\t// console.log(cardTypeList[i]);\n\t\t// console.log(name);\n\t\tif (cardTypeList[i].name === name)\n\t\t\tif (cardTypeList[i].hasOwnProperty('bp')) {\n\t\t\t if(storyCardFaceUp.foe === name) return cardTypeList[i].bonusbp;\n\t\t\t return cardTypeList[i].bp;\n\t\t\t}\n\t}\n\treturn \"card not found\";\n}",
"function rangingCallback(beaconRegion, beacons) {\n kony.print(\"Beacons found for BeaconRegion: \", kony.type(beaconRegion), \" \", beaconRegion, \" Beacons: \", beacons);\n var beaconLabel = \"No beacons\";\n var proximityLabel = \"...\";\n if (beacons.length > 0) {\n beacon = beacons[0];\n proximityUUIDString = beacon.getProximityUUIDString();\n major = beacon.getMajor();\n minor = beacon.getMinor();\n beaconLabel = beacon.getProximityUUIDString() + \" \" + beacon.getMajor() + \" \" + beacon.getMinor();\n proximityLabel = beacon.getProximity();\n }\n if ((prevProximityUUIDString != proximityUUIDString) && (ksid != null)) {\n beaconUpdate();\n }\n}",
"function getPlayerData(list, playerName) {\n for (let p = 0; p < list.length; p++) {\n const player = list[p];\n if (player.name === playerName) {\n return player;\n }\n }\n // console.log(\"Unable to find player \", playerName, \"in list:\\n\", list);\n}",
"function getPlayerData(list, playerName) {\n for (let p = 0; p < list.length; p++) {\n const player = list[p];\n if (player.name === playerName) {\n return player;\n }\n }\n console.log(\"Unable to find player \", playerName, \"in list:\\n\", list);\n}",
"addMarker(level, openings, itemObj, startPosX = -1, startPosY = -1) {\n let startPos = startPosX + startPosY;\n if (startPos >= 0 && openings.indexOf(startPos) === -1 && startPos < this.maze.length) {\n level[startPos] = itemObj;\n }\n else {\n let randomCell = Math.floor(Math.random() * openings.length);\n let addMarkerPosn = openings.splice(randomCell, 1)[0];\n level[addMarkerPosn] = itemObj;\n }\n }",
"function updateMap(time){\n // console.log(\"----------------------------\");\n if(showBeacon){\n var position1 = JSON.parse(httpGet(beaconPosiSource)); //two dimensional JSON array\n // console.log(\"----------------------------\");\n var position = new ibeaconBeanGroup(position1).getAllBestLocations();\n\n // console.log(position1);\n \n // console.log(position);\n\n\t\tfor(var i=0;i<position.length;i++){\n\t\t\tif(typeof(beaconMap[position[i].mac])=='undefined'){\n\t\t\t\tbeaconMap[position[i].mac] = new beaconMarker(position[i]);\n\t\t\t\tbeaconMap[position[i].mac].setColor(colorBar[i%7]);\n console.log(\"beaconMap[position[i].mac])=='undefined'\");\n\t\t\t}else{\n\n\t\t\t\tif(!beaconMap[position[i].mac].equal(position[i])){\n\t\t\t\t\tbeaconMap[position[i].mac].setPosi(position[i]);\n console.log(position[i]);\n\t\t\t\t\tbeaconMap[position[i].mac].time=parseInt(position[i].time);\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n \n \n }\n window.setTimeout(\"updateMap(\"+time+\")\",time);\n}",
"getEmptySpawn() {\n for (let mySpawnName in this.spawnNames) {\n let mySpawn = Game.spawns[this.spawnNames[mySpawnName]];\n if (mySpawn && mySpawn.energy < mySpawn.energyCapacity) {\n return mySpawn;\n }\n } \n return null;\n }",
"map_attribute_name_to_buffer_name( name ) \n { \n return { object_space_pos: \"positions\" }[ name ]; // Use a simple lookup table.\n }",
"function showMarker(name,address){\n var l = self.restaurantList().length;\n for(var i=0;i<l;i++){\n var rName = self.restaurantList()[i].restaurant.name;\n var position = self.restaurantList()[i].marker.marker.position;\n var rAddress = self.restaurantList()[i].restaurant.address;\n if(name === rName && address === rAddress){\n map.panTo(position);\n map.setZoom(15);\n populateInfoWindow(self.restaurantList()[i].marker.marker,\n largeInfowindow,\n self.restaurantList()[i].marker.content);\n self.restaurantList()[i].marker.marker.setAnimation(\n google.maps.Animation.BOUNCE);\n\n break;\n }\n }\n }",
"function Awake (){\n\t//get the parent of the markers\n\tGlobe = transform.parent;\n\t//Just setting the name again, to make sure.\n\tboardObject = \"CountryBoard\";\n\t//When start, look for the plane\n\tBoard = GameObject.Find(boardObject);\n}",
"function updateCoordinates(name) {\n name.position.y = floor(random(10, (width) / 10)) * 10;\n name.position.x = floor(random(10, (height) / 10)) * 10;\n }",
"function insertRecordOfWhoWasSeen(){\n var data = {};\n data['name'] = $('#insertName').val();\n data['posX'] = clickedPositionX;\n data['posY'] = clickedPositionY;\n \n $.get('../insert',data);\n \n $('#insertModal').modal('hide');\n drawCircleOnMap(clickedPositionX, clickedPositionY, data['name'][0], 30, '#b8dbd3', 3500);\n }"
] | [
"0.55945784",
"0.55155414",
"0.5372061",
"0.53548574",
"0.52936345",
"0.5292482",
"0.52400655",
"0.52102",
"0.5159438",
"0.51353896",
"0.51154304",
"0.5113312",
"0.51111436",
"0.5110201",
"0.5109417",
"0.5098488",
"0.50911343",
"0.50832295",
"0.5079928",
"0.5076207",
"0.5045602",
"0.5038288",
"0.5030733",
"0.50182706",
"0.5015086",
"0.50018305",
"0.4996816",
"0.49821067",
"0.49794316",
"0.49780127"
] | 0.7198466 | 0 |
Setup canvas based on the video input | function setup_canvases() {
canvas.width = video_element.scrollWidth;
canvas.height = video_element.scrollHeight;
output_element.width = video_element.scrollWidth;
output_element.height = video_element.scrollHeight;
console.log("Canvas size is " + video_element.scrollWidth + " x " + video_element.scrollHeight);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_setupCanvas() {\n\t\tconst {video, elements} = this;\n\n\t\tconst virtualCanvas = elements.virtualCanvas = document.createElement('canvas');\n\n\t\tthis.context = elements.canvas.getContext('2d');\n\t\tthis.virtualContext = virtualCanvas.getContext('2d');\n\n\t\telements.canvas.width = virtualCanvas.width = video.videoWidth;\n\t\telements.canvas.height = virtualCanvas.height = video.videoHeight;\n\t}",
"canvasApp() {\n this.context = this.canvas.getContext(\"2d\");\n this.videoLoop();\n }",
"function makeCanvases() {\n w = _this.media.videoWidth;\n h = _this.media.videoHeight;\n \n // create a canvas to display the color-changed video, and a div to hold the canvas\n var candiv = document.createElement('div');\n candiv.style.position = 'absolute';\n _mediaHolder.appendChild(candiv);\n candiv.style.top = _media.offsetTop + 'px'; // so that the canvas will appear over the video\n candiv.style.left = _media.offsetLeft + 'px';\n _colorCanvas = document.createElement('canvas');\n _colorCanvas.style.display = 'none';\n _colorCanvas.width = w;\n _colorCanvas.height = h;\n candiv.appendChild(_colorCanvas);\n \n _colctx = _colorCanvas.getContext('2d');\n options.colorCanvas = _colorCanvas;\n \n // create a buffer canvas to hold each frame for processing\n // note that it just \"floats\" and is never appended to the document\n _bufferCanvas = document.createElement('canvas');\n _bufferCanvas.style.display = 'none';\n _bufferCanvas.width = w;\n _bufferCanvas.height = h;\n _bufctx = _bufferCanvas.getContext('2d');\n options.bufferCanvas = _bufferCanvas;\n console.log('The variable bufctx is ' + _bufctx);\n \n \n if (_coloring === \"color-no-change\"){\n return;\n }\n else if (_coloring === \"blackwhite\"){\n _media.addEventListener('play', function(){\n var framecounter = 0;\n console.log('Playing. The variable bufctx is ' + _bufctx);\n options.redrawID = makeBW(_media, _bufctx, _colctx, w, h, framecounter);\n });\n }\n else if (_coloring === \"sepia\"){\n _media.addEventListener('play', function(){\n var framecounter = 0;\n options.redrawID = makeSepia(_media, _bufctx, _colctx, w, h, framecounter);\n });\n }\n else if (_coloring === \"custom\"){\n _media.addEventListener('play', function(){\n var framecounter = 0;\n options.redrawID = adjustColor(_media, _bufctx, _colctx, w, h, framecounter, _redAdd, _greenAdd, _blueAdd);\n });\n }\n }",
"constructor() {\n super();\n /**\n * video source file or stream\n * @type {string}\n * @private\n */\n this._source = '';\n\n /**\n * use camera\n * @type {boolean}\n * @private\n */\n this._useCamera = false;\n\n /**\n * is component ready\n * @type {boolean}\n */\n this.isReady = false;\n\n /**\n * is video playing\n * @type {boolean}\n */\n this.isPlaying = false;\n\n /**\n * width of scaled video\n * @type {int}\n */\n this.videoScaledWidth = 0;\n\n /**\n * height of scaled video\n * @type {int}\n */\n this.videoScaledHeight = 0;\n\n /**\n * how the video is scaled\n * @type {string}\n * @default letterbox\n */\n this.videoScaleMode = 'contain';\n\n /**\n * what type of data comes back with frame data event\n * @type {string}\n * @default imagedataurl\n */\n this.frameDataMode = 'none';\n\n /**\n * determines whether to use the canvas element for display instead of the video element\n * @type {boolean}\n * @default false\n */\n this.useCanvasForDisplay = false;\n\n /**\n * canvas filter function (manipulate pixels)\n * @type {method}\n * @default 0 ms\n */\n this.canvasFilter = this.canvasFilter ? this.canvasFilter : null;\n\n /**\n * refresh interval when using the canvas for display\n * @type {int}\n * @default 0 ms\n */\n this.canvasRefreshInterval = 0;\n\n /**\n * video element\n * @type {HTMLElement}\n * @private\n */\n this.videoElement = null;\n\n /**\n * camera sources list\n * @type {Array}\n */\n this.cameraSources = [];\n\n /**\n * canvas element\n * @type {Canvas}\n * @private\n */\n this.canvasElement = null;\n\n /**\n * component shadow root\n * @type {ShadowRoot}\n * @private\n */\n this.root = null;\n\n /**\n * interval timer to draw frame redraws\n * @type {int}\n * @private\n */\n this.tick = null;\n\n /**\n * canvas context\n * @type {CanvasContext}\n * @private\n */\n this.canvasctx = null;\n\n /**\n * has the canvas context been overridden from the outside?\n * @type {boolean}\n * @private\n */\n this._canvasOverride = false;\n\n /**\n * width of component\n * @type {int}\n * @default 0\n */\n this.width = 0;\n\n /**\n * height of component\n * @type {int}\n * @default 0\n */\n this.height = 0;\n\n /**\n * left offset for letterbox of video\n * @type {int}\n * @default 0\n */\n this.letterBoxLeft = 0;\n\n /**\n * top offset for letterbox of video\n * @type {int}\n * @default 0\n */\n this.letterBoxTop = 0;\n\n /**\n * aspect ratio of video\n * @type {number}\n */\n this.aspectRatio = 0;\n\n /**\n * render scale for canvas frame data\n * best used when grabbing frame data at a different size than the shown video\n * @attribute canvasScale\n * @type {float}\n * @default 1.0\n */\n this.canvasScale = 1.0;\n\n /**\n * visible area bounding box\n * whether letterboxed or cropped, will report visible video area\n * does not include positioning in element, so if letterboxing, x and y will be reported as 0\n * @type {{x: number, y: number, width: number, height: number}}\n */\n this.visibleVideoRect = { x: 0, y: 0, width: 0, height: 0 };\n\n this.template = `\n <style>\n ccwc-video {\n display: inline-block;\n background-color: black;\n position: relative;\n overflow: hidden;\n }\n \n ccwc-video > canvas {\n position: absolute;\n }\n \n ccwc-video > video {\n position: absolute;\n }\n </style>\n\n <video autoplay=\"true\"></video>\n <canvas></canvas>`;\n }",
"async function populateVideo() {\n // We grab the feed off the user's webcam\n const stream = await navigator.mediaDevices.getUserMedia({\n video: { width: 1280, height: 720 },\n });\n\n // We set the object to be the stream\n video.srcObject = stream; // usually when dealing with video files we use video.src = 'videoName.mp4'\n await video.play();\n\n // size the canvases to be the same size as the video\n console.log(video.videoWidth, video.videoHeight);\n\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n\n faceCanvas.width = video.videoWidth;\n faceCanvas.height = video.videoHeight;\n}",
"function paintToCanvas() {\n // you will find that the canvas height is bigger than the current window size even though its size is set to 640*480\n // because the width of the canvas is set to 100% which means it will take 100% of the space availabe of its parent container (photobooth)\n // Since the width of the photobooth is appx 1330px \n // the canvas will also take width of 1330px\n // since the width is 1330px the height will be 999px in order to maintain the aspect ratio (640*480)\n // the canvas is taking aspect ratio from our defined size (i.e 640 * 480)\n // therefore you can change the aspect ratio by changing the width and height of the canvas\n // if you remove the width 100% from its css , it will regain the size of 640*480\n\n // width and height = 640 * 480 \n // because the resolution we get from the video feed is by default 640*480 and is pre-defined by the system webcam\n // setting canvas width and height = 640*480\n const width = video.videoWidth;\n const height = video.videoHeight;\n [canvas.width, canvas.height] = [width, height];\n\n // the video playing in the canvas is not a actual video\n // but rather a image showing every few millisecond (giving us a video like visual)\n // So every 16ms the image captured from the video feed will be pasted/drawed on the canvas.\n // So we can say our video on canvas is showing 1 frame every 16 milliseconds\n return setInterval(() => {\n // ctx.drawImage will draw the image captured from the video feed\n // 0,0 are the x and y coordinate of the top left corner of the canvas\n // it will indicate that from which point the image drawing will start\n // width and height is of the destination contex(canvas)\n ctx.drawImage(video, 0, 0, width, height);\n\n // FROM HERE AFTERWARDS pixels MEANS VARIABLE\n\n // ctx.getImageData will give the data of the image(from the video playing on the canvas) \n // pixels will store the image data in form of array of rgb values for individual pixels\n let pixels = ctx.getImageData(0, 0, width, height);\n\n // Rendering different effects for the pixels\n // Every image captured from the video feed every 16ms will go through these function everytime\n // The pixels returned by these function will have different rgb values as compared to the original pixels\n\n // This is for red filter\n // pixels = redEffect(pixels);\n\n // This is for rgbSplit(tiktok) filter\n // pixels = rgbSplit(pixels);\n\n // This is for green screen\n pixels = greenScreen(pixels);\n\n // globalAlpha will determine how transparent will be the filters (0 - fully transparent, 1-opaque)\n // ctx.globalAlpha = 0.8\n\n // this will put the modified pixels back into the canvas\n // thus showing the filter on the video\n ctx.putImageData(pixels, 0, 0)\n }, 16);\n}",
"function drawCameraIntoCanvas() {\n // Draw the video element into the canvas\n ctx.drawImage(video, 0, 0, pageContent.offsetWidth, pageContent.offsetHeight);\n ctx.fillStyle = '#000000';\n ctx.fillRect(0, 0, pageContent.offsetWidth, pageContent.offsetHeight);\n ctx.lineWidth = 5;\n ctx.fillStyle = '#00FFFF';\n ctx.strokeStyle = '#00FFFF';\n\n // We can call both functions to draw all keypoints and the skeletons\n drawKeypoints();\n drawSkeleton();\n window.requestAnimationFrame(drawCameraIntoCanvas);\n}",
"function installcanvas () {\n\n // if there's an iframe\n var iframe = document.getElementById('tool_content');\n if (iframe) {\n \t\taddEventListener(\"message\", installfromiframe('#content', 'about:blank', ''), false);\n } \n \n // multiple videos as per\n // https://canvas.harvard.edu/courses/340/wiki/supplemental-materials-for-lab-1-reporter-gene-analysis-using-transgenic-animals?module_item_id=630 \n else {\n\n // video locations that may need a click to access \n var containers = [].slice.call(document.getElementsByClassName('instructure_file_link_holder'));\n containers = containers.concat([].slice.call(document.getElementsByClassName('instructure_inline_media_comment')));\n // known video locations\n var matches = document.body.innerHTML.match(/me_flash_\\d_container/g);\n\n // if any known videos exist, launch those\n if (matches) {\n\n // loop through all known videos\n for (var i = 0; i < matches.length; i++) {\n\n // pull out the video number\n matches[i] = matches[i].replace(/\\D/g, \"\");\n\n // parameters for the videoplayer\n var parameter = {};\n\n // only supporting mp4 at the moment\n parameter.audio = false;\n\n // set number for video classes \n parameter.number = matches[i];\n\n // get source for available video\n parameter.source = document.getElementById('mep_' + matches[i]).childNodes[0].childNodes[0].childNodes[1].src + '?1';\n if (parameter.source) {\n\n // get locally stored data \n var hist = JSON.parse(localStorage.getItem(parameter.source));\n if (hist) {\n parameter.time = hist.time;\n }\n\n // prepare new container\n var container = $('<div/>');\n\n // maximize player's width\n container.css('margin', '10px 0 0 0');\n container.css('padding', '0');\n container.css('width', '100%');\n parameter.playing = false;\n\n // find if the video is playing\n if ($('#mep_' + matches[i]).find('.mejs-pause')[0]){\n parameter.playing = true;\n }\n\n // replace old container with new\n $('#mep_' + matches[i]).replaceWith(container);\n\n // install player\n install(container, parameter);\n }\n }\n }\n\n // click on all possible video containers, watch if things change\n if (containers.length != 0) {\n\n // watch for changes for each container\n for(var i = 0; i < containers.length; i++) {\n\n // use mutation observer as per \n // https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver\n var observer = new MutationObserver(function (mutations) {\n mutations.forEach(function (mutation) {\n\n // see if changes are to the child of the container\n if (mutation.type === 'childList') {\n\n // look through each child\n Array.prototype.forEach.call(mutation.target.children, function (child) {\n\n // match (only once per video) -- same code as if (matches) branch\n matches = document.body.innerHTML.match(/me_flash_\\d_container/g);\n if (matches) {\n for (var i = 0; i < matches.length; i++) {\n matches[i] = matches[i].replace(/\\D/g, '');\n\n // parameters for the videoplayer\n var parameter = {};\n parameter.audio = false;\n\n // set number for video classes \n parameter.number = matches[i];\n\n // get source for available video\n parameter.source = document.getElementById('mep_' + matches[i]).childNodes[0].childNodes[0].childNodes[1].src + '?1';\n if (parameter.source) {\n\n // get locally stored data for time\n var hist = JSON.parse(localStorage.getItem(parameter.source));\n if (hist) {\n parameter.time = hist.time;\n }\n\n // prepare new container\n var container = $('<div/>');\n\n // maximize player's width\n container.css('margin', '10px 0 0 0');\n container.css('padding', '0');\n container.css('width', '100%');\n\n // replace old container with new\n $('#mep_' + matches[i]).replaceWith(container);\n\n parameter.playing = false;\n\n // install player\n install(container, parameter);\n }\n }\n }\n });\n }\n });\n });\n\n // actually start observing\n observer.observe(containers[i], {\n childList: true,\n characterData: true,\n subtree: true\n });\n }\n\n // simulate click, waits for link to appear\n $('.media_comment_thumbnail').click(); \n } \n\n // no possible video containers, apologize\n else {\n apologize();\n }\n }\n}",
"function init() {\n\t\tconsole.log('init');\n\t\t// Put event listeners into place\n\t\t// Notice that in this specific case handlers are loaded on the onload event\n\t\twindow.addEventListener(\n\t\t\t'DOMContentLoaded',\n\t\t\tfunction() {\n\t\t\t\t// Grab elements, create settings, etc.\n\t\t\t\tvar canvas = document.getElementById('canvas');\n\t\t\t\tvar context = canvas.getContext('2d');\n\t\t\t\t// context.transform(3,0,0,1,canvas.width,canvas.heigth);\n\t\t\t\tvar video = document.getElementById('video');\n\t\t\t\tvar mediaConfig = {\n\t\t\t\t\tvideo: true\n\t\t\t\t};\n\t\t\t\tvar errBack = function(e) {\n\t\t\t\t\tconsole.log('An error has occurred!', e);\n\t\t\t\t};\n\n\t\t\t\tlet aspectRatio = 2;\n\n\t\t\t\t// Put video listeners into place\n\t\t\t\tif (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n\t\t\t\t\tnavigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {\n\t\t\t\t\t\taspectRatio = stream.getVideoTracks()[0].getSettings().aspectRatio;\n\t\t\t\t\t\tdocument.getElementById('video-spinner').style.display = 'block';\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Trigger photo take\n\t\t\t\tdocument.getElementById('snap').addEventListener('click', function() {\n\t\t\t\t\tdocument.getElementsByClassName('canvas-container')[0].style.visibility = 'visible';\n\t\t\t\t\tlet heigth = 480;\n\n\t\t\t\t\tcontext.save();\n\t\t\t\t\tcontext.translate(480 * aspectRatio, 0);\n\t\t\t\t\tcontext.scale(-1, 1);\n\t\t\t\t\tcontext.drawImage(video, 0, 0, aspectRatio * heigth, heigth);\n\t\t\t\t\tcontext.restore();\n\t\t\t\t\tstate.photoSnapped = true; // photo has been taken\n\t\t\t\t});\n\n\t\t\t\t// Trigger when upload button is pressed\n\t\t\t\tif (document.getElementById('upload'))\n\t\t\t\t\tdocument.getElementById('upload').addEventListener('click', () => {\n\t\t\t\t\t\tdocument.getElementById('video-spinner').style.display = 'block';\n\t\t\t\t\t\t// uploadImage();\n\t\t\t\t\t\tselectImage();\n\t\t\t\t\t});\n\n\t\t\t\tif (document.getElementById('upload_search'))\n\t\t\t\t\tdocument.getElementById('upload_search').addEventListener('click', () => {\n\t\t\t\t\t\tdocument.getElementById('video-spinner').style.display = 'block';\n\t\t\t\t\t\t// searchImage();\n\t\t\t\t\t});\n\t\t\t},\n\t\t\tfalse\n\t\t);\n\t}",
"function drawCameraIntoCanvas() {\n // Draw the video element into the canvas\n ctx.drawImage(video, 0, 0, 640, 480);\n // We can call both functions to draw all keypoints and the skeletons\n drawKeypoints();\n drawSkeleton();\n window.requestAnimationFrame(drawCameraIntoCanvas);\n}",
"function startVideo(){\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n canvas.getContext('2d').\n drawImage(video, 0, 0, canvas.width, canvas.height);\n $scope.sendPicture();\n}",
"function paintToCanvas() {\n // We need to make sure canvas and video are the same width/height\n const width = video.videoWidth;\n const height = video.videoHeight;\n canvas.width = width;\n canvas.height = height;\n\n // Every couple seconds, take image from webcam and put it onto canvas\n return setInterval(() => {\n // drawImage: pass it an image/video and it will place it on the canvas\n ctx.drawImage(video, 0, 0, width, height);\n\n // Take pixels out\n let pixels = ctx.getImageData(0, 0, width, height); // huge array of pixels\n\n // Play around with pixels\n switch (this.className) {\n case 'red':\n pixels = redEffect(pixels);\n break;\n case 'split':\n ctx.globalAlpha = 0.1;\n pixels = rgbSplit(pixels);\n break;\n case 'green':\n pixels = greenScreen(pixels);\n }\n\n // Put pixels back into canvas\n ctx.putImageData(pixels, 0, 0);\n }, 16);\n}",
"function drawCameraIntoCanvas() {\n // Draw the video element into the canvas\n drawKeypoints();\n window.requestAnimationFrame(drawCameraIntoCanvas);\n}",
"function currentFrameCanvas(){\n let video = document.getElementById(\"video_id\");\n canvas = document.getElementById('screenShot');\n canvas.width = width;\n canvas.height = height;\n canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);\n}",
"function drawCameraIntoCanvas() {\n\n // draw the video element into the canvas\n ctx.drawImage(video, 0, 0, video.width, video.height);\n \n if (body) {\n // draw circle for left and right Eye\n const leftWrist = body.getBodyPart(bodyParts.leftWrist);\n const rightWrist = body.getBodyPart(bodyParts.rightWrist);\n\n\n\n // draw left Eye\n ctx.beginPath();\n ctx.arc(leftWrist.position.x, leftWrist.position.y, 5, 0, 2 * Math.PI);\n ctx.fillStyle = 'white';\n ctx.fill();\n\n // draw right Eye\n ctx.beginPath();\n ctx.arc(rightWrist.position.x, rightWrist.position.y, 5, 0, 2 * Math.PI);\n ctx.fillStyle = 'white';\n ctx.fill();\n\n\n ctx.beginPath();\n ctx.moveTo(leftWrist.position.x,leftWrist.position.y);\n ctx.lineTo(rightWrist.position.x,rightWrist.position.y, 150);\n ctx.lineWidth = 10;\n ctx.strokeStyle = 'white';\n ctx.stroke();\n }\n requestAnimationFrame(drawCameraIntoCanvas);\n}",
"function createCanvas() {\n // console.log(parseInt(pixelByPixel.value));\n selectedFrameData = null;\n selectedFrameData = {};\n layerCount = 0;\n framesArray = [],\n currentFrame = 0,\n playbackRunning = false,\n playbackInterval = null,\n unsavedFrame = false;\n removeListeners();\n resetFrames();\n resetLayers();\n resetSelectionState();\n addDisplayFrame(0);\n setCurrentFrame(0);\n initCanvas(\"2d\", parseInt(pixelByPixel.value));\n}",
"function paintToCanvas() {\n // get the width and height of the actual live feed video\n const width = video.videoWidth;\n const height = video.videoHeight;\n\n // set canvas width and height to be the same as the live feed video\n canvas.width = width;\n canvas.height = height;\n\n // every 16ms, take the image from the webcam and put it into the canvas\n return setInterval(() => {\n ctx.drawImage(video, 0, 0, width, height);\n\n // take the pixels out\n let pixels = ctx.getImageData(0, 0, width, height);\n\n // mess with them\n // pixels = redEffect(pixels);\n\n // pixels = redSplit(pixels);\n // ctx.globalAlpha = 0.8;\n\n pixels = greenScreen(pixels);\n\n // put them back\n ctx.putImageData(pixels, 0, 0);\n }, 16);\n}",
"function initPreview() {\n\t\n\t//clear the canvas first\n\tcanvasPreviewContext.clearRect(0, 0, canvasPreview.width, canvasPreview.height);\n\t\n\t//what file type are we dealing with\n\tif (fileType == \"VIDEO\") {\n\t\t\n\t\tsampleWidth = 50;\n\t\tsampleHeight = Math.floor((9/16)*sampleWidth);\n\t\tvideoArea.width = sampleWidth;\n\t\tvideoArea.height = sampleHeight;\n\t\t\n\t\t//reset size of the canvas\n\t\tcanvasPreview.width = sampleWidth;\n\t\tcanvasPreview.height = sampleHeight;\n\t\tpreviewArea.style.width = sampleWidth + \"px\";\n\t\tpreviewArea.style.height = sampleHeight + \"px\";\n\t\t\n\t\t//set the video in the videoArea so it starts playing\n\t\tvideoArea.type = file.type;\n\t\tvideoArea.src = fileURL;\n\t\t\n\t\t//set fileWidth\n\t\tfileWidth = sampleWidth;\n\t\tfileHeight = sampleHeight;\n\t\t\n\t\t//make a sample first\n\t\t/*canvasPreviewContext.drawImage(videoArea, 0, 0, videoArea.width, videoArea.height);*/\n\t\t\n\t\t//initBuffers();\n\t\t\n\t\t\n\t\t/*document.onclick = function() {\n\t\t\tinitCubes();\n\t\t}*/\n\t\t\n\t\t//keep updating cubes based on the options\n\t\t//startUpdateCubesInterval();\n\t\tsetTimeout(initPlanes, 2000);\n\t\tstartUpdatePlanesInterval();\n\t\tstopUpdateCubesInterval();\n\t\t\n\t\t//keep rendering the screen based on mouse/camera position\n\t\tstartThreeInterval();\n\n\t\t\n\t} else if (fileType == \"IMAGE\") {\n\t\t\n\t\t\n\t\tsampleWidth = 30;\n\t\tsampleHeight = Math.floor((9/16)*sampleWidth);\n\t\t\n\t\t//load the image data and display in the preview\n\t\tvar img = new Image();\n\t\timg.onload = function() {\n\n\t\t\t//get the image dimensions so we can drawImage at the right aspect ratio\n\t\t\tsetNewFileDimensions(img);\n\t\t\t\n\t\t\t//draw the image onto the canvas\n\t\t canvasPreviewContext.drawImage(img, 0, 0, fileWidth, fileHeight);\n\t\t\t\n\t\t\t//initBuffers();\n\t\t\tinitCubes();\n\t\t\t//initPlanes();\n\t\t\t\n\t\t\t//keep updating cubes based on the options\n\t\t\tstartUpdateCubesInterval();\n\t\t\tstopUpdatePlanesInterval();\n\t\t\t\n\t\t\t//keep rendering the screen based on mouse/camera position\n\t\t\tstartThreeInterval();\n\n\t\t}\n\t\t\n\t\t//set the src of our new file\n\t\timg.src = fileURL;\n\t\t\n\t\t//we should clear the video tag\n\t\tvideoArea.type = \"\";\n\t\tvideoArea.src = \"\";\n\t\tvideoArea.pause();\n\t\t\n\t\t//we should stop sampling the video if its there\n\t\tstopSamplingVideo();\n\t\t\n\t}\n\t\n}",
"function FrameInitalizer(canvas, form, video, options) {\n //Opt parse.\n options = options || {};\n this.drawFrame = options.override_frame_draw || this._drawFrame\n this.drawImage = options.override_image_draw || this._drawImage\n this.drawPolygons = options.override_polygon_draw || this._drawPolygons\n //I might add a string to the OnChange functions that says where they were called from.\n //I could also add stuff like OnClear or whatever, not really sure I wanna go for that.\n //A return a reference to the previous state?\n //You shouldn't need these unless you do web worker stuff anyways.\n this.onImageChange = options.on_image_change_functor || (function(self) {\n return; //self.drawFrame() //Do nothing, if they want to draw on every update, let them set this.\n });\n this.onPolygonChange = options.on_polygon_change_functor || (function(self) {\n return; //self.drawFrame(); //Do nothing, if they want to draw on every update, let them set this.\n });\n this.source = options.source || null;\n this.number_of_frames = options.number_of_frames || 1;\n //Mandatory positional args.\n this.canvas = canvas;\n this.form = form;\n this.video = video; //video element;\n this.frames = [new _FrameTracker(0)];\n this.frame_index = 0;\n this.updateFrameList(1);\n }",
"function initialize() {\n // Create a canvas element to which we will copy video.\n canvas = document.createElement('canvas');\n var webcamDimensions = webcam.getDimensions();\n canvas.width = webcamDimensions.width;\n canvas.height = webcamDimensions.height;\n\n // We need a context for the canvas in order to copy to it.\n context = canvas.getContext('2d');\n\n // create an AR Marker detector using the canvas as the data source\n detector = ardetector.create( canvas );\n\n // Create an AR View for displaying the augmented reality scene\n view = arview.create( webcam.getDimensions(), canvas );\n\n // Set the ARView camera projection matrix according to the detector\n view.setCameraMatrix( detector.getCameraMatrix(10,1000) );\n\n // Place the arview's GL canvas into the DOM.\n document.getElementById(\"application\").appendChild( view.glCanvas );\n }",
"function setup() {\n createCanvas(640, 480, P2D); // canvas has same dimensions as my webcam\n background(0);\n stroke(0, 255, 0);\n noFill();\n\n // make sure the framerate is the same between sending and receiving\n frameRate(30);\n\n // Set to true to turn on logging for the webrtc client\n WebRTCPeerClient.setDebug(true);\n\n // To connect to server over public internet pass the ngrok address\n // See https://github.com/lisajamhoury/WebRTC-Simple-Peer-Examples#to-run-signal-server-online-with-ngrok\n WebRTCPeerClient.initSocketClient('https://XXXXXXXX.ngrok.io/');\n\n // Start the peer client\n WebRTCPeerClient.initPeerClient();\n\n // start your video\n // your webcam will always appear below the canvas\n myVideo = createCapture(VIDEO);\n myVideo.size(width, height);\n myVideo.hide();\n\n ////// HOW TO DEFINE OTHER PERSON'S VIDEO? //////\n // otherVideo = createCapture(VIDEO);\n // otherVideo.size(width, height);\n\n}",
"function paintToCanvas() { //to display webcame live in a specified canvas with videos actual height and width\n\n const width = video.videoWidth; //getting actual height and width of video\n const height = video.videoHeight;\n canvas.width = width; //setting the canvas width and height accordingly \n canvas.height = height;\n return setInterval(() => { //by setintertval method we are drawing the recieved video's image in after every 16milli sec \n ctx.drawImage(video, 0, 0, width, height); //here we are drawing the image recieved in canvas\n let pixels = ctx.getImageData(0, 0, width, height) //here we are getting the canvas image to make some effect\n // console.log(pixels)\n // debugger;\n // pixels = redeffect(pixels) //here redeffect is called\n // console.log(hola);\n pixels = rgbsplit(pixels) // we are calling rgb split to make some changes in the pixels thats is the image we get from canvas\n ctx.globalAlpha=0.8; \n // pixels = greenscreen(pixels)\n ctx.putImageData(pixels, 0, 0); //after we get the changed pixels we put it back in the canvas\n }, 16);\n}",
"function setup() {\n createCanvas(640, 480);\n video = select(\"video\") || createCapture(VIDEO);\n video.size(width, height);\n\n const poseNet = ml5.poseNet(video, { flipHorizontal: true }, () => {\n select(\"#status\").hide();\n });\n\n poseNet.on(\"pose\", (newPoses) => {\n poses = newPoses;\n });\n\n // Hide the video element, and just show the canvas\n video.hide();\n}",
"function ytInject() {\n injectStyle();\n injectCanvas();\n injectButton();\n\n $(window).resize(function() {\n var main = $('#vt-main-div').get(0);\n var canvas = $('#vt-canvas').get(0);\n\n main.style.height = $('.video-stream').height();\n main.style.width = $('.video-stream').width();\n $('#vt-canvas').height($('vt-main-div').height());\n $('#vt-canvas').width($('vt-main-div').width());\n\n //Scale the canvas to achieve proper resolution\n canvas.width=$('#vt-main-div').width()*window.devicePixelRatio;\n canvas.height=$('#vt-main-div').height()*window.devicePixelRatio;\n canvas.style.width=$('#vt-main-div').width() + \"px\";\n canvas.style.height=$('#vt-main-div').height() + \"px\";\n });\n}",
"setup(canvas) {\n this.engine.renderer.setup(canvas);\n this.start();\n }",
"function start() {\n if (initialized)\n return;\n\n let myCanvas = document.getElementById(\"canvas\");\n myCanvas.classList.toggle(\"hide\");\n\n let button = document.getElementById(\"webcamButton\");\n button.classList.add(\"hide\");\n\n window.ctx = myCanvas.getContext('2d', {alpha: false});\n\n var mycamvas = new camvas(window.ctx, processFrame);\n initialized = true;\n}",
"function drawVedio() {\n setTimeout(() => {\n canvas.getContext(\"2d\").drawImage(video, 0, 0, 100, 100);\n drawVedio();\n }, 0);\n }",
"function setupMotionDetection() {\n md_canvas = document.getElementById('mdCanvas');\n test_canvas = document.getElementById('testCanvas');\n md_canvas.width = vid_width;\n md_canvas.height = vid_height;\n}",
"function prepareCanvas() {\n canvas = window._canvas = new fabric.Canvas('canvas');\n canvas.backgroundColor = '#ffffff';\n canvas.isDrawingMode = 1;\n canvas.freeDrawingBrush.color = \"black\";\n canvas.freeDrawingBrush.width = 1;\n canvas.renderAll();\n //setup listeners \n canvas.on('mouse:up', function(e) {\n getFrame();\n mousePressed = false\n });\n canvas.on('mouse:down', function(e) {\n mousePressed = true\n });\n canvas.on('mouse:move', function(e) {\n recordCoor(e)\n });\n}",
"function setupCanvas() {\n// setup everything else\n\tconsole.log(\"Setting up canvas...\")\n\tcanvas = document.getElementById(\"drone-sim-canvas\");\n\twindow.addEventListener(\"keyup\", keyFunctionUp, false);\n\twindow.addEventListener(\"keydown\", keyFunctionDown, false);\n\twindow.onresize = doResize;\n\tcanvas.width = window.innerWidth-16;\n\tcanvas.height = window.innerHeight-200;\n\tconsole.log(\"Done.\")\n}"
] | [
"0.78905183",
"0.73323876",
"0.7324095",
"0.6902919",
"0.6802968",
"0.6754874",
"0.674903",
"0.67110926",
"0.6707982",
"0.66969913",
"0.66809857",
"0.6675698",
"0.6649001",
"0.65843296",
"0.65676445",
"0.65668964",
"0.65466964",
"0.65347123",
"0.6457012",
"0.6453839",
"0.6424336",
"0.64237124",
"0.6419021",
"0.63978547",
"0.6386163",
"0.6385013",
"0.63836545",
"0.63807344",
"0.63210124",
"0.63173777"
] | 0.7507471 | 1 |
Connect the proper camera to the video element, trying to get a camera with facing mode of "user". | async function connect_camera() {
try {
let stream = await navigator.mediaDevices.getUserMedia({
video: { facingMode: "user" },
audio: false
});
video_element.srcObject = stream;
video_element.setAttribute('playsinline', true);
video_element.setAttribute('controls', true);
// remove controls separately
setTimeout(function() { video_element.removeAttribute('controls'); });
} catch(error) {
console.error("Got an error while looking for video camera: " + error);
return null;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function setupCamera() {\n const video = document.getElementById('video')\n video.width = videoWidth\n video.height = videoHeight\n\n const stream = await navigator.mediaDevices.getUserMedia({\n audio: false,\n video: {\n facingMode: 'user',\n width: videoWidth,\n height: videoHeight\n }\n })\n video.srcObject = stream\n\n return new Promise(resolve => {\n video.onloadedmetadata = () => {\n resolve(video)\n }\n })\n}",
"function cameraSetup(){\n\t// Get access to the camera!\n\tif('mediaDevices' in navigator && 'getUserMedia' in navigator.mediaDevices) {\n\t\t// Not adding `{ audio: true }` since we only want video now\n\t\tnavigator.mediaDevices.getUserMedia({\n\t\t\t//Kamera Constrains:\n\t\t\t\n\t\t\tvideo: \n\t\t\t{\n\t\t\t\twidth: {ideal: 50},\n\t\t\t\theight: {ideal: 50},\n\t\t\t\tfacingMode: ['environment']\n\t\t\t}\n\t\t\t}).then(function(stream) {\n\t\t\t\tstreamVideo = stream;\n\t\t\t\tcameraOk = true;\n\t\t\t\tvideo.srcObject = stream;\n\t\t\t\tvideo.play();\n\n\t\t\t\tvar track = stream.getVideoTracks()[0];\n\t\t\t\t//Taschenlampe einschalten:\n\t\t\t\tconst imageCapture = new ImageCapture(track)\n\t\t\t\tconst photoCapabilities = imageCapture.getPhotoCapabilities().then(() => {\n\t\t\t\t\ttrack.applyConstraints({\n\t\t\t\t\t\tadvanced: [{torch: true}]\n\t\t\t\t\t});\n\t\t\t\t});\n\n\n\n\t\t\t});\n\t\t}\n\n\n\t}",
"async function setupCamera() {\n const video = document.getElementById('video');\n const canvas = document.getElementById('canvas');\n if (!video || !canvas) return null;\n\n let msg = '';\n log('Setting up camera');\n // setup webcam. note that navigator.mediaDevices requires that page is accessed via https\n if (!navigator.mediaDevices) {\n log('Camera Error: access not supported');\n return null;\n }\n let stream;\n const constraints = {\n audio: false,\n video: { facingMode: 'user', resizeMode: 'crop-and-scale' },\n };\n if (window.innerWidth > window.innerHeight) constraints.video.width = { ideal: window.innerWidth };\n else constraints.video.height = { ideal: window.innerHeight };\n try {\n stream = await navigator.mediaDevices.getUserMedia(constraints);\n } catch (err) {\n if (err.name === 'PermissionDeniedError' || err.name === 'NotAllowedError') msg = 'camera permission denied';\n else if (err.name === 'SourceUnavailableError') msg = 'camera not available';\n log(`Camera Error: ${msg}: ${err.message || err}`);\n return null;\n }\n // @ts-ignore\n if (stream) video.srcObject = stream;\n else {\n log('Camera Error: stream empty');\n return null;\n }\n const track = stream.getVideoTracks()[0];\n const settings = track.getSettings();\n if (settings.deviceId) delete settings.deviceId;\n if (settings.groupId) delete settings.groupId;\n if (settings.aspectRatio) settings.aspectRatio = Math.trunc(100 * settings.aspectRatio) / 100;\n log(`Camera active: ${track.label}`); // ${str(constraints)}\n log(`Camera settings: ${str(settings)}`);\n canvas.addEventListener('click', () => {\n // @ts-ignore\n if (video && video.readyState >= 2) {\n // @ts-ignore\n if (video.paused) {\n // @ts-ignore\n video.play();\n detectVideo(video, canvas);\n } else {\n // @ts-ignore\n video.pause();\n }\n }\n // @ts-ignore\n log(`Camera state: ${video.paused ? 'paused' : 'playing'}`);\n });\n return new Promise((resolve) => {\n video.onloadeddata = async () => {\n // @ts-ignore\n canvas.width = video.videoWidth;\n // @ts-ignore\n canvas.height = video.videoHeight;\n // @ts-ignore\n video.play();\n detectVideo(video, canvas);\n resolve(true);\n };\n });\n}",
"async function setupCamera() {\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\n throw new Error(\n 'Browser API navigator.mediaDevices.getUserMedia not available');\n }\n\n const video = document.getElementById('video');\n video.width = videoWidth;\n video.height = videoHeight;\n\n const mobile = isMobile();\n const stream = await navigator.mediaDevices.getUserMedia({\n 'audio': false,\n 'video': {\n facingMode: 'user',\n width: mobile ? undefined : videoWidth,\n height: mobile ? undefined : videoHeight,\n },\n });\n video.srcObject = stream;\n\n return new Promise((resolve) => {\n video.onloadedmetadata = () => {\n resolve(video);\n };\n });\n}",
"async function setupCamera() {\n const video = document.getElementById('video');\n video.width = maxVideoSize;\n video.height = maxVideoSize;\n\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n const mobile = isMobile();\n const stream = await navigator.mediaDevices.getUserMedia({\n 'audio': false,\n 'video': {\n facingMode: 'environment',\n width: mobile ? undefined : maxVideoSize,\n height: mobile ? undefined: maxVideoSize}\n });\n video.srcObject = stream;\n\n return new Promise(resolve => {\n video.onloadedmetadata = () => {\n resolve(video);\n };\n });\n } else {\n const errorMessage = \"This browser does not support video capture, or this device does not have a camera\";\n alert(errorMessage);\n return Promise.reject(errorMessage);\n }\n}",
"async function setupCamera() {\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\n throw new Error(\n 'Browser API navigator.mediaDevices.getUserMedia not available');\n }\n\n const video = document.getElementById('webcam-video');\n video.width = videoWidth;\n video.height = videoHeight;\n\n // const mobile = isMobile();\n const stream = await navigator.mediaDevices.getUserMedia({\n 'audio': false,\n 'video': {\n facingMode: 'user',\n width: videoWidth,\n height: videoHeight,\n },\n });\n video.srcObject = stream;\n\n return new Promise((resolve) => {\n video.onloadedmetadata = () => {\n resolve(video);\n };\n });\n}",
"async function setupCamera() {\n const video = document.getElementById('video');\n video.width = maxVideoSize;\n video.height = maxVideoSize;\n\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n const mobile = isMobile();\n const stream = await navigator.mediaDevices.getUserMedia({\n 'audio': false,\n 'video': {\n facingMode: 'user',\n width: mobile ? undefined : maxVideoSize,\n height: mobile ? undefined: maxVideoSize}\n });\n video.srcObject = stream;\n\n return new Promise(resolve => {\n video.onloadedmetadata = () => {\n resolve(video);\n };\n });\n } else {\n const errorMessage = \"This browser does not support video capture, or this device does not have a camera\";\n alert(errorMessage);\n return Promise.reject(errorMessage);\n }\n}",
"function startCamera() {\n\n let constraints = {\n audio: false,\n video: {\n width: 640,\n height: 480,\n frameRate: 30\n }\n }\n\n video.setAttribute('width', 640);\n video.setAttribute('height', 480);\n video.setAttribute('autoplay', '');\n video.setAttribute('muted', '');\n video.setAttribute('playsinline', '');\n\n // Start video playback once the camera was fetched.\n function onStreamFetched(mediaStream) {\n video.srcObject = mediaStream;\n // Check whether we know the video dimensions yet, if so, start BRFv4.\n function onStreamDimensionsAvailable() {\n if (video.videoWidth === 0) {\n setTimeout(onStreamDimensionsAvailable, 100);\n } else {\n\n }\n }\n onStreamDimensionsAvailable();\n }\n\n window.navigator.mediaDevices.getUserMedia(constraints).then(onStreamFetched).catch(function() {\n alert(\"No camera available.\");\n });\n}",
"function startvideo() {\n webcam.style.width = document.width + 'px';\n webcam.style.height = document.height + 'px';\n webcam.setAttribute('autoplay', '');\n webcam.setAttribute('muted', '');\n\twebcam.setAttribute('playsinline', '');\n\n var constraints = {\n audio: false,\n video: {\n facingMode: 'user'\n }\n }\n \tnavigator.mediaDevices.getUserMedia(constraints).then(function success(stream) {\n webcam.srcObject = stream;\n initImages();\n animate();\n });\n}",
"function loadCamera() {\n // setup camera capture\n videoInput = createCapture(VIDEO);\n videoInput.size(400, 300);\n videoInput.position(0, 0);\n videoInput.id(\"v\");\n var mv = document.getElementById(\"v\");\n mv.muted = true;\n}",
"async function setupCamera() {\r\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\r\n throw new Error(\r\n 'Browser API navigator.mediaDevices.getUserMedia not available');\r\n }\r\n\r\n const camera = document.getElementById('camera');\r\n camera.width = cameraWidth;\r\n camera.height = cameraHeight;\r\n\r\n const mobile = isMobile();\r\n\r\n const stream = await navigator.mediaDevices.getUserMedia({\r\n 'audio': false,\r\n 'video': {\r\n facingMode: 'user',\r\n width: mobile ? undefined : cameraWidth,\r\n height: mobile ? undefined : cameraHeight,\r\n },\r\n });\r\n camera.srcObject = stream;\r\n\r\n return new Promise((resolve) => {\r\n camera.onloadedmetadata = () => {\r\n resolve(camera);\r\n };\r\n });\r\n}",
"async start() {\n if (this.webcamConfig.facingMode) {\n util.assert((this.webcamConfig.facingMode === 'user') ||\n (this.webcamConfig.facingMode === 'environment'), () => `Invalid webcam facing mode: ${this.webcamConfig.facingMode}. ` +\n `Please provide 'user' or 'environment'`);\n }\n try {\n this.stream = await navigator.mediaDevices.getUserMedia({\n video: {\n deviceId: this.webcamConfig.deviceId,\n facingMode: this.webcamConfig.facingMode ?\n this.webcamConfig.facingMode :\n 'user',\n width: this.webcamVideoElement.width,\n height: this.webcamVideoElement.height\n }\n });\n }\n catch (e) {\n // Modify the error message but leave the stack trace intact\n e.message = `Error thrown while initializing video stream: ${e.message}`;\n throw e;\n }\n if (!this.stream) {\n throw new Error('Could not obtain video from webcam.');\n }\n // Older browsers may not have srcObject\n try {\n this.webcamVideoElement.srcObject = this.stream;\n }\n catch (error) {\n console.log(error);\n this.webcamVideoElement.src = window.URL.createObjectURL(this.stream);\n }\n // Start the webcam video stream\n this.webcamVideoElement.play();\n this.isClosed = false;\n return new Promise(resolve => {\n // Add event listener to make sure the webcam has been fully initialized.\n this.webcamVideoElement.onloadedmetadata = () => {\n resolve();\n };\n });\n }",
"function cameraStart() {\n if(selfie === true){\n cameraView.classList.replace(\"user\", \"environment\");\n cameraOutput.classList.replace(\"user\", \"environment\");\n cameraSensor.classList.replace(\"user\", \"environment\");\n constraints = rearConstraints;\n selfie = false;\n }\n else{\n cameraView.classList.replace(\"environment\", \"user\");\n cameraOutput.classList.replace(\"environment\", \"user\");\n cameraSensor.classList.replace(\"environment\", \"user\");\n constraints = userConstraints;\n selfie = true;\n }\n\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}",
"function cameraStartFront() { \n frontCamera = true\n var constraints = { video: { facingMode: \"user\" }, audio: false };\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}",
"function cameraStart() {\n cameraView = document.querySelector(\"#webcam\");\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}",
"function cam() {\n snapBtn.addEventListener('click', enroll);\n // detectButton.addEventListener('click', detect);\n navigator.mediaDevices.getUserMedia({\n audio: false,\n video: {\n width: 500,\n height: 500\n }\n })\n .then(stream => {\n video.srcObject = stream;\n video.onloadedmetadata = video.play()\n })\n .catch(err => console.error(err));\n}",
"_switchCamera() {\n if (this.isVideoTrack() && this.videoType === _service_RTC_VideoType__WEBPACK_IMPORTED_MODULE_10___default.a.CAMERA && typeof this.track._switchCamera === 'function') {\n this.track._switchCamera();\n\n this._facingMode = this._facingMode === _service_RTC_CameraFacingMode__WEBPACK_IMPORTED_MODULE_7___default.a.ENVIRONMENT ? _service_RTC_CameraFacingMode__WEBPACK_IMPORTED_MODULE_7___default.a.USER : _service_RTC_CameraFacingMode__WEBPACK_IMPORTED_MODULE_7___default.a.ENVIRONMENT;\n }\n }",
"function getCamera(){\n document.getElementById('ownGifs').style.display=\"none\"\n document.getElementById('createGif').style.display=\"none\";\n document.getElementById('camera').style.display=\"inline-block\";\n var video = document.querySelector('video');\n stream = navigator.mediaDevices.getUserMedia(constraints)\n .then(function(mediaStream) {\n video.srcObject = mediaStream;\n video.onloadedmetadata = function(e) {\n video.play(); // Starting reproduce video cam\n };\n recorder = RecordRTC(mediaStream, { \n // disable logs\n disableLogs: true,\n type: \"gif\",\n frameRate: 1,\n width: 360,\n hidden: 240,\n quality: 10});\n })\n .catch(function(err) { \n\n }); // always check for errors at the end.\n\n \n}",
"async function setupCamera (config) {\n const { videoWidth, videoHeight } = config\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\n throw new Error(\n 'Browser API navigator.mediaDevices.getUserMedia not available'\n )\n }\n\n const video = document.getElementById('video')\n video.width = videoWidth\n video.height = videoHeight\n\n const mobile = isMobile()\n const stream = await navigator.mediaDevices.getUserMedia({\n audio: false,\n video: {\n facingMode: 'user',\n width: mobile ? undefined : videoWidth,\n height: mobile ? undefined : videoHeight\n }\n })\n video.srcObject = stream\n\n return new Promise(resolve => {\n video.onloadedmetadata = () => {\n resolve(video)\n }\n })\n}",
"function cameraStart() {\r\n navigator.mediaDevices\r\n .getUserMedia(constraints)\r\n .then(function(stream) {\r\n track = stream.getTracks()[0];\r\n cameraView.srcObject = stream;\r\n })\r\n .catch(function(error) {\r\n console.error(\"Oops. Something is broken.\", error);\r\n });\r\n}",
"function cameraStart() {\r\n navigator.mediaDevices\r\n .getUserMedia(constraints)\r\n .then(function(stream) {\r\n track = stream.getTracks()[0];\r\n cameraView.srcObject = stream;\r\n })\r\n .catch(function(error) {\r\n console.error(\"Oops. Something is broken.\", error);\r\n });\r\n}",
"async start() {\n if (this.webcamConfig.facingMode) {\n _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].assert((this.webcamConfig.facingMode === 'user') ||\n (this.webcamConfig.facingMode === 'environment'), () => `Invalid webcam facing mode: ${this.webcamConfig.facingMode}. ` +\n `Please provide 'user' or 'environment'`);\n }\n try {\n this.stream = await navigator.mediaDevices.getUserMedia({\n video: {\n deviceId: this.webcamConfig.deviceId,\n facingMode: this.webcamConfig.facingMode ?\n this.webcamConfig.facingMode :\n 'user',\n width: this.webcamVideoElement.width,\n height: this.webcamVideoElement.height\n }\n });\n }\n catch (e) {\n // Modify the error message but leave the stack trace intact\n e.message = `Error thrown while initializing video stream: ${e.message}`;\n throw e;\n }\n if (!this.stream) {\n throw new Error('Could not obtain video from webcam.');\n }\n // Older browsers may not have srcObject\n try {\n this.webcamVideoElement.srcObject = this.stream;\n }\n catch (error) {\n console.log(error);\n this.webcamVideoElement.src = window.URL.createObjectURL(this.stream);\n }\n // Start the webcam video stream\n this.webcamVideoElement.play();\n this.isClosed = false;\n return new Promise(resolve => {\n // Add event listener to make sure the webcam has been fully initialized.\n this.webcamVideoElement.onloadedmetadata = () => {\n resolve();\n };\n });\n }",
"function cameraStart() {\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function (stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function (error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}",
"function startVideo(){\n //gets the webcam, takes object as the first param, video is key, empty object as param\n navigator.getUserMedia(\n {video: {}},\n //whats coming from our webcam, setting it as source\n stream =>video.srcObject = stream,\n err => console.log(err))\n}",
"function cameraStart() {\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}",
"function cameraStart() {\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}",
"function cameraStart() {\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}",
"function cameraStart() {\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}",
"function setupCamera() {\n camera = new PerspectiveCamera(35, config.Screen.RATIO, 0.1, 300);\n camera.position.set(0, 8, 20);\n //camera.rotation.set(0,0,0);\n //camera.lookAt(player.position);\n console.log(\"Finished setting up Camera...\"\n + \"with x\" + camera.rotation.x + \" y:\" + camera.rotation.y + \" z:\" + camera.rotation.z);\n }",
"async function setupCamera() {\n let depthStream = await DepthCamera.getDepthStream();\n const depthVideo = document.getElementById('depthStream');\n depthVideo.srcObject = depthStream;\n return DepthCamera.getCameraCalibration(depthStream);\n}"
] | [
"0.76734245",
"0.74210167",
"0.7339442",
"0.7298811",
"0.72884417",
"0.72826576",
"0.72387886",
"0.7193497",
"0.7098979",
"0.709148",
"0.70444125",
"0.7037726",
"0.70060045",
"0.6965139",
"0.6923468",
"0.6908866",
"0.6832422",
"0.68167394",
"0.6798288",
"0.67865056",
"0.6764955",
"0.6762703",
"0.6756786",
"0.67466146",
"0.67402864",
"0.67402864",
"0.6718014",
"0.6718014",
"0.667351",
"0.6665457"
] | 0.8200102 | 0 |
converts it to a base b number. Return the new number as a string E.g. base_converter(5, 2) == "101" base_converter(31, 16) == "1f" | function baseConverter(num, b) {
if (num === 0) {
return ""
};
const digit = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];
return baseConverter((num/b), b) + digit[num % b];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function baseConverter(num, base) {\n const bases = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, \"a\", \"b\", \"c\", \"d\", \"e\", \"f\"]\n const possibleBases = bases.slice(0, base)\n\n let result = [];\n\n while (num >= base) {\n result.unshift(possibleBases[num % base])\n num = Math.floor(num / base)\n }\n result.unshift(num)\n return result.join(\"\")\n}",
"function baseConverter(decNumber, base) {\n\n\tvar remStack = new Stack(),\n\t\trem,\n\t\tbaseString = '';\n\t\tdigits = '0123456789ABCDEF';\n\n\twhile(decNumber > 0) {\n\t\trem = Math.floor(decNumber % base);\n\t\tremStack.push(rem);\n\t\tdecNumber = Math.floor(decNumber / base);\n\t}\n\n\twhile(!remStack.isEmpty()) {\n\t\tbaseString += digits[remStack.pop()];\n\t}\n\n\treturn baseString;\n}",
"function strBaseConverter (number,ob,nb) {\n number = number.toUpperCase();\n var list = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n var dec = 0;\n for (var i = 0; i <= number.length; i++) {\n dec += (list.indexOf(number.charAt(i))) * (Math.pow(ob , (number.length - i - 1)));\n }\n number = '';\n var magnitude = Math.floor((Math.log(dec)) / (Math.log(nb)));\n for (var i = magnitude; i >= 0; i--) {\n var amount = Math.floor(dec / Math.pow(nb,i));\n number = number + list.charAt(amount);\n dec -= amount * (Math.pow(nb,i));\n }\n return number;\n}",
"function baseConvert(base, number) {\n if (checkNum()) {\n let conversion = 0;\n let digits = number.split('').map(Number).reverse();\n base = Number(base);\n for (let place = digits.length - 1; place >= 0; place--) {\n conversion += (Math.pow(base, place)) * digits[place];\n }\n return conversion;\n }\n }",
"toBase10(value, b = 62) {\n const limit = value.length;\n let result = base.indexOf(value[0]);\n for (let i = 1; i < limit; i++) {\n result = b * result + base.indexOf(value[i]);\n }\n return result;\n }",
"function h$ghcjsbn_showBase(b, base) {\n h$ghcjsbn_assertValid_b(b, \"showBase\");\n h$ghcjsbn_assertValid_s(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === 1) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}",
"function h$ghcjsbn_showBase(b, base) {\n h$ghcjsbn_assertValid_b(b, \"showBase\");\n h$ghcjsbn_assertValid_s(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === 1) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}",
"function h$ghcjsbn_showBase(b, base) {\n h$ghcjsbn_assertValid_b(b, \"showBase\");\n h$ghcjsbn_assertValid_s(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === 1) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}",
"function h$ghcjsbn_showBase(b, base) {\n h$ghcjsbn_assertValid_b(b, \"showBase\");\n h$ghcjsbn_assertValid_s(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === 1) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}",
"function convertBase(str, fromBase, toBase) {\n const digits = parseToDigitsArray(str, fromBase);\n if (digits === null) return null;\n\n let outArray = [];\n let power = [1];\n for (let i = 0; i < digits.length; i += 1) {\n // invariant: at this point, fromBase^i = power\n if (digits[i]) {\n outArray = add(outArray, multiplyByNumber(digits[i], power, toBase), toBase);\n }\n power = multiplyByNumber(fromBase, power, toBase);\n }\n\n let out = '';\n for (let i = outArray.length - 1; i >= 0; i -= 1) {\n out += outArray[i].toString(toBase);\n }\n // if the original input was equivalent to zero, then 'out' will still be empty ''. Let's check for zero.\n if (out === '') {\n let sum = 0;\n for (let i = 0; i < digits.length; i += 1) {\n sum += digits[i];\n }\n if (sum === 0) out = '0';\n }\n\n return out;\n}",
"function base(dec, base) {\n var len = base.length;\n var ret = '';\n while(dec > 0) {\n ret = base.charAt(dec % len) + ret;\n dec = Math.floor(dec / len);\n }\n return ret;\n}",
"function $builtin_base_convert_helper(obj, base) {\n var prefix = \"\";\n switch(base){\n case 2:\n prefix = '0b'; break\n case 8:\n prefix = '0o'; break\n case 16:\n prefix = '0x'; break\n default:\n console.log('invalid base:' + base)\n }\n\n if(obj.__class__ === $B.long_int){\n var res = prefix + obj.value.toString(base)\n return res\n }\n\n var value = $B.$GetInt(obj)\n\n if(value === undefined){\n // need to raise an error\n throw _b_.TypeError.$factory('Error, argument must be an integer or' +\n ' contains an __index__ function')\n }\n\n if(value >= 0){return prefix + value.toString(base)}\n return '-' + prefix + (-value).toString(base)\n}",
"function h$ghcjsbn_showBase(b, base) {\n ASSERTVALID_B(b, \"showBase\");\n ASSERTVALID_S(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === GHCJSBN_EQ) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}",
"function toBaseOut(str,baseIn,baseOut,alphabet){var j,arr=[0],arrL,i=0,len=str.length;for(;i<len;){for(arrL=arr.length;arrL--;arr[arrL]*=baseIn){;}arr[0]+=alphabet.indexOf(str.charAt(i++));for(j=0;j<arr.length;j++){if(arr[j]>baseOut-1){if(arr[j+1]==null)arr[j+1]=0;arr[j+1]+=arr[j]/baseOut|0;arr[j]%=baseOut}}}return arr.reverse()}// Convert a numeric string of baseIn to a numeric string of baseOut.",
"function decimalToBase(decNumber, base) {\n if (!Number.isInteger(decNumber) || !Number.isInteger(base)) {\n throw TypeError('input number is not an integer');\n }\n if (!(base >= 2 && base <= 36)) {\n throw Error('invalid base')\n }\n\n const remStack = new Stack();\n const digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n let number = decNumber;\n let rem;\n let stringified = '';\n\n while (number > 0) {\n rem = number % base;\n remStack.push(rem);\n number = Math.floor(number / base);\n }\n\n while (!remStack.isEmpty()) {\n stringified += digits[remStack.pop()].toString();\n }\n\n return stringified;\n}",
"toBase(value, b = 62) {\n let r = value % b;\n let result = base[r];\n let q = Math.floor(value / b);\n while (q) {\n r = q % b;\n q = Math.floor(q / b);\n result = base[r] + result;\n }\n return result;\n }",
"function baseConvert(obj, begBase, endBase ){\n if (begBase < 2 && endBase > 36){\n throw new Error(\"Bases are not valid\");\n }else {\n return parseInt(obj, begBase).toString(endBase);\n }\n}",
"function convertBase( str, baseOut, baseIn, sign ) {\n\t var d, e, k, r, x, xc, y,\n\t i = str.indexOf( '.' ),\n\t dp = DECIMAL_PLACES,\n\t rm = ROUNDING_MODE;\n\n\t if ( baseIn < 37 ) str = str.toLowerCase();\n\n\t // Non-integer.\n\t if ( i >= 0 ) {\n\t k = POW_PRECISION;\n\n\t // Unlimited precision.\n\t POW_PRECISION = 0;\n\t str = str.replace( '.', '' );\n\t y = new BigNumber(baseIn);\n\t x = y.pow( str.length - i );\n\t POW_PRECISION = k;\n\n\t // Convert str as if an integer, then restore the fraction part by dividing the\n\t // result by its base raised to a power.\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n\t y.e = y.c.length;\n\t }\n\n\t // Convert the number as integer.\n\t xc = toBaseOut( str, baseIn, baseOut );\n\t e = k = xc.length;\n\n\t // Remove trailing zeros.\n\t for ( ; xc[--k] == 0; xc.pop() );\n\t if ( !xc[0] ) return '0';\n\n\t if ( i < 0 ) {\n\t --e;\n\t } else {\n\t x.c = xc;\n\t x.e = e;\n\n\t // sign is needed for correct rounding.\n\t x.s = sign;\n\t x = div( x, y, dp, rm, baseOut );\n\t xc = x.c;\n\t r = x.r;\n\t e = x.e;\n\t }\n\n\t d = e + dp + 1;\n\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\t i = xc[d];\n\t k = baseOut / 2;\n\t r = r || d < 0 || xc[d + 1] != null;\n\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\n\t if ( d < 1 || !xc[0] ) {\n\n\t // 1^-dp or 0.\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\n\t } else {\n\t xc.length = d;\n\n\t if (r) {\n\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\n\t xc[d] = 0;\n\n\t if ( !d ) {\n\t ++e;\n\t xc.unshift(1);\n\t }\n\t }\n\t }\n\n\t // Determine trailing zeros.\n\t for ( k = xc.length; !xc[--k]; );\n\n\t // E.g. [4, 11, 15] becomes 4bf.\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n\t str = toFixedPoint( str, e );\n\t }\n\n\t // The caller will add the sign.\n\t return str;\n\t }",
"function convertBase( str, baseOut, baseIn, sign ) {\n\t var d, e, k, r, x, xc, y,\n\t i = str.indexOf( '.' ),\n\t dp = DECIMAL_PLACES,\n\t rm = ROUNDING_MODE;\n\n\t if ( baseIn < 37 ) str = str.toLowerCase();\n\n\t // Non-integer.\n\t if ( i >= 0 ) {\n\t k = POW_PRECISION;\n\n\t // Unlimited precision.\n\t POW_PRECISION = 0;\n\t str = str.replace( '.', '' );\n\t y = new BigNumber(baseIn);\n\t x = y.pow( str.length - i );\n\t POW_PRECISION = k;\n\n\t // Convert str as if an integer, then restore the fraction part by dividing the\n\t // result by its base raised to a power.\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n\t y.e = y.c.length;\n\t }\n\n\t // Convert the number as integer.\n\t xc = toBaseOut( str, baseIn, baseOut );\n\t e = k = xc.length;\n\n\t // Remove trailing zeros.\n\t for ( ; xc[--k] == 0; xc.pop() );\n\t if ( !xc[0] ) return '0';\n\n\t if ( i < 0 ) {\n\t --e;\n\t } else {\n\t x.c = xc;\n\t x.e = e;\n\n\t // sign is needed for correct rounding.\n\t x.s = sign;\n\t x = div( x, y, dp, rm, baseOut );\n\t xc = x.c;\n\t r = x.r;\n\t e = x.e;\n\t }\n\n\t d = e + dp + 1;\n\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\t i = xc[d];\n\t k = baseOut / 2;\n\t r = r || d < 0 || xc[d + 1] != null;\n\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\n\t if ( d < 1 || !xc[0] ) {\n\n\t // 1^-dp or 0.\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\n\t } else {\n\t xc.length = d;\n\n\t if (r) {\n\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\n\t xc[d] = 0;\n\n\t if ( !d ) {\n\t ++e;\n\t xc.unshift(1);\n\t }\n\t }\n\t }\n\n\t // Determine trailing zeros.\n\t for ( k = xc.length; !xc[--k]; );\n\n\t // E.g. [4, 11, 15] becomes 4bf.\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n\t str = toFixedPoint( str, e );\n\t }\n\n\t // The caller will add the sign.\n\t return str;\n\t }",
"function convertBase( str, baseOut, baseIn, sign ) {\n\t var d, e, k, r, x, xc, y,\n\t i = str.indexOf( '.' ),\n\t dp = DECIMAL_PLACES,\n\t rm = ROUNDING_MODE;\n\t\n\t if ( baseIn < 37 ) str = str.toLowerCase();\n\t\n\t // Non-integer.\n\t if ( i >= 0 ) {\n\t k = POW_PRECISION;\n\t\n\t // Unlimited precision.\n\t POW_PRECISION = 0;\n\t str = str.replace( '.', '' );\n\t y = new BigNumber(baseIn);\n\t x = y.pow( str.length - i );\n\t POW_PRECISION = k;\n\t\n\t // Convert str as if an integer, then restore the fraction part by dividing the\n\t // result by its base raised to a power.\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n\t y.e = y.c.length;\n\t }\n\t\n\t // Convert the number as integer.\n\t xc = toBaseOut( str, baseIn, baseOut );\n\t e = k = xc.length;\n\t\n\t // Remove trailing zeros.\n\t for ( ; xc[--k] == 0; xc.pop() );\n\t if ( !xc[0] ) return '0';\n\t\n\t if ( i < 0 ) {\n\t --e;\n\t } else {\n\t x.c = xc;\n\t x.e = e;\n\t\n\t // sign is needed for correct rounding.\n\t x.s = sign;\n\t x = div( x, y, dp, rm, baseOut );\n\t xc = x.c;\n\t r = x.r;\n\t e = x.e;\n\t }\n\t\n\t d = e + dp + 1;\n\t\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\t i = xc[d];\n\t k = baseOut / 2;\n\t r = r || d < 0 || xc[d + 1] != null;\n\t\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\t\n\t if ( d < 1 || !xc[0] ) {\n\t\n\t // 1^-dp or 0.\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\n\t } else {\n\t xc.length = d;\n\t\n\t if (r) {\n\t\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\n\t xc[d] = 0;\n\t\n\t if ( !d ) {\n\t ++e;\n\t xc.unshift(1);\n\t }\n\t }\n\t }\n\t\n\t // Determine trailing zeros.\n\t for ( k = xc.length; !xc[--k]; );\n\t\n\t // E.g. [4, 11, 15] becomes 4bf.\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n\t str = toFixedPoint( str, e );\n\t }\n\t\n\t // The caller will add the sign.\n\t return str;\n\t }",
"function convertBase( str, baseOut, baseIn, sign ) {\n\t var d, e, k, r, x, xc, y,\n\t i = str.indexOf( '.' ),\n\t dp = DECIMAL_PLACES,\n\t rm = ROUNDING_MODE;\n\t\n\t if ( baseIn < 37 ) str = str.toLowerCase();\n\t\n\t // Non-integer.\n\t if ( i >= 0 ) {\n\t k = POW_PRECISION;\n\t\n\t // Unlimited precision.\n\t POW_PRECISION = 0;\n\t str = str.replace( '.', '' );\n\t y = new BigNumber(baseIn);\n\t x = y.pow( str.length - i );\n\t POW_PRECISION = k;\n\t\n\t // Convert str as if an integer, then restore the fraction part by dividing the\n\t // result by its base raised to a power.\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n\t y.e = y.c.length;\n\t }\n\t\n\t // Convert the number as integer.\n\t xc = toBaseOut( str, baseIn, baseOut );\n\t e = k = xc.length;\n\t\n\t // Remove trailing zeros.\n\t for ( ; xc[--k] == 0; xc.pop() );\n\t if ( !xc[0] ) return '0';\n\t\n\t if ( i < 0 ) {\n\t --e;\n\t } else {\n\t x.c = xc;\n\t x.e = e;\n\t\n\t // sign is needed for correct rounding.\n\t x.s = sign;\n\t x = div( x, y, dp, rm, baseOut );\n\t xc = x.c;\n\t r = x.r;\n\t e = x.e;\n\t }\n\t\n\t d = e + dp + 1;\n\t\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\t i = xc[d];\n\t k = baseOut / 2;\n\t r = r || d < 0 || xc[d + 1] != null;\n\t\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\t\n\t if ( d < 1 || !xc[0] ) {\n\t\n\t // 1^-dp or 0.\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\n\t } else {\n\t xc.length = d;\n\t\n\t if (r) {\n\t\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\n\t xc[d] = 0;\n\t\n\t if ( !d ) {\n\t ++e;\n\t xc = [1].concat(xc);\n\t }\n\t }\n\t }\n\t\n\t // Determine trailing zeros.\n\t for ( k = xc.length; !xc[--k]; );\n\t\n\t // E.g. [4, 11, 15] becomes 4bf.\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n\t str = toFixedPoint( str, e );\n\t }\n\t\n\t // The caller will add the sign.\n\t return str;\n\t }",
"function convertBase( str, baseOut, baseIn, sign ) {\r\n\t var d, e, k, r, x, xc, y,\r\n\t i = str.indexOf( '.' ),\r\n\t dp = DECIMAL_PLACES,\r\n\t rm = ROUNDING_MODE;\r\n\r\n\t if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n\t // Non-integer.\r\n\t if ( i >= 0 ) {\r\n\t k = POW_PRECISION;\r\n\r\n\t // Unlimited precision.\r\n\t POW_PRECISION = 0;\r\n\t str = str.replace( '.', '' );\r\n\t y = new BigNumber(baseIn);\r\n\t x = y.pow( str.length - i );\r\n\t POW_PRECISION = k;\r\n\r\n\t // Convert str as if an integer, then restore the fraction part by dividing the\r\n\t // result by its base raised to a power.\r\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n\t y.e = y.c.length;\r\n\t }\r\n\r\n\t // Convert the number as integer.\r\n\t xc = toBaseOut( str, baseIn, baseOut );\r\n\t e = k = xc.length;\r\n\r\n\t // Remove trailing zeros.\r\n\t for ( ; xc[--k] == 0; xc.pop() );\r\n\t if ( !xc[0] ) return '0';\r\n\r\n\t if ( i < 0 ) {\r\n\t --e;\r\n\t } else {\r\n\t x.c = xc;\r\n\t x.e = e;\r\n\r\n\t // sign is needed for correct rounding.\r\n\t x.s = sign;\r\n\t x = div( x, y, dp, rm, baseOut );\r\n\t xc = x.c;\r\n\t r = x.r;\r\n\t e = x.e;\r\n\t }\r\n\r\n\t d = e + dp + 1;\r\n\r\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n\t i = xc[d];\r\n\t k = baseOut / 2;\r\n\t r = r || d < 0 || xc[d + 1] != null;\r\n\r\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n\t rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n\t if ( d < 1 || !xc[0] ) {\r\n\r\n\t // 1^-dp or 0.\r\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\r\n\t } else {\r\n\t xc.length = d;\r\n\r\n\t if (r) {\r\n\r\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\r\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n\t xc[d] = 0;\r\n\r\n\t if ( !d ) {\r\n\t ++e;\r\n\t xc.unshift(1);\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t // Determine trailing zeros.\r\n\t for ( k = xc.length; !xc[--k]; );\r\n\r\n\t // E.g. [4, 11, 15] becomes 4bf.\r\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n\t str = toFixedPoint( str, e );\r\n\t }\r\n\r\n\t // The caller will add the sign.\r\n\t return str;\r\n\t }",
"function convertBase(str, baseIn, baseOut) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n strL = str.length;\n\n for (; i < strL;) {\n for (arrL = arr.length; arrL--;) {arr[arrL] *= baseIn;}\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\n for (j = 0; j < arr.length; j++) {\n if (arr[j] > baseOut - 1) {\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n }",
"function convertFromBaseTenToBaseX( xbase, inval ) {\n\n return inval.toString( xbase ).toUpperCase();\n\n /* let xinval = inval;\n let remainder = hexidecimal[ xinval % xbase ];\n while ( xinval >= xbase ) {\n let r1 = subtract( xinval, ( xinval % xbase ) );\n xinval = divide( r1, xbase );\n // in this case we do not want to add we want to append the strings together\n if ( xinval >= xbase ) {\n remainder = hexidecimal[ xinval % xbase ] + remainder;\n } else {\n remainder = hexidecimal[ xinval ] + remainder;\n }\n }\n return remainder; */\n}",
"function dec_to_bho(number, change_base) {\n if (change_base == B ){\n return parseInt(number + '', 10)\n .toString(2);} else\n if (change_base == H ){\n return parseInt(number + '', 10)\n .toString(8);} else \n if (change_base == O ){\n return parseInt(number + '', 10)\n .toString(8);} else\n console.log(\"pick H, B, or O\");\n\n }",
"function convertBase(str, baseOut, baseIn, sign) {\n var d,\n e,\n k,\n r,\n x,\n xc,\n y,\n i = str.indexOf('.'),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if (baseIn < 37) str = str.toLowerCase();\n\n // Non-integer.\n if (i >= 0) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace('.', '');\n y = new BigNumber(baseIn);\n x = y.pow(str.length - i);\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e), 10, baseOut);\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut(str, baseIn, baseOut);\n e = k = xc.length;\n\n // Remove trailing zeros.\n for (; xc[--k] == 0; xc.pop()) {}\n if (!xc[0]) return '0';\n\n if (i < 0) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div(x, y, dp, rm, baseOut);\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));\n\n if (d < 1 || !xc[0]) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint('1', -dp) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for (--baseOut; ++xc[--d] > baseOut;) {\n xc[d] = 0;\n\n if (!d) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for (k = xc.length; !xc[--k];) {}\n\n // E.g. [4, 11, 15] becomes 4bf.\n for (i = 0, str = ''; i <= k; str += ALPHABET.charAt(xc[i++])) {}\n str = toFixedPoint(str, e);\n }\n\n // The caller will add the sign.\n return str;\n }",
"function convertBase(str, baseOut, baseIn, sign) {\n var d,\n e,\n k,\n r,\n x,\n xc,\n y,\n i = str.indexOf('.'),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if (baseIn < 37) str = str.toLowerCase();\n\n // Non-integer.\n if (i >= 0) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace('.', '');\n y = new BigNumber(baseIn);\n x = y.pow(str.length - i);\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e), 10, baseOut);\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut(str, baseIn, baseOut);\n e = k = xc.length;\n\n // Remove trailing zeros.\n for (; xc[--k] == 0; xc.pop()) {}\n if (!xc[0]) return '0';\n\n if (i < 0) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div(x, y, dp, rm, baseOut);\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));\n\n if (d < 1 || !xc[0]) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint('1', -dp) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for (--baseOut; ++xc[--d] > baseOut;) {\n xc[d] = 0;\n\n if (!d) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for (k = xc.length; !xc[--k];) {}\n\n // E.g. [4, 11, 15] becomes 4bf.\n for (i = 0, str = ''; i <= k; str += ALPHABET.charAt(xc[i++])) {}\n str = toFixedPoint(str, e);\n }\n\n // The caller will add the sign.\n return str;\n }",
"function convertBase(str, baseOut, baseIn, sign) {\n var d,\n e,\n k,\n r,\n x,\n xc,\n y,\n i = str.indexOf('.'),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n if (baseIn < 37) str = str.toLowerCase(); // Non-integer.\n\n if (i >= 0) {\n k = POW_PRECISION; // Unlimited precision.\n\n POW_PRECISION = 0;\n str = str.replace('.', '');\n y = new BigNumber(baseIn);\n x = y.pow(str.length - i);\n POW_PRECISION = k; // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e), 10, baseOut);\n y.e = y.c.length;\n } // Convert the number as integer.\n\n\n xc = toBaseOut(str, baseIn, baseOut);\n e = k = xc.length; // Remove trailing zeros.\n\n for (; xc[--k] == 0; xc.pop()) {\n }\n\n if (!xc[0]) return '0';\n\n if (i < 0) {\n --e;\n } else {\n x.c = xc;\n x.e = e; // sign is needed for correct rounding.\n\n x.s = sign;\n x = div(x, y, dp, rm, baseOut);\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1; // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));\n\n if (d < 1 || !xc[0]) {\n // 1^-dp or 0.\n str = r ? toFixedPoint('1', -dp) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for (--baseOut; ++xc[--d] > baseOut;) {\n xc[d] = 0;\n\n if (!d) {\n ++e;\n xc.unshift(1);\n }\n }\n } // Determine trailing zeros.\n\n\n for (k = xc.length; !xc[--k];) {\n } // E.g. [4, 11, 15] becomes 4bf.\n\n\n for (i = 0, str = ''; i <= k; str += ALPHABET.charAt(xc[i++])) {\n }\n\n str = toFixedPoint(str, e);\n } // The caller will add the sign.\n\n\n return str;\n } // Perform division in the specified base. Called by div and convertBase.",
"function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }",
"function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }"
] | [
"0.78933334",
"0.7787537",
"0.76196146",
"0.746665",
"0.74133676",
"0.7408443",
"0.7408443",
"0.7408443",
"0.7408443",
"0.7367569",
"0.7335649",
"0.72488385",
"0.7197895",
"0.7121101",
"0.7059255",
"0.7058206",
"0.69450194",
"0.6917524",
"0.6917524",
"0.68824667",
"0.68824667",
"0.68236697",
"0.6814816",
"0.6798944",
"0.6797506",
"0.67898643",
"0.67898643",
"0.67874205",
"0.67802835",
"0.67802835"
] | 0.81513506 | 0 |
Add room name to DOM | function outputRoomName(room) {
const roomName = document.getElementById('room-name');
roomName.innerHTML = room;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function outputRoomName(room) {\n roomName.innerHTML = `<li class=\"contact\">\n <div class=\"wrap\">\n <div class=\"meta\">\n <p class=\"name\">${room}</p>\n </div>\n </div>\n </li>`\n}",
"function outputRoomName(room) {\n roomName.innerText = room;\n}",
"function outputRoomName(room) {\n roomName.innerText = room;\n}",
"function outputRoomName(room) {\n roomName.innerText = room;\n}",
"function outputRoomName(room) {\n roomName.innerText = room;\n}",
"function outputRoomName(room) {\n roomName.innerText = room;\n}",
"function outputRoomName(room) {\n roomName.innerText = room;\n}",
"function outputRoomName(room) {\n \n roomName.innerText = room;\n}",
"function outputRoomName(room) {\r\n roomName.innerText = room;\r\n}",
"function outputRoomName(room) {\r\n roomName.innerText = room;\r\n}",
"function outputRoomName(room){\n roomName.innerHTML = room;\n}",
"function outputRoomName(room) {\n roomName.innerText = room;\n}",
"function outputRoomName(room) {\n roomName.innerText = room;\n}",
"function outputRoomName(room) {\n roomName.innerText = room;\n}",
"function outputRoomName(room) {\n roomName.innerText = room;\n}",
"function outputRoomName(room){\n roomName.innerText = room;\n}",
"function outputRoomName(room){\n roomName.innerHTML = room;\n }",
"function outputRoomName(room){\n roomName.innerText = room;\n}",
"function outputRoomName(room){\n roomName.innerText=room;\n}",
"function outputRoomname(room){\n roomName.innerText = room;\n}",
"function outputRoomname(room){\n roomName.innerText= room;\n}",
"function outputRoomName(room){\n\n roomName.innerText=room;\n\n}",
"function setRoom(name) {\n\t$('#joinRoom').remove();\n\t$('h1').text('Room name : ' + name);\n\t$('body').append('<input type=\"hidden\" id=\"roomName\" value=\"'+name+'\"/>');\n\t$('body').addClass('active');\n}",
"function setChatroom(room) {\n $('#chatroom h1').append(room);\n}",
"function createRoom(name)\n\t{\n\t\tdocument.getElementsByClassName('dropdown-item selected')[0].className = 'dropdown-item'\n\n\t\tvar room = document.createElement('div')\n\t\troom.className = 'dropdown-item selected'\n\t\troom.innerText = name\n\t\tcreateDropdownClickMethod(room)\n\t\tget('create-room-name').value = ''\n\n\t\tdropdown.appendChild(room)\n\t\tdropdown.className = 'dropdown closed'\n\t}",
"function setRoom(name) {\r\n $('#createRoom').remove();\r\n $('h1').text(name);\r\n // $('#subTitle').text(name + \" || link: \"+ location.href);\r\n $('body').addClass('active');\r\n}",
"function addRoom(room){\n $outer.append(Mustache.render(roomTemplate, room));\n }",
"function populateRoomListView(user) {\n var name = document.getElementById(\"roomName\");\n var desc = document.getElementById(\"roomDesc\");\n var destroydate = document.getElementById(\"roomDest\");\n //var privacy = document.getElementById(\"privacy\");\n name.innerHTML = \"<strong>\"+room.Name+\"</strong>\";\n desc.innerHTML = room.Description;\n}",
"function setRoom(name) {\n $('form').remove();\n $('h1').text(name);\n $('#subTitle').text('Link to join: ' + location.href);\n $('body').addClass('active');\n }",
"function createRoomButton(roomInfo) {\n var header = roomInfo.name.charAt(0);\n\n var id = roomInfo.id;\n var room = `<li>\n <a href=\"#\" data-id=`+ roomInfo.id + `>\n <input type=\"hidden\" id=`+ id +` value=`+ roomInfo.name +` />\n <div class=\"media\" data-id=`+ roomInfo.id + ` class=\"list-group-item\">\n <div class=\"chat-user-img online align-self-center mr-3\" data-id=`+ roomInfo.id + ` >\n <div class=\"avatar-xs\" data-id=`+ roomInfo.id + `>\n <span class=\"avatar-title rounded-circle bg-soft-primary text-primary\" data-id=`+ roomInfo.id + `>\n ` + header.toUpperCase() + `\n </span>\n </div>\n </div>\n <div class=\"media-body overflow-hidden\" data-id=`+ roomInfo.id + `>\n <h5 class=\"text-truncate font-size-15 mb-1\" data-id=`+ roomInfo.id + `>` + roomInfo.name + `</h5>\n <p class=\"chat-user-message text-truncate mb-0\" data-id=`+ roomInfo.id + `>Hey! there I'm available</p>\n </div>\n </div>\n </a>\n </li>`;\n\n return room;\n}"
] | [
"0.7907107",
"0.7804841",
"0.7804841",
"0.7804841",
"0.7804841",
"0.7804841",
"0.7804841",
"0.77756387",
"0.7764691",
"0.7764691",
"0.77535206",
"0.7694868",
"0.7694868",
"0.7694868",
"0.7694868",
"0.76699555",
"0.7601553",
"0.7549329",
"0.7530662",
"0.74739176",
"0.7458124",
"0.73475415",
"0.72127086",
"0.70887303",
"0.69283646",
"0.67928314",
"0.66517746",
"0.6555788",
"0.65383327",
"0.6499427"
] | 0.7851127 | 1 |
Vanilla JS to delete tasks in 'Trash' column | function emptyTrash() {
/* Clear tasks from 'Trash' column */
document.getElementById("trash").innerHTML = "";
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteTasks() {\n const mutateCursor = getCursorToMutate();\n if (mutateCursor) {\n clickTaskMenu(mutateCursor, 'task-overflow-menu-delete', false);\n } else {\n withUnique(\n openMoreMenu(),\n 'li[data-action-hint=\"multi-select-toolbar-overflow-menu-delete\"]',\n click,\n );\n }\n }",
"function deleteTask()\n {\n var child = this.parentNode.parentNode;\n var parent = child.parentNode;\n parent.removeChild(child);\n var id= parent.id;\n var value = child.innerText;\n if (id == \"taskList\")\n {\n obj.taskListArr.splice(obj.taskListArr.indexOf(value), 1);\n }\n else \n {\n obj.taskCompletedArr.splice(obj.taskCompletedArr.indexOf(value), 1);\n } \n dataStorageUpdt();\n }",
"function emptyTrash() {\n /* Clear tasks from 'Trash' column */\n document.getElementById(\"monday\").innerHTML = \"\";\n document.getElementById(\"tuesday\").innerHTML = \"\";\n document.getElementById(\"wednesday\").innerHTML = \"\";\n document.getElementById(\"thursday\").innerHTML = \"\";\n document.getElementById(\"friday\").innerHTML = \"\";\n document.getElementById(\"saturday\").innerHTML = \"\";\n}",
"function deleteTask(e) {\n let index = this.dataset.index;\n let tyList = this.parentElement.parentElement.parentElement;\n if (tyList.getAttribute(\"id\") == \"lists\") {\n tasks.splice(index, 1);\n localStorage.setItem(\"tasks\", JSON.stringify(tasks));\n render(lists, tasks);\n }\n if (tyList.getAttribute(\"id\") == \"listOfChecked\") {\n tasksChecked.splice(index, 1);\n localStorage.setItem(\"tasksChecked\", JSON.stringify(tasksChecked));\n render(listOfChecked, tasksChecked);\n }\n}",
"function removeTask(event){\n // Get the index of the task to be removed\n let index = findIndexById(event.target.parentElement.id);\n\n // Confirm if the user wants to remove said task\n if(confirm(`Do you want to remove this task? \"${toDos[index].content}\"`)){\n // Use splice to delete the task object and reorder the array then update local storage\n toDos.splice(index, 1);\n ls.setJSON(key, JSON.stringify(toDos));\n\n // Update the list displayed to the user\n displayList();\n }\n}",
"function deleteTask() {\n const buttonDelete = document.querySelectorAll('.button-delete')\n buttonDelete.forEach(button => {\n button.onclick = function (event) {\n event.path.forEach(el => {\n if (el.classList?.contains(listItemClass)) {\n let id = +el.id\n listTask = listTask.filter(task => {\n if (task.id === id) {\n el.remove()\n return false\n }\n return true\n })\n showInfoNoTask()\n }\n })\n setTaskValue()\n localStorage.setItem('listTask', JSON.stringify(listTask))\n }\n })\n }",
"removeTask () {\n\t\tthis.deleter.addEventListener('click', (e) => {\n\t\t\tfetch('/items/'+e.target.parentNode.parentNode.parentNode.childNodes[0].getAttribute('data-task'), {\n\t\t\t\tmethod: 'DELETE',\n\t\t\t\theaders: {\n\t\t\t\t'Accept': 'application/json',\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t\t},\n\t\t\t\t\n\t\t\t})\n\t\t\t.then(res => res.text()) \n\t\t\t.then(res => console.log(res))\n\t\t\t.catch(error => console.error(error));\n\t\t\te.target.parentNode.parentNode.parentNode.remove();\n\t\t\tupdateProgess(numberOfCompletedTasks());\n\t\t});\n\n\t\t// We need to also remove tasks from the backend\n\t}",
"function removeTask(elem) {\n elem.parentNode.parentNode.removeChild(elem.parentNode);\n LIST[elem.id].trash = true;\n}",
"function deleteTask (e){\n for (var i = 0 ; i< loginUser.tasks.length; i ++){\n if(parseInt(loginUser.tasks[i].id) === parseInt(e.target.getAttribute('data-id'))){\n if(loginUser.tasks[i].status === false){\n taskToDo--;\n $('#countOfTask').text('').text('Task to do: '+ taskToDo);\n }\n loginUser.tasks.splice(i, 1);\n $('#task' + e.target.getAttribute('data-id')).remove();\n collectionOfUser.update(\n {\n id : loginUser.id,\n tasks : loginUser.tasks\n },\n function(user){\n loginUser = user;\n },\n error \n );\n }\n }\n }",
"function delete_task(e) {\n console.log('delete task btn pressed...');\n e.target.parentElement.remove();\n\n }",
"function deleteLS(delItem){\n console.log(\"delete activated\");\n let task;\n if(localStorage.getItem('task') === null)\n {\n task=[];\n }\n else\n {\n task=JSON.parse(localStorage.getItem('task'));\n\n\n }\n\n \n task.forEach(function(tasks,index){\n \n if(delItem.innerHTML === tasks){\n \n\n \n \n task.splice(index,1);\n }\n })\n localStorage.setItem('task',JSON.stringify(task));\n}",
"function deleteTask(id) {\r\n let Note = document.getElementById(id); \r\n //removes note from page\r\n document.getElementById(\"shoeNotesFromLS\").removeChild(Note); \r\n let indexOfTaskToRemove = tasks.findIndex(task => task.id === id);\r\n //removes from array of tasks\r\n tasks.splice(indexOfTaskToRemove, 1);\r\n //removes from array in local storage\r\n if (tasks.length != 0) {\r\n localStorage.tasks = JSON.stringify(tasks);\r\n }\r\n else {\r\n localStorage.removeItem(\"tasks\");\r\n }\r\n \r\n}",
"function deleteTask(e) {\n e.preventDefault();\n if (e.target.className === 'delete-task') {\n e.target.parentElement.remove();\n deleteTaskLocalStorage(e.target.parentElement.textContent);\n\n //alert('Tweet eliminado')\n }\n\n}",
"function removeTask(e) {\n if (e.target.parentElement.classList.contains('delete-item')) {\n if (confirm('Are you sure?')) {\n e.target.parentElement.parentElement.remove();\n\n removeTaskFromLocalStorage(Number(e.target.parentElement.parentElement.id.substring(5)))\n }\n }\n}",
"function deleteTask(event) {\n const taskListItem = this.parentNode.parentNode;\n const keyValue = taskListItem.querySelector('input').dataset.key\n taskListItem.parentNode.removeChild(taskListItem);\n\n\n manageTasksAjax(event, '', keyValue, 'delete')\n}",
"function removeTask(e) {\n // Clicking on the delete button causes the removal of that list item\n if (e.target.parentElement.classList.contains('delete-item')){\n e.target.parentElement.parentElement.remove();\n removeLocalStorage(e.target.parentElement.parentElement.textContent);\n // Refresh the list to mirror local storage contents as all duplicates are removed\n getTasks(e);\n }\n e.preventDefault();\n}",
"function deleteList(c) {\n\tconst taskDel = document.querySelector(`.item-${c}`);\n\ttaskDel.firstElementChild.addEventListener(\"click\", () => {\n\t\tif (confirm(\"Are you sure?\")) {\n\t\t\ttaskDel.remove();\n\t\t\tconsole.log(taskDel.textContent);\n\t\t\tremoveFromStorage(taskDel.textContent);\n\t\t}\n\t});\n}",
"function removeTask(e){\n if (e.target.parentElement.classList.contains('delete-item')){\n if(confirm('u sure, dude?')){\n e.target.parentElement.parentElement.remove(); \n\n //remove from local storage\n removeTaskFromLocalStorage(e.target.parentElement.parentElement);\n }\n }\n}",
"function removeTask(e) {\n\tif (e.target.parentElement.classList.contains('delete-item')) {\n\t\tif (confirm('Are You Sure?')) {\n\t\t\te.target.parentElement.parentElement.remove();\n\t\t\t/*Ako parentElement ima klasu delete-item onda hocu da...*/\n\n\t\t\t//-Remove from LS-//\n\t\t\tremoveTasksFromLocalStorage(e.target.parentElement.parentElement);//Funkcija za brisanje iz LS\n\t\t}\n\t}\n}",
"function deleteTask(description) {\n\tvar username = localStorage.getItem(\"username\"); \n\tdatabase.ref('/task/'+username+'/'+description).remove();\n\tswal('Task deleted','','success').then((result) => {\n\t\twindow.location.reload();\n\t});\n\t\n\t\n}",
"function removeTask(e) {\n if(e.target.parentElement.classList.contains\n ('delete-item')) {\n if(confirm('Are You Sure?')) {\n e.target.parentElement.parentElement.remove();\n //Remove from LS\n removeTaskFromLocalStorage\n (e.target.parentElement.parentElement);\n\n \n }\n}\n\n}",
"function clearTasks(e){\n //taskList.innerHTML = '';\n while(taskList.firstChild){\n taskList.removeChild(taskList.firstChild);\n }\n let deletedTasks;\n \n deletedTasks = localStorage.getItem('tasks')\n \n localStorage.setItem('deletedTasks',deletedTasks)\n localStorage.removeItem('tasks')\n //localStorage.clear()\n e.preventDefault()\n}",
"function removeTask(e) {\r\n let li = e.target.parentElement.parentElement;\r\n let a = e.target.parentElement;\r\n if (a.classList.contains('delete-item')) {\r\n if (confirm('Are You Sure ?')) {\r\n li.remove();\r\n removeFromLS(li);\r\n }\r\n }\r\n}",
"function deleteTask() {\n this.parentNode.parentNode.removeChild(this.parentNode);\n }",
"function deleteTaskFromToDoList(event) {\n event.target.parentElement.remove();\n}",
"function deleteTask(event)\n{\n //gets button id\n let id = event.target.id;\n\n //gets task position from button id\n let taskPosition = id.replace(/\\D/g,'');\n\n //removes task from task array\n taskArr.splice(taskPosition - 1, 1); \n\n //loop through task array to adjust position\n for(let i = 0; i < taskArr.length; i++)\n {\n taskArr[i].position = i + 1;\n };\n\n //rewrites task list\n rewritesList();\n}",
"function removeTask(e) {\n\n if (e.target.parentElement.classList.contains('delete-item')) {\n if (confirm('Are you sure!!')) {\n e.target.parentElement.parentElement.remove();\n }\n }\n removeItemFromLocalStorage(e.target.parentElement.parentElement);\n}",
"function removeTask(){\n\t\t$(\".remove\").unbind(\"click\").click(function(){\n\t\t\tvar single = $(this).closest(\"li\");\n\t\t\t\n\t\t\ttoDoList.splice(single.index(), 1);\n\t\t\tsingle.remove();\n\t\t\ttoDoCount();\n\t\t\tnotToDoCount();\n\t\t\taddClear();\n\t\t});\n\t}",
"function deleteAllCompletedTodos() {\n // Write your code here...\n}",
"function deleteAllCompletedTodos() {\n // Write your code here...\n}"
] | [
"0.7403256",
"0.72473013",
"0.7158116",
"0.7153182",
"0.71489525",
"0.7123197",
"0.70864403",
"0.70445865",
"0.70080054",
"0.6972743",
"0.6972021",
"0.69592506",
"0.6953322",
"0.69066185",
"0.6871405",
"0.68564725",
"0.6838206",
"0.6827074",
"0.68257725",
"0.6818862",
"0.68032724",
"0.6795183",
"0.6789422",
"0.67869186",
"0.6783482",
"0.67824054",
"0.67822033",
"0.67680055",
"0.6765169",
"0.6765169"
] | 0.7694405 | 0 |
handleMessage: do the entire sequence for this message. subscribe: send the machine if available, else send error. any other command: send error. This method returns a promise that usually resolves. It rejects only if there is a bug or internal error. | handleMessage(clientId, data) {
return new Promise( (resolve, reject) => {
log(`client ${clientId}: |${data}|`);
if (data.match(/^\s*subscribe\s+/)) {
const m = data.match(/subscribe\s+(\w+)/);
if (m) {
let machine = m[1];
this.subscribe(clientId, machine)
.then( () => {
log(`subscribed ${clientId} to machine ${machine}`);
resolve();
})
.catch( errMsg => {
const fullMsg = `error: ${errMsg}`;
log(fullMsg);
this.sendMessage(clientId, fullMsg)
.then(resolve)
.catch(reject);
});
} else {
const msg = `error: bad subscribe command`;
log(`sending ${msg} to client ${clientId}`);
this.sendMessage(clientId, `${msg}`)
.then(resolve)
.catch(reject);
}
} else if (data.match(/^command\s+/)) {
const m = data.match(/^\s*command\s+(\w+)/);
const arr = data.split('\n').filter( e => e.length > 0);
if (!m) {
log(`did not match command pattern`);
return reject(`bad command line: ${arr[0]}`);
}
log(`emitting command ${m[1]} ${clientId}: |${arr.slice(1)}|`);
this.emit('command', m[1], clientId, arr.slice(1));
return resolve();
} else {
const msg = `bad command: |${trunc(data)}|`;
console.log(`sending ${msg} to client ${clientId}`);
this.sendMessage(clientId, msg)
.then(resolve)
.catch(reject);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function handleMessage(msg, reply) {\n let response = 'success';\n try {\n if (msg.command == 'capture') {\n if (!msg.streamId) {\n throw new Error('No stream ID received');\n }\n await startCapture(msg.streamId);\n } else if (msg.command == 'stop') {\n stopCapture();\n } else {\n throw new Error(\n `Unexpected message: ${JSON.stringify(message)}`);\n }\n } catch (e) {\n response = e.toString();\n }\n reply(response);\n}",
"function sendMessage(message) {\n return new RSVP.Promise(function (resolve, reject) {\n spec._processor.onmessage = function (event) {\n if (event.data.error) {\n return reject(event.data.error);\n } else {\n return resolve(event.data.data);\n }\n };\n return spec._processor.postMessage(message);\n });\n }",
"receiveMessage(message) {\n return new Promise((resolve, reject) => {\n if (message instanceof Message){\n this.messageEventCallbacks.forEach(cb=>{\n cb(message);\n });\n }\n resolve();\n })\n }",
"function handleMessage(message) {\n if (closed)\n fail(new Error('Client cannot send messages after being closed'));\n\n //TODO for debugging purposes\n pubsub.emit('message', message);\n\n const commandName = message.command;\n delete message.command;\n\n //look for command in list of commands and check if exists\n const commandModule = commands[commandName];\n if (commandModule) {\n //TODO move this into the command modules\n //check params\n try {\n ow(message, commandModule.paramType);\n } catch (error) {\n throw new MyaError(`Invalid arguments passed to ${commandModule}`, 'INVALID_ARGUMENTS', error);\n }\n\n //run the command\n commandModule.run(client, message);\n } else {\n throw new MyaError(`Command ${commandName} does not exist`, 'COMMAND_NOT_FOUND');\n }\n }",
"_handleMessage(message) {\n // command response\n if (message.id) {\n const callback = this._callbacks[message.id];\n if (!callback) {\n return;\n }\n // interpret the lack of both 'error' and 'result' as success\n // (this may happen with node-inspector)\n if (message.error) {\n callback(true, message.error);\n } else {\n callback(false, message.result || {});\n }\n // unregister command response callback\n delete this._callbacks[message.id];\n // notify when there are no more pending commands\n if (Object.keys(this._callbacks).length === 0) {\n this.emit('ready');\n }\n }\n // event\n else if (message.method) {\n const {method, params, sessionId} = message;\n this.emit('event', message);\n this.emit(method, params, sessionId);\n this.emit(`${method}.${sessionId}`, params, sessionId);\n }\n }",
"function handleShellMessage(kernel, msg) {\n var future;\n try {\n future = kernel.sendShellMessage(msg, true);\n }\n catch (e) {\n return Promise.reject(e);\n }\n return new Promise(function (resolve) { future.onReply = resolve; });\n }",
"function handleShellMessage(kernel, msg) {\n var future;\n try {\n future = kernel.sendShellMessage(msg, true);\n }\n catch (e) {\n return Promise.reject(e);\n }\n return new Promise(function (resolve, reject) {\n future.onReply = function (reply) {\n resolve(reply);\n };\n });\n }",
"async __receiveMsg() {\n let msg;\n try {\n msg = await this.sqs.receiveMessage({\n QueueUrl: this.queueUrl,\n MaxNumberOfMessages: this.maxNumberOfMessages,\n WaitTimeSeconds: this.waitTimeSeconds,\n VisibilityTimeout: this.visibilityTimeout,\n }).promise();\n } catch (err) {\n this.emit('error', err, 'api');\n return;\n }\n\n let msgs = [];\n if (msg.Messages) {\n if (!Array.isArray(msg.Messages)) {\n this.emit('error', new Error('SQS Api returned non-list'), 'api');\n return;\n }\n msgs = msg.Messages;\n }\n this.debug('received %d messages', msgs.length);\n\n // We never want this to actually throw. The __handleMsg function should\n // take care of emitting the error event\n try {\n if (this.sequential) {\n for (let msg of msgs) {\n await this.__handleMsg(msg);\n }\n } else {\n await Promise.all(msgs.map(x => this.__handleMsg(x)));\n }\n } catch (err) {\n let error = new Error('__handleMsg is rejecting when it ought not to. ' +\n 'This is a programming error in QueueListener.__handleMsg()');\n error.underlyingErr = err;\n error.underlyingStack = err.stack || '';\n this.debug('This really should not happen... %j', error);\n this.emit('error', error, 'api');\n }\n\n if (this.running) {\n // Same as the call in .start(), but here we do a small timeout of 50ms\n // just to make sure that we're not totally starving eveything\n setTimeout(async () => {\n await this.__receiveMsg();\n }, 50);\n } else {\n this.emit('stopped');\n }\n }",
"_sendCommMessages() {\n let topMessage;\n return Promise.try(() => {\n if (!this.comm) {\n // TODO: try to init comm channel here\n throw new Error('Comm channel not initialized, not sending message.');\n }\n while (this.messageQueue.length) {\n topMessage = this.messageQueue.shift();\n this.comm.send(this._transformMessage(topMessage));\n this.debug(`sending comm message: ${COMM_NAME} ${topMessage.msgType}`);\n }\n }).catch((err) => {\n console.error('ERROR sending comm message', err.message, err, topMessage);\n throw new Error('ERROR sending comm message: ' + err.message);\n });\n }",
"send(message) {\n\n\n return new Promise((resolve, reject) => {\n if (this._connected) {\n\n let delivery = false;\n\n\n if (!message.id) {\n message.id = this.autoId();\n }\n\n this._ws.send(JSON.stringify(message));\n\n const cb = (data) => {\n delivery = true;\n return resolve(data);\n };\n\n\n const key = `__reply__${get(message, 'id')}`;\n\n this.on(key, cb);\n\n this._timeout = setTimeout(() => {\n if (!delivery) {\n this._event.off(key, cb);\n return reject(\"Unable send message to the server.\");\n } else {\n clearTimeout(this._timeout);\n }\n\n }, 10000);\n\n } else {\n return reject(\"You are not connected\");\n }\n });\n }",
"async function handleMessage(message){\n\t\tconsole.debug(\"[DEBUG] Message from: \", message);\n\t\tif (message.request === \"GETACTIVETASKS\"){ // get all tasks and return them\n console.debug(\"[BACKEND] Message received: \", message);\n\t\t\tawait returnActiveTasks(message, sendResponse);\t\t\t\n } \n else if (message.request === 'ADDNEWTASK'){ // add the payload as new data\n let payload = message.payload;\n let hash = \"\" + payload.title + payload.creationDate;\n payload.hash = hash;\n saveNewTaskToDatabase(payload);\n }\n else if (message.request === 'DELETETASK'){ // delete task from database\n await delteTaskFromDatabase(message);\n }\n else if (message.request === 'RESOLVETASK'){ // move task from active to resolved store\n await resolveTask(message);\n }\n else if (message.request === 'GETRESOLVEDTASKS'){ // get all removed tasks and return them\n await returnResolvedTasks(message, sendResponse);\n }\n else if (message.request === 'GETRESOLVEDTASKBYHASH'){\n await returnResolvedTaskByHash(message, sendResponse);\n }\n \n else {\n\t\t\tconsole.error(\"[ERROR] Unable to handle request from: \", message);\n\t\t}\n\t}",
"joinSystemMsgRoom() {\n\n // Received direct message from cloud\n io.socket.on( 'sysmsg:' + _deviceUDID, ( data ) => {\n if ( _sysMsgCb ) {\n this.$rootScope.$apply( () => {\n _sysMsgCb( data );\n } );\n } else {\n console.log( 'Dropping sio DEVICE_DM message rx (no cb)' );\n }\n } )\n\n return new Promise( ( resolve, reject ) => {\n\n io.socket.post( '/ogdevice/subSystemMessages', {\n deviceUDID: _deviceUDID\n }, ( resData, jwres ) => {\n this.$log.debug( resData );\n if ( jwres.statusCode !== 200 ) {\n reject( jwres );\n } else {\n this.$log.debug( \"Successfully joined sysmsg room for this device\" );\n resolve();\n }\n } );\n } );\n\n }",
"function handleMessage(msg) { // process message asynchronously\n setTimeout(function () {\n messageHandler(msg);\n }, 0);\n }",
"async _onMessage(connection, message) {\n switch (message.type) {\n case signalr.MessageType.Invocation:\n try {\n var method = this._methods[message.target.toLowerCase()];\n var result = await method.apply(this, message.arguments);\n connection.completion(message.invocationId, result);\n }\n catch (e) {\n connection.completion(message.invocationId, null, 'There was an error invoking the hub');\n }\n break;\n case signalr.MessageType.StreamItem:\n break;\n case signalr.MessageType.Ping:\n // TODO: Detect client timeout\n break;\n default:\n console.error(`Invalid message type: ${message.type}.`);\n break;\n }\n }",
"function doSendMessage(message) {\n return new Promise(resolve => {\n chrome.runtime.sendMessage(chrome.runtime.id, message, {}, resolve);\n });\n}",
"waitForMessage_() {\n this.wait_(4, buffer => {\n this.wait_(buffer.readUInt32BE(0), buffer => {\n this.push(this.getMessage_(buffer));\n process.nextTick(() => this.waitForMessage_());\n });\n });\n }",
"function simulate(messageHandler, message) {\n console.log('[In]', message);\n return processMessage(messageHandler, message).then(response => {\n if (response === false) {\n console.log('-');\n }\n else {\n console.log('[Out]', response);\n }\n });\n}",
"function consume({ connection, channel }) {\n return new Promise((resolve, reject) => {\n channel.consume(\"processing.results\", async function (msg) {\n // parse message\n let msgBody = msg.content.toString();\n let data = JSON.parse(msgBody);\n let requestId = data.requestId;\n let processingResults = data.processingResults;\n console.log(\"[x]Received a result message, requestId:\", requestId, \"processingResults:\", processingResults);\n\n\n // acknowledge message as received\n await channel.ack(msg);\n // send notification to browsers\n app.io.sockets.emit(requestId + '_new message', \"SUCESS\");\n\n });\n\n // handle connection closed\n connection.on(\"close\", (err) => {\n return reject(err);\n });\n\n // handle errors\n connection.on(\"error\", (err) => {\n return reject(err);\n });\n });\n }",
"onMessage(data) {\n const {id, error, result} = JSON.parse(data);\n const promise = this.currentMessages[id];\n if(!promise) return;\n \n if(error) {\n promise.reject(error);\n } else {\n promise.resolve(result);\n }\n\n delete this.currentMessages[id];\n }",
"subscribeToMessageChannel() {\n this.subscription = subscribe(\n this.messageContext,\n RECORD_SELECTED_CHANNEL,\n (message) => {\n console.log(message);\n this.handleMessage(message); \n }\n );\n \n\n }",
"function sendMessage(message) {\r\n return new Promise( (resolve, reject) => {\r\n console.log(\"sendMessage\", message);\r\n setTimeout(() => {\r\n if(!ALLOW_RANDOM_FAILURE || Math.random < 0.5){\r\n echoServer.emit(\"sendMessage\", {\r\n name: MY_USER_NAME,\r\n message,\r\n });\r\n console.log(\"message sent\", message);\r\n resolve(\"OK\");\r\n } else {\r\n reject(\"TIMEOUT\");\r\n }\r\n }, Math.random() * 150);\r\n });\r\n}",
"__receiveMessage(msg) {\n var implCmdName = '_cmd_' + msg.type;\n if (!(implCmdName in this)) {\n logic(this, 'badMessageTypeError', { type: msg.type });\n return;\n }\n try {\n let namedContext = msg.handle &&\n this.bridgeContext.maybeGetNamedContext(msg.handle);\n if (namedContext) {\n if (namedContext.pendingCommand) {\n console.warn('deferring', msg);\n namedContext.commandQueue.push(msg);\n } else {\n let promise = namedContext.pendingCommand =\n this._processCommand(msg, implCmdName);\n if (promise) {\n this._trackCommandForNamedContext(namedContext, promise);\n }\n }\n } else {\n let promise = this._processCommand(msg, implCmdName);\n // If the command went async, then it's also possible that the command\n // grew a namedContext and that we therefore need to get it and set up the\n // bookkeeping so that if any other commands come in on this handle before\n // the promise is resolved that we can properly queue them.\n if (promise && msg.handle) {\n namedContext = this.bridgeContext.maybeGetNamedContext(msg.handle);\n if (namedContext) {\n namedContext.pendingCommand = promise;\n this._trackCommandForNamedContext(namedContext, promise);\n }\n }\n }\n } catch (ex) {\n logic(this, 'cmdError', { type: msg.type, ex, stack: ex.stack });\n }\n }",
"function promiseMessage(messageName, params = {}, paramsAsCPOW = {}) {\n let requestName, responseName;\n\n if (typeof messageName === 'string') {\n requestName = responseName = messageName;\n }\n else {\n requestName = messageName.request;\n responseName = messageName.response;\n }\n\n // A message manager for the current browser.\n let mm = gBrowser.selectedBrowser.messageManager;\n\n return new Promise((resolve) => {\n // TODO: Make sure the response is associated with this request.\n mm.sendAsyncMessage(requestName, params, paramsAsCPOW);\n\n let onMessage = (message) => {\n mm.removeMessageListener(responseName, onMessage);\n\n resolve(message.data);\n };\n\n mm.addMessageListener(responseName, onMessage);\n });\n }",
"send(message) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.gatewayInstance) {\n throw new Error('No gateway instance initialized for the Text messages service');\n }\n else if (!message) {\n throw new Error('No message provided for the Text gateway service');\n }\n return this.gatewayInstance.send(message);\n });\n }",
"async process(message, phrase) {\n const commandDefs = this.command.argumentDefaults;\n const handlerDefs = this.handler.argumentDefaults;\n const optional = Util_1.default.choice(typeof this.prompt === \"object\" && this.prompt && this.prompt.optional, commandDefs.prompt && commandDefs.prompt.optional, handlerDefs.prompt && handlerDefs.prompt.optional);\n const doOtherwise = async (failure) => {\n const otherwise = Util_1.default.choice(this.otherwise, commandDefs.otherwise, handlerDefs.otherwise);\n const modifyOtherwise = Util_1.default.choice(this.modifyOtherwise, commandDefs.modifyOtherwise, handlerDefs.modifyOtherwise);\n let text = await Util_1.default.intoCallable(otherwise).call(this, message, {\n phrase,\n failure\n });\n if (Array.isArray(text)) {\n text = text.join(\"\\n\");\n }\n if (modifyOtherwise) {\n text = await modifyOtherwise.call(this, message, text, {\n phrase,\n failure: failure\n });\n if (Array.isArray(text)) {\n text = text.join(\"\\n\");\n }\n }\n if (text) {\n const sent = await message.channel.send(text);\n if (message.util)\n message.util.addMessage(sent);\n }\n return Flag_1.default.cancel();\n };\n if (!phrase && optional) {\n if (this.otherwise != null) {\n return doOtherwise(null);\n }\n return Util_1.default.intoCallable(this.default)(message, {\n phrase,\n failure: null\n });\n }\n const res = await this.cast(message, phrase);\n if (Argument.isFailure(res)) {\n if (this.otherwise != null) {\n return doOtherwise(res);\n }\n if (this.prompt != null) {\n return this.collect(message, phrase, res);\n }\n return this.default == null ? res : Util_1.default.intoCallable(this.default)(message, { phrase, failure: res });\n }\n return res;\n }",
"async function receiveMessage() {\n const sqs = new AWS.SQS();\n\n try {\n // to simplify running multiple workers in parallel, \n // fetch one message at a time\n const data = await sqs.receiveMessage({\n QueueUrl: config.queue.url,\n VisibilityTimeout: config.queue.visibilityTimeout,\n MaxNumberOfMessages: 1\n }).promise();\n\n if (data.Messages && data.Messages.length > 0) {\n const message = data.Messages[0];\n const params = JSON.parse(message.Body);\n\n // while processing is not complete, update the message's visibilityTimeout\n const intervalId = setInterval(_ => sqs.changeMessageVisibility({\n QueueUrl: config.queue.url,\n ReceiptHandle: message.ReceiptHandle,\n VisibilityTimeout: config.queue.visibilityTimeout\n }), 1000 * 60);\n\n // processMessage should return a boolean status indicating success or failure\n const status = await processMessage(params);\n clearInterval(intervalId);\n \n // if message was not processed successfully, send it to the\n // error queue (add metadata in future if needed)\n if (!status) {\n await sqs.sendMessage({\n QueueUrl: config.queue.errorUrl,\n MessageBody: JSON.stringify(params),\n }).promise();\n }\n\n // remove original message from queue once processed\n await sqs.deleteMessage({\n QueueUrl: config.queue.url,\n ReceiptHandle: message.ReceiptHandle\n }).promise();\n }\n } catch (e) {\n // catch exceptions related to sqs\n logger.error(e);\n } finally {\n // schedule receiving next message\n setTimeout(receiveMessage, config.queue.pollInterval);\n }\n}",
"function send_message_to_client(client, msg){\n return new Promise((resolve, reject) => {\n var msg_chan = new MessageChannel();\n msg_chan.port1.onmessage = function(event){\n if(event.data.error){\n reject(event.data.error);\n }else{\n resolve(event.data);\n }\n };\n\n client.postMessage(\"SW Says: '\"+msg+\"'\", [msg_chan.port2]);\n });\n}",
"handleMessage(msg) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!msg.author)\n return; // this is a bug and shouldn't really happen\n if (this.ignoreBots && msg.author.bot)\n return;\n // Construct a partial context (without prefix or command name)\n const partialContext = Object.assign({\n client: this,\n }, this.contextAdditions);\n // Is the message properly prefixed? If not, we can ignore it\n const matchResult = yield this.splitPrefixFromContent(msg, partialContext);\n if (!matchResult)\n return;\n // It is! We can\n const [prefix, content] = matchResult;\n // If there is no content past the prefix, we don't have a command\n if (!content) {\n // But a lone mention will trigger the default command instead\n if (!prefix || !prefix.match(this.mentionPrefixRegExp))\n return;\n const defaultCommand = this.defaultCommand;\n if (!defaultCommand)\n return;\n defaultCommand.execute(msg, [], Object.assign({\n client: this,\n prefix,\n }, this.contextAdditions));\n return;\n }\n // Separate command name from arguments and find command object\n const args = content.split(' ');\n const commandName = args.shift();\n if (commandName === undefined)\n return;\n const command = this.commandForName(commandName);\n // Construct a full context object now that we have all the info\n const fullContext = Object.assign({\n prefix,\n commandName,\n }, partialContext);\n // If the message has command but that command is not found\n if (!command) {\n this.emit('invalidCommand', msg, args, fullContext);\n return;\n }\n // Do the things\n this.emit('preCommand', command, msg, args, fullContext);\n const executed = yield command.execute(msg, args, fullContext);\n if (executed)\n this.emit('postCommand', command, msg, args, fullContext);\n });\n }",
"message(msg) {\n const sessionPath = this.sessionClient.sessionPath(projectId, sessionId);\n const request = {\n session: sessionPath,\n queryInput: {\n text: {\n text: msg,\n languageCode: languageCode,\n },\n },\n };\n\n const processMessage = (resolve, reject) => {\n this.sessionClient\n .detectIntent(request)\n .then(responses => {\n if (responses.length === 0 || !responses[0].queryResult) {\n reject(new Error('incorrect Dialog Flow answer'));\n } else {\n resolve(responses[0].queryResult);\n }\n })\n .catch(err => {\n console.error('ERROR:', err);\n reject(err);\n });\n }\n return new Promise(processMessage);\n }",
"subscribeToMessageChannel() {\n if (!this.subscription) {\n this.subscription = subscribe(\n this.messageContext,\n sObjectSelected,\n (message) => this.handleMessage(message),\n { scope: APPLICATION_SCOPE }\n );\n }\n }"
] | [
"0.62991405",
"0.6008539",
"0.58747715",
"0.581249",
"0.57012355",
"0.5655519",
"0.5601487",
"0.55965835",
"0.55960613",
"0.5570987",
"0.554621",
"0.55416393",
"0.55300313",
"0.54769",
"0.54657245",
"0.5454042",
"0.54484653",
"0.53516346",
"0.5329301",
"0.5327847",
"0.5322457",
"0.5315284",
"0.52806383",
"0.52544695",
"0.5227921",
"0.52278745",
"0.5221724",
"0.5216168",
"0.52104986",
"0.51834863"
] | 0.6933967 | 0 |
subscribe() returns a promise. write a "provide" command followed by the serialization of the indicated machine. If no such machine, then reject. | subscribe(clientId, machine) {
return new Promise( (resolve, reject) => {
if (typeof machine !== 'string' || !machine.match(/^[a-z0-9]+$/)) {
return reject(`subscribe: bad machine name: ${machine}`);
}
const rec = this._clientMap.get(clientId);
if (! rec) {
return reject(`subscribe(${machine}): no such client: ${clientId}`);
} else if (rec.machines.includes(machine)) {
log(`subscribe(${machine}): already subscribed`);
return resolve();
} else if (! this._machineMap.has(machine)) {
return reject(`subscribe: no such machine: ${machine}`);
}
rec.machines.push(machine);
log(`sending machine ${machine} to client ${clientId}`);
this.sendMachine(machine, rec.wse)
.then( resolve )
.catch( errMsg => reject(`failed sending ${machine}: ${errMsg}`) );
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function ProductionEngineSubscription(machine) {\n //console.log('created pe subs: ', machine.id);\n\n let pesMachine = machine;\n let peState = null;\n\n this.getPeState = () => peState;\n this.getMachine = () => pesMachine;\n\n this.makeUpdater = function () {\n return function(newState) {\n //console.log('update Pe state for machine', pesMachine.id);\n peState = newState;\n clients.forEach(callback => { callback(peState, pesMachine.id); });\n pesMachine.connected = true;\n }\n }\n}",
"function startPeSubscription(m) {\n\n peSubcription = peSubcriptions.find( s => s.getMachine().id === m.id)\n if(!peSubcription) {\n peSubcription = new ProductionEngineSubscription(m)\n peSubcriptions.push(peSubcription);\n }\n\n grpcConnection = grpcConnections.find( c => c.machineId === m.id)\n\n channel = grpcConnection.connection.subscribeProdEngineStatus({ n: -1 });\n channel.on(\"data\", peSubcription.makeUpdater()); \n\n channel.on(\"error\", () => {\n //console.log('Connection lost to ', m.machineId)\n m.connected = false;\n }); \n channel.on(\"end\", () => {\n //console.log('Connection lost to ', m.machineId)\n m.connected = false;\n }); \n\n}",
"async add_provider(params) {\n\n var schema = {\n name: { required: 'string', format: 'lowercase' }\n }\n\n if (!(params = this.utils.validator(params, schema))) return false; \n\n var name = params.name;\n\n var provider_uuid = this.encryption.new_uuid();\n\n var data = {\n uuid: provider_uuid,\n name: name,\n whitelist: [],\n exchanges: []\n }\n\n var result = await this.settings.set('signalprovider', provider_uuid, data);\n if (result) {\n this.output.success('add_provider', [name]);\n return provider_uuid;\n }\n return this.output.error('add_provider', [name]);\n\n }",
"async publish () {}",
"function myCodeService(req, resp){\n var client = new MQTT.Client();\n client.publish(\"analytics\", JSON.stringify(payload))\n .then(function (resolve) {\n resp.success(\"success\");\n }, function (reason) {\n log(reason)\n resp.error('failure');\n });\n\n }",
"ping(machine) {\n return new Promise((resolve, reject) => {\n tcpp.probe(machine.ipaddress, machine.sshPort, (err, available) => {\n //console.log(`${machine.destination} - ssh ${available}`);\n if (err) {\n logger.error(err);\n resolve({name:machine.name, sshStatus: false})\n } else {\n resolve({name:machine.name, sshStatus: available})\n }\n });\n }).then((res) => {\n var args = [\"-q\", \"-n\", \"-w 2\", \"-c 1\", machine.ipaddress];\n return new Promise((resolve, reject) => {\n var ps = cp.spawn('/bin/ping', args);\n ps.on('error', (e) => {\n logger.error(e);\n res.pingStatus = false;\n resolve(res);\n });\n ps.on('exit', (code) => {\n res.pingStatus = (code == 0);\n resolve(res);\n });\n });\n })\n }",
"handleSubscribe() {\n // Callback invoked whenever a new event message is received\n const messageCallback = (response) => {\n console.log('Segment Membership PE fired: ', JSON.stringify(response));\n // Response contains the payload of the new message received\n this.notifier = JSON.stringify(response);\n this.refresh = true;\n // refresh LWC\n if(response.data.payload.Category__c == 'Segmentation') {\n this.getData();\n }\n \n\n\n };\n\n // Invoke subscribe method of empApi. Pass reference to messageCallback\n subscribe(this.channelName, -1, messageCallback).then(response => {\n // Response contains the subscription information on subscribe call\n console.log('Subscription request sent to: ', JSON.stringify(response.channel));\n this.subscription = response;\n this.toggleSubscribeButton(true);\n });\n }",
"checkMachineReady(){\n\t\tvar machineReady = new Promise((resolve, reject) => {\n\t\t setTimeout(() => {\n\t\t\t if (this.apiReady) {\n\t\t\t\tresolve(true);\n\t\t\t }else if (!this.apiReady) {\n\t\t\t\t reject(false)\n\t\t\t }\n\t\t }, 3000);\n\t\t}); \n\t\t\n\t\treturn Promise.resolve(machineReady);\n\t}",
"createSubscription(topic, range, duration, selector, deviceId, completion) {\n return this.withDevice(deviceId)(deviceId => {\n let p = new Promise((resolve, reject) => {\n let api = new ScalpsCoreRestApi.SubscriptionApi();\n let callback = function (error, data, response) {\n if (error) {\n reject(\"An error has occured while creating subscription '\" +\n topic +\n \"' :\" +\n error);\n }\n else {\n // Ensure that the json response is sent as pure as possible, sometimes data != response.text. Swagger issue?\n resolve(JSON.parse(response.text));\n }\n };\n let subscription = {\n worldId: this.token.sub,\n topic: topic,\n deviceId: deviceId,\n range: range,\n duration: duration,\n selector: selector || \"\"\n };\n api.createSubscription(deviceId, subscription, callback);\n });\n return p.then((subscription) => {\n this._persistenceManager.add(subscription);\n if (completion)\n completion(subscription);\n return subscription;\n });\n });\n }",
"requestSubscription(options) {\n if (!this.sw.isEnabled || this.pushManager === null) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const pushOptions = { userVisibleOnly: true };\n let key = this.decodeBase64(options.serverPublicKey.replace(/_/g, '/').replace(/-/g, '+'));\n let applicationServerKey = new Uint8Array(new ArrayBuffer(key.length));\n for (let i = 0; i < key.length; i++) {\n applicationServerKey[i] = key.charCodeAt(i);\n }\n pushOptions.applicationServerKey = applicationServerKey;\n return this.pushManager.pipe(switchMap(pm => pm.subscribe(pushOptions)), take(1))\n .toPromise()\n .then(sub => {\n this.subscriptionChanges.next(sub);\n return sub;\n });\n }",
"publish(what, data) {\n\t logging.assertExists(this._frontend).send(`publish${what}`, [data]);\n\t }",
"provisionedMachine() {\n const namespace = this.metadata?.annotations?.[CAPI_ANNOTATIONS.CLUSTER_NAMESPACE];\n const name = this.metadata?.annotations?.[CAPI_ANNOTATIONS.MACHINE_NAME];\n\n if ( namespace && name ) {\n return this.$rootGetters['management/byId'](CAPI.MACHINE, `${ namespace }/${ name }`);\n }\n }",
"function provisionBroker(){\n let timestamp = (new Date()).getTime();\n let brokerId = `broker${timestamp}`\n let brokerDeploy = JSON.parse(JSON.stringify(deployTemplate));\n brokerDeploy.metadata.name = brokerId;\n brokerDeploy.spec.template.metadata.labels.app = brokerId;\n\n return writeFile(`/tmp/deploy-${brokerId}.json`, JSON.stringify(brokerDeploy), 'utf8').then(() => {\n return exec(`kubectl create -f /tmp/deploy-${brokerId}.json`);\n }).then((res) => {\n if(res.stderr) {\n console.log(res.stderr);\n throw new Error('error occurred provisioning broker');\n }\n console.log(res.stdout);\n return exposeBroker(timestamp);\n }).then(() => {\n return timestamp;\n })\n}",
"define(topics, cb) {\n const publisher = this.eventContext.stageContext(topics);\n if (typeof cb === 'function') {\n const ret = cb(publisher, this);\n // keep cb returns something, treat is as a response\n if (ret !== undefined) {\n publisher.pub(ret);\n }\n return this; // to allow cascading style\n }\n if (cb instanceof Promise) {\n cb.then(data => publisher.pub(data))\n .catch(err => publisher.pub(err));\n return this;\n }\n if (cb !== undefined) {\n // assume it is a response\n publisher.pub(cb);\n return this;\n }\n // otherwise, it is sync mode, hence return publisher\n return publisher;\n }",
"function readMessage(destinationDeviceName) {\n var publish = true;\n rl.question('enter the cmd to send to ' + destinationDeviceName + ':\\r\\n', function (message) {\n // Calling function to publish to IoT Topic\n switch (message) {\n case 'kill':\n case 'stop':\n message = 'kill';\n console.log('killing node ' + destinationDeviceName + '!');\n break;\n case 'restart':\n case 'reset':\n message = 'restart';\n console.log('restarting the node ' + destinationDeviceName + '!');\n break;\n case 'sleep':\n case 'pause':\n message = 'pause';\n console.log('putting the ' + destinationDeviceName + ' to deep sleep / pausing it');\n break;\n case 'start':\n case 'wake':\n message = 'start';\n console.log('starting / waking up the ' + destinationDeviceName + ' from deep sleep');\n break;\n case 'emergency':\n case 'eme':\n message = 'emergency';\n console.log('updating the duty cycle of ' + destinationDeviceName + ' to send constant updates');\n break;\n case 'normal':\n message = 'normal';\n console.log('updating the duty cycle of ' + destinationDeviceName + ' to work as usual');\n break;\n case 'plugin':\n case 'charge':\n message = 'plugin';\n console.log('hard charging the ' + destinationDeviceName);\n break;\n case 'letdie':\n case 'unplug':\n case 'discharge':\n message = 'unplug';\n console.log('setting ' + destinationDeviceName + ' to not charge and die');\n break;\n default:\n console.log('incorrect cmd please enter again!');\n publish = false;\n break;\n }\n if (publish) {\n publishToIoTTopic(cmdTopic + destinationDeviceName, message);\n }\n readConsoleInput();\n });\n}",
"function registerDevice() {\n // Register device\n var registerPromise = provision.register();\n\n registerPromise.then((result) => {\n console.log(`connectionString: ${result}`);\n connectionString = result;\n\n deviceStart();\n\n // save connection string to file \n connectionStringInfo.save(result).then((saveresult) => {\n console.log(`connection string saved.`);\n }, (saveerr) => {\n console.error(`Error: save connection string: ${saveerr}`);\n });\n }, (error) => {\n console.error(`DPS register error: ${error}`);\n });\n}",
"createOffer() {\n this.pc.createOffer()\n .then(this.getDescription.bind(this))\n .catch(err => console.log(err));\n return this;\n }",
"subscribe() {}",
"publish () {}",
"onDiscover(data) {\n console.log(\"onDiscover\");\n self.emit('ready', data.metadata);\n }",
"function publish(selector) {\n return selector ?\n multicast(function () { return new Subject/* Subject */.xQ(); }, selector) :\n multicast(new Subject/* Subject */.xQ());\n}",
"function subscribe(data) {\n\t\t\t\tconsole.log(data);\n\t\t\t\treturn Subscriber.save(data).$promise.then(function(success) {\n\t\t\t\t\tconsole.log(success);\n\t\t\t\t}, function(error) {\n\t\t\t\t\tconsole.log(error);\n\t\t\t\t});\n\t\t\t}",
"function Scall() {\n this.available = false;\n this.platform = null;\n this.version = null;\n this.uuid = null;\n this.cordova = null;\n this.model = null;\n this.manufacturer = null;\n this.isVirtual = null;\n this.serial = null;\n\n var me = this;\n console.log(\"scall subscribe\");\n channel.onCordovaReady.subscribe(function() {\n console.log(\"scall ready\");\n\t\t// channel.onCordovaInfoReady.fire();\n channel.initializationComplete('onCordovaScallReady'); \n });\n}",
"createOffer () {\n this.pc.createOffer()\n .then(this.getDescription.bind(this))\n .catch(err => console.log(err))\n return this\n }",
"constructor(cloud) {\n this.cloud = cloud;\n this.requests = new rxjs_1.Subject();\n // this.cloud = new CloudObject(client);\n this.requests.asObservable().pipe(operators_1.concatMap(([name, type, resolve]) => new rxjs_1.Observable(subs => {\n fetch(\"twits-5-1-17/\" + type + \"s/\" + name + \"/plugin.txt\").then((res) => {\n if (res.status < 400)\n return res.text().then(data => {\n const split = data.indexOf('\\n');\n const meta = JSON.parse(data.slice(0, split)), text = data.slice(split + 2);\n meta.text = text;\n resolve(res);\n subs.complete();\n });\n else {\n resolve(false);\n subs.complete();\n }\n });\n }))).subscribe();\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 }",
"function subscribe(){\n performance.mark('subscribing');\n client.subscribe('payload/empty', function (err) {});\n performance.mark('subscribed');\n performance.measure('subscribing to subscribed', 'subscribing', 'subscribed');\n}",
"produce(energyOut, out){}",
"findRegisters() {\n if (this.meterId) {\n this._registerService.getRegisters(this.meterId).subscribe(response => {\n if (response.registers) {\n console.log(response.registers);\n this.registers = response.registers;\n }\n else {\n this.registers = null;\n }\n }, error => {\n console.log(error);\n });\n }\n }",
"bus_rx(data) { this.send('bus-rx', data); }"
] | [
"0.5257558",
"0.51723474",
"0.4928612",
"0.48542452",
"0.48314035",
"0.48277408",
"0.48249453",
"0.47648463",
"0.47130254",
"0.47021812",
"0.4699739",
"0.46977046",
"0.46927583",
"0.46921438",
"0.46291152",
"0.46257806",
"0.46217126",
"0.45902544",
"0.4585775",
"0.45815372",
"0.45782486",
"0.45452338",
"0.45427555",
"0.45421016",
"0.4528943",
"0.4528781",
"0.45248878",
"0.452048",
"0.4519789",
"0.44978303"
] | 0.68615836 | 0 |
Return a promise to load features for the genomic interval | async readFeatures(chr, start, end) {
const index = await this.getIndex()
if (index) {
this.indexed = true
return this.loadFeaturesWithIndex(chr, start, end)
} else if (this.dataURI) {
this.indexed = false
return this.loadFeaturesFromDataURI()
} else {
this.indexed = false
return this.loadFeaturesNoIndex()
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async readFeatures(chr, start, end) {\n\n const index = await this.getIndex()\n if (index) {\n return this.loadFeaturesWithIndex(chr, start, end);\n } else if (this.dataURI) {\n return this.loadFeaturesFromDataURI();\n } else {\n return this.loadFeaturesNoIndex()\n }\n\n }",
"load () {\n this.fire('dataLoading') // for supporting loading spinners\n \n let promise = this.coverage.loadDomain().then(domain => {\n this.domain = domain\n \n ;[this._projX, this._projY] = getHorizontalCRSComponents(domain)\n return loadProjection(domain)\n }).then(proj => {\n this.projection = proj\n })\n if (this._loadCoverageSubset) {\n promise = promise.then(() => this._loadCoverageSubset())\n } else if (this.parameter) {\n promise = promise.then(() => this.coverage.loadRange(this.parameter.key)).then(range => {\n this.range = range\n })\n }\n \n promise = promise.then(() => {\n this.fire('dataLoad')\n }).catch(e => {\n console.error(e)\n this.fire('error', {error: e})\n this.fire('dataLoad')\n })\n return promise\n }",
"function get_features(refseqID) {\n\n\tvar myFeatures;\t\n\tglue.inMode(\"reference/\"+refseqID, function(){\n\t\tmyFeatures = glue.getTableColumn(glue.command([\"list\", \"feature-location\"]), \"feature.name\");\n\t});\n\treturn myFeatures;\n}",
"getFeaturesInRange(contig: string, start: number, stop: number): Q.Promise<string> {\n start--; // switch to zero-based indices\n stop--;\n return this._getSequenceHeader(contig).then(header => {\n var dnaOffset = header.offset + header.dnaOffsetFromHeader;\n var offset = Math.floor(dnaOffset + start/4);\n var byteLength = Math.ceil((stop - start + 1) / 4) + 1;\n return this.remoteFile.getBytes(offset, byteLength).then(dataView => {\n return markUnknownDNA(\n unpackDNA(dataView, start % 4, stop - start + 1), start, header)\n .join('');\n });\n });\n }",
"getFeaturesByTagExpression() {\n return getTestCasesFromFilesystem({\n cwd: '',\n eventBroadcaster: eventBroadcaster,\n featurePaths: this.getFeatures(),\n pickleFilter: new PickleFilter({\n tagExpression: this.getCucumberCliTags()\n }),\n order: 'defined'\n }).then(function (results) {\n let features = [];\n let scenarios = [];\n _.forEach(results, function (result) {\n if (argv.parallelFeatures) {\n features.push(result.uri);\n } else {\n let lineNumber = result.pickle.locations[0].line;\n let uri = result.uri;\n let scenario = `${uri}:${lineNumber}`;\n scenarios.push(scenario);\n }\n });\n\n return {\n features: _.sortedUniq(features),\n scenarios: scenarios\n };\n });\n }",
"getFeatures() {\n let filesGlob = 'e2e/features/**/*.feature';\n let files = glob.sync(filesGlob);\n return _.sortedUniq(files);\n }",
"async function loadData() {\r\n\tlet result = [];\r\n\tlet resp = await fetch('./cats.geojson');\r\n\tlet data = await resp.json();\r\n\tdata.features.forEach(f => {\r\n\t\tresult.push({\r\n\t\t\tlat:f.geometry.coordinates[1],\r\n\t\t\tlng:f.geometry.coordinates[0]\r\n\t\t});\r\n\t});\r\n\treturn result;\r\n}",
"function gvpLoadPromise () {\n if (context.uriAddressableDefsEnabled) {\n return Promise[\"resolve\"]();\n } else {\n return context.globalValueProviders.loadFromStorage();\n }\n }",
"function loadFeature( feature, data ) {\n // Add a Spinner\n var bodyNode = can.$('body');\n var waitingNode = can.$('<div class=\"dg-feature-loading\"><span class=\"dg-square-spinner\"> </span></div>');\n waitingNode.appendTo(bodyNode);\n\n // Loads the feature files and templates, feature name is critical to the file name\n require(['js/features/'+feature+'.min.js'], function( init ){\n fadeOut(waitingNode, function(){\n init( data );\n waitingNode.remove();\n });\n }, onInternetDown);\n \n currentFeature = feature;\n\n return feature;\n}",
"load ()\n {\n let thisObj = this;\n return new Promise (function (resolve, reject)\n {\n //run async mode\n (async function () { \n try {\n\n\n \n //pull the feature service definition'\n logger.info(\"Fetching the feature service definition...\")\n let featureServiceJsonResult = await makeRequest({method: 'POST', timeout: 120000, url: thisObj.featureServiceUrl, params: {f : \"json\", token: thisObj.token}});\n thisObj.featureServiceJson = featureServiceJsonResult\n //check to see if the feature service has a UN\n if (thisObj.featureServiceJson.controllerDatasetLayers != undefined)\n { \n thisObj.layerId = thisObj.featureServiceJson.controllerDatasetLayers.utilityNetworkLayerId;\n let queryDataElementUrl = thisObj.featureServiceUrl + \"/queryDataElements\";\n let layers = \"[\" + thisObj.layerId + \"]\"\n \n let postJson = {\n token: thisObj.token,\n layers: layers,\n f: \"json\"\n }\n logger.info(\"Fetching the utility network data element ...\")\n //pull the data element definition of the utility network now that we have the utility network layer\n let undataElement = await makeRequest({method: 'POST', url: queryDataElementUrl, params: postJson });\n \n //request the un layer defition which has different set of information\n let unLayerUrl = thisObj.featureServiceUrl + \"/\" + thisObj.layerId;\n postJson = {\n token: thisObj.token,\n f: \"json\"\n }\n\n logger.info(\"Fetching the utility network layer definition ...\")\n\n let unLayerDef = await makeRequest({method: 'POST', url: unLayerUrl, params: postJson });\n \n thisObj.dataElement = undataElement.layerDataElements[0].dataElement;\n thisObj.layerDefinition = unLayerDef\n thisObj.subnetLineLayerId = thisObj.getSubnetLineLayerId(); \n resolve(thisObj);\n }\n else\n reject(\"No Utility Network found in this feature service\");\n\n }\n\n catch(ex){\n reject(ex)\n }\n })();\n })\n\n \n }",
"async function getData() {\n request.open('GET',\n 'https://services1.arcgis.com/0n2NelSAfR7gTkr1/arcgis/rest/services/Business_Licenses/FeatureServer/0/query?where=FID' + ' > ' + lastFID + ' AND FID <= ' + (lastFID + 500) + '&outFields=*&outSR=4326&f=json',\n true);\n\n //comment out the following line to quickly edit ui without making requests\n request.send();\n}",
"load() {\n return this.loading || (this.loading = this.loadFunc().then(support => this.support = support, err => { this.loading = null; throw err; }));\n }",
"function get_features(res, mysql, context, complete){\r\n mysql.pool.query(\"SELECT * FROM features\", function(error, results, fields){\r\n if(error){\r\n res.write(JSON.stringify(error));\r\n res.end();\r\n }\r\n context.features = results;\r\n complete();\r\n });\r\n }",
"getGC() {\n return this.$http.get(PATH + \"gc_polygon.topo.json\", {cache: true})\n .then(function(data, status) {\n return topojson.feature(data.data, data.data.objects['dc_polygon.geo']);\n });\n }",
"async function fetchData(data) {\n let fetchedData = await fetch(data);\n let json = await fetchedData.json();\n let features = json.features;\n return features\n}",
"async getLoadOperation() {}",
"load() {\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function* () { });\n }",
"$onInit() {\n\n \tPromise.all([\n \t\tthis.loadLocations(),\n \t\tthis.loadCategories(), \n \t\tthis.loadCollections()\n \t]).then(() => this.loadFeatures(this.filter))\n }",
"get features() {\r\n return new Features(this);\r\n }",
"get features() {\r\n return new Features(this);\r\n }",
"async loadFeatureList(list) {\n await import(\"./subcomp/facility.js\")\n .then(() => {\n // API call for get Facilities List\n list.forEach(\n (item) =>\n (this._qs(\".features\").innerHTML += `\n <facility-comp \n key=\"${item.featureId}\" \n name=\"${item.feature}\" \n measurable=\"${item.quantity == \"null\" ? \"false\" : \"1\"}\" \n checked=\"true\" \n quantity=\"${item.quantity}\"\n ></facility-comp>\n `)\n );\n })\n .catch((err) => this.popup(err, \"error\"));\n }",
"getContigList(): Q.Promise<string[]> {\n return this.header.then(header => header.sequences.map(seq => seq.name));\n }",
"async function getFeatures() {\n // Read JSON file\n return await fetch(base_url + '/content/mapping_metrics_definition.json')\n .then(response => response.json())\n .then(data => {\n let features = data['features'];\n getButtonType().then(button => {\n\n document.getElementById('buttons').innerHTML = '';\n let div = document.createElement('div');\n div.className = 'control-area';\n\n let buttonType;\n if (typeof uid !== undefined && uid !== \"\" && uid != null) {\n buttonType = button[0];\n } else {\n buttonType = button[1];\n }\n div.innerHTML = `<button id=\"save-button\" class=\"create-button\" onclick=\"createEditProcess()\" type=\"button\"> ` + buttonType + ` </button>`\n\n // Append element to document\n document.getElementById('buttons').appendChild(div);\n })\n return features;\n });\n}",
"async function getData(){\r\n\r\n //Fetch the data from the geojson file\r\n fetch(\"BEWES_Building_Data.geojson\").then(response => response.json()).then(data => {addToTable(data);});\r\n\r\n }",
"getFeatures() {\n\t\tfetch(`https://maximum-arena-3000.codio-box.uk/api/features/${this.state.prop_ID}`, {\n\t\t\tmethod: \"GET\",\n\t\t\tbody: null,\n\t\t\theaders: {\n\t\t\t\t\"Authorization\": \"Basic \" + btoa(this.context.user.username + \":\" + this.context.user.password)\n\t\t\t}\n\t\t})\n\t\t\t.then(status)\n\t\t\t.then(json)\n\t\t\t.then(dataFromServer => {\n\t\t\t\tthis.setState({\n\t\t\t\t\tfeatures: dataFromServer,\n\t\t\t\t});\n\t\t\t\tconsole.log(dataFromServer, 'features here')\n\t\t\t})\n\t\t\t.catch(error => {\n\t\t\t\tconsole.log(error)\n\t\t\t\tmessage.error('Could not get the features. Try Again!', 5);\n\t\t\t});\n\t}",
"async function loadCoreData() {\n await Promise.all([\n loadExercises(),\n loadCategories(),\n loadSessions(),\n ]);\n}",
"function load() {\n return Promise.all([storage.getTree(), storage.getTokenIndex(), storage.getEntries()])\n .then(function(result) {\n console.log('load results')\n tree = result[0];\n dbIndex = new Index(result[1]);\n entries = result[2];\n });\n}",
"load() {\n return Promise.resolve(false /* identified */);\n }",
"async fetchDvFeatures() {\n await fetch(\n `${this.mapboxLayer.url}/data/ch.sbb.direktverbindungen.public.json?key=${this.mapboxLayer.apiKey}`,\n )\n .then((res) => res.json())\n .then((data) => {\n this.allFeatures = data['geops.direktverbindungen'].map((line) => {\n return new Feature({\n ...line,\n geometry: new LineString([\n [line.bbox[0], line.bbox[1]],\n [line.bbox[2], line.bbox[3]],\n ]),\n });\n });\n this.syncFeatures();\n })\n // eslint-disable-next-line no-console\n .catch((err) => console.error(err));\n }",
"async function load() { // returns a promise of an array\n const rawData = await fsp.readFile('./restaurant.json');\n const restaurantsArray = (JSON.parse(String(rawData)));\n return restaurantsArray;\n}"
] | [
"0.6543959",
"0.61009336",
"0.590788",
"0.5869675",
"0.5767293",
"0.5726963",
"0.571669",
"0.5531802",
"0.54262996",
"0.5398379",
"0.53473455",
"0.52430815",
"0.5231676",
"0.5218503",
"0.5158587",
"0.5131139",
"0.5100868",
"0.5091692",
"0.50904274",
"0.50904274",
"0.5066121",
"0.5030894",
"0.50205815",
"0.50121015",
"0.4995787",
"0.49709815",
"0.4954698",
"0.4903145",
"0.4888073",
"0.4870576"
] | 0.6294286 | 1 |
Return a Promise for the async loaded index | async loadIndex() {
const indexURL = this.config.indexURL
return loadIndex(indexURL, this.config, this.genome)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async getCurentIndex() {\n\n this.check()\n return await this.storage.loadIndex()\n }",
"async loadIndex() {\n const indexURL = this.config.indexURL;\n let indexFilename;\n if (isFilePath(indexURL)) {\n indexFilename = indexURL.name;\n } else {\n const uriParts = parseUri(indexURL);\n indexFilename = uriParts.file;\n }\n const isTabix = indexFilename.endsWith(\".tbi\") || this.filename.endsWith('.gz') || this.filename.endsWith('.bgz')\n let index;\n if (isTabix) {\n index = await loadBamIndex(indexURL, this.config, true, this.genome);\n } else {\n index = await loadTribbleIndex(indexURL, this.config, this.genome);\n }\n return index;\n }",
"async function getIndexes() {\n return await fetch('https://api.coingecko.com/api/v3/indexes').then(res => res.json());\n }",
"static loadProjectIndex(projectId) {\n return Promise( (resolve, reject) => {\n const url = ProjectIndex.APIUrlForProject(projectId);\n fetch(url).then( (response) => {\n if (response.status !== 200) reject(response.status);\n try {\n const json = response.json();\n const index = new ProjectIndex(\"/\", json.project);\n resolve(index);\n } catch (error) {\n reject(error);\n }\n })\n }\n\n static APIUrlForProject(projectId) {\n return `/API/getProjectIndex/${projectId}`;\n }",
"function load() {\n return Promise.all([storage.getTree(), storage.getTokenIndex(), storage.getEntries()])\n .then(function(result) {\n console.log('load results')\n tree = result[0];\n dbIndex = new Index(result[1]);\n entries = result[2];\n });\n}",
"async function loadData() {\n // Get the health of the connection\n let health = await connection.checkConnection();\n\n // Check the status of the connection\n if (health.statusCode === 200) {\n // Delete index\n await connection.deleteIndex().catch((err) => {\n console.log(err);\n });\n // Create Index\n await connection.createIndex().catch((err) => {\n console.log(err);\n });\n // If index exists\n if (await connection.indexExists()) {\n const parents = await rest.getRequest(rest.FlaskUrl + \"/N\");\n // If parents has the property containing the files\n if (parents.hasOwnProperty(\"data\")) {\n //Retrieve the parent list\n let parrentArray = parents.data;\n\n // Get amount of parents\n NumberOfParents = parrentArray.length;\n console.log(\"Number of parents to upload: \" + NumberOfParents);\n // Each function call to upload a JSON object to the index\n // delayed by 50ms\n parrentArray.forEach(delayedFunctionLoop(uploadParentToES, 50));\n }\n }\n } else {\n console.log(\"The connection failed\");\n }\n}",
"function getIndexId() {\n return new Promise((resolve, reject) => {\n fs.readFile(INDEX_FILE, (err, data) => {\n if (err || data === undefined) {\n reject(err);\n } else {\n const json = JSON.parse(data);\n resolve(json.id);\n }\n });\n });\n}",
"prepareIndiceForUpdate(indexData) {\n return Promise.resolve();\n }",
"getActIndex() {\n return __awaiter(this, void 0, void 0, function* () {\n return yield this._handleApiCall(`${this.gameBaseUrlPath}/act`, 'Error fetching the act index.');\n });\n }",
"async fetchExistingRecords () {\n const client = getAlgoliaClient()\n\n // return an empty array if the index does not exist yet\n const { items: indices } = await client.listIndices()\n\n if (!indices.find(index => index.name === this.name)) {\n console.log(`index '${this.name}' does not exist!`)\n return []\n }\n\n const index = client.initIndex(this.name)\n let records = []\n\n await index.browseObjects({\n batch: batch => (records = records.concat(batch))\n })\n\n return records\n }",
"async do(headers = {}) {\n\t\tlet res = await this.c.get(\"/v2/assets/\" + this.index, {}, headers);\n\t\treturn res.body;\n\t}",
"function index() {\n\n return resource.fetch()\n .then(function(data){ return data; });\n }",
"getByIndex(storeName, indexName, key) {\n return from(new Promise((resolve, reject) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, reject);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readonly, storeName, reject, resolve));\n const objectStore = transaction.objectStore(storeName);\n const index = objectStore.index(indexName);\n const request = index.get(key);\n request.onsuccess = (event) => {\n resolve(event.target.result);\n };\n })\n .catch((reason) => reject(reason));\n }));\n }",
"async init() {\n var that = this;\n\n var promise = new Promise(function(resolve, reject) {\n\n var req = indexedDB.open(that.db_name, that.version);\n\n req.onupgradeneeded = function(event) {\n that.database = event.target.result;\n //run callback method in createTable to add a new object table\n that.upgrade();\n };\n\n req.onsuccess = function (event) {\n that.database = event.target.result;\n resolve();\n };\n\n req.onerror = function (error) {\n if (req.error.name === \"VersionError\") {\n //we can never be sure what version of the database the client is on\n //therefore in the event that we request an older version of the db than the client is on, we will need to update the js version request on runtime\n that.version++;\n\n //we need to initiate a steady increment of promise connections that either resolve or reject\n that.init()\n .then(function() {\n //bubble the result\n resolve();\n })\n .catch(function() {\n //bubble the result: DOESNT WORK?\n reject();\n });\n } else {\n console.error(error);\n }\n };\n });\n return promise;\n }",
"async function getIndex() {\n const contents = fs.readdirSync(`./${ipfs.host}/`);\n iLog('Trying to load indices from local files ...');\n for (i in contents) {\n if (contents[i][0] === 'i' && !fs.statSync(`./${ipfs.host}/${contents[i]}`).isDirectory()) {\n const indexFile = fs.readFileSync(`./${ipfs.host}/${contents[i]}`);\n const indexDump = JSON.parse(indexFile);\n global.indices[contents[i].substr(5,contents[i].length-10)] = elasticlunr.Index.load(indexDump);\n }\n }\n try {\n await fs.statSync(`./${ipfs.host}/hostedFiles.json`);\n global.ipfsearch.hostedFiles = JSON.parse(await fs.readFileSync(`./${ipfs.host}/hostedFiles.json`));\n } catch (e) { }\n if (Object.keys(global.indices).length === 0) {\n // file does not exist, create fresh index\n iLog('No local indices exist, generating new index files ...');\n const contents = fs.readdirSync(`./${ipfs.host}/`);\n for (i in contents) {\n if (fs.statSync(`./${ipfs.host}/${contents[i]}`).isDirectory()) {\n global.indices[contents[i]] = createIndex();\n await readFilesIntoObjects(contents[i], `./${ipfs.host}/${contents[i]}`);\n // save the index\n await saveIndex(global.indices[contents[i]], `./${ipfs.host}/index${contents[i]}.json`);\n }\n }\n }\n}",
"function readIndexJson() {\n return new Promise((resolve, reject) => {\n fs.readFile(INDEX_FILE, (err, data) => {\n if (err) reject(err);\n const json = JSON.parse(data);\n const promises = [];\n Object.keys(json).forEach((lang) => {\n if (LANG_SUPPORTED.includes(lang)) {\n promises.push(getJson(json[lang].raw.DestinyStatDefinition, `${STAT_DIR}/${lang}.json`));\n promises.push(getJson(json[lang].raw.DestinyClassDefinition, `${CLASS_DIR}/${lang}.json`));\n promises.push(getJson(json[lang].items.Mod, `${MOD_DIR}/${lang}.json`));\n promises.push(getJson(json[lang].raw.DestinyInventoryBucketDefinition, `${BUCKET_DIR}/${lang}.json`));\n promises.push(getJson(json[lang].items.Armor, `${ARMOR_DIR}/${lang}.json`));\n promises.push(getJson(json[lang].items.Weapon, `${WEAPON_DIR}/${lang}.json`));\n }\n });\n Promise.all(promises)\n .then(() => {\n resolve();\n })\n .catch((pErr) => {\n console.log(pErr);\n reject(pErr);\n });\n });\n });\n}",
"function loadIndex() {\n\tvar indexRequest = new XMLHttpRequest();\n\tindexRequest.open(\"GET\", \"https://mustang-index.azurewebsites.net/index.json\");\n\tindexRequest.onload = function() {\n\t\tconsole.log(\"Index JSON file:\" + indexRequest.responseText);\n\t\tcontactIndex = JSON.parse(indexRequest.responseText);\n\t\tcontactURLArray.length = 0;\n\t\tfor(i = 0; i < contactIndex.length; i++) {\n\t\t\tcontactURLArray.push(contactIndex[i].ContactURL);\n\t\t}\n\t\tconsole.log(\"ContactURLArray: \" + JSON.stringify(contactURLArray));\n\t\trenderIndex(contactIndex);\n\t\tshowSnackbar(\"Index loaded\");\n\t}\n\tindexRequest.send();\n}",
"async load(indexRootUrl, searchHint) {\n const enumValueIds = searchHint;\n const promises = enumValueIds.map(async (valueId) => {\n const value = this.values[valueId];\n if (value.dataRowIds)\n return Promise.resolve();\n const promise = loadCsv(joinUrl(indexRootUrl, value.url), {\n dynamicTyping: true,\n header: true\n }).then(rows => rows.map(({ dataRowId }) => dataRowId));\n value.dataRowIds = promise;\n return promise;\n });\n await Promise.all(promises);\n }",
"async createIndexJson(url) {\n \treturn this.rs.readFolder(url).then(folder => {\n \t\tvar promises = [];\n \t\tthis.index = {};\n \t\tif (folder.files.length == 0) {\n \t\t\tpromises.push(this.index)\n \t\t} else {\n\t\t\t\tlet i\n\t\t\t\t\tfor ( i = 0; i < folder.files.length ; i ++) {\n\t\t\t\t\t\tlet file = folder.files[i].name.split(\".\");\n\t\t\t\t\t\tif (file.pop() == \"ttl\") {\n\t\t\t\t\t\t\tvar title = file.join(\".\")\n\t\t\t\t\t\t\tpromises.push(\n\t\t\t\t\t\t\tthis.rs.rdf.query(url+title+\".ttl\")\n\t\t\t\t\t\t\t.then(queryRes => {\n\t\t\t\t\t\t\t\tthis.jsonTiddler(queryRes)\n\t\t\t\t\t\t\t\tdelete this.tiddlerJson[\"text\"]\n\t\t\t\t\t\t\t\tthis.index[this.tiddlerJson[\"title\"]] = this.tiddlerJson;\n\t\t\t\t\t\t\t},err => {alert(\"title \"+err)})\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn Promise.all(promises).then( success => {\n\t\t\t\t\treturn this.index\n\t\t\t},err => {alert(\"Are some .ttl files not tiddlers ??? \\n\"+err)})\n \t})\n }",
"function load(index) {\n return loadInternal(index, viewData);\n}",
"indexPage(req) {\n return __awaiter(this, void 0, void 0, function* () {\n });\n }",
"prepareIndiceForInstall(indexData) {\n return Promise.resolve();\n }",
"getCachedDataByIndex(storename, index, key) {\n return this.cache.then((db) => {\n return db.transaction(storename).objectStore(storename).index(index).getAll(key);\n });\n }",
"_updateIndex() {\n return __awaiter(this, void 0, void 0, function* () {\n //creates index file if it doesn't already exist\n let inCouch = yield this._isInCouch(\"index\", \"index\");\n if (!inCouch) {\n yield this.couchdb.createDatabase(\"index\");\n yield this.couchdb.createDocument(\"index\", {}, \"index\");\n }\n let data = yield readFile(path.join(this.localRepoPath, \"/EventIndex.json\"), \"utf8\");\n let json = JSON.parse(data.replace(/"/g, '\\\\\"'));\n let events = json[\"Events\"];\n events.sort(function (a, b) {\n return Date.parse(b.StartDate) - Date.parse(a.StartDate);\n });\n let couchDocument = yield this.couchdb.getDocument(\"index\", \"index\");\n yield this.couchdb.createDocument(\"index\", { Events: events, \"_rev\": couchDocument.data[\"_rev\"] }, \"index\");\n });\n }",
"async getLoadOperation() {}",
"function loadIndex() {\n var idxFile = this.indexURL;\n\n if (this.filename.endsWith(\".gz\")) {\n if (!idxFile) idxFile = this.url + \".tbi\";\n return igv.loadBamIndex(idxFile, this.config, true);\n } else {\n if (!idxFile) idxFile = this.url + \".idx\";\n return igv.loadTribbleIndex(idxFile, this.config);\n }\n }",
"loadIndexPage () {\n return Promise.resolve(Request.httpGet(this.SiteUrl + this.DefaultPrefix, this.CharSet).then(res => {\n let $ = cheerio.load(res.text);\n let Navis = $('#sliderNav > li');\n let Uid = new Date().getTime();\n Navis.each((i, elem) => {\n let _this = $(elem);\n let _ChildNodes = _this.find('> ul >li');\n let _SiteUrl = _this.find('>a').attr('href');\n if (_SiteUrl === './') {\n _SiteUrl = '../ssxx/'\n }\n\n let _SiteReg = /^javascript:/ig;\n this.ListNavis.push({\n Uid: `${Uid}${i}`,\n Section: _this.find('> a >span:first-child').text(),\n SiteUrl: _SiteReg.test(_SiteUrl) ? '' : _SiteUrl,\n HasChild: _ChildNodes && _ChildNodes.length > 0,\n ChildNodes: _ChildNodes && _ChildNodes.toArray().map((item, index) => {\n let _node = $(item).find('a');\n let _group = _node.text();\n let _uid = this.GroupDefine.has(_group) && this.GroupDefine.get(_group) || this.GroupDefine.set(_group, `${new Date().getTime()}${i}`).get(_group);\n return {\n Uid: _uid,\n Group: _node.text(),\n SiteUrl: _node.attr('href')\n };\n })\n });\n });\n\n /*保存首页数据*/\n Request.saveJsonToFile(this.ListNavis, 'index.json', this.Group, [...this.GroupDefine]);\n }).catch(err => {\n console.error(err);\n }));\n }",
"fetchIndex(){\n return this.http.fetch('data/index.json?t=' + new Date().getTime())\n .then(response=>{\n //convert text to json\n return response.json()\n })\n .then(json=>{\n let infos = json;\n return infos;\n });\n }",
"function wrappedFetch() {\n var wrappedPromise = {};\n\n var promise = new index_es(function (resolve, reject) {\n wrappedPromise.resolve = resolve;\n wrappedPromise.reject = reject;\n });\n\n var args = new Array(arguments.length);\n\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n\n wrappedPromise.promise = promise;\n\n index_es.resolve().then(function () {\n return fetch.apply(null, args);\n }).then(function (response) {\n wrappedPromise.resolve(response);\n }).catch(function (error) {\n wrappedPromise.reject(error);\n });\n\n return wrappedPromise;\n}",
"function page(index) {\n var item = internal.loader.info(index),\n res;\n if (item) {\n res = {\n index: item.index,\n data: item.cached,\n loading: item.queued || item.loading || item.waiting,\n cancel: item.cancel\n };\n } else {\n res = null;\n }\n return res;\n }"
] | [
"0.70689124",
"0.6799907",
"0.6459076",
"0.64186",
"0.6398918",
"0.6349781",
"0.62687784",
"0.62290114",
"0.6192579",
"0.6090689",
"0.60649323",
"0.60526985",
"0.6047419",
"0.60411704",
"0.6028308",
"0.6021699",
"0.60055244",
"0.5975181",
"0.59711975",
"0.5960433",
"0.59251773",
"0.5924601",
"0.5914405",
"0.589476",
"0.58265656",
"0.5819227",
"0.5814982",
"0.58119315",
"0.57929933",
"0.5787757"
] | 0.7352213 | 0 |
return the two oldest/oldest ages within the array of ages passed in. | function twoOldestAges(ages){
ages.sort((a,b) => b-a)
ages = ages.slice(0,2)
ages.sort((a,b) => a-b);
return ages;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function twoOldestAges(ages){\n let sorted = ages.sort((a, b) => { return b - a; });\n return [sorted[1], sorted[0]];\n }",
"function twoOldestAges(ages){\nlet oldestAges = ages.sort((a, b) => b-a).splice(0,2).reverse();\n return oldestAges;\n}",
"function twoOldestAges(ages){\n var sortArr = ages.map(Number).sort(function (a, b) { return a - b; });\n var scoreTab = [sortArr[sortArr.length - 2], sortArr[sortArr.length - 1]];\n return scoreTab;\n}",
"function older(array){\n\tvar max = 0;\n\tvar olderst = {};\n\tfor (var i=0; i<array.length; i++){\n\t\tif(array[i][\"age\"] > max){\n\t\t\tmax= array[i][\"age\"];\n\t\t\toldest = array[i];\n\t\t}\n\t}\n\treturn oldest;\t\t\n}",
"function byAge(arr){\n const youngToOld = arr.sort((a, b) => {\n return a.age - b.age\n })\n return youngToOld\n}",
"function older(a, b) {\n\treturn max(a, b, ageCompare);\n }",
"function findOlder(arr)\n{\n\tvar oldest = arr[0].age;\n\tvar oldClassmate = {};\n\n\tfor(var i=1; i<arr.length; i++)\n\t{\n\t\tif(arr[i].age > oldest)\n\t\t{\n\t\t\toldest = arr[i].age;\n\t\t\toldClassmate = arr[i];\n\t\t}\n\t}\n\n\treturn oldClassmate;\n}",
"function older(people,age){\n\tnew newArray =[];\n\tfor ( var i =0; i < array.length-1;i++){\n\t\tif(Arr[i].age > age){\n\t\t\tnewArray.push(Arr[i].age);\n\t\t}\t\n\t}\n\treturn newArray;\n}",
"function younger(a, b) {\n\treturn min(a, b, ageCompare);\n }",
"function checkYoungest(array) {\n var arrIndex = 0;\n var minAge = array[0].age;\n for (var i = 1; i < array.length; i++) {\n if (array[i].age < minAge) {\n minAge = array[i];\n arrIndex = i;\n }\n }\n return array[arrIndex].firstname + ' ' + array[arrIndex].lastname;\n}",
"function differenceInAges (ages) {\n\n let max = Math.max(...ages),\n min = Math.min(...ages)\n diff = max - min\n \n return [min, max, diff]\n}",
"function older3ars(array){\n\t\tvar older=array[0].age\n\t\tfor (var i = 0; i < array.length; i++) {\n\t\t\tif(array[i].age>older){\n\t\t\t\tolder=array[i].age\n\t\t\t}\n\n\t\t}\n\t\treturn older;\n\t}",
"function findOldestPerson(people) {\n var oldest = people[0];\n for (var i = 1; i < people.length; i++) {\n if (people[i].age > oldest.age) {\n oldest = people[i];\n }\n }\n return oldest;\n}",
"function getMinAge(data) {\n\tconst ages = data.map(passenger => {\n\t\treturn passenger.fields.age;\n\t}).filter( p => p !== undefined)\n\treturn Math.min(...ages)\n}",
"function olderPeople(peopleArr, age) {\n return peopleArr.filter(function (person) {\n return person.age > age;\n });\n}",
"function olderPeople(peopleArr, age) {\n // initialize a new empty array\n let newArray = [];\n // loop through each persons\n peopleArr.forEach(element => {\n // check if person is older\n if (element.age > age) {\n // add to array\n newArray.push(element);\n }\n })\n return newArray\n}",
"function sortedByAge(arr) {\n return arr.sort((a, b) => (a - b) ? -1 : 1 )\n}",
"function above(person, age){\n let aboveAge = [];\n person.forEach(element => {\n if(element.age > age)\n {aboveAge.push(element)}\n });\n return aboveAge;\n }",
"function byAge(arr){\n return arr.sort(function(a, b){\n return a.age - b.age;\n });\n}",
"static older(person1, person2){\n return (person1.age >= person2.age)?person1:person2;\n }",
"function findYoungest(arr) {\n arr.sort(function(a, b) {\n return a.age - b.age;\n });\n\n return arr[0].firstname + ' ' + arr[0].lastname;\n}",
"function findOldestMale(people) {\n var oldest = people[0];\n for (var i = 1; i < people.length; i++) {\n if (people[i].gender == \"Male\") {\n if (people[i].age > oldest.age) {\n oldest = people[i];\n }\n }\n }\n return oldest;\n}",
"function getMinAge(data) {\n\tconst ages = data.filter(passenger => passenger.fields.age != null).map(passenger => passenger.fields.age)\n\tconst minAge = Math.min(...ages)\n\tconsole.log('MINIMUM AGE:', minAge)\n\treturn minAge\n}",
"function sortByAge(arr) {\n return arr.sort((a,b) => a.age - b.age); // increment\n}",
"function familyReport(ages) {\n // sort the ages into ascending order\n ages.sort(compareNumeric)\n // get the smallest age (first index)\n const smallest = ages[0];\n // get the largest age (last index)\n const largest = ages[ages.length - 1];\n // difference between largest and smallest age\n const difference = largest - smallest;\n\n return [smallest, largest, difference]\n}",
"function SortByNamexOlderThan(age) {\n var pl = [];\n let k = 0;\n for (let i of players) {\n if (i.age >= age) {\n i.awards.name.sort().reverse();\n pl[c++] = i;\n }\n }\n\n return pl.age.sort();\n}",
"function findOldestByGender(people, gender) {\n var oldest = people[0];\n for (var i = 1; i < people.length; i++) {\n if (people[i].gender == gender && people[i].age > oldest.age) {\n oldest = people[i];\n }\n }\n return oldest;\n}",
"function findOlder() {\n //let arr = [];\n //console.log(val);\n for (i = 0; i < devs.length; i++) {\n //let val = devs[i].age;\n //arr.push(val);\n if (devs[i].age > 24) {\n console.log(devs[i]);\n }\n }\n //console.log(arr);\n }",
"function secondOldest() {\n var firstMaxSoFar = ages[0]; \n var secondMax = undefined; \n \n document.getElementById(\"secondoldest\").innerHTML = outPutText; \n}",
"function getMinandMaxAge() {\n let ages = [];\n let leagueSelected = $(\"#division\").val();\n\n if (leagueSelected == \"Tee Ball\") {\n ages = [4, 6];\n }\n else if (leagueSelected == \"Minors\") {\n ages = [7, 9];\n }\n else if (leagueSelected == \"Majors\") {\n ages = [10, 12];\n }\n else {\n ages = [12, 14];\n }\n return ages;\n}"
] | [
"0.78486305",
"0.7427882",
"0.7326222",
"0.7013265",
"0.6738038",
"0.6712644",
"0.6627846",
"0.65975624",
"0.6574193",
"0.65132743",
"0.64635026",
"0.6458466",
"0.6167384",
"0.61547387",
"0.61451113",
"0.6124622",
"0.61235875",
"0.6054878",
"0.60398024",
"0.5996854",
"0.59744465",
"0.5914014",
"0.5867591",
"0.5856671",
"0.58202606",
"0.57858205",
"0.57242167",
"0.568981",
"0.56497484",
"0.5565444"
] | 0.74437 | 1 |
remove the created div when this Modal Component is unmounted Used to clean up the memory to avoid memory leak | componentWillUnmount() {
modalRoot.removeChild(this.element);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"destroy() {\n $.removeData(this.element[0], COMPONENT_NAME);\n }",
"destroy() {\n this.teardown();\n $.removeData(this.element[0], COMPONENT_NAME);\n }",
"destroy() {\n this._componentRef.destroy();\n }",
"destroy() {\n if (!this.isDestroyed) {\n this.uiWrapper.parentNode.removeChild(this.uiWrapper);\n this.emitEvent('destroyed', this.id);\n this.isDestroyed = true;\n }\n }",
"onRemove() {\n if (this.div_) {\n this.div_.parentNode.removeChild(this.div_);\n this.div_ = null;\n }\n }",
"destroy() {\n this.modalPanel.destroy();\n this.fields = null;\n this.classes = null;\n }",
"componentWillUnmount() {\n // Cleans up Blaze view\n Blaze.remove(this.view);\n }",
"destroy()\n {\n this.div = null;\n\n for (let i = 0; i < this.children.length; i++)\n {\n this.children[i].div = null;\n }\n\n window.document.removeEventListener('mousemove', this._onMouseMove);\n window.removeEventListener('keydown', this._onKeyDown);\n\n this.pool = null;\n this.children = null;\n this.renderer = null;\n }",
"destroy () {\n this.getElement().remove()\n }",
"_destroy() {\n this._root.unmount();\n this._container.off('open', this._render, this);\n this._container.off('destroy', this._destroy, this);\n }",
"destroy() {\n delete this.root.dataset.componentId;\n }",
"destroy() {\n this.disconnect()\n this.element.remove();\n }",
"function doDestroy()\n {\n $(\"#\" + _containerId).remove();\n }",
"remove() {\n ReactDOM.unmountComponentAtNode(this.container);\n super.remove();\n }",
"function onunmount () {\n removeNativeElement()\n currentElement = null\n }",
"destroy() {\n // this.group = null;\n this.$el = null;\n }",
"destroy() {\n\t\tthis._container.removeEventListener('mousewheel',this._mouseWheelListener);\n\t\twindow.removeEventListener('resize',this._resizeListener);\n\t\tthis._mc.destroy();\n\t\tthis._container = null;\n\t}",
"unmounted(el, binding) {\n const masonryId = binding.value || defaultId\n emitter.emit(`${EVENT_DESTROY}__${masonryId}`)\n }",
"destroy () {\n // unbind event handlers and clear elements created\n }",
"destroy() {\n this.element.remove();\n // this.subscriptions.dispose();\n }",
"componentWillUnmount() {\n var element = ReactDOM.findDOMNode(this);\n this.getChartState().d3component.destroy(element);\n }",
"destroy()\n\t{\n\t\tthis.element.remove();\n\t\tthis.modalPanel.destroy();\n\t}",
"destroy(){\n\t\tthis._wrapper.innerHTML = '';\n\t\tthis._wrapper.classList.remove('mvc-wrapper', 'mvc-stylised');\n\t}",
"unmount() {\n let me = this;\n\n Neo.currentWorker.promiseMessage('main', {\n action : 'updateDom',\n appName: me.appName,\n deltas : [{\n action: 'removeNode',\n id : me.vdom.id\n }]\n }).then(() => {\n me.mounted = false;\n }).catch(err => {\n console.log('Error attempting to unmount component', err, me);\n });\n }",
"destroy() {\n if (!this.destroyed) {\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n this.destroyed = true;\n this.dispose();\n }\n }",
"destroy() {\n this.element.remove();\n this.subscriptions.dispose();\n this.editorSubs.dispose();\n }",
"destroy () {\n\t\tthis.options.element.removeEventListener('click', this.onClickToElement);\n\t\tthis.options.element.removeChild(this.options.element.querySelector('.pollsr'));\n\t}",
"function onunmount () {\n\t removeNativeElement()\n\t currentElement = null\n\t }",
"unMount() {\n this.removeListeners();\n SimpleBar.instances.delete(this.el);\n }",
"unMount() {\n this.removeListeners();\n SimpleBar.instances.delete(this.el);\n }"
] | [
"0.72245914",
"0.71879286",
"0.70123136",
"0.6941995",
"0.6914517",
"0.691231",
"0.6912048",
"0.6909787",
"0.6885292",
"0.6876775",
"0.6874604",
"0.6846686",
"0.6827205",
"0.6821308",
"0.6811845",
"0.67996776",
"0.67801577",
"0.6775338",
"0.67741215",
"0.67691034",
"0.67415154",
"0.6737373",
"0.67300946",
"0.67147166",
"0.66979116",
"0.6697667",
"0.66965824",
"0.6694532",
"0.669025",
"0.66902214"
] | 0.7750632 | 0 |
Navigate to Submit an Ad Page | function gotoSubmitAd() {
if (localStorage.getItem('user_id')) {
window.location.href = "../dashboard/dashboard.html";
}
else {
window.location.href = "../login/login.html";
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function submitPost(post) {\n $.post(\"/api/posts\", post, function() {\n window.location.href = \"/addexercise\";\n });\n }",
"function goToSubmit() {\n var element = document.getElementById('car_submit');\n element.scrollIntoView({ behavior: \"smooth\", block: \"end\" });\n }",
"function pageOneSubmitPressed() {\r\n window.location.href = \"2nd.html\";\r\n}",
"function postDetails(){\n\twindow.location.href = \"../html/post.html\";\n\t\n}",
"function postRedirect(){\n\tdocument.getElementById(\"redirect\").submit();\n}",
"function goto_next_form() {\n context.current++;\n if (context.current >= context.workflow.length) {\n return finish_survey(); //todo: verify that when going Back and clicking Next this doesn't break the flow\n }\n //Store the incremented value of 'current'\n Survana.Storage.Set('current', context.current, function () {\n //load the next form\n window.location.href = context.workflow[context.current];\n }, on_storage_error);\n }",
"function paypalRedirect(){\n\t\t\n\t\tsetTimeout(function() { \t\n\t\t\tdocument.forms['paypal_auto_form'].submit();\n\t\t}, 300);\t\n\t}",
"function resultsRedirect(){\n\tresultsForm.submit();\n}",
"function submitFormLanding() {\n var TriggeredAction = request.triggeredFormAction;\n if (TriggeredAction !== null) {\n if (TriggeredAction.formId === 'search') {\n search();\n return;\n }\n }\n\n}",
"function navSubmitClick (evt) {\n\tconsole.debug('navSubmitClick', evt);\n\thidePageComponents();\n\t$storyAddingForm.show();\n}",
"function tf_askSearch(url) {\n\tvar adv = tf_linkObjects[tf_flash_adNum - 1].getAd();\n\ttf_submitClick(tf_flash_adNum, url, adv.trackURL);\n}",
"function navSubmitClick(evt) {\n evt.preventDefault();\n console.debug(\"navSubmitClick\", evt);\n navAllStories();\n $newStoryForm.show();\n}",
"function submitSearch() {\n hitSelected = document.getElementsByClassName('aa-cursor')[0];\n\n if (hitSelected && searchQuery) {\n const articleUrl = hitSelected.querySelector('a').href;\n window.location.assign(articleUrl);\n } else if (!hitSelected && searchQuery && hits) {\n window.location.assign(`{{ site.url }}/search?query=${searchQuery}`);\n }\n }",
"function postPage() {\n window.location = \"../createPost.html\";\n}",
"function navSubmitClick(evt) {\n console.debug('navSubmitClick', evt)\n hidePageComponents()\n putStoriesOnPage()\n $submitForm.show()\n $allStoriesList.prepend($submitForm)\n}",
"function onClickSubmit() {\n location.href = \"./student-submit-quest.html?questid=\" + questID + \"&userid=\" + userID;\n}",
"function gotoViewAd(ID){\r\n window.location.href = \"/view_ads.html?ad_id=\" + String(ID);\r\n}",
"function submitRecord() {\n var url_string = window.location.href\n var url = new URL(url_string);\n var contract_id = Number(url.searchParams.get(\"contract_id\"));\n addPoSubmit(contract_id)\n}",
"function gotoViewAd(ID) {\r\n window.location.href=\"/view_ads.html?ad_id=\" + String(ID);\r\n}",
"function gotoViewAd(ID) {\r\n window.location.href=\"/view_ads.html?ad_id=\" + String(ID);\r\n}",
"function goBack()\n{\n if (document.forms[0].calledFrom.value==\"onGoingProjects\")\n {\n document.forms[0].action=\"/ICMR/allocatorAbstract.do?hmode=ongoingDetails\";\n }\n else if (document.forms[0].calledFrom.value==\"fullPaper\")\n {\n document.forms[0].action=\"/ICMR/saveSemiModified.do\"; //name of action which takes to allocator full paper\n }\n \n document.forms[0].submit();\n}",
"function approvedPost() {\n\tdocument.getElementById(\"form-approved-post\").submit();\n}",
"function submitClicked () {\n retrieveInput();\n changePage();\n}",
"function submit(){\n\t/* MAKE URL */\n\tvar selectedStr = selected.toString();\n\twindow.location.href = makeQueryString()+\"&submit=\";\n}",
"function auto_next_course_action(form) {\n var element_text = $('#auto_next_course_button').html();\n if (element_text == 'AUTO FILL COURSES') {\n autoCourse();\n return false;\n } else if (element_text == 'NEXT STEP') {\n submitCourse(form);\n return true;\n }\n}",
"function goToTaskForm() {\n window.location.href = TASK_CREATOR + '?id=' + projectID;\n}",
"function setUpSurvey(ob) {\r\n\tif (ob.value != '') {\r\n\t\twindow.location.href = app_path_webroot+\"Surveys/create_survey.php?pid=\"+pid+\"&view=showform&page=\"+ob.value;\r\n\t}\r\n}",
"function submitCustomerInfo(Post){\n $.post(\"/api/customerposts/\", Post, function(){\n window.location.href = \"/customer\"\n \n })\n }",
"function submitPost(Post) {\n $.post(\"/event\", Post, function() {\n window.location.href = \"/event\";\n });\n }",
"function newLocation() {\r\n\tdocument.location.href = \"http://www.\" + adURL[thisAd];\r\n\treturn false;\r\n}"
] | [
"0.6617835",
"0.6567393",
"0.6372224",
"0.6305512",
"0.62939143",
"0.6288367",
"0.62680435",
"0.6235656",
"0.6207745",
"0.6203159",
"0.6171488",
"0.611962",
"0.61175114",
"0.6093927",
"0.6084791",
"0.6063685",
"0.60440403",
"0.5987568",
"0.59585685",
"0.59585685",
"0.59500283",
"0.59278214",
"0.5897213",
"0.5890079",
"0.585619",
"0.5844964",
"0.58324367",
"0.58303446",
"0.58267426",
"0.58157766"
] | 0.6731556 | 0 |
gets the time that the standup report will be generated for a channel | function getStandupTime(channel, cb) {
controller.storage.teams.get('standupTimes', function(err, standupTimes) {
if (!standupTimes || !standupTimes[channel]) {
cb(null, null);
} else {
cb(null, standupTimes[channel]);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getBotMsgTime(session){\n\tconsole.log(\"getBotMsgTime() executing\");\n\tvar botTime = new Date(session.userData.lastMessageSent);\n\tconsole.log(\"Bot time unformatted is:\");\n\tconsole.log(botTime);\n\n\tvar botTimeFormatted = dateFormat(botTime, \"yyyy-mm-dd HH:MM:ss\");\n\n\tconsole.log(\"Bot messaged at: \" + botTimeFormatted);\n\treturn botTimeFormatted;\n}",
"function checkTimesAndReport(bot) {\n getStandupTimes(function(err, standupTimes) { \n if (!standupTimes) {\n return;\n }\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n for (var channelId in standupTimes) {\n var standupTime = standupTimes[channelId];\n if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) {\n getStandupData(channelId, function(err, standupReports) {\n bot.say({\n channel: channelId,\n text: getReportDisplay(standupReports),\n mrkdwn: true\n });\n clearStandupData(channelId);\n });\n }\n }\n });\n}",
"get time() {}",
"function reportTime(){\n const date = new Date();\n const {time, mode} = getTime();\n const reportTime = `${time} ${mode} ${date.getDate()}/${date.getMonth()+1}/${date.getFullYear()}`;\n return reportTime ;\n}",
"getReadableTime() {\n // Debugging line.\n Helper.printDebugLine(this.getReadableTime, __filename, __line);\n\n // Stop the time please. How long was the crawling process?\n let ms = new Date() - this.startTime,\n time = Parser.parseTime(ms),\n timeString = `${time.d} days, ${time.h}:${time.m}:${time.s}`;\n\n this.output.write(timeString, true, 'success');\n this.output.writeLine(`Stopped at: ${new Date()}`, true, 'success');\n }",
"get time() {\n return (process.hrtime()[0] * 1e9 + process.hrtime()[1]) / 1e6;\n }",
"function pii_next_report_time() {\n var curr_time = new Date();\n\n curr_time.setSeconds(0);\n // Set next send time after 3 days\n curr_time.setMinutes( curr_time.getMinutes() + 4320);\n curr_time.setMinutes(0);\n curr_time.setHours(0);\n curr_time.setMinutes( curr_time.getMinutes() + pii_vault.config.reporting_hour);\n return new Date(curr_time.toString());\n}",
"function getInitialTime() {\n changeTime();\n}",
"function get_time() {\n let d = new Date();\n if (start_time != 0) {\n d.setTime(Date.now() - start_time);\n } else {\n d.setTime(0);\n }\n return d.getMinutes().toString().padStart(2,\"0\") + \":\" + d.getSeconds().toString().padStart(2,\"0\");\n }",
"function getStats() {\n let timestamp = new Date(Date.now());\n let dateTime = timestamp.toDateString() + \" \" + timestamp.toLocaleTimeString()\n return dateTime;\n}",
"get uptime() {\n if (this._state === exports.ClientState.ACTIVE\n && this._currentConnectionStartTime) {\n return Date.now() - this._currentConnectionStartTime;\n }\n else {\n return 0;\n }\n }",
"liveTime() {\n\t\tthis.updateTime();\n\t\tthis.writeLog();\n\t}",
"function get_time() {\n return Date.now();\n}",
"function setStandupTime(channel, standupTimeToSet) {\n \n controller.storage.teams.get('standupTimes', function(err, standupTimes) {\n\n if (!standupTimes) {\n standupTimes = {};\n standupTimes.id = 'standupTimes';\n }\n\n standupTimes[channel] = standupTimeToSet;\n controller.storage.teams.save(standupTimes);\n });\n}",
"_clock(subscription) {\n return new Promise((resolve, reject) => {\n let watcherInfo = this._getWatcherInfo(subscription);\n\n this._client.command(['clock', watcherInfo.root], (error, resp) => {\n if (error) {\n reject(error);\n } else {\n watcherInfo.since = resp.clock;\n resolve(resp);\n }\n });\n });\n }",
"function getNoon(){\n\treturn time;\n}",
"function getTimeLapse(session){\n\tconsole.log(\"getTimeLapse() executing\");\n\tvar botTime = new Date(session.userData.lastMessageSent);\n\tvar userTime = new Date(session.message.localTimestamp);\n\tvar userTimeManual = new Date(session.userData.lastMessageReceived);\n\tconsole.log(\"Time Lapse Info:\");\n\tvar timeLapseMs = userTimeManual - botTime;\n\tconsole.log(\"Time lapse in ms is: \" + timeLapseMs);\n\tvar timeLapseHMS = convertMsToHMS(timeLapseMs);\n\tconsole.log(\"Time lapse in HH:MM:SS: \" + timeLapseHMS);\n\treturn timeLapseHMS;\n}",
"function getTime(){\n \n hr = hour();\n mn = minute();\n sc = second();\n}",
"function o2ws_get_time() { return o2ws_get_float(); }",
"function getAskingTime(user, channel, cb) {\n controller.storage.teams.get('askingtimes', function(err, askingTimes) {\n\n if (!askingTimes || !askingTimes[channel] || !askingTimes[channel][user]) {\n cb(null,null);\n } else {\n cb(null, askingTimes[channel][user]); \n }\n }); \n}",
"getTime(){\n this.time = millis();\n this.timeFromLast = this.time - this.timeUntilLast;\n }",
"get remainingTime() {\r\n return Math.ceil((this.maxTime - this.timeTicker) / 60);\r\n }",
"getTimePassed() {\n let createdAt = new Date(parseInt(this.props._id.slice(0,8), 16)*1000);\n let now = new Date();\n let diffMs = (now - createdAt); // milliseconds between now & createdAt\n let diffMins = Math.floor(diffMs / 60000); // minutes\n if(diffMins < 1)\n return \"just now\";\n if(diffMins == 1)\n return \"1 min\";\n let diffHrs = Math.floor(diffMins / 60); // hours\n if(diffHrs < 1)\n return `${diffMins} mins`;\n if(diffHrs == 1)\n return `1 hr`;\n let diffDays = Math.floor(diffHrs / 24); // days\n if(diffDays < 1)\n return `${diffHrs} hrs`;\n if(diffDays == 1)\n return `1 day`;\n let diffWeeks = Math.floor(diffDays / 7);\n if(diffWeeks < 1)\n return `${diffDays} days`;\n if(diffWeeks == 1)\n return `1 week`;\n return `${diffWeeks} weeks`;\n }",
"function updateclock() {\n var date = new Date();\n var hours = date.getHours() < 10 ? \"0\" + date.getHours() : date.getHours();\n var minutes = date.getMinutes() < 10 ? \"0\" + date.getMinutes() : date.getMinutes();\n var seconds = date.getSeconds() < 10 ? \"0\" + date.getSeconds() : date.getSeconds();\n time = hours + \"\" + minutes + \"\" + seconds;\n return time;\n }",
"function latestTime() {\n return web3.eth.getBlock('latest').timestamp;\n}",
"function currTime(){\n let timeout = new Date();\n return timeout.toString();\n}",
"function latestTime () {\n return web3.eth.getBlock('latest').timestamp\n}",
"function respondWithTime(){\n sendMessage(buildBotMessage(new Date().toUTCString()));\n}",
"function time() {\n return (Date.now() / 1000);\n }",
"async run(message) {\n let days = 0;\n let week = 0;\n\n\n let uptime = ``;\n let totalSeconds = (this.client.uptime / 1000);\n let hours = Math.floor(totalSeconds / 3600);\n totalSeconds %= 3600;\n let minutes = Math.floor(totalSeconds / 60);\n let seconds = Math.floor(totalSeconds % 60);\n\n if(hours > 23){\n days = hours / 24;\n days = Math.floor(days);\n hours = hours - (days * 24);\n }\n\n if(minutes > 60){\n minutes = 0;\n }\n\n uptime += `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`;\n\n let serverembed = new MessageEmbed()\n .setColor(0x00FF00)\n .addField('Uptime', uptime)\n .setFooter(`Hypixel Stats made by Slice#1007 | https://discord.gg/RGD8fkD`, 'https://i.imgur.com/WdvE9QUg.jpg');\n\n message.say(serverembed);\n }"
] | [
"0.6040518",
"0.60359293",
"0.6010521",
"0.6001613",
"0.5957078",
"0.5952818",
"0.590619",
"0.58774245",
"0.5787974",
"0.5776971",
"0.56780404",
"0.56668615",
"0.5617398",
"0.56120676",
"0.5591071",
"0.55838776",
"0.55686265",
"0.5552662",
"0.55173296",
"0.55053",
"0.55017895",
"0.54842645",
"0.5483245",
"0.5472952",
"0.5462436",
"0.54581654",
"0.5450036",
"0.543837",
"0.54375696",
"0.5427483"
] | 0.7024009 | 0 |
gets the time a user has asked to report for a given channel | function getAskingTime(user, channel, cb) {
controller.storage.teams.get('askingtimes', function(err, askingTimes) {
if (!askingTimes || !askingTimes[channel] || !askingTimes[channel][user]) {
cb(null,null);
} else {
cb(null, askingTimes[channel][user]);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getStandupTime(channel, cb) {\n controller.storage.teams.get('standupTimes', function(err, standupTimes) {\n if (!standupTimes || !standupTimes[channel]) {\n cb(null, null);\n } else {\n cb(null, standupTimes[channel]);\n }\n });\n}",
"function getBotMsgTime(session){\n\tconsole.log(\"getBotMsgTime() executing\");\n\tvar botTime = new Date(session.userData.lastMessageSent);\n\tconsole.log(\"Bot time unformatted is:\");\n\tconsole.log(botTime);\n\n\tvar botTimeFormatted = dateFormat(botTime, \"yyyy-mm-dd HH:MM:ss\");\n\n\tconsole.log(\"Bot messaged at: \" + botTimeFormatted);\n\treturn botTimeFormatted;\n}",
"function pii_next_report_time() {\n var curr_time = new Date();\n\n curr_time.setSeconds(0);\n // Set next send time after 3 days\n curr_time.setMinutes( curr_time.getMinutes() + 4320);\n curr_time.setMinutes(0);\n curr_time.setHours(0);\n curr_time.setMinutes( curr_time.getMinutes() + pii_vault.config.reporting_hour);\n return new Date(curr_time.toString());\n}",
"getTimePassed() {\n let createdAt = new Date(parseInt(this.props._id.slice(0,8), 16)*1000);\n let now = new Date();\n let diffMs = (now - createdAt); // milliseconds between now & createdAt\n let diffMins = Math.floor(diffMs / 60000); // minutes\n if(diffMins < 1)\n return \"just now\";\n if(diffMins == 1)\n return \"1 min\";\n let diffHrs = Math.floor(diffMins / 60); // hours\n if(diffHrs < 1)\n return `${diffMins} mins`;\n if(diffHrs == 1)\n return `1 hr`;\n let diffDays = Math.floor(diffHrs / 24); // days\n if(diffDays < 1)\n return `${diffHrs} hrs`;\n if(diffDays == 1)\n return `1 day`;\n let diffWeeks = Math.floor(diffDays / 7);\n if(diffWeeks < 1)\n return `${diffDays} days`;\n if(diffWeeks == 1)\n return `1 week`;\n return `${diffWeeks} weeks`;\n }",
"function checkTimesAndReport(bot) {\n getStandupTimes(function(err, standupTimes) { \n if (!standupTimes) {\n return;\n }\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n for (var channelId in standupTimes) {\n var standupTime = standupTimes[channelId];\n if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) {\n getStandupData(channelId, function(err, standupReports) {\n bot.say({\n channel: channelId,\n text: getReportDisplay(standupReports),\n mrkdwn: true\n });\n clearStandupData(channelId);\n });\n }\n }\n });\n}",
"_clock(subscription) {\n return new Promise((resolve, reject) => {\n let watcherInfo = this._getWatcherInfo(subscription);\n\n this._client.command(['clock', watcherInfo.root], (error, resp) => {\n if (error) {\n reject(error);\n } else {\n watcherInfo.since = resp.clock;\n resolve(resp);\n }\n });\n });\n }",
"async function watchCheck(botChannel, bot) {\n console.log(`\\nwatchCheck at: ${new Date(Date.now())}\\nlast Check at: ${new Date(bot.lastWatch)}\\n`);\n\n const subscribers = await getSubs();\n const wfState = await commons.getWfStatInfo(config.WFStatApiURL);\n\n subscribers.forEach((sub) => {\n console.log(`User: ${sub.userID}`);\n\n sub.subData.forEach((entry) => {\n const notifyStr = checkNotificationsForEntry(entry, wfState, bot);\n\n console.log(`return string:${notifyStr}`);\n\n if (notifyStr) {\n bot.users.fetch(sub.userID).then((user) => {\n try {\n user.send(`Notification for you operator:\\n${notifyStr}`);\n } catch (error) {\n botChannel.send(`Failed to send a DM to ${user}. Have you enabled DMs?`);\n }\n });\n }\n });\n });\n\n return Date.parse(wfState.timestamp);\n}",
"static get lastReport() {}",
"function respondWithTime(){\n sendMessage(buildBotMessage(new Date().toUTCString()));\n}",
"function reportTime(){\n const date = new Date();\n const {time, mode} = getTime();\n const reportTime = `${time} ${mode} ${date.getDate()}/${date.getMonth()+1}/${date.getFullYear()}`;\n return reportTime ;\n}",
"function getChannel(channel){\n gapi.client.youtube.channels.list({\n part: 'snippet,contentDetails,statistics',\n forUsername: channel\n\n })\n .then(respone => {\n console.log(response);\n const channel = response.result.items[0];\n\n const output = `\n <ul class=\"collection\">\n <li class=\"collection-item\">Title : ${channel.snippet.title}</li>\n <li class=\"collection-item\">ID: ${channel.id}</li>\n <li class=\"collection-item\">Subscribers: ${channel.statistics.subscriberCount}</li>\n <li class=\"collection-item\">Views: ${ numberWithCommas(channel.statistics.viewCount)}</li>\n <li class=\"collection-item\">Videos: ${numberWithCommas(channel.statistics.videoCount)}</li>\n </ul>\n <p>${channel.snippet.description}</p>\n <hr>\n <a class=\"btn grey darken-2\" target=\"_blank\" href=\"https://youtube.com/${channel.snippet.customURL}\">Visit Channel</a>\n\n `;\n\n showChannelData(output);\n\n const playlistID = channel.contentDetails.relatedPlaylists.uploads;\n requestVideoPlaylist(playlistID);\n })\n .catch(err => alert('No Channel By That Name'));\n}",
"function getTimeFromBackground() {\n chrome.runtime.sendMessage({message: 'whoIsPlaying', action: true}, function (response) {\n var currentService = PlayerFactory.setCurrentService(response) || response.currentService;\n console.log('progressbar current service', currentService)\n var request = {\n message: \"checkTimeAction\",\n service: currentService\n };\n chrome.runtime.sendMessage(request, function (response) {\n $scope.duration = response.duration || $scope.duration ;\n $scope.timeElapsed = response.currentTime || $scope.timeElapsed;\n // console.log('scope time elapsed and duration', $scope.timeElapsed, $scope.duration);\n // console.log('response time elapsed and duration', response.currentTime, response.duration);\n if ($scope.duration !== max) {\n max = $scope.duration;\n theSlider.slider(\"option\", \"max\", max);\n }\n theSlider.slider({\n value: $scope.timeElapsed\n });\n $scope.$digest();\n });\n });\n }",
"function getChannel(channel) {\n gapi.client.youtube.channels\n .list({\n part: 'snippet,contentDetails,statistics',\n id: channel\n })\n .then(response => {\n console.log(response);\n const channel = response.result.items[0];\n\n const playlistId = channel.contentDetails.relatedPlaylists.uploads;\n requestVideoPlaylist(playlistId);\n })\n .catch(err => alert('No Channel By That Name'));\n}",
"function getUserMsgTime(session){\n\tconsole.log(\"getUserMsgTime() executing\");\n\tvar userTime = new Date(session.userData.lastMessageReceived);\n\tconsole.log(\"User unformatted is:\");\n\tconsole.log(userTime);\n\n\tvar userTimeFormatted = dateFormat(userTime, \"yyyy-mm-dd HH:MM:ss\");\n\tconsole.log(\"User time formatted:\" + userTimeFormatted);\n\n\treturn userTimeFormatted;\n}",
"get(channelId) {\n\t\tif(CHANNEL_CACHE[channelId] != null) {\n\t\t\t//channel in cache\n\t\t\treturn Promise.resolve(CHANNEL_CACHE[channelId]);\n\t\t} else if(GET_CHANNEL_CALL_IN_PROGRESS[channelId]) {\n\t\t\t//channel call in progress\n\t\t\treturn GET_CHANNEL_CALL_IN_PROGRESS[channelId];\n\t\t} else {\n\t\t\t//Calling API to fetch channel info\n\t\t\tconst options = {\n\t\t\t\turl: 'https://slack.com/api/channels.info',\n\t\t\t\tqs: {\n\t\t\t\t\ttoken: process.env.apiToken,\n\t\t\t\t\tchannel: channelId\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst newPromise = new Promise((resolve, reject) => {\n\t\t\t\tthis._callRest(options).then((response) => {\n\t\t\t\t\tconst output = JSON.parse(response);\n\t\t\t\t\tif(this.logger.isSillyEnabled()) {\n\t\t\t\t\t\tthis.logger.silly('Output of channels.info api:-' + JSON.stringify(output));\n\t\t\t\t\t}\n\t\t\t\t\tif(output.ok) {\n\t\t\t\t\t\tCHANNEL_CACHE[channelId] = output.channel;\n\t\t\t\t\t\tresolve(CHANNEL_CACHE[channelId]);\n\n\t\t\t\t\t\t//remove promise from cache as now channel object is cached\n\t\t\t\t\t\tdelete GET_CHANNEL_CALL_IN_PROGRESS[channelId];\n\t\t\t\t\t} else {\n\t\t\t\t\t\treject(output.error);\n\t\t\t\t\t}\n\t\t\t\t}).catch((error) => {\n\t\t\t\t\treject(error);\n\t\t\t\t});\n\t\t\t});\n\t\t\t//put promise in cache so there wont be a duplicate call to API when first call is in progress\n\t\t\tGET_CHANNEL_CALL_IN_PROGRESS[channelId] = newPromise;\n\t\t\treturn newPromise;\n\t\t}\n\t}",
"function getLastThingSpeakData3(){\n console.log(\"aaaaaaaaaaaaaaaaaaa\")\n var channel_id = 196384; //id do canal\n var field_number1 = 1; //numero do field\n var field_number2 = 2; //numero do field\n var field_number3 = 3 //3\n var field_number4 = 4 //4\n var num_results = 500; //numero de resultados requisitados\n\n\n}",
"function currTime(){\n let timeout = new Date();\n return timeout.toString();\n}",
"function getEventMeta (channel) {\n\t\treturn {\n\t\t\tviewers: getNumberOfViewers(channel)\n\t\t};\n\t}",
"function cancelAskingTime(user, channel) {\n controller.storage.teams.get('askingtimes', function(err, askingTimes) {\n\n if (!askingTimes || !askingTimes[channel] || !askingTimes[channel][user]) {\n return;\n } else {\n delete askingTimes[channel][user];\n controller.storage.teams.save(askingTimes); \n }\n }); \n}",
"function get_channelInfo(APIKey , channel_id , callBackFunction ){\n $.getJSON( \"https://www.googleapis.com/youtube/v3/channels?part=statistics,snippet&id=\" + channel_id + \"&key=\" + APIKey , function(data) {\n /*On success callback*/\n var channel = new ChannelObj( data.items[0].snippet.title , data.items[0].snippet.description , data.items[0].snippet.thumbnails.default.url , new Date(data.items[0].snippet.publishedAt) );\n channel.id = channel_id;\n channel.stats.push( { key: \"views\", value: Number(data.items[0].statistics.viewCount) });\n channel.stats.push( { key: \"subscribers\", value: Number(data.items[0].statistics.subscriberCount) });\n channel.stats.push( { key: \"videoCount\", value: Number(data.items[0].statistics.videoCount) });\n callBackFunction(channel);\n });\n}",
"function getRemainingTime() {\n return new Date().getTime() - startTimeMS;\n}",
"function askingTime(msg){\n return msg.text.toLowerCase().match(/time/i);\n}",
"function getStats() {\n let timestamp = new Date(Date.now());\n let dateTime = timestamp.toDateString() + \" \" + timestamp.toLocaleTimeString()\n return dateTime;\n}",
"function coffeeConsumptionTime() {\n for (var i = 0; i < entries.length; i++) {\n if (entries[i].q1_3 === 0) {\n coffeeTimes.none += 1;\n } else if (entries[i].q1_3 === 1) {\n coffeeTimes.min += 1;\n } else if (entries[i].q1_3 === 2) {\n coffeeTimes.mid += 1;\n } else if (entries[i].q1_3 === 3) {\n coffeeTimes.max += 1;\n }\n }\n }",
"function addAskingTime(user, channel, timeToSet) {\n controller.storage.teams.get('askingtimes', function(err, askingTimes) {\n\n if (!askingTimes) {\n askingTimes = {};\n askingTimes.id = 'askingtimes';\n }\n\n if (!askingTimes[channel]) {\n askingTimes[channel] = {};\n }\n\n askingTimes[channel][user] = timeToSet;\n controller.storage.teams.save(askingTimes);\n });\n}",
"function send_client_info_timer() {\n if (fatal_error) {\n return;\n }\n\n /* send timer after channel starts playing */\n if (startup_delay_ms !== null) {\n that.send_client_info('timer');\n }\n\n /* periodically update vbuf and abuf in case 'updateend' is not fired */\n if (av_source) {\n av_source.vbuf_update();\n av_source.abuf_update();\n }\n }",
"getCountdownTimeRemaining() {\n var timeleft = CookieManager.get(this.options.popupID + '-timer');\n if (!timeleft) {\n timeleft = this.options.popupDelaySeconds;\n }\n timeleft = Number(timeleft);\n if (timeleft < 0)\n timeleft = 0;\n return timeleft;\n }",
"getReport()\r\n\t{\r\n\t\tlet report = '';\r\n\r\n\t\tmembers.forEach( (member, duration) => s += member.username + '\\t\\t' + duration + ' seconds\\n' );\r\n\t\treturn report;\r\n\t}",
"get time() {}",
"getCurrentChannel() {\n return BdApi.findModuleByProps(\"getChannelId\").getChannelId();\n }"
] | [
"0.6046183",
"0.5564972",
"0.5558473",
"0.55167425",
"0.54932386",
"0.5406893",
"0.5406754",
"0.5369679",
"0.5338762",
"0.5330139",
"0.52722967",
"0.5264473",
"0.51975965",
"0.5191128",
"0.5190129",
"0.51743525",
"0.5171066",
"0.5164562",
"0.5160631",
"0.5139034",
"0.5132241",
"0.51214993",
"0.5116543",
"0.5112763",
"0.5096299",
"0.50929505",
"0.5092364",
"0.5079716",
"0.5058528",
"0.5058042"
] | 0.6806506 | 0 |
cancels a user's asking time in a channel | function cancelAskingTime(user, channel) {
controller.storage.teams.get('askingtimes', function(err, askingTimes) {
if (!askingTimes || !askingTimes[channel] || !askingTimes[channel][user]) {
return;
} else {
delete askingTimes[channel][user];
controller.storage.teams.save(askingTimes);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"cancel() {\n return this.channel.basicCancel(this.tag)\n }",
"cancelA2HSprompt(_this) {\n document.getElementById('cancel-btn').addEventListener('click', () => {\n _this.delayA2HSprompt();\n _this.hideMsg();\n });\n }",
"function OnCancelAndUnlockPressed()\n{\n\t// Unlock the team selection, allowing the players to change teams again\n\tGame.SetTeamSelectionLocked( false );\n\n\t// Stop the countdown timer\n\tGame.SetRemainingSetupTime( -1 ); \n}",
"function cancelForgotUsername(){\n\tcloseWindow();\n}",
"canceled() {}",
"cancel(silent) {\n // Update database\n app.database.finishGame(this);\n\n if(this.staff_alert != null){\n clearInterval(this.staff_alert);\n this.staff_alert = null;\n }\n // Delete channels\n app.discordClient.channels.fetch(this.category).then(category => {\n (async ()=>{\n for(const channel of category['children']){\n await channel[1].delete()\n }\n category.delete().then(null);\n })();\n })\n\n // Remove object\n app.gamemap = removeItemAll(app.gamemap,this);\n\n // Message players\n if(silent === undefined || silent === false) {\n this.players.forEach(player => {\n // Give queue priority for 5 minutes\n app.queuemap[this.guild['id']].priority.push({\n player: player,\n expires: (new Date()).getTime()+60000\n });\n\n // Direct message player\n app.discordClient.users.resolve(player).send(new MessageEmbed().setColor(\"RED\").setTitle(\"Your match has been cancelled\").setDescription(`The game ${this.id} has been cancelled. You have been returned to the queue.\\n\\n**If you re-queue within a minute you will be at the top**`)).then(null);\n });\n }\n\n delete this;\n }",
"async function ChooseChanForDelete()\n{\n\tlet choice = []\n\tawait objActualServer.server.channels.forEach((channel) =>\n\t{\n\t\tif (channel.type == \"text\")\n\t\t{\n\t\t\tchoice.push(\n\t\t\t{\n\t\t\t\tname: channel.name,\n\t\t\t\tvalue: channel\n\t\t\t})\n\t\t}\n\t})\n\tchoice.push(\n\t\t{\n\t\t\tname: \"Retournez au choix des actions\",\n\t\t\tvalue: -1\n\t\t},\n\t\treturnObjectLeave()\n\t)\n\n\tlet response = await ask(\n\t{\n\t\ttype: \"list\",\n\t\tmessage: \"Choissisez le serveur à supprimer DISCLAIMER !!!!! Cette action est irréversible !!!! DISCLAIMER\",\n\t\tchoices: choice,\n\t\tname: \"selectedChan\"\n\t})\n\tif (response.selectedChan == -1)\n\t{\n\t\taskWhatToDoChan()\n\t}\n\telse if (response.selectedChan == -2)\n\t{\n\t\tendProcess()\n\t}\n\telse\n\t{\n\t\tdoDeleteChannel(response.selectedChan)\n\t}\n\n\n}",
"function Cancellation() { }",
"function countdown() {\n if (timer > 0) {\n timer--;\n $(\"#time\").text(timer)\n }\n else {\n var buttonData = {\n userId: socket.id,\n buttonClicked: 'none',\n timeLeft: 0\n }\n userAnswers.push(buttonData);\n newMeme();\n return;\n }\n }",
"function cancel() {\n\t// If enabled, play a sound.\n\tchrome.storage.sync.get({\n\t\tsounds: defaultSettings.sounds\n\t}, function(settings) {\n\t\tif(settings.sounds) {\n\t\t\tdocument.getElementById(\"cancelSound\").play();\n\t\t}\n\t});\n\tclosePopup();\n}",
"cancel() {\n this.logout();\n this.isCancelled = true;\n }",
"cancel() {\n if (this.midPrompt()) {\n this._cancel = true;\n this.submit('');\n this._midPrompt = false;\n }\n return this;\n }",
"cancel() {\n\n }",
"function decrement(){\n $(\"#timerArea\").html(\"Time remaining: \" + seconds)\n seconds--\n if (seconds < 0){\n $(\"#messageArea\").html(message.time);\n clearInterval(timer);\n timeOut = false\n answer();\n }\n}",
"function cancelGame(){\n\t\t\n\t\t//show a warning message before cancelling \n\t\t $('<div>').simpledialog2({\n\t\t\t mode: 'button',\n\t\t\t headerText: 'Sure?',\n\t\t\t headerClose: true,\n\t\t\t buttonPrompt: 'This will reset all the images selected till now',\n\t\t\t buttons : {\n\t\t\t 'Yes': {\n\t\t\t click: function () { \n\t\t\t resetcreategamepage();\n\t\t\t }\n\t\t\t },\n\t\t\t 'No': {\n\t\t\t click: function () { \n\t\t\t //$('#buttonoutput').text('Cancel');\n\t\t\t // do nothing\n\t\t\t },\n\t\t\t icon: \"delete\",\n\t\t\t theme: \"b\"\n\t\t\t }\n\t\t\t }\n\t\t });\n\t}",
"cancel() {}",
"function cancelstehenbleiben(){\n clearTimeout(stehenbleibencancel);\n}",
"function cancelOption(){\n document.getElementById(\"newOption\").style.display = \"none\";\n document.getElementById(\"pollSelection\").value = \"\";\n document.getElementById(\"newOptionValue\").value = \"\";\n document.getElementById(\"optionWarning\").innerHTML = \"\";\n }",
"cancelInput() {\n this.closeSettings();\n }",
"function decrement () {\n time--;\n $(\"#timeRemainingEl\").html(\"Time remaining: \" + time);\n\n if (time === 0) {\n clickOptionOn = false;\n guessResult = 2;\n correctAnsFunc();\n countMissedGuess++;\n transitionFunc();\n }\n }",
"function cancelMyBid() {\n\n}",
"function cancelAlarm(e) {\r\n if (e.keyCode !== 13)\r\n return;\r\n id = document.getElementById(\"alarmCancel\").value;\r\n chrome.alarms.getAll(function (alarms) {\r\n if (id <= 0 || alarms.length < id) {\r\n alert(\"Alarm \" + id + \" does not exist!\");\r\n return;\r\n }\r\n chrome.alarms.clear(alarms[id - 1].name);\r\n });\r\n}",
"function cancel(event, response, model) {\n model.exitQuestionMode();\n const speech = speaker.get(\"WhatToDo\");\n response.speak(speech)\n .listen(speech)\n .send();\n}",
"function count() {\n time--;\n displayCurrentTime();\n\n if (time < 1) {\n console.log('Out of time, I guess...');\n prependNewMessage('alert-danger', 'OUT OF TIME!!!!');\n stopTimer();\n setTimeout(nextQuestion, 1.2 * 1000);\n }\n }",
"function user_disconnect() {\n\n console.log(\"User disconnected.\");\n\n\n if (consumer.paymentTx.amount - consumer.paymentTx.paid <= min_initial_payment)\n {\n console.log(\"User tried to disconnect but the channel is almost done\");\n jQuery('#repayment_prompt').html(\"Channel already depleted. Please wait one moment.\");\n }\n else\n {\n // we send an error message here to allow for possibility of reopening channel.\n // this should probably be made more robust in future\n var msg = new Message({\n \"type\": Message.MessageType.ERROR,\n \"error\": {\n \"code\": ChannelError.ErrorCode.OTHER\n }\n });\n send_message(msg);\n cancel_payments();\n\n // set this to false so websockets don't automatically reopen the channel\n open_channel = false;\n\n set_channel_state(CHANNEL_STATES.SENT_ERROR);\n set_ui_state(UI_STATES.USER_DISCONNECTED);\n }\n}",
"function wrongAnswer() {\n secondsLeft -= 10;\n}",
"_maybeCancelCountdown(lobby) {\n if (!this.lobbyCountdowns.has(lobby.name)) {\n return\n }\n\n const countdown = this.lobbyCountdowns.get(lobby.name)\n countdown.timer.reject(new Error('Countdown cancelled'))\n this.lobbyCountdowns = this.lobbyCountdowns.delete(lobby.name)\n this._publishTo(lobby, {\n type: 'cancelCountdown',\n })\n this._publishListChange('add', Lobbies.toSummaryJson(lobby))\n }",
"function cancel() {\r\n click(getCancel());\r\n waitForElementToDisappear(getCancel());\r\n }",
"function endCondition_outOfTime() {\n outOfTime_count++;\n let headingText = \"Out of Time\";\n let giveDetails = \"The correct answer was:\";\n callModal(headingText, giveDetails);\n }",
"function decrement() {\n\n // Time decreasing (--)\n timer--;\n\n //Display remaining time\n $(\"#timeclock\").html(\"<h2>Time Left: \" + timer + \"</h2>\");\n \n // Surpassing the Time Limit for Questions\n if (timer === 0) {\n //Alert the user that time is up.\n $('#start').html('<h2>You ran out of time! The correct answer is: '+correctoptions[optionIndex]+'</h2>');\n\t\t$(\"#option0, #option1, #option2, #option3\").hide();\n\t\timagedisplay();\n\t endgame();\n\t\tsetTimeout(nextquestion, 5000);\n\t\tunanswered++;\n }\n \t}"
] | [
"0.62495184",
"0.61248153",
"0.60613745",
"0.6051775",
"0.5957667",
"0.579878",
"0.5796032",
"0.5793594",
"0.57708716",
"0.5764484",
"0.5754102",
"0.5734898",
"0.5730226",
"0.57185125",
"0.57181215",
"0.5714681",
"0.57004356",
"0.56908435",
"0.56721675",
"0.56693536",
"0.56413734",
"0.5628383",
"0.5627233",
"0.56015784",
"0.5597637",
"0.55956554",
"0.5570816",
"0.554943",
"0.5548131",
"0.55253804"
] | 0.8139517 | 0 |
adds a user's standup report to the standup data for a channel | function addStandupData(standupReport) {
controller.storage.teams.get('standupData', function(err, standupData) {
if (!standupData) {
standupData = {};
standupData.id = 'standupData';
}
if (!standupData[standupReport.channel]) {
standupData[standupReport.channel] = {};
}
standupData[standupReport.channel][standupReport.user] = standupReport;
controller.storage.teams.save(standupData);
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function doStandup(bot, user, channel) {\n\n var userName = null;\n\n getUserName(bot, user, function(err, name) {\n if (!err && name) {\n userName = name;\n\n bot.startPrivateConversation({\n user: user\n }, function(err, convo) {\n if (!err && convo) {\n var standupReport = \n {\n channel: channel,\n user: user,\n userName: userName,\n datetime: getCurrentOttawaDateTimeString(),\n yesterdayQuestion: null,\n todayQuestion: null,\n obstacleQuestion: null\n };\n\n convo.ask('What did you work on yesterday?', function(response, convo) {\n standupReport.yesterdayQuestion = response.text;\n \n convo.ask('What are you working on today?', function(response, convo) {\n standupReport.todayQuestion = response.text;\n \n convo.ask('Any obstacles?', function(response, convo) {\n standupReport.obstacleQuestion = response.text;\n \n convo.next();\n });\n convo.say('Thanks for doing your daily standup, ' + userName + \"!\");\n \n convo.next();\n });\n \n convo.next();\n });\n \n convo.on('end', function() {\n // eventually this is where the standupReport should be stored\n bot.say({\n channel: standupReport.channel,\n text: \"*\" + standupReport.userName + \"* did their standup at \" + standupReport.datetime,\n //text: displaySingleReport(bot, standupReport),\n mrkdwn: true\n });\n\n addStandupData(standupReport);\n });\n }\n });\n }\n });\n}",
"function postTeamStandUpsToChannel() {\n today = moment().format(\"YYYY-MM-DD\");\n let todayFormatted = moment(today, \"YYYY-MM-DD\").format(\"MMM Do YYYY\");\n let standupUpdate = `*📅 Showing Ona Team Standup Updates On ${todayFormatted}*\\n\\n`;\n repos.userStandupRepo.getByDatePosted(today)\n .then(data => {\n let attachments = [];\n data.forEach((item, index) => {\n let attachment = formatTeamsMessageAttachment(item, index, data);\n attachments.push(attachment);\n });\n return Promise.resolve(attachments);\n })\n .then(allAttachments => {\n if (allAttachments.length > 0) {\n postMessageToChannel(standupUpdate, allAttachments);\n } else {\n standupUpdate = `*📅 Nothing to show. No team standup updates for ${todayFormatted}*`;\n postMessageToChannel(standupUpdate, [])\n }\n });\n}",
"function setStandupTime(channel, standupTimeToSet) {\n \n controller.storage.teams.get('standupTimes', function(err, standupTimes) {\n\n if (!standupTimes) {\n standupTimes = {};\n standupTimes.id = 'standupTimes';\n }\n\n standupTimes[channel] = standupTimeToSet;\n controller.storage.teams.save(standupTimes);\n });\n}",
"function saveStandUp(standUpDetails) {\n repos.userStandupRepo.add(standUpDetails);\n}",
"postTeamStandupsToChannel() {\n let todayFormatted = moment(today, \"YYYY-MM-DD\").format(\"MMM Do YYYY\")\n let standupUpdate = `*📅 Showing Ona Standup Updates On ${todayFormatted}*\\n\\n`;\n AppBootstrap.userStandupRepo\n .getByDatePosted(today)\n .then(data => {\n let attachments = [];\n\n data.forEach((item, index) => {\n let attachment = {\n color: \"#dfdfdf\",\n title: `<@${item.username}>`,\n fallback:\n \"Sorry Could not display standups in this type of device. Check in desktop browser\",\n fields: [\n {\n title: \"Today\",\n value: `${item.standup_today}`,\n short: false\n }\n ],\n footer: `Posted as ${item.team}`\n };\n if (item.standup_previous != null) {\n const previously = {\n title: \"Yesterday/Previously\",\n value: `${\n item.standup_previous == null\n ? \"Not specified\"\n : item.standup_previous\n }`,\n short: false\n };\n attachment.fields.push(previously);\n }\n if (index === 0) {\n attachment.pretext = `Team ${item.team} Standups`;\n attachment.color = \"#7DCC34\";\n }\n if (index > 0) {\n if (item.team != data[index - 1].team) {\n attachment.pretext = `Team ${item.team} Standups`;\n attachment.color = \"#7DCC34\";\n }\n }\n attachments.push(attachment);\n });\n return Promise.resolve(attachments);\n })\n .then(allAttachments => {\n if (allAttachments.length > 0) {\n web.channels.list().then(res => {\n const channel = res.channels.find(c => c.is_member);\n if (channel) {\n web.chat\n .postMessage({\n text: standupUpdate,\n attachments: allAttachments,\n channel: channel.id\n })\n .then(msg =>\n console.log(\n `Message sent to channel ${channel.name} with ts:${msg.ts}`\n )\n )\n .catch(console.error);\n } else {\n console.log(\n \"This bot does not belong to any channel, invite it to at least one and try again\"\n );\n }\n });\n } else {\n web.channels.list().then(res => {\n let todayFormatted = moment(today, \"YYYY-MM-DD\").format(\"MMM Do YYYY\")\n const channel = res.channels.find(c => c.is_member);\n if (channel) {\n web.chat\n .postMessage({\n text: `*📅 Nothing to show. No standup updates for ${todayFormatted}*`,\n channel: channel.id\n })\n .then(msg =>\n console.log(\n `Message sent to channel ${channel.name} with ts:${msg.ts}`\n )\n )\n .catch(console.error);\n } else {\n console.log(\n \"This bot does not belong to any channel, invite it to at least one and try again\"\n );\n }\n });\n }\n });\n }",
"function getSingleReportDisplay(standupReport) {\n var report = \"*\" + standupReport.userName + \"* did their standup at \" + standupReport.datetime + \"\\n\";\n report += \"_What did you work on yesterday:_ `\" + standupReport.yesterdayQuestion + \"`\\n\";\n report += \"_What are you working on today:_ `\" + standupReport.todayQuestion + \"`\\n\";\n report += \"_Any obstacles:_ `\" + standupReport.obstacleQuestion + \"`\\n\\n\";\n return report;\n}",
"saveStandup(standupDetails) {\n AppBootstrap.userStandupRepo.add(standupDetails);\n }",
"function displayUserReport(data) {\n $('body').append(\n \t'<p>' + 'Report: ' + data.report + '</p>');\n}",
"function startNewUserWorkout(app, workout_type, completed) {\n console.log(\"Tracking new user activity\");\n let trackUpdateRef = db.ref(\"last_activity/\" + USER);\n trackUpdateRef.set({\n \"last_done\" : {\n \"workout_type\": workout_type,\n \"completed\": completed,\n }\n });\n }",
"function addReports(data) {\n console.log(` Adding: ${data.itemID} (${data.reporter})`);\n Reports.insert(data);\n}",
"addToacceptedTimes() { this.acceptedStatsDB( {dbId:this.dbId, date:new Date().getTime()} ); }",
"function streamPush() {\n // $('#streamstatus').html(user.streamdesc);\n $('#viewers').html(user.viewers);\n if (user.islive === 'true') {\n $('#useronline').removeClass('label-danger');\n $('#useronline').addClass('label-success');\n $('#useronline').html('ONLINE');\n $('#useronline').css('opacity','.70');\n $('.videoinfo').html(user.streamdesc);\n\n } else {\n\n $('#useronline').addClass('label-danger');\n $('#useronline').removeClass('label-success');\n $('#useronline').html('OFFLINE');\n $('#useronline').css('opacity','1.0');\n // $('.videoinfo').html(user.streamdesc);\n }\n }",
"execute(message, args) { // omit args argument if not using args\n\n let userID = message.author.id;\n console.log(userID);\n if (!(\"\" + userID in users) ) users[userID] = {};\n \n if (!(\"notifications\" in users[userID]) ) users[userID][\"notifications\"] = [];\n let notifObj = {\n stock: args[0],\n percent_threshold: args[1],\n days: args.slice(2)\n };\n console.log(notifObj);\n users[userID].notifications.push(notifObj)\n fs.writeFile(path.join(__dirname, \"..\", \"db\", \"users.json\"), JSON.stringify(users, null, '\\t'), (err)=>{\n if (err) return message.channel.send(\"There was an error setting your notification.\")\n message.channel.send(\"Notification set successfully!\")\n });\n\n\t}",
"function clearStandupData(channel) {\n controller.storage.teams.get('standupData', function(err, standupData) {\n if (!standupData || !standupData[channel]) {\n return;\n } else {\n delete standupData[channel];\n controller.storage.teams.save(standupData);\n }\n });\n}",
"function getReportDisplay(standupReports) {\n \n if (!standupReports) {\n return \"*There is no standup data to report.*\";\n }\n\n var totalReport = \"*Standup Report*\\n\\n\";\n for (var user in standupReports) {\n var report = standupReports[user];\n totalReport += getSingleReportDisplay(report);\n }\n return totalReport;\n}",
"function hasStandup(who, cb) {\n \n var user = who.user;\n var channel = who.channel;\n controller.storage.teams.get('standupData', function(err, standupData) {\n if (!standupData || !standupData[channel] || !standupData[channel][user]) {\n cb(null, false);\n } else {\n cb(null, true);\n }\n });\n}",
"function checkTimesAndReport(bot) {\n getStandupTimes(function(err, standupTimes) { \n if (!standupTimes) {\n return;\n }\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n for (var channelId in standupTimes) {\n var standupTime = standupTimes[channelId];\n if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) {\n getStandupData(channelId, function(err, standupReports) {\n bot.say({\n channel: channelId,\n text: getReportDisplay(standupReports),\n mrkdwn: true\n });\n clearStandupData(channelId);\n });\n }\n }\n });\n}",
"function emitShipPowerUpUpdates(){\n var vessels = ships.shipGet();\n var out = {};\n\n // Only add to the output json that has changed since last send\n for (var id in vessels){\n var list = vessels[id].powerUps.active.join(' ');\n if (lastPowerUpData[id] != list) {\n lastShieldData[id] = list;\n out[id] = {\n status: 'powerup',\n addClasses: list,\n removeClasses: vessels[id].powerUps.inactive.join(' ')\n };\n }\n }\n\n // Only *if* there's useful data to be sent, send that data to all clients\n if (Object.keys(out).length) {\n io.sockets.emit('shipstat', out);\n }\n}",
"function writeUserData(displayName,message) {\n var today = new Date()\n var year = today.getFullYear().toString()\n var month = monthName[(today.getMonth()+1)]\n var date = today.getDate().toString()\n var datoString = date + \" \" + month + \" \" + year;\n var hour = today.getHours()\n var minute = today.getMinutes()\n if(hour < 10) {\n hour = \"0\" + hour\n }\n if(minute < 10) {\n minute = \"0\" + minute\n }\n if(displayName == null) {\n displayName = \"Anonym\"\n }\n var newPostRef = meldinger.push();\n newPostRef.set({\n msg: message,\n datestamp: datoString,\n showTime: hour.toString() + \":\" + minute.toString(),\n name: displayName\n });\n}",
"function attachNewUserToIncident() {\n attachNewUser = true;\n $(\"#user_add_username\").val($(\"#user_name\").val());\n openAddUser();\n }",
"function addAskingTime(user, channel, timeToSet) {\n controller.storage.teams.get('askingtimes', function(err, askingTimes) {\n\n if (!askingTimes) {\n askingTimes = {};\n askingTimes.id = 'askingtimes';\n }\n\n if (!askingTimes[channel]) {\n askingTimes[channel] = {};\n }\n\n askingTimes[channel][user] = timeToSet;\n controller.storage.teams.save(askingTimes);\n });\n}",
"function addNewReport(userName, storeId, description, callable) {\n console.log(\"(model/store.js) Started addNewReport()\");\n store.update({_id: storeId}, {$push: {\"Reports\": {UserID: userName, Description: description}}}, function (err) {\n if (err) {\n console.log(err);\n }\n else {\n callable.call(this, err);\n }\n });\n}",
"function user_update_lobby(user) {\n // Agent logs in or updates\n agent.add(user);\n update_interface();\n }",
"function upUser(user){\n if (user.point > 10){\n // long upgrade logic..\n }\n}",
"function getAndDisplayUserReport() {\n getUserInfo(displayUserReport);\n}",
"function appendUsers() {\n queryRequest(uniqueProjectUsers);\n usersWithNumberOfIssues.length = 0;\n uniqueProjectUsers.forEach(function (user) {\n var numberOfIssues = 0;\n issuesOfProject.forEach(function (issue) {\n if (issue.assignee == user) {\n numberOfIssues++;\n }\n })\n if (user == 'Unassigned') {\n usersWithNumberOfIssues.push({\n user: user,\n numberOfIssues: numberOfIssues,\n color: 'color: #1678CC'\n })\n } else {\n usersWithNumberOfIssues.push({\n user: user,\n numberOfIssues: numberOfIssues\n })\n }\n })\n buildPieChart();\n}",
"function updateDashboard() {\n request\n .get(\"https://dsrealtimefeed.herokuapp.com/\")\n .end(function(res) {\n console.log(\"Pinged Dashboard, \" + res.status)\n if(res.status != 200) {\n stathat.trackEZCount(config.STATHAT, 'dsrealtime-feed-cant_ping', 1, function(status, response){});\n }\n });\n}",
"function report(user) {\n if (user) {\n $.post(\"/reportUser\", {sender: username, receiver: user, chatroom: chatroomId}, function (data) {}, \"json\");\n }\n}",
"function saveStandup(room, time, utc) {\n var standups = getStandups();\n\n var newStandup = {\n time: time,\n room: room,\n utc: utc\n };\n\n standups.push(newStandup);\n updateBrain(standups);\n }",
"function updateCalendarSignup(signup) {\n \n var event = groupMealCalendar.getEventById(signup.eventID);\n \n if (event.getColor() !== \"4\")\n event.setColor(\"4\"); // Set event color to pale red\n \n var description = 'Estimated people: ' + signup.peopToFeed + \n '\\nGraciously Provided By: ' + signup.name + \n '\\nContact Info: ' + signup.email + ', ' + signup.phone + \n '\\nAffiliation: ' + signup.student +\n '\\nPlanned Food: ' + signup.foodDescrip + \n '\\nAllergen Alerts: ' + signup.allergy + \n '\\n\\n' + signup.details;\n \n // Set calendar description\n if (event.getDescription() !== description)\n event.setDescription(description);\n \n}"
] | [
"0.6443461",
"0.592248",
"0.59018815",
"0.58021027",
"0.57642514",
"0.5632085",
"0.5553548",
"0.5301624",
"0.516726",
"0.51363057",
"0.5127875",
"0.5127709",
"0.5107881",
"0.51040447",
"0.50867414",
"0.50698984",
"0.5049063",
"0.504188",
"0.50250804",
"0.5000019",
"0.49985132",
"0.49903136",
"0.4987935",
"0.49846178",
"0.49741217",
"0.49724045",
"0.49674425",
"0.49509475",
"0.49315158",
"0.48898286"
] | 0.74245036 | 0 |
gets all standup data for a channel | function getStandupData(channel, cb) {
controller.storage.teams.get('standupData', function(err, standupData) {
if (!standupData || !standupData[channel]) {
cb(null, null);
} else {
cb(null, standupData[channel]);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getLobbyData(){}",
"function clearStandupData(channel) {\n controller.storage.teams.get('standupData', function(err, standupData) {\n if (!standupData || !standupData[channel]) {\n return;\n } else {\n delete standupData[channel];\n controller.storage.teams.save(standupData);\n }\n });\n}",
"function readChannelsList() {\n // DEFINE LOCAL VARIABLES\n\n // NOTIFY PROGRESS\n console.log('reading channels');\n\n // HIT METHOD\n asdb.read.channelsList().then(function success(s) {\n console.log('Channels collection:');\n \n var i = 1;\n Object.keys(s).forEach(function(key) {\n console.log(i + \". \" + s[key].title + \" (\" + key + \")\");\n i++;\n });\n\n }).catch(function error(e) {\n\t\tconsole.log(\"error\", e);\n\t});\n\n}",
"function fetchChannels() {\n const top = async (total) => {\n const pages = Math.ceil(total / 100);\n results = [];\n channels = [];\n\n const args = \" -H 'query: username' -H 'history: default' -H 'clientid: \" + 'cli_f0d30ff74a331ee97e486558' +\n \"' -H 'token: \" + '7574a0b5ff5394fd628727f9d6d1da723a66736f3461930c79f4080073e09e349f5e8e366db4500f30c82335aa832b64b7023e0d8a6c7176c7fe9a3909fa43b7' +\n \"' -X GET https://matrix.sbapis.com/b/youtube/statistics\";\n\n for (let index = 0; index < pages; index++) {\n results.push(await client.youtube.top('subscribers', index + 1));\n }\n\n for (let page_index = 0; page_index < results.length; page_index++) {\n for (let index = 0; index < results[page_index].length; index++) {\n channel = results[page_index][index];\n channel['grade'] = \"N/A\";\n// channel_args = args;\n// exec('curl ' + channel_args.replace(\"username\",channel['id']['username']), function (error, stdout, stderr) {\n// console.log('stdout: ' + stdout)\n// if (stdout != null && stdout['data'] != undefined && stdout['data']['misc'] != undefined\n// && stdout['data']['misc']['grade'] != undefined && stdout['data']['misc']['grade']['grade'] != undefined) {\n// channel['grade'] = stdout['data']['misc']['grade']['grade'];\n// } else {\n// channel['grade'] = '';\n// }\n// console.log('stderr: ' + stderr);\n// if (error !== null) {\n// console.log('exec error: ' + error);\n// }\n// });\n channels.push(channel);\n }\n }\n\n var file = fs.createWriteStream('output.csv');\n file.write(\"id, username, display_name, created_at, channel_type, country, uploads, subscribers, views\" + \"\\n\");\n file.on('error', function(err) { /* error handling */ });\n channels.forEach(function(channel) {\n file.write(channel['id']['id'] + \", \" + channel['id']['username'] + \", \" + channel['id']['display_name'] + \", \"\n + channel['general']['created_at'] + \", \" + channel['general']['channel_type'] + \", \" + channel['general']['geo']['country'] + \", \"\n + channel['statistics']['total']['uploads'] + \", \" + channel['statistics']['total']['subscribers'] + \", \" + channel['statistics']['total']['views'] + \"\\n\");\n });\n\n file.end();\n\n return results;\n};\n\n top(500).then(\"done\").catch(console.error);\n}",
"function getAllChannelDataTS(){\n getDataField1();\n getDataField2();\n getDataField3();\n getDataField4();\n getDataField5();\n getDataField6();\n getDataField7();\n getDataField8();\n }",
"function populateInit() {\n for (var i = 0; i < channels.length; i++) {\n channel = channels[i];\n channelurl = baseUrl + \"/channels/\" + channel;\n $.ajax({\n \"url\": channelurl,\n dataType: \"jsonp\",\n success: populateDOM,\n error: errorChannel,\n });\n }\n }",
"function getChannel() {\n channels.forEach(function(channel) {\n function makeURL(type, name) {\n return 'https://wind-bow.gomix.me/twitch-api/' + type + '/' + name + '?callback=?';\n };\n $.getJSON(makeURL(\"channels\", channel), function(data) {\n $(\"#\" + channel).attr('src',data.logo)\n $(\".\" + channel).html(channel)\n $(\"#\" + channel + '1').attr('href', data.url)\n $(\".game\" + channel).html('GAME:' + '<br>' + data.game)\n $(\".status\" + channel).html('STATUS:' + '<br>' + data.status)\n });\n $.getJSON(makeURL(\"streams\",channel), function(data) {\n console.log(data);\n var str1 = 'This user is currently not streaming.';\n if (data.stream === null) {\n $(\".\" + channel).addClass(\"offline\")\n $(\".game\" + channel).html(str1)\n $('.game' + channel).show();\n } else {\n $(\".\" + channel).addClass(\"online\")\n $(\".game\" + channel).removeClass('hidden')\n $(\".status\" + channel).removeClass('hidden')\n }\n });\n });\n}",
"async function fetchStreamData() {\n await getStreamCommits(streamId, 1, null, token).then(str => {\n stream = str.data.stream\n\n // Split the branches into \"main\" and everything else\n mainBranch = stream.branches.items.find(b => b.name == \"main\")\n beams = stream.branches.items.filter(b => b.name.startsWith(\"beam\"))\n columns = stream.branches.items.filter(b => b.name.startsWith(\"column\"))\n console.log(\"main branch\", mainBranch)\n console.log(\"beam options\", beams)\n console.log(\"column options\", columns)\n })\n}",
"function display_channels(){\n //clear the local storage current channel\n localStorage.setItem('channel', null);\n localStorage.setItem('id', null);\n //clear the current channel's list of users\n document.querySelector('.users').innerHTML = '';\n //get channels from the server\n const request = new XMLHttpRequest();\n request.open('GET', '/channels');\n request.onload = ()=>{\n const data = JSON.parse(request.responseText);\n if (data.length === 0) {\n var empty = false;\n channels(empty);\n } else {\n channels(data);\n }\n };\n data = new FormData;\n request.send(data)\n }",
"function setupChannel() {\n\n // Join the control channel\n controlChannel.join().then(function(channel) {\n print('Joined controlchannel as '\n + '<span class=\"me\">' + username + '</span>.', true);\n });\n\n // Listen for new messages sent to the channel\n controlChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n console.log('lenis')\n test();\n //printcontrol()\n if (message.body.search(\"@anon\")>=0)\n {\n $.get( \"alch/\"+message.body, function( data ) {\n\n console.log(data);\n });\n }\n else if (message.body.search(\"@time\")>=0)\n {\n\n test();\n // var date=new Date().toLocaleString();\n // controlChannel.sendMessage(date);\n\n }\n else if (message.body.search(\"@junk\")>=0)\n {\n console.log(\"penis\");\n// test();\n }\n\n\n });\n }",
"prepareDataChannel(channel) {\n channel.onopen = () => {\n log('WebRTC DataChannel opened!');\n snowflake.ui.setActive(true);\n // This is the point when the WebRTC datachannel is done, so the next step\n // is to establish websocket to the server.\n return this.connectRelay();\n };\n channel.onclose = () => {\n log('WebRTC DataChannel closed.');\n snowflake.ui.setStatus('disconnected by webrtc.');\n snowflake.ui.setActive(false);\n this.flush();\n return this.close();\n };\n channel.onerror = function() {\n return log('Data channel error!');\n };\n channel.binaryType = \"arraybuffer\";\n return channel.onmessage = this.onClientToRelayMessage;\n }",
"function getAllData() {\n fillPlayerList();\n}",
"function getChannel(name) {\n\t\t$.ajax({\n\t\t\tdataType: 'json',\n\t\t\theaders: {\n\t\t\t\t'Client-ID': process.env.TWITCH_CLIENT_ID,\n\t\t\t},\n\t\t\turl: `https://api.twitch.tv/kraken/channels/${name}`\n\t\t})\n\t\t.done(json => {\n\t\t\tconst streamData = {\n\t\t\t\tstreamUrl: json.url,\n\t\t\t\tstreamLogo: json.logo || defaultLogo,\n\t\t\t\tstreamName: json.display_name,\n\t\t\t\tstreamInfo: json.status || defaultInfo,\n\t\t\t\tstreamStatus: 'offline'\n\t\t\t};\n\t\t\t$('#featuredDivider').append(streamTemplate(streamData));\n\t\t})\n\t\t.fail(err => {\n\t\t\tconsole.log(err);\n\t\t});\n\t}",
"function loadWelcomeChannels() {\n\tpool.getConnection(function(err, connection) {\n\t\tconnection.query(\"SELECT * FROM wmtoggle\", function(err, results) {\n\t\t\tfor(var i in results) {\n\t\t\t\tif(welcomeServers.hasOwnProperty(\"server\" + results[i].serverID))\n\t\t\t\t\twelcomeServers[\"server\" + results[i].serverID]['channel' + results[i].channelID] = {'jtoggle': results[i].welcomeMessage, 'ltoggle': results[i].leaveMessage};\n\t\t\t\telse {\n\t\t\t\t\twelcomeServers[\"server\" + results[i].serverID] = {};\n\t\t\t\t\twelcomeServers[\"server\" + results[i].serverID]['channel' + results[i].channelID] = {'jtoggle': results[i].welcomeMessage, 'ltoggle': results[i].leaveMessage};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.log(localDateString() + \" | \" + colors.green(\"[LOAD]\") + \" Loaded all the Welcome Channels!\");\n\t\t\tconnection.release();\n\t\t});\n\t});\n}",
"function getData() {\n if(app.connected) {\n // prepare thingspeak URL\n // set up a thingspeak channel and change the write key below\n var key = 'IKYH9WWZLG5TVYF2'\n var urlTS = 'https://api.thingspeak.com/update?api_key=' + key + '&field1=' + app.heartRate;\n // make the AJAX call\n $.ajax({\n url: urlTS,\n type: \"GET\",\n dataType: \"json\",\n success: onDataReceived,\n error: onError\n });\n }\n\t}",
"function getInfo() {\n list.forEach(function(channel) {\n function makeURL(type, name) {\n return 'https://wind-bow.gomix.me/twitch-api/' + type + '/' + name + '?callback=?';\n };\n\n //Get logo, name, and display name from \"users\" URL\n $.getJSON(makeURL(\"users\", channel), function(data) {\n var logo = data.logo;\n var displayName = data.display_name;\n var name = data.name;\n\n //Get status and game from \"streams\" URL\n $.getJSON(makeURL(\"streams\", channel), function(data2) {\n if (data2.stream === null) {\n status = \"OFFLINE\";\n game = \"\";\n }\n\n if (data2.stream) {\n status = \"ONLINE\";\n game = data2.stream.game;\n }\n\n html = '<div class=\"box\"><div><img src=\"' + logo + '\" class=\"logoSize\" alt=\"Logo\"></div><div class=\"nameSize\"><a href=\"' + \"https://go.twitch.tv/\" + name + '\" target=\"_blank\">' + displayName + '</a></div>' + '<a href=\"' + \"https://go.twitch.tv/\" + name + '\" target=\"_blank\"><div class=\"statusSize\">' + status + '</div><div class=\"gameSize\">' + game + '</div></a></div>';\n\n $(\"#display\").prepend(html);\n\n //Add online users to \"onlines\" variable\n if (data2.stream) {\n onlines.push(html);\n }\n\n //Add offline users to \"offlines\" variable\n if (data2.stream === null) {\n offlines.push(html);\n }\n\n $(\"#all\").click(function() {\n $(\"#display\").empty();\n $(\"#display\").prepend(onlines);\n $(\"#display\").prepend(offlines);\n $(\"#offline\").removeClass(\"active\");\n $(\"#online\").removeClass(\"active\");\n $(\"#all\").addClass(\"active\");\n });\n\n $(\"#online\").click(function() {\n $(\"#display\").empty();\n $(\"#display\").prepend(onlines);\n $(\"#offline\").removeClass(\"active\");\n $(\"#all\").removeClass(\"active\");\n $(\"#online\").addClass(\"active\");\n });\n\n $(\"#offline\").click(function() {\n $(\"#display\").empty();\n $(\"#display\").prepend(offlines);\n $(\"#all\").removeClass(\"active\");\n $(\"#online\").removeClass(\"active\");\n $(\"#offline\").addClass(\"active\");\n });\n }); //End second getJSON\n }); //End first getJSON\n }); //End list.forEach(function(channel))\n}",
"function getStandupTime(channel, cb) {\n controller.storage.teams.get('standupTimes', function(err, standupTimes) {\n if (!standupTimes || !standupTimes[channel]) {\n cb(null, null);\n } else {\n cb(null, standupTimes[channel]);\n }\n });\n}",
"async function fetchData() {\n const channels = await getChannels();\n\n const data = {\n title: 'ChatX',\n content: component,\n state: {\n rooms: channels, // preload existing rooms\n messages: [],\n signedIn: req.session.user ? true : false\n }\n };\n\n res.status(200);\n res.render('index', data);\n }",
"async initializeChannel(channel) {\r\n\t\tconst now = new Date().getTime();\r\n const queries = newChannelSql.split(';');\r\n\t\tfor(const i in queries) {\r\n\t\t\tconst query = queries[i];\r\n\t\t\tlet params = {};\r\n\t\t\tif(query.indexOf('$channel') > -1) {\r\n\t\t\t\tparams['$channel'] = channel;\r\n\t\t\t}\r\n\t\t\tif(query.indexOf('$now') > -1) {\r\n\t\t\t\tparams['$now'] = now;\r\n\t\t\t}\r\n\t\t\tawait sql.run(query, params);\r\n\t\t}\r\n\r\n\t\tlet offset = (await sql.get(`SELECT Offset FROM Worlds ORDER BY ID`)).Offset;\r\n\t\tif(!offset) offset = Math.floor(Math.random() * 1000);\r\n\t\tawait sql.run(`UPDATE Worlds SET Offset = $offset WHERE Channel = $channel`, {$offset: offset, $channel: channel});\r\n\r\n\t\treturn await this.getWorld(channel);\r\n\t}",
"function setupChannelApis() {\n var fabricNet=require(__dirname+'/utils/fabric_net_api.js')(fcw,configer,logger);\n\n var channelinfo={\n low:0,\n high:0,\n currentBlockHash:\"\",\n previousBlockHash:\"\"\n };\n\n app.channelinfo=channelinfo;\n //enroll_admin\n fabricNet.enroll_admin(2,function (err,obj) {\n if(err==null) {\n logger.info(\"get genesis block\");\n var g_option = configer.makeEnrollmentOptions(0);\n g_option.chaincode_id=configer.getChaincodeId();\n g_option.chaincode_version=configer.getChaincodeVersion();\n logger.info(g_option.chaincode_id);\n g_option.event_url=configer.getPeerEventUrl(configer.getFirstPeerName(configer.getChannelId()))\n\n fcw.query_channel_info(obj,g_option,function (err,resp) {\n if (err!=null){\n logger.error(\"Error for getting channel info!\");\n }else {\n app.channelinfo.low=resp.height.low;\n app.channelinfo.high=resp.height.high;\n app.channelinfo.currentBlockHash=resp.currentBlockHash;\n app.channelinfo.previousBlockHash=resp.previousBlockHash\n }\n });\n\n var cc_api=require(__dirname+'/utils/creditcheck_cc_api.js')(obj,g_option,fcw,logger);\n cc_api.setupEventHub(app.wss,app.channelinfo);\n app.cc_api=cc_api;\n }else{\n logger.error(\"Error for enroll admin to channel!\");\n }\n });\n}",
"async function getCMCData() {\n //WARNING! This will pull ALL cmc coins and cost you about 11 credits on your api account!\n let cmcJSON = await clientcmc.getTickers({ limit: 4200 }).then().catch(console.error);\n cmcArray = cmcJSON['data'];\n cmcArrayDictParsed = cmcArray;\n cmcArrayDict = {};\n try {\n cmcArray.forEach(function (v) {\n if (!cmcArrayDict[v.symbol])\n cmcArrayDict[v.symbol] = v;\n });\n } catch (err) {\n console.error(chalk.red.bold(\"failed to get cmc dictionary for metadata caching!\"));\n }\n //console.log(chalk.green(chalk.cyan(cmcArray.length) + \" CMC tickers updated!\"));\n}",
"function displayChannels(data) {\n\t\t\t$(`#${userName}`).append(\"<div class='layout col-lg-3 col-md-3 col-sm-12'><div class='user-name'>\" + `${data.display_name}` + \"</div></div>\");\n\t\t\t$(`#${userName} div div`).append(`<a target=\"_blank\" href=\"${data.url}\"><img src=\"${data.logo}\"></img></a>`);\n\t\t\t$.getJSON(urlStreams, displayStatus);\n\t\t}",
"function listChannels(){\n $http.get(baseUrl+\"/mobilegateway/masterdata/channels\")\n .then(function(response) {\n $scope.getChannelType = response.data.channelList;\n });\n }",
"function startChannelStats() {\n stats = setInterval(() => {\n ApiHandle.getStats().then(data => {\n if (data == null) { // They are not live or the channel doesn't exist.\n console.log(\"The user is not live or there was an error getting stats.\")\n } else { // Sets the info from the request next to the icons on the chat page.\n if (data.channel.stream.countViewers !== undefined && data.channel.stream.countViewers !== null) {\n document.getElementById(\"fasUsers\").innerHTML = `<span><i class=\"fas fa-users\"></i></span> ${data.channel.stream.countViewers}`\n }\n if (data.followers.length !== undefined && data.followers.length !== null) {\n document.getElementById(\"fasHeart\").innerHTML = `<span><i class=\"fas fa-heart\"></i></span> ${data.followers.length}`\n }\n if (data.channel.stream.newSubscribers !== undefined && data.channel.stream.newSubscribers !== null) {\n document.getElementById(\"fasStar\").innerHTML = `<span><i class=\"fas fa-star\"></i></span> ${data.channel.stream.newSubscribers}`\n }\n }\n })\n }, 900000);\n}",
"async channels(sender) {\n let channels = await slack.getAllChannels()\n channels = _.orderBy(channels, ['name'], ['asc'])\n const bundle = channels.map((c) => {\n if (c.is_archived || c.is_im || c.is_mpim) {\n return\n }\n let type = 'public'\n if (c.is_private || c.is_group) {\n type = 'private'\n }\n if (c.is_general) {\n type = 'general'\n }\n return `${c.name} | ${c.id} | ${type} | ${c.num_members || 0}`\n })\n bundle.unshift(`Name | ChannelId | Type | Members`)\n await slack.postEphemeral(sender, bundle.join('\\n'))\n }",
"function getDataForAllChannels() {\n channels.forEach(function(channel) {\n // Data from the Channels API\n $.getJSON(\"https://wind-bow.gomix.me/twitch-api/channels/\" + channel + \"?callback=?\", function(data) {\n var status, url, name, logo;\n if (data.error === \"Not Found\") {\n status = false;\n url = '';\n name = '<div class=\"col-md-2\">' + channel + '</div>';\n logo = \"https://dummyimage.com/50x50/ecf0e7/5c5457.jpg&text=0x3F\";\n } else {\n status = true;\n url = '<a href=\"' + data.url + '\" target=\"_blank\">';\n name = '<div class=\"col-md-2\">' + data.name + '</div></a>';\n logo = data.logo;\n };\n // Data from the Streams API\n $.getJSON(\"https://wind-bow.gomix.me/twitch-api/streams/\" + channel + \"?callback=?\", function(streamdata) {\n if (status === false) {\n status = \"Not on twitch\";\n } else if (streamdata.stream === null) {\n status = \"Offline\";\n } else {\n url = '<a href=\"' + streamdata.stream.channel.url + '\" target=\"_blank\">';\n status = '<a href=\"' + streamdata.stream.channel.url + '\">' + streamdata.stream.channel.status + '</a>';\n }\n // Build the page from the pulled data\n var html = '<div class=\"row text-center\" id=\"datarow\">' +\n url + '<div class=\"col-xs-2 col-sm-1\"><img src=\"' +\n logo + '\"></div><div class=\"col-xs-10 col-sm-3\">' +\n name + '</div><div class=\"col-xs-10 col-sm-8\"\">' +\n status + '</div></div>';\n document.getElementById(\"rows\").innerHTML += html;\n });\n });\n });\n}",
"initChannels() {\n this.initFetchAll();\n this.initGenerate();\n this.initSubmit();\n this.initDelete();\n this.initFetchOne();\n this.initUpdate();\n }",
"function channelHandler(agent) {\n console.log('in channel handler');\n var jsonResponse = `{\"ID\":10,\"Listings\":[{\"Title\":\"Catfish Marathon\",\"Date\":\"2018-07-13\",\"Time\":\"11:00:00\"},{\"Title\":\"Videoclips\",\"Date\":\"2018-07-13\",\"Time\":\"12:00:00\"},{\"Title\":\"Pimp my ride\",\"Date\":\"2018-07-13\",\"Time\":\"12:30:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"13:00:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"13:30:00\"},{\"Title\":\"Daria\",\"Date\":\"2018-07-13\",\"Time\":\"13:45:00\"},{\"Title\":\"The Real World\",\"Date\":\"2018-07-13\",\"Time\":\"14:00:00\"},{\"Title\":\"The Osbournes\",\"Date\":\"2018-07-13\",\"Time\":\"15:00:00\"},{\"Title\":\"Teenwolf\",\"Date\":\"2018-07-13\",\"Time\":\"16:00:00\"},{\"Title\":\"MTV Unplugged\",\"Date\":\"2018-07-13\",\"Time\":\"16:30:00\"},{\"Title\":\"Rupauls Drag Race\",\"Date\":\"2018-07-13\",\"Time\":\"17:30:00\"},{\"Title\":\"Ridiculousness\",\"Date\":\"2018-07-13\",\"Time\":\"18:00:00\"},{\"Title\":\"Punk'd\",\"Date\":\"2018-07-13\",\"Time\":\"19:00:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"20:00:00\"},{\"Title\":\"MTV Awards\",\"Date\":\"2018-07-13\",\"Time\":\"20:30:00\"},{\"Title\":\"Beavis & Butthead\",\"Date\":\"2018-07-13\",\"Time\":\"22:00:00\"}],\"Name\":\"MTV\"}`;\n var results = JSON.parse(jsonResponse);\n var listItems = {};\n textResults = getListings(results);\n\n for (var i = 0; i < results['Listings'].length; i++) {\n listItems[`SELECT_${i}`] = {\n title: `${getShowTime(results['Listings'][i]['Time'])} - ${results['Listings'][i]['Title']}`,\n description: `Channel: ${results['Name']}`\n }\n }\n\n if (agent.requestSource === 'hangouts') {\n const cardJSON = getHangoutsCard(results);\n const payload = new Payload(\n 'hangouts',\n cardJSON,\n {rawPayload: true, sendAsMessage: true},\n );\n agent.add(payload);\n } else {\n agent.add(textResults);\n }\n}",
"function setupDataChannel() {\n\t\tcheckDataChannelState();\n\t\tdataChannel.onopen = checkDataChannelState;\n\t\tdataChannel.onclose = checkDataChannelState;\n\t\tdataChannel.onmessage = Reversi.remoteMessage;\n\t}",
"function handleChannel (channel) {\n // Log new messages\n channel.onmessage = function (msg) {\n console.log('Getting data')\n console.log(msg)\n handleMessage(JSON.parse(msg.data), channel)\n waitingOffer = msg.data\n }\n // Other events\n channel.onerror = function (err) { console.log(err) }\n channel.onclose = function () { console.log('Closed!') }\n channel.onopen = function (evt) { console.log('Opened') }\n}"
] | [
"0.6174487",
"0.6143607",
"0.6024814",
"0.6006331",
"0.597928",
"0.5950036",
"0.5829109",
"0.56514424",
"0.56441987",
"0.564225",
"0.5628344",
"0.55985993",
"0.5591854",
"0.5590676",
"0.55876064",
"0.5571876",
"0.5569628",
"0.55689764",
"0.55517554",
"0.55306715",
"0.5503061",
"0.5493065",
"0.5473355",
"0.54645115",
"0.5462683",
"0.5459969",
"0.545293",
"0.5448151",
"0.5418286",
"0.54118264"
] | 0.7028158 | 0 |
clears all standup reports for a channel | function clearStandupData(channel) {
controller.storage.teams.get('standupData', function(err, standupData) {
if (!standupData || !standupData[channel]) {
return;
} else {
delete standupData[channel];
controller.storage.teams.save(standupData);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"clear() {\n\t\treturn this._sendMessage(JSON.stringify({type: \"clearHistory\"}), (resolve, reject) => {\n\t\t\tresolve([channel]);\n\t\t});\n\t}",
"clearAllChannels() {\n this.state.channels.forEach((channel) => {\n if (channel.active) {\n this.context.api.newsItem.removeChannel('publicationchannel', channel)\n }\n })\n\n this.synchronize()\n }",
"destroyAllBugs(){\n this.bugs = this.chort.getBugs()\n this.bugs.clear(true) // not working?!\n //tell chort\n this.chort.setBugs(this.bugs)\n }",
"function\nclearReport(){\nAssert.reporter.setClear();\n}\t//---clearReport",
"clearAll() {\r\n \r\n // reset sample data\r\n this.sampleData = [];\r\n\r\n // reset distribution paramters\r\n this.mu = null;\r\n this.sigma = null;\r\n\r\n // update the plots\r\n this.ecdfChart.updatePlot([], []);\r\n this.histChart.updateChart([])\r\n \r\n }",
"function clearAll(day) {\n\t\t// reset time\n\t\tif (day === \"Saturday\" || day === \"Sunday\") {\n\t\t\t$(\"#time\").text(\"08:00\");\n\t\t} else {\n\t\t\t$(\"#time\").text(\"07:00\");\n\t\t}\n\t\t// reset count\n\t\tfor (let i = 0; i < STATION_NAMES.length; i++) {\n\t\t\t// reset count\n\t\t\t$(\"#\" + STATION_NAMES[i] + \"-count\").text(\"0\");\n\t\t\t// clear customers\n\t\t\twhile ($(\"#\" + STATION_NAMES[i] + \"-wait-area\").children().length > 1) {\n\t\t\t\t$(\"#\" + STATION_NAMES[i] + \"-wait-area\").children().last().remove();\n\t\t\t}\n\t\t\t// clear servers\n\t\t\t$(\"#\" + STATION_NAMES[i] + \"-server-area\").empty();\n\t\t\t// close all stations\n\t\t\t$(\"#\" + STATION_NAMES[i] + \"-title\").addClass(\"closed\");\n\t\t}\n\t}",
"function clearScreen() {\n result.innerHTML = \"\";\n reportInfo.style.display = \"none\";\n }",
"function clearWeek(){\n\n let errorExists = false;\n\n pool.getConnection(function(err, connection){\n\n if(_assertConnectionError(err)){\n return;\n }\n \n const streamersReg = [];\n const streamersWhitelist = [];\n connection.query(\"SELECT * FROM list_of_streamers;\",\n function(error, results, fields){\n\n if(errorExists || _assertError(error, connection)){\n errorExists = true;\n return;\n }\n\n for(let row of results){\n streamersReg.push(sql.raw(row[\"channel_id\"] \n + _REGULAR_SUFFIX));\n streamersWhitelist.push(sql.raw(row[\"channel_id\"] \n + _WHITELIST_SUFFIX));\n }\n\n });\n\n connection.query(\"UPDATE ?, ? SET ?.week=0, ?.week=0;\", \n [streamersReg, streamersWhitelist, \n streamersReg, streamersWhitelist], function(error){\n \n if(errorExists || _assertError(error)){\n errorExists = true;\n return;\n }\n\n });\n\n if(!errorExists){\n connection.release();\n }\n\n });\n\n}",
"function clear() {\n appworks.notifications.clear();\n notifications = [];\n}",
"function clear() {\n\n\t// IF the legacy logs has too many elements, start shifting the first item on each clear.\n\tif (_legacy.length > options.limit) {\n\t\t_legacy.shift()\n\t}\n\n\t_legacy.push(_logs)\n\n\t_logs = []\n\n}",
"function unsubscribeAll() {\r\n\r\n if (socketMessage.session) {\r\n\r\n var confirmDeleteStream = function (response, project) {\r\n if (response.status === 'ok') {\r\n project.subscribed = false;\r\n } else {\r\n Y.log(\"delete \" + response.status + \" for \" + project.title + ' ' + JSON.stringify(response));\r\n }\r\n };\r\n\r\n var i, l;\r\n for (/*var*/i = 0, l = Y.postmile.gpostmile.projects.length; i < l; ++i) {\r\n var project = Y.postmile.gpostmile.projects[i];\r\n if (project.subscribed) {\r\n deleteJson('/stream/' + socketMessage.session + '/project/' + project.id, null, confirmDeleteStream, project);\r\n project.subscribed = false; // presume this works (we'd not do anything differently anyways)\r\n }\r\n }\r\n }\r\n }",
"clearUser(channel) {\n\t\treturn this._sendMessage(JSON.stringify({type: \"clearUser\", displayName: channel}), (resolve, reject) => {\n\t\t\tresolve([channel]);\n\t\t});\n\t}",
"function clearSearch(){\n for(var i=0;i<reporter_path.length;i++){\n reporter_path[i].setMap(null);\n }\n for(var i=0;i<reporter_record.length;i++){\n reporter_record[i].setMap(null);\n }\n reporter_path=[];\n reporter_record=[];\n}",
"function reset() {\n Report.deleteMany({}, function (err, doc) {\n console.log(\"removeeeeeeeeeeeeeeeeeeeeeed\");\n });\n}",
"function Clear()\n{\n\tUnspawnAll();\n\tavailable.Clear();\n\tall.Clear();\n}",
"async clearSlackCredentials () {\n\t\tconst query = {\n\t\t\tteamIds: this.team.id\n\t\t};\n\t\tconst op = {\n\t\t\t$unset: {\n\t\t\t\t[`providerInfo.${this.team.id}.slack`]: true\n\t\t\t}\n\t\t};\n\t\tif (Commander.dryrun) {\n\t\t\tthis.log('\\t\\tWould have cleared all Slack credentials');\n\t\t}\n\t\telse {\n\t\t\tthis.log('\\t\\tClearing all Slack credentials');\n\t\t\tawait this.data.users.updateDirect(query, op);\n\t\t}\n\t\tthis.verbose(query);\n\t\tthis.verbose(op);\n\t}",
"function Clearup() {\n //TO DO:\n EventLogout();\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }",
"function Clearup() {\n //TO DO:\n EventLogout();\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }",
"function Clearup() {\n //TO DO:\n EventLogout();\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }",
"function Clearup() {\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }",
"function sched_clear() {\n\tfor (let name in schedule.list) {\n\t\t// Remove summary sidebar elements.\n\t\tdiv.summary_tbody.removeChild(schedule.list[name].tr);\n\n\t\t// Remove cards.\n\t\tfor (let i in schedule.list[name].cards)\n\t\t\tdiv.deck.removeChild(schedule.list[name].cards[i]);\n\n\t\tdelete schedule.list[name];\n\t}\n}",
"function Clearup() {\n //TO DO:\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }",
"function clearCoverage() {\n coverageData = {};\n disposeDecorators();\n isCoverageApplied = false;\n}",
"function clearMonth(){\n\n let errorExists = false;\n\n pool.getConnection(function(err, connection){\n\n if(_assertConnectionError(err)){\n return;\n }\n \n const streamersReg = [];\n const streamersWhitelist = [];\n connection.query(\"SELECT * FROM list_of_streamers;\",\n function(error, results, fields){\n\n if(errorExists || _assertError(error, connection)){\n errorExists = true;\n return;\n }\n\n for(let row of results){\n streamersReg.push(sql.raw(row[\"channel_id\"] \n + _REGULAR_SUFFIX));\n streamersWhitelist.push(sql.raw(row[\"channel_id\"] \n + _WHITELIST_SUFFIX));\n }\n\n });\n\n connection.query(\"UPDATE ?, ? SET ?.month=0, ?.month=0;\", \n [streamersReg, streamersWhitelist, streamersReg, \n streamersWhitelist], function(error){\n \n if(errorExists || _assertError(error)){\n errorExists = true;\n return;\n }\n\n });\n\n if(!errorExists){\n connection.release();\n }\n\n });\n}",
"clear() {\n this.dialOutputs.forEach(dialOutput => {\n dialOutput.clear()\n })\n }",
"function clearAll() {\n var tableBody = document.getElementById(\"historyTableBody\");\n tableBody.innerHTML = '';\n storageLocal.removeItem('stopWatchData');\n historyData = [];\n cachedData = [];\n stopButtonsUpdate();\n}",
"function clearWorkspace(){\n var len = 0;\n dashWorkspace.content = '';\n if(columns){\n len = columns.length;\n while(len--){\n dashWorkspace.remove(columns[len]);\n }\n }\n if(conditionals){\n len = conditionals.length;\n while(len--){\n dashWorkspace.remove(conditionals[len]);\n }\n }\n screen.render();\n}",
"function clearTests() {\n tests = [];\n}",
"function clearAll() {\n catQueue = new Queue();\n dogQueue = new Queue();\n userQueue = new Queue();\n }",
"function clear() {\n newStats = {\n theyAreReady: false,\n iAmReady: false,\n currentTurn: null,\n firstTurn: null,\n openRows: null,\n history: null,\n future: null,\n iAmRed: null,\n moveStart: null,\n redTime: null,\n bluTime: null,\n winner: null,\n winBy: null,\n theyWantMore: false,\n iWantMore: false,\n };\n Object.assign(stats, newStats);\n }"
] | [
"0.6528912",
"0.6494929",
"0.64406866",
"0.6426045",
"0.62254184",
"0.6205152",
"0.62045234",
"0.6150138",
"0.61259806",
"0.5997079",
"0.5973085",
"0.5954252",
"0.5943247",
"0.591203",
"0.59086585",
"0.5901544",
"0.58659446",
"0.58659446",
"0.58659446",
"0.5856577",
"0.5851668",
"0.58507645",
"0.57735926",
"0.57466334",
"0.57434434",
"0.57023615",
"0.5698813",
"0.5674449",
"0.56618917",
"0.5646667"
] | 0.68249196 | 0 |
intended to be called every minute. checks if there exists a user that has requested to be asked to give a standup report at this time, then asks them | function checkTimesAndAskStandup(bot) {
getAskingTimes(function (err, askMeTimes) {
if (!askMeTimes) {
return;
}
for (var channelId in askMeTimes) {
for (var userId in askMeTimes[channelId]) {
var askMeTime = askMeTimes[channelId][userId];
var currentHoursAndMinutes = getCurrentHoursAndMinutes();
if (compareHoursAndMinutes(currentHoursAndMinutes, askMeTime)) {
hasStandup({user: userId, channel: channelId}, function(err, hasStandup) {
// if the user has not set an 'ask me time' or has already reported a standup, don't ask again
if (hasStandup == null || hasStandup == true) {
var x = "";
} else {
doStandup(bot, userId, channelId);
}
});
}
}
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function promptStandup(promptMessage) {\n usersService.getLateSubmitters().then(lateSubmitters => {\n if (lateSubmitters.length > 0) {\n console.log(\"Behold late submitters members = > \" + lateSubmitters);\n lateSubmitters.forEach(user => {\n sendMessageToUser(user, promptMessage);\n });\n }\n });\n}",
"function checkTimesAndReport(bot) {\n getStandupTimes(function(err, standupTimes) { \n if (!standupTimes) {\n return;\n }\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n for (var channelId in standupTimes) {\n var standupTime = standupTimes[channelId];\n if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) {\n getStandupData(channelId, function(err, standupReports) {\n bot.say({\n channel: channelId,\n text: getReportDisplay(standupReports),\n mrkdwn: true\n });\n clearStandupData(channelId);\n });\n }\n }\n });\n}",
"function dailyCheck(){\n // set later to use local time\n later.date.localTime();\n // this is 8 PM on July 23rd\n var elevenAM = later.parse.recur().every(1).dayOfMonth().on(11).hour();\n var tenAM = later.parse.recur().every(1).dayOfMonth().on(10).hour();\n\n var timer2 = later.setInterval(remindPresentingGroups, elevenAM);\n var timer3 = later.setInterval(otherReminders, tenAM);\n}",
"function getAndDisplayUserReport() {\n getUserInfo(displayUserReport);\n}",
"promptIndividualStandup() {\n let rmUserArr = [];\n this.getUsers().then(res => {\n res.forEach(res => {\n rmUserArr.push(res.username);\n });\n });\n this.getChannelMembers().then(res => {\n let allChannelUsers = res.members;\n allChannelUsers = allChannelUsers.filter(\n item => !rmUserArr.includes(item)\n );\n\n allChannelUsers.forEach(user => {\n this.sendMessageToUser(user, pickRandomPromptMsg());\n });\n });\n }",
"function checkNewUsers(){\n fetch(\"/userUpdate\", {method: \"post\"})\n .then(res => res.json())\n .then(response => {updateUsersList(response)})\n .catch((err) => {\n if(err.message === \"Unexpected end of JSON input\") //user disconnected\n stopIntervalAndReturn()\n else\n console.log(err.message)\n })\n }",
"function pii_check_if_stats_server_up() {\n var stats_server_url = \"http://woodland.gtnoise.net:5005/\"\n\ttry {\n\t var wr = {};\n\t wr.guid = (sign_in_status == 'signed-in') ? pii_vault.guid : '';\n\t wr.version = pii_vault.config.current_version;\n\t wr.deviceid = (sign_in_status == 'signed-in') ? pii_vault.config.deviceid : 'Not-reported';\n\n\t var r = request({\n\t\t url: stats_server_url,\n\t\t content: JSON.stringify(wr),\n\t\t onComplete: function(response) {\n\t\t\tif (response.status == 200) {\n\t\t\t var data = response.text;\n\t\t\t var is_up = false;\n\t\t\t var stats_message = /Hey ((?:[0-9]{1,3}\\.){3}[0-9]{1,3}), Appu Stats Server is UP!/;\n\t\t\t is_up = (stats_message.exec(data) != null);\n\t\t\t my_log(\"Appu stats server, is_up? : \"+ is_up, new Error);\n\t\t\t}\n\t\t\telse {\n\t\t\t //This means that HTTP response is other than 200 or OK\n\t\t\t my_log(\"Appu: Could not check if server is up: \" + stats_server_url\n\t\t\t\t\t+ \", status: \" + response.status.toString(), new Error);\n\t\t\t print_appu_error(\"Appu Error: Seems like server was down. \" +\n\t\t\t\t\t \"Status: \" + response.status.toString() + \" \"\n\t\t\t\t\t + (new Date()));\n\t\t\t}\n\t\t }\n\t\t});\n\n\t r.post();\n\t}\n\tcatch (e) {\n\t my_log(\"Error while checking if stats server is up\", new Error);\n\t}\n last_server_contact = new Date();\n}",
"checkForUserEmail(results) {\n // check if user email is in dbs\n // TO DO function calls based on what emerges\n apiCalls.checkUserByEmail(results.email).then(results => {\n if (results.data.data === \"new user\") {\n console.log(\"build new user\");\n } else {\n console.log(\"update old user\");\n }\n });\n }",
"checkUser(user, onTakePill, onNotify){\n console.log('checking user', user);\n \n let handler = (err, res) => { \n console.log('checked user with res', res);\n let d = moment(res.d);\n \n if(that.checkIfShouldTakePill(user, d)){\n onTakePill(user);\n\n if(that.checkIfShouldNotify(user)){\n console.log('notifying');\n onNotify(user)\n }\n }\n \n };\n this.db.getLastTakenDate(user.id, handler)\n }",
"function doStandup(bot, user, channel) {\n\n var userName = null;\n\n getUserName(bot, user, function(err, name) {\n if (!err && name) {\n userName = name;\n\n bot.startPrivateConversation({\n user: user\n }, function(err, convo) {\n if (!err && convo) {\n var standupReport = \n {\n channel: channel,\n user: user,\n userName: userName,\n datetime: getCurrentOttawaDateTimeString(),\n yesterdayQuestion: null,\n todayQuestion: null,\n obstacleQuestion: null\n };\n\n convo.ask('What did you work on yesterday?', function(response, convo) {\n standupReport.yesterdayQuestion = response.text;\n \n convo.ask('What are you working on today?', function(response, convo) {\n standupReport.todayQuestion = response.text;\n \n convo.ask('Any obstacles?', function(response, convo) {\n standupReport.obstacleQuestion = response.text;\n \n convo.next();\n });\n convo.say('Thanks for doing your daily standup, ' + userName + \"!\");\n \n convo.next();\n });\n \n convo.next();\n });\n \n convo.on('end', function() {\n // eventually this is where the standupReport should be stored\n bot.say({\n channel: standupReport.channel,\n text: \"*\" + standupReport.userName + \"* did their standup at \" + standupReport.datetime,\n //text: displaySingleReport(bot, standupReport),\n mrkdwn: true\n });\n\n addStandupData(standupReport);\n });\n }\n });\n }\n });\n}",
"function pollUsers(client, storage) {\n const currentTime = DateTime.local();\n\n for (const [user, id] of storage.users) {\n if (user.unbanDate !== '0' && DateTime.fromISO(user.unbanDate) < currentTime) {\n // Unban user\n restrictUser(client, storage.channelId, id, false);\n user.unbanDate = '0';\n }\n }\n}",
"function check_and_report() {\n \n }",
"notifyBeforePostingStandup() {\n let rmUserArr = [];\n this.getUsers().then(res => {\n if (res.length > 0) {\n res.forEach(res => {\n rmUserArr.push(res.username);\n });\n console.log(\"Unsubscribed users = \" + rmUserArr)\n }\n });\n this.getLateSubmitters().then(res => {\n let lateSubmitters\n if (res.length > 0) {\n lateSubmitters = res\n console.log(\"Late submitters before filter = \" + lateSubmitters)\n lateSubmitters = lateSubmitters.filter(\n item => !rmUserArr.includes(item)\n );\n console.log(\"Late submitters after filter = \" + lateSubmitters)\n if (lateSubmitters.length > 0) {\n res.forEach(user => {\n this.sendMessageToUser(user, pickRandomReminderMsg());\n });\n }\n }\n\n });\n }",
"function _verify_account_with_offline(){\n try{\n var db = Titanium.Database.open(self.get_db_name());\n var my_table_name = \"my_manager_user\";\n var rows = db.execute('SELECT type,name FROM sqlite_master WHERE type=? AND name=? LIMIT 1', 'table', my_table_name);\n var manager_row_count = rows.getRowCount();\n rows.close();\n db.close(); \n if(manager_row_count > 0){ \n db = Titanium.Database.open(self.get_db_name());\n rows = db.execute('SELECT * FROM my_manager_user WHERE username=? and password=? and status_code=1',(_user_name).toLowerCase(),_sha1_password);\n var rows_count = rows.getRowCount();\n if(rows_count > 0){\n self.update_message('Loading My Calendar ...');\n Ti.App.Properties.setString('current_login_user_id',rows.fieldByName('id'));\n Ti.App.Properties.setString('current_login_user_name',rows.fieldByName('display_name'));\n Ti.App.Properties.setString('current_company_id',rows.fieldByName('company_id'));\n Ti.App.Properties.setString('location_service_time','0');\n Ti.App.Properties.setBool('location_service_time_start',false);\n _user_id = rows.fieldByName('id');\n _company_id = rows.fieldByName('company_id');\n rows.close();\n \n //set properties: active_material_location\n rows = db.execute('SELECT * FROM my_company WHERE id=?',_company_id);\n if(rows.isValidRow()){\n Ti.App.Properties.setString('current_company_active_material_location',rows.fieldByName('active_material_location')); \n }\n rows.close(); \n\n rows = db.execute('SELECT * FROM my_login_info where id=1');\n if((rows.getRowCount() > 0) && (rows.isValidRow())){\n db.execute('UPDATE my_login_info SET name=?,value=? WHERE id=1','username',_user_name);\n }else{\n db.execute('INSERT INTO my_login_info (id,name,value)VALUES(?,?,?)',1,'username',_user_name);\n }\n rows.close();\n\n //SAVE LOGIN USER STATUS,SET STATUS IS 1,THEN IF CRASH OR SOMETHING ,CAN LOGIN AUTO\n db.execute('UPDATE my_manager_user SET local_login_status=1 WHERE id=?',_user_id);\n db.close();\n if(Ti.Network.online){\n _download_my_jobs(_first_login);\n }else{\n self.hide_indicator();\n if(_first_login){\n if(_tab_group_obj == undefined || _tab_group_obj == null){ \n }else{\n //_tab_group_obj.open();\n }\n }\n win.close({\n transition:Titanium.UI.iPhone.AnimationStyle.CURL_UP\n });\n }\n }else{ \n rows.close();\n db.close();\n self.hide_indicator();\n self.show_message(L('message_login_failure'));\n return;\n } \n }else{\n self.hide_indicator();\n self.show_message(L('message_login_failure'));\n return; \n } \n }catch(err){\n self.process_simple_error_message(err,window_source+' - _verify_account_with_offline');\n return;\n } \n }",
"function checkUserState() {\n var user = firebaseData.getUser();\n if (user) {\n // logged in - hide this\n document.getElementById('not_logged_in').style.display = 'none';\n document.getElementById('submit_access_reminder').style.display = 'none';\n document.getElementById('not_reader').style.display = null;\n document.getElementById('login_explanation').style.display = null;\n firebaseData.getUserData(user,\n function(firebaseUserData) {\n // got the data\n if (firebaseData.isUserReader(firebaseUserData)) {\n // we are a reader\n document.getElementById('not_reader').style.display = 'none';\n document.getElementById('login_explanation').style.display = 'none';\n }\n else {\n // not a reader\n document.getElementById('not_reader').style.display = null;\n populateRegistrationForm(firebaseUserData);\n }\n if (firebaseUserData['isRequestPending']) {\n // let them send their reminder as the request is pending\n document.getElementById('submit_access_reminder').style.display = null;\n }\n }),\n function(error) {\n // failed\n console.log('failed to get the user data to see if a reader', error);\n document.getElementById('not_reader').style.display = null;\n }\n }\n else {\n // not logged in, show this\n document.getElementById('not_logged_in').style.display = null;\n document.getElementById('not_reader').style.display = 'none';\n document.getElementById('submit_access_reminder').style.display = 'none';\n }\n}",
"function logUserScheduleCreateDetails() {\n if (createScheduleReq.readyState == 4) {\n\n var dbData = JSON.parse(showErrorCreate(userManagementProfileReq.responseText, \"Error Found\"));\n var userDetails = dbData['queryresult'];\n\n\n var userProfileData = JSON.parse(showErrorCreate(userProfilereq.responseText, \"Error Found\"));\n var userProfile = userProfileData['UserInfo'];\n\n if ((Object.entries(dbData).length != 0) && (Object.entries(userProfileData).length != 0)) {\n var newScheduleName = document.getElementById(\"newScheduleName\").value;\n\n\n var radioOnce = document.getElementById(\"radioOnce\");\n var radioDaily = document.getElementById(\"radioDaily\");\n var radioWeekly = document.getElementById(\"radioWeekly\");\n var radioEnable = document.getElementById(\"radioEnable\");\n var radioDisable = document.getElementById(\"radioDisable\");\n\n var newScheduleName = document.getElementById(\"newScheduleName\").value;\n\n\n\n // frequency\n if (radioOnce.checked == true) {\n var newScheduleFrequency = radioOnce.value;\n } else if (radioDaily.checked == true) {\n\n var newScheduleFrequency = radioDaily.value;\n } else if (radioWeekly.checked == true) {\n\n var newScheduleFrequency = radioWeekly.value;\n }\n\n if (radioEnable.checked == true) {\n var newScheduleEnabled = radioEnable.value;\n } else if (radioDisable.checked == true) {\n var newScheduleEnabled = radioDisable.value;\n }\n\n\n var newScheduleStartDate = document.getElementById(\"nStartDate\").value;\n var newScheduleStartTime = document.getElementById(\"StartTime\").value;\n var newScheduleEndDate = document.getElementById(\"EndDate\").value;\n var newScheduleEndTime = document.getElementById(\"EndTime\").value;\n\n var newStartDateTime = newScheduleStartDate + \" \" + newScheduleStartTime;\n var newEndDateTime = newScheduleEndDate + \" \" + newScheduleEndTime;\n\n loadActiveSchedules();\n\n var currentUser;\n var userProfileID = \"\";\n var dateNow;\n\n // var remoteVodaEXT = \"?remotehost=https://41.0.203.210:8443/InovoCentralMonitorClient/MonitorData&action=runopenquery&query=\";\n\n\n var newUserId;\n\n currentUser = userProfile['userLogin']\n for (var iAlarm = 0; iAlarm < userDetails.length; iAlarm++) {\n\n var rowData = userDetails[iAlarm];\n if (currentUser == rowData['userlogin']) {\n userProfileID = rowData['id'];\n }\n }\n\n // // --------------------------------------------------------------------------------------------------------------------------------------------------\n // // UPDATE USER LOG\n // // -------------------------------------------------------------------------------------------------------------------------------------------------- \n var updateReason = createReasonUserLogForSchedule(newScheduleName, newScheduleFrequency, newScheduleEnabled, newStartDateTime, newEndDateTime);\n // var query = \"SELECT * FROM InovoMonitor.tblAlarms;\"\n\n dateNow = new Date();\n dateNow = dateNow.getFullYear() + '-' +\n ('00' + (dateNow.getMonth() + 1)).slice(-2) + '-' +\n ('00' + dateNow.getDate()).slice(-2) + ' ' +\n ('00' + dateNow.getHours()).slice(-2) + ':' +\n ('00' + dateNow.getMinutes()).slice(-2) + ':' +\n ('00' + dateNow.getSeconds()).slice(-2);\n\n var insertLogquery = \"INSERT INTO InovoMonitor.tblUserLog (userid, reason, datecreated, createdby) VALUES ('\" + userProfileID + \"','\" + String(updateReason) + \"', '\" + dateNow + \"','\" + currentUser + \"');\";\n\n createScheduleUserlogReq.open(\"POST\", serverURL + \"/MonitorData\", true);\n createScheduleUserlogReq.onreadystatechange = completeScheduleCreation;\n createScheduleUserlogReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n createScheduleUserlogReq.send(\"action=runopenquery&query=\" + insertLogquery);\n }\n }\n\n}",
"function setUserAutorefresh(){\n setInterval(function(){\n var checked = $('input.check_item:checked',dataTable_users);\n var filter = $(\"#datatable_users_filter input\",\n dataTable_users.parents(\"#datatable_users_wrapper\")).attr('value');\n if (!checked.length && !filter.length){\n Sunstone.runAction(\"User.autorefresh\");\n }\n },INTERVAL+someTime());\n}",
"function performChecks() {\n if (atLeastOneAdmin()) {\n let demoteSelf = false;\n if (document.getElementById(\"membership-\" + currentUserMembershipID + \"-select\").value.toString() ===\n \"Member\") {\n $('#demote-self-modal').modal('show');\n $('#demote-self-modal-button').click(function () {\n demoteSelf = true;\n updateMemberships(demoteSelf);\n })\n } else {\n updateMemberships(demoteSelf);\n }\n } else {\n updateFailure(\"The Group needs at least one Admin.\");\n }\n}",
"function hasStandup(who, cb) {\n \n var user = who.user;\n var channel = who.channel;\n controller.storage.teams.get('standupData', function(err, standupData) {\n if (!standupData || !standupData[channel] || !standupData[channel][user]) {\n cb(null, false);\n } else {\n cb(null, true);\n }\n });\n}",
"function checkOnlineStatuses() {\n\tif(DEBUG) {\n\t\tconsole.group(\"checkOnlineStatuses\");\n\t\tconsole.time(\"checkOnlineStatuses\");\n\t\tconsole.count(\"checkOnlineStatuses count\");\n\t}\n\t\n\tfor (var i in usersOnThisPage) {\n\t\tif(DEBUG) console.debug(\"Retrieving data for user %s.\", i);\n\t\tvar tempULS = getUserLastSeen(i);\n\t\tif(tempULS === null) getUserOptions(i);\n\t\tif((tempULS !== null) && (tempULS != \"false\")) {\n\t\t\tvar tempEvent = document.createEvent(\"UIEvents\");\n\t\t\ttempEvent.initUIEvent(\"user_last_seen_ready\", false, false, window, i);\n\t\t\tdocument.dispatchEvent(tempEvent);\n\t\t}\n\t}\n\t\n\tif(DEBUG) {\n\t\tconsole.timeEnd(\"checkOnlineStatuses\");\n\t\tconsole.groupEnd();\n\t}\n}",
"function isup_request_callback(requested_obj) {\n\tbrequested_isup = true;\n\tvar rows = document.getElementsByClassName(\"table__rows\");\n\tvar link;\n\tvar i;\n\n\t// For SG++ endless scrolling, to check if rows[0] is the default one or one\n\t//added by SG++\n\tfor (var j = 0; j < rows.length; j++) {\n\t\tvar rows_inner = rows[j].querySelectorAll(\".table__row-inner-wrap:not(.FTB-checked-row)\");\n\n\t\tif (rows_inner.length === 0) {\n\t\t\tcontinue;\n\t\t} else {\n\t\t\trows = rows_inner;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (requested_obj.successful) {\n\t\tbapi_sighery = true;\n\t\tfor(i = 0; i < rows.length; i++) {\n\t\t\tlink = rows[i].getElementsByClassName(\"table__column__heading\")[0].href;\n\t\t\tvar nick = link.substring(link.lastIndexOf(\"/\") + 1);\n\n\t\t\tqueue.add_to_queue({\n\t\t\t\t\"link\": \"http://api.sighery.com/SteamGifts/IUsers/GetUserInfo/?filters=suspension,last_online&user=\" + nick,\n\t\t\t\t\"headers\": {\n\t\t\t\t\t\"User-Agent\": user_agent\n\t\t\t\t},\n\t\t\t\t\"fallback\": {\n\t\t\t\t\t\"link\": link,\n\t\t\t\t\t\"row\": rows[i],\n\t\t\t\t\t\"headers\": {\n\t\t\t\t\t\t\"User-Agent\": user_agent\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"row\": rows[i]\n\t\t\t});\n\t\t}\n\t} else {\n\t\tfor(i = 0; i < rows.length; i++) {\n\t\t\tlink = rows[i].getElementsByClassName(\"table__column__heading\")[0].href;\n\n\t\t\tqueue.add_to_queue({\n\t\t\t\t\"link\": link,\n\t\t\t\t\"headers\": {\n\t\t\t\t\t\"User-Agent\": user_agent\n\t\t\t\t},\n\t\t\t\t\"row\": rows[i]\n\t\t\t});\n\t\t}\n\t}\n\n\tif (queue.is_busy() === false) {\n\t\tqueue.start(normal_callback);\n\t}\n}",
"function notifyBeforePostingStandup() {\n promptStandup(commons.pickRandomReminderMsg());\n}",
"function checkUserAnswer() {\r\n if (userAnswer === answer) {\r\n score += scoreGot;\r\n updateMaxScore();\r\n } else {\r\n displayCheck();\r\n setTimeout(() => toggleMsg(\"game\"),\r\n 1000);\r\n }\r\n getNew();\r\n }",
"function startInterview(){\n // timer start \n // database upate user data\n // user id will be the object id? is that going to be safe? simply i will bcrypt the roomid and make it userid \n }",
"function checkIfUserInitialized() {\n if (currentuser) {\n loadHomePage();\n } else {\n updateCurrentUser().then(function () {\n loadHomePage();\n }).catch(function () {\n loadSettingsPage();\n });\n }\n}",
"function purposeUser() {\n\n // Displaying the patients.\n var p = displayPatients();\n\n // Asking the user to select the patient to change the appointment.\n r.question(\"Hello User! Choose a patient ID to set/change his/her appointment! \", (ans1) => {\n if (!isNaN(ans1.trim()) && ans1.trim() < p) {\n\n // Calling chooseDoctor() function to choose the doctor for appointment.\n chooseDoctor(Number(ans1.trim()));\n } else {\n\n // If the ID is invalid, trying again.\n console.log(\"INVALID! Choose a patient by ID only! Try again.\");\n purposeUser();\n }\n });\n}",
"async checkFreeAccountRequestsLimit() {\n const from = +this.userTokens.property('сounting_requests_from');\n const counter = +this.userTokens.property('request_counter');\n if (this.now >= (from + 3600000)) { // Обновим метку отсчета (запросов в час)\n await this.extendRequestCounting();\n }\n else if (counter >= config.requests_per_hour_for_free_account) { // Превышено\n this.exceededRequestsLimit();\n return false;\n }\n else { // Накрутить счетчик запросов\n await this.increaseRequestsCount(counter + 1);\n }\n return true;\n }",
"function startIterationOnlyOnLoginWindow() {\n\ttry {\n\t\t// pagefreshInterval (mins) is used for when to relad page, randomized by 0.5 times.\n\t\tvar loginWindowFreshIntrv = GM_getValue ( myacc() + \"_loginWindowFreshInterval\", \"60\");\n\t\tpagefreshInterval = loginWindowFreshIntrv * 60*1000 + Math.ceil ( Math.random() * loginWindowFreshIntrv*60*1000 - loginWindowFreshIntrv*60*1000/2.0 );\n\t\t// transsInterval (mins) is used for by Auto Transport (Construction Support / Resource Concentration).\n\t\ttranssInterval = GM_getValue(myacc() + \"_transInterval\", \"30\")*60*1000;\n\t\t\n\t\t// scriptRunInterval (seconds) is used for when to run this (auto-task) script.\n\t\tscriptRunInterval = GM_getValue(myacc() + \"_scriptRunInterval\", \"20\")*1000;\n\n\t\t// how many intervals to skip on user activity\n\t\t//onActivitySkipIntervals = Number(GM_getValue(myacc() + \"_skipIntervalsOnUserActivity\", \"3\"));\n\t\t//onActivitySkipTime = scriptRunInterval * onActivitySkipIntervals;\n\n\t\t// when to refresh incoming troops before an incoming attack\n\t\trandomizeIncomingTroopsFreshTime();\n\n\t\t// print timer status in footer and in log and handle last user activity time.\n\t\t/*var scriptStartTime = new Date().getTime();\n\t\tvar lastUsrActTime = GM_getValue(myacc() + \"_lastUsrActTime\", \"false\");\n\t\tif ( lastUsrActTime != \"false\" ) {\n\t\t\tvar timeElapsedSinceLastUsrAct = scriptStartTime - parseInt(lastUsrActTime);\n\t\t\tif ( timeElapsedSinceLastUsrAct < onActivitySkipTime ) {\n\t\t\t\tccclock = 0;\n\t\t\t\tcheckForUserActivity = - onActivitySkipTime;\n\t\t\t\tdebugText = \"checkForUserActivity: \" + checkForUserActivity + \"; ccclock: \" + ccclock + \"; Time to Reload Page: \" + Number(pagefreshInterval);\n\t\t\t\tflag ( debugText );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tGM_deleteValue(myacc() + \"_lastUsrActTime\");\n\t\t\t}\n\t\t}*/\n\n\t\t// setup footer text\n\t\tdefaultFooterText = document.getElementById(\"footer\").innerHTML; // first backup original footer\n\t\tprintFooterMsg();\n\n\t\t// add event listeners on keydown and mouse events to clear timers on user activity.\n\t\twindow.addEventListener(\"keydown\", cleartime, false);\n\t\twindow.addEventListener(\"mousemove\", cleartime, false); \n\t\twindow.addEventListener(\"DOMMouseScroll\", cleartime, false); //adding the event listerner for Mozilla\n\t\t// set task cookies for all tasks, doing this only on refresh of profile page, on login & on addition of tasks.\n\t\tgetTaskCookies();\n\t\t// start iteration on self profile page.\n\t\tflag (\"Auto Task iteration started on Login Window.\");\n\t\tstartIteration();\n\t}\n\tcatch ( err ) {\n\t\tprintStackTrace();\n\t\tvar msg = \"<b>startIterationOnlyOnLoginWindow():: Something went wrong, error: \" + err.name + \", Error Message: \" + err.message + \"</b>\";\n\t\tplaySound ( msg );\n\t\tprintErrorMSG(msg);\n\t\tthrow err;\n\t}\n}",
"check_in(req, res) {\n return __awaiter(this, void 0, void 0, function* () {\n const user = yield database_1.default.query('SELECT * FROM check_work WHERE user_id= ? AND state_check = 001', [req.body.user_id]);\n if (user.length >= 1) {\n res.send({ message: 'The worker has an unfinished activity.', code: '001' });\n }\n else {\n yield database_1.default.query('INSERT INTO check_work set ?', [req.body]);\n res.send({ message: 'Saved Check in', code: '000' });\n }\n });\n }",
"function checkNotification (user, admin, callback) {\n\tgetLastCheckIn(user, admin, function (err, previous) {\n\t\tif (previous === undefined) {\n\t\t\tconsole.log(\"No Checkins for user\");\n\t\t\treturn callback(null);\n\t\t}\n\t\tvar checkInInterval = admin.requiredCheckIn;\n\t\tvar reminderTime = admin.reminderTime;\n\t\tvar notifyEmergencyContact = admin.emergencyTime;\n\t\tvar overdueTime = admin.overdueTime;\n\t\tif (previous.type === 'Check In' || previous.type === 'Start') {\n\t\t\tvar timeNow = moment();\n\t\t\tvar previousTime = moment(previous.timestamp, 'ddd, MMM Do YYYY, h:mm:ss a Z', 'en');\n\t\t\tvar timeDiff = timeNow.diff(previousTime, 'minutes'); // get time difference in mins\n\t\t\tconsole.log(previous.name + \" last check in was \" + timeDiff + \" minutes ago\");\n\t\t\tif (timeDiff >= (checkInInterval - reminderTime)) {\n\t\t\t\tconsole.log(\"In Reminder/Overdue\");\n\t\t\t\tvar tech = previous.username;\n\t\t\t\tvar dontSend = false;\n\t\t\t\t// Stop sending messages if it's been too long\n\t\t\t\tif (timeDiff < (checkInInterval + notifyEmergencyContact)) {\n\t\t\t\t\tconsole.log(\"Checking if: \" + timeDiff + \" is less than \" + (checkInInterval + notifyEmergencyContact));\n\t\t\t\t\tvar overdueAlert = timeDiff >= (checkInInterval + overdueTime);\n\t\t\t\t\tconsole.log(\"Reminders are: \" + (user.reminders ? 'ON' : 'OFF'));\n\t\t\t\t\tconsole.log(\"Notifications are: \" + (user.notifications ? 'ON' : 'OFF'));\n\t\t\t\t\tconsole.log(\"Checking if: \" + timeDiff + \" > \" + checkInInterval);\n\t\t\t\t\tif (timeDiff > checkInInterval && user.reminders) {\n\t\t\t\t\t\tconsole.log(\"OVERDUE REMINDER\");\n\t\t\t\t\t\tvar message = \"You are \" + (-(checkInInterval - timeDiff)) + \" minutes overdue for Check In!\";\n\t\t\t\t\t\tvar subject = \"OVERDUE WARNING\";\n\t\t\t\t\t}\n\t\t\t\t\telse if (timeDiff < checkInInterval && user.notifications) {\n\t\t\t\t\t\tconsole.log(\"NORMAL REMINDER\");\n\t\t\t\t\t\tvar message = \"You are due for a Check In in \" + (checkInInterval - timeDiff) + \" minutes\";\n\t\t\t\t\t\tvar subject = \"REMINDER NOTIFICATION\"\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tconsole.log(\"Setting dontSend to: true\");\n\t\t\t\t\t\tdontSend = true;\n\t\t\t\t\t}\n\t\t\t\t\tif (!dontSend) {\n\t\t\t\t\t\tconsole.log(\"Sending REMINDER/OVERDUE Notification\");\n\t\t\t\t\t\tvar emailObj = {\n\t\t\t\t\t\t\tto: user.email,\n\t\t\t\t\t\t\ttext: message,\n\t\t\t\t\t\t\tsubject: subject\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsendEmail(emailObj, function (err) {\n\t\t\t\t\t\t\tif (err) { \n\t\t\t\t\t\t\t\tvar emailError = {\n\t\t\t\t\t\t\t\t\tto: process.env.ERROR_EMAIL,\n\t\t\t\t\t\t\t\t\tsubject: \"Error sending email to \" + user.email,\n\t\t\t\t\t\t\t\t\ttext: err\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsendEmail(emailError);\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\tconsole.log(\"OVERDUE ALERT (ADMIN/VIEW USERS): \" + overdueAlert);\n\t\t\t\t\tif (overdueAlert) {\n\t\t\t\t\t\tvar massEmail = {\n\t\t\t\t\t\t\ttext: user.firstName + \" \" + user.lastName + \" (\" + user.username + \") is \" \n\t\t\t\t\t\t\t\t+ (-(checkInInterval - timeDiff)) + \" minutes overdue for check in!\",\n\t\t\t\t\t\t\tsubject: subject\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconsole.log(\"Admin notifications are \" + (admin.overdueNotifications ? 'ON' : 'OFF'));\n\t\t\t\t\t\tif (admin.overdueNotifications) {\n\t\t\t\t\t\t\tmassEmail.to = admin.email;\n\t\t\t\t\t\t\tsendEmail(massEmail);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgetViewUsers(admin, function (err, viewUsers) {\n\t\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\t\tvar emailError = {\n\t\t\t\t\t\t\t\t\tto: process.env.ERROR_EMAIL,\n\t\t\t\t\t\t\t\t\tsubject: \"Error getting view users for \" + admin.username,\n\t\t\t\t\t\t\t\t\ttext: err\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsendEmail(emailError);\n\t\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (viewUsers.length !== 0) {\n\t\t\t\t\t\t\t\tviewUsers.forEach(function (viewUser) {\n\t\t\t\t\t\t\t\t\tif (viewUser !== undefined) {\n\t\t\t\t\t\t\t\t\t\tconsole.log(viewUser.username + \" has notifications \" + (viewUser.notifications ? 'ON' : 'OFF'));\n\t\t\t\t\t\t\t\t\t\tif (viewUser.notifications) {\n\t\t\t\t\t\t\t\t\t\t\tmassEmail.to = viewUser.email;\n\t\t\t\t\t\t\t\t\t\t\tsendEmail(massEmail);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcallback(null);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tcallback(null);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// Ensure they are only sent a message once\n\t\t\t\t\tconsole.log(\"Checking if: \" + timeDiff + \" is less than \" + (checkInInterval + notifyEmergencyContact + runInterval));\n\t\t\t\t\tif (timeDiff < (checkInInterval + notifyEmergencyContact + runInterval)) {\n\t\t\t\t\t\tconsole.log(\"In Emergency Noticications\");\n\t\t\t\t\t\tif (user.emergencyContact.email !== '') {\n\t\t\t\t\t\t\tconsole.log(\"Sending EMERG msg to \" + user.emergencyContact.email);\n\t\t\t\t\t\t\tvar mailOpts = {\n\t\t\t\t\t\t\t\tto: user.emergencyContact.email,\n\t\t\t\t\t\t\t\tsubject: user.firstName + \" \" + user.lastName + ' is overdue for Check In',\n\t\t\t\t\t\t\t\thtml : '<p>' + user.firstName + \" \" + user.lastName + ' (' + user.username + ')'\n\t\t\t\t\t\t\t\t\t+ ' is overdue by ' + (timeDiff - checkInInterval) + ' minutes! Please ' \n\t\t\t\t\t\t\t\t\t+ 'ensure they are safe.</p><p><strong>You will only receive this email' \n\t\t\t\t\t\t\t\t\t+ ' once</strong></p>'\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tsendEmail(mailOpts);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (user.emergencyContact.phone !== '') {\n\t\t\t\t\t\t\tconsole.log(\"Sending EMERG text to \" + user.emergencyContact.phone);\n\t\t\t\t\t\t\tvar phoneOpts = {\n\t\t\t\t\t\t\t\tphone: user.emergencyContact.phone,\n\t\t\t\t\t\t\t\tbody: user.firstName + \" \" + user.lastName + \" is overdue by \" + (timeDiff - checkInInterval) \n\t\t\t\t\t\t\t\t\t+ \" minutes. Please ensure they are safe. You will only get this message once.\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsendText(phoneOpts);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tconsole.log(\"Emergency contact already notified.\");\n\t\t\t\t\t}\n\t\t\t\t\tcallback(null);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log(timeDiff + \" not >= \" + (checkInInterval - reminderTime));\n\t\t\t\tconsole.log(\"NO ACTION TAKEN\");\n\t\t\t\tcallback(null);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconsole.log('Last checkin was END');\n\t\t\tcallback(null);\n\t\t}\n\t});\n}"
] | [
"0.6484531",
"0.6158379",
"0.5830184",
"0.579746",
"0.57936287",
"0.5697816",
"0.5687309",
"0.5672732",
"0.5660969",
"0.56362784",
"0.5614853",
"0.55957496",
"0.5588634",
"0.553915",
"0.5532074",
"0.55250454",
"0.5511523",
"0.5510523",
"0.5507814",
"0.54976106",
"0.54964715",
"0.54783666",
"0.54762775",
"0.5462905",
"0.54583824",
"0.54539317",
"0.5453371",
"0.54487145",
"0.544773",
"0.5443606"
] | 0.6836265 | 0 |
will initiate a private conversation with user and save the resulting standup report for the channel | function doStandup(bot, user, channel) {
var userName = null;
getUserName(bot, user, function(err, name) {
if (!err && name) {
userName = name;
bot.startPrivateConversation({
user: user
}, function(err, convo) {
if (!err && convo) {
var standupReport =
{
channel: channel,
user: user,
userName: userName,
datetime: getCurrentOttawaDateTimeString(),
yesterdayQuestion: null,
todayQuestion: null,
obstacleQuestion: null
};
convo.ask('What did you work on yesterday?', function(response, convo) {
standupReport.yesterdayQuestion = response.text;
convo.ask('What are you working on today?', function(response, convo) {
standupReport.todayQuestion = response.text;
convo.ask('Any obstacles?', function(response, convo) {
standupReport.obstacleQuestion = response.text;
convo.next();
});
convo.say('Thanks for doing your daily standup, ' + userName + "!");
convo.next();
});
convo.next();
});
convo.on('end', function() {
// eventually this is where the standupReport should be stored
bot.say({
channel: standupReport.channel,
text: "*" + standupReport.userName + "* did their standup at " + standupReport.datetime,
//text: displaySingleReport(bot, standupReport),
mrkdwn: true
});
addStandupData(standupReport);
});
}
});
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function initiateConversation(adminID){\n rainbowSDK.contacts.searchById(adminID).then((contact)=>{\n console.log(\"[DEMO] :: \" + contact);\n if(mocClicked == \"Chat\"){\n rainbowSDK.conversations.openConversationForContact(contact).then(function(conversation) {\n console.log(\"[DEMO] :: Conversation\", conversation);\n conversation1 = conversation;\n rainbowSDK.im.getMessagesFromConversation(conversation, 30).then(function() {\n console.log(\"[DEMO] :: Messages\", conversation);\n chat();\n }).catch(function(err) {\n console.error(\"[DEMO] :: Error Messages 1\", err);\n });\n }).catch(function(err) {\n console.error(\"[DEMO] :: Error conversation\", err);\n });\n }else{\n //check browser compatibility\n if(rainbowSDK.webRTC.canMakeAudioVideoCall()) {\n console.log(\"[DEMO] :: Audio supported\");\n if(rainbowSDK.webRTC.hasAMicrophone()) {\n /* A microphone is available, you can make at least audio call */\n console.log(\"[DEMO] :: microphone supported\");\n var res = rainbowSDK.webRTC.callInAudio(contact);\n if(res.label === \"OK\") {\n call();\n /* Your call has been correctly initiated. Waiting for the other peer to answer */\n console.log(\"[DEMO] :: Contact Successful\");\n let paragraph = document.getElementById(\"p1\");\n paragraph.innerHTML(\"Waiting for Admin to pick up.\");\n }\n else{console.log(\"[DEMO] :: Call not initialised successfully.\");}\n }else {\n alert(\"DEMO :: no microphone found\");\n }\n }else{\n alert(\"DEMO :: browser does not support audio\")\n }\n }\n }).catch((err)=>{\n console.log(err);\n });\n}",
"function loginInitiateConversation(bot, identity) {\n\n\tvar SlackUserId = identity.user_id;\n\tvar botToken = bot.config.token;\n\tbot = _controllers.bots[botToken];\n\n\t_models2.default.User.find({\n\t\twhere: { SlackUserId: SlackUserId }\n\t}).then(function (user) {\n\t\tvar scopes = user.scopes;\n\t\tvar accessToken = user.accessToken;\n\n\n\t\tbot.startPrivateConversation({ user: SlackUserId }, function (err, convo) {\n\n\t\t\t/**\n * \t\tINITIATE CONVERSATION WITH LOGIN\n */\n\t\t\tconvo.say('Awesome!');\n\t\t\tconvo.say('Let\\'s win this day now. Let me know when you want to `/focus`');\n\t\t});\n\t});\n}",
"function firstInstallInitiateConversation(bot, team) {\n\n\tvar config = {\n\t\tSlackUserId: team.createdBy\n\t};\n\n\tvar botToken = bot.config.token;\n\tbot = _controllers.bots[botToken];\n\n\tbot.startPrivateConversation({ user: team.createdBy }, function (err, convo) {\n\n\t\t/**\n * \t\tINITIATE CONVERSATION WITH INSTALLER\n */\n\n\t\tconvo.say('Hey! I\\'m Toki!');\n\t\tconvo.say('Thanks for inviting me to your team. I\\'m excited to work together :grin:');\n\n\t\tconvo.on('end', function (convo) {\n\t\t\t// let's save team info to DB\n\t\t\tconsole.log(\"\\n\\nteam info:\\n\\n\");\n\t\t\tconsole.log(team);\n\t\t});\n\t});\n}",
"function startConversation(user, guid, callback) {\n\n\tvar endpoint = `${rest_endpoint}v3/conversations`;\n\tvar data = {\n\t\t\"bot\": {\n\t\t\t\"id\": \"28:\" + appID,\n\t\t\t\"name\": \"luislocalnotify\"\n\t\t},\n\t\t\"members\": [{\n\t\t\t\"id\": user\n\t\t}],\n\t\t\"channelData\": {\n\t\t\t\"tenant\": {\n\t\t\t\t\"id\": tenant_id[guid]\n\t\t\t}\n\t\t}\n\t};\n\n\trest.post(endpoint, {\n\t\t'headers': {\n\t\t\t'Authorization': 'Bearer ' + access_token[guid]\n\t\t},\n\t\t'data': JSON.stringify(data)\n\t}).on('complete', function (data) {\n\t\tconsole.log('Starting Conversation');\n\t\tcallback(data);\n\t});\n}",
"function setupDecisionsUser() {\n\n // move ticket link for easier access\n $(\"#moderation-ticket-link-new\").remove();\n $(\"#moderation-ticket-link p a\").attr('id', 'moderation-ticket-link-new');\n $(\"#moderation-ticket-link p a\").appendTo($(\"div#moderation-form form div:nth-child(3)\"));\n //$(\"#moderation-ticket-link\").remove();\n\n // add decision selection in user column\n var decisionsHTML = \"\";\n for (var key in decisions) {\n if (decisions[key].message == \"\") {\n var message = \"[No message]\";\n } else {\n var message = \"Message: \" + decisions[key].message;\n }\n\n // extend decisions dialog html code\n decisionsHTML = decisionsHTML + (\"<li><input name='decisions' type='radio' id='\" + key + \"'/><label for='\" + key + \"' title='\" + message + \"' >\" + decisions[key].title + \"</label></li>\");\n }\n\n // inject decision dialog\n $(\".user-annotations-info\").append(\"\\\n <p><strong>User decisions:</strong></p>\\\n <ul id='decisions'>\" + decisionsHTML + \"</ul>\\\n \");\n\n // get username from user column\n var username = $(\".user-annotations-info p a:first\").text();\n\n // load already made decision\n chrome.storage.local.get('decisionsUsers', function(data) {\n var decisionsUsers = data.decisionsUsers;\n\n // create object if it does not exist yet\n if (typeof decisionsUsers == \"undefined\") {decisionsUsers = {};}\n\n // if current user has a decision\n if (username in decisionsUsers) {\n\n // set decision\n $(\"#\" + decisionsUsers[username]).prop('checked', true);\n\n }\n });\n\n /////////////////////////////////////////////////////////\n // highlight active sound and active user in sound ticket column and play sound\n\n // highlight user\n $('#assigned-tickets-table-wrapper table tbody tr').each(function (i, row) {\n\n // remove highlights on all sounds and users\n $(this).removeClass(\"loading loaded\");\n $(this).children(\"td:nth-child(3)\").removeClass(\"loaded\");\n $(this).children(\"td:nth-child(1)\").removeClass(\"loaded\");\n\n // add highlight if the user is right\n if ( username.indexOf($(this).children(\"td:nth-child(3)\").text()) > -1 ){\n $(this).children(\"td:nth-child(3)\").addClass(\"loaded\");\n }\n });\n\n // add loaded class to currently selected\n $(\"tr.mod-selected-row\").addClass(\"loaded\");\n $(\"tr.mod-selected-row td:nth-child(1)\").addClass(\"loaded\");\n\n /////////////////////////////////////////////////\n // bind radio buttons to local storage operations\n $('#decisions li input').each(function (i, radio) {\n\n $(radio).bind('click', function() {\n\n // get decision key (hidden in radio button's id)\n var decision = $(radio).attr(\"id\");\n chrome.storage.local.get('decisionsUsers', function(data) {\n\n var decisionsUsers = data.decisionsUsers;\n\n // create object if it does not exist yet\n if (jQuery.isEmptyObject(decisionsUsers)) { decisionsUsers = {}; };\n decisionsUsers[username] = decision;\n\n //\n chrome.storage.local.set( { \"decisionsUsers\": decisionsUsers }, function (result) {\n // remove classes of user's sounds\n // update user's sounds decision indicator\n $('#assigned-tickets-table-wrapper table tbody tr').each(function (i, row) {\n var userNameField = $(this).children(\"td:nth-child(3)\");\n\n // get username from user column\n var username = $(\".user-annotations-info p a\").first().text();\n\n if (userNameField.text() == username) {\n $(userNameField).removeClass(\"decNot decAcc decAcD decDfr decDel decSpm\");\n $(userNameField).addClass(decisions[decision].cssClass);\n $(userNameField).attr(\"data-user-decision\", decision);\n $(userNameField).attr(\"title\", decisions[decision].title);\n }\n });\n })\n });\n })\n })\n\n} // end function setupDecisionsUser()",
"async sendInfoToChat() {\r\n let messageData = {\r\n user: game.user.id,\r\n speaker: ChatMessage.getSpeaker(),\r\n };\r\n\r\n let cardData = {\r\n ...this.data,\r\n owner: this.actor.id,\r\n };\r\n messageData.content = await renderTemplate(this.chatTemplate[this.type], cardData);\r\n messageData.roll = true;\r\n ChatMessage.create(messageData);\r\n }",
"async initializeChat(conversationData, userInfo, botTranscript) {\n var buttonOverrides = new Array(process.env.BUTTON_ID);\n var preChatDetails = this.initializePrechatDetails(userInfo, botTranscript);\n var chasitorInit = this.initializeSalesForceChatObject(preChatDetails, userInfo, conversationData.sessionId, buttonOverrides);\n return await this.salesForceRepo.requestChat(chasitorInit, conversationData.affinityToken,conversationData.sessionKey);\n }",
"function start_conversation(){\n $(\"#body-wrapper\").hide();\n\n var video_peer = new Peer({key: '57jf1vutabvjkyb9'});\n var audio_peer = new Peer({key: '57jf1vutabvjkyb9'});\n \n //musician\n if(if_musician){\n //we need to await the call\n initialize_musician(video_peer, audio_peer);\n } else {\n initialize_critiquer(video_peer, audio_peer);\n }\n\n video_peer.on('error', function(err){\n alert(err.message);\n });\n\n audio_peer.on('error', function(err){\n alert(err.message);\n });\n\n //draws a new timeline with specified totalDuration\n makeTimeline();\n }",
"async function startChat(user) {\n // replace selector with selected user\n let user_chat_selector = selector.user_chat;\n user_chat_selector = user_chat_selector.replace('XXX', user);\n\n // type user into search to avoid scrolling to find hidden elements\n await page.click(selector.search_box)\n // make sure it's empty\n await page.evaluate(() => document.execCommand( 'selectall', false, null ))\n await page.keyboard.press(\"Backspace\");\n // find user\n await page.keyboard.type(user)\n await page.waitFor(user_chat_selector);\n await page.click(user_chat_selector);\n\t await page.click(selector.chat_input);\n\t \n let name = getCurrentUserName();\n\n if (name) {\n console.log(logSymbols.success, chalk.bgGreen('You can chat now :-)'));\n console.log(logSymbols.info, chalk.bgRed('Press Ctrl+C twice to exit any time.\\n'));\n } else {\n console.log(logSymbols.warning, 'Could not find specified user \"' + user + '\"in chat threads\\n');\n }\n }",
"function callUser(user) {\n getCam()\n .then(stream => {\n if (window.URL) {\n document.getElementById(\"selfview\").srcObject = stream;\n } else {\n document.getElementById(\"selfview\").src = stream;\n }\n toggleEndCallButton();\n caller.addStream(stream);\n localUserMedia = stream;\n caller.createOffer().then(function (desc) {\n caller.setLocalDescription(new RTCSessionDescription(desc));\n channel.trigger(\"client-sdp\", {\n sdp: desc,\n room: user,\n from: id\n });\n room = user;\n });\n })\n .catch(error => {\n console.log(\"an error occured\", error);\n });\n}",
"onDialogBegin(session, args, next) {\n return __awaiter(this, void 0, void 0, function* () {\n session.dialogData.isFirstTurn = true;\n this.showUserProfile(session);\n next();\n });\n }",
"function setupChannel() {\n\n // Join the control channel\n controlChannel.join().then(function(channel) {\n print('Joined controlchannel as '\n + '<span class=\"me\">' + username + '</span>.', true);\n });\n\n // Listen for new messages sent to the channel\n controlChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n console.log('lenis')\n test();\n //printcontrol()\n if (message.body.search(\"@anon\")>=0)\n {\n $.get( \"alch/\"+message.body, function( data ) {\n\n console.log(data);\n });\n }\n else if (message.body.search(\"@time\")>=0)\n {\n\n test();\n // var date=new Date().toLocaleString();\n // controlChannel.sendMessage(date);\n\n }\n else if (message.body.search(\"@junk\")>=0)\n {\n console.log(\"penis\");\n// test();\n }\n\n\n });\n }",
"function startInterview(){\n // timer start \n // database upate user data\n // user id will be the object id? is that going to be safe? simply i will bcrypt the roomid and make it userid \n }",
"function startConversation() {\n var sync = true;\n var data = null;\n\n var params = {\n TableName: BLOCKBOT_PROJECT_ID,\n Item: {\n 'sender' : {S: getMessageSender()},\n },\n ConditionExpression: 'attribute_not_exists(sender)',\n // ExpressionAttributeNames: {'#i' : 'sender'},\n // ExpressionAttributeValues: {':val' : getMessageSender()}\n };\n ddb.putItem(params, function(err, result) {\n if (err) {\n // item exists\n } else {\n //console.log(\"success\");\n }\n data = result;\n sync = false;\n });\n while(sync) {deasync.sleep(100);}\n }",
"function startConversation() {\n lmedia = new Twilio.Conversations.LocalMedia();\n Twilio.Conversations.getUserMedia().then(function(mediaStream) {\n lmedia.addStream(mediaStream);\n lmedia.attach('#lstream');\n }, function(e) {\n tlog('We were unable to access your Camera and Microphone.');\n });\n}",
"ADD_USER_CONVERSATION (state, user) {\n state.userConversation = user\n }",
"@track((undefined, state) => {\n return {action: `enter-attempt-to-channel: ${state.channel.name}`};\n })\n enterChannel(channel){\n\n let addNewMessage = this.props.addNewMessage;\n let updateMessage = this.props.updateMessage;\n\n sb.OpenChannel.getChannel(channel.url, (channel, error) => {\n if(error) return console.error(error);\n\n channel.enter((response, error) => {\n if(error) return console.error(error);\n\n //set app store to entered channel\n this.props.setEnteredChannel(channel);\n //fetch the current participantList to append\n this.fetchParticipantList(channel);\n //fetch 30 previous messages from channel\n this.fetchPreviousMessageList(channel);\n });\n });\n }",
"function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.log(err);\n } else {\n convo.say('I am a bot that has just joined your team');\n convo.say('You must now /invite me to a channel so that I can be of use!');\n }\n });\n }\n}",
"function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.log(err);\n } else {\n convo.say('I am a bot that has just joined your team');\n convo.say('You must now /invite me to a channel so that I can be of use!');\n }\n });\n }\n}",
"function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.log(err);\n } else {\n convo.say('I am a bot that has just joined your team');\n convo.say('You must now /invite me to a channel so that I can be of use!');\n }\n });\n }\n}",
"function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.log(err);\n } else {\n convo.say('I am a bot that has just joined your team');\n convo.say('You must now /invite me to a channel so that I can be of use!');\n }\n });\n }\n}",
"function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.log(err);\n } else {\n convo.say('I am a bot that has just joined your team');\n convo.say('You must now /invite me to a channel so that I can be of use!');\n }\n });\n }\n}",
"onOpen() {\n const {dataStore, activeUserId, activeTeamId} = this.slack.rtmClient;\n const user = dataStore.getUserById(activeUserId);\n const team = dataStore.getTeamById(activeTeamId);\n this.log(this.formatOnOpen({user, team}));\n }",
"function setupChannel() {\r\n\r\n\t\t// Join the general channel\r\n\t\tgeneralChannel.join().then(function(channel) {\r\n\t\t\tconsole.log('Enter Chat room');\r\n\r\n\t\t\t// Listen for new messages sent to the channel\r\n\t\t\tgeneralChannel.on('messageAdded', function(message) {\r\n\t\t\t\tremoveTyping();\r\n\t\t\t\tprintMessage(message.author, message.body, message.index, message.timestamp);\r\n\t\t\t\tif (message.author != identity) {\r\n\t\t\t\t\tgeneralChannel.updateLastConsumedMessageIndex(message.index);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\t// 招待先プルダウンの描画\r\n\t\t\tvar storedInviteTo = storage.getItem('twInviteTo');\r\n\t\t\tgenerateInviteToList(storedInviteTo);\r\n\r\n\t\t\t// 招待先プルダウンの再描画\r\n\t\t\tgeneralChannel.on('memberJoined', function(member) {\r\n\t\t\t\tconsole.log('memberJoined');\r\n\t\t\t\tmember.on('updated', function(updatedMember) {\r\n\t\t\t\t\tupdateMemberMessageReadStatus(updatedMember.identity, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumedMessageIndex || 0, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\tconsole.log(updatedMember.identity, updatedMember.lastConsumedMessageIndex, updatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t});\r\n\t\t\t\tgenerateInviteToList();\r\n\t\t\t});\r\n\t\t\tgeneralChannel.on('memberLeft', function(member) {\r\n\t\t\t\tconsole.log('memberLeft');\r\n\t\t\t\tgenerateInviteToList();\r\n\t\t\t});\r\n\r\n\t\t\t// Typing Started / Ended\r\n\t\t\tgeneralChannel.on('typingStarted', function(member) {\r\n\t\t\t\tconsole.log(member.identity + ' typing started');\r\n\t\t\t\tshowTyping();\r\n\t\t\t});\r\n\t\t\tgeneralChannel.on('typingEnded', function(member) {\r\n\t\t\t\tconsole.log(member.identity + ' typing ended');\r\n\t\t\t\tclearTimeout(typingTimer);\r\n\t\t\t});\r\n\r\n\t\t\t// 最終既読メッセージindex取得\r\n\t\t\tgeneralChannel.getMembers().then(function(members) {\r\n\t\t\t\tfor (i = 0; i < members.length; i++) {\r\n\t\t\t\t\tvar member = members[i];\r\n\t\t\t\t\tmember.on('updated', function(updatedMember) {\r\n\t\t\t\t\t\tupdateMemberMessageReadStatus(updatedMember.identity, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumedMessageIndex || 0, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\t\tconsole.log(updatedMember.identity, updatedMember.lastConsumedMessageIndex, updatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\t});\r\n\t\t\t\t\tif (identity != member.identity && inviteToNames.indexOf(member.identity) != -1) {\r\n\t\t\t\t\t\treadStatusObj[identity] = member.lastConsumedMessageIndex;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// Get Messages for a previously created channel\r\n\t\t\t\tgeneralChannel.getMessages().then(function(messages) {\r\n\t\t\t\t\t$chatWindow.empty();\r\n\t\t\t\t\tvar lastIndex = null;\r\n\t\t\t\t\tfor (i = 0; i < messages.length; i++) {\r\n\t\t\t\t\t\tvar message = messages[i];\r\n\t\t\t\t\t\tprintMessage(message.author, message.body, message.index, message.timestamp);\r\n\t\t\t\t\t\tif (message.author != identity) {\r\n\t\t\t\t\t\t\tlastIndex = message.index;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (lastIndex && lastIndex >= 0) {\r\n\t\t\t\t\t\tgeneralChannel.updateLastConsumedMessageIndex(lastIndex);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\thideSpinner();\r\n\t\t\t\t\t$('#chat-input').prop('disabled', false);\r\n\t\t\t\t});\r\n\r\n\t\t\t});\r\n\r\n\t\t});\r\n\r\n\t}",
"function start() {\n\n gw_job_process.UI();\n gw_job_process.procedure();\n gw_com_module.startPage();\n\n var args = { ID: gw_com_api.v_Stream.msg_openedDialogue };\n gw_com_module.streamInterface(args);\n\n v_global.logic.login_cnt = 0;\n }",
"function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.error(err)\n } else {\n convo.say('I am a bot that has just joined your team')\n convo.say('You must now /invite me to a channel so that I can be of use!')\n }\n })\n }\n}",
"triggerUserActivity() {\n this._updateUserActivity();\n\n // This case means that recording was once stopped due to inactivity.\n // Ensure that recording is resumed.\n if (!this._stopRecording) {\n // Create a new session, otherwise when the user action is flushed, it\n // will get rejected due to an expired session.\n if (!this._loadAndCheckSession()) {\n return;\n }\n\n // Note: This will cause a new DOM checkout\n this.resume();\n return;\n }\n\n // Otherwise... recording was never suspended, continue as normalish\n this.checkAndHandleExpiredSession();\n\n this._updateSessionActivity();\n }",
"async function step1(msgText, report) {\n console.log(\"Steeeeeeep 1111111111111111\");\n\n //Check if we recibe the text from the Quick Replys\n //If it is information we stay in the step\n if (msgText == \"Información\") {\n report[0].responseAuxIndicator = 1\n report[0].responseAux = {\n \"text\": 'Somos el asistente de daños de República Dominicana. Nuestro trabajo consiste en recoger información sobre los daños sufridos por desastre naturales para poder actuar mejor respecto a estos. Estamos a su disposición en caso de que ocurra algo /n Puede compartir nuestro trabajo en sus Redes Sociales: https://www.facebook.com/sharer/sharer.php?u=https%3A//www.facebook.com/Monitoreo-RRSS-Bot-110194503665276/'\n }\n report[0].response = grettingsInfoReply;\n report = fillReport(\"step\", 1, report);\n\n //if it is \"Si\"o \"Reportar daños avanzamos un paso\"\n } else if ((msgText == \"¡Si!\") || (msgText == \"Reportar daños\")) {\n report = nextStep(report);\n report[0].response = safePlaceReply;\n\n //If it is \"No\" remain in the step 1\n } else if (msgText == \"No\") {\n report[0].response = {\n \"text\": \"Nos alegramos de que no haya sufrido ningún problema, muchas gracias\"\n };\n report = fillReport(\"step\", 1, report)\n\n //If the message contains \"no\" and \"app\" we activates the auxiliar conversation for users without writting from the mobile browser\n } else if ((msgText.toLowerCase().includes(\"no\")) && (msgText.includes(\"app\"))) {\n report[0].responseAuxIndicator = 1;\n report[0].responseAux = {\n \"text\": \"De acuerdo, iniciaremos un reporte sin botones\"\n }\n report[0].response = {\n \"text\": \"¿Cual es la causa de los daños producidos?\"\n }\n\n //Change the field fromApp of the report to false and upgrade one step\n report = fillReport(\"fromApp\", false, report)\n\n //if the user dont use the buttons and don´t say No app, we understand that maybe the user can´t see the buttons and \n //inform him/her about the option of having an auxiliar conversation with nobuttons\n } else {\n\n console.log(report[0].response);\n console.log(grettingsReply);\n\n console.log(report[0].response == \"\");\n\n //Checks if the response field is empty. This let us know if the report was just created via writting a msg,\n //so we dont show the auxiliar message, or if we have already made a first reply and the user didnt use the buttons \n if (!report[0].response == \"\") {\n\n report[0].responseAuxIndicator = 1;\n report[0].responseAux = {\n \"text\": 'Si no le aparecen los botones quiere decir que no nos escribe desde la aplicación de messenger. Sería mejor que nos escribiera desde la app. En caso de que este usando el celular y no le sea posible escribanos \"No tengo la app\"'\n };\n }\n report[0].response = grettingsReply;\n\n //maintain the steo to 1 and update the response fields\n report = fillReport(\"step\", 1, report)\n }\n\n //Returns the report object after the pertinent modifications\n return report;\n}",
"function sendPrivateMsg(user1, user2, bot, guild) {\n bot.users.fetch(user1, false).then((user) => {\n user.send(\n`>>> You have been matched with <@${user2}>, from ${guild.name}\nIn order to speak with them you must send them a message.\nIf you would like to continue using this service, please re-react to the message in ${guild.name}`);\n });\n\n bot.users.fetch(user2, false).then((user) => {\n user.send(\n`>>> You have been matched with <@${user1}>, from ${guild.name}\nIn order to speak with them you must send them a message.\nIf you would like to continue using this service, please re-react to the message in ${guild.name}`);\n });\n}",
"function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.log(err);\n } else {\n convo.say(\"Hi there, I'm Taylor. I'm a bot that has just joined your team.\");\n convo.say('You can now /invite me to a channel so that I can be of use!');\n }\n });\n }\n}"
] | [
"0.5840379",
"0.56874186",
"0.5675624",
"0.5628233",
"0.55131686",
"0.54803413",
"0.5475566",
"0.5454759",
"0.5421371",
"0.5414625",
"0.5405184",
"0.5356118",
"0.5349045",
"0.5308127",
"0.5287822",
"0.5276483",
"0.52346283",
"0.520408",
"0.520408",
"0.520408",
"0.520408",
"0.520408",
"0.5195482",
"0.5148355",
"0.5142533",
"0.51349086",
"0.5126448",
"0.51168704",
"0.51136345",
"0.5113416"
] | 0.69738185 | 0 |
when the time to report is hit, report the standup, clear the standup data for that channel | function checkTimesAndReport(bot) {
getStandupTimes(function(err, standupTimes) {
if (!standupTimes) {
return;
}
var currentHoursAndMinutes = getCurrentHoursAndMinutes();
for (var channelId in standupTimes) {
var standupTime = standupTimes[channelId];
if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) {
getStandupData(channelId, function(err, standupReports) {
bot.say({
channel: channelId,
text: getReportDisplay(standupReports),
mrkdwn: true
});
clearStandupData(channelId);
});
}
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function clearStandupData(channel) {\n controller.storage.teams.get('standupData', function(err, standupData) {\n if (!standupData || !standupData[channel]) {\n return;\n } else {\n delete standupData[channel];\n controller.storage.teams.save(standupData);\n }\n });\n}",
"function discard() {\n\t// Wenn der Timer aktiv ist,...\n\tif(time.Enable) {\n\t\t// ...dann anhalten\n\t\ttime.Stop();\n\t}\n\t\n\t// Die gespielte Zeit in die Statistiken einfließen lassen\n\tstatistics.addSeconds(difficulty, statistics.state.discard, seconds);\n\t// Die aufgedeckte Fläche in die Statistiken einfließen lassen\n\tstatistics.addDiscovered(difficulty, statistics.state.discard, calculateDiscoveredPercent());\n\t\n\t// DIe statistics speichern\n\tPersistanceManager.saveStatistics(statistics);\n}",
"function onReport() {\n\t\t\tvar reportTime = t.getTimeBucket();\n\t\t\tvar curTime = reportTime;\n\t\t\tvar missedReports = 0;\n\n\t\t\tif (total === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// if we had more polls than we expect in each\n\t\t\t// collection period (we allow one extra for wiggle room), we\n\t\t\t// must not have been able to report, so assume those periods were 100%\n\t\t\twhile (total > (POLLS_PER_REPORT + 1) &&\n\t\t\t missedReports <= MAX_MISSED_REPORTS) {\n\t\t\t\tt.set(\"busy\", 100, --curTime);\n\n\t\t\t\t// reset the period by one\n\t\t\t\ttotal -= POLLS_PER_REPORT;\n\t\t\t\tlate = Math.max(late - POLLS_PER_REPORT, 0);\n\n\t\t\t\t// this was a busy period\n\t\t\t\toverallTotal += POLLS_PER_REPORT;\n\t\t\t\toverallLate += POLLS_PER_REPORT;\n\n\t\t\t\tmissedReports++;\n\t\t\t}\n\n\t\t\t// update the total stats\n\t\t\toverallTotal += total;\n\t\t\toverallLate += late;\n\n\t\t\tt.set(\"busy\", Math.round(late / total * 100), reportTime);\n\n\t\t\t// reset stats\n\t\t\ttotal = 0;\n\t\t\tlate = 0;\n\t\t}",
"function refreshBadge() {\n curTime--; //first we decrement the time given bc we've waited a sec\n //console.log('leak testing', interval, 'interval ', curTime)\n\n //gotta assess how much time is remaining for our user's period\n if (curTime > 86400) {\n let tempTime = Math.floor(curTime / 86400);\n badgeText = `>${tempTime}d`\n } else if (curTime > 3600) {\n let tempTime = Math.floor(curTime / 3600);\n badgeText = `>${tempTime}h`;\n } else if (curTime > 120) {\n let tempTime = Math.floor(curTime / 60);\n badgeText = `>${tempTime}m`\n } else if (curTime === 2) {\n chrome.action.setBadgeText({ text: '' });\n intervalStorage.clearAll();\n } else if (curTime === 1) {\n chrome.action.setBadgeText({ text: '' });\n intervalStorage.clearAll();\n } else if (curTime <= 0) {\n intervalStorage.clearAll();\n } else {\n badgeText = `${curTime}s`;\n }\n\n //then update the badge with how much time they have left if there's time remaining\n if (curTime > 2) chrome.action.setBadgeText({ text: badgeText });\n //console.log('counting down time, ', curTime);\n }",
"function startMeasure(){\n socket.emit( 'newMeasure' );\n var intId = setTimeout( startMeasure, 5000 );\n if (stop == true) {\n console.log(\"Cleared\");\n clearTimeout( intId );\n }\n }",
"clearECDistributionCountdown() {\n this.energyChunkDistributionCountdownTimer = 0;\n }",
"function resetHUD() {\n score = gscore = tick = 0;\n tTime = 60;\n timeReturn = window.setInterval(mTime, 1000);\n clearMsgs();\n}",
"function reportEmptyData(probe) {\n\t\tconst response = `boat ${probe} is online but not reporting data`;\n\t\tbot.sendMessage(process.env.CHAT_ID, response);\n\t\treportNotWorking = probe;\n\t\tconsole.log(response);\n\t}",
"resetSW() {\r\n this.hmsElapsed = [];\r\n clearInterval(this.interval);\r\n this.view.playerInfo([\"00\", \"00\", \"00\", \"0\"].join(\":\"));\r\n }",
"function clearAgentInfo() {\n console.log('Timer Triggered Server');\n for (var key in Keep_alive_lists) {\n if (Keep_alive_lists.hasOwnProperty(key)) {\n //console.log(\"Server AgentId \"+Keep_alive_lists[key].id);\n //console.log(\"Server Time \"+Keep_alive_lists[key].time);\n if (Keep_alive_lists[key].time == \"\") {\n var id = Keep_alive_lists[key].id.trim();\n //clearSessionId(id);\n //UpdateAgentStatus(id.trim(),Status.AVAILABLE);\n }\n Keep_alive_lists[key].time = \"\";\n }\n }\n}",
"function setStandupTime(channel, standupTimeToSet) {\n \n controller.storage.teams.get('standupTimes', function(err, standupTimes) {\n\n if (!standupTimes) {\n standupTimes = {};\n standupTimes.id = 'standupTimes';\n }\n\n standupTimes[channel] = standupTimeToSet;\n controller.storage.teams.save(standupTimes);\n });\n}",
"function flush() {\n sendEntries();\n events.length = 0;\n totalLogScore = 0;\n}",
"function Clearup() {\n //TO DO:\n EventLogout();\n top.API.Fpi.CancelAcquireData();\n App.Timer.ClearTime();\n }",
"buildStatistic() { // builds a statistic and removes values older than 48h\n setTimeout(() => {\n this.detectors.map((detector) =>\n // todo first build a statistic\n SensorDataModel.remove({\n sensor: this._id,\n detectorType: detector.type,\n timestamp: {$gt: moment().subtract(48, 'hours')},\n }).exec((err) => {\n if (err) {\n return logger.error;\n }\n }));\n }\n , STATISTIC_INTERVALL);\n }",
"function Clearup() {\n App.Timer.ClearTime();\n }",
"function Clearup() {\n App.Timer.ClearTime();\n EventLogout();\n //TO DO:\n }",
"function\nclearReport(){\nAssert.reporter.setClear();\n}\t//---clearReport",
"function finishCutting(c_num) {\n var user;\n if( c_num == 0 ){\n user = q[0];\n q[0] = null;\n } else if (c_num == 1 ){\n user = q[1];\n q[1] = null;\n } else {\n console.log(\"Lasercutter number not valid\")\n }\n ids.delete(user['email']);\n pulltoCutter();\n calculateTime();\n}",
"async refresh({recording = true, sds011 = null, sensehat = null, log = false}) {\n //Dump sensors\n const t = Date.now()\n const {records} = data\n const d = {}\n if (log)\n console.log(`${t} : refreshing data`)\n //Save data\n if (sds011) {\n d.sds011 = await sds011.dump()\n if (records)\n [\"pm10\", \"pm25\"].forEach(k => records[k].push({t, y:d.sds011[k]}))\n }\n if (sensehat) {\n d.sensehat = await sensehat.dump({ledmatrix:true})\n if (recording) {\n ;[\"humidity\", \"pressure\"].forEach(k => records[k].push({t, y:d.sensehat[k]}))\n records.temperature_from_humidity.push({t, y:d.sensehat.temperature.humidity})\n records.temperature_from_pressure.push({t, y:d.sensehat.temperature.pressure})\n records.temperature.push({t, y:.5*(d.sensehat.temperature.humidity+d.sensehat.temperature.pressure)})\n }\n }\n data.dump = d\n //Filter old data\n for (let [key, record] of Object.entries(records))\n records[key] = record.filter(r => r.t >= t - 12*60*60*1000)\n }",
"_cleanHits() {\n let now = Date.now();\n let xMilliSecondsAgo = now - this.minsAgoInMilli;\n\n console.log(\"Time now: \", this._toHHMMSS(now));\n console.log(`Time ${this.minsAgo} minute ago: `, this._toHHMMSS(xMilliSecondsAgo));\n\n console.log(\"total hits: \", this.hitsCount[\"totalCount\"]);\n\n\n for (; this.startPointer < xMilliSecondsAgo; this.startPointer++) {\n if (this.hitsCount[this.startPointer]) {\n // we need to delete the oldest visit entries from the total count\n\n // for example, if we logged 10 visits 5 min and 1 milliseconds ago\n // 1) we need to delete that key-value pair from the hash AND\n // 2) we need to subtract 10 visits from \"totalCount\"\n this.hitsCount[\"totalCount\"] -= this.hitsCount[this.startPointer];\n delete this.hitsCount[this.startPointer];\n }\n }\n\n }",
"function resetTimer() {\n dashboardTimer = setInterval(function() {\n gridcells.forEach(gridcell => {\n if(gridcell.graph) {\n if(gridcell.graphType == 'Linechart') {\n if(dashboardIsOnline) {\n gridcell.graph.getData(undefined, false);\n } else {\n gridcell.graph.getData(undefined, true);\n }\n } else if(gridcell.graphType == 'Gauge') {\n gridcell.graph.getData(false);\n }\n }\n });\n setCurrentDateAndTime();\n }, refreshSettings.time);\n}",
"function Clearup(){\n //TO DO:\n EventLogout();\n App.Timer.ClearTime();\n }",
"function Clearup() {\n //TO DO:\n EventLogout();\n App.Timer.ClearTime();\n }",
"function Clearup() {\n //TO DO:\n EventLogout();\n App.Timer.ClearTime();\n }",
"function Clearup() {\n //TO DO:\n EventLogout();\n App.Timer.ClearTime();\n }",
"function Clearup() {\n //TO DO:\n EventLogout();\n App.Timer.ClearTime();\n }",
"function updateReporter(time){\n\t\n if(showReporter){\n\n\t\tvar posi=JSON.parse(httpGet(reporterPosiSource)); //Two dimensional array with reporter position\n\n\t\tfor(var i=0;i<posi.length;i++){\n\t\t\tif(typeof(reporterMap[posi[i][0].mac])=='undefined'){\n\t\t\t\n\t\t\t\treporterMap[posi[i][0].mac]=new reporterMarker(posi[i][0]);\n // console.log(reporterMap);\n\t\t\t\t// console.log(\"Add\");\n\t\t\t}else{ \n\t\t\t\treporterMap[posi[i][0].mac].setPosi({\"lat\":parseFloat(posi[i][0].lat),\"lng\":parseFloat(posi[i][0].long)}); \n\t\t\t\treporterMap[posi[i][0].mac].time=parseInt(posi[i][0].ts);\n reporterMap[posi[i][0].mac].rssi=parseInt(posi[i][0].rssi);\n\t\t\t\t// console.log(reporterMap);\n\t\t\t\t// console.log(posi[i][0]);\n\t\t\t}\n\t\t}\n\t\t\n\t}else{\n\n\t\t// Clear memory\n\t\tfor(var key in reporterMap){\n\t\t\treporterMap[key].marker.setMap(null);\n\t\t}\n\t\treporterMap={};\n\t\t\n\t}\n \n window.setTimeout(\"updateReporter(\"+time+\")\",time);\n}",
"clearEnergyData() {\n this.batchRemoveSamples( this.dataSamples.slice() );\n this.sampleTimeProperty.reset();\n this.timeSinceSampleSave = 0;\n }",
"_removeStatsPusher() {\n if (this._statsPusher) {\n this._holdStatsTimer();\n clearInterval(this._statsPusher);\n this._statsPusher = null;\n }\n }",
"function clearWeek(){\n\n let errorExists = false;\n\n pool.getConnection(function(err, connection){\n\n if(_assertConnectionError(err)){\n return;\n }\n \n const streamersReg = [];\n const streamersWhitelist = [];\n connection.query(\"SELECT * FROM list_of_streamers;\",\n function(error, results, fields){\n\n if(errorExists || _assertError(error, connection)){\n errorExists = true;\n return;\n }\n\n for(let row of results){\n streamersReg.push(sql.raw(row[\"channel_id\"] \n + _REGULAR_SUFFIX));\n streamersWhitelist.push(sql.raw(row[\"channel_id\"] \n + _WHITELIST_SUFFIX));\n }\n\n });\n\n connection.query(\"UPDATE ?, ? SET ?.week=0, ?.week=0;\", \n [streamersReg, streamersWhitelist, \n streamersReg, streamersWhitelist], function(error){\n \n if(errorExists || _assertError(error)){\n errorExists = true;\n return;\n }\n\n });\n\n if(!errorExists){\n connection.release();\n }\n\n });\n\n}"
] | [
"0.6351986",
"0.57172143",
"0.57172",
"0.5665382",
"0.5609832",
"0.56097007",
"0.5597038",
"0.5584903",
"0.5575114",
"0.5570066",
"0.55546856",
"0.55154425",
"0.55140424",
"0.5512958",
"0.54904246",
"0.54677385",
"0.5444892",
"0.5407005",
"0.54037684",
"0.53916013",
"0.5390941",
"0.5373701",
"0.53542405",
"0.53542405",
"0.53542405",
"0.53542405",
"0.5339238",
"0.5327365",
"0.5314967",
"0.53036207"
] | 0.63896483 | 0 |
returns an object (not date) with the current hours and minutes, Ottawa time | function getCurrentHoursAndMinutes() {
var now = convertUTCtoOttawa(new Date());
return { hours: now.getHours(), minutes: now.getMinutes() };
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getNow() {\n var now = new Date();\n return {\n hours: now.getHours() + now.getMinutes() / 60,\n minutes: now.getMinutes() * 12 / 60 + now.getSeconds() * 12 / 3600,\n seconds: now.getSeconds() * 12 / 60\n };\n }",
"function time() {\r\n var data = new Date();\r\n var ora = addZero( data.getHours() );\r\n var minuti = addZero( data.getMinutes() );\r\n return orario = ora + ':' + minuti;\r\n }",
"function getCurrentOttawaDateTimeString() {\n\n var date = convertUTCtoOttawa(new Date());\n\n var hour = date.getHours();\n hour = (hour < 10 ? \"0\" : \"\") + hour;\n\n var min = date.getMinutes();\n min = (min < 10 ? \"0\" : \"\") + min;\n\n var year = date.getFullYear();\n\n var month = date.getMonth() + 1;\n month = (month < 10 ? \"0\" : \"\") + month;\n\n var day = date.getDate();\n day = (day < 10 ? \"0\" : \"\") + day;\n\n return year + \"-\" + month + \"-\" + day + \": \" + hour + \":\" + min;\n}",
"function getTiempo() {\n\tvar date = new Date();\n\tvar time = date.getHours()+':'+\n\t\t\t date.getMinutes()+':'+\n\t\t\t date.getSeconds()+':'+\n\t\t\t date.getMilliseconds();\n\treturn time;\n}",
"function getTime(){\n const d = new Date();\n let hours = d.getHours();\n let minutes = d.getMinutes();\n let mode = 'am';\n\n if(hours > 12){\n hours -= 12 ;\n mode = \"pm\"\n }\n\n return {time: `${hours}:${JSON.stringify(minutes).padStart(2,'0')}`, mode}\n}",
"function getTime(data){\n let today = data;\n let date = today.getFullYear() + \"-\" + (today.getMonth() + 1) + \"-\" + today.getDate();\n let time = today.getHours() + \":\" + today.getMinutes() + \":\" + today.getSeconds();\n return {dateTime: date + \" \" + time , date: date , time: time};\n }",
"function getTime() {\n\t\t\tvar date = new Date(),\n\t\t\t\thour = date.getHours();\n\t\t\treturn {\n\t\t\t\tday: weekdays[lang][date.getDay()],\n\t\t\t\tdate: date.getDate(),\n\t\t\t\tmonth: months[lang][date.getMonth()],\n\t\t\t\thour: appendZero(hour),\n\t\t\t\tminute: appendZero(date.getMinutes()),\n\t\t\t\t//second: appendZero(date.getSeconds())\n\t\t\t};\n\t\t}",
"function getCurrentTime() {\n\tconst time = performance.now() / 1000;\n\tconst secs = Math.floor(time % 60);\n\tconst mins = Math.floor((time / 60) % 60);\n\tconst hrs = Math.floor(time / 60 / 60);\n\n\treturn { hrs: (hrs < 10 ? '0' : '') + hrs,\n\t\tmins: (mins < 10 ? '0' : '') + mins,\n\t\tsecs: (secs < 10 ? '0' : '') + secs};\n}",
"function getCurrTimeFormated() {\n var d = new Date();\n return { h: addZero(d.getHours()), m: addZero(d.getMinutes()), s: addZero(d.getSeconds()) }\n}",
"function returnTime(){\n let d = new Date();\n // Get the time settings\n let min = d.getMinutes();\n let hour = d.getHours();\n let time = hour + \":\" + min;\n return time;\n}",
"function getCurrentTime() {\n\n \t\tvar now = new Date();\n \t\tvar dayMonth = now.getDate();\n \t\tvar meridien = \"AM\";\n \t\tvar hours = now.getHours();\n \t\tvar minutes = now.getMinutes();\n \t\tvar month = (now.getMonth()) + 1;\n \t\tvar start = new Date(now.getFullYear(), 0, 0);\n \t\tvar diff = now - start;\n \t\tvar oneDay = 1000 * 60 * 60 * 24;\n \t\tvar day = Math.floor(diff / oneDay);\n \t\tvar seconds = now.getSeconds();\n \n \t\tif ( hours >= 12 ) {\n \t\t \n \t\t\tmeridien = \"PM\"\n \t\t\thours = hours - 12; \n \t\t\t\n \t\t}//end of if statement\n \n \t\tif (minutes < 10 ){\n \t\t\tminutes = \"0\"+minutes;\n \t\t} //end of if statement\n \n \t\treturn{\n \t\t hours : hours,\n \t\t\tminutes : minutes,\n \t\t\tmeridien : meridien,\n \t\t\tmonth : month,\n \t\t\tday : day,\n \t\t\tseconds : seconds,\t\n\t\t\t\tdayMonth : dayMonth\t\t\n\t\t\t}//end of return\n }",
"function now() {\n return new Time(new Date());\n}",
"static get_time() {\n return (new Date()).toISOString();\n }",
"function getTime() {\n\t//get absolute most current time and date\n\tvar localTime = new Date();\n\t//make sure we got it\n\tconsole.log( localTime );\n\t//extract time and date info and store it in an object\n\tvar theTime = {\n\t\tyear : localTime.getFullYear(),\n\t\tmonth : localTime.getMonth(),\n\t\tdate: localTime.getDate(),\n\t\tday : localTime.getDay(),\n\t\thour : localTime.getHours(),\n\t\tminute : localTime.getMinutes()\n\t};\n\t//makes sure it's working\n\tconsole.log( theTime )\n\t//return our time object\n\treturn theTime;\n\t// functionality goes here!\n\n} // end getTime()",
"function getTimeObject(time) {\r\n\t\r\n\tvar hours = Math.floor(time / secondsInHours);\r\n\tvar totalTime = ((time / secondsInHours) - hours) * secondsInHours;\r\n\r\n\tvar minutes = 0;\r\n\twhile (totalTime >= 60) {\r\n\t\t\r\n\t\ttotalTime -= 60;\r\n\t\tminutes++;\r\n\t}\r\n\r\n\tvar seconds = totalTime;\r\n\r\n\tvar timeObj = {\r\n\t\t'hours': hours,\r\n\t\t'minutes': minutes,\r\n\t\t'seconds': seconds\r\n\t}\r\n\treturn timeObj;\r\n}",
"function get_time(){\n const today = new Date()\n let time = today.getHours() + \":\" + today.getMinutes();\n return time;\n }",
"function getTime(){\n \n hr = hour();\n mn = minute();\n sc = second();\n}",
"time() {\n return (new Date()).valueOf() + this.offset;\n }",
"function date(){\n var myDate = new Date();\n var time= {\n d : myDate.toLocaleDateString(),\n h : myDate.getHours(),\n m : myDate.getMinutes(),\n s : myDate.getSeconds()\n }\n return time;\n}",
"function get_time() {\n return Date.now();\n}",
"get timeDetails() {\n let now = new Date().getTime();\n return {\n quizTime: this._time,\n start: this._startTime,\n end: this._endTime,\n elapsedTime: ((this._endTime || now) - this._startTime) / 1000, // ms to sec\n remainingTime: secToTimeStr(this._remainingTime),\n timeOver: this[TIME_OVER_SYM]\n }\n }",
"function getCurrentTime() {\r\n let today = new Date();\r\n let hours = today.getHours() >= 10 ? today.getHours() : '0' + today.getHours();\r\n let minutes = today.getMinutes() >= 10 ? today.getMinutes() : '0' + today.getMinutes();\r\n let day = today.getDate() >= 10 ? today.getDate() : '0' + today.getDate();\r\n let month = today.getMonth() + 1;\r\n month = month >= 10 ? month : '0' + month;\r\n\r\n let hoursAndMin = hours + ':' + minutes + ' ';\r\n let dayMonthAndYear = day + '/' + month + '/' + today.getFullYear();\r\n return hoursAndMin + dayMonthAndYear;\r\n}",
"function getTime(t) {\r\n date = new Date(t);\r\n offset = date.getTimezoneOffset() / 60;\r\n //var milliseconds = parseInt((t % 1000) / 100),\r\n seconds = Math.floor((t / 1000) % 60);\r\n minutes = Math.floor((t / (1000 * 60)) % 60);\r\n hours = Math.floor((t / (1000 * 60 * 60)) % 24);\r\n hours = hours - offset;\r\n hours = (hours < 10) ? \"0\" + hours : hours;\r\n minutes = (minutes < 10) ? \"0\" + minutes : minutes;\r\n seconds = (seconds < 10) ? \"0\" + seconds : seconds;\r\n return hours + \":\" + minutes + \":\" + seconds;\r\n }",
"function gettime() {\n //return Math.round(new Date().getTime() / 1000);\n return Math.round(Date.now() / 1000);\n}",
"function getDateAndTime(){\n return new Date()\n}",
"get() {\n let date = new Date();\n\n Object.assign(this.currentTime, {\n hours : date.getHours(),\n minutes : date.getMinutes(),\n seconds : date.getSeconds()\n })\n }",
"function getTime() {\r\n var currentTime = new Date();\r\n var hours = currentTime.getHours();\r\n var minutes = currentTime.getMinutes();\r\n if (minutes < 10) {\r\n minutes = \"0\" + minutes;\r\n }\r\n return hours + \":\" + minutes;\r\n}",
"function currentTime() {\n const today = new Date();\n let hours = today.getHours();\n let mins = today.getMinutes();\n let ampm = \"am\";\n\n if (hours >= 12) {\n ampm = \"pm\";\n }\n if (mins < 10) {\n mins = '0' + mins;\n }\n hours = hours % 12;\n let time = hours + \":\" + mins + ampm;\n return time;\n}",
"function getCurrentTime() {\r\n //returns time in minutes\r\n return Math.round(new Date().getTime() / 1000 / 60);\r\n}",
"function getCurrentTime() {\r\n //returns time in minutes\r\n return Math.round(new Date().getTime() / 1000 / 60);\r\n}"
] | [
"0.7421034",
"0.7070131",
"0.7042703",
"0.7019506",
"0.7016044",
"0.6983289",
"0.69333446",
"0.68698555",
"0.68485516",
"0.6821014",
"0.68004423",
"0.6745183",
"0.67373943",
"0.6730873",
"0.6727982",
"0.67008406",
"0.66862845",
"0.65916675",
"0.6536028",
"0.65289223",
"0.65264136",
"0.6493134",
"0.6491401",
"0.64850444",
"0.6472812",
"0.6457571",
"0.6448586",
"0.6445742",
"0.6444603",
"0.6444603"
] | 0.7886335 | 0 |
compares two objects (not date) with hours and minutes | function compareHoursAndMinutes(t1, t2) {
return (t1.hours === t2.hours) && (t1.minutes === t2.minutes);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function compare(a,b) {\r\n var startTimeA = (a.StartTimeHour*60) + a.StartTimeMinute;\r\n var startTimeB = (b.StartTimeHour*60) + b.StartTimeMinute;\r\n return startTimeA - startTimeB;\r\n}",
"equalsTo(operand){\r\n return (this.hours === operand.hours && this.minutes === operand.minutes);\r\n }",
"function withInTime(minutes, timeOne, timeTwo){\n var hours = minutes / 60;\n minutes = minutes % 60;\n var diffTime = (timeTwo[0] - timeOne[0]) * 60 + timeTwo[1] - timeOne[1];\n return minutes >= Math.abs(diffTime);\n}",
"function compare(a, b){\n // const dayA = a.startTime[0];\n // const dayB = b.startTime[0];\n // const hourA = parseInt(a.startTime.substring(\n // a.startTime.lastIndexOf(\":\") + 1,\n // a.startTime.lastIndexOf(\";\")\n // ));\n // const hourB = parseInt(b.startTime.substring(\n // b.startTime.lastIndexOf(\":\") + 1,\n // b.startTime.lastIndexOf(\";\")\n // ));\n // const minutesA = parseInt(a.startTime.split(\":\").pop());\n // const minutesB = parseInt(b.startTime.split(\":\").pop());\n\n if (a.people.length > b.people.length) {\n return -1;\n }\n else if (a.people.length == b.people.length && (a.startTime < b.startTime)) {\n return -1;\n }\n else{\n return 1;\n }\n }",
"leastEqualThan(operand){\r\n return ((this.hours === operand.hours && this.minutes <= operand.minutes)\r\n || (this.hours < operand.hours));\r\n }",
"function compareTime(timeA, timeB) {\n var startTimeParse = timeA.split(\":\");\n var endTimeParse = timeB.split(\":\");\n var firstHour = parseInt(startTimeParse[0]);\n var firstMinute = parseInt(startTimeParse[1]);\n var secondHour = parseInt(endTimeParse[0]);\n var secondMinute = parseInt(endTimeParse[1]);\n if (firstHour == secondHour) {\n if (firstMinute == secondMinute)\n return 0;\n if (firstMinute < secondMinute)\n return -1\n return 1\n }\n else {\n if (firstHour < secondHour)\n return -1\n return 1\n }\n}",
"function compare (a,b){\n if (a.hoursInSpace < b.hoursInSpace){\n return 1;\n }\n if (a.hoursInSpace > b.hoursInSpace){\n return -1;\n }\n return 0;\n }",
"function isTimeSmallerOrEquals(time1, time2, doNotInvolveMinutePart) {\r\n\t\t\tvar regex = '^(-|\\\\+)?([0-9]+)(.([0-9]{1,2}))?$';\r\n\t\t\t(new RegExp(regex, 'i')).test(time1);\r\n\t\t\tvar t1 = parseInt(RegExp.$2) * 60;\r\n\t\t\tif (RegExp.$4 && !doNotInvolveMinutePart) t1 += parseInt(RegExp.$4);\r\n\t\t\tif (RegExp.$1 == '-') t1 *= -1;\r\n\t\t\t(new RegExp(regex, 'i')).test(time2);\r\n\t\t\tvar t2 = parseInt(RegExp.$2) * 60;\r\n\t\t\tif (RegExp.$4 && !doNotInvolveMinutePart) t2 += parseInt(RegExp.$4);\r\n\t\t\tif (RegExp.$1 == '-') t2 *= -1;\r\n\t\t\tif (t1 <= t2) return true;\r\n\t\t\telse return false;\r\n\t\t}",
"function IsTimeEqual(timeOne, timeTwo)\n{\n\treturn ((timeOne.getHours() == timeTwo.getHours()) && (timeOne.getMinutes() == timeTwo.getMinutes()) && (timeOne.getSeconds() == timeTwo.getSeconds()));\n}",
"function compareDate(date1, date2) {\n\n //Hours equal\n if (date1.getHours() == date2.getHours()) {\n\n //Check minutes\n if (date1.getMinutes() == date2.getMinutes()) {\n return 0;\n } else {\n if (date1.getMinutes() > date2.getMinutes()) {\n return 1;\n } else {\n return -1;\n }\n }\n }\n\n //Hours not equal\n else {\n if (date1.getHours() > date2.getHours()) {\n return 1;\n } else {\n return -1;\n }\n }\n}",
"function compare(a, b) {\n var date2 = new Date(parseInt(a.created_time) * 1000),\n date1 = new Date(parseInt(b.created_time) * 1000);\n\n if (date1 < date2)\n return -1;\n if (date1 > date2)\n return 1;\n return 0;\n }",
"function compareReminders(a, b) {\r\n const reminderA = a.reminderTimeMin;\r\n const reminderB = b.reminderTimeMin;\r\n\r\n let comparison = 0;\r\n if (reminderA > reminderB) {\r\n comparison = 1;\r\n } else if (reminderA < reminderB) {\r\n comparison = -1;\r\n }\r\n return comparison;\r\n}",
"function diffTopOfHour(a,b) {\n return a.minutes(0).diff(b.minutes(0),\"hours\");\n }",
"function compare(objectA,objectB) {\n\n\t\tvar objectATime = Number(objectA.timestampms);\n\t\tvar objectBTime = Number(objectB.timestampms);\n\n\t\tif (objectATime < objectBTime){\n\t\t\t//timeDifference += \"##\" + objectATime+ \"is SMALLER than \" + objectBTime;\n\t\t\treturn -1;\n\t\t}\n\t\tif (objectATime > objectBTime){\n\t\t\t//timeDifference += \"##\" + objectATime+ \"is BIGGER than \" + objectBTime;\n\t\t\treturn 1;\n\t\t}\n\t\t//timeDifference += \"##\" + objectATime+ \"is EQUALS to \" + objectBTime;\n\t\treturn 0;\n\t}",
"compareTime(time1, time2) {\n return new Date(time1) > new Date(time2);\n }",
"matches(timeToCheck) {\n return this.time.getHours() === timeToCheck.getHours()\n && this.time.getMinutes() === timeToCheck.getMinutes()\n && this.time.getSeconds() === timeToCheck.getSeconds();\n }",
"function timeCompare(time1, time2) {\n time1 = time1.toLowerCase();\n time2 = time2.toLowerCase();\n var regex = /^(\\d{1,2}):(\\d{2}) ?(am|pm)$/;\n regex.exec(time1);\n var time1amPm = RegExp.$3;\n var time1Hour = RegExp.$1;\n var time1Minute = RegExp.$2; \n regex.exec(time2);\n var time2amPm = RegExp.$3;\n var time2Hour = RegExp.$1;\n var time2Minute = RegExp.$2;\n\n //if am/pm are different, determine and return\n if(time1amPm == 'am' && time2amPm == 'pm') return -1;\n else if(time1amPm == 'pm' && time2amPm == 'am') return 1;\n //if hours are different determine and return\n if(time1hour < time2hour) return -1;\n else if(time1hour > time2hour) return 1;\n //if minutes are different determine and return\n if(time1Minute < time2Minute) return -1;\n else if(time1Minute > time2Minute) return 1;\n\n //times are the same\n return 0;\n}",
"function compare(a, b) {\n if (a.timeInNumbers < b.timeInNumbers) {\n return -1;\n }\n if (a.timeInNumbers > b.timeInNumbers) {\n return 1;\n }\n return 0;\n}",
"leastThan(operand){\r\n return ((this.hours === operand.hours && this.minutes < operand.minutes)\r\n || (this.hours < operand.hours));\r\n }",
"function compare(a,b) {\n if (a.time < b.time)\n return -1;\n if (a.time > b.time)\n return 1;\n return 0;\n }",
"function compare(a,b) {\n if(a.time < b.time) {\n return -1;\n }\n if(a.time > b.time) {\n return 1;\n }\n return 0;\n }",
"function compareTime(t1, t2) {\n return t1 > t2;\n}",
"function timeCompare(a, b) {\n if (a.time < b.time) return -1;\n if (a.time > b.time) return 1;\n return 0;\n }",
"function dateDiffInMinutes(a, b) {\r\n var diff;\r\n var ms_minute = 1000 * 60;\r\n\tif(a instanceof Date && b instanceof Date)\r\n\t{\r\n//using UTC to discard time-zone information.\r\n var date1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate(), a.getUTCHours(), a.getUTCMinutes(), a.getUTCSeconds());\r\n var date2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate(), b.getUTCHours(), b.getUTCMinutes(), b.getUTCSeconds());\r\n\tdiff = Math.abs(Math.floor((date2 - date1) / ms_minute));\r\n//checking NaN value\r\n\t\tif (!diff){\r\n\t\t\tdiff = \"format error\";\r\n\t\t}\r\n\t} else {\r\n diff = \"wrong, not a date type\"; \r\n\t}\r\nreturn diff;\r\n}",
"compare (a, b){\n if (a.time > b.time){\n return -1;\n }\n if (a.time < b.time){\n return 1;\n }\n return 0;\n }",
"function compareDate(paramFirstDate,paramSecondDate)\n{\n\tvar fromDate = new Date(paramFirstDate);\n//\tvar hour = fromDate.getHours();\n\t\n\t\n\tvar toDate = new Date(paramSecondDate);\n\tvar diff = toDate.getTime() - fromDate.getTime();\n\treturn (diff);\n}",
"function diffh(dt2, dt1) {\r\n var diff =(dt2.getTime() - dt1.getTime()) / 1000;\r\n diff /= (60 * 60);\r\n return Math.abs(Math.round(diff));\r\n}",
"@computed('hour', 'minute', 'timeOfDay', 'hourWithinRange', 'minuteWithinRange')\n get timeValid() {\n const timeValid = this.hour && this.minute && this.timeOfDay && this.hourWithinRange && this.minuteWithinRange;\n return timeValid;\n }",
"function compare(a,b) {\n if (a.time < b.time)\n return -1;\n else if (a.time > b.time)\n return 1;\n else \n return 0;\n}",
"function compare(a, b) {\n\t\t\tif (a.when.startTime < b.when.startTime)\n\t\t\t\treturn -1;\n\t\t\tif (a.when.startTime > b.when.startTime)\n\t\t\t\treturn 1;\n\t\t\treturn 0;\n\t\t}"
] | [
"0.7367753",
"0.694777",
"0.6863364",
"0.6707897",
"0.6653542",
"0.6519639",
"0.64801466",
"0.64379394",
"0.64292246",
"0.63552475",
"0.6304667",
"0.624035",
"0.6188942",
"0.6164275",
"0.6143916",
"0.6035805",
"0.6030706",
"0.59936357",
"0.59759927",
"0.5975752",
"0.5959879",
"0.59533393",
"0.594821",
"0.59381163",
"0.58956885",
"0.58871573",
"0.58735824",
"0.58532643",
"0.58504045",
"0.5849191"
] | 0.81036144 | 0 |
if the given date is in UTC, converts it to Ottawa time. this is a 'reasonable' hack since the only two places that the js will be run will be on azure (UTC), and locally (Ottawa time) | function convertUTCtoOttawa(date) {
var d = new Date();
if (d.getHours() === d.getUTCHours()) {
d.setUTCHours(d.getUTCHours() - 5);
}
return d;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toMarketTime(date,tz){\n\t\t\t\tvar utcTime=new Date(date.getTime() + date.getTimezoneOffset() * 60000);\n\t\t\t\tif(tz && tz.indexOf(\"UTC\")!=-1) return utcTime;\n\t\t\t\telse return STX.convertTimeZone(utcTime,\"UTC\",tz);\n\t\t\t}",
"toFinnishTime(date) {\n //var date = new Date();\n date.setHours(date.getHours()+2);\n return date.toJSON().replace(/T/, ' ').replace(/\\..+/, '');\n }",
"utcToLocalTime(utcTime) {\r\n let dateIsoString;\r\n if (typeof utcTime === \"string\") {\r\n dateIsoString = utcTime;\r\n }\r\n else {\r\n dateIsoString = utcTime.toISOString();\r\n }\r\n return this.clone(TimeZone_1, `utctolocaltime('${dateIsoString}')`)\r\n .postCore()\r\n .then(res => hOP(res, \"UTCToLocalTime\") ? res.UTCToLocalTime : res);\r\n }",
"localTimeToUTC(localTime) {\r\n let dateIsoString;\r\n if (typeof localTime === \"string\") {\r\n dateIsoString = localTime;\r\n }\r\n else {\r\n dateIsoString = dateAdd(localTime, \"minute\", localTime.getTimezoneOffset() * -1).toISOString();\r\n }\r\n return this.clone(TimeZone_1, `localtimetoutc('${dateIsoString}')`)\r\n .postCore()\r\n .then(res => hOP(res, \"LocalTimeToUTC\") ? res.LocalTimeToUTC : res);\r\n }",
"static getUTCDateTime() {\n return new Date().toISOString().replace(/T/, ' ').replace(/\\..+/, '')\n }",
"function time() {\n return dateFormat(\"isoUtcDateTime\");\n}",
"function convertUTCDateToLocalDate(date) {\r\n if (IsNotNullorEmpty(date)) {\r\n var d = new Date(date);\r\n //var d = new Date(date.replace(/-/g, \"/\"))\r\n d = d - (d.getTimezoneOffset() * 60000);\r\n d = new Date(d);\r\n return d;\r\n }\r\n return null;\r\n //return d.toISOString().substr(0, 19) + \"Z\";\r\n}",
"function toUTCtime(dateStr) {\n //Date(1381243615503+0530),1381243615503,(1381243615503+0800)\n \n dateStr += \"\";\n var utcPrefix = 0;\n var offset = 0;\n var dateFormatString = \"yyyy-MM-dd hh:mm:ss\";\n var utcTimeString = \"\";\n var totalMiliseconds = 0;\n\n var regMatchNums = /\\d+/gi;\n var regSign = /[\\+|\\-]/gi;\n var arrNums = dateStr.match(regMatchNums);\n utcPrefix = parseInt(arrNums[0]);\n if (arrNums.length > 1) {\n offset = arrNums[1];\n offsetHour = offset.substring(0, 2);\n offsetMin = offset.substring(2, 4);\n offset = parseInt(offsetHour) * 60 * 60 * 1000 + parseInt(offsetMin) * 60 * 1000;\n }\n if(dateStr.lastIndexOf(\"+\")>-1){\n totalMiliseconds= utcPrefix - offset;\n } else if (dateStr.lastIndexOf(\"-\") > -1) {\n totalMiliseconds = utcPrefix + offset;\n }\n\n utcTimeString = new Date(totalMiliseconds).format(dateFormatString);\n return utcTimeString;\n}",
"function convertLocalDateToUTCDate(date, toUTC) {\n date = new Date(date);\n //Hora local convertida para UTC \n var localOffset = date.getTimezoneOffset() * 60000;\n var localTime = date.getTime();\n if (toUTC) {\n date = localTime + localOffset;\n } else {\n date = localTime - localOffset;\n }\n date = new Date(date);\n\n return date;\n }",
"function getpass_at(e) {\n const minuteRelativeTime = /(\\d+)\\s*分钟前/;\n const hourRelativeTime = /(\\d+)\\s*小时前/;\n const yesterdayRelativeTime = /昨天\\s*(\\d+):(\\d+)/;\n const shortDate = /(\\d+)-(\\d+)\\s*(\\d+):(\\d+)/;\n\n // offset to ADD for transforming China time to UTC\n const chinaToUtcOffset = -8 * 3600 * 1000;\n // offset to ADD for transforming local time to UTC\n const localToUtcOffset = new Date().getTimezoneOffset() * 60 * 1000;\n // offset to ADD for transforming local time to china time\n const localToChinaOffset = localToUtcOffset - chinaToUtcOffset;\n\n let time;\n if (e === '刚刚') {\n time = new Date();\n } else if (minuteRelativeTime.test(e)) {\n const rel = minuteRelativeTime.exec(e);\n time = new Date(Date.now() - parseInt(rel[1]) * 60 * 1000);\n } else if (hourRelativeTime.test(e)) {\n const rel = hourRelativeTime.exec(e);\n time = new Date(Date.now() - parseInt(rel[1]) * 60 * 60 * 1000);\n } else if (yesterdayRelativeTime.test(e)) {\n const rel = yesterdayRelativeTime.exec(e);\n // this time is China time data in local timezone\n time = new Date(Date.now() - 86400 * 1000 + localToChinaOffset);\n time.setHours(parseInt(rel[1]), parseInt(rel[2]), 0, 0);\n // transform back to china timezone\n time = new Date(time.getTime() - localToChinaOffset);\n } else if (shortDate.test(e)) {\n const rel = shortDate.exec(e);\n const now = new Date(Date.now() + localToChinaOffset);\n const year = now.getFullYear();\n // this time is China time data in local timezone\n time = new Date(year, parseInt(rel[1]) - 1, parseInt(rel[2]), parseInt(rel[3]), parseInt(rel[4]));\n // transform back to china timezone\n time = new Date(time.getTime() - localToChinaOffset);\n } else {\n time = new Date(e);\n }\n return time;\n }",
"function convertDateToUTC(day, month, year){\n return year + \"-\" + month + \"-\" + day + \"T00:00:00\";\n }",
"function toLocalTime(date){\n var dateMsj = new Date(date);\n var hoy = new Date();\n // var ayer = new Date(hoy.getTime() - 24*60*60*1000);\n if (hoy.getDate() === dateMsj.getDate()){\n return String(dateMsj.getHours()) + ':' + String(dateMsj.getMinutes());\n }\n else if (dateMsj.getDate() === hoy.getDate() - 1) {\n return \"Ayer\";\n }\n else {\n return dateMsj.toLocaleDateString();\n }\n}",
"function convertFromUTC(utcdate) {\n localdate = new Date(utcdate);\n return localdate;\n }",
"function getCurrentOttawaDateTimeString() {\n\n var date = convertUTCtoOttawa(new Date());\n\n var hour = date.getHours();\n hour = (hour < 10 ? \"0\" : \"\") + hour;\n\n var min = date.getMinutes();\n min = (min < 10 ? \"0\" : \"\") + min;\n\n var year = date.getFullYear();\n\n var month = date.getMonth() + 1;\n month = (month < 10 ? \"0\" : \"\") + month;\n\n var day = date.getDate();\n day = (day < 10 ? \"0\" : \"\") + day;\n\n return year + \"-\" + month + \"-\" + day + \": \" + hour + \":\" + min;\n}",
"function convertToUTCTimezone(date) {\n\t// Doesn't account for leap seconds but I guess that's ok\n\t// given that javascript's own `Date()` does not either.\n\t// https://www.timeanddate.com/time/leap-seconds-background.html\n\t//\n\t// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset\n\t//\n\treturn new Date(date.getTime() - date.getTimezoneOffset() * 60 * 1000)\n}",
"function treatAsUTC(date) {\n var result = new Date(date);\n result.setMinutes(result.getMinutes() - result.getTimezoneOffset());\n return result;\n }",
"static isoDateTime(date) {\n var pad;\n console.log('Util.isoDatetime()', date);\n console.log('Util.isoDatetime()', date.getUTCMonth().date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes, date.getUTCSeconds);\n pad = function(n) {\n if (n < 10) {\n return '0' + n;\n } else {\n return n;\n }\n };\n return date.getFullYear()(+'-' + pad(date.getUTCMonth() + 1) + '-' + pad(date.getUTCDate()) + 'T' + pad(date.getUTCHours()) + ':' + pad(date.getUTCMinutes()) + ':' + pad(date.getUTCSeconds()) + 'Z');\n }",
"function dateObjtoUT(dateTime) {\n var setUT = ((dateTime.getTime() - foundingMoment) / 1000);\n if (dateTime.toString().includes(\"Standard\")) setUT += 3600;\n return setUT;\n}",
"function set_sonix_date()\n{\n var d = new Date();\n var dsec = get_utc_sec();\n var tz_offset = -d.getTimezoneOffset() * 60;\n d = (dsec+0.5).toFixed(0);\n var cmd = \"set_time_utc(\" + d + \",\" + tz_offset + \")\";\n command_send(cmd);\n}",
"function convertUTC2Local(dateformat) {\r\n\tif (!dateformat) {dateformat = 'globalstandard'}\r\n\tvar $spn = jQuery(\"span.datetime-utc2local\").add(\"span.date-utc2local\");\r\n\t\r\n\t$spn.map(function(){\r\n\t\tif (!$(this).data(\"converted_local_time\")) {\r\n\t\t\tvar date_obj = new Date(jQuery(this).text());\r\n\t\t\tif (!isNaN(date_obj.getDate())) {\r\n\t\t\t\tif (dateformat = 'globalstandard') {\r\n\t\t\t\t\t//console.log('globalstandard (' + dateformat + ')');\r\n\t\t\t\t\tvar d = date_obj.getDate() + ' ' + jsMonthAbbr[date_obj.getMonth()] + ' ' + date_obj.getFullYear();\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//console.log('other (' + dateformat + ')');\r\n\t\t\t\t\tvar d = (date_obj.getMonth()+1) + \"/\" + date_obj.getDate() + \"/\" + date_obj.getFullYear();\r\n\t\t\t\t\tif (dateformat == \"DD/MM/YYYY\") {\r\n\t\t\t\t\t\td = date_obj.getDate() + \"/\" + (date_obj.getMonth()+1) + \"/\" + date_obj.getFullYear();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif ($(this).hasClass(\"datetime-utc2local\")) {\r\n\t\t\t\t\tvar h = date_obj.getHours() % 12;\r\n\t\t\t\t\tif (h==0) {h = 12;}\r\n\t\t\t\t\tvar m = \"0\" + date_obj.getMinutes();\r\n\t\t\t\t\tm = m.substring(m.length - 2,m.length+1)\r\n\t\t\t\t\tvar t = h + \":\" + m;\r\n\t\t\t\t\tif (date_obj.getHours() >= 12) {t = t + \" PM\";} else {t = t + \" AM\";}\r\n\t\t\t\t\t\r\n\t\t\t\t\t$(this).text(d + \" \" + t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$(this).text(d);\r\n\t\t\t\t}\r\n\t\t\t\t$(this).data(\"converted_local_time\",true);\r\n\t\t\t} else {console.log(\"isNaN returned true on \" + date_obj.getDate())}\r\n\t\t} else {console.log($(this).data(\"converted_local_time\"));}\r\n\t});\r\n}",
"function ConvertToLocalTime(dateObject, style, locale) {\n // debugger;\n // If the caller didn't specify the style, use the \"short\" time format 1:30 pm\n if (!style) {\n style = \"short\";\n }\n // If the caller didn't specify the regional locale, use the web browser default locale\n if (!locale) {\n locale = GetPreferredRegion();\n }\n var valueAsShortDate = \"\";\n var conversionRules = {\n timeStyle: style,\n ////// or if you don't want to use timeStyle, you can specify things like this\n // hour:\t\"2-digit\",\n // minute:\t\"2-digit\",\n // hour12: true,\n }\n\n if (dateObject && dateObject.toLocaleString() !== undefined) {\n valueAsShortDate = dateObject.toLocaleString(locale, conversionRules);\n }\n return valueAsShortDate;\n}",
"function dateUTC(date) {\n\treturn new Date(date.getTime() + date.getTimezoneOffset() * 60 * 1000);\n}",
"static isoDateTime(dateIn) {\n var date, pad;\n date = dateIn != null ? dateIn : new Date();\n console.log('Util.isoDatetime()', date);\n console.log('Util.isoDatetime()', date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes, date.getUTCSeconds);\n pad = function(n) {\n return Util.pad(n);\n };\n return date.getFullYear()(+'-' + pad(date.getUTCMonth() + 1) + '-' + pad(date.getUTCDate()) + 'T' + pad(date.getUTCHours()) + ':' + pad(date.getUTCMinutes()) + ':' + pad(date.getUTCSeconds()) + 'Z');\n }",
"function getTimeZone(date, long, savings, utc) {\n if (long === void 0) { long = false; }\n if (savings === void 0) { savings = false; }\n if (utc === void 0) { utc = false; }\n if (utc) {\n return long ? \"Coordinated Universal Time\" : \"UTC\";\n }\n var wotz = date.toLocaleString(\"UTC\");\n var wtz = date.toLocaleString(\"UTC\", { timeZoneName: long ? \"long\" : \"short\" }).substr(wotz.length);\n //wtz = wtz.replace(/[+-]+[0-9]+$/, \"\");\n if (savings === false) {\n wtz = wtz.replace(/ (standard|daylight|summer|winter) /i, \" \");\n }\n return wtz;\n}",
"function changeTimezone(date){\n d = new Date(date);\n var offset = -(d.getTimezoneOffset());\n var newDate = new Date(d.getTime() + offset*60000 - 19800000);\n return newDate;\n}",
"function transformUTCToTZ() {\n $(\".funnel-table-time\").each(function (i, cell) {\n var dateTimeFormat = \"MM:DD HH:mm\";\n transformUTCToTZTime(cell, dateTimeFormat);\n });\n }",
"function getLocalTime() {\n\tvar date = new Date();\n\n\tvar options = {\n timezone: 'UTC',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric'\n };\n\n return date.toLocaleString(\"ru\", options);\n}",
"function ConvertUTCtoGPSTime() {\r\n\t\tvar day = $('#UTCDay').val();\r\n\t\tvar month = $('#UTCMonth').val();\r\n\t\tvar year = $('#UTCYear').val();\r\n\t\tvar hour = $('#UTCHour').val();\r\n\t\tvar minute = $('#UTCMinute').val();\r\n\t\tvar second = $('#UTCSecond').val();\r\n\t\tvar Leap = $('#LeapSecond').val();\r\n\t\tvar GPSTime = $('#gpsTime').val();\r\n\t\t\r\n\t\tif(GPSTime.length > 0){\r\n\t\t\t\r\n\t\t\treturn GPSTime;\r\n\t\t\t\r\n\t\t} else {\r\n\t\t\t\r\n\t\tvar D = new Date(Date.UTC(year, (month -1), day, hour, minute, second));\r\n\t\tvar UNIX = (D.getTime() / 1000);\r\n\t\tvar GPSTime = UNIX - 315964800 + +Leap;\r\n\t\treturn GPSTime;\r\n\t}\r\n\t\r\n}",
"static toTargetTimezone(time) {\n return new Date(time + TARGET_TIMEZONE_OFFSET * 60 * 60 * 1000);\n }",
"function sanitizeDate (date) {\n var utc = moment.tz(date['utc'], 'America/Guayaquil');\n return {\n utc: date['utc'],\n local: utc.format()\n };\n}"
] | [
"0.69358057",
"0.66025054",
"0.6601455",
"0.65316075",
"0.65142703",
"0.6426732",
"0.6398034",
"0.63451177",
"0.6302007",
"0.63002443",
"0.6222299",
"0.61798775",
"0.6176149",
"0.6171457",
"0.6171189",
"0.61192024",
"0.60711014",
"0.6012052",
"0.60070336",
"0.5975017",
"0.5961675",
"0.5948713",
"0.5931749",
"0.5901644",
"0.59014314",
"0.5880948",
"0.58370537",
"0.5836581",
"0.5826762",
"0.58167225"
] | 0.79901075 | 0 |
returns a formatted string of the current datetime in Ottawa time | function getCurrentOttawaDateTimeString() {
var date = convertUTCtoOttawa(new Date());
var hour = date.getHours();
hour = (hour < 10 ? "0" : "") + hour;
var min = date.getMinutes();
min = (min < 10 ? "0" : "") + min;
var year = date.getFullYear();
var month = date.getMonth() + 1;
month = (month < 10 ? "0" : "") + month;
var day = date.getDate();
day = (day < 10 ? "0" : "") + day;
return year + "-" + month + "-" + day + ": " + hour + ":" + min;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getFormattedCurrentDateTime() {\n return new Date().toJSON().slice(0, 19).replace('T', ' ');\n}",
"function nowAsString() {\n return new Date().toISOString().replace(\"T\", \" \").replace(\"Z\",\" \");\n}",
"function formatCurrentDateTime() {\n // Timestamp from API seems to be GMT, which the JS Date object handles\n var dayName = ['Sunday', 'Monday', 'Tuesday', \n 'Wednesday', 'Thursday', 'Friday', 'Saturday']; \n var localNow = new Date(),\n dayString = dayName[ localNow.getDay() ],\n localTime = localNow.toLocaleTimeString();\n // console.log(\"in formatCurrentDateTime\", dayString, localTime);\n return 'as of ' + dayString + ' ' + localTime;\n}",
"function nowAsString() {\n return new Date().toISOString().substring(0, 10);\n}",
"function currentDateTime(){\n let date_ob = new Date();\n // current date\n // adjust 0 before single digit date\n let day = (\"0\" + date_ob.getDate()).slice(-2);\n // current month\n let month = (\"0\" + (date_ob.getMonth() + 1)).slice(-2);\n // current year\n let year = date_ob.getFullYear();\n // current hours\n let hours = date_ob.getHours();\n // current minutes\n let minutes = date_ob.getMinutes();\n // current seconds\n let seconds = date_ob.getSeconds();\n return year+'-'+month+'-'+day+'T'+hours+\":\"+minutes+\":\"+seconds+\"Z\";\n }",
"static currentDateToISOString()/*:string*/{\n const currentDateTime = new Date()\n currentDateTime.setMinutes(currentDateTime.getMinutes() - currentDateTime.getTimezoneOffset()) \n return currentDateTime.toISOString()\n }",
"function matter_datetime(){\n var dt = curr_date() + ' ' + curr_time() + ' -0400';\n return dt;\n }",
"function currentTime() {\n var now = new Date();\n var offset = now.getTimezoneOffset();\n var actual = now - offset;\n var str_date = new Date(actual).toLocaleDateString();\n var str_time = new Date(actual).toLocaleTimeString();\n return str_date + ' ' + str_time;\n}",
"function timeFormatFn() {\n let now = new Date();\n return now.toUTCString();\n}",
"function get_timestr() { \n\tvar d = new Date();\n\treturn d.toLocaleString() + \"<br />\\n\";\n}",
"function getCurrentTime(){\n\t//get timestamp and format it\n\t\tvar date = new Date();\n\t\tvar hours = date.getHours()\n\t\tvar ampm = (hours >= 12) ? \"PM\" : \"AM\";\n\t\thours = hours% 12||12;\n\t\tvar minutes =date.getMinutes();\n\t\tminutes = (minutes <10) ? \"0\" + minutes:minutes;\n\t\treturn \"(\" + hours + \":\" + minutes + ampm + \")\";\n}",
"function now() {\n return formatDateTime(moment());\n }",
"function nowString () {\n const stamp = new Date()\n const h = stamp.getHours().toString().padStart(2, '0')\n const m = stamp.getMinutes().toString().padStart(2, '0')\n const s = stamp.getSeconds().toString().padStart(2, '0')\n const ms = stamp.getMilliseconds().toString().padStart(3, '0')\n return `${h}:${m}:${s}.${ms}`\n}",
"static get_time() {\n return (new Date()).toISOString();\n }",
"function atualizar_tempo(){\r\n\td = new Date();\r\n\treturn d.toLocaleTimeString();\r\n}",
"getCurrentDate()\n {\n // get date:\n let date = new Date();\n // format:\n return date.toISOString().slice(0, 19).replace('T', ' ');\n }",
"static getDateTimeString() {\n return `[${moment().format(\"DD.MM.YYYY HH:mm\")}] `;\n }",
"getCurrentDateTime() {\n const today = new Date();\n let dd = today.getDate();\n let mm = today.getMonth() + 1; // January is 0!\n const yyyy = today.getFullYear();\n let hours = today.getHours();\n let minutes = today.getMinutes();\n\n if (dd < 10) {\n dd = `0${dd}`;\n }\n if (mm < 10) {\n mm = `0${mm}`;\n }\n if (hours < 10) {\n hours = `0${hours}`;\n }\n if (minutes < 10) {\n minutes = `0${minutes}`;\n }\n return `${dd}/${mm}/${yyyy}-${hours}:${minutes}`.replace(/\\//g, '').replace(/:/g, '').replace(' ', '');\n }",
"function getFormattedTime() {\n var today = new Date();\n\n return moment(today).format(\"YYYYMMDDHHmmss\");\n }",
"function getCurrentDateTime() {\n let today = new Date();\n let date = `${today.getMonth() +\n 1}/${today.getDate()}/${today.getFullYear()}`;\n\n return `${date} ${formatAMPM(today)}`;\n}",
"function getFormattedTime() {\n var today = new Date();\n //return moment(today).format(\"YYYYMMDDHHmmssSSS\");\n return moment(today).format(\"YYYYMMDDHHmmss\");\n }",
"function getDateString () {\n var time = new Date();\n // 14400000 is (GMT-4 Montreal)\n // for your timezone just multiply +/-GMT by 3600000\n var datestr = new Date(time - 14400000).toISOString().replace(/T/, ' ').replace(/Z/, '');\n return datestr;\n}",
"function prettyDate() {\n var theTimeIsNow = new Date(Date.now());\n var hors = theTimeIsNow.getHours();\n var mens = theTimeIsNow.getMinutes();\n var sex = theTimeIsNow.getSeconds();\n return hors + \":\" + mens + \":\" + sex;\n }",
"function currentTimeString(){\n\treturn new Date().toLocaleString(\"en-US\",{hour:\"numeric\",minute:\"numeric\",hour12:true,second:\"numeric\"});\n}",
"function getCurrentTimeString() {\n const date = new Date();\n return date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();\n}",
"function getCurrentDateAndTime() {\n\tvar datetime = new Date();\n\tdatetime = datetime.toISOString().replace(/[^0-9a-zA-Z]/g,'');\t// current date+time ISO8601 compressed\n\tdatetime = datetime.substring(0,15) + datetime.substring(18,19); // remove extra characters\n\treturn datetime;\n}",
"function getCurrentDateString() {\n\t\tlet date = new Date();\n\t\tlet dateString = \"\" + date.getFullYear() + \"-\" + (date.getMonth() + 1) + \"-\" + date.getDate() + \"-\" + \n\t\t\t(date.getHours() + 1) + \"-\" + (date.getMinutes() + 1);\n\n\t\treturn dateString;\n}",
"function getFormattedDate() {\n return \"[\" + new Date().toISOString().replace(/T/, ' ').replace(/\\..+/, '') + \"] \";\n}",
"function GetDateTime() {\n return new Date().toISOString()\n .replace(/T/, ' ') // replace T with a space \n .replace(/\\..+/, ''); // delete the dot and everything after\n}",
"function now() {\n return new Date().toISOString();\n}"
] | [
"0.7872003",
"0.7791804",
"0.7354191",
"0.73127687",
"0.72452915",
"0.7146017",
"0.7138602",
"0.7121298",
"0.7103326",
"0.7062861",
"0.7016527",
"0.70033497",
"0.695631",
"0.6956222",
"0.69544303",
"0.69452065",
"0.69369656",
"0.6936768",
"0.6931186",
"0.6926132",
"0.6895374",
"0.686413",
"0.6823558",
"0.6821653",
"0.6821055",
"0.68001187",
"0.6772134",
"0.676637",
"0.67653745",
"0.676448"
] | 0.8083763 | 0 |
builds a string that displays a single user's standup report | function getSingleReportDisplay(standupReport) {
var report = "*" + standupReport.userName + "* did their standup at " + standupReport.datetime + "\n";
report += "_What did you work on yesterday:_ `" + standupReport.yesterdayQuestion + "`\n";
report += "_What are you working on today:_ `" + standupReport.todayQuestion + "`\n";
report += "_Any obstacles:_ `" + standupReport.obstacleQuestion + "`\n\n";
return report;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getReportDisplay(standupReports) {\n \n if (!standupReports) {\n return \"*There is no standup data to report.*\";\n }\n\n var totalReport = \"*Standup Report*\\n\\n\";\n for (var user in standupReports) {\n var report = standupReports[user];\n totalReport += getSingleReportDisplay(report);\n }\n return totalReport;\n}",
"getReport()\r\n\t{\r\n\t\tlet report = '';\r\n\r\n\t\tmembers.forEach( (member, duration) => s += member.username + '\\t\\t' + duration + ' seconds\\n' );\r\n\t\treturn report;\r\n\t}",
"function formatTeamMembers (user) {\n\t if (user.loading) return 'Loading...';\n\n\t var markup = '<div>('+user.full_id+') '+user.name+'</div>';\n\n\t return markup;\n\t }",
"function formatresults(){\nif (this.timesup==false){//if target date/time not yet met\nvar displaystring=\"<span style='background-color: #CFEAFE'>\"+arguments[1]+\" hours \"+arguments[2]+\" minutes \"+arguments[3]+\" seconds</span> left until launch time\"\n}\nelse{ //else if target date/time met\nvar displaystring=\"Launch time!\"\n}\nreturn displaystring\n}",
"function toText(inst){\n var shownText = inst[\"value\"][\"shortName\"] + \" - \" + inst[\"value\"][\"fullName\"] + \n \"\\nTotal Launches: \"+inst[\"value\"][\"Total\"] + \n \"\\nSuccess: \"+inst[\"value\"][\"Success\"] + \n \"\\nFailure: \"+inst[\"value\"][\"Failure\"]+\n \"\\nUnknown: \"+inst[\"value\"][\"Unknown\"]+\n \"\\nPad Explosion: \"+inst[\"value\"][\"Pad Explosion\"]\n return shownText\n}",
"function getAndDisplayUserReport() {\n getUserInfo(displayUserReport);\n}",
"function summarizeUser(userName, userAge, userHasHobby){\n return (\n 'Name is ' + userName +\n ', age is ' + userAge +\n ', and the user has hobbies : ' + userHasHobby\n );\n}",
"function makeOutString() {\n var outString = \"\";\n outString += first_name + \"\\t\"\n + surname + \"\\t\"\n + patient_alert + \"\\t\"\n + education_level + \"\\t\"\n + dob + \"\\t\"\n + q1 + \"\\t\"\n + q2 + \"\\t\"\n + q3 + \"\\t\"\n + q5a + \"\\t\"\n + q5b + \"\\t\"\n + q6.toString() + \"\\t\"\n + q7.toString() + \"\\t\"\n + q8a + \"\\t\"\n + q8b + \"\\t\"\n + q9a + \"\\t\"\n + q9b + \"\\t\"\n + q10a + \"\\t\"\n + q10b + \"\\t\"\n + q11a + \"\\t\"\n + q11b + \"\\t\"\n + q11c + \"\\t\"\n + q11d + \"\\t\"\n + now.getFullYear().toString() + now.getMonth().toString() + now.getDate().toString()\n + \"\\n\";\n \n return outString;\n}",
"function displayUserReport(data) {\n $('body').append(\n \t'<p>' + 'Report: ' + data.report + '</p>');\n}",
"function RainbowProfileReport() {\r\n}",
"function displayWelcome() {\n\treturn 'This program is used to determine the length of time needed to pay off'\n\t+'a credit card balance, as well as the total interest paid. ';\n}",
"function formatresults2(){\nif (this.timesup==false){ //if target date/time not yet met\nvar displaystring=\"<span>\"+arguments[0]+\" <sup>days</sup> \"+arguments[1]+\" <sup>hours</sup> \"+arguments[2]+\" <sup>minutes</sup> \"+arguments[3]+\" <sup>seconds</sup></span> left until launch time\"\n}\nelse{ //else if target date/time met\nvar displaystring=\"\" //Don't display any text\nalert(\"Launch time!\") //Instead, perform a custom alert\n}\nreturn displaystring\n}",
"toString()\n {\n /// UC13 -- Adding the date in short representation\n const options = { year: 'numeric', month: 'long', day: 'numeric'};\n const emplpyeeStartDate = this.startDate == undefined ? \"Undefined\" : this.startDate.toLocaleDateString(\"en-US\", options);\n return `\\n ID : ${this.id} , Name : ${this.name} , Salary : ${this.salary}, Gender = ${this.gender}, Start Date : ${emplpyeeStartDate}`;\n }",
"function doStandup(bot, user, channel) {\n\n var userName = null;\n\n getUserName(bot, user, function(err, name) {\n if (!err && name) {\n userName = name;\n\n bot.startPrivateConversation({\n user: user\n }, function(err, convo) {\n if (!err && convo) {\n var standupReport = \n {\n channel: channel,\n user: user,\n userName: userName,\n datetime: getCurrentOttawaDateTimeString(),\n yesterdayQuestion: null,\n todayQuestion: null,\n obstacleQuestion: null\n };\n\n convo.ask('What did you work on yesterday?', function(response, convo) {\n standupReport.yesterdayQuestion = response.text;\n \n convo.ask('What are you working on today?', function(response, convo) {\n standupReport.todayQuestion = response.text;\n \n convo.ask('Any obstacles?', function(response, convo) {\n standupReport.obstacleQuestion = response.text;\n \n convo.next();\n });\n convo.say('Thanks for doing your daily standup, ' + userName + \"!\");\n \n convo.next();\n });\n \n convo.next();\n });\n \n convo.on('end', function() {\n // eventually this is where the standupReport should be stored\n bot.say({\n channel: standupReport.channel,\n text: \"*\" + standupReport.userName + \"* did their standup at \" + standupReport.datetime,\n //text: displaySingleReport(bot, standupReport),\n mrkdwn: true\n });\n\n addStandupData(standupReport);\n });\n }\n });\n }\n });\n}",
"function renderUserStats(UserData) {\n // console.log(\"Stats\", UserData);\n var htmlString = \"\";\n //headline stats\n htmlString += \" <div class='row padTop10 ellipsis'>\";\n htmlString += \"<div class='col-xs-4 padColumnSmall'>\";\n htmlString += \"<h2>Headline stats</h2>\";\n htmlString += \"<table class='table table-striped table-hover'>\";\n htmlString += \"<tr><td><i class='fa fa-star-half-alt'></i> Overall rating</td><td>\" + UserData.global_rating + \"</td></tr>\";\n htmlString += \"<tr><td><i class='fa fa-gamepad'></i> Battles<td>\" + UserData.battles + \"</td></tr>\";\n htmlString += \"<tr><td><i class='fa fa-arrows-alt-v'></i> Win percentage</td><td>\" + UserData.win_percent + \"%</td></tr>\";\n htmlString += \"<tr><td><i class='fa fa-user-plus'></i> Survived battles</td><td>\" + UserData.survived_battles + \"</td></tr>\";\n htmlString += \"<tr><td><i class='fa fa-star'></i> Average xp per game</td><td>\" + UserData.battle_avg_xp + \"</td></tr>\";\n htmlString += \"<tr><td><i class='fa fa-binoculars'></i> Average assisted per game</td><td>\" + UserData.avg_damage_assisted + \"</td></tr>\";\n htmlString += \"<tr><td><i class='fa fa-stop'></i> Average damage blocked per game</td><td>\" + UserData.avg_damage_blocked + \"</td></tr>\";\n htmlString += \"<tr><td><i class='fa fa-percentage'></i> Hit percent</td><td>\" + UserData.hits_percents + \"%</td></tr>\";\n htmlString += \"</table></div>\";\n\n //best stats\n htmlString += \"<div class='col-xs-4 padColumnSmall'>\";\n htmlString += \"<h2>Best stats</h2>\"\n htmlString += \"<table class='table table-striped table-hover'>\";\n htmlString += \"<tr><td> Highest Damage dealt</td><td>\" + UserData.max_damage + \"hp <img title='\" + UserData.maxDamageTank.name + \"' class='tankStatImg' src='\" + UserData.maxDamageTank.images.small_icon + \"'></img></td></tr>\";\n htmlString += \"<tr><td> Max kills</td><td>\" + UserData.max_frags + \" kills <img title='\" + UserData.maxKillsTank.name + \"' class='tankStatImg' src='\" + UserData.maxKillsTank.images.small_icon + \"'></img></td></tr>\";\n htmlString += \"<tr><td> Highest xp game</td><td>\" + UserData.max_xp + \"xp <img title='\" + UserData.maxXpTank.name + \"' class='tankStatImg' src='\" + UserData.maxXpTank.images.small_icon + \"'></img></td></tr>\";\n htmlString += \"</table></div>\";\n\n //random stats\n htmlString += \"<div class='col-xs-4 padColumnSmall'>\";\n htmlString += \"<h2>Random stats</h2>\";\n htmlString += \"<table class='table table-striped table-hover'>\";\n htmlString += \"<tr><td><i class='fa fa-skull-crossbones'></i> Total kills</td><td>\" + UserData.frags + \"</td></tr>\";\n htmlString += \"<tr><td><i class='fa fa-skull'></i> Total damage dealt</td><td>\" + UserData.damage_dealt + \"</td></tr>\";\n htmlString += \"<tr><td><i class='fa fa-times'></i> Total damage recieved</td><td>\" + UserData.damage_received + \"</td></tr>\";\n htmlString += \"<tr><td><i class='fa fa-binoculars'></i> Total tanks spotted</td><td>\" + UserData.spotted + \"</td></tr>\";\n htmlString += \"<tr><td><i class='fa fa-fire'></i> Total shots fired</td><td>\" + UserData.shots + \"</td></tr>\";\n htmlString += \"<tr><td><i class='fa fa-tree'></i> Trees pushed over</td><td>\" + UserData.trees_cut + \"</td></tr>\";\n htmlString += \"<tr><td><i class='fa fa-bomb'></i> HE hits recieved</td><td>\" + UserData.explosion_hits_received + \"</td></tr>\";\n htmlString += \"<tr><td><i class='fa fa-star'></i> Total xp earned</td><td>\" + UserData.xp + \"</td></tr>\";\n htmlString += \"</div>\";\n\n $(\"#UserStats\").html(htmlString);\n}",
"function formatresults(){\r\n if (this.timesup==false){//if target date/time not yet met\r\n var displaystring=arguments[0]+\" days \"+arguments[1]+\" hours \"+arguments[2]+\" minutes \"+arguments[3]+\" seconds left until Scott & Javaneh's Wedding\"\r\n }\r\n else{ //else if target date/time met\r\n var displaystring=\"Future date is here!\"\r\n }\r\n return displaystring\r\n}",
"function displayName(user) {\n const html = `<br><br>\n <h1>${user.first_name} ${user.last_name}</h1>\n `;\n const display = document.getElementById('display-name')\n display.innerHTML = html\n return html\n}",
"function userInformationHTML(user) { //the 'user' parameter here references the user object being returned from the github API. this contains information methods like user's name login name etc.\n//could console.log(user) to see all the different things in user object from github data API that you could display.\n return `<h2>${user.name}\n <span class=\"small-name\">\n (@<a href=\"${user.html_url}\" target= \"_blank\">${user.login}</a>)\n </span>\n </h2>\n <div class=\"gh-content\">\n <div class=\"gh-avatar\">\n <a href=\"${user.html_url} target= \"_blank\" \n <img src=\"${user.avatar_url}\" width=\"80\" height=\"80\" alt=\"${user.login}\"/>\n </a>\n </div>\n <p>Followers: ${user.followers} - Following ${user.following} <br> Repos: ${user.public_repos}</p>\n </div>`;\n}",
"function GenerateProfileHTML(user) {\r\n \r\n if(typeof user['link'] != 'undefined')\r\n return '<a href=\"' + user['link'] + '\" class=\"user-link\">by ' + user['display_name'] + '</a>';\r\n else\r\n return '<span class=\"user-link\">' + user['display_name'] + '</span>'\r\n \r\n }",
"function usersDisplayGenerator(){\n msg3 = \"<br/>\";\n if(theUsers != null){\n msg3 = msg3 + \"<b>Here is the display of the users</b><br/>\";\n msg3 = msg3 + \"<table><tr><th>Ord.No</th><th>Username</th><th>email</th></tr>\";\n var count = Object.keys(theUsers).length;\n for(x=0; x<count; x++){\n //console.log(\"Checking user:\" + theUsers[x].username);\n msg3 = msg3 + \"<tr><td>\" + x + \"</td><td>\" + theUsers[x].username + \"</td><td>\" \n + theUsers[x].email + \"</td></tr>\";\n }\n msg3 = msg3 + \"</table>\";\n } else {\n msg3 = msg3 + \"<h3>Remember!</h3><br/>\";\n msg3 = msg3 + \"Treating the users fairly is important!<br/>\";\n msg3 = msg3 + \"Click Refresh to see the users:<br/>\";\n }\n \n msg3 = msg3 + '|<a href=\"/adminpanel.html\">Refresh!</a>|<br/>';\n return msg3;\n}",
"function createUserString(userObj) {\n\n \n return (`name: ${userObj.name}, age: ${userObj.age}, language: ${userObj.language}`);\n }",
"function generateSummary() {\n // Add .repeat method for padEnd method\n if (!String.prototype.repeat) {\n String.prototype.repeat = function(count) {\n 'use strict';\n if (this == null)\n throw new TypeError('can\\'t convert ' + this + ' to object');\n\n var str = '' + this;\n // To convert string to integer.\n count = +count;\n // Check NaN\n if (count != count)\n count = 0;\n\n if (count < 0)\n throw new RangeError('repeat count must be non-negative');\n\n if (count == Infinity)\n throw new RangeError('repeat count must be less than infinity');\n\n count = Math.floor(count);\n if (str.length == 0 || count == 0)\n return '';\n\n // Ensuring count is a 31-bit integer allows us to heavily optimize the\n // main part. But anyway, most current (August 2014) browsers can't handle\n // strings 1 << 28 chars or longer, so:\n if (str.length * count >= 1 << 28)\n throw new RangeError('repeat count must not overflow maximum string size');\n\n var maxCount = str.length * count;\n count = Math.floor(Math.log(count) / Math.log(2));\n while (count) {\n str += str;\n count--;\n }\n str += str.substring(0, maxCount - str.length);\n return str;\n }\n }\n\n // Add .padEnd() method to better format strings\n String.prototype.padEnd = function padEnd(targetLength,padString) {\n targetLength = targetLength>>0; //floor if number or convert non-number to 0;\n padString = String((typeof padString !== 'undefined' ? padString : ' '));\n if (this.length > targetLength) {\n return String(this);\n }\n else {\n targetLength = targetLength-this.length;\n if (targetLength > padString.length) {\n padString += padString.repeat(targetLength/padString.length); //append to original to ensure we are longer than needed\n }\n return String(this) + padString.slice(0,targetLength);\n }\n };\n\n // Important PPMG worksheet add-on to change disclaimer based on who is signing out\n var pathologist = this.getField(\"Casestatus\").valueAsString;\n var ppmd = \"\";\n if (pathologist == \"Chandra Krishnan\") {\n ppmd = \"PROFESSIONAL INTERPRETATION PERFORMED BY CLINICAL PATHOLOGY ASSOCIATES (3445 Executive Center Drive, Suite 250, Austin, TX 78731. CLIA#45D2052154)\\n\\n\";\n } else if (pathologist == \"Michael Cascio\") {\n ppmd = \"PROFESSIONAL INTERPRETATION PERFORMED BY PENNINSULA PATHOLOGISTS MEDICAL GROUP LABORATORY (383 East Grand Ave, Suite A, South San Francisco, CA 94080. Ph. 650-616-2951. CLIA#05D1029487)\\n\\n\";\n } else {\n ppmd = \"\";\n }\n\n var viability = this.getField(\"Viability\").valueAsString;\n var lymphs = this.getField(\"Diff#1\").valueAsString;\n var blym = this.getField(\"CD19 LYMPHS\").valueAsString;\n var tlym = this.getField(\"CD3 or CD2\").valueAsString;\n var mono = this.getField(\"Diff#2\").valueAsString;\n var gran = this.getField(\"Diff#3\").valueAsString;\n var blast = this.getField(\"Diff#4\").valueAsString;\n var debris = this.getField(\"Diff#5\").valueAsString;\n var plratio = getField(\"Plasma cell K/L\").valueAsString;\n\n \n var bioCD19 = this.getField(\"bioCD19\").valueAsString;\n var bioCD20 = this.getField(\"bioCD20\").valueAsString;\n var bioCD22 = this.getField(\"bioCD22\").valueAsString;\n var bioCD33 = this.getField(\"bioCD33\").valueAsString;\n var bioCD38 = this.getField(\"bioCD38\").valueAsString;\n\n var wild1 = this.getField(\"Wildcard1\").valueAsString;\n var wild2 = this.getField(\"Wildcard2\").valueAsString;\n var wild3 = this.getField(\"Wildcard3\").valueAsString;\n \n var abnorm = '';\n var abnorm2 = '';\n var abnorm3 = '';\n if (wild1 == \"Abnormal cells\"){abnorm = this.getField(\"Diff#6\").value}; \n if (wild2 == \"Abnormal cells #2\"){abnorm2 = this.getField(\"Diff#7\").value};\n if (wild3 == \"Abnormal cells #3\"){abnorm3 = this.getField(\"Diff#8\").value};\n \n var baso = '';\n if (wild1 == \"Basophils\"){baso = this.getField(\"Diff#6\").value} \n else if (wild2 == \"Basophils\"){baso = this.getField(\"Diff#7\").value} \n else if (wild3 == \"Basophils\"){baso = this.getField(\"Diff#8\").value};\n \n var hemat = '';\n if (wild1 == \"Hematogones\"){hemat = this.getField(\"Diff#6\").value} \n else if (wild2 == \"Hematogones\"){hemat = this.getField(\"Diff#7\").value} \n else if (wild3 == \"Hematogones\"){hemat = this.getField(\"Diff#8\").value};\n \n var plasma = '';\n if (wild1 == \"Plasma cells\"){plasma = this.getField(\"Diff#6\").value} \n else if (wild2 == \"Plasma cells\"){plasma = this.getField(\"Diff#7\").value} \n else if (wild3 == \"Plasma cells\"){plasma = this.getField(\"Diff#8\").value};\n \n var other = '';\n if (wild1 == \"Other\"){other = this.getField(\"Diff#6\").value} \n else if (wild2 == \"Other\"){other = this.getField(\"Diff#7\").value} \n else if (wild3 == \"Other\"){other = this.getField(\"Diff#8\").value};\n \n var nk = '';\n if (wild1 == \"NK-cells\"){nk = this.getField(\"Diff#6\").value} \n else if (wild2 == \"NK-cells\"){nk = this.getField(\"Diff#7\").value} \n else if (wild3 == \"NK-cells\"){nk = this.getField(\"Diff#8\").value};\n \n var nonheme = '';\n if (wild1 == \"Non-heme\"){nonheme = this.getField(\"Diff#6\").value} \n else if (wild2 == \"Non-heme\"){nonheme = this.getField(\"Diff#7\").value} \n else if (wild3 == \"Non-heme\"){nonheme = this.getField(\"Diff#8\").value};\n \n var s = \n \"Flow cytometry differential (excluding unclassified events)\\n\\n\"+\n \"Viability:\".padEnd(24)+ viability +\"%\\n\"+\n \"Lymphocytes:\".padEnd(24)+ lymphs +\"%\\n\"+\n \" B-cells:\".padEnd(24)+ blym +\"%\\n\"+\n \" T-cells:\".padEnd(24)+ tlym +\"%\\n\"+\n \"Monocytes:\".padEnd(24)+ mono +\"%\\n\"+\n \"Granulocytes:\".padEnd(24)+ gran +\"%\\n\"+\n \"Blasts:\".padEnd(24)+ blast +\"%\\n\"+\n \"CD45-neg/Debris:\".padEnd(24)+ debris +\"%\\n\";\n \n if (abnorm != ''){\n s = s+\"Abnormal:\".padEnd(24)+abnorm+\"%\\n\"};\n if (abnorm2 != ''){\n s = s+\"Abnormal #2:\".padEnd(24)+abnorm2+\"%\\n\"};\n if (abnorm3 != ''){\n s = s+\"Abnormal #3:\".padEnd(24)+abnorm3+\"%\\n\"};\n if (baso != ''){\n s = s+\"Basophils:\".padEnd(24)+baso+\"%\\n\"};\n if (hemat != ''){\n s = s+\"Hematogones:\".padEnd(24)+hemat+\"%\\n\"};\n if (plasma != ''){\n s = s+\"Plasma cells:\".padEnd(24)+plasma+\"% (K:L ratio = \"+plratio+\") \\n\"};\n if (other != ''){\n s = s+\"Others:\".padEnd(24)+other+\"%\\n\"};\n if (nk != ''){\n s = s+\"NK-cells:\".padEnd(24)+nk+\"%\\n\"};\n if (nonheme != ''){\n s = s+\"Non-hematolymphoid:\".padEnd(24)+nonheme+\"%\\n\"};\n\n var b = \"Biomarker Status (% of abnormal cells expressing therapeutic targets): \\n\";\n if (bioCD19 != ''){\n b = b+\"CD19 expression:\".padEnd(24)+bioCD19+\"%\\n\"};\n if (bioCD20 != ''){\n b = b+\"CD20 expression:\".padEnd(24)+bioCD20+\"%\\n\"};\n if (bioCD22 != ''){\n b = b+\"CD22 expression:\".padEnd(24)+bioCD22+\"%\\n\"};\n if (bioCD33 != ''){\n b = b+\"CD33 expression:\".padEnd(24)+bioCD33+\"%\\n\"};\n if (bioCD38 != ''){\n b = b+\"CD38 expression:\".padEnd(24)+bioCD38+\"%\\n\"};\n if ((bioCD19 == '') && (bioCD20 == '') && (bioCD22 == '') && (bioCD33 == '') && (bioCD38 == '')){\n b = \"\"\n }; \n \n s = s + \"\\nResults:\\n\"+this.getField(\"Finaldx\").valueAsString+\"\\n\\n\"+\n b+\"\\n\"+\n \"Interpretation: \" + this.getField(\"Interp text\").valueAsString+ \" \\n\\n\"+ \n \"Antibodies tested: Total, \" + this.getField(\"Abtotal\").valueAsString + \": \" + this.getField(\"AbList\").valueAsString+\"\\n\\nTECHNICAL WORK PERFORMED BY PENNINSULA PATHOLOGISTS MEDICAL GROUP LABORATORY (383 East Grand Ave, Suite A, South San Francisco, CA 94080. Ph. 650-616-2951. CLIA#05D1029487). Flow cytometry testing was developed and the performance characteristics determined by PPMG Flow cytometry laboratory. They have not been cleared or approved by the U.S. Food and Drug Administration. The FDA has determined that such clearance or approval is not necessary. These tests are used for clinical purposes. They should not be regarded as investigational or for research. This laboratory is certified under the Clinical Laboratory Improvement Amendments of 1988 (CLIA-88) as qualified to perform high complexity clinical laboratory testing.\\n\\n\"+\n ppmd+\n \"Some antigens evaluated by flow cytometry may also be evaluated by immunohistochemistry when deemed medically necessary. Concurrent evaluation by IHC on tissue sections is indicated in some cases in order to further characterize or categorize tumors. IHC may also be necessary to correlate immunophenotype with cell morphology and determine extent of involvement, spatial pattern, and focality of potential disease distribution.\";\n\n \n \n console.clear();\n console.println(s);\n console.show();\n //app.alert(s);\n }",
"function formatStats(attack, defense) {\n return \"(<span class='attack'>\" + attack + \"</span>\" + \"/\" + \"<span class='defense'>\" + defense + \"</span>\" + \")\";\n}",
"function showUserGifts(){\r\n \r\n // get from database mission type assigned for this day and appends to HTML\r\n appendGifts(userGifts,'neutral')\r\n }",
"function displayEntireNameForUser(user) {\n if (!user) {\n return '';\n }\n\n let displayName = '@' + user.username;\n const fullName = getFullName(user);\n\n if (fullName && user.nickname) {\n displayName = react__WEBPACK_IMPORTED_MODULE_10___default.a.createElement(\"span\", null, '@' + user.username, ' - ', react__WEBPACK_IMPORTED_MODULE_10___default.a.createElement(\"span\", {\n className: \"light\"\n }, fullName + ' (' + user.nickname + ')'));\n } else if (fullName) {\n displayName = react__WEBPACK_IMPORTED_MODULE_10___default.a.createElement(\"span\", null, '@' + user.username, ' - ', react__WEBPACK_IMPORTED_MODULE_10___default.a.createElement(\"span\", {\n className: \"light\"\n }, fullName));\n } else if (user.nickname) {\n displayName = react__WEBPACK_IMPORTED_MODULE_10___default.a.createElement(\"span\", null, '@' + user.username, ' - ', react__WEBPACK_IMPORTED_MODULE_10___default.a.createElement(\"span\", {\n className: \"light\"\n }, '(' + user.nickname + ')'));\n }\n\n return displayName;\n}",
"function DisplayTaunt() {\n\t\tif (props.powerPro.boss === 0) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t\"Well! Come in intruder\" says the cyborg without looking at you,\n\t\t\t\t\t\t\"Give me a second to finish... Ah done!\"\n\t\t\t\t\t</p>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t\"Let me take a look at you... I see... You're here to stop my master\n\t\t\t\t\t\tand kill me. Oh where are my manners I am Dr. Crackle and while it\n\t\t\t\t\t\twould be interesting to learn your name we should get started. Good\n\t\t\t\t\t\tluck! Mwah. Mwah Ha Ha HA HA!\n\t\t\t\t\t</p>\n\t\t\t\t</>\n\t\t\t);\n\t\t} else {\n\t\t\treturn (\n\t\t\t\t<p>\n\t\t\t\t\t\"Oh look it's {props.name.name}. What? Surprised I know your name? I\n\t\t\t\t\thacked your brain while you were unconscious before I threw you out\n\t\t\t\t\twith the other scrap. Looks like Polina is not doing her job. Seems\n\t\t\t\t\tthat I need to give her another chance at it! Ha Ha HA HA!\"\"\n\t\t\t\t</p>\n\t\t\t);\n\t\t}\n\t}",
"get dashboard(){\n return (\n `<div class=\"swTable__dashbox\">\n <div class=\"swTable__dash-heading\">Tallest Human</div>\n <div class=\"swTable__dash-result\">${this.findTallestHuman(this.humans).name} @ ${this.getMeters(this.findTallestHuman(this.humans).height)}</div>\n </div>\n <div class=\"swTable__dashbox\">\n <div class=\"swTable__dash-heading\">Most Common Hair Color</div>\n <div class=\"swTable__dash-result\">${this.findCommonHairColor(this.humans)}</div>\n </div>\n <div class=\"swTable__dashbox\">\n <div class=\"swTable__dash-heading\">Average Mass</div>\n <div class=\"swTable__dash-result\">${this.findAverageMass(this.humans)}<i>kg</i></div>\n </div>`\n )\n }",
"getAsString() { \r\n if(!Lang.isNull(this.staging)) { \r\n if((Lang.isNull(this.staging.tumorSize) || Lang.isUndefined(this.staging.tumorSize)) &&\r\n (Lang.isNull(this.staging.nodeSize) || Lang.isUndefined(this.staging.nodeSize)) &&\r\n (Lang.isNull(this.staging.metastasis) || Lang.isUndefined(this.staging.metastasis)))\r\n {\r\n return `#staging`;\r\n } else { \r\n const tString = this.getTumorSizeString(this.staging);\r\n const nString = this.getNodeSizeString(this.staging);\r\n const mString = this.getMetastasisString(this.staging);\r\n // Don't put any spaces -- the spaces should be dictated by the current reason and date\r\n return `#staging[T${tString}N${nString}M${mString}]`;\r\n }\r\n }\r\n }",
"function getSummonerStatsSummary(){\n\n}",
"function GGTRCC_RenderBattingSummary (aPLSO, aBattingGraphInfo)\r\n{\r\n\tvar lRet=\"\";\r\n\t\r\n\tlRet += \"<span class='GadgetStatsHeading'>Career Batting Summary</span>\";\r\n\t\t\r\n\tif (0 == aBattingGraphInfo.length)\r\n\t{\r\n\t\tlRet += \"<br>There is no Batting record for this player<br><br>\";\r\n\t}\r\n\telse\r\n\t{\r\n\t\t//\r\n\t\t// Do we have enough entries to warrent a graph?\r\n\t\t//\r\n\t\tif (1 < aBattingGraphInfo.length)\r\n\t\t{\r\n\t\t\tlRet += GGTRCC_PlayerLTGraph_MakeBattingGraphHTML (aBattingGraphInfo) + \"<br><br>\";\r\n\t\t}\r\n\t\t\t\r\n\t\tlRet += GGTRCC_RenderBattingTotals (aPLSO.mLifetimeBattingTotals) + \"<br><br><br>\";\r\n\t}\r\n\r\n\treturn (lRet);\r\n}"
] | [
"0.68696153",
"0.67091095",
"0.58703655",
"0.58037055",
"0.5690617",
"0.56840926",
"0.56504303",
"0.5626813",
"0.55754954",
"0.5566497",
"0.55646896",
"0.5559293",
"0.54887426",
"0.5483268",
"0.5476705",
"0.5465037",
"0.54605424",
"0.5443541",
"0.54333824",
"0.5423004",
"0.54099447",
"0.54072976",
"0.539538",
"0.53862536",
"0.5372017",
"0.536952",
"0.5350074",
"0.5340502",
"0.53395617",
"0.5324475"
] | 0.75525874 | 0 |
return "Hello, " + person; } | function greeter(person) {
return "Hi " + person.firstName + " " + person.lastName;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function person(name) {\n return \"I think\" + name + \"is a cool guy\";\n}",
"function greeter2(person) {\n return \"Aloha \" + person + \"!\";\n}",
"function greeter(person) {\n return \"Hello, \" + person;\n}",
"hello(someone) {\n return \"hello, \"+ someone\n }",
"function sayName(person) {\n return \"Hey! \" + person.name;\n}",
"function greet() {\n\treturn `Hello, I'm ${this.name}!`; \n}",
"function firstName(first) {\n return (\"Hi \" + first);\n}",
"function sayHi(name, age) {\n return \"Hi. My name is \" + name + \" and I'm \" + age + \" years old\";\n}",
"greet() {\n return 'Yo ' + this.firstname;\n }",
"function greet(name){\n return 'hi ' + name\n}",
"function helloHow() {\r\n return 'Hello, ' + 'how are you?'\r\n}",
"function getName() {\n return \"Hello, my name is Irvan\";\n}",
"function greet(person) {\n console.log(`Hi ${person}`);\n}",
"function sayHi() {\n return `Hello, ${this.name}`;\n}",
"function sayHello (greeting) {\n return (`${greeting} my name is ${this.name}`);\n}",
"function greet(name) {\n\n return \"Hello, \" + name + \"!\";\n\n}",
"function sayMyName(myName) {\n return (\"Hello, my name is \" + myName);\n}",
"sayHello() {\n return \"Hello, \" + this.firstname + \" \" + this.lastname;\n }",
"function greet(firstName, lastName){\n return 'Hello ' + firstName + ' ' + lastName;\n}",
"function greeting2(firstName, lastName){\n return 'hello ' + firstName + \" \" + lastName;\n}",
"function greeter(name){\n return \"Hello, \" + name + \"!\";\n}",
"function hello(who) {\r\n return 'Let me introduce: ' + who;\r\n }",
"function greet(name){\r\n return \"hello \"+name;\r\n}",
"function greet(name)\n{\n return \"Hello \" + name + \"!\";\n}",
"function greet(person) {\n console.log(\"Hi \" + person.firstName + \"!\");\n}",
"greet() {\n return `${this.name} says hello.`;\n }",
"greet() {\n return `${this.name} says hello.`;\n }",
"function getName() {\n return \"Hello my name is Arief muhamad\";\n}",
"greet() {\n return `${this.name} says hello.`;\n }",
"function greeter02(name) {\n return \"Hello, \" + name;\n}"
] | [
"0.83308357",
"0.82673615",
"0.82393354",
"0.7925421",
"0.7888341",
"0.7842417",
"0.7716826",
"0.7624223",
"0.76173675",
"0.7573261",
"0.7572713",
"0.7570779",
"0.7568589",
"0.75617194",
"0.7533274",
"0.751613",
"0.7516",
"0.75083584",
"0.75056255",
"0.74988335",
"0.74911076",
"0.74774665",
"0.74716264",
"0.7460667",
"0.7458579",
"0.7441101",
"0.7441101",
"0.7439209",
"0.7438368",
"0.7433606"
] | 0.8291874 | 1 |
COUNT items in each brand | countItemsInBrand(getBrandArr, getItemsArr) {
for (let i = 0; i < getBrandArr.length; i++) {
var tmp = getItemsArr.filter((item) => item.subcategoryArr.id === getBrandArr[i].id).length;
getBrandArr[i].itemCount = tmp;
}
return getBrandArr;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"countOfItems() {\n var count = 0\n for (var sku in this.items) {\n var li = this.items[sku]\n count = Number(count) + Number(li.quantity)\n }\n return count\n }",
"itemsCount() {\n return this._checkoutProducts\n .map((checkoutProduct) => checkoutProduct.count)\n .reduce((totalCount, count) => totalCount + count, 0);\n }",
"countItems() {\n this.elementsCounted = {};\n \t for(let name of this.items) {\n \t\tthis.elementsCounted[name] = this.elementsCounted[name] ? this.elementsCounted[name] + 1 : 1;\n }\n }",
"function getNumItemsPerCategory() {\n // Get items per farming season\n const perSeason = [];\n farmSeasonFilters.forEach((season) => {\n const currentSeasonItems = produceListings.filter(\n (listing) => listing.season === season,\n );\n perSeason.push(currentSeasonItems.length);\n });\n setSeasonItems(perSeason);\n\n // Get items per item type (agency or standard)\n const numAgencyItems = produceListings.filter((listing) => listing.hasAgencyPrice).length;\n const numStandardItems = produceListings.length - numAgencyItems;\n setItemsPerItemType([numAgencyItems, numStandardItems]);\n\n // Get items per produce type\n const perProdType = [];\n produceTypeFilters.forEach((prodType) => {\n const currentProdItems = produceListings.filter(\n (listing) => listing.produceType === prodType,\n );\n perProdType.push(currentProdItems.length);\n });\n setProdItems(perProdType);\n\n // Get items per price range (0-15, 15-30, 30-45, 45-60, 60-75)\n const perPrice = [0, 0, 0, 0, 0];\n produceListings.forEach((listing) => {\n const thisPrice = listing.palletPrice;\n if (thisPrice >= priceOptions[0] && thisPrice <= priceOptions[1]) {\n perPrice[0] += 1;\n }\n if (thisPrice >= priceOptions[1] && thisPrice <= priceOptions[2]) {\n perPrice[1] += 1;\n }\n if (thisPrice >= priceOptions[2] && thisPrice <= priceOptions[3]) {\n perPrice[2] += 1;\n }\n if (thisPrice >= priceOptions[3] && thisPrice <= priceOptions[4]) {\n perPrice[3] += 1;\n }\n if (thisPrice >= priceOptions[4] && thisPrice <= priceOptions[5]) {\n perPrice[4] += 1;\n }\n });\n setPriceItems(perPrice);\n }",
"count() {\n let sum = this.items.length;\n return sum;\n }",
"countItems(type) {\n let key = this.getKey(type)\n return this.items[key].length\n }",
"getItemCount() {\n let count = 0;\n for (const data of this.facetBatches.values()) {\n count += data.length;\n }\n return count;\n }",
"GetItemCount() {}",
"get count() {\n\t\t\treturn this.items\n\t\t\t\t.map(item => item.qty)\n\t\t\t\t.reduce((total, qty) => total += qty, 0);\n\t\t}",
"function countProductsOnPage() {\n $('.displayed__localCount').html(document.querySelectorAll('.collection__item').length + ' of');\n}",
"function countBy(items, groupName) {\r\n\tlet counts = [];\r\n\tfor(let item of items) {\r\n\t\tlet name = groupName(item);\r\n\t\tlet known = counts.findIndex(c => c.name == name);\r\n\t\tif(known == -1) {\r\n\t\t\tcounts.push({name, count: 1});\r\n\t\t} else {\r\n\t\t\tcounts[known].count++;\r\n\t\t}\r\n\t}\r\n\treturn counts;\r\n}",
"count(state) {\n const cart = state.cart || [];\n let count = 0;\n for (const slug in cart) {\n if (cart.hasOwnProperty(slug)) {\n count += cart[slug];\n }\n }\n return count;\n }",
"function numberOfItemTypes(numbOfUniqueItems){\n //takes in the shopping cart as input\n //returns the number of unique item types in the shopping cart\n var ItemsThatAreUnique = [];\n for (let i = 0; i < numbOfUniqueItems.items.length; i++) {//took a while to find .items.length inorder to make this one work\n if (ItemsThatAreUnique.includes(numbOfUniqueItems.items[i].title)){\n //only need to check for one thing that each item has inorder to count them as unique\n continue;\n }\n ItemsThatAreUnique.push(numbOfUniqueItems.items[i].title);// put findings into empty array\n }\n return ItemsThatAreUnique.length;//returns all unique items in the object\n}",
"function countBricks () {\n var brickIds = Crafty(\"Brick\");\n counts = {normals: 0, diamonds: 0};\n\n for (var i = 0; i < brickIds.length; i++) {\n if (brickIsNormal(Crafty(brickIds[i]).type)) {\n counts.normals++;\n }\n if (brickIsDiamond(Crafty(brickIds[i]).type)) {\n counts.diamonds++;\n }\n }\n\n return counts;\n}",
"function countItem(item, callbacker) {\n var q = new Parse.Query(Item);\n q.equalTo(\"category\", item).count({\n success: function(count) {\n callbacker(null, count);\n }\n })\n }",
"function countSales(pop){\n\n // it would probably be better if every purchase of a beer got stored in the database as a number\n // then this would go faster\n var counting = []; // array where beer_id and the number of times it has been bought is stored\n var itemlist = []; // array where beer_id is stored so it's possible to use indexOf\n\n\n for (var i = 0; i < pop.length; i++) {\n var if_in_mapp= itemlist.indexOf(pop[i].beer_id);// gives what index an element has or -1 if it's not in the array\n\n if (if_in_mapp==-1){\n var itemBought = {\"beer_id\" :pop[i].beer_id, \"times_bought\": 1};\n counting.push(itemBought); // store the item in counted...\n itemlist.push(pop[i].beer_id);\n\n }\n\n else { // every time loop finds that a beverage has been bought 1 time or more it adds +1 in times it has been bought\n for (var j =0; j < itemlist.length; j++){\n if (pop[i].beer_id==counting[j].beer_id){\n counting[j].times_bought+=1;\n\n }\n\n }\n }\n\n }\n\n return counting;\n}",
"function getLegendCounts(d) {\n brandCounts[d['Manufacturer']]['count']--;\n if (brandCounts[d['Manufacturer']]['count'] <= 0) {\n hiddenBrands.push(d['Manufacturer']);\n }\n}",
"get itemCount() {\n return this._itemsByElement.size;\n }",
"function countBy(items, groupName) {\n\tlet counts = [];\n\tfor (let item of items) {\n\t\tlet name = groupName(item);\n\t\tlet known = counts.findIndex(c => c.name == name);\n\t\tif (known == -1) {\n\t\t\tcounts.push({ name, count: 1 });\n\t\t} else {\n\t\t\tcounts[known].count++;\n\t\t}\n\t}\n\treturn counts;\n}",
"function num_availHouses(ndx, group) {\n dc.dataCount('.dc-data-count')\n .crossfilter(ndx)\n .groupAll(group)\n .transitionDuration(500);\n}",
"function num_items(name) {\r\n\tvar item_count = character.items.filter(item => item != null && item.name == name).reduce(function (a, b) {\r\n\t\treturn a + (b[\"q\"] || 1);\r\n\t}, 0);\r\n\r\n\treturn item_count;\r\n}",
"function itemCount(arr, el) {\n\t\tlet count = {};\n\t\tarr.forEach(function(item){\n\t\t\tcount[item] = count[item] ? count[item] + 1 : 1;\n\t\t});\n\t\treturn count[el];\n\t}",
"function num_items(name) {\n var item_count = character.items.filter(item => item != null && item.name == name).reduce(function(a, b) {\n return a + (b[\"q\"] || 1);\n }, 0);\n\n return item_count;\n}",
"function calculateSummaryOfAllItems(basketItems) {\n const counts = {};\n for (var i = 0; i < basketItems.length; i++) {\n counts[basketItems[i]] = 1 + (counts[basketItems[i]] || 0);\n };\n return counts;\n}",
"function countBy(items, groupName) {\n let counts = [];\n for (let item of items) {\n let name = groupName(item);\n let known = counts.findIndex(c => c.name == name);\n if (known == -1) {\n counts.push({ name, count: 1 });\n } else {\n counts[known].count++;\n }\n }\n return counts;\n}",
"function countCombinations() {\n var sets = [];\n for (var i in filteredInfo) {\n var genres = filteredInfo[i].Genre.split(\",\");\n for (var j in genres) {\n var genre = genres[j].trim();\n if (genres_count[genre] != undefined)\n genres_count[genre] += 1;\n else\n genres_count[genre] = 1;\n }\n }\n for (var i in genres_count)\n sets.push({\"Genre\": i, Size: genres_count[i], label: i});\n createDonutChart(sets);\n}",
"getCount(category) {\n let count = [];\n let types = this.getAllPossible(category);\n let slot = this.getCategoryNumber(category);\n\n types.forEach(() => {\n count.push(0);\n });\n\n mushroom.data.forEach((mushroom) => {\n types.forEach((type, index) => {\n if (mushroom[slot] === type.key) {\n count[index]++;\n }\n });\n });\n\n return count;\n }",
"getProductCount(array) {\n let productCount = 0;\n array.value.splitEntries.map((item) => {\n productCount += Number(item.qty);\n });\n return productCount;\n }",
"function HowMany() {\r\n shirts.forEach(shirt => {\r\n SIZESFOREACH[shirt.size]++;\r\n });\r\n\r\n return SIZESFOREACH;\r\n}",
"function countCartItems(arr) {\n let count = 0;\n arr.map(item => {\n count += item.qauntity\n })\n return count;\n}"
] | [
"0.67231584",
"0.6563493",
"0.63034475",
"0.62030816",
"0.6187013",
"0.60876316",
"0.60441923",
"0.6032323",
"0.59975",
"0.59230274",
"0.5913571",
"0.59081304",
"0.590752",
"0.5882206",
"0.5869655",
"0.5868861",
"0.5865619",
"0.5865054",
"0.58574206",
"0.5835562",
"0.5833918",
"0.58227307",
"0.5812632",
"0.5780321",
"0.5748023",
"0.5742234",
"0.5689573",
"0.56750953",
"0.5670736",
"0.5664956"
] | 0.7266751 | 0 |
Page Title Vertical Align | function pageTitle(){
if ( $(window).width() >= 1000 && pageTitleResized == false ) {
$('#ins-page-title').each(function() {
var marginTop = 55;
var extra = 0;
var titleInner = $(this).find( '.ins-page-title-inner' );
var titleInnerHeight = titleInner.height();
if( $('#header').length ) {
extra = 80 / 2;
}
if( $('#topbar').length ) {
extra += $('#topbar').height() / 2;
}
if( $('.bottom-nav-wrapper').length ) {
extra += $('.bottom-nav-wrapper').height() / 2;
}
marginTop = extra;
$(this).find( '.ins-page-title-inner' ).css( 'margin-top', marginTop );
pageTitleResized = true;
});
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fTitlePlacement (elem, ht, vPos) {\n fAnimateHeight (elem, ht);\n fAnimateTop (elem, vPos);\n }",
"function fTitlePlacement (elem, ht, vPos) {\n fAnimateHeight (elem, ht);\n fAnimateTop (elem, vPos);\n }",
"function getPageTitle () {\n return title;\n }",
"function createTitlePages() {\n let titleInfo = [\n { num:'1', title:'General Provisions' },\n { num:'2', title:'Elections'},\n { num:'3', title:'Legislature'},\n { num:'4', title:'State Organization and Administration, Generally'},\n { num:'5', title:'State Financial Administration'},\n { num:'6', title:'County Organization and Administration'},\n { num:'7', title:'Public Officers and Employees'},\n { num:'8', title:'Public Proceedings and Records'},\n { num:'9', title:'Public Property, Purchasing and Contracting'},\n { num:'10', title:'Public Safety and Internal Security'},\n { num:'11', title:'Agriculture and Animals'},\n { num:'12', title:'Conservation and Resources'},\n { num:'13', title:'Planning and Economic Development'},\n { num:'14', title:'Taxation'},\n { num:'15', title:'Transportation and Utilities'},\n { num:'16', title:'Intoxicating Liquor'},\n { num:'17', title:'Motor and Other Vehicles'},\n { num:'18', title:'Education'},\n { num:'19', title:'Health'},\n { num:'20', title:'Social Services'},\n { num:'21', title:'Labor and Industrial Relations'},\n { num:'22', title:'Banks and Financial Institutions'},\n { num:'23', title:'Corporations and Partnerships'},\n { num:'23a', title:'Other Business Entities'},\n { num:'24', title:'Insurance'},\n { num:'25', title:'Professions and Occupations'},\n { num:'25a', title:'General Business Provisions'},\n { num:'26', title:'Trade Regulation and Practice'},\n { num:'27', title:'Uniform Commercial Code'},\n { num:'28', title:'Property'},\n { num:'29', title:'Decedents\\' Estates'},\n { num:'30', title:'Guardians and Trustees'},\n { num:'30a', title:'Uniform Probate Code'},\n { num:'31', title:'Family'},\n { num:'32', title:'Courts and Court Officers'},\n { num:'33', title:'Evidence'},\n { num:'34', title:'Pleadings and Procedure'},\n { num:'35', title:'Appeal and Error'},\n { num:'36', title:'Civil Remedies and Defenses and Special Proceedings'},\n { num:'37', title:'Hawaii Penal Code'},\n { num:'38', title:'Procedural and Supplementary Provisions'}\n ];\n\n let re = new RegExp(/^([0-9]+)/i);\n\n let allPromises = [];\n\n //loop thru titles\n for (let i=0; i<titleInfo.length; i++) {\n\n let division = '';\n let volume = '';\n\n let r = titleInfo[i].num.match(re);\n let titleNumOnly = parseInt(r[1]);\n \n if (titleNumOnly < 22) division = '1';\n else if (titleNumOnly < 28) division = '2';\n else if (titleNumOnly < 32) division = '3';\n else if (titleNumOnly < 37) division = '4';\n else division = '5';\n\n if (titleNumOnly < 6) volume = '1';\n else if (titleNumOnly < 10) volume = '2';\n else if (titleNumOnly < 13) volume = '3';\n else if (titleNumOnly < 15) volume = '4';\n else if (titleNumOnly < 19) volume = '5';\n else if (titleNumOnly < 20) volume = '6';\n else if (titleNumOnly < 22) volume = '7';\n else if (titleNumOnly < 24) volume = '8';\n else if (titleNumOnly < 25) volume = '9';\n else if (titleNumOnly < 26) volume = '10';\n else if (titleNumOnly < 27) volume = '11';\n else if (titleNumOnly < 32) volume = '12';\n else if (titleNumOnly < 37) volume = '13';\n else volume = '14';\n\n // Create meta\n let meta = {\n hrs_structure: {\n division: division,\n volume: volume,\n title: titleInfo[i].num,\n chapter: '',\n section: ''\n },\n type: 'title',\n menu: {\n hrs: {\n identifier: `title${titleInfo[i].num}`,\n name: `Title ${titleInfo[i].num}. ${titleInfo[i].title}`\n }\n },\n weight: (5 * (i + 1)),\n title: titleInfo[i].title,\n full_title: `Title ${titleInfo[i].num}. ${titleInfo[i].title}`\n };\n let allMeta = Object.assign({}, meta, addCustomMetaAllFiles);\n\n //write file\n let path = Path.join(destFileDir, `title-${titleInfo[i].num}`, '_index.md');\n allPromises.push(writeFile(path, \"---\\n\" + yaml.safeDump(allMeta) + \"---\\n\"));\n \n } \n\n return Promise.all(allPromises).then((val)=>val);\n}",
"function updatePageTitle() {\n $rootScope.page_title = Mayocat.applicationName + ' | ' + $translate('routes.title.' + $route.current.titleTranslation);\n }",
"function titlePage(){\n\t\t$('.title-page').html('<h2 class=\"text-center\">'+objet_concours[last_concours]+'</h2>');\n\t}",
"getFormattedTitle() {\n return this.info.title.toUpperCase();\n }",
"function showTitle(title, selection, plotWidth, chartMargin, titleMargin) {\n var center = chartMargin.left + plotWidth/2,\n textHeight = 10,\n titleTop = titleMargin[1] + textHeight,\n attachedTitle = attachByClass(\"text\", selection, \"title\"); \n\n attachedTitle.entered()\n .attr(\"class\", \"title\")\n .attr(\"text-anchor\", \"middle\");\n\n attachedTitle\n .attr(\"transform\", \"translate(\" + center + \",\" + titleTop +\")\")\n .text(title);\n }",
"function title() {\n\n push();\n imageMode(CORNER);\n image(titleImage,0,0,windowWidth,windowHeight);\n textFont(\"Times New Roman\");\n textSize(40);\n text(\"THE CODED \\nMULTIDISCIPLINARY GALLERY\",width*0.56,height*0.3);\n textSize(20);\n fill(0);\n text(\"Huyen Tran Pham\",width*0.56,height*0.6);\n text(\"Click to move around in the gallery\",width*0.56,height*0.65);\n pop();\n\n}",
"function setPageTitle() {\n const titleHTML = document.getElementById('title');\n titleHTML.innerText = pageTitle;\n}",
"function initTitle() {\n if (Vue.prototype.hasOwnProperty('$createTitle')) {\n return;\n }\n\n /**\n * Generates the document title out of the given VueComponent and parameters\n *\n * @param {String} [identifier = null]\n * @param {...String} additionalParams\n * @returns {string}\n */\n Vue.prototype.$createTitle = function createTitle(identifier = null, ...additionalParams) {\n const baseTitle = this.$tc('global.sw-admin-menu.textShopwareAdmin');\n const pageTitle = this.$tc(this.$route.meta.$module.title);\n\n const params = [baseTitle, pageTitle, identifier, ...additionalParams].filter((item) => {\n return item !== null && item.trim() !== '';\n });\n\n return params.reverse().join(' | ');\n };\n }",
"function pageTitle($rootScope, $timeout) {\n return {\n // link: function(scope, element) {\n // var listener = function(event, toState, toParams, fromState, fromParams) {\n // var themeSettings = localStorageService.get('themeSettings');\n // // Default title\n // if(themeSettings == null || typeof(themeSettings) == \"undefined\") {\n // headerTitle = \"Panda\";\n // } else {\n // headerTitle = themeSettings.data.headerTitle;\n // }\n //\n // if(themeSettings.data.headerTitle == null) {\n // themeSettings.data.headerTitle = \"Panda\";\n // }\n //\n // var title = headerTitle;\n // // Create your own title pattern\n // if (toState.data && toState.data.pageTitle) title = 'Panda | ' + toState.data.pageTitle;\n // $timeout(function() {\n // // element.text(title);\n // });\n // };\n // $rootScope.$on('$stateChangeStart', listener);\n }\n}",
"function setPageTitle() {\n const title = document.getElementById('title');\n title.innerText = pageTitle;\n}",
"function setPageTitle() {\n const title = document.getElementById('title');\n title.innerText = pageTitle;\n}",
"function titleText(title) {\n pageTitle.textContent = title;\n}",
"function getPageTitle($location) {\n var name = $location.path().split(\"/\").slice(-1)[0].split(\".\")[0];\n var words = name.split('_');\n var title = '';\n for (var i = 0; i < words.length; i++) {\n title += ' ' + words[i].charAt(0).toUpperCase() + words[i].substr(1);\n }\n return title.substr(1);\n}",
"function titleize() {\n\n}",
"async getTitlePage() {\n const pageTitle = await this.page.title();\n console.log('\\t HomePage Title =', pageTitle);\n assert.strictEqual(pageTitle, \"Home loan borrowing power calculator | ANZ\");\n console.log('\\t Home Page title validation successful \\t \\n \\t Browser is open \\t');\n }",
"function getPageTitle(url) {\n return path.basename(url);\n}",
"function setPageTitle (newTitle) {\n title = newTitle;\n }",
"function getTitle() {\n return chalk.blue(\n figlet.textSync(\"Weather app\", {\n horizontalLayout: \"full\",\n font: \"banner\",\n })\n );\n}",
"function setTitle() {\n var dateString = dateFormat(new Date(), 'HH:MM:ss');\n document.title = title + ' - ' + APP_PACKAGE_INFO.version;\n }",
"function setPageTitle(){\n\tif(pmgConfig.pmgSubTitle){\n\t\tdocument.tile = pmgConfig.siteTitle + ' - ' + pmgConfig.pmgSubTitle;\n\t}\n\telse{\n\t\tdocument.tile = pmgConfig.siteTitle;\n\t}\n}",
"function subtitleSidePosition(subWidth, titleWidth, subScale, titleScale, marginBetween) {\nvar subHalfWidth = (subWidth*subScale)/2;\nvar titleHalfWidth = (titleWidth*titleScale)/2;\n// Calculate how far from the center this title needs to be\nvar centerOffset = subHalfWidth + titleHalfWidth + marginBetween;\nvar offset = ($(window).width()/2) - centerOffset;\n\nreturn offset;\n}",
"function setPageTitle() {\n const titleElement = document.getElementById('title');\n titleElement.innerText = pageTitle;\n}",
"function setTitle() {\n dt = formatDate(myDateFormat, appstate.date);\n dtextra = (appstate.date2 === null) ? '' : ' to ' + formatDate(myDateFormat, appstate.date2);\n $('#maptitle').html(\"Viewing \" + vartitle[appstate.ltype] +\n \" for \" + dt + \" \" + dtextra);\n $('#variable_desc').html(vardesc[appstate.ltype]);\n}",
"getPageTitle(){\n return elementUtil.dogetPageTitle(constants.LOGIN_PAGE_TITLE)\n }",
"function pageTitle($rootScope, $timeout) {\r\n return {\r\n link: function(scope, element) {\r\n var listener = function(event, toState, toParams, fromState, fromParams) {\r\n // Default title - load on Dashboard 1\r\n var title = 'SmpleGHPrj | Responsive Admin Theme';\r\n // Create your own title pattern\r\n if (toState.data && toState.data.pageTitle) title = 'SmpleGHPrj | ' + toState.data.pageTitle;\r\n $timeout(function() {\r\n element.text(title);\r\n });\r\n };\r\n $rootScope.$on('$stateChangeStart', listener);\r\n }\r\n }\r\n}",
"function getSectionTitle(title) {\n // section title layout\n return title;\n}",
"function displayTitle(){\n push();\n textFont(`Blenny`);\n textSize(70);\n fill(breadFill.r, breadFill.g, breadFill.b);\n textLeading(53);\n text(`GET\\nTHAT\\nBREAD`, 1050, 612);\n pop();\n}"
] | [
"0.6289992",
"0.6289992",
"0.620483",
"0.6144102",
"0.6076659",
"0.597595",
"0.5893578",
"0.586862",
"0.5790285",
"0.575313",
"0.5747338",
"0.5740914",
"0.5738883",
"0.5738883",
"0.5716012",
"0.57087487",
"0.5697498",
"0.56831956",
"0.5679236",
"0.5669497",
"0.5648148",
"0.56459606",
"0.56445056",
"0.56426144",
"0.5633709",
"0.5619147",
"0.5616998",
"0.55817986",
"0.55634344",
"0.55414385"
] | 0.6583696 | 0 |
Boot up the Native Messaging and establish a connection with the host, indicated by hostName | function connect() {
var hostName = "com.google.chrome.example.echo";
port = chrome.runtime.connectNative(hostName);
port.onMessage.addListener(onNativeMessage);
port.onDisconnect.addListener(onDisconnected);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"connect() {\n\t\tthis._communicator.connect();\n\t}",
"function connect() {\n console.log(\"Connecting to `\" + localStorage.broker + \"` on port `\" + localStorage.port + \"`\");\n var clientId = \"myclientid_\" + parseInt(Math.random() * 100, 10);\n\n client = new Messaging.Client(localStorage.broker,\n parseInt(localStorage.port),\n clientId);\n client.onConnectionLost = onConnectionLost;\n client.onMessageArrived = onMessageArrived;\n\n var connectOptions = new Object();\n connectOptions.useSSL = false;\n connectOptions.cleanSession = true;\n connectOptions.onSuccess = onConnect;\n if (localStorage.username != \"\") {\n connectOptions.userName = localStorage.username;\n }\n if (localStorage.password != \"\") {\n connectOptions.password = localStorage.password;\n }\n client.connect(connectOptions);\n}",
"function connect()\n{\n console.log(\"Connecting to `\" + localStorage.broker + \"` on port `\" + localStorage.port + \"`\");\n var clientId = \"myclientid_\" + parseInt(Math.random() * 100, 10);\n\n client = new Messaging.Client(localStorage.broker,\n parseInt(localStorage.port),\n clientId);\n client.onConnectionLost = onConnectionLost;\n client.onMessageArrived = onMessageArrived;\n\n var connectOptions = new Object();\n connectOptions.useSSL = false;\n connectOptions.cleanSession = true;\n connectOptions.onSuccess = onConnect;\n if (localStorage.username != \"\") {\n connectOptions.userName = localStorage.username;\n }\n if (localStorage.password != \"\") {\n connectOptions.password = localStorage.password;\n }\n client.connect(connectOptions);\n}",
"function connect()\n{\n console.log(\"Connecting to `\" + localStorage.broker + \"` on port `\" + localStorage.port + \"`\");\n var clientId = \"myclientid_\" + parseInt(Math.random() * 100, 10);\n\n client = new Messaging.Client(localStorage.broker,\n parseInt(localStorage.port),\n clientId);\n client.onConnectionLost = onConnectionLost;\n client.onMessageArrived = onMessageArrived;\n\n var connectOptions = new Object();\n connectOptions.useSSL = false;\n connectOptions.cleanSession = true;\n connectOptions.onSuccess = onConnect;\n if (localStorage.username != \"\") {\n connectOptions.userName = localStorage.username;\n }\n if (localStorage.password != \"\") {\n connectOptions.password = localStorage.password;\n }\n client.connect(connectOptions);\n}",
"function startPeerCommunications(peerName) {\n\n // start server with port zero so it will get new port for us.\n startServerSocket(0);\n\n serverport = server.address().port;\n console.log(\" server listens port :\" + serverport);\n\n Mobile('StartBroadcasting').callNative(peerName, serverport, function (err) {\n console.log(\"StartPeerCommunications returned : \" + err + \", port: \" + port);\n if (err != null && err.length > 0) {\n Mobile('ShowToast').callNative(\"Can not Start boardcasting: \" + err, true, function () {\n //callback(arguments);\n });\n }\n });\n }",
"async connect() {\n this._mav = await this._getMavlinkInstance();\n this._socket = await this._getSocket();\n this._registerMessageListener();\n this._registerSocketListener();\n }",
"connect() {\n communicator.sendMessage('connected');\n }",
"function spConnect() {\n\n // use 'PushManager' to request a new PushServer URL endpoint for 'Mail' notifications:\n endpointRequest = navigator.push.register();\n // the DOMRequest returns 'successfully':\n endpointRequest.onsuccess = function( event ) {\n // extract the endpoint object from the event:\n endpoint = event.target.result;\n\n // if it is the first registration, need to register\n // the 'pushEndpoint' with the UnifiedPush server.\n if ( endpoint.pushEndpoint ) {\n // assemble the metadata for registration with the UnifiedPush server\n var metadata = {\n deviceToken: mailEndpoint.channelID,\n simplePushEndpoint: mailEndpoint.pushEndpoint\n };\n\n var settings = {\n success: function() {\n //success handler\n alert('Success')\n },\n error: function() {\n //error handler\n }\n };\n\n settings.metadata = metadata;\n\n // register with the server\n UPClient.registerWithPushServer(settings);\n } else {\n console.log(\"'Endpoint' was already registered!\");\n }\n };\n // set the notification handler:\n navigator.setMessageHandler( \"push\", function( message ) {\n if ( message.channelID === mailEndpoint.channelID ) {\n // let's react on the endpoint\n }\n });\n }",
"function startServer(){\n listDevices.startAttendaceServer(UserName);\n startMessageServer();\n console.log('did');\n}",
"function ConnectToDevice(address) {\n\n var tmpAddress = address;\n Mobile('Connect').callNative(address, function (err, port) {\n console.log(\"ConnectToDevice called with port \" + port + \", error: \" + err);\n\n if (err != null && err.length > 0) {\n Mobile('ShowToast').callNative(\"Can not Connect: \" + err, true, function () {\n //callback(arguments);\n });\n }else if (port > 0){\n console.log(\"Starting client socket at : \" + port);\n startClientSocket(port,tmpAddress);\n }\n });\n }",
"function init () {\n log.info('Hyperion Remote starting...')\n createSSDPHandler()\n createWebsocketHandler()\n createWindow()\n}",
"connectToHost (host, cb) {\n if (host.Host === 'localhost') {\n setImmediate(() => {\n this.client = redis.createClient()\n this.client.on('ready', () => {\n cb()\n })\n })\n } else {\n this.connectToRemoteHost(host, cb)\n }\n }",
"function Connect ()\n{\n\tvar DeviceName = GetProjectPartName ();\n\tTargetInterface.message (\"## Connect to \" + DeviceName);\n\tTargetInterface.message (\"## Connect to \" + DeviceName + \" - done\");\n}",
"start () {\n\t\tthis._logger.info(`Connecting to ${this.host}...`)\n\t\tthis._params.host = this.host\n\t\tthis._connection.connect(this._params)\n\t\tthis.started = true\n\t}",
"function attach_socket() {\n var wsUri = \"ws://\" + window.location.hostname + \"/controller\";\n update_connection_status(\"Connection to \" + wsUri + \" ...\")\n websocket = new WebSocket(wsUri);\n websocket.onopen = function (evt) { onOpen(evt) };\n websocket.onclose = function (evt) { onClose(evt) };\n websocket.onmessage = function (evt) { onMessage(evt) };\n websocket.onerror = function (evt) { onError(evt) };\n}",
"function init() {\n\t\t_startBridge(_bridgePort);\n\t}",
"initiateConnect(connectedAs) {\n\t\tthis.setState({connectedAs});\n\t\t\n\t\t// now open up the socket to the server\n\t\ttry {\n\t\t\tthis.clientConnection = new clientConnection(connectedAs);\t\t\n\t\t} catch (ex) {\n\t\t\n\t\t}\n\t}",
"function preInititiation(){\n\tsignalServer = new WebSocket(signalServerURL); // Set to local websocket for now\n\tsignalServer.binaryType = \"arraybuffer\";\n\n\tvar peerMediaElements = document.getElementById(\"peer-media-banner\");\n\tvar peerMediaDiv = document.createElement(\"div\");\n\tvar peerMediaVideo = document.createElement(\"img\");\n\tpeerMediaVideo.setAttribute(\"class\", \"z-depth-5\");\n\tpeerMediaVideo.setAttribute(\"height\", \"150\");\n\tpeerMediaVideo.src = avatarPath;\n\tpeerMediaVideo.id = \"user-media-\"+peerID;\n\tpeerMediaDiv.setAttribute(\"class\", \"col s4\");\n\tpeerMediaDiv.appendChild(peerMediaVideo);\n\tpeerMediaElements.appendChild(peerMediaDiv);\n\n\t\tif (peerID != senderID){\n\t\t\tcurrentPeer = 0; // Since server ID of the host will always be 0 for a new room\n\t\t\t// addPeer(); // Will resume this function while on the feature of video calling\n\t\t\tconsole.log(\"initiating connection with host peer\")\n\t\t\t// initiatePeerConnection(peerID);\n\t\t}else{\n\t\t\tnavigator.getUserMedia(constraints, function(stream){\n\t\t\t\tlocalStream = stream;\n\t\t\t\tconsole.log(localStream);\n\t\t\t\tgotLocalStream(localStream, currentPeer);\n\t\t\t}, fallbackUserMedia);\n\t\t\tconsole.log(signalServer.readyState);\n\t\t\t// signalServer.send(JSON.stringify({\"addRoom\": true, \"roomID\": peerID}));\n\t\t}\n\t// };\n\t// }, 2000);\n}",
"function connect()\r\n {\r\n statusEl.textContent = `Connecting to ${settings.ip}:${settings.port}`;\r\n\r\n ws = new WebSocket(`ws://${settings.ip}:${settings.port}`);\r\n ws.addEventListener('open', e => {\r\n connectionEl.classList.add('active');\r\n statusEl.textContent = `Connected`;\r\n // screenAwaker.enable();\r\n });\r\n ws.addEventListener('close', e => {\r\n connectionEl.classList.remove('active');\r\n statusEl.textContent = `Connection lost: ${e.reason}`;\r\n // screenAwaker.disable();\r\n });\r\n ws.addEventListener('error', e => {\r\n connectionEl.classList.remove('active');\r\n statusEl.textContent = `Connection error`;\r\n setTimeout( connect, 3000 );\r\n });\r\n ws.addEventListener('message', e => {\r\n const msg = JSON.parse(e.data);\r\n if (msg.type === 'settings') {\r\n settings = { ...settings, ...(msg.payload) };\r\n console.log(`Settings: ${settings}`);\r\n }\r\n else if (msg.type === 'flash') {\r\n console.log('Flash');\r\n targetEl.classList.remove('invisible');\r\n setTimeout(hideTarget, settings.duration);\r\n }\r\n });\r\n }",
"function setup(){\n\t\n\n\t//Make sure to change the IP\n\tvar ros = new ROSLIB.Ros({\n\t\t//Use the localhost one if running in on the laptop only\n\t\t//Use the local IP if accessing it from tablet\n\t\t\n\t\t//url: 'ws://192.168.0.21:9090'\n\t\turl: 'ws://192.168.8.217:9090'\n\t\t//url: 'ws://192.168.5.159:9090'\n\t\t//url: 'ws://localhost:9090'\n\t\t//url: 'ws://10.120.114.241:9090'\n\t\t//url: 'ws://172.20.10.3:9090'\n\t});\n\n\tros.on('connection',function(){\n\t\tconsole.log('Connecting to websocket server.');\n\t});\n\n\tros.on('error',function(error){\n\t\tconsole.log('Error connecting to websocket server: ', error);\n\t});\n\n\tros.on('close',function(){\n\t\tconsole.log('Connection to websocket closed.');\n\t});\n\n\tmain_topic = new ROSLIB.Topic({\n\t\tros: ros,\n\t\tname: '/Game_MAKI',\n\t\tmessageType: 'std_msgs/String'\n\n\t});\n\n\tstart_breathing();\n}",
"connect() {\n this.ws = new WebSocket(this.host);\n this.ws.on('open', this.onConnect.bind(this));\n this.ws.on('close', this.onDisconnect.bind(this));\n this.ws.on('error', this.onError.bind(this));\n }",
"function start() {\n\tsocket.connect(port, host);\n}",
"function connect_() {\n if (channel) {\n // If there is already an existing channel, close the existing ports.\n channel.port1.close();\n channel.port2.close();\n channel = null;\n }\n\n channel = new MessageChannel();\n window.postMessage(\n PORT_SETUP_MSG, '*' /* target origin */,\n [channel.port2] /* transfer */);\n channel.port1.onmessage = function(event) {\n if (event.data == DISCONNECT_MSG) {\n channel = null;\n }\n try {\n var message = JSON.parse(event.data);\n if (message['id'] && callbackMap_[message['id']]) {\n callbackMap_[message['id']](message);\n delete callbackMap_[message['id']];\n }\n } catch (e) {\n }\n };\n }",
"initialiseChat() {\n this.waitForSocketConnection(() => {\n WebSocketInstance.fetchMessages(\n this.props.username,\n this.props.chat.chatId\n );\n });\n WebSocketInstance.connect(this.props.chat.chatId);\n }",
"function onhostconnect(err, result) {\n if (err) return fn(err);\n\n var socket = result.socket;\n\n var s = socket;\n if (opts.secureEndpoint) {\n // since the proxy is connecting to an SSL server, we have\n // to upgrade this socket connection to an SSL connection\n if (!tls) tls = __webpack_require__(16);\n opts.socket = socket;\n opts.servername = opts.host;\n opts.host = null;\n opts.hostname = null;\n opts.port = null;\n s = tls.connect(opts);\n }\n\n fn(null, s);\n }",
"function ConnectWbemServer(hostName, strClass, dictProperties)\n{\n\tconsole.log(\"ConnectWbemServer hostName=\"+hostName+\" strClass=\"+strClass);\n\n\t// If a machine name given in the XID before \"@\".\n\tif(hostName != \"\" ) {\n\t\tconsole.log(\"ConnectWbemServer: WMI connect to explicit hostName:\"+hostName);\n\t\treturn CreateWbemConnector(hostName);\n\t}\n\n\t// Possibly other cases depending on the class name.\n\tvar wmiHostname = dictProperties[\"Name\"];\n\tconsole.log(\"ConnectWbemServer: strClass=\"+strClass+\" wmiHostname=\"+wmiHostname);\n\tif( ( strClass == \"CIM_ComputerSystem\") && ( ! IsBrowserHostname(wmiHostname) ))\n\t{\n\t\tvar remoteHostname = dictProperties[\"Name\"];\n\t\tconsole.log(\"ConnectWbemServer: WMI connect to CIM_ComputerSystem remoteHostname=\"+remoteHostname);\n\t\treturn CreateWbemConnector(remoteHostname);\n\t}\n\n\tconsole.log(\"ConnectWbemServer: WMI connect local\");\n\treturn CreateWbemConnector(\".\");\n\t//svcWbem = wbemLocat.ConnectServer(\".\", \"root\\\\cimv2\");\n\t//return svcWbem;\n}",
"function connect() {\n var target = $(\"#target-id\").val();\n conn = peer.connect(target);\n conn.on(\"open\", function () {\n updateConnectedTo(target);\n prepareMessaging();\n conn.on(\"data\", function (data) {\n displayMessage(data.message, data.timestamp, conn.peer);\n });\n console.log(conn);\n });\n}",
"async connect(){\n\t\ttry {\n\t\t\tthis.token = await Global.key('token');\n\t\t\tLogger.info(\"Connecting to Ably message service...\");\n\t\t\tthis.client = new Ably.Realtime({\n\t\t\t\tclientId: Global.mac, \n\t\t\t\ttoken: this.token,\n\t\t\t\tauthUrl: 'https://mystayapp.ngrok.io/devices/v1/tokens', \n\t\t\t\tauthMethod: 'POST',\n\t\t\t\tauthHeaders: {\n\t\t\t\t\t'x-device-id': Global.mac\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// Here we are setting up the various listeners for Ably realtime\n\t\t\t// client connection state events:\n\t\t\t// https://ably.com/documentation/realtime/connection\n\t\t\t// These should all be bound to this class in order\n\t\t\t// to call methods on the class itself:\n\n\t\t\tthis.client.connection.on(this.stateChange.bind(this));\n\t\t\tthis.client.connection.on('connected', this.connected.bind(this));\n\t\t\tthis.client.connection.on('disconnected', this.disconnected.bind(this));\n\n\t\t} catch(err){\n\t\t\tLogger.error(err);\n\t\t}\n\t}",
"publishMasterHost() {\n this.log.info('Bonjour: Casting Master mode server on port: '+this.settings.WEBSERVER_PORT+' name: '+this.masterServiceName);\n this.mastetService = this.bonjour.publish({ name: this.masterServiceName, type: 'piLaz0rTag', port: this.settings.WEBSERVER_PORT })\n }",
"function initiateConnection() {\n localPeer = new Peer();\n localPeer.remoteHandshake = sendHandshakeToRemote;\n\n // Data channels\n localPeer.useDataChannel = true;\n localPeer.dataChannel.outbound_onOpen = outboundChannelStatusChange;\n localPeer.dataChannel.outbound_onClose = outboundChannelStatusChange;\n localPeer.dataChannel.inbound_onMessage = messageFromRemote;\n\n // Initialize for a new connection, including generating an offer\n localPeer.InitializeConnection();\n}"
] | [
"0.5986448",
"0.58668643",
"0.5841325",
"0.5841325",
"0.5785808",
"0.57438385",
"0.5655347",
"0.5622621",
"0.56021273",
"0.55080324",
"0.54482317",
"0.54211783",
"0.5416453",
"0.54157996",
"0.5405801",
"0.535047",
"0.53294265",
"0.5316533",
"0.5309893",
"0.5305062",
"0.5300018",
"0.5291534",
"0.5269527",
"0.5265193",
"0.5258431",
"0.52440464",
"0.5237755",
"0.52336985",
"0.5225178",
"0.52211404"
] | 0.60736364 | 0 |
When disconnected from host, set port to null value so that it may reconnect at the next request | function onDisconnected() {
console.log("Failed to connect: " + chrome.runtime.lastError.message);
port = null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static set port(value) {}",
"repickHost() {\n this.host = null;\n var newHostId = Object.keys(this.socketNames)[0];\n this.host = newHostId ? newHostId : null;\n }",
"reset() {\n this.socket = this._newSocket();\n }",
"get port() { return this._port; }",
"reassignHostSocket() {\n this.hostSocket = undefined;\n\n if (this.playerMap.getActivePlayerCount() > 0) {\n this.setHostSocketAndNotify(this.playerMap.getActivePlayerList()[0].socket);\n }\n }",
"disconnect() {\n if (this.proto == 'tcp') {\n this._api.disconnect(this.socketId);\n }\n }",
"static get port() {}",
"constructor(host = 'localhost', port = 4444) {\n\t\tsuper()\n\n\t\tthis.debug = false\n\t\tthis.host = host\n\t\tthis.port = port\n\n\t\tthis._connecting = null\n\t\tthis._idCounter = 1\n\t\tthis._promises = {}\n\t\tthis._socket = undefined\n\t}",
"close() {\n if (this.connectStream) {\n this.connectStream.cancel();\n this.connectStream = null;\n }\n\n this.serverAddress = null;\n this.hostname = null;\n this.address = null;\n this.callbacks = null;\n this.creds = null;\n }",
"reset() {\n const protocol = this.getBestProtocolMatch();\n\n this.setHangingProtocol(protocol);\n }",
"setPort(port) {\n if (port === undefined || port === null || port === \"\") {\n this._port = undefined;\n }\n else {\n this.set(port.toString(), \"PORT\");\n }\n }",
"setPort(port) {\n if (port === undefined || port === null || port === \"\") {\n this._port = undefined;\n }\n else {\n this.set(port.toString(), \"PORT\");\n }\n }",
"SOCKET_RECONNECT_DECLINED(state) {\n // eslint-disable-next-line\n console.log(\"%c socket_on_reconnect_declined\", \"color:green\");\n // TODO: Find way to reset whole state\n // state.user = null;\n state.userId = null;\n state.name = null;\n state.color = null;\n state.users = [];\n state.broadcastMessages = [];\n state.rooms = null;\n state.messages = [];\n state.room = null;\n state.isHost = false;\n router.push(\"/login\");\n }",
"_reset() {\n this.log(\"Closing connections.\");\n this._stopTrackingTask();\n this._partialResponse = \"\";\n this._closeSocket(this._socket);\n this._closeSocket(this._dataSocket);\n // Set a new socket instance to make reconnecting possible.\n this.socket = new Socket();\n }",
"@action\n modulePortFinishedConnecting() {\n if (get(this, 'connectingToPort')) {\n this.addConnection(get(this, 'connectingFromPort'), get(this, 'connectingToPort'));\n }\n set(this, 'connectingFromPort', null);\n set(this, 'connectingToPort', null);\n }",
"function stripPortNumber(host) {\r\n\t\t\t\treturn host.split(':')[0];\r\n\t\t\t}",
"function resetConnection() {\n //close socket\n GEPPETTO.MessageSocket.close();\n //clear message handlers, all tests within module should have performed by time method it's called\n GEPPETTO.MessageSocket.clearHandlers();\n //connect to socket again for next test\n GEPPETTO.MessageSocket.connect(GEPPETTO.MessageSocket.protocol + window.location.host + '/' + window.BUNDLE_CONTEXT_PATH + '/GeppettoServlet');\n }",
"constructor() {\n this.conn = null;\n this.log = util.log.dialer();\n }",
"removeConnectTimeout() {\r\n var self = this;\r\n clearTimeout(self.connectTimeout);\r\n }",
"disconnect() {\n this.shouldReconnect = false;\n this._listenersMap = new Map();\n this.closeAllConnections()\n }",
"reconnect() {\n if ( this.socket )\n {\n this.socket.close();\n delete this.socket;\n }\n\n this.connect();\n }",
"constructor () {\n this.conn = null\n this.log = util.log.dialer()\n }",
"constructor () {\n this.conn = null\n this.log = util.log.dialer()\n }",
"disconnect() {\n window.removeEventListener('message', this.onConnectionMessageHandler);\n this.closePort();\n }",
"_resetState() {\n this.anonymousConnectionFailed = false;\n this.connectionFailed = false;\n this.lastErrorMsg = undefined;\n this.disconnectInProgress = undefined;\n }",
"constructor(port) {\n this.port = port;\n }",
"disconnect() {\n this.connection.destroy()\n }",
"_resetState() {\n this.anonymousConnectionFailed = false;\n this.connectionFailed = false;\n this.lastErrorMsg = undefined;\n this.disconnectInProgress = undefined;\n }",
"reset() {\n this.heartbeatTask && clearInterval(this.heartbeatTask);\n this.heartbeatTask = null;\n this.healthCheck && clearInterval(this.healthCheck);\n this.healthCheck = null;\n (this.socket \n && this.socket.unref().end().destroy() \n && (this.socket = null));\n this.buffer = Buffer.alloc(0);\n this.totalLength = -1;\n }",
"function disconnect(){\r\n\tconn.disconnect();\r\n}"
] | [
"0.66604096",
"0.6570076",
"0.64096314",
"0.6310094",
"0.6273757",
"0.6256183",
"0.6221901",
"0.6196667",
"0.6173534",
"0.6066822",
"0.6055589",
"0.6055589",
"0.6052514",
"0.6027057",
"0.60181713",
"0.60075426",
"0.5991197",
"0.5986552",
"0.5976626",
"0.5960655",
"0.59246415",
"0.59179485",
"0.59179485",
"0.5914387",
"0.5906173",
"0.5888545",
"0.5886876",
"0.5881348",
"0.5870695",
"0.5854486"
] | 0.6781185 | 0 |
uploaded images on mobile are typically oriented incorrectly. loadImage corrects the image orientation. | orientImage(file, callback) {
window.loadImage(
file,
img => callback(img.toDataURL("image/png")),
{ canvas: true, orientation: true }
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function loadImage(image) {\n if (artwork.orientation == 'landscape') {\n context.drawImage(\n image,\n Math.abs(canvas.width / 2 - artwork.longDimension/2),\n Math.abs(canvas.height / 2 - artwork.shortDimension / 2),\n artwork.longDimension,\n artwork.shortDimension\n );\n } else { \n context.drawImage(\n image,\n Math.abs(canvas.width / 2 - artwork.shortDimension / 2),\n Math.abs(canvas.height / 2 - artwork.longDimension/2),\n artwork.shortDimension,\n artwork.longDimension,\n );\n }\n}",
"function imageOrientation() {\n\tlet images = document.getElementsByTagName('img')\n\n\tfunction setOrientationState(image) {\n\t\tlet orientation = 'square'\n\n\t\tif (image.width > image.height) {\n\t\t\torientation = 'landscape'\n\t\t} else if (image.height > image.width) {\n\t\t\torientation = 'portrait'\n\t\t}\n\n\t\tstate.set('orientation', orientation, image)\n\t}\n\n\tfor (let i = 0; i < images.length; i++) {\n\t\tif (!images[i].naturalWidth || !images[i].naturalHeight) {\n\t\t\timages[i].addEventListener('load', function () {\n\t\t\t\tsetOrientationState(this)\n\t\t\t})\n\t\t} else {\n\t\t\tsetOrientationState(images[i])\n\t\t}\n\t}\n}",
"loadImage() {\n if (this.imageType === \"inline\") {\n if (this.imageLoaded === false || this.imageReloader === true) {\n this.getImageFile(this.smartImageElem);\n }\n } else if (this.imageType === \"background\") {\n this.smartImageElem.classList.add(imageFlexClass);\n if (this.imageLoaded === false || this.imageReloader === true) {\n this.getImageFile(this.smartImageElem);\n }\n }\n }",
"_handleImageLoad() {\n if (!this.attachmentViewer || !this.attachmentViewer.attachment) {\n return;\n }\n const refs = this._getRefs();\n const image = refs[`image_${this.attachmentViewer.attachment.id}`];\n if (\n this.attachmentViewer.attachment.fileType === 'image' &&\n (!image || !image.complete)\n ) {\n this.attachmentViewer.update({ isImageLoading: true });\n }\n }",
"function processImageOptions(imageData, onSuccess, onFail, options) {\n\tvar image = new Image();\n\timage.onload = function() {\n\t\t// detect orientation of captured photo on mobile device using EXIF data\n\t\tvar o = 1;\n\t\tEXIF.getData(image, function() {\n\t\t\tconsole.log(\"EXIF:\", EXIF.pretty(this) );\n\t\t\to = EXIF.getTag(this,'Orientation');\n\n\t\t\t// set real image width and height\n\t\t\tvar imageWidth = image.width;\n\t\t\tvar imageHeight = image.height;\n\t\t\tvar isSideways = false;\n\t\t\tif (o===5 || o===6 || o===7 || o===8) {\n\t\t\t\tisSideways = true;\n\t\t\t\timageWidth = image.height;\n\t\t\t\timageHeight = image.width;\n\t\t\t}\n\n\t\t\tconsole.log(\"process Image @\", imageWidth, imageHeight, \" orientation:\", o, \" sideways:\", isSideways);\n\n\t\t\tvar r = imageWidth / imageHeight;\n\t\t\tvar width = imageWidth;\n\t \tvar height = imageHeight;\n\t\t\tvar quality = (options.quality/100 || 0.8);\n\t\t\tvar scale = 1;\n\n\t\t\t// scale down if source is larger than target dimensions\n\t\t\tif (r > 1 && imageWidth>options.targetWidth) {\n\t\t\t\t// landscape format - adjust target height\n\t\t\t\twidth = options.targetWidth;\n\t\t\t\tscale = width/imageWidth;\n\t\t\t\theight = Math.floor( imageHeight * scale );\n\t\t\t\tconsole.log(\"Landscape *h\", height, \"scale:\", scale);\n\t\t\t} else if (r < 1 && imageHeight>options.targetHeight) {\n\t\t\t\t// portrait format - adjust target width\n\t\t\t\theight = options.targetHeight;\n\t\t\t\tscale = height/imageHeight;\n\t\t\t\twidth = Math.floor( imageWidth * scale );\n\t\t\t\tconsole.log(\"Portrait *w\", width, \"scale:\", scale);\n\t\t\t}\n\t\t\tconsole.log(\"resize ->\", width, height, \" quality:\", quality);\n\n\t\t\t// create canvas without appending to DOM\n\t\t\tif (typeof imageCanvas === \"undefined\") {\n\t\t\t\tconsole.log(\"image canvas created\");\n\t\t\t\timageCanvas = document.createElement('canvas');\n\t\t\t\timageCanvas.setAttribute(\"hidden\", true);\n\t\t\t}\n\n\t\t\tvar x = width,\n\t\t\t\t\ty = height,\n\t\t\t\t\tw = width,\n\t\t\t\t\th = height;\n\n\t\t\t// swap x/y dimensions for sideways orientated photos\n\t\t\tif (isSideways) {\n\t\t\t\tx = height;\n\t\t\t\ty = width;\n\t\t\t}\n\n\t\t\timageCanvas.width = w;\n\t\t\timageCanvas.height = h;\n\t\t\tconsole.log(\"x\",x, \"y\",y, \" w\",w, \"h\",h);\n\n\t\t\tvar ctx = imageCanvas.getContext(\"2d\");\n\n\t\t\tswitch (o) {\n\t\t\t\tcase 1:\n\t\t\t\t\tconsole.log(\"Orientation correct\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2: // mirror\n\t\t\t\t\tctx.translate(x,0);\n\t\t\t\t\tctx.scale(-1,1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tctx.translate(x,y);\n \tctx.rotate(Math.PI);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\tctx.translate(0,y);\n\t\t\t\t\tctx.scale(1,-1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\tctx.rotate(0.5*Math.PI);\n\t\t\t\t\tctx.scale(1, -1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 6:\n\t\t\t\t\tctx.rotate(0.5*Math.PI);\n\t\t\t \t\tctx.translate(0,-y);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 7:\n\t\t\t\t\tctx.rotate(0.5*Math.PI);\n \tctx.translate(x,-y);\n \tctx.scale(-1,1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 8:\n\t\t\t\t\tctx.rotate(-0.5*Math.PI);\n \tctx.translate(-x,0);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tconsole.log(\"Orientation not defined\", o);\n\t\t\t}\n\n\t\t\t// apply scale\n\t\t\tif (scale < 1) {\n\t\t\t\tconsole.log(\"Apply scale-down\", scale);\n\t\t\t\tctx.scale(scale, scale);\n\t\t\t}\n\t\t\t// finally, draw image\n\t\t\tctx.drawImage(image, 0, 0);\n\n\t\t\tvar processedImageData = imageCanvas.toDataURL(\"image/jpeg\", quality);\n\t\t\tconsole.log(\"Canvas data\", processedImageData.length, processedImageData.substr(0,32)+\"...\");\n\n\t\t\t// clear resources\n\t\t\tctx.restore();\n\t\t\tctx.clearRect(0, 0, w, h);\n\t\t\timage = null;\n\n\t\t return onSuccess( processedImageData );\n });\n };\n\timage.onerror = function() {\n\t\treturn onFail(\"Error processing image options.\");\n\t};\n\timage.src = imageData;\n}",
"function readPic(file) {\n console.log(file);\n var fileType = file[\"type\"].split(\"/\")[0];\n if (fileType !== \"image\") {\n displayError(\"Not an image, please use a valid image format: \\\n JPEG, PNG8, PNG24, GIF, Animated GIF (first frame only), BMP, WEBP, RAW, or ICO\");\n\n } else {\n loadImage.parseMetaData(file, function(data) {\n //default image orientation\n var orientation = 0;\n //if exif data available, update orientation\n if (data.exif) {\n orientation = data.exif.get('Orientation');\n }\n var loadingImage = loadImage(\n file,\n function(canvas) {\n //here's the base64 data result\n var base64data = canvas.toDataURL('image/jpeg');\n displayPic(base64data);\n if (file.size < 4000000) {\n sendImageDirect(base64data);\n } else {\n sendImageImgur(base64data);\n }\n }, {\n //should be set to canvas : true to activate auto fix orientation\n canvas: true,\n orientation: orientation\n }\n );\n });\n // getOrientation(file, function checkRotate(orientation) {\n // console.log(orientation);\n // var reader = new FileReader();\n // getImageBase64(file, function(image) {\n // if (file.size < 4000000) {\n // orientDisplayPic(image, orientation);\n // sendImageDirect(image, orientation);\n // } else { \n // orientDisplayPic(image, orientation);\n // sendImageImgur(image, orientation);\n // }\n // });\n // });\n }\n}",
"handleImageLoad_() {\n const image = /** @type {HTMLImageElement} */ (this.image_);\n if (image.naturalWidth && image.naturalHeight) {\n this.state = TileState.LOADED;\n } else {\n this.state = TileState.EMPTY;\n }\n this.unlistenImage_();\n this.changed();\n }",
"handleImageLoad_() {\n const image = /** @type {HTMLImageElement} */ (this.image_);\n if (image.naturalWidth && image.naturalHeight) {\n this.state = TileState.LOADED;\n } else {\n this.state = TileState.EMPTY;\n }\n this.unlistenImage_();\n this.changed();\n }",
"function load_image(file){\r\nconsole.log(\"image loading\");\r\n$(\"#message\").text(\"image loading\");\r\n\tvar image = document.createElement(\"img\");\r\n\tdocument.getElementById(\"hidden_area\").appendChild(image);\r\n\timage.onerror = onImageError;\r\n\timage.onload = onImageLoad;\r\n\tvar createObjectURL = (window.webkitURL && window.webkitURL.createObjectURL) || (window.URL && window.URL.createObjectURL);\r\n\timage.src = createObjectURL(file);\r\n}",
"function loadImage(firstLoad){\n img = new Image()\n zoomed = false\n if (!firstLoad){\n basename = images[curIndex]\n }\n src = path.join(dirname, basename)\n img.src = src\n img.onload = () => {\n setOriDim()\n setSvgDim()\n setDefaultScale()\n setImgDim()\n setImgPos()\n updateImg()\n setTitle()\n }\n}",
"function fixImageOrientation(img64){\n return new Promise((resolve, reject) => {\n sharp(Buffer.from(img64, 'base64'))\n .rotate() //rotate based on exif value\n .toBuffer()\n .then(data => resolve(data.toString('base64')))\n .catch(err => reject(err));\n });\n}",
"function orientation(img_element) {\n var canvas = document.createElement('canvas');\n // Set variables\n var ctx = canvas.getContext(\"2d\");\n var exifOrientation = '';\n var width = img_element.width,\n height = img_element.height;\n\n // Check orientation in EXIF metadatas\n EXIF.getData(img_element, function () {\n var allMetaData = EXIF.getAllTags(this);\n exifOrientation = allMetaData.Orientation;\n });\n\n // set proper canvas dimensions before transform & export\n if (jQuery.inArray(exifOrientation, [5, 6, 7, 8]) > -1) {\n canvas.width = height;\n canvas.height = width;\n } else {\n canvas.width = width;\n canvas.height = height;\n }\n\n // transform context before drawing image\n switch (exifOrientation) {\n case 2:\n ctx.transform(-1, 0, 0, 1, width, 0);\n break;\n case 3:\n ctx.transform(-1, 0, 0, -1, width, height);\n break;\n case 4:\n ctx.transform(1, 0, 0, -1, 0, height);\n break;\n case 5:\n ctx.transform(0, 1, 1, 0, 0, 0);\n break;\n case 6:\n ctx.transform(0, 1, -1, 0, height, 0);\n break;\n case 7:\n ctx.transform(0, -1, -1, 0, height, width);\n break;\n case 8:\n ctx.transform(0, -1, 1, 0, 0, width);\n break;\n default:\n ctx.transform(1, 0, 0, 1, 0, 0);\n }\n\n // Draw img_element into canvas\n ctx.drawImage(img_element, 0, 0, width, height);\n var __return = canvas.toDataURL();\n $(canvas).remove();\n return __return;\n}",
"function loadImage(fileList, fileIndex) {\n\t//if (fileList.indexOf(fileIndex) < 0) {\n cc = document.getElementById('user_image').getContext('2d');\n\n\t\tvar reader = new FileReader();\n\t\treader.onload = (function(theFile) {\n\t\t return function(e) {\n\t\t\t\t// check if positions already exist in storage\n\t\t\t\t// Render thumbnail.\n\t\t\t\tvar canvas = document.getElementById('user_image')\n\t\t\t\tvar cc = canvas.getContext('2d');\n\t\t\t\tvar img = new Image();\n\t\t\t\timg.onload = function() {\n\t\t\t\t\tif (img.height > 500 || img.width > 700) {\n\t\t\t\t\t\tvar rel = img.height/img.width;\n\t\t\t\t\t\tvar neww = 700;\n\t\t\t\t\t\tvar newh = neww*rel;\n\t\t\t\t\t\tif (newh > 500) {\n\t\t\t\t\t\t\tnewh = 500;\n\t\t\t\t\t\t\tneww = newh/rel;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcanvas.setAttribute('width', neww);\n\t\t\t\t\t\tcanvas.setAttribute('height', newh);\n // overlay.setAttribute('width', neww);\n // overlay.setAttribute('height', newh);\n\t\t\t\t\t\tcc.drawImage(img,0,0,neww, newh);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcanvas.setAttribute('width', img.width);\n\t\t\t\t\t\tcanvas.setAttribute('height', img.height);\n // overlay.setAttribute('width', img.width);\n // overlay.setAttribute('height', img.height);\n\t\t\t\t\t\tcc.drawImage(img,0,0,img.width, img.height);\n\t\t\t\t\t}\n startCrop(overlay);\n // jQuery('#overlay').css({left:jQuery('#user_image').offset().left})\n // jQuery('#overlay').css({top:jQuery('#user_image').offset().top})\n\t\t\t\t}\n\t\t\t\timg.src = e.target.result;\n\n\t\t\t};\n\t\t})(fileList[fileIndex]);\n\t\treader.readAsDataURL(fileList[fileIndex]);\n\t\toverlayCC.clearRect(0, 0, 720, 576);\n\t\tdocument.getElementById('convergence').innerHTML = \"\";\n\t\tctrack.reset();\n\n animateClean();\n//\t}\n}",
"function loadImg(e){var files=e.target.files;if(files.length){[].forEach.call(files,function(file){var reader=new FileReader();//проветка на тип зашруженного файла и размер\nexchangeByteForMb(file.size)>5&&console.log('55');if(testTypeImage(file,['gif','jpeg','pjpeg','png'])&&exchangeByteForMb(file.size)<5){reader.onload=function(e){var fileData=e.target.result;//base64\nvar error=e.target.error;error&&log('Файл не загрузился!');var block='<div class=\"blockFlexImgInfo\">\\n <img src=\"'+fileData+'\" alt=\"\">\\n <a href=\"#\" class=\"deleteImg \"></a>\\n <div class=\"blockFlexImgInfo__name\">'+file.name.split('.')[0]+'</div>\\n <div class=\"blockFlexImgInfo__size\">'+exchangeByteForMb(file.size)+' Mb</div>\\n </div>';document.querySelector('.blockFlexImg__square').insertAdjacentHTML('afterEnd',block);};reader.readAsDataURL(file);}else if(testTypeImage(file,['gif','jpeg','pjpeg','png'])){var errorSize=document.createElement('div');errorSize.classList.add('errorSizeImg');errorSize.innerHTML='Error: '+file.name.split('.')[0]+' \\u043F\\u0440\\u0435\\u0432\\u044B\\u0448\\u0430\\u0435\\u0442 \\u043C\\u0430\\u043A\\u0441\\u0438\\u043C\\u0430\\u043B\\u044C\\u043D\\u044B\\u0439 \\u0440\\u0430\\u0437\\u043C\\u0435\\u0440 5 Mb!';document.querySelector('.errorSizeImgConteiner').appendChild(errorSize);setTimeout(function(){return document.querySelector('.errorSizeImg').remove();},7000);log(66666);}else{var blockNoImage='<article class=\"infoNoImage\">\\n <div class=\"flex\">\\n <pre class=\"infoNoImage__info-maxSize\">1. '+file.name.split('.')[0]+'</pre>\\n <pre class=\"infoNoImage__info\">'+file.type.split('/')[1]+'</pre>\\n <pre class=\"infoNoImage__info\">'+exchangeByteForMb(file.size)+' Mb</pre>\\n </div>\\n <pre class=\"infoNoImage__info__delete \">Delete </pre>\\n </article>';document.querySelector('.startFlex__column').insertAdjacentHTML('beforeEnd',blockNoImage);}});e.target.value='';}}",
"onImageLoaded() {\n this.imgLoaded = true;\n }",
"function loadImage(src){\n //\tPrevent any non-image file type from being read.\n if(!src.type.match(/image.*/)){\n console.log(\"The dropped file is not an image: \", src.type);\n return;\n }\n\n //\tCreate our FileReader and run the results through the render function.\n var reader = new FileReader();\n reader.onload = function(e){\n var data = e.target.result\n $.ajax({\n type: \"POST\",\n url: \"uploadCanvas\",\n //contentType: \"application/x-www-form-urlencoded\",\n data: {\n img64: data\n },\n success: function (response) {\n console.log(response);\n },\n error: function (errorThrown) {\n console.log(errorThrown)\n }\n\n }).done(function(o) {\n tempImg = globalsrc + o\n tmpO = o\n var tmp = new Image();\n tmp.src = tempImg\n tmp.onload = function(){\n $(\"#image\").css('width',tmp.width)\n $(\"#image\").css('height',tmp.height)\n\n $(\"#image\").css({'background': 'url('+tempImg+') no-repeat',\n 'background-size': '100% auto'})\n\n\n\n $(\"#image\").freetrans({\n 'rot-origin': '50% 50%'\n }).css({\n border: \"1px solid pink\"\n });\n var o = $('#image').freetrans('getBounds');\n tmpW = o.width\n tmp=null\n }\n\n\n\n });\n\n };\n reader.readAsDataURL(src);\n}",
"function onPhotoDataSuccess(imageData) {\n\t\t\n\t\tvar image = new Image();\n\t image.onload = function() {\n\t \t\n\t \t//Get aspect ratio, aiming for 300px width\n\t \tconsole.log(image.width + \"x\" + image.height);\n\t \tvar maxDimension = 250;\n\t \tif(image.width > image.height)\n\t \t{\n\t\t \tvar resizeFactor = (maxDimension/image.width);\n\t\t \tconsole.log('resize Factor: ' + resizeFactor);\t\t \t\n\t\t\t} else {\n\t\t\t\tvar resizeFactor = (maxDimension/image.height);\n\t\t\t}\n\t\t\tvar newWidth = image.width * resizeFactor;\n\t\t\tvar newHeight = image.height * resizeFactor;\n\t\t\tconsole.log('new dimensions: ' + newWidth + 'x' + newHeight);\n\n\t \t//Set up canvas\n\t\t\tvar canvas = document.createElement(\"canvas\");\n\t\t\tvar ctx = canvas.getContext(\"2d\");\n\t\t\t\n\t\t\t//Draw rotated image\n\t\t\tcanvas.width = newHeight;\n\t\t\tcanvas.height = newWidth;\n\t ctx.translate(canvas.width/2, canvas.height/2); \n\t ctx.rotate(90*(Math.PI/180));\t \n\t ctx.drawImage(image, -(newWidth/2), -(newHeight/2), newWidth, newHeight);\n\t \n\t //Save image data and display on screen\n\t var imageDataRotated = canvas.toDataURL('image/jpeg'); \n\t\t\tvar playerImage = document.getElementById('playerImage');\n\t\t\tplayerImage.src = imageDataRotated;\n\t\t\tplayerImage.style.display = 'block';\n\t\t\taddPlayer();\n\t\t};\n\t\timage.src = \"data:image/jpeg;base64,\" + imageData;\n }",
"function load360Image() {\n var img = new Image();\n img.src = imgList[loaded];\n img.onload = img360Loaded;\n images[loaded] = img;\n }",
"loadImage(file) {\n let reader = new FileReader();\n\n reader.onload = (e) => {\n file.src = e.target.result;\n\n if (this.afterFileSelect){\n this.afterFileSelect(file);\n }\n };\n\n reader.readAsDataURL(file);\n }",
"imageOnLoad() {\n loadJS(resizeScript, this.initResizeHandler.bind(this), document.body);\n\n this.toggleStatus(STATUS.FILLED);\n // eslint-disable-next-line no-undef\n\n /**\n * Preloader does not exists on first rendering with presaved data\n */\n if (this.nodes.imagePreloader) {\n this.nodes.imagePreloader.style.backgroundImage = \"\";\n }\n }",
"function orientation(img, canvas) {\n var ctx = canvas.getContext(\"2d\");\n var exifOrientation = '';\n var width = img.width,\n height = img.height;\n // Check orientation in EXIF metadatas\n EXIF.getData(img, function() {\n var allMetaData = EXIF.getAllTags(this);\n exifOrientation = allMetaData.Orientation;\n console.log('Exif orientation: ' + exifOrientation);\n console.log(allMetaData);\n });\n // set proper canvas dimensions before transform & export\n if (jQuery.inArray(exifOrientation, [5, 6, 7, 8]) > -1) {\n canvas.width = height;\n canvas.height = width;\n } else {\n canvas.width = width;\n canvas.height = height;\n }\n switch (exifOrientation) {\n case 2:\n ctx.transform(-1, 0, 0, 1, width, 0);\n break;\n case 3:\n ctx.transform(-1, 0, 0, -1, width, height);\n break;\n case 4:\n ctx.transform(1, 0, 0, -1, 0, height);\n break;\n case 5:\n ctx.transform(0, 1, 1, 0, 0, 0);\n break;\n case 6:\n ctx.transform(0, 1, -1, 0, height, 0);\n break;\n case 7:\n ctx.transform(0, -1, -1, 0, height, width);\n break;\n case 8:\n ctx.transform(0, -1, 1, 0, 0, width);\n break;\n default:\n ctx.transform(1, 0, 0, 1, 0, 0);\n }\n ctx.drawImage(img, 0, 0, width, height);\n}",
"function resetImage() {\n //load the image in canvas if the image is loaded successfully\n ctx = canvas.getContext(\"2d\");\n angleInDegrees = 0;\n currentScale = 1;\n currentAngle = 0;\n\n //for initial loading\n if (scope.flag) {\n scope.flag = 0;\n ctx.translate(canvas.width / 2, canvas.height / 2);\n drawImage();\n } else {\n ctx.translate(0, 0);\n drawImage();\n }\n }",
"patched() {\n this._handleImageLoad();\n }",
"_updateImage() {\n let boundsSize = [getWidth(this.bounds), getHeight(this.bounds)]\n let regionSize = [getWidth(this.region), getHeight(this.region)]\n if (this._orientation === 90 || this._orientation === 270) {\n boundsSize = [boundsSize[1], boundsSize[0]]\n regionSize = [regionSize[1], regionSize[0]]\n }\n\n // Set the size of the image\n this._dom.image.style.backgroundSize\n = `${boundsSize[0]}px ${boundsSize[1]}px`\n this._dom.image.style.width = `${regionSize[0]}px`\n this._dom.image.style.height = `${regionSize[1]}px`\n\n // Position the image centerally so the rotatation is aligned\n this._dom.image.style.marginLeft = `-${regionSize[0] / 2}px`\n this._dom.image.style.marginTop = `-${regionSize[1] / 2}px`\n this._dom.image.style.left = `${getWidth(this.region) / 2}px`\n this._dom.image.style.top = `${getHeight(this.region) / 2}px`\n\n // Set the orientation of the image\n this._dom.image.style.transform = `rotate(${this._orientation}deg)`\n\n // Set the background's position inline with the crop region's\n let bkgX = this._region[0][0] // eslint-disable-line\n let bkgY = this._region[0][1] // eslint-disable-line\n\n switch (this._orientation) {\n\n case 90:\n bkgX = this._region[0][1] // eslint-disable-line\n bkgY = (boundsSize[1] - regionSize[1]) - this._region[0][0]\n break\n\n case 180:\n bkgX = (boundsSize[0] - regionSize[0]) - this._region[0][0]\n bkgY = (boundsSize[1] - regionSize[1]) - this._region[0][1]\n break\n\n case 270:\n bkgX = (boundsSize[0] - regionSize[0]) - this._region[0][1]\n bkgY = this._region[0][0] // eslint-disable-line\n break\n\n // No default\n\n }\n\n // Ceil the values to prevent fractions causing jerking when dragging\n // or resizing.\n bkgX = Math.ceil(bkgX)\n bkgY = Math.ceil(bkgY)\n\n this._dom.image.style.backgroundPosition = `-${bkgX}px -${bkgY}px`\n }",
"async load()\n {\n if (this.path)\n {\n // Try loading\n this.image = await Picture2D.loadImage(this.path);\n this.empty = this.image.empty;\n\n // If not empty, configure bitmap size\n if (!this.empty)\n {\n this.oW = this.image.width;\n this.oH = this.image.height;\n if (this.cover)\n {\n this.w = RPM.CANVAS_WIDTH;\n this.h = RPM.CANVAS_HEIGHT;\n } else if (this.stretch)\n {\n this.w = RPM.getScreenX(this.image.width);\n this.h = RPM.getScreenY(this.image.height);\n } else\n {\n this.w = RPM.getScreenMinXY(this.image.width);\n this.h = RPM.getScreenMinXY(this.image.height);\n }\n RPM.requestPaintHUD = true;\n this.loaded = true;\n }\n }\n }",
"function onLowResImageSuccess(e){\n\t// Swap the thumbnail image with the low one\n\t$.media.image = e.data;\n}",
"function loadImgs(cropImgWidth, rotateImgWidth, index) { \n var imgAttrs = imgData[index];\n \n $('#crop-img')\n .css({ \n height: getHeight(cropImgWidth, imgAttrs.origWidth, imgAttrs.origHeight) + 'px', \n width: cropImgWidth + 'px' \n })\n .attr('src', imgAttrs.fileSrc);\n\n // remove existing image element \n $('#rotate-img').remove();\n\n // create new image element for rotate action and attach it \n $('<img>', {\n id: 'rotate-img',\n src: imgAttrs.fileSrc, \n css: { \n height: getHeight(rotateImgWidth, imgAttrs.origWidth, imgAttrs.origHeight) + 'px', \n width: rotateImgWidth + 'px' \n }\n }).appendTo('#rotate-container'); \n \n // disable this slide's checkbox\n $('.chk-box').removeAttr('disabled');\n $('#chkbox_' + index).attr('disabled', true);\n \n // initialize crop and rotation actions\n apiJcrop.destroy();\n setJcrop(index); \n $('#rotate-img').rotate(0);\n currentCropRatio = imgAttrs.cropRatio;\n }",
"function loadedImage()\r\n {\r\n //console.log(\"Load image \" + this.width + \" \" + this.height);\r\n\r\n this.loadMode = 2;\r\n\r\n if (this.repaint)\r\n {\r\n for (var i = 0; i < this.repaint.length; ++i)\r\n {\r\n var r = this.repaint[i];\r\n\r\n that.printPage(r.canvas, r.page, r.canvas.cpcOptions);\r\n }\r\n\r\n this.repaint = null;\r\n }\r\n\r\n this.removeEventListener('load', loadedImage);\r\n }",
"function loadImage() {\n\tif (fileList.indexOf(fileIndex) < 0) {\n\t\tvar reader = new FileReader();\n\t\treader.onload = (function(theFile) {\n\t\t\treturn function(e) {\n\t\t\t\t// check if positions already exist in storage\n\n\t\t\t\t// Render thumbnail.\n\t\t\t\tvar span = document.getElementById('imageholder');\n\t\t\t\tspan.innerHTML = '<canvas id=\"imgcanvas\"></canvas>';\n\t\t\t\tvar canvas = document.getElementById('imgcanvas')\n\t\t\t\tvar cc = canvas.getContext('2d');\n\t\t\t\tvar img = new Image();\n\t\t\t\timg.onload = function() {\n\t\t\t\t\tcanvas.setAttribute('width', img.width);\n\t\t\t\t\tcanvas.setAttribute('height', img.height);\n\t\t\t\t\tcc.drawImage(img,0,0,img.width, img.height);\n\n scale = 1.0;\n\t\t\t\t\t// check if parameters already exist\n\t\t\t\t\tvar positions = localStorage.getItem(fileList[fileIndex].name)\n\t\t\t\t\tif (positions) {\n\t\t\t\t\t\tpositions = JSON.parse(positions);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// estimating parameters\n\t\t\t\t\t\tpositions = estimatePositions();\n\t\t\t\t\t\tif (!positions) {\n\t\t\t\t\t\t\tclear()\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// put boundary on estimated points\n\t\t\t\t\t\tfor (var i = 0;i < positions.length;i++) {\n\t\t\t\t\t\t\tif (positions[i][0][0] > img.width) {\n\t\t\t\t\t\t\t\tpositions[i][0][0] = img.width;\n\t\t\t\t\t\t\t} else if (positions[i][0][0] < 0) {\n\t\t\t\t\t\t\t\tpositions[i][0][0] = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (positions[i][0][1] > img.height) {\n\t\t\t\t\t\t\t\tpositions[i][0][1] = img.height;\n\t\t\t\t\t\t\t} else if (positions[i][0][1] < 0) {\n\t\t\t\t\t\t\t\tpositions[i][0][1] = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (positions) {\n\t\t\t\t\t\t// render points\n\t\t\t\t\t\trenderPoints(positions, img.width, img.height);\n\t\t\t\t\t\tstoreCurrent();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclear();\n\t\t\t\t\t\tconsole.log(\"Did not manage to detect position of face in this image. Please select position of face by clicking 'manually select face' and dragging a box around the face.\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\timg.src = e.target.result;\n\t\t\t};\n\t\t})(fileList[fileIndex]);\n\t\treader.readAsDataURL(fileList[fileIndex]);\n\t}\n\tdocument.getElementById('imagenumber').innerHTML = (fileIndex+1)+\" / \"+fileList.length;\n}",
"function imageLoaded() {\n self.framed = self.createFramedImage(self.image, width, height);\n //self.framed = self.image;\n self.object = self.createRendererObject();\n if(self.prepareCallback) {\n self.prepareCallback(true);\n }\n }"
] | [
"0.7144427",
"0.6631277",
"0.645808",
"0.6393823",
"0.6194077",
"0.60488397",
"0.59705955",
"0.59705955",
"0.59020543",
"0.5868273",
"0.5816981",
"0.58118296",
"0.58105105",
"0.5767477",
"0.57385",
"0.57257855",
"0.5700381",
"0.5699242",
"0.5688993",
"0.5681487",
"0.5679571",
"0.5674024",
"0.56686443",
"0.56059873",
"0.559824",
"0.55882937",
"0.5583826",
"0.5576911",
"0.5568084",
"0.5545107"
] | 0.687945 | 1 |
Passes the uploaded file object as well as a base 64 of the image to the onUpload callback | uploadImage(e) {
const { onUpload } = this.props;
let file = e.target.files[0]
this.orientImage(file, (src) => {
onUpload({
file,
name: file.name,
src
})
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"handleFile(e) {\n const reader = new FileReader();\n const file = e.target.files[0];\n\n if (!file) return;\n\n //useful for debugging base64 to images http://codebeautify.org/base64-to-image-converter\n reader.onload = function () {\n this.setState({\n cropperOpen: true,\n uploadedImage: reader.result\n });\n }.bind(this);\n reader.readAsDataURL(file);\n }",
"handleImageChange(e) {\n alert(e.target.files[0]);\n this.getBase64(e.target.files[0], (base64) => {\n this.setState({ Base64Image: base64 });\n this.image = base64;\n })\n }",
"function upload_image()\n{\n\n const file = document.querySelector('input[type=file]').files[0];\n //const reader = new FileReader();\n send_request_and_receive_payload(file)\n\n\n/*\n reader.addEventListener(\"load\", () => {\n\tsend_request_and_receive_payload(reader.result);\n });\n\n if (file) {\n\treader.readAsDataURL(file);\n }\n*/\n\n}",
"imageUpload (e) {\n let imgData = e.target.files[0];\n let imageExt = imgData ? imgData.type : '';\n let imageSize = imgData ? imgData.size : '';\n\n const reader = new FileReader();\n\n if(imgData){\n reader.onload = (() => {\n return e => {\n const previewSrc = e.target.result;\n console.log(previewSrc);\n this.props.dispatch(setUserDataImage({imageVal: previewSrc}));\n }\n })(imgData);\n reader.readAsDataURL(imgData);\n this.props.dispatch(setUserDataImageAsObject(imgData));\n }\n\n let dispatchObj = {\n imgData,\n status: null,\n imageValid: true,\n show: false\n }\n\n if(!imgData){\n dispatchObj.imgData = '';\n dispatchObj.imageValid = false;\n } else if(!(this.allowedExts.includes(imageExt)) || !(imageSize>MIN_SIZE || imageSize<MAX_SIZE)){\n dispatchObj.status = \"error\";\n dispatchObj.imageValid = false;\n dispatchObj.show = true\n }\n\n \n\n return this.props.dispatch(validateImage(dispatchObj));\n }",
"function uploadFiles (event) {\n event.preventDefault(); // Prevent the default form post\n\n // Grab the file and asynchronously convert to base64.\n var file = $('#fileform [name=fileField]')[0].files[0];\n console.log(file);\n var reader = new FileReader();\n reader.onloadend = processFile;\n reader.readAsDataURL(file);\n}",
"fileChangeHandler(event){\n const file = event.target.files[0]\n this.getBase64(file).then( (fileString) => {\n const formState = Object.assign({}, this.state.form)\n formState.avatar_base = fileString\n this.setState({form: formState})\n })\n }",
"fileChangeHandler(event){\n const file = event.target.files[0]\n this.getBase64(file).then( (fileString) => {\n const formState = Object.assign({}, this.state.form)\n formState.avatar_base = fileString\n this.setState({form: formState})\n })\n }",
"function base64(file, callback){\n var coolFile = {};\n function readerOnload(e){\n var base64 = btoa(e.target.result);\n coolFile.base64 = base64;\n callback(coolFile)\n };\n\n var reader = new FileReader();\n reader.onload = readerOnload;\n\n var file = file[0].files[0];\n coolFile.filetype = file.type;\n coolFile.size = file.size;\n coolFile.filename = file.name;\n reader.readAsBinaryString(file);\n}",
"fileChangeHandler(event){\n const file = event.target.files[0]\n this.getBase64(file).then( (fileString) => {\n const formState = Object.assign({}, this.state.form)\n formState.photo_base = fileString\n this.setState({form: formState})\n })\n }",
"function UploadImage({ setBaseImage }) {\n // const { userPersistido } = useAuth();\n\n const uploadImage = async (e) => {\n const file = e.target.files[0];\n const base64 = await convertBase64(file); \n setBaseImage(base64);\n };\n\n const convertBase64 = (file) => {\n return new Promise((resolve, reject) => {\n const fileReader = new FileReader();\n fileReader.readAsDataURL(file);\n\n fileReader.onload = () => {\n resolve(fileReader.result);\n };\n\n fileReader.onerror = (error) => {\n reject(error);\n };\n });\n };\n\n return (\n <div>\n <label className=\"label-arquivo\" htmlFor=\"arquivo\">Selecione a imagem do produto</label>\n <input\n type=\"file\"\n name=\"arquivo\"\n id=\"arquivo\"\n accept=\"image/*\"\n onChange={(e) => {\n uploadImage(e);\n }}\n />\n </div>\n );\n}",
"async handleImageUpload(file) {\n const fd = new FormData();\n fd.append('upload_preset', CLOUDINARY_UPLOAD_PRESET);\n fd.append('tags', 'browser_upload'); // Optional - add tag for image admin in Cloudinary\n fd.append('file', file);\n\n try {\n const response = await axios.post(\n CLOUDINARY_UPLOAD_URL,\n fd,\n {\n onUploadProgress: (progressEvent) => {\n const progress = Math.round((progressEvent.loaded * 100.0) / progressEvent.total);\n\n this.setState({\n uploadProgressShow: true,\n uploadProgress: progress,\n });\n },\n }\n );\n\n this.setState({\n uploadedFileCloudinaryID: response.data.public_id,\n uploadedFileCloudinaryUrl: response.data.secure_url,\n uploadProgress: 0,\n uploadProgressShow: false,\n deletedCurrentImage: false,\n });\n } catch (error) {\n this.handleUpdateError(error);\n }\n }",
"function imageUpload(e) {\n var reader = new FileReader();\n reader.onload = async function (event) {\n var imgObj = await new Image();\n imgObj.src = await event.target.result;\n setImage([...getImage, imgObj.src]);\n };\n let p = e.target.files[0];\n\n reader.readAsDataURL(p);\n }",
"function uploadImage(base64) {\n return __awaiter(this, void 0, void 0, function* () {\n return new Promise(resolve => {\n cloudinary.v2.uploader.upload(base64, function (err, result) {\n if (err)\n console.log(err);\n resolve(result);\n });\n });\n });\n}",
"static base64(file, callback){\n const reader = new FileReader();\n reader.onload = function(event){\n callback(event.target.result, file);\n }\n reader.readAsDataURL(file);\n }",
"handleUpload(evt) {\n if(evt.target.files && evt.target.files[0]) {\n this.readFile(evt.target.files[0])\n .then(this.renderDummyImage)\n .then(this.updateImageState);\n }\n }",
"handleImageChange(file) {\n const {setMedia} = this.props;\n const reader = new FileReader();\n reader.onloadend = () => {\n setMedia({\n source: reader.result,\n fileName: file.name\n });\n }\n reader.readAsDataURL(file);\n // Begin upload process\n this.props.uploadMedia(file);\n }",
"function handleUpload(event) {\n setFile(event.target.files[0]);\n \n // Add code here to upload file to server\n // ...\n }",
"function handleUpload(event) {\n setFile(event.target.files[0]);\n \n // Add code here to upload file to server\n // ...\n }",
"async function handleImageUpload(event) {\n\t\tconst imageFile = event.target.files[0];\n\n\t\tconsole.log('originalFile instanceof Blob', imageFile instanceof Blob); // true\n\t\tconsole.log(`originalFile size ${imageFile.size / 1024 / 1024} `);\n\n\t\tconst options = {\n\t\t\tmaxSizeMB: 0.1,\n\t\t\tmaxWidthOrHeight: 1920,\n\t\t\tuseWebWorker: true\n\t\t};\n\t\ttry {\n\t\t\tconst compressedFile = await imageCompression(imageFile, options);\n\t\t\tlet imgBlobToFile = new File([ compressedFile ], imageFile.name, {\n\t\t\t\tlastModified: Date.now(),\n\t\t\t\ttype: 'image/jpeg'\n\t\t\t});\n\t\t\tsetUploadPhoto(imgBlobToFile);\n\n\t\t\tconsole.log('compressedFile instanceof Blob', uploadPhoto instanceof Blob); // true\n\t\t\tconsole.log(`compressedFile size ${uploadPhoto.size / 1024 / 1024} MB`); // smaller than maxSizeMB\n\n\t\t\t// await uploadToServer(compressedFile); // write your own logic\n\t\t\tconsole.log(uploadPhoto);\n\t\t\tconsole.log('uploaded successfully');\n\t\t} catch (error) {\n\t\t\tconsole.log(error);\n\t\t}\n\t}",
"function uploadFiles (event) {\n event.preventDefault(); // Prevent the default form post\n\n // Grab the file and asynchronously convert to base64.\n var file = $('#fileform [name=fileField]')[0].files[0];\n var reader = new FileReader();\n reader.onloadend = processFile;\n reader.readAsDataURL(file);\n}",
"handleImgUpload(e){\n // get the file off of the submit event\n var files = e.target.files,\n file;\n\n if (!this.validFile(files[0].name)) {\n this.setState({\n error: 'Supported File Types: JPEG, TIFF, BMP'\n })\n return;\n }\n\n if (files && files.length > 0) {\n\n file = files[0];\n\n this.setState({\n file: file,\n loading: true,\n tags: [],\n error: '',\n })\n\n try {\n // Get window.URL object\n var URL = window.URL || window.webkitURL;\n const imgURL = URL.createObjectURL(file);\n\n this.setState({\n imgURL: imgURL\n })\n // send the image as a message\n this.props.addMessage(['you', imgURL, true]);\n\n const fileReader = new FileReader()\n fileReader.readAsDataURL(file)\n // you only have access to the read file inside of this callback(?)function\n fileReader.onload = () => {\n\n const imgBytes = fileReader.result.split(',')[1]\n this.useClarifaiAPI(imgBytes)\n }\n }\n catch (err) {\n try {\n // Fallback if createObjectURL is not supported\n var fileReader = new FileReader();\n fileReader.onload = function (event) {\n this.setState({\n imgURL: event.target.result,\n })\n };\n fileReader.readAsDataURL(file);\n }\n catch (err) {\n // Display error message\n\n }\n }\n }\n }",
"uploadFile(e) {\n // get the file and send\n const selectedFile = this.postcardEle.getElementsByTagName(\"input\")[0].files[0];\n const formData = new FormData();\n formData.append('newImage', selectedFile, selectedFile.name);\n // build a browser-style HTTP request data structure\n const xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"/upload\", true);\n xhr.addEventListener('loadend', (e) => {\n this.onImageLoad(e, xhr);\n });\n xhr.send(formData);\n }",
"function encodeIMG() {\n if ($('#fileIMG').prop('files')[0]) {\n var imgFile = $('#fileIMG').prop('files')[0];\n if (imgFile.size >= 2000000) {\n $('.error').text(\n 'Your image is larger than 2mb! Please upload a smaller image.'\n );\n }\n var reader = new FileReader();\n reader.onloadend = function () {\n $('.file1').remove();\n $('<img>')\n .attr('src', reader.result)\n .attr('alt', 'User Image')\n .attr('id', 'preview1')\n .attr('class', 'file1')\n .appendTo($('.imgdisplay')); // displays image on site\n imgResult = reader.result; // base64 conversion result\n return imgResult;\n };\n reader.readAsDataURL(imgFile); // Takes the file and converts the data to base64\n }\n}",
"function processFile (event) {\n var content = event.target.result;\n sendFileToCloudVision(content.replace('data:image/jpeg;base64,', ''));\n}",
"function processFile (event) {\n var content = event.target.result;\n sendFileToCloudVision(content.replace('data:image/jpeg;base64,', ''));\n}",
"function uploadImage(file){\n setShowAlert(false);\n setImgFile(URL.createObjectURL(file));\n setFormImg(file);\n }",
"getBase64(img, callback) {\n const reader = new FileReader();\n reader.addEventListener('load', () => callback(reader.result));\n reader.readAsDataURL(img);\n }",
"function initUpload() {\n\t\t\t\tvar fileInput = document.getElementById('fileInput');\n\n\t\t\t\tfileInput.addEventListener('change', function(e) {\n\t\t\t\t imageChanged(fileInput);\n\t\t\t\t});\n\t\t\t }",
"function _upload(fileObj){\r\n\t\tif(fileObj){\r\n\t\t\tUpload.upload({\r\n\t\t\t\turl: '/api/user/editPhoto',\r\n\t\t\t\tmethod: 'POST',\r\n\t\t\t\tdata: {userId: $rootScope.userProfileObj._id},\r\n\t\t\t\tfile: fileObj\r\n\t\t\t}).progress(function(evt){\r\n\t\t\t}).success(function(data){\r\n\t\t\t\tif(data.status == 1)\r\n\t\t\t\t\ttoaster.pop('success', \"Success\", appConstants.profileImageUpdated);\r\n\t\t\t\telse \r\n\t\t\t\t\ttoaster.pop('error', \"Error\", appConstants.profileImageUpdateFailed);\r\n\t\t\t}).error(function(error){});\r\n\t\t}\r\n\t}",
"uploadFile(file) {\n this.validatePhoto(file);\n\n const fd = new FormData();\n fd.append('upload_preset', this.state.unsignedUploadPreset);\n fd.append('tags', `${(this.props.album.name, this.props.album.location)}`); // Optional - add tag for image admin in Cloudinary\n fd.append('file', file);\n\n const config = {\n method: 'post',\n url: `https://api.cloudinary.com/v1_1/${\n this.state.cloudName\n }/image/upload`,\n headers: {\n 'X-Requested-With': 'XMLHttpRequest'\n },\n data: fd,\n onUploadProgress: e => {\n let percentCompleted = Math.round((e.loaded * 100) / e.total);\n this.setState({\n uploadComplete: percentCompleted === 100 ? true : false\n });\n this.setState({\n percentCompleted: percentCompleted >= 100 ? 0 : percentCompleted\n });\n }\n };\n\n axios(config)\n .then(resp => {\n const { secure_url, public_id, delete_token } = resp.data;\n this.setState({\n secure_url,\n public_id,\n delete_token,\n deletedUpload: false\n });\n this.validateForm();\n })\n .catch(err => console.log(err));\n }"
] | [
"0.69902676",
"0.6935119",
"0.6765236",
"0.6727766",
"0.6721871",
"0.6705777",
"0.6676353",
"0.6668043",
"0.66410273",
"0.6615347",
"0.6575097",
"0.65480185",
"0.6494769",
"0.64868236",
"0.6479687",
"0.64705485",
"0.6443938",
"0.6443938",
"0.6442665",
"0.64375377",
"0.64330477",
"0.6403431",
"0.6390866",
"0.6385269",
"0.6385269",
"0.63508695",
"0.63346106",
"0.63317925",
"0.6304828",
"0.6259715"
] | 0.69668007 | 1 |
remove a specific value from the heap | remove(data) {
const size = this.heap.length;
let i;
for (i = 0; i < size; i++) {
if (data === this.heap[i]) {
break;
}
}
[this.heap[i], this.heap[size - 1]] = [this.heap[size - 1], this.heap[i]];
this.heap.splice(size - 1);
for (let i = parseInt(this.heap.length / 2 - 1); i >= 0; i--) {
this.maxHeapify(this.heap, this.heap.length, i);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"remove() {\n // Swap root value with last element in the heap\n // Pop the last element from heap array\n // Perform siftDown to correct position of swapped value\n // Return popped value\n this.swap(0, this.heap.length - 1, this.heap);\n const valueToRemove = this.heap.pop();\n this.siftDown(0, this.heap.length - 1, this.heap);\n \n return valueToRemove;\n }",
"remove(data) {\r\n\t\tconst size = this.heap.length;\r\n\r\n\t\tlet i;\r\n\t\tfor (i = 0; i < size; i++) {\r\n\t\t\tif (data === this.heap[i]) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t[this.heap[i], this.heap[size - 1]] = [this.heap[size - 1], this.heap[i]];\r\n\t\tthis.heap.splice(size - 1);\r\n\r\n\t\tfor (let i = parseInt(this.heap.length / 2 - 1); i >= 0; i--) {\r\n\t\t\tthis.minHeapify(this.heap, this.heap.length, i);\r\n\t\t}\r\n\t}",
"remove() {\n if (this.heap.length < 2) {\n return this.heap.pop(); //easy\n }\n\n const removed = this.heap[0]; // save to return later\n this.heap[0] = this.heap.pop(); // replace with last el\n\n let currentIdx = 0;\n let [left, right] = [currentIdx * 2 + 1, currentIdx * 2 + 2];\n let currentChildIdx = (\n this.heap[right] && this.heap[right].priority >= this.heap[left].priority ? right : left\n );\n // right if heap[right].priority >= heap[left].priority, else left\n // index of max(left.priority, right.priority)\n\n while (\n this.heap[currentChildIdx] && this.heap[currentIdx].priority <= this.heap[currentChildIdx].priority\n ) {\n let currentNode = this.heap[currentIdx];\n let currentChildNode = this.heap[currentChildIdx];\n\n // swap parent & max child\n\n this.heap[currentChildIdx] = currentNode;\n this.heap[currentIdx] = currentChildNode;\n\n\n // update pointers\n currentIdx = currentChildIdx;\n [left, right] = [currentIdx * 2 + 1, currentIdx * 2 + 2];\n currentChildIdx = (\n this.heap[right] && this.heap[right].priority >= this.heap[left].priority ? right : left\n );\n }\n\n return removed;\n }",
"removeMin() {\r\n\t\tthis.remove(this.heap[0]);\r\n\t}",
"removeMax() {\r\n\t\tthis.remove(this.heap[0]);\r\n\t}",
"remove() {\n if (this.isEmpty()) return;\n this.swap(0, this.store.length - 1);\n const { value } = this.store.pop();\n if (!this.isEmpty()) this.heapDown(0);\n return value;\n }",
"delete() {\n // implement delete\n // only delete if the heap has elements\n if (this.heap.length > 0) {\n // save the smallest element\n let smallest = this.heap[0];\n // swap the last element in the heap whatever it is \n this.heap[0] = this.heap[this.heap.length -1];\n this.heap.pop();\n this.minHeapifyDown(0, this.heap);\n return smallest;\n }\n }",
"remove(element,comparator=this.compare){\r\n let totalOccurenceOfElement=this.find(element,comparator).length;\r\n for(let i=0;i<totalOccurenceOfElement;i++){\r\n let removeIndex=this.heapContainer.findIndex((x)=> comparator.equal(x,element)); // findIndex is used for finding first found element's index\r\n let heapSize=this.heapContainer.length;\r\n // if the element is at last index simply remove it as we\r\n // don't need to haepify\r\n if(removeIndex===heapSize-1){\r\n this.heapContainer.pop();\r\n }\r\n else{\r\n this.heapContainer[removeIndex]=this.heapContainer[heapSize-1]; \r\n this.heapContainer.pop();\r\n let parentElement=this.getParent(removeIndex);\r\n let elementAtRemovedIndex=this.heapContainer[removeIndex];\r\n // if at index where the element is removed does not have a parent element that means it was on root and we cannot go up to heapify and alternately if the parent element\r\n // is in right order as compare to the new element that is moved to removed index that means we dont' have to take care of upper part of heap as if it is i right position to parent than it will also be in correct position to it's\r\n // parent's parent and we have used hasLeftChild because we only need to heapify down if there exists element in \r\n // down side\r\n if(!parentElement || this.isPairInRightOrder(parentElement,elementAtRemovedIndex) && this.hasLeftChild(removeIndex)){\r\n this.heapifyDown(removeIndex);\r\n }\r\n else{\r\n this.heapifyUp(removeIndex);\r\n }\r\n }\r\n \r\n }\r\n return this;\r\n }",
"remove() {\n if (this.heap.length === 0) {\n return null;\n }\n const item = this.heap[0];\n this.heap[0] = this.heap[this.heap.length - 1];\n this.heap.pop();\n this.heapifyDown();\n return item;\n }",
"remove() {\n if (this.heap.length === 0) {\n return null;\n }\n const item = this.heap[0];\n this.heap[0] = this.heap[this.heap.length - 1];\n this.heap.pop();\n this.heapifyDown();\n return item;\n }",
"delMin() {\n /*\n * Save reference to the min key.\n * Swap the min key with the last key in the heap.\n * Decrement n so that the key does not swim back up the heap.\n * Sink down the heap to fix any violations that have arisen.\n * Delete the min key to prevent loitering, and return its reference.\n */\n let min = this.heap[1];\n\n [this.heap[1], this.heap[this.n]] = [this.heap[this.n], this.heap[1]];\n this.n--;\n this.sink(1);\n this.heap[this.n+1] = null;\n\n return min;\n }",
"remove(item) {\n // Find number of items to remove.\n const numberOfItemsToRemove = this.find(item).length;\n\n for (let iteration = 0; iteration < numberOfItemsToRemove; iteration += 1) {\n // We need to find item index to remove each time after removal since\n // indices are being changed after each heapify process.\n const indexToRemove = this.find(item).pop();\n\n // If we need to remove last child in the heap then just remove it.\n // There is no need to heapify the heap afterwards.\n if (indexToRemove === this.heapContainer.length - 1) {\n this.heapContainer.pop();\n } else {\n // Move last element in heap to the vacant (removed) position.\n this.heapContainer[indexToRemove] = this.heapContainer.pop();\n\n // Get parent.\n const parentItem = this.parent(indexToRemove);\n\n // If there is no parent or parent is in correct order with the node\n // we're going to delete then heapify down. Otherwise heapify up.\n if (\n this.hasLeftChild(indexToRemove) &&\n (!parentItem || parentItem <= this.heapContainer[indexToRemove])\n ) {\n this.heapifyDown(indexToRemove);\n } else {\n this.heapifyUp(indexToRemove);\n }\n }\n }\n\n return this;\n }",
"deleteMax() {\n // recall that we have an empty position at the very front of the array, \n // so an array length of 2 means there is only 1 item in the heap\n\n if (this.array.length === 1) return null;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// edge case- if no nodes in tree, exit\n\n if (this.array.length === 2) return this.array.pop();\t\t\t\t\t\t\t\t\t\t\t\t// edge case- if only 1 node in heap, just remove it (2 bec. null doesnt count)\n\n let max = this.array[1];\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// save reference to root value (max)\n\n this.array[1] = this.array.pop();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t // remove last val in array (farthest right node in tree), and update root value with it\n\n this.siftDown(1);\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// continuoully swap the new root toward the back of the array to maintain maxHeap property\n\n return max;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// return max value\n }",
"pop(){\r\n if (this.top === -1){\r\n return undefined;\r\n }else{\r\n delete this.storage[this.top];\r\n this.top -= 1;\r\n }\r\n }",
"pop(value) {\n if (!this.length) {\n return null;\n }\n const deletedValue = this.stackData.pop();\n this.length--;\n if (!this.length) {\n this.bottom = null;\n this.top = null;\n }\n return deletedValue;\n }",
"heapDown(index) {\n const [leftIndex, rightIndex] = this.children(index);\n \n if (!leftIndex && !rightIndex) return;\n\n let min;\n rightIndex ? min = rightIndex : min = leftIndex;\n if ((leftIndex && rightIndex) &&\n this.store[leftIndex].key < this.store[rightIndex].key) {\n min = leftIndex;\n }\n\n if (this.store[index].key > this.store[min].key) {\n this.swap(index, min);\n this.heapDown(min);\n }\n }",
"removeNode (value) {\n this.nodes.delete(value)\n this.nodes.forEach(node => {\n if (node.includes(value)) {\n let newNodes = node.filter(item => item !== value)\n while (node.length > 0) {\n node.pop()\n }\n newNodes.forEach(item => node.push(item))\n }\n })\n }",
"remove(key) {\n this.storage.set(getIndexBelowMax(key), undefined);\n }",
"extractMax(){\n // bubble down\n // swap first and last element.\n // then pop\n [this.values[0],this.values[this.values.length-1]] = [this.values[this.values.length-1], this.values[0]]\n // console.log(element + ' removed from the heap');\n this.values.pop();\n let index = 0;\n while(true){\n // compare with both the children and swap with the larger one.\n let leftParent = 2 * index + 1;\n let rightParent = 2 * index + 2;\n if(this.values[index] < this.values[leftParent] || this.values[index] < this.values[rightParent]){\n if(this.values[leftParent] > this.values[rightParent]){\n [this.values[index], this.values[leftParent]] = [this.values[leftParent], this.values[index]]\n index = leftParent;\n\n }\n else if(this.values[rightParent] > this.values[leftParent]){\n [this.values[index], this.values[rightParent]] = [this.values[rightParent], this.values[index]]\n index = rightParent;\n }\n else {\n if(this.values[rightParent]){\n [this.values[index], this.values[rightParent]] = [this.values[rightParent], this.values[index]]\n index = rightParent\n }\n else {\n [this.values[index], this.values[leftParent]] = [this.values[leftParent], this.values[index]]\n index = leftParent\n }\n \n };\n }\n else return;\n }\n }",
"removeByValue (value) {\n\t\tthis.remove(this.findFirst(value));\n\t}",
"function remove() {\n var index = Math.floor(Math.random() * values.length);\n console.log(\"DEL \" + values[index]);\n tree.remove(values[index]);\n values.splice(index, 1);\n}",
"delete(value) {\n if (this.head.back === this.head && this.head.value === value) {\n this.head = null;\n } else {\n let temp = this.head;\n\n while (temp.value !== value) {\n if (temp.forward.value <= temp.value) {\n return false;\n }\n temp = temp.forward;\n }\n\n temp.back.forward = temp.forward;\n temp.forward.back = temp.back;\n\n if (temp === this.head) {\n this.head = temp.forward;\n }\n\n delete this.temp;\n }\n this.size--;\n return true;\n }",
"pop() {\n //delete the current top values within the stack\n delete this.items[this.top];\n //deduct 1 from the top to show the new top index\n this.top = this.top -1;\n }",
"extract() {\n\t\tif (this.isEmpty()) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (this.size() === 1) {\n\t\t\treturn this.heap.shift();\n\t\t}\n\t\tconst removedValue = this.heap[0];\n\t\tthis.heap[0] = this.heap.pop();\n\t\tthis.siftDown(0);\n\t\treturn removedValue;\n\t}",
"function heapDeleteRoot()\n{\n\tif (!this.isEmpty()) { \n\t\t// save root key and item pair\n\t\tvar root = [ this.h[1], this.h_item[1] ]; \n }\n\telse { //if heap is empty\n\t\treturn \"The heap is empty\";\n\t}\n\t// ... complete\n\tthis.h_item[1] = this.h_item[this.size];\n\n this.h[1] = this.h[this.size];\n this.heapify(1);\n\t\n //decrease the heap size by 1 since we delete from it\n this.size = this.size-1;\n\n\treturn root;\n}",
"remove(key) {\n\n // getIndexBelowMax(this.storage[key]);\n }",
"remove(value) {\n if (this.head === null) return;\n\n if (this.head.data === value) this.removeFirst();\n\n let prev = this.head;\n let cur = this.head;\n while (cur !== null && cur.data !== value) {\n prev = cur;\n cur = cur.next;\n }\n if (cur !== null) prev.next = cur.next;\n }",
"function pqdownheap(tree, k) {\n\t\tvar v = heap[k],\n\t\t\tj = k << 1; // left son of k\n\n\t\twhile (j <= heap_len) {\n\t\t\t// Set j to the smallest of the two sons:\n\t\t\tif (j < heap_len && SMALLER(tree, heap[j + 1], heap[j])) {\n\t\t\t\tj++;\n\t\t\t}\n\n\t\t\t// Exit if v is smaller than both sons\n\t\t\tif (SMALLER(tree, v, heap[j])) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Exchange v with the smallest son\n\t\t\theap[k] = heap[j];\n\t\t\tk = j;\n\n\t\t\t// And continue down the tree, setting j to the left son of k\n\t\t\tj <<= 1;\n\t\t}\n\t\theap[k] = v;\n\t}",
"remove(value) {\n let currentNode = this.head;\n\n if (currentNode !== null) {\n if (currentNode.data == value) {\n this.head = currentNode.next;\n this.size--;\n } else {\n let previousNode;\n\n while (currentNode && currentNode.data !== value) {\n previousNode = currentNode;\n currentNode = currentNode.next;\n }\n\n if (currentNode && previousNode) {\n previousNode.next = currentNode.next;\n this.size--;\n } else {\n return `Given ${value} value not found !!!`;\n }\n }\n }\n }",
"delete(val) {\n let ind = this.values.indexOf(val)\n if(this.has(val)) {\n this.values.splice(ind, 1);\n }\n }"
] | [
"0.80592644",
"0.771712",
"0.75571394",
"0.75185335",
"0.748075",
"0.7324977",
"0.7206284",
"0.7075653",
"0.7057192",
"0.7057192",
"0.6849966",
"0.67913896",
"0.66329116",
"0.65866756",
"0.6565453",
"0.64938587",
"0.64443773",
"0.6443872",
"0.6382864",
"0.6373806",
"0.6357709",
"0.6350169",
"0.6332954",
"0.6317014",
"0.62710875",
"0.62187046",
"0.6216089",
"0.6203261",
"0.6201298",
"0.61842114"
] | 0.77889985 | 1 |
returns the max value from the heap | findMax() {
return this.heap[0];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"extractMax() {\n\t\tconst max = this.heap[0];\n\t\tconst tmp = this.heap.pop();\n\t\tif (!this.empty()) {\n\t\t\tthis.heap[0] = tmp;\n\t\t\tthis.sinkDown(0);\n\t\t}\n\t\treturn max;\n\t}",
"extractMax() {\r\n\t\tconst max = this.heap[0];\r\n\t\tthis.remove(max);\r\n\t\treturn max;\r\n\t}",
"function maxHeap(val, parentVal) {\n return val > parentVal;\n}",
"deleteMax() {\n // recall that we have an empty position at the very front of the array, \n // so an array length of 2 means there is only 1 item in the heap\n\n if (this.array.length === 1) return null;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// edge case- if no nodes in tree, exit\n\n if (this.array.length === 2) return this.array.pop();\t\t\t\t\t\t\t\t\t\t\t\t// edge case- if only 1 node in heap, just remove it (2 bec. null doesnt count)\n\n let max = this.array[1];\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// save reference to root value (max)\n\n this.array[1] = this.array.pop();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t // remove last val in array (farthest right node in tree), and update root value with it\n\n this.siftDown(1);\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// continuoully swap the new root toward the back of the array to maintain maxHeap property\n\n return max;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// return max value\n }",
"maxValue() {\n let currNode = this.top;\n let maxValue = this.top.value;\n \n while (currNode.next) {\n if (currNode.next.value > maxValue) maxValue = currNode.next.value;\n currNode = currNode.next;\n }\n \n return maxValue;\n }",
"extractMax(){\n // bubble down\n // swap first and last element.\n // then pop\n [this.values[0],this.values[this.values.length-1]] = [this.values[this.values.length-1], this.values[0]]\n // console.log(element + ' removed from the heap');\n this.values.pop();\n let index = 0;\n while(true){\n // compare with both the children and swap with the larger one.\n let leftParent = 2 * index + 1;\n let rightParent = 2 * index + 2;\n if(this.values[index] < this.values[leftParent] || this.values[index] < this.values[rightParent]){\n if(this.values[leftParent] > this.values[rightParent]){\n [this.values[index], this.values[leftParent]] = [this.values[leftParent], this.values[index]]\n index = leftParent;\n\n }\n else if(this.values[rightParent] > this.values[leftParent]){\n [this.values[index], this.values[rightParent]] = [this.values[rightParent], this.values[index]]\n index = rightParent;\n }\n else {\n if(this.values[rightParent]){\n [this.values[index], this.values[rightParent]] = [this.values[rightParent], this.values[index]]\n index = rightParent\n }\n else {\n [this.values[index], this.values[leftParent]] = [this.values[leftParent], this.values[index]]\n index = leftParent\n }\n \n };\n }\n else return;\n }\n }",
"function maxHeapify(arr){\n\n}",
"extractMax() {\n const max = this.values[0];\n const end = this.values.pop();\n this.values[0] = end;\n this.sinkDown();\n return max;\n }",
"function max() {\n // set node to the root value\n var node = this.root;\n // loop until there is no more values to the right\n while( node.right != null ) {\n node = node.right; // move to the right value\n } // end while\n return node.data;\n} // end max",
"extractMax() {\n // swap the first value in the values property with the last value\n // pop from the values property, so you can return the value at the end.\n // 'sink down' to the correct spot\n const max = this.values[0];\n const end = this.values.pop();\n if (this.values.length > 0) {\n this.values[0] = end;\n // move it to the correct position\n this.bubbleDown();\n }\n return max;\n }",
"extractMax() {\n if (this.values.length===1) {\n return this.values.pop()\n }\n let max = this.values[0]\n let tail = this.values.pop()\n this.values[0] = tail\n let index = 0\n let element = this.values[index]\n // repeat until neither child is greater than the element\n while(true) {\n let swapped = null\n let leftIndex = 2 * index + 1\n let rightIndex = 2 * index + 2\n if (leftIndex < this.values.length) {\n if(this.values[leftIndex] > element) {\n swapped = leftIndex\n }\n }\n if (rightIndex < this.values.length) {\n if( (!swapped && this.values[rightIndex] > element || !!swapped && this.values[rightIndex] > this.values[leftIndex])) {\n swapped = rightIndex\n }\n }\n if (swapped===null) break\n this.values[index] = this.values[swapped]\n this.values[swapped] = element\n index = swapped\n }\n return max\n }",
"function MaxHeap(array){\r\n Heap.call(this, array);\r\n \r\n // Build-max-heap method: produces a max-heap from an unordered input array\r\n // The elements in the subarray A[(floor(n/2)+1) .. n] are all leaves of the tree, and so\r\n // start doing Float-down from the top non-leave element ( floor(A.length/2) ) to the bottom ( A[i] )\r\n for (var i = Math.floor( this.heapSize / 2 ); i>0; i--){\r\n this.floatDownElementOfIndex(i)\r\n }\r\n}",
"maxHeap(index) {\n var left = this.left(index);\n var right = this.right(index);\n var largest = index;\n if (left < this.heapSize && this.array[left] > this.array[index]) {\n largest = left;\n }\n if (right < this.heapSize && this.array[right] > this.array[largest]) {\n largest = right;\n }\n if (largest != index) {\n this.swap(this.array, index, largest);\n this.maxHeap(largest);\n }\n }",
"max() {\n let currentNode = this.root;\n // continue traversing right until no more children\n while(currentNode.right) {\n currentNode = currentNode.right;\n }\n return currentNode.value;\n }",
"function BSTMax(){\n var walker = this.root;\n while (walker.right != null){\n walker = walker.right;\n }\n return walker.val;\n }",
"extractMax() {\n let values = this.values;\n if (values.length === 0) return;\n let max = values[0];\n // For time complexity reasons, I swap first then remove the old root node\n values[0] = values[values.length - 1];\n values.pop();\n console.log(values);\n // instatiate child nodes\n let child1, child2, indexToSwap;\n let currentIndex = 0;\n while (true) {\n child1 = currentIndex * 2 + 1;\n child2 = currentIndex * 2 + 2;\n if (values[currentIndex] >= Math.max(values[child1], values[child2])) {\n break;\n }\n indexToSwap = values[child1] > values[child2] ? child1 : child2;\n if (!values[indexToSwap]) break;\n let oldNode = values[currentIndex];\n values[currentIndex] = values[indexToSwap];\n values[indexToSwap] = oldNode;\n currentIndex = indexToSwap;\n }\n this.values = values;\n return max;\n }",
"extractMax(){\n const max = this.values.shift();\n let current = this.values.pop();\n if(this.values.length > 0){\n this.values.unshift(current);\n this.sinkDown();\n }\n return max;\n }",
"findMaxValue() {\n\n let current = this.root;\n\n const findMax = (node) => {\n if (node === null) {\n return;\n }\n\n let actualMax = node.value;\n let leftSideMax = findMax(node.left);\n let rightSideMax = findMax(node.right);\n\n if (leftSideMax > actualMax) {\n actualMax = leftSideMax;\n }\n\n if (rightSideMax > actualMax) {\n actualMax = rightSideMax;\n }\n\n return actualMax;\n };\n\n return findMax(current);\n }",
"extractMax() {\n const max = this.values[0]\n const end = this.values.pop()\n\n if (this.values.length > 0) {\n this.values[0] = end\n this._sinkDown()\n }\n\n return max\n }",
"max() {\n let currentNode = this.root;\n // Case for no root\n if(!currentNode) {\n throw new Error('This tree does not yet contain any values');\n return;\n }\n while(currentNode.right) {\n currentNode = currentNode.right;\n }\n return currentNode.value;\n }",
"max() {\r\n return this.maxHelper(this.root);\r\n }",
"removeMax() {\r\n\t\tthis.remove(this.heap[0]);\r\n\t}",
"function findMax(stack) {\n var maxSize = 0;\n var max = null;\n for (var i = 0; i < stack.length; i++) {\n var peasant = stack[i];\n if (peasant.size > maxSize) {\n maxSize = peasant.size;\n max = peasant;\n }\n }\n\n return max;\n}",
"getMax() {\n let values = [];\n let current = this.head;\n\n // collect all values in the list\n while (current) {\n values.push(current.value);\n\n current = current.next;\n }\n\n return values.length === 0 ? null : Math.max(...values);\n }",
"maximum() {\n if (this.isEmpty()) {\n return null;\n }\n\n return this.doMaximum(this.root).key;\n }",
"max(){\r\n if(this.isEmpty()){\r\n console.log(\"Tree is empty!\");\r\n return null;\r\n }\r\n let runner = this.root;\r\n while(runner.right != null){\r\n runner = runner.right;\r\n }\r\n return runner.value;\r\n }",
"extractMax(){\r\n if(this.values.length === 1) return this.values.pop();\r\n const oldRoot = this.values[0];\r\n this.values[0] = this.values[this.values.length-1];\r\n this.values.pop();\r\n let idx = 0;\r\n let child1 = (2*idx) + 1;\r\n let child2 = (2*idx) + 2;\r\n\r\n while(this.values[idx] < this.values[child1] || \r\n this.values[idx] < this.values[child2]){\r\n child1 = (2*idx) + 1;\r\n child2 = (2*idx) + 2;\r\n if(this.values[child1] >= this.values[child2]){\r\n let temp = this.values[child1];\r\n this.values[child1] = this.values[idx];\r\n this.values[idx] = temp;\r\n idx = child1;\r\n } else {\r\n let temp = this.values[child2];\r\n this.values[child2] = this.values[idx];\r\n this.values[idx] = temp;\r\n idx = child2;\r\n }\r\n }\r\n return oldRoot;\r\n }",
"get maximumValue() {\r\n return this.i.bk;\r\n }",
"function MaxPriorityQueue(array){\r\n MaxHeap.call(this, array)\r\n}",
"function max(arr){\n return sortNumbers(arr)[arr.length - 1];\n }"
] | [
"0.82991564",
"0.7957347",
"0.78086686",
"0.7646159",
"0.7423833",
"0.73725516",
"0.7348753",
"0.72745484",
"0.72237366",
"0.72114444",
"0.7197894",
"0.7177174",
"0.7163383",
"0.7146565",
"0.70919085",
"0.70852536",
"0.70802695",
"0.7070464",
"0.7062798",
"0.7037336",
"0.7013775",
"0.6969921",
"0.6968393",
"0.6965604",
"0.69146156",
"0.6899203",
"0.686",
"0.6844688",
"0.6844106",
"0.6824768"
] | 0.84279215 | 0 |
removes the max value from the heap | removeMax() {
this.remove(this.heap[0]);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"deleteMax() {\n // recall that we have an empty position at the very front of the array, \n // so an array length of 2 means there is only 1 item in the heap\n\n if (this.array.length === 1) return null;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// edge case- if no nodes in tree, exit\n\n if (this.array.length === 2) return this.array.pop();\t\t\t\t\t\t\t\t\t\t\t\t// edge case- if only 1 node in heap, just remove it (2 bec. null doesnt count)\n\n let max = this.array[1];\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// save reference to root value (max)\n\n this.array[1] = this.array.pop();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t // remove last val in array (farthest right node in tree), and update root value with it\n\n this.siftDown(1);\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// continuoully swap the new root toward the back of the array to maintain maxHeap property\n\n return max;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// return max value\n }",
"remove() {\n if (this.heap.length < 2) {\n return this.heap.pop(); //easy\n }\n\n const removed = this.heap[0]; // save to return later\n this.heap[0] = this.heap.pop(); // replace with last el\n\n let currentIdx = 0;\n let [left, right] = [currentIdx * 2 + 1, currentIdx * 2 + 2];\n let currentChildIdx = (\n this.heap[right] && this.heap[right].priority >= this.heap[left].priority ? right : left\n );\n // right if heap[right].priority >= heap[left].priority, else left\n // index of max(left.priority, right.priority)\n\n while (\n this.heap[currentChildIdx] && this.heap[currentIdx].priority <= this.heap[currentChildIdx].priority\n ) {\n let currentNode = this.heap[currentIdx];\n let currentChildNode = this.heap[currentChildIdx];\n\n // swap parent & max child\n\n this.heap[currentChildIdx] = currentNode;\n this.heap[currentIdx] = currentChildNode;\n\n\n // update pointers\n currentIdx = currentChildIdx;\n [left, right] = [currentIdx * 2 + 1, currentIdx * 2 + 2];\n currentChildIdx = (\n this.heap[right] && this.heap[right].priority >= this.heap[left].priority ? right : left\n );\n }\n\n return removed;\n }",
"extractMax(){\n // bubble down\n // swap first and last element.\n // then pop\n [this.values[0],this.values[this.values.length-1]] = [this.values[this.values.length-1], this.values[0]]\n // console.log(element + ' removed from the heap');\n this.values.pop();\n let index = 0;\n while(true){\n // compare with both the children and swap with the larger one.\n let leftParent = 2 * index + 1;\n let rightParent = 2 * index + 2;\n if(this.values[index] < this.values[leftParent] || this.values[index] < this.values[rightParent]){\n if(this.values[leftParent] > this.values[rightParent]){\n [this.values[index], this.values[leftParent]] = [this.values[leftParent], this.values[index]]\n index = leftParent;\n\n }\n else if(this.values[rightParent] > this.values[leftParent]){\n [this.values[index], this.values[rightParent]] = [this.values[rightParent], this.values[index]]\n index = rightParent;\n }\n else {\n if(this.values[rightParent]){\n [this.values[index], this.values[rightParent]] = [this.values[rightParent], this.values[index]]\n index = rightParent\n }\n else {\n [this.values[index], this.values[leftParent]] = [this.values[leftParent], this.values[index]]\n index = leftParent\n }\n \n };\n }\n else return;\n }\n }",
"removeMin() {\r\n\t\tthis.remove(this.heap[0]);\r\n\t}",
"extractMax() {\r\n\t\tconst max = this.heap[0];\r\n\t\tthis.remove(max);\r\n\t\treturn max;\r\n\t}",
"extractMax() {\n\t\tconst max = this.heap[0];\n\t\tconst tmp = this.heap.pop();\n\t\tif (!this.empty()) {\n\t\t\tthis.heap[0] = tmp;\n\t\t\tthis.sinkDown(0);\n\t\t}\n\t\treturn max;\n\t}",
"remove() {\n // Swap root value with last element in the heap\n // Pop the last element from heap array\n // Perform siftDown to correct position of swapped value\n // Return popped value\n this.swap(0, this.heap.length - 1, this.heap);\n const valueToRemove = this.heap.pop();\n this.siftDown(0, this.heap.length - 1, this.heap);\n \n return valueToRemove;\n }",
"function maxHeapify(arr){\n\n}",
"remove(data) {\r\n\t\tconst size = this.heap.length;\r\n\r\n\t\tlet i;\r\n\t\tfor (i = 0; i < size; i++) {\r\n\t\t\tif (data === this.heap[i]) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t[this.heap[i], this.heap[size - 1]] = [this.heap[size - 1], this.heap[i]];\r\n\t\tthis.heap.splice(size - 1);\r\n\r\n\t\tfor (let i = parseInt(this.heap.length / 2 - 1); i >= 0; i--) {\r\n\t\t\tthis.maxHeapify(this.heap, this.heap.length, i);\r\n\t\t}\r\n\t}",
"function nMax(){\n var arr=[-3,3,5,7];\n var max= arr[0];\n for(var i = 0; i< arr.length; i++){\n if(arr[i]>max){\n max=arr[i];\n arr.splice(max);\n }\n }\n for(var i=0; i<arr.length;i++){\n if(arr[i]>max){\n max=arr[i];\n \n }\n }\n console.log(max);\n return max;\n }",
"function maxHeap(val, parentVal) {\n return val > parentVal;\n}",
"delete() {\n // implement delete\n // only delete if the heap has elements\n if (this.heap.length > 0) {\n // save the smallest element\n let smallest = this.heap[0];\n // swap the last element in the heap whatever it is \n this.heap[0] = this.heap[this.heap.length -1];\n this.heap.pop();\n this.minHeapifyDown(0, this.heap);\n return smallest;\n }\n }",
"delMin() {\n /*\n * Save reference to the min key.\n * Swap the min key with the last key in the heap.\n * Decrement n so that the key does not swim back up the heap.\n * Sink down the heap to fix any violations that have arisen.\n * Delete the min key to prevent loitering, and return its reference.\n */\n let min = this.heap[1];\n\n [this.heap[1], this.heap[this.n]] = [this.heap[this.n], this.heap[1]];\n this.n--;\n this.sink(1);\n this.heap[this.n+1] = null;\n\n return min;\n }",
"function deleteMax(h) { \n if (isRed(h.left))\n h = rotateRight(h);\n\n if (h.right == null || h.right == undefined)\n return null;\n\n if (!isRed(h.right) && !isRed(h.right.left))\n h = moveRedRight(h);\n\n h.right = deleteMax(h.right);\n\n return balance(h);\n }",
"heapDown(index) {\n const [leftIndex, rightIndex] = this.children(index);\n \n if (!leftIndex && !rightIndex) return;\n\n let min;\n rightIndex ? min = rightIndex : min = leftIndex;\n if ((leftIndex && rightIndex) &&\n this.store[leftIndex].key < this.store[rightIndex].key) {\n min = leftIndex;\n }\n\n if (this.store[index].key > this.store[min].key) {\n this.swap(index, min);\n this.heapDown(min);\n }\n }",
"function insert_max_heap(A, no, value) {\n A[no] = value //Insert , a new element will be added always at last \n const n = no\n let i = n\n\n //apply hepify method till we reach root (i=1)\n while (i >= 1) {\n const parent = Math.floor((i - 1) / 2)\n if (A[parent] < A[i]) {\n swap(A, parent, i)\n i = parent\n } else {\n i = parent\n //return ;\n }\n }\n}",
"extractMax(){\n const max = this.values.shift();\n let current = this.values.pop();\n if(this.values.length > 0){\n this.values.unshift(current);\n this.sinkDown();\n }\n return max;\n }",
"findMax() {\r\n\t\treturn this.heap[0];\r\n\t}",
"extractMax(){\r\n if(this.values.length === 1) return this.values.pop();\r\n const oldRoot = this.values[0];\r\n this.values[0] = this.values[this.values.length-1];\r\n this.values.pop();\r\n let idx = 0;\r\n let child1 = (2*idx) + 1;\r\n let child2 = (2*idx) + 2;\r\n\r\n while(this.values[idx] < this.values[child1] || \r\n this.values[idx] < this.values[child2]){\r\n child1 = (2*idx) + 1;\r\n child2 = (2*idx) + 2;\r\n if(this.values[child1] >= this.values[child2]){\r\n let temp = this.values[child1];\r\n this.values[child1] = this.values[idx];\r\n this.values[idx] = temp;\r\n idx = child1;\r\n } else {\r\n let temp = this.values[child2];\r\n this.values[child2] = this.values[idx];\r\n this.values[idx] = temp;\r\n idx = child2;\r\n }\r\n }\r\n return oldRoot;\r\n }",
"remove(data) {\r\n\t\tconst size = this.heap.length;\r\n\r\n\t\tlet i;\r\n\t\tfor (i = 0; i < size; i++) {\r\n\t\t\tif (data === this.heap[i]) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t[this.heap[i], this.heap[size - 1]] = [this.heap[size - 1], this.heap[i]];\r\n\t\tthis.heap.splice(size - 1);\r\n\r\n\t\tfor (let i = parseInt(this.heap.length / 2 - 1); i >= 0; i--) {\r\n\t\t\tthis.minHeapify(this.heap, this.heap.length, i);\r\n\t\t}\r\n\t}",
"extractMax() {\n if (this.values.length===1) {\n return this.values.pop()\n }\n let max = this.values[0]\n let tail = this.values.pop()\n this.values[0] = tail\n let index = 0\n let element = this.values[index]\n // repeat until neither child is greater than the element\n while(true) {\n let swapped = null\n let leftIndex = 2 * index + 1\n let rightIndex = 2 * index + 2\n if (leftIndex < this.values.length) {\n if(this.values[leftIndex] > element) {\n swapped = leftIndex\n }\n }\n if (rightIndex < this.values.length) {\n if( (!swapped && this.values[rightIndex] > element || !!swapped && this.values[rightIndex] > this.values[leftIndex])) {\n swapped = rightIndex\n }\n }\n if (swapped===null) break\n this.values[index] = this.values[swapped]\n this.values[swapped] = element\n index = swapped\n }\n return max\n }",
"function insert(maxHeap, value) {\n let currentIndex = maxHeap.length;\n let parent = Math.floor((currentIndex - 1) / 2);\n maxHeap.push(value);\n while (maxHeap[currentIndex] > maxHeap[parent]) {\n let temp = maxHeap[parent];\n maxHeap[parent] = maxHeap[currentIndex];\n maxHeap[currentIndex] = temp;\n currentIndex = parent;\n parent = Math.floor((currentIndex - 1) / 2);\n }\n return maxHeap;\n}",
"extractMax() {\n let values = this.values;\n if (values.length === 0) return;\n let max = values[0];\n // For time complexity reasons, I swap first then remove the old root node\n values[0] = values[values.length - 1];\n values.pop();\n console.log(values);\n // instatiate child nodes\n let child1, child2, indexToSwap;\n let currentIndex = 0;\n while (true) {\n child1 = currentIndex * 2 + 1;\n child2 = currentIndex * 2 + 2;\n if (values[currentIndex] >= Math.max(values[child1], values[child2])) {\n break;\n }\n indexToSwap = values[child1] > values[child2] ? child1 : child2;\n if (!values[indexToSwap]) break;\n let oldNode = values[currentIndex];\n values[currentIndex] = values[indexToSwap];\n values[indexToSwap] = oldNode;\n currentIndex = indexToSwap;\n }\n this.values = values;\n return max;\n }",
"buildMaxHeap() {}",
"maxToBack(){\n var runner = this.head;\n var max = this.head\n var prevnode = this.head\n var maxprev = null\n while (runner != null) {\n if (runner.val > max.val) {\n max = runner;\n maxprev = prevnode\n }\n prevnode = runner\n runner = runner.next\n }\n prevnode.next = max\n maxprev.next = max.next\n max.next = null;\n }",
"function MaxPriorityQueue(array){\r\n MaxHeap.call(this, array)\r\n}",
"maxHeap(index) {\n var left = this.left(index);\n var right = this.right(index);\n var largest = index;\n if (left < this.heapSize && this.array[left] > this.array[index]) {\n largest = left;\n }\n if (right < this.heapSize && this.array[right] > this.array[largest]) {\n largest = right;\n }\n if (largest != index) {\n this.swap(this.array, index, largest);\n this.maxHeap(largest);\n }\n }",
"function buildMaxHeap() {\n for (let i = Math.floor(array.length / 2) - 1; i >= 0; i--) {\n maxHeapify(i, array.length);\n }\n}",
"Dequeue() {\r\n if (this.heap.length == 0) return;\r\n const highestPriority = this.heap[0];\r\n const leastPriority = this.heap[this.heap.length - 1];\r\n //swap first and last priority\r\n this.heap[this.heap.length - 1] = highestPriority;\r\n this.heap[0] = leastPriority;\r\n this.heap.pop();\r\n let nodeIndex = 0; //sink down\r\n while (true) {\r\n const left = this.heap[2 * nodeIndex + 1];\r\n const right = this.heap[2 * nodeIndex + 2];\r\n const leastElement = this.heap[nodeIndex];\r\n if (\r\n right &&\r\n right.priority < left.priority &&\r\n right.priority < leastElement.priority\r\n ) {\r\n this.heap[2 * nodeIndex + 2] = leastElement;\r\n this.heap[nodeIndex] = right;\r\n nodeIndex = 2 * nodeIndex + 2;\r\n } else if (\r\n left &&\r\n left.priority < right.priority &&\r\n left.priority < leastElement.priority\r\n ) {\r\n this.heap[2 * nodeIndex + 1] = leastElement;\r\n this.heap[nodeIndex] = left;\r\n nodeIndex = 2 * nodeIndex + 1;\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n return highestPriority;\r\n }",
"function MaxHeap(array){\r\n Heap.call(this, array);\r\n \r\n // Build-max-heap method: produces a max-heap from an unordered input array\r\n // The elements in the subarray A[(floor(n/2)+1) .. n] are all leaves of the tree, and so\r\n // start doing Float-down from the top non-leave element ( floor(A.length/2) ) to the bottom ( A[i] )\r\n for (var i = Math.floor( this.heapSize / 2 ); i>0; i--){\r\n this.floatDownElementOfIndex(i)\r\n }\r\n}"
] | [
"0.8018191",
"0.76265055",
"0.7623531",
"0.7504439",
"0.74354666",
"0.72889215",
"0.7252715",
"0.71510285",
"0.71128887",
"0.7089084",
"0.69999665",
"0.6982427",
"0.6941861",
"0.68232596",
"0.6717149",
"0.67013896",
"0.6697178",
"0.66557425",
"0.6639741",
"0.6616899",
"0.661175",
"0.6586071",
"0.6577476",
"0.6492891",
"0.64878803",
"0.64686894",
"0.646686",
"0.6457381",
"0.6451232",
"0.6433157"
] | 0.88509464 | 0 |
return the size of the heap | size() {
return this.heap.length;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"size() {\n\t\treturn this.heap.length;\n\t}",
"getHeap() {\r\n\t\treturn this.heap;\r\n\t}",
"getHeap() {\r\n\t\treturn this.heap;\r\n\t}",
"get size() {\n let size = 0;\n for (let i = 0; i < this.children.length; i++)\n size += this.children[i].size;\n return size;\n }",
"function size() {\r\n var counter = 0;\r\n for (var i = 0; i < this.PriorityQueueContents.length; i++) {\r\n counter += this.PriorityQueueContents[i].ids.length;\r\n }\r\n return counter;\r\n }",
"function size() {\n\t return n;\n\t }",
"function size() {\n return n;\n }",
"size() {\n return Math.abs(this.tail - this.head);\n }",
"function size() {\n return stack_size;\n }",
"function heapisEmpty() {\n return this.size == 0 ? true : false;\n}",
"delete() {\n // implement delete\n // only delete if the heap has elements\n if (this.heap.length > 0) {\n // save the smallest element\n let smallest = this.heap[0];\n // swap the last element in the heap whatever it is \n this.heap[0] = this.heap[this.heap.length -1];\n this.heap.pop();\n this.minHeapifyDown(0, this.heap);\n return smallest;\n }\n }",
"size() {\n return this.rootNode.size(this.storage);\n }",
"buildMaxHeap() {}",
"function getSize(){\n return queue.length;\n }",
"function size(node) {\n return node.size ? node.size : 1;\n }",
"size() {\n return this.tail - this.head;\n }",
"function size(self) {\n return self.size();\n}",
"get size() {}",
"function Heap(type) {\n var heapBuf = utils.expandoBuffer(Int32Array),\n indexBuf = utils.expandoBuffer(Int32Array),\n heavierThan = type == 'max' ? lessThan : greaterThan,\n itemsInHeap = 0,\n dataArr,\n heapArr,\n indexArr;\n\n this.init = function(values) {\n var i;\n dataArr = values;\n itemsInHeap = values.length;\n heapArr = heapBuf(itemsInHeap);\n indexArr = indexBuf(itemsInHeap);\n for (i=0; i<itemsInHeap; i++) {\n insertValue(i, i);\n }\n // place non-leaf items\n for (i=(itemsInHeap-2) >> 1; i >= 0; i--) {\n downHeap(i);\n }\n };\n\n this.size = function() {\n return itemsInHeap;\n };\n\n // Update a single value and re-heap\n this.updateValue = function(valIdx, val) {\n var heapIdx = indexArr[valIdx];\n dataArr[valIdx] = val;\n if (!(heapIdx >= 0 && heapIdx < itemsInHeap)) {\n error(\"Out-of-range heap index.\");\n }\n downHeap(upHeap(heapIdx));\n };\n\n this.popValue = function() {\n return dataArr[this.pop()];\n };\n\n this.getValue = function(idx) {\n return dataArr[idx];\n };\n\n this.peek = function() {\n return heapArr[0];\n };\n\n this.peekValue = function() {\n return dataArr[heapArr[0]];\n };\n\n // Return the idx of the lowest-value item in the heap\n this.pop = function() {\n var popIdx;\n if (itemsInHeap <= 0) {\n error(\"Tried to pop from an empty heap.\");\n }\n popIdx = heapArr[0];\n insertValue(0, heapArr[--itemsInHeap]); // move last item in heap into root position\n downHeap(0);\n return popIdx;\n };\n\n function upHeap(idx) {\n var parentIdx;\n // Move item up in the heap until it's at the top or is not lighter than its parent\n while (idx > 0) {\n parentIdx = (idx - 1) >> 1;\n if (heavierThan(idx, parentIdx)) {\n break;\n }\n swapItems(idx, parentIdx);\n idx = parentIdx;\n }\n return idx;\n }\n\n // Swap item at @idx with any lighter children\n function downHeap(idx) {\n var minIdx = compareDown(idx);\n\n while (minIdx > idx) {\n swapItems(idx, minIdx);\n idx = minIdx; // descend in the heap\n minIdx = compareDown(idx);\n }\n }\n\n function swapItems(a, b) {\n var i = heapArr[a];\n insertValue(a, heapArr[b]);\n insertValue(b, i);\n }\n\n // Associate a heap idx with the index of a value in data arr\n function insertValue(heapIdx, valId) {\n indexArr[valId] = heapIdx;\n heapArr[heapIdx] = valId;\n }\n\n // comparator for Visvalingam min heap\n // @a, @b: Indexes in @heapArr\n function greaterThan(a, b) {\n var idx1 = heapArr[a],\n idx2 = heapArr[b],\n val1 = dataArr[idx1],\n val2 = dataArr[idx2];\n // If values are equal, compare array indexes.\n // This is not a requirement of the Visvalingam algorithm,\n // but it generates output that matches Mahes Visvalingam's\n // reference implementation.\n // See https://hydra.hull.ac.uk/assets/hull:10874/content\n return (val1 > val2 || val1 === val2 && idx1 > idx2);\n }\n\n // comparator for max heap\n function lessThan(a, b) {\n var idx1 = heapArr[a],\n idx2 = heapArr[b];\n return dataArr[idx1] < dataArr[idx2];\n }\n\n function compareDown(idx) {\n var a = 2 * idx + 1,\n b = a + 1,\n n = itemsInHeap;\n if (a < n && heavierThan(idx, a)) {\n idx = a;\n }\n if (b < n && heavierThan(idx, b)) {\n idx = b;\n }\n return idx;\n }\n }",
"function heapreheapify() {\n\n var node = this.size; // set the size to heap\n var pn = Math.floor(node/2); // use math floor to set last parent node to pn = parent node\n\n var i = pn; // set new varibale and get value pn.\n while(i >= 1)\n {\n var key = i;\n var v = this.h[key];\n var v2 = this.h_item[key];\n var heap = false; // here intitalize heap with boolean value false\n\n for (var j = 2 * key; !heap && 2 * key <= node;)\n {\n if (j < node)\n {\n if (this.h[j] < this.h[j + 1]) {\n j += 1;\n } // end the inner if\n } // end the outer if\n\n\n if (v >= this.h[j])\n {\n heap = true;\n } // end if\n else\n {\n this.h_item[key] = this.h_item[j];\n this.h[key] = this.h[j];\n key = j;\n } // end wlse\n\n this.h[key] = v;\n this.h_item[key] = v2;\n }\n i = i-1; // here decreese the number in each iteration\n } // end while\n}",
"size() {\n return this.stack.length;\n }",
"childCount() {\n\t\tif (!this.state()) { return 0 }\n\n\t\tif (this[_size] === undefined) {\n\t\t\tthis[_size] = Object.keys(this.state()).length;\n\t\t}\n\n\t\treturn this[_size];\n\t}",
"function GetSize() : int\n\t{\n\t\tvar n = 0;\n\t\tfor( var i = 0; i < key2down.length; i++ )\n\t\t{\n\t\t\tif( key2down[i] )\n\t\t\t\tn++;\n\t\t}\n\t\treturn n;\n\t}",
"function maxHeapify(arr){\n\n}",
"constructor(){\n this.heap = [];\n this.count = 0;\n }",
"constructor(){\n this.heap = [];\n this.count = 0;\n }",
"function Heap()\n{\n\t// h[0] not used, heap initially empty\n\n\tthis.h = [null]; // heap of integer keys\n\tthis.h_item = [null]; // corresponding heap of data-items (any object)\n\tthis.size = 0; // 1 smaller than array (also index of last child)\n\n\n\t// --------------------\n\t// PQ-required only; more could be added later when needed\n\t// the 2 basic shape maintaining operations heapify and reheapify simplify\n\t// processing functions\n\n\tthis.isEmpty = heapisEmpty; // return true if heap empty\n\tthis.deleteRoot = heapDeleteRoot; // return data-item in root\n\tthis.insert = heapInsert; // insert data-item with key\n\n\tthis.heapify = heapheapify; // make subtree heap; top-down heapify (\"sink\") used by .deleteRoot()\n\tthis.reheapify = heapreheapify; // bottom-up reheapify (\"swim\") used by .insert()\n\tthis.show = heapShow; \t // utility: return pretty formatted heap as string\n\t \t // ... etc\n\n\t// --------------------\n}",
"function size(x) {\n if (x === null || x == undefined) return 0;\n return x.size;\n }",
"size() {\n let count = 0;\n let node = this.head; // Declare a node variable initialize to this.head\n // While the node exist\n while (node) {\n count++; // Increment count variable\n node = node.next; // reinitialize node to next node (if node.next is null the loop will break)\n }\n return count; // return count (which is the size)\n }",
"get size() {\n return this._queue.size;\n }"
] | [
"0.823258",
"0.6719874",
"0.6719874",
"0.6594933",
"0.65847397",
"0.6490526",
"0.6471409",
"0.64260876",
"0.641185",
"0.63683355",
"0.6361953",
"0.6324604",
"0.6305498",
"0.6303767",
"0.62501025",
"0.6240314",
"0.62244964",
"0.61938465",
"0.61566305",
"0.6134111",
"0.6093153",
"0.60734415",
"0.6067266",
"0.6066432",
"0.6050705",
"0.6050705",
"0.604303",
"0.60254204",
"0.60232586",
"0.59972703"
] | 0.8242203 | 1 |
check if the heap is empty | isEmpty() {
return this.heap.length === 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function heapisEmpty() {\n return this.size == 0 ? true : false;\n}",
"isEmpty() {\n return !this.heapContainer.length;\n }",
"function isEmpty() {\n return this.top === 0;\n}",
"heapHasIndex(index){\r\n if(index>=0 && index<this.heapContainer.length)\r\n return true;\r\n \r\n return false;\r\n }",
"checkEmpty () {\n if (this.front === 0 && this.rear === 0) {\n return true\n }\n }",
"function isEmpty(){\n return (queue.length === 0);\n }",
"isEmpty() {\n return this.top === null;\n }",
"isEmpty() {\n if (this.top === null){\n return true;\n } else {\n return false;\n }\n }",
"get empty() {\n if(this.children.length === 0) {\n return true\n } else {\n return false\n }\n }",
"queueIsFull() {\n return this.queue.length >= this.maxSize\n }",
"isEmpty() {\n if (this._storage.head === null) {\n return true;\n }\n return false;\n }",
"isEmpty() {\n return this.front == -1;\n }",
"isEmpty() {\n if (this.queue.length) {\n return false;\n }\n return true;\n }",
"function isEmptyQ(queue){\n queue.first === null;\n\n const currNode = queue.first;\n\n if(!currNode){\n // is empty!\n return true;\n } else {\n // not empty!\n return false;\n }\n}",
"empty(){\r\n return this.size == 0;\r\n }",
"isEmpty()\n {\n if(this.front===null)\n return true;\n else\n return false;\n }",
"isEmpty(){\n return (this.rear +1 === this.front);\n }",
"empty(){ return this.stack.length === 0; }",
"isEmpty() {\n return this.queue.size() === 0;\n }",
"isEmpty() {\n\t\treturn this.size === 0;\n\t}",
"isEmpty() {\n return _size == 0;\n }",
"isEmpty() {\n return this.items.length === 0; // return true if the queue is empty.\n }",
"isEmpty() {\n return this._size === 0;\n }",
"isEmpty () {\n return Boolean(this.queue.length === 0)\n }",
"isEmpty() {\n return this.head === -1;\n }",
"isFull() {\n return ((this.tail + 1) % this.size) === this.head;\n }",
"function boardHasEmptySpaces() {\n let $emptySpaces = emptyBoardSpaceElements();\n return $emptySpaces.length > 0;\n}",
"function isEmpty() {\n if (stack_top === -1) {\n return true;\n }\n return false;\n }",
"isEmpty() {\n console.log(this.size === 0);\n }",
"isEmpty() {\n return (this._size === 0);\n }"
] | [
"0.8801127",
"0.7740314",
"0.69832236",
"0.6907285",
"0.6777653",
"0.6752135",
"0.6746486",
"0.67290246",
"0.65971357",
"0.6547033",
"0.65308535",
"0.6521938",
"0.6514921",
"0.65049946",
"0.6492355",
"0.64725035",
"0.64722633",
"0.6470793",
"0.64603376",
"0.64533764",
"0.64189154",
"0.64147365",
"0.64121425",
"0.64099336",
"0.6407907",
"0.6386726",
"0.63847196",
"0.63835406",
"0.63575613",
"0.6351252"
] | 0.82852596 | 1 |
returns the heap structure | getHeap() {
return this.heap;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Heap()\n{\n\t// h[0] not used, heap initially empty\n\n\tthis.h = [null]; // heap of integer keys\n\tthis.h_item = [null]; // corresponding heap of data-items (any object)\n\tthis.size = 0; // 1 smaller than array (also index of last child)\n\n\n\t// --------------------\n\t// PQ-required only; more could be added later when needed\n\t// the 2 basic shape maintaining operations heapify and reheapify simplify\n\t// processing functions\n\n\tthis.isEmpty = heapisEmpty; // return true if heap empty\n\tthis.deleteRoot = heapDeleteRoot; // return data-item in root\n\tthis.insert = heapInsert; // insert data-item with key\n\n\tthis.heapify = heapheapify; // make subtree heap; top-down heapify (\"sink\") used by .deleteRoot()\n\tthis.reheapify = heapreheapify; // bottom-up reheapify (\"swim\") used by .insert()\n\tthis.show = heapShow; \t // utility: return pretty formatted heap as string\n\t \t // ... etc\n\n\t// --------------------\n}",
"function heapShow()\n{\n\tvar n = this.size;\n\tvar m = Math.floor(n/2); // last parent node\n\n\tvar k = this.h.slice(1,n+1), a = this.h_item.slice(1,n+1);\n\n\tvar out=\"<h2>Heap (size=\"+ n+ \"):</h2><p>Keys: \" + k + \"<br>Data: \"+ a + \"</p>\";\n\tfor (var i=1; i<=m; i++)\n\t{\n\t\tout += \"<p>\"+ i+ \": <b>\"+ this.h[i]+ \"(\"+ this.h_item[i]+ \")</b><ul>\";\n\t\tif ( 2*i <= n )\n\t\t\tout += \"<li>\"+ this.h[2*i]+ \"</li>\";\n\t\tif ( 2*i+1 <= n )\n\t\t\tout+= \"<li>\"+ this.h[2*i+1]+ \"</li>\";\n\t\tout+= \"</ul></p>\";\n\t}\n\n\treturn out;\n}",
"function Heap(){\n this.heap = [];\n}",
"function Heap(type) {\n var heapBuf = utils.expandoBuffer(Int32Array),\n indexBuf = utils.expandoBuffer(Int32Array),\n heavierThan = type == 'max' ? lessThan : greaterThan,\n itemsInHeap = 0,\n dataArr,\n heapArr,\n indexArr;\n\n this.init = function(values) {\n var i;\n dataArr = values;\n itemsInHeap = values.length;\n heapArr = heapBuf(itemsInHeap);\n indexArr = indexBuf(itemsInHeap);\n for (i=0; i<itemsInHeap; i++) {\n insertValue(i, i);\n }\n // place non-leaf items\n for (i=(itemsInHeap-2) >> 1; i >= 0; i--) {\n downHeap(i);\n }\n };\n\n this.size = function() {\n return itemsInHeap;\n };\n\n // Update a single value and re-heap\n this.updateValue = function(valIdx, val) {\n var heapIdx = indexArr[valIdx];\n dataArr[valIdx] = val;\n if (!(heapIdx >= 0 && heapIdx < itemsInHeap)) {\n error(\"Out-of-range heap index.\");\n }\n downHeap(upHeap(heapIdx));\n };\n\n this.popValue = function() {\n return dataArr[this.pop()];\n };\n\n this.getValue = function(idx) {\n return dataArr[idx];\n };\n\n this.peek = function() {\n return heapArr[0];\n };\n\n this.peekValue = function() {\n return dataArr[heapArr[0]];\n };\n\n // Return the idx of the lowest-value item in the heap\n this.pop = function() {\n var popIdx;\n if (itemsInHeap <= 0) {\n error(\"Tried to pop from an empty heap.\");\n }\n popIdx = heapArr[0];\n insertValue(0, heapArr[--itemsInHeap]); // move last item in heap into root position\n downHeap(0);\n return popIdx;\n };\n\n function upHeap(idx) {\n var parentIdx;\n // Move item up in the heap until it's at the top or is not lighter than its parent\n while (idx > 0) {\n parentIdx = (idx - 1) >> 1;\n if (heavierThan(idx, parentIdx)) {\n break;\n }\n swapItems(idx, parentIdx);\n idx = parentIdx;\n }\n return idx;\n }\n\n // Swap item at @idx with any lighter children\n function downHeap(idx) {\n var minIdx = compareDown(idx);\n\n while (minIdx > idx) {\n swapItems(idx, minIdx);\n idx = minIdx; // descend in the heap\n minIdx = compareDown(idx);\n }\n }\n\n function swapItems(a, b) {\n var i = heapArr[a];\n insertValue(a, heapArr[b]);\n insertValue(b, i);\n }\n\n // Associate a heap idx with the index of a value in data arr\n function insertValue(heapIdx, valId) {\n indexArr[valId] = heapIdx;\n heapArr[heapIdx] = valId;\n }\n\n // comparator for Visvalingam min heap\n // @a, @b: Indexes in @heapArr\n function greaterThan(a, b) {\n var idx1 = heapArr[a],\n idx2 = heapArr[b],\n val1 = dataArr[idx1],\n val2 = dataArr[idx2];\n // If values are equal, compare array indexes.\n // This is not a requirement of the Visvalingam algorithm,\n // but it generates output that matches Mahes Visvalingam's\n // reference implementation.\n // See https://hydra.hull.ac.uk/assets/hull:10874/content\n return (val1 > val2 || val1 === val2 && idx1 > idx2);\n }\n\n // comparator for max heap\n function lessThan(a, b) {\n var idx1 = heapArr[a],\n idx2 = heapArr[b];\n return dataArr[idx1] < dataArr[idx2];\n }\n\n function compareDown(idx) {\n var a = 2 * idx + 1,\n b = a + 1,\n n = itemsInHeap;\n if (a < n && heavierThan(idx, a)) {\n idx = a;\n }\n if (b < n && heavierThan(idx, b)) {\n idx = b;\n }\n return idx;\n }\n }",
"function heapreheapify() {\n\n var node = this.size; // set the size to heap\n var pn = Math.floor(node/2); // use math floor to set last parent node to pn = parent node\n\n var i = pn; // set new varibale and get value pn.\n while(i >= 1)\n {\n var key = i;\n var v = this.h[key];\n var v2 = this.h_item[key];\n var heap = false; // here intitalize heap with boolean value false\n\n for (var j = 2 * key; !heap && 2 * key <= node;)\n {\n if (j < node)\n {\n if (this.h[j] < this.h[j + 1]) {\n j += 1;\n } // end the inner if\n } // end the outer if\n\n\n if (v >= this.h[j])\n {\n heap = true;\n } // end if\n else\n {\n this.h_item[key] = this.h_item[j];\n this.h[key] = this.h[j];\n key = j;\n } // end wlse\n\n this.h[key] = v;\n this.h_item[key] = v2;\n }\n i = i-1; // here decreese the number in each iteration\n } // end while\n}",
"heapify() {\n\t\t// last index is one less than the size\n\t\tlet index = this.size() - 1;\n\n\t\t/*\n Property of ith element in binary heap - \n left child is at = (2*i)th position\n right child is at = (2*i+1)th position\n parent is at = floor(i/2)th position\n */\n\n\t\t// converting entire array into heap from behind to front\n\t\t// just like heapify function to create it MAX HEAP\n\t\twhile (index > 0) {\n\t\t\t// pull out element from the array and find parent element\n\t\t\tlet element = this.heap[index],\n\t\t\t\tparentIndex = Math.floor((index - 1) / 2),\n\t\t\t\tparent = this.heap[parentIndex];\n\n\t\t\t// if parent is greater or equal, its already a heap hence break\n\t\t\tif (parent[0] >= element[0]) break;\n\t\t\t// else swap the values as we're creating a max heap\n\t\t\tthis.heap[index] = parent;\n\t\t\tthis.heap[parentIndex] = element;\n\t\t\tindex = parentIndex;\n\t\t}\n\t}",
"function BinaryHeap() {\n this.array = [];\n }",
"getRoot() {\n if(this.heap_size <= 0) {\n console.log(\"Heap underflow\");\n return null;\n }\n return this.harr[0];\n }",
"constructor(){\n this.heap = [];\n this.count = 0;\n }",
"constructor(){\n this.heap = [];\n this.count = 0;\n }",
"function BinaryHeap() {\n this.nodes = [];\n}",
"function heapDeleteRoot()\n{\n\tif (!this.isEmpty()) { \n\t\t// save root key and item pair\n\t\tvar root = [ this.h[1], this.h_item[1] ]; \n }\n\telse { //if heap is empty\n\t\treturn \"The heap is empty\";\n\t}\n\t// ... complete\n\tthis.h_item[1] = this.h_item[this.size];\n\n this.h[1] = this.h[this.size];\n this.heapify(1);\n\t\n //decrease the heap size by 1 since we delete from it\n this.size = this.size-1;\n\n\treturn root;\n}",
"function minheap_extract(heap) {\n swap(heap,0,heap.length - 1);\n var to_pop = heap.pop();\n var parent = 0;\n var child = parent * 2 + 1;\n while(child < heap.length){\n if(child + 1 < heap.length && heap[child] > heap[child + 1]){\n child = child + 1;\n }\n if(heap[child] < heap[parent]){\n swap(heap,child,parent);\n parent = child;\n child = parent * 2 + 1; \n }\n else{\n break;\n }\n }\n return to_pop;\n // STENCIL: implement your min binary heap extract operation\n}",
"function MinHeap(){\n\tthis.maxIndex = -1;\n\tthis.arr = {};\n}",
"constructor() {\n\t\tthis.heap = [];\n\t}",
"function heapify (heap) {\n // Get the parent idx of the last node\n var start = iparent(heap.arr.length - 1)\n while (start >= 0) {\n siftDown(start, heap)\n start -= 1\n }\n return heap\n}",
"function h$HeapSet() {\n this._keys = [];\n this._prios = [];\n this._vals = [];\n this._size = 0;\n}",
"function h$HeapSet() {\n this._keys = [];\n this._prios = [];\n this._vals = [];\n this._size = 0;\n}",
"function h$HeapSet() {\n this._keys = [];\n this._prios = [];\n this._vals = [];\n this._size = 0;\n}",
"function h$HeapSet() {\n this._keys = [];\n this._prios = [];\n this._vals = [];\n this._size = 0;\n}",
"function setupHeap(lists) {\n var heap = new MinHeap();\n for (var i = 0; i < lists.length; i++) {\n var node = new ListNode(lists[i][0], lists[i][1]);\n heap.insert(node);\n }\n return heap;\n}",
"static heapInMemory() {\n return this.inMemory(function () {\n return new Heap();\n }, (heap) => {\n return heap.array;\n }, (array) => {\n return new Heap(array);\n });\n }",
"buildMaxHeap() {}",
"toString() {\n return this.heapContainer.toString();\n }",
"getHead() {\n return this.maxheap[1]\n }",
"function make_heap_obj(node1_id, node2_id, weight) {\n return [node1_id, node2_id, weight];\n }",
"function Heap(key) {\n this._array = [];\n this._key = key || function (x) { return x; };\n}",
"function MinHeap() {\n\n /**\n * Insert an item into the heap\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @param{number} x\n */\n this.insert = function(x) {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Get the smallest value in the heap\n *\n * Time Complexity:\n * Space Complexity:)\n *\n * @return{number}\n */\n this.peek = function() {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Remove and return the smallest value in the heap\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @return{number}\n */\n this.pop = function() {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Get the size of the heap\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @return{number}\n */\n this.size = function() {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Convert the heap data into a string\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @return{string}\n */\n MinHeap.prototype.toString = function() {\n // INSERT YOUR CODE HERE\n }\n\n /*\n * The following are some optional helper methods. These are not required\n * but may make your life easier\n */\n\n /**\n * Get the index of the parent node of a given index\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @param{number} i\n * @return{number}\n */\n var parent = function(i) {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Get the index of the left child of a given index\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @param{number} i\n * @return{number}\n */\n var leftChild = function(i) {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Swap the values at 2 indices in our heap\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @param{number} i\n * @param{number} j\n */\n var swap = function(i, j) {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Starting at index i, bubble up the value until it is at the correct\n * position in the heap\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @param{number} i\n */\n var bubbleUp = function(i) {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Starting at index i, bubble down the value until it is at the correct\n * position in the heap\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @param{number} i\n */\n var bubbleDown = function(i) {\n // INSERT YOUR CODE HERE\n }\n}",
"allocateHeap(hexData) {\n let addr = \"H\" + this.heapLength++; //Create placeholder address\n this.heap[addr] = { data: hexData, loc: \"\" };\n return addr;\n }",
"function displayHeap() {\n for (var i = 0; i < arr.length; i++) {\n if (arr[i].father == arr[i]) {\n arr[i].x = width / 2;\n arr[i].y = 100;\n }\n else {\n if (arr[i] == arr[i].father.leftson)\n arr[i].x = arr[i].father.x - arr[i].father.gap;\n else if (arr[i] == arr[i].father.rightson)\n arr[i].x = arr[i].father.x + arr[i].father.gap;\n\n arr[i].y = arr[i].father.y + 50;\n }\n }\n\n for (var ii = 0; ii < arr.length; ii++)\n arr[ii].edge = new edge(arr[ii]);\n}"
] | [
"0.7372717",
"0.7307348",
"0.7011272",
"0.6944502",
"0.69332767",
"0.6875817",
"0.6830716",
"0.6772608",
"0.6742784",
"0.6742784",
"0.6671171",
"0.66410375",
"0.6612922",
"0.6560505",
"0.6552577",
"0.65003353",
"0.6475312",
"0.6475312",
"0.6475312",
"0.6475312",
"0.6440758",
"0.64238054",
"0.6406391",
"0.6403313",
"0.6397833",
"0.6360772",
"0.6356306",
"0.6356154",
"0.6333905",
"0.63059485"
] | 0.74754506 | 0 |
return the size of the heap | size() {
return this.heap.length;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"size() {\n\t\treturn this.heap.length;\n\t}",
"getHeap() {\r\n\t\treturn this.heap;\r\n\t}",
"getHeap() {\r\n\t\treturn this.heap;\r\n\t}",
"get size() {\n let size = 0;\n for (let i = 0; i < this.children.length; i++)\n size += this.children[i].size;\n return size;\n }",
"function size() {\r\n var counter = 0;\r\n for (var i = 0; i < this.PriorityQueueContents.length; i++) {\r\n counter += this.PriorityQueueContents[i].ids.length;\r\n }\r\n return counter;\r\n }",
"function size() {\n\t return n;\n\t }",
"function size() {\n return n;\n }",
"size() {\n return Math.abs(this.tail - this.head);\n }",
"function size() {\n return stack_size;\n }",
"function heapisEmpty() {\n return this.size == 0 ? true : false;\n}",
"delete() {\n // implement delete\n // only delete if the heap has elements\n if (this.heap.length > 0) {\n // save the smallest element\n let smallest = this.heap[0];\n // swap the last element in the heap whatever it is \n this.heap[0] = this.heap[this.heap.length -1];\n this.heap.pop();\n this.minHeapifyDown(0, this.heap);\n return smallest;\n }\n }",
"size() {\n return this.rootNode.size(this.storage);\n }",
"buildMaxHeap() {}",
"function getSize(){\n return queue.length;\n }",
"function size(node) {\n return node.size ? node.size : 1;\n }",
"size() {\n return this.tail - this.head;\n }",
"function size(self) {\n return self.size();\n}",
"get size() {}",
"function Heap(type) {\n var heapBuf = utils.expandoBuffer(Int32Array),\n indexBuf = utils.expandoBuffer(Int32Array),\n heavierThan = type == 'max' ? lessThan : greaterThan,\n itemsInHeap = 0,\n dataArr,\n heapArr,\n indexArr;\n\n this.init = function(values) {\n var i;\n dataArr = values;\n itemsInHeap = values.length;\n heapArr = heapBuf(itemsInHeap);\n indexArr = indexBuf(itemsInHeap);\n for (i=0; i<itemsInHeap; i++) {\n insertValue(i, i);\n }\n // place non-leaf items\n for (i=(itemsInHeap-2) >> 1; i >= 0; i--) {\n downHeap(i);\n }\n };\n\n this.size = function() {\n return itemsInHeap;\n };\n\n // Update a single value and re-heap\n this.updateValue = function(valIdx, val) {\n var heapIdx = indexArr[valIdx];\n dataArr[valIdx] = val;\n if (!(heapIdx >= 0 && heapIdx < itemsInHeap)) {\n error(\"Out-of-range heap index.\");\n }\n downHeap(upHeap(heapIdx));\n };\n\n this.popValue = function() {\n return dataArr[this.pop()];\n };\n\n this.getValue = function(idx) {\n return dataArr[idx];\n };\n\n this.peek = function() {\n return heapArr[0];\n };\n\n this.peekValue = function() {\n return dataArr[heapArr[0]];\n };\n\n // Return the idx of the lowest-value item in the heap\n this.pop = function() {\n var popIdx;\n if (itemsInHeap <= 0) {\n error(\"Tried to pop from an empty heap.\");\n }\n popIdx = heapArr[0];\n insertValue(0, heapArr[--itemsInHeap]); // move last item in heap into root position\n downHeap(0);\n return popIdx;\n };\n\n function upHeap(idx) {\n var parentIdx;\n // Move item up in the heap until it's at the top or is not lighter than its parent\n while (idx > 0) {\n parentIdx = (idx - 1) >> 1;\n if (heavierThan(idx, parentIdx)) {\n break;\n }\n swapItems(idx, parentIdx);\n idx = parentIdx;\n }\n return idx;\n }\n\n // Swap item at @idx with any lighter children\n function downHeap(idx) {\n var minIdx = compareDown(idx);\n\n while (minIdx > idx) {\n swapItems(idx, minIdx);\n idx = minIdx; // descend in the heap\n minIdx = compareDown(idx);\n }\n }\n\n function swapItems(a, b) {\n var i = heapArr[a];\n insertValue(a, heapArr[b]);\n insertValue(b, i);\n }\n\n // Associate a heap idx with the index of a value in data arr\n function insertValue(heapIdx, valId) {\n indexArr[valId] = heapIdx;\n heapArr[heapIdx] = valId;\n }\n\n // comparator for Visvalingam min heap\n // @a, @b: Indexes in @heapArr\n function greaterThan(a, b) {\n var idx1 = heapArr[a],\n idx2 = heapArr[b],\n val1 = dataArr[idx1],\n val2 = dataArr[idx2];\n // If values are equal, compare array indexes.\n // This is not a requirement of the Visvalingam algorithm,\n // but it generates output that matches Mahes Visvalingam's\n // reference implementation.\n // See https://hydra.hull.ac.uk/assets/hull:10874/content\n return (val1 > val2 || val1 === val2 && idx1 > idx2);\n }\n\n // comparator for max heap\n function lessThan(a, b) {\n var idx1 = heapArr[a],\n idx2 = heapArr[b];\n return dataArr[idx1] < dataArr[idx2];\n }\n\n function compareDown(idx) {\n var a = 2 * idx + 1,\n b = a + 1,\n n = itemsInHeap;\n if (a < n && heavierThan(idx, a)) {\n idx = a;\n }\n if (b < n && heavierThan(idx, b)) {\n idx = b;\n }\n return idx;\n }\n }",
"function heapreheapify() {\n\n var node = this.size; // set the size to heap\n var pn = Math.floor(node/2); // use math floor to set last parent node to pn = parent node\n\n var i = pn; // set new varibale and get value pn.\n while(i >= 1)\n {\n var key = i;\n var v = this.h[key];\n var v2 = this.h_item[key];\n var heap = false; // here intitalize heap with boolean value false\n\n for (var j = 2 * key; !heap && 2 * key <= node;)\n {\n if (j < node)\n {\n if (this.h[j] < this.h[j + 1]) {\n j += 1;\n } // end the inner if\n } // end the outer if\n\n\n if (v >= this.h[j])\n {\n heap = true;\n } // end if\n else\n {\n this.h_item[key] = this.h_item[j];\n this.h[key] = this.h[j];\n key = j;\n } // end wlse\n\n this.h[key] = v;\n this.h_item[key] = v2;\n }\n i = i-1; // here decreese the number in each iteration\n } // end while\n}",
"size() {\n return this.stack.length;\n }",
"childCount() {\n\t\tif (!this.state()) { return 0 }\n\n\t\tif (this[_size] === undefined) {\n\t\t\tthis[_size] = Object.keys(this.state()).length;\n\t\t}\n\n\t\treturn this[_size];\n\t}",
"function GetSize() : int\n\t{\n\t\tvar n = 0;\n\t\tfor( var i = 0; i < key2down.length; i++ )\n\t\t{\n\t\t\tif( key2down[i] )\n\t\t\t\tn++;\n\t\t}\n\t\treturn n;\n\t}",
"function maxHeapify(arr){\n\n}",
"constructor(){\n this.heap = [];\n this.count = 0;\n }",
"constructor(){\n this.heap = [];\n this.count = 0;\n }",
"function Heap()\n{\n\t// h[0] not used, heap initially empty\n\n\tthis.h = [null]; // heap of integer keys\n\tthis.h_item = [null]; // corresponding heap of data-items (any object)\n\tthis.size = 0; // 1 smaller than array (also index of last child)\n\n\n\t// --------------------\n\t// PQ-required only; more could be added later when needed\n\t// the 2 basic shape maintaining operations heapify and reheapify simplify\n\t// processing functions\n\n\tthis.isEmpty = heapisEmpty; // return true if heap empty\n\tthis.deleteRoot = heapDeleteRoot; // return data-item in root\n\tthis.insert = heapInsert; // insert data-item with key\n\n\tthis.heapify = heapheapify; // make subtree heap; top-down heapify (\"sink\") used by .deleteRoot()\n\tthis.reheapify = heapreheapify; // bottom-up reheapify (\"swim\") used by .insert()\n\tthis.show = heapShow; \t // utility: return pretty formatted heap as string\n\t \t // ... etc\n\n\t// --------------------\n}",
"function size(x) {\n if (x === null || x == undefined) return 0;\n return x.size;\n }",
"size() {\n let count = 0;\n let node = this.head; // Declare a node variable initialize to this.head\n // While the node exist\n while (node) {\n count++; // Increment count variable\n node = node.next; // reinitialize node to next node (if node.next is null the loop will break)\n }\n return count; // return count (which is the size)\n }",
"get size() {\n return this._queue.size;\n }"
] | [
"0.8232244",
"0.6720662",
"0.6720662",
"0.6595036",
"0.658402",
"0.6490136",
"0.6471042",
"0.64250314",
"0.64119965",
"0.636866",
"0.6362219",
"0.6324369",
"0.6306118",
"0.6303182",
"0.62492096",
"0.62391216",
"0.62245953",
"0.6194299",
"0.61576664",
"0.61351967",
"0.6093203",
"0.6073549",
"0.6068318",
"0.6066446",
"0.60509115",
"0.60509115",
"0.6044252",
"0.60250926",
"0.6022354",
"0.5996662"
] | 0.8241832 | 0 |
returns the heap structure | getHeap() {
return this.heap;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Heap()\n{\n\t// h[0] not used, heap initially empty\n\n\tthis.h = [null]; // heap of integer keys\n\tthis.h_item = [null]; // corresponding heap of data-items (any object)\n\tthis.size = 0; // 1 smaller than array (also index of last child)\n\n\n\t// --------------------\n\t// PQ-required only; more could be added later when needed\n\t// the 2 basic shape maintaining operations heapify and reheapify simplify\n\t// processing functions\n\n\tthis.isEmpty = heapisEmpty; // return true if heap empty\n\tthis.deleteRoot = heapDeleteRoot; // return data-item in root\n\tthis.insert = heapInsert; // insert data-item with key\n\n\tthis.heapify = heapheapify; // make subtree heap; top-down heapify (\"sink\") used by .deleteRoot()\n\tthis.reheapify = heapreheapify; // bottom-up reheapify (\"swim\") used by .insert()\n\tthis.show = heapShow; \t // utility: return pretty formatted heap as string\n\t \t // ... etc\n\n\t// --------------------\n}",
"function heapShow()\n{\n\tvar n = this.size;\n\tvar m = Math.floor(n/2); // last parent node\n\n\tvar k = this.h.slice(1,n+1), a = this.h_item.slice(1,n+1);\n\n\tvar out=\"<h2>Heap (size=\"+ n+ \"):</h2><p>Keys: \" + k + \"<br>Data: \"+ a + \"</p>\";\n\tfor (var i=1; i<=m; i++)\n\t{\n\t\tout += \"<p>\"+ i+ \": <b>\"+ this.h[i]+ \"(\"+ this.h_item[i]+ \")</b><ul>\";\n\t\tif ( 2*i <= n )\n\t\t\tout += \"<li>\"+ this.h[2*i]+ \"</li>\";\n\t\tif ( 2*i+1 <= n )\n\t\t\tout+= \"<li>\"+ this.h[2*i+1]+ \"</li>\";\n\t\tout+= \"</ul></p>\";\n\t}\n\n\treturn out;\n}",
"function Heap(){\n this.heap = [];\n}",
"function Heap(type) {\n var heapBuf = utils.expandoBuffer(Int32Array),\n indexBuf = utils.expandoBuffer(Int32Array),\n heavierThan = type == 'max' ? lessThan : greaterThan,\n itemsInHeap = 0,\n dataArr,\n heapArr,\n indexArr;\n\n this.init = function(values) {\n var i;\n dataArr = values;\n itemsInHeap = values.length;\n heapArr = heapBuf(itemsInHeap);\n indexArr = indexBuf(itemsInHeap);\n for (i=0; i<itemsInHeap; i++) {\n insertValue(i, i);\n }\n // place non-leaf items\n for (i=(itemsInHeap-2) >> 1; i >= 0; i--) {\n downHeap(i);\n }\n };\n\n this.size = function() {\n return itemsInHeap;\n };\n\n // Update a single value and re-heap\n this.updateValue = function(valIdx, val) {\n var heapIdx = indexArr[valIdx];\n dataArr[valIdx] = val;\n if (!(heapIdx >= 0 && heapIdx < itemsInHeap)) {\n error(\"Out-of-range heap index.\");\n }\n downHeap(upHeap(heapIdx));\n };\n\n this.popValue = function() {\n return dataArr[this.pop()];\n };\n\n this.getValue = function(idx) {\n return dataArr[idx];\n };\n\n this.peek = function() {\n return heapArr[0];\n };\n\n this.peekValue = function() {\n return dataArr[heapArr[0]];\n };\n\n // Return the idx of the lowest-value item in the heap\n this.pop = function() {\n var popIdx;\n if (itemsInHeap <= 0) {\n error(\"Tried to pop from an empty heap.\");\n }\n popIdx = heapArr[0];\n insertValue(0, heapArr[--itemsInHeap]); // move last item in heap into root position\n downHeap(0);\n return popIdx;\n };\n\n function upHeap(idx) {\n var parentIdx;\n // Move item up in the heap until it's at the top or is not lighter than its parent\n while (idx > 0) {\n parentIdx = (idx - 1) >> 1;\n if (heavierThan(idx, parentIdx)) {\n break;\n }\n swapItems(idx, parentIdx);\n idx = parentIdx;\n }\n return idx;\n }\n\n // Swap item at @idx with any lighter children\n function downHeap(idx) {\n var minIdx = compareDown(idx);\n\n while (minIdx > idx) {\n swapItems(idx, minIdx);\n idx = minIdx; // descend in the heap\n minIdx = compareDown(idx);\n }\n }\n\n function swapItems(a, b) {\n var i = heapArr[a];\n insertValue(a, heapArr[b]);\n insertValue(b, i);\n }\n\n // Associate a heap idx with the index of a value in data arr\n function insertValue(heapIdx, valId) {\n indexArr[valId] = heapIdx;\n heapArr[heapIdx] = valId;\n }\n\n // comparator for Visvalingam min heap\n // @a, @b: Indexes in @heapArr\n function greaterThan(a, b) {\n var idx1 = heapArr[a],\n idx2 = heapArr[b],\n val1 = dataArr[idx1],\n val2 = dataArr[idx2];\n // If values are equal, compare array indexes.\n // This is not a requirement of the Visvalingam algorithm,\n // but it generates output that matches Mahes Visvalingam's\n // reference implementation.\n // See https://hydra.hull.ac.uk/assets/hull:10874/content\n return (val1 > val2 || val1 === val2 && idx1 > idx2);\n }\n\n // comparator for max heap\n function lessThan(a, b) {\n var idx1 = heapArr[a],\n idx2 = heapArr[b];\n return dataArr[idx1] < dataArr[idx2];\n }\n\n function compareDown(idx) {\n var a = 2 * idx + 1,\n b = a + 1,\n n = itemsInHeap;\n if (a < n && heavierThan(idx, a)) {\n idx = a;\n }\n if (b < n && heavierThan(idx, b)) {\n idx = b;\n }\n return idx;\n }\n }",
"function heapreheapify() {\n\n var node = this.size; // set the size to heap\n var pn = Math.floor(node/2); // use math floor to set last parent node to pn = parent node\n\n var i = pn; // set new varibale and get value pn.\n while(i >= 1)\n {\n var key = i;\n var v = this.h[key];\n var v2 = this.h_item[key];\n var heap = false; // here intitalize heap with boolean value false\n\n for (var j = 2 * key; !heap && 2 * key <= node;)\n {\n if (j < node)\n {\n if (this.h[j] < this.h[j + 1]) {\n j += 1;\n } // end the inner if\n } // end the outer if\n\n\n if (v >= this.h[j])\n {\n heap = true;\n } // end if\n else\n {\n this.h_item[key] = this.h_item[j];\n this.h[key] = this.h[j];\n key = j;\n } // end wlse\n\n this.h[key] = v;\n this.h_item[key] = v2;\n }\n i = i-1; // here decreese the number in each iteration\n } // end while\n}",
"heapify() {\n\t\t// last index is one less than the size\n\t\tlet index = this.size() - 1;\n\n\t\t/*\n Property of ith element in binary heap - \n left child is at = (2*i)th position\n right child is at = (2*i+1)th position\n parent is at = floor(i/2)th position\n */\n\n\t\t// converting entire array into heap from behind to front\n\t\t// just like heapify function to create it MAX HEAP\n\t\twhile (index > 0) {\n\t\t\t// pull out element from the array and find parent element\n\t\t\tlet element = this.heap[index],\n\t\t\t\tparentIndex = Math.floor((index - 1) / 2),\n\t\t\t\tparent = this.heap[parentIndex];\n\n\t\t\t// if parent is greater or equal, its already a heap hence break\n\t\t\tif (parent[0] >= element[0]) break;\n\t\t\t// else swap the values as we're creating a max heap\n\t\t\tthis.heap[index] = parent;\n\t\t\tthis.heap[parentIndex] = element;\n\t\t\tindex = parentIndex;\n\t\t}\n\t}",
"function BinaryHeap() {\n this.array = [];\n }",
"getRoot() {\n if(this.heap_size <= 0) {\n console.log(\"Heap underflow\");\n return null;\n }\n return this.harr[0];\n }",
"constructor(){\n this.heap = [];\n this.count = 0;\n }",
"constructor(){\n this.heap = [];\n this.count = 0;\n }",
"function BinaryHeap() {\n this.nodes = [];\n}",
"function heapDeleteRoot()\n{\n\tif (!this.isEmpty()) { \n\t\t// save root key and item pair\n\t\tvar root = [ this.h[1], this.h_item[1] ]; \n }\n\telse { //if heap is empty\n\t\treturn \"The heap is empty\";\n\t}\n\t// ... complete\n\tthis.h_item[1] = this.h_item[this.size];\n\n this.h[1] = this.h[this.size];\n this.heapify(1);\n\t\n //decrease the heap size by 1 since we delete from it\n this.size = this.size-1;\n\n\treturn root;\n}",
"function minheap_extract(heap) {\n swap(heap,0,heap.length - 1);\n var to_pop = heap.pop();\n var parent = 0;\n var child = parent * 2 + 1;\n while(child < heap.length){\n if(child + 1 < heap.length && heap[child] > heap[child + 1]){\n child = child + 1;\n }\n if(heap[child] < heap[parent]){\n swap(heap,child,parent);\n parent = child;\n child = parent * 2 + 1; \n }\n else{\n break;\n }\n }\n return to_pop;\n // STENCIL: implement your min binary heap extract operation\n}",
"function MinHeap(){\n\tthis.maxIndex = -1;\n\tthis.arr = {};\n}",
"constructor() {\n\t\tthis.heap = [];\n\t}",
"function heapify (heap) {\n // Get the parent idx of the last node\n var start = iparent(heap.arr.length - 1)\n while (start >= 0) {\n siftDown(start, heap)\n start -= 1\n }\n return heap\n}",
"function h$HeapSet() {\n this._keys = [];\n this._prios = [];\n this._vals = [];\n this._size = 0;\n}",
"function h$HeapSet() {\n this._keys = [];\n this._prios = [];\n this._vals = [];\n this._size = 0;\n}",
"function h$HeapSet() {\n this._keys = [];\n this._prios = [];\n this._vals = [];\n this._size = 0;\n}",
"function h$HeapSet() {\n this._keys = [];\n this._prios = [];\n this._vals = [];\n this._size = 0;\n}",
"function setupHeap(lists) {\n var heap = new MinHeap();\n for (var i = 0; i < lists.length; i++) {\n var node = new ListNode(lists[i][0], lists[i][1]);\n heap.insert(node);\n }\n return heap;\n}",
"static heapInMemory() {\n return this.inMemory(function () {\n return new Heap();\n }, (heap) => {\n return heap.array;\n }, (array) => {\n return new Heap(array);\n });\n }",
"buildMaxHeap() {}",
"toString() {\n return this.heapContainer.toString();\n }",
"getHead() {\n return this.maxheap[1]\n }",
"function make_heap_obj(node1_id, node2_id, weight) {\n return [node1_id, node2_id, weight];\n }",
"function Heap(key) {\n this._array = [];\n this._key = key || function (x) { return x; };\n}",
"function MinHeap() {\n\n /**\n * Insert an item into the heap\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @param{number} x\n */\n this.insert = function(x) {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Get the smallest value in the heap\n *\n * Time Complexity:\n * Space Complexity:)\n *\n * @return{number}\n */\n this.peek = function() {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Remove and return the smallest value in the heap\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @return{number}\n */\n this.pop = function() {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Get the size of the heap\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @return{number}\n */\n this.size = function() {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Convert the heap data into a string\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @return{string}\n */\n MinHeap.prototype.toString = function() {\n // INSERT YOUR CODE HERE\n }\n\n /*\n * The following are some optional helper methods. These are not required\n * but may make your life easier\n */\n\n /**\n * Get the index of the parent node of a given index\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @param{number} i\n * @return{number}\n */\n var parent = function(i) {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Get the index of the left child of a given index\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @param{number} i\n * @return{number}\n */\n var leftChild = function(i) {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Swap the values at 2 indices in our heap\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @param{number} i\n * @param{number} j\n */\n var swap = function(i, j) {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Starting at index i, bubble up the value until it is at the correct\n * position in the heap\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @param{number} i\n */\n var bubbleUp = function(i) {\n // INSERT YOUR CODE HERE\n }\n\n /**\n * Starting at index i, bubble down the value until it is at the correct\n * position in the heap\n *\n * Time Complexity:\n * Space Complexity:\n *\n * @param{number} i\n */\n var bubbleDown = function(i) {\n // INSERT YOUR CODE HERE\n }\n}",
"allocateHeap(hexData) {\n let addr = \"H\" + this.heapLength++; //Create placeholder address\n this.heap[addr] = { data: hexData, loc: \"\" };\n return addr;\n }",
"function displayHeap() {\n for (var i = 0; i < arr.length; i++) {\n if (arr[i].father == arr[i]) {\n arr[i].x = width / 2;\n arr[i].y = 100;\n }\n else {\n if (arr[i] == arr[i].father.leftson)\n arr[i].x = arr[i].father.x - arr[i].father.gap;\n else if (arr[i] == arr[i].father.rightson)\n arr[i].x = arr[i].father.x + arr[i].father.gap;\n\n arr[i].y = arr[i].father.y + 50;\n }\n }\n\n for (var ii = 0; ii < arr.length; ii++)\n arr[ii].edge = new edge(arr[ii]);\n}"
] | [
"0.7372717",
"0.7307348",
"0.7011272",
"0.6944502",
"0.69332767",
"0.6875817",
"0.6830716",
"0.6772608",
"0.6742784",
"0.6742784",
"0.6671171",
"0.66410375",
"0.6612922",
"0.6560505",
"0.6552577",
"0.65003353",
"0.6475312",
"0.6475312",
"0.6475312",
"0.6475312",
"0.6440758",
"0.64238054",
"0.6406391",
"0.6403313",
"0.6397833",
"0.6360772",
"0.6356306",
"0.6356154",
"0.6333905",
"0.63059485"
] | 0.74754506 | 1 |
Alyssa postulates the existence of an abstract object called an interval that has two endpoints: a lower bound and an upper bound. She also presumes that, given the endpoints of an interval, she can construct the interval using the data constructor make_interval. Alyssa first writes a function for adding two intervals. She reasons that the minimum value the sum could be is the sum of the two lower bounds and the maximum value it could be is the sum of the two upper bounds: | function addInterval(x, y) {
return makeInterval(
lowerBound(x) + lowerBound(y),
upperBound(x) + upperBound(y)
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addTwo(range1, range2) {\n if (range1.overlaps(range2, {adjacent: true})) {\n var start = moment.min(range1.start, range2.start);\n var end = moment.max(range1.end, range2.end);\n var sum = moment.range(start, end);\n return sum;\n } else {\n return null;\n }\n}",
"addInterval(low, high, value){\n const interval = new Interval(low, high, value);\n this.intervals.insert(interval);\n if(interval.high < this.minimumHigh) this.minimumHigh = interval.high;\n if(interval.high > this.maximumHigh) this.maximumHigh = interval.high;\n if(interval.high > this.high) this.high = interval.high;\n }",
"function createSubintervals(start, end, unit) {\n var ints = makeIntervals(start, end, unit);\n var collection = toPairs(ints);\n completeInterval(collection, end);\n collection = collection.concat(addLostIntervals(collection));\n return collection;\n}",
"function sub_interval(x, y) {\n return make_interval(\n lower_bound(x) - lower_bound(y),\n upper_bound(x) - upper_bound(y)\n );\n}",
"add(range) {\n return new SubRange(\n Math.min(this.low, range.low),\n Math.max(this.high, range.high)\n );\n }",
"add(range) {\n return new SubRange(Math.min((this || _global).low, range.low), Math.max((this || _global).high, range.high));\n }",
"function addRanges(range1, range2) {\n const segments = [];\n // consider all possible segment combinations\n range1.forEach((segment1) => {\n range2.forEach((segment2) => {\n segments.push([segment1[0] + segment2[0], segment1[1] + segment2[1]]);\n });\n });\n // join segments that overlap using the classic algorithm\n segments.sort((segmentA, segmentB) => segmentA[0] - segmentB[0]);\n const newRange = [];\n let joinedSegment = segments[0].slice(0);\n segments.slice(1).forEach((segment) => {\n if (joinedSegment[1] >= segment[0]) {\n joinedSegment[1] = Math.max(joinedSegment[1], segment[1]);\n } else {\n newRange.push(joinedSegment);\n joinedSegment = segment.slice(0);\n }\n });\n newRange.push(joinedSegment);\n return newRange;\n}",
"function makeIntervals(start, end, unit) {\n var r = moment.range(start, end);\n return getInterval(unit, r);\n}",
"mergeIntervals (intervals)\n {\n if( intervals.length < 2 )\n {\n return intervals\n }\n\n intervals.sort((a, b) => a.start - b.start);\n\n const merged = [];\n\n let start = intervals[0].start,\n end = intervals[0].end;\n\n for (let i = 1; i < intervals.length; i++)\n {\n const interval = intervals[i];\n if (interval.start <= end)\n { // overlapping intervals, adjust the 'end'\n end = Math.max(interval.end, end);\n }\n else\n { // non-overlapping interval, add the previous interval and reset\n merged.push(new Interval(start, end));\n start = interval.start;\n end = interval.end;\n }\n }\n // add the last interval\n merged.push(new Interval(start, end));\n\n return merged;\n }",
"function getRangeOverlap(first, second) {\n const result = {\n first: [],\n second: [],\n both: null\n };\n // Both\n if (first[0] < second[1] && second[0] < first[1]) {\n const start = Math.max(first[0], second[0]);\n const end = Math.min(first[1], second[1]);\n result.both = rangeOrIndividual(start, end);\n }\n // Before\n if (first[0] < second[0]) {\n const start = first[0];\n const end = Math.min(second[0], first[1]);\n result.first.push(rangeOrIndividual(start, end));\n }\n else if (second[0] < first[0]) {\n const start = second[0];\n const end = Math.min(second[1], first[0]);\n result.second.push(rangeOrIndividual(start, end));\n }\n // After\n if (first[1] > second[1]) {\n const start = Math.max(first[0], second[1]);\n const end = first[1];\n result.first.push(rangeOrIndividual(start, end));\n }\n else if (second[1] > first[1]) {\n const start = Math.max(first[1], second[0]);\n const end = second[1];\n result.second.push(rangeOrIndividual(start, end));\n }\n return result;\n}",
"function Interval(start, end) {\n this.start = start\n this.end = end\n}",
"insertInterval (intervals, new_interval)\n {\n const merged = [];\n\n let newStart = new_interval[0]\n let newEnd = new_interval[1]\n\n let i = 0\n while( i < intervals.length && intervals[i][1] <= newStart )\n {\n merged.push( intervals[i] )\n i++\n }\n\n if( intervals[i][1] === newStart )\n {\n newStart = intervals[i][0]\n }\n\n while( i < intervals.length && intervals[i][0] <= newEnd )\n {\n newEnd = Math.max( newEnd, intervals[i][1] )\n i++\n }\n\n merged.push( [newStart, newEnd] )\n\n while( i < intervals.length )\n {\n merged.push( intervals[i] )\n i++\n }\n\n return merged;\n }",
"function Interval(start, end) {\n this.start = start;\n this.end = end;\n}",
"function Interval(start, end) {\n this.start = start;\n this.end = end;\n}",
"function Interval(start, end) {\n this.start = start;\n this.end = end;\n }",
"function mulInterval(x, y) {\n const p1 = lowerBound(x) * lowerBound(y);\n const p2 = lowerBound(x) * upperBound(y);\n const p3 = upperBound(x) * lowerBound(y);\n const p4 = upperBound(x) * upperBound(y);\n return makeInterval(Math.min(p1, p2, p3, p4), Math.max(p1, p2, p3, p4));\n}",
"findIntersection (intervals_a, intervals_b)\n {\n const result = [];\n\n let aIndex = 0, bIndex = 0\n\n while( aIndex < intervals_a.length && bIndex < intervals_b.length )\n {\n const aStart = intervals_a[aIndex][0],\n aEnd = intervals_a[aIndex][1],\n bStart = intervals_b[bIndex][0],\n bEnd = intervals_b[bIndex][1]\n\n if( bStart <= aEnd && aStart <= bEnd )\n {\n result.push( [Math.max(aStart, bStart), Math.min(aEnd, bEnd)] )\n aIndex++\n }\n else if( aStart <= bEnd && bStart <= aEnd )\n {\n result.push( [Math.max(aStart, bStart), Math.min(aEnd, bEnd)] )\n bIndex++\n }\n\n if( aEnd < bStart )\n {\n aIndex++\n }\n else if( bEnd < aStart )\n {\n bIndex++\n }\n }\n\n return result;\n}",
"function addInterval(list, newInt){\n if(!list || !newInt) return 'please provide a list and a new list.'\n let newList = [];\n var holder = [null,null];\n var intGreaterThenNew = false;\n\n list.forEach(int => {\n let temp = [];\n if(holder[0]){\n temp[0] = holder;\n } else {\n temp[0] = newInt[0];\n }\n if(holder[1]){\n temp[1] = holder[1];\n } else {\n temp[1] = newInt[1];\n }\n if(temp[0] > int[1]){\n newList.push(int); //new Interval is greater then both parts of the other\n }\n if(temp[0] <= int[1]){\n if(temp[0] <= int[0]){\n if(temp[1] > int[1]){\n //larger of new interval is larger then larger of current interval\n holder[1] = newInt [1];\n }\n if(temp[1] <= int[1]){\n if(temp[1] <= int[0]){ //new Interval is less then both parts of this interval\n if(temp[0] && temp[1]) {\n newList.push(temp);\n }\n newList.push(int);\n intGreaterThenNew = true;\n return\n }\n //larger of newinterval is less then larger of current interval;\n holder[1] = int[1];\n }\n //newInt min is less then current interval min\n holder[0] = newInt[1];\n }\n //newInt min is less less then current int max but not less then its min.\n holder[0] = int[0];\n }\n })\n if(!intGreaterThenNew) newList.push(holder);\n return newList;\n}",
"function IntervalPacker(lowerBoundToInt, upperBoundToInt, options) {\n options = options || {};\n\n this._lowerBoundToInt = lowerBoundToInt;\n this._upperBoundToInt = upperBoundToInt;\n this._minGap = options.minGap || 0;\n\n}",
"function intervalDistance(minA, maxA, minB, maxB)\n{\n if (minA < minB)\n {\n return minB - maxA;\n }\n\n else return minA - maxB;\n}",
"function rangeIntersection(a, b) {\n if (a[0] > b[1])\n return null;\n if (a[1] < b[0])\n return null;\n // We know they intersect, result is the larger lower bound to the smaller\n // upper bound.\n return [Math.max(a[0], b[0]), Math.min(a[1], b[1])];\n}",
"function unionRanges(a, b) {\n if (!rangesOverlap(a, b)) {\n return null;\n } // Find the range with the earliest start point, and the range with the\n // latest end point.\n\n\n var starter = compareRangeBoundaryPoints(a, \"start\", b, \"start\") < 0 ? a : b;\n var ender = compareRangeBoundaryPoints(a, \"end\", b, \"end\") > 0 ? a : b;\n return spanRanges(starter, ender);\n}",
"function validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\"end before start\", \"The end of an interval must be after its start, but you had start=\" + start.toISO() + \" and end=\" + end.toISO());\n } else {\n return null;\n }\n }",
"function intervalContainsInterval(interval1, interval2) {\n\t\t\treturn interval1.start <= interval2.start && interval2.end <= interval1.end;\n\t\t}",
"function validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\"end before start\", \"The end of an interval must be after its start, but you had start=\" + start.toISO() + \" and end=\" + end.toISO());\n } else {\n return null;\n }\n}",
"function validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\"end before start\", \"The end of an interval must be after its start, but you had start=\" + start.toISO() + \" and end=\" + end.toISO());\n } else {\n return null;\n }\n}",
"function validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\"end before start\", \"The end of an interval must be after its start, but you had start=\" + start.toISO() + \" and end=\" + end.toISO());\n } else {\n return null;\n }\n}",
"function validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\"end before start\", \"The end of an interval must be after its start, but you had start=\" + start.toISO() + \" and end=\" + end.toISO());\n } else {\n return null;\n }\n}",
"function unionRanges(a, b) {\n\t if (!rangesOverlap(a, b)) {\n\t return null;\n\t }\n\n\t // Find the range with the earliest start point, and the range with the\n\t // latest end point.\n\t var starter = compareRangeBoundaryPoints(a, \"start\", b, \"start\") < 0 ? a : b;\n\t var ender = compareRangeBoundaryPoints(a, \"end\", b, \"end\") > 0 ? a : b;\n\n\t return spanRanges(starter, ender);\n\t}",
"function sumIntervals(intervals) {\n let sum = 0;\n intervals = intervals.sort(sortFunction);\n\n function sortFunction(a, b) { // Сортировка по первому столбцу\n if (a[0] === b[0]) {\n return 0;\n } else {\n return (a[0] < b[0]) ? -1 : 1;\n }\n }\n\n sum += intervals[0][1] - intervals[0][0];\n let max = intervals[0][1];\n for (let key = 1; key < intervals.length; key++) {\n if (intervals[key][1] <= max) {\n // nothing\n } else if (intervals[key][1] >= intervals[key - 1][1] && intervals[key][0] <= intervals[key - 1][1]) {\n sum += intervals[key][1] - intervals[key - 1][1];\n max = intervals[key][1];\n } else {\n sum += intervals[key][1] - intervals[key][0];\n max = intervals[key][1];\n }\n }\n return sum;\n}"
] | [
"0.66479737",
"0.6616013",
"0.652245",
"0.6456774",
"0.6433727",
"0.6431704",
"0.6426851",
"0.6387165",
"0.6342265",
"0.63171923",
"0.63106346",
"0.62977326",
"0.62505305",
"0.6249269",
"0.6243401",
"0.62178606",
"0.61666274",
"0.60571927",
"0.6051225",
"0.6029278",
"0.60221106",
"0.5993758",
"0.59743655",
"0.59701765",
"0.5968611",
"0.5968611",
"0.5968611",
"0.5968611",
"0.59659415",
"0.5940981"
] | 0.73323363 | 0 |
Alyssa also works out the product of two intervals by finding the minimum and the maximum of the products of the bounds and using them as the bounds of the resulting interval. (math_min and math_max are primitives that find the minimum or maximum of any number of arguments.) | function mulInterval(x, y) {
const p1 = lowerBound(x) * lowerBound(y);
const p2 = lowerBound(x) * upperBound(y);
const p3 = upperBound(x) * lowerBound(y);
const p4 = upperBound(x) * upperBound(y);
return makeInterval(Math.min(p1, p2, p3, p4), Math.max(p1, p2, p3, p4));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function iclamp(a, min, max) {\n\treturn Math.max(min, Math.min(a, max));\n}",
"function product_Range(a,b) {\n var prd = a,i = a;\n\n while (i++< b) {\n prd*=i;\n }\n return prd;\n}",
"function map(x, in_min, in_max, out_min, out_max,checkRanges) {\n if ((typeof checkRanges != 'undefined') && checkRanges) {\n if (x < in_min) x = in_min;\n else if (x > in_max) x = in_max;\n }\n return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;\n}",
"function linearScale (a1, b1, a2, b2) {\n return function (x1) {\n // in the interval [0, 1]\n var t = (x1 - a1) / (b1 - a1);\n // in the interval [a2, b2]\n return t * (b2 - a2) + a2;\n }\n}",
"function solve(a) {\n let min = 1, max = 1;\n for (let x of a) {\n let cur = [];\n for (let y of x) cur.push(y * min), cur.push(y * max);\n min = Math.min(...cur);\n max = Math.max(...cur);\n }\n return max;\n }",
"map(original, in_min, in_max, out_min, out_max) {\n return (original - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;\n }",
"function map(x, oMin, oMax, nMin, nMax) {\n // check range\n\n if (oMin === oMax) {\n console.log(\"Warning: Zero input range\");\n return null;\n }\n\n if (nMin === nMax) {\n console.log(\"Warning: Zero output range\");\n return null;\n }\n\n // check reversed input range\n let reverseInput = false;\n let oldMin = Math.min(oMin, oMax);\n let oldMax = Math.max(oMin, oMax);\n\n if (oldMin != oMin) reverseInput = true;\n\n // check reversed output range\n let reverseOutput = false;\n let newMin = Math.min(nMin, nMax);\n let newMax = Math.max(nMin, nMax);\n\n if (newMin != nMin) reverseOutput = true;\n\n // calculate new range\n let portion = (x - oldMin) * (newMax - newMin) / (oldMax - oldMin);\n\n if (reverseInput) portion = (oldMax - x) * (newMax - newMin) / (oldMax - oldMin);\n\n let result = portion + newMin;\n\n if (reverseOutput) result = newMax - portion;\n\n return result;\n }",
"function GetSum( a,b ) {\n let min = Math.min(a,b)\n let max = Math.max(a,b)\n \n let total = 0\n \n for(let i = min; i <= max; i++){\n total += i\n }\n return total\n }",
"function area(a, b){\n return (a*b);\n}",
"static map(val, inputMin, inputMax, outputMin, outputMax) {\n return ((outputMax - outputMin) * ((val - inputMin) / (inputMax - inputMin))) + outputMin;\n }",
"function rangeRad(a,b){\n var min = Math.min.apply(Math, [a, b]);\n var max = Math.max.apply(Math, [a, b]);\n console.log('min ' + min + ' max '+max);\n return this > min && this < max;\n }",
"function rangeIntersection(a, b) {\n if (a[0] > b[1])\n return null;\n if (a[1] < b[0])\n return null;\n // We know they intersect, result is the larger lower bound to the smaller\n // upper bound.\n return [Math.max(a[0], b[0]), Math.min(a[1], b[1])];\n}",
"function maxOfTwoNumbers(a, b) {\n //\n}",
"function constrain(x, x0, x1) {\r\n return Math.min(Math.max(x, x0), x1);\r\n}",
"function maxOfTwoNumbers(a, b) {\n return Math.max(a, b);\n //\n}",
"function map(x, inMin, inMax, outMin, outMax) {\n return (x - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n }",
"function maxOfTwoNumbers(a, b) { \n return Math.max (a,b) }",
"function within(min1, max1, min2, max2) {\n return (min1 <= max2 && max1 >= min2);\n}",
"function getSum( a,b ) {\n let min = Math.min(a,b);\n let max = Math.max(a,b);\n let sum = 0;\n if (min >= 0) {\n while (max-min >= 1) {\n sum = sum + max;\n max--;\n }\n } else if (min < 0) {\n while (-min-max >= 1) {\n sum += max;\n max--;\n }\n }\n\n \n \n console.log(min, max, sum)\n \n return;\n}",
"map(value, startRangeLower, startRangeHigher, targetRangeLower, targetRangeHigher)\n {\n let startSpan = startRangeHigher - startRangeLower;\n let targetSpan = targetRangeHigher - targetRangeLower;\n return (((value - startRangeLower) / startSpan) * targetSpan) + targetRangeLower;\n }",
"function abTest(a, b){\n if (a < 0 || b < 0){\n return undefined;\n }\n\n return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));\n}",
"function map_range(value, low1, high1, low2, high2) {\n return low2 + (high2 - low2) * (value - low1) / (high1 - low1);\n}",
"function map_range(value, low1, high1, low2, high2) {\n return low2 + (high2 - low2) * (value - low1) / (high1 - low1);\n}",
"function map_range(value, low1, high1, low2, high2) {\n return low2 + (high2 - low2) * (value - low1) / (high1 - low1);\n}",
"function map_range(value, low1, high1, low2, high2) {\n return low2 + (high2 - low2) * (value - low1) / (high1 - low1);\n}",
"function map_range(value, low1, high1, low2, high2) {\n return low2 + (high2 - low2) * (value - low1) / (high1 - low1);\n}",
"function map (num, in_min, in_max, out_min, out_max) {\n return (num - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;\n}",
"function abTest(a, b) {\n if (a < 0 || b < 0) {\n return undefined;\n }\n return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));\n}",
"function abTest(a, b) {\n\tif (a < 0 || b < 0) {\n\t\treturn undefined;\n\t}\n\treturn Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 0));\n}",
"function abTest(a,b){\n if (a < 0 || b < 0){\n return undefined\n }\n return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b),2))\n}"
] | [
"0.63497293",
"0.6287785",
"0.6074114",
"0.6001888",
"0.5925367",
"0.5914643",
"0.58827174",
"0.5819397",
"0.58159214",
"0.5801726",
"0.5793916",
"0.5776489",
"0.5767991",
"0.57658136",
"0.576004",
"0.5758149",
"0.5742974",
"0.5724646",
"0.57046723",
"0.5695718",
"0.5684329",
"0.56808263",
"0.56808263",
"0.56808263",
"0.56808263",
"0.56808263",
"0.56747955",
"0.5646715",
"0.5638208",
"0.5637244"
] | 0.69145757 | 0 |
To divide two intervals, Alyssa multiplies the first by the reciprocal of the second. Note that the bounds of the reciprocal interval are the reciprocal of the upper bound and the reciprocal of the lower bound, in that order. | function divInterval(x, y) {
return mulInterval(x, makeInterval(1.0 / upperBound(y), 1.0 / upperBound(y)));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function divide(a, b) {\n\t\ta = a + 0.0;\n\t\tb = b + 0.0;\n\t\tif(Math.abs(b) < 0.00001) {\n\t\t\tb = 0.0001;\n\t\t}\t\n\t\treturn a / b;\n\t}",
"function divide1(a, b) {\n return a / b; \n}",
"function divide(a, b) {\n return divide(a, b);\n}",
"function division(a, b) {\r\n\treturn a / b;\r\n}",
"function divide(a,b) {\n\treturn a / b\n}",
"div(a, b) {\n\t\tthis.registers[a] = Math.trunc(this.get(a) / this.get(b));\n\t}",
"function divide(a, b) {\r\n // if (b === 0) {\r\n // throw 'Division by zero is undefined: ' + a + '/' + b;\r\n // }\r\n var sign = 1;\r\n if (a < 0) {\r\n a = -a;\r\n sign = -sign;\r\n }\r\n if (b < 0) {\r\n b = -b;\r\n sign = -sign;\r\n }\r\n var result = 0;\r\n while (a >= 0) {\r\n a -= b;\r\n result++;\r\n }\r\n return (result - 1) * sign;\r\n }",
"function div(a, b) {\n return (a-(a%b))/b;\n}",
"function divValues(firstValue, secondValue) {\n\t\tvar result = 0; \n\t\tresult = firstValue / secondValue;\n\t\treturn result;\n\t}",
"function divide(a, b) {\n\t\tvar result = a / b;\n\t\treturn result;\n\t}",
"function avgTwoNumbers(a, b) {\n\treturn (a+b)/2;\n}",
"function Divide(This, A, B) {\n\n evaluate(A);\n evaluate(B);\n if (act[A] === true && act[b] === true && val[b] !== 0) {\n val[This] = val[A] / val[B];\n act[This] = true;} else \n {\n act[This] = false;}\n\n return true;}",
"function fractionate(val, minVal, maxVal) {\n return (val - minVal)/(maxVal - minVal);\n}",
"function divide(a,b){\n return a / b\n}",
"function divide(a, b) {\n int1 = a / b;\n return int1;\n}",
"function div(a, b) {\n return ~~(a / b);\n}",
"function linearScale (a1, b1, a2, b2) {\n return function (x1) {\n // in the interval [0, 1]\n var t = (x1 - a1) / (b1 - a1);\n // in the interval [a2, b2]\n return t * (b2 - a2) + a2;\n }\n}",
"function calculateRatio(l1, l2) {\n\t\treturn l1 > l2 ? l1 / l2 : l2 / l1;\n\t}",
"function shitty_averagizer(a, b) {\r\n return (a + b) / 2;\r\n }",
"function division(num1, num2){\n return -1;\n }",
"function division(a, b) {\n\treturn printResult(parseInt(a) / parseInt(b));\n}",
"function euclidDistNorm(a,b) {\n var diff=(a.map((a,i) => (a/b[i])));\n diff=(diff.map((a,i) => (1-a)*(1-a)));\n return(Math.sqrt(diff.reduce((acc,v) => acc + v)));\n}",
"function div(a, b, bitPrecision) {\n if (a == 0) {\n return 0;\n }\n if (a < b) {\n return 1 / _div(b, a, bitPrecision);\n }\n return _div(a, b, bitPrecision);\n}",
"function abTest(a, b) {\n\tif (a < 0 || b < 0) {\n\t\treturn undefined;\n\t}\n\treturn Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 0));\n}",
"function revDivided(v1,v2){\r\n //return v1/v2;\r\n console.log(v1/v2);\r\n }",
"function divide(n1, n2) {\n return n1 / n2;\n }",
"function goldenRatio(a, b) {\n var ratio = b / a;\n\n function getNewRatio(x, y) {\n var newRatio = x / y;\n returnRatio = 0;\n\n if ((newRatio > 1.61800) && (newRatio < 1.61806)) {\n returnRatio = newRatio;\n } else {\n getNewRatio((x + y), x);\n }\n return returnRatio;\n }\n\n if ((ratio > 1.61800) && (ratio < 1.61806)) {\n return ratio;\n } else {\n var goldenRatio = getNewRatio((a + b), b);\n return goldenRatio;\n }\n\n}",
"function average(a, b) {\n return (a + b) / 2;\n}",
"function divide_(x,y,q,r) {\n var kx, ky;\n var i,j,y1,y2,c,a,b;\n copy_(r,x);\n for (ky=y.length;y[ky-1]==0;ky--); //ky is number of elements in y, not including leading zeros\n\n //normalize: ensure the most significant element of y has its highest bit set \n b=y[ky-1];\n for (a=0; b; a++)\n b>>=1; \n a=bpe-a; //a is how many bits to shift so that the high order bit of y is leftmost in its array element\n leftShift_(y,a); //multiply both by 1<<a now, then divide both by that at the end\n leftShift_(r,a);\n\n //Rob Visser discovered a bug: the following line was originally just before the normalization.\n for (kx=r.length;r[kx-1]==0 && kx>ky;kx--); //kx is number of elements in normalized x, not including leading zeros\n\n copyInt_(q,0); // q=0\n while (!greaterShift(y,r,kx-ky)) { // while (leftShift_(y,kx-ky) <= r) {\n subShift_(r,y,kx-ky); // r=r-leftShift_(y,kx-ky)\n q[kx-ky]++; // q[kx-ky]++;\n } // }\n\n for (i=kx-1; i>=ky; i--) {\n if (r[i]==y[ky-1])\n q[i-ky]=mask;\n else\n q[i-ky]=Math.floor((r[i]*radix+r[i-1])/y[ky-1]);\n\n //The following for(;;) loop is equivalent to the commented while loop, \n //except that the uncommented version avoids overflow.\n //The commented loop comes from HAC, which assumes r[-1]==y[-1]==0\n // while (q[i-ky]*(y[ky-1]*radix+y[ky-2]) > r[i]*radix*radix+r[i-1]*radix+r[i-2])\n // q[i-ky]--; \n for (;;) {\n y2=(ky>1 ? y[ky-2] : 0)*q[i-ky];\n c=y2;\n y2=y2 & mask;\n c = (c - y2) / radix;\n y1=c+q[i-ky]*y[ky-1];\n c=y1;\n y1=y1 & mask;\n c = (c - y1) / radix;\n\n if (c==r[i] ? y1==r[i-1] ? y2>(i>1 ? r[i-2] : 0) : y1>r[i-1] : c>r[i]) \n q[i-ky]--;\n else\n break;\n }\n\n linCombShift_(r,y,-q[i-ky],i-ky); //r=r-q[i-ky]*leftShift_(y,i-ky)\n if (negative(r)) {\n addShift_(r,y,i-ky); //r=r+leftShift_(y,i-ky)\n q[i-ky]--;\n }\n }\n\n rightShift_(y,a); //undo the normalization step\n rightShift_(r,a); //undo the normalization step\n }",
"function rangeMatch(X1, minX1, maxX1, minX2, maxX2) {\n return minX2 + ((X1 - minX1) / (maxX1 - minX1)) * (maxX2 - minX2)\n}"
] | [
"0.6556227",
"0.6140319",
"0.6107507",
"0.6097738",
"0.60297906",
"0.5959053",
"0.59564245",
"0.5914174",
"0.5869834",
"0.5859574",
"0.5777394",
"0.5768386",
"0.57455504",
"0.5718051",
"0.5714318",
"0.5704635",
"0.5701839",
"0.5690303",
"0.56748295",
"0.5670914",
"0.5670283",
"0.56592184",
"0.5649269",
"0.5610257",
"0.5589122",
"0.55734015",
"0.5571114",
"0.55605364",
"0.55587626",
"0.55499405"
] | 0.6592287 | 0 |
Define a constructor make_center_percent that takes a center and a percentage tolerance and produces the desired interval. You must also define a selector percent that produces the percentage tolerance for a given interval. The center selector is the same as the one shown above. | function makeCenterPercent(center, percent, width = center * (percent / 100)) {
return makeCenterWidth(center, width);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getCubicBezierXYatPercent(startPt,controlPt1,controlPt2,endPt,percent){\n var x=CubicN(percent,startPt.x,controlPt1.x,controlPt2.x,endPt.x);\n var y=CubicN(percent,startPt.y,controlPt1.y,controlPt2.y,endPt.y);\n return({x:x,y:y});\n }",
"percent(val) {\n this._percent = val;\n return this;\n }",
"function percent(value) {\n return new Percent(value);\n}",
"function calcPercent(target, total){ //Declare and define function\n return target / total * 100; //Code to be calculated and returned when the function is called\n}",
"static interpolate(start, end, percent) {\n return (end - start) * percent + start;\n }",
"function produceTipCalculator(percent) {\n return function(fare) {\n return percent * fare;\n };\n}",
"function calcPointToPercentage(calcPoint) {\n var location = calcPoint - offset(scope_Base, options.ort);\n var proposal = (location * 100) / baseSize();\n\n // Clamp proposal between 0% and 100%\n // Out-of-bound coordinates may occur when .noUi-base pseudo-elements\n // are used (e.g. contained handles feature)\n proposal = limit(proposal);\n\n return options.dir ? 100 - proposal : proposal;\n }",
"function calcPointToPercentage(calcPoint) {\n var location = calcPoint - offset(scope_Base, options.ort);\n var proposal = (location * 100) / baseSize();\n\n // Clamp proposal between 0% and 100%\n // Out-of-bound coordinates may occur when .noUi-base pseudo-elements\n // are used (e.g. contained handles feature)\n proposal = limit(proposal);\n\n return options.dir ? 100 - proposal : proposal;\n }",
"function calcPointToPercentage(calcPoint) {\n var location = calcPoint - offset(scope_Base, options.ort);\n var proposal = (location * 100) / baseSize();\n\n // Clamp proposal between 0% and 100%\n // Out-of-bound coordinates may occur when .noUi-base pseudo-elements\n // are used (e.g. contained handles feature)\n proposal = limit(proposal);\n\n return options.dir ? 100 - proposal : proposal;\n }",
"function calcPointToPercentage(calcPoint) {\n var location = calcPoint - offset(scope_Base, options.ort);\n var proposal = (location * 100) / baseSize();\n\n // Clamp proposal between 0% and 100%\n // Out-of-bound coordinates may occur when .noUi-base pseudo-elements\n // are used (e.g. contained handles feature)\n proposal = limit(proposal);\n\n return options.dir ? 100 - proposal : proposal;\n }",
"function calcPointToPercentage(calcPoint) {\n var location = calcPoint - offset(scope_Base, options.ort);\n var proposal = (location * 100) / baseSize();\n // Clamp proposal between 0% and 100%\n // Out-of-bound coordinates may occur when .noUi-base pseudo-elements\n // are used (e.g. contained handles feature)\n proposal = limit(proposal);\n return options.dir ? 100 - proposal : proposal;\n }",
"function Range(percent) {\n\tthis.percent = percent;\n\tthis.pocketPairs = this.getPreFlopRange(this.percent);\n\tthis.cards = [];\n\tthis.MONTE_CARLO_COUNT = 100;\n\tthis.CONFIDENCE = 0.2;\n}",
"function calcPointToPercentage ( calcPoint ) {\n\t\tvar location = calcPoint - offset(scope_Base, options.ort);\n\t\tvar proposal = ( location * 100 ) / baseSize();\n\n\t\t// Clamp proposal between 0% and 100%\n\t\t// Out-of-bound coordinates may occur when .noUi-base pseudo-elements\n\t\t// are used (e.g. contained handles feature)\n\t\tproposal = limit(proposal);\n\n\t\treturn options.dir ? 100 - proposal : proposal;\n\t}",
"function calcPointToPercentage ( calcPoint ) {\n\t\tvar location = calcPoint - offset(scope_Base, options.ort);\n\t\tvar proposal = ( location * 100 ) / baseSize();\n\n\t\t// Clamp proposal between 0% and 100%\n\t\t// Out-of-bound coordinates may occur when .noUi-base pseudo-elements\n\t\t// are used (e.g. contained handles feature)\n\t\tproposal = limit(proposal);\n\n\t\treturn options.dir ? 100 - proposal : proposal;\n\t}",
"function calcPointToPercentage ( calcPoint ) {\n\t\tvar location = calcPoint - offset(scope_Base, options.ort);\n\t\tvar proposal = ( location * 100 ) / baseSize();\n\n\t\t// Clamp proposal between 0% and 100%\n\t\t// Out-of-bound coordinates may occur when .noUi-base pseudo-elements\n\t\t// are used (e.g. contained handles feature)\n\t\tproposal = limit(proposal);\n\n\t\treturn options.dir ? 100 - proposal : proposal;\n\t}",
"function setProgress(calcper, Maxvalue, type) {\n percent = (calcper / Maxvalue) *100\n if(percent > 100) percent = 100;\n if(percent < 0) percent = 0;\n if (0 < percent && percent < 10)\n {percent = 10 };\n if (10 < percent && percent < 20)\n {percent = 20};\n if (20 < percent && percent < 30)\n {percent = 30};\n if (30 < percent && percent < 40)\n {percent = 40};\n if (40 < percent && percent < 50)\n {percent = 50};\n if (50 < percent && percent < 60)\n {percent = 60};\n if (60 < percent && percent < 70)\n {percent = 70};\n if (70 < percent && percent < 80)\n {percent = 80};\n if (80 < percent && percent < 90)\n {percent = 90};\n if (90 < percent && percent < 100)\n {percent = 100};\n\n type(percent);\n }",
"function parsePercent$1(percent, all) {\n\t switch (percent) {\n\t case 'center':\n\t case 'middle':\n\t percent = '50%';\n\t break;\n\t\n\t case 'left':\n\t case 'top':\n\t percent = '0%';\n\t break;\n\t\n\t case 'right':\n\t case 'bottom':\n\t percent = '100%';\n\t break;\n\t }\n\t\n\t if (typeof percent === 'string') {\n\t if (_trim(percent).match(/%$/)) {\n\t return parseFloat(percent) / 100 * all;\n\t }\n\t\n\t return parseFloat(percent);\n\t }\n\t\n\t return percent == null ? NaN : +percent;\n\t }",
"function calcPointToPercentage ( calcPoint ) {\r\n\t\tvar location = calcPoint - offset(scope_Base, options.ort);\r\n\t\tvar proposal = ( location * 100 ) / baseSize();\r\n\t\treturn options.dir ? 100 - proposal : proposal;\r\n\t}",
"function calcPointToPercentage ( calcPoint ) {\n\t\tvar location = calcPoint - offset(scope_Base, options.ort);\n\t\tvar proposal = ( location * 100 ) / baseSize();\n\t\treturn options.dir ? 100 - proposal : proposal;\n\t}",
"function calcPointToPercentage ( calcPoint ) {\n\t\tvar location = calcPoint - offset(scope_Base, options.ort);\n\t\tvar proposal = ( location * 100 ) / baseSize();\n\t\treturn options.dir ? 100 - proposal : proposal;\n\t}",
"function calcPointToPercentage ( calcPoint ) {\n\t\tvar location = calcPoint - offset(scope_Base, options.ort);\n\t\tvar proposal = ( location * 100 ) / baseSize();\n\t\treturn options.dir ? 100 - proposal : proposal;\n\t}",
"function calcPointToPercentage ( calcPoint ) {\n\t\tvar location = calcPoint - offset(scope_Base, options.ort);\n\t\tvar proposal = ( location * 100 ) / baseSize();\n\t\treturn options.dir ? 100 - proposal : proposal;\n\t}",
"function calcPointToPercentage ( calcPoint ) {\n\t\tvar location = calcPoint - offset(scope_Base, options.ort);\n\t\tvar proposal = ( location * 100 ) / baseSize();\n\t\treturn options.dir ? 100 - proposal : proposal;\n\t}",
"function calcPointToPercentage ( calcPoint ) {\n\t\tvar location = calcPoint - offset(scope_Base, options.ort);\n\t\tvar proposal = ( location * 100 ) / baseSize();\n\t\treturn options.dir ? 100 - proposal : proposal;\n\t}",
"function calcPointToPercentage(calcPoint) {\n var location = calcPoint - offset(scope_Base, options.ort);\n var proposal = (location * 100) / baseSize();\n return options.dir ? 100 - proposal : proposal;\n }",
"function percentOf(val, percent) {\r\n return (val * percent) / 100;\r\n}",
"setProgress(percent) {\n const offset = this.circumference - percent / 100 * this.circumference;\n\n let circle = this.container.querySelector('.radialcircle');\n circle.style.strokeDasharray = `${this.circumference} ${this.circumference}`;\n circle.style.strokeDashoffset = offset;\n\n if (this.segments) {\n\n let tickwidth = this.segments * 2;\n\n let seglength = (((this.radius * 2) * Math.PI) - tickwidth) / (this.segments);\n\n let tickmarks = this.container.querySelector('.tickmarks');\n tickmarks.style.strokeDasharray = `2px ${seglength}px`;\n tickmarks.style.strokeDashoffset = 0;\n\n }\n }",
"static interpolateDelta(start, end, percent) {\n return (end - start) * percent;\n }",
"function percentage() {\n return percent;\n}",
"function circlePointsFromPercent(percent) {\n var x = Math.cos(2 * Math.PI * percent);\n var y = Math.sin(2 * Math.PI * percent);\n\n return [x, y];\n}"
] | [
"0.5441083",
"0.5423155",
"0.53515947",
"0.51415503",
"0.5099301",
"0.50814635",
"0.50578564",
"0.50578564",
"0.50578564",
"0.50578564",
"0.5045009",
"0.50370234",
"0.50069755",
"0.50069755",
"0.50069755",
"0.4975419",
"0.49723375",
"0.4970372",
"0.49646857",
"0.49646857",
"0.49646857",
"0.49646857",
"0.49646857",
"0.49646857",
"0.49532548",
"0.49466726",
"0.49455425",
"0.4914168",
"0.49080184",
"0.49056897"
] | 0.7483115 | 0 |
returns number of cannons in a pyramid of cannonballs using a recurrence relation cannonball(n) = nn + cannonball(n1) | function cannonball(n) {
if( n === 1){
return 1;
}else{
return n * n + cannonball(n - 1);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function pyramid(cans){\n\tvar total = 0;\n\tvar counter = 1;\n\tvar result = 0;\n\twhile(total <= cans){\n\t\ttotal += Math.pow(counter,2);\n\t\tresult = counter;\n\t\tcounter++;\n\t}\n\treturn --result;\n}",
"function pyramid(cans){\n\tvar res = []; \n\t// var x = 0\n\twhile(cans > 1){\n\n\t\tres.push(Math.sqrt(cans-1) + Math.sqrt(cans))\n\t\tconsole.log(cans);\n\t\tconsole.log(res)\n\t\t\tcans--;\n\t}\n\n\treturn res.length ;\n}",
"function mystery(n) {\n let r = 0;\n for (let i = 0; i < n; i++) {\n for (let j = i + 1; j <= n; j++) {\n for (let k = 1; k < j; k++) {\n r++;\n }\n }\n }\n return r;\n}",
"function collatzSequenceCount(n) {\n let sequenceCount = 1;\n let startingNum = n;\n while (n > 1) {\n if (n % 2 === 0) {\n n = n / 2;\n } else {\n n = 3 * n + 1;\n }\n sequenceCount++;\n }\n return {number: startingNum, count: sequenceCount};\n}",
"function num_of_live_neighbours(game, n, r, c){\n const x = [-1,0,1];\n const y = [-1,0,1];\n let ans = 0;\n for(let i = 0; i < 3; i = i + 1){\n for(let j = 0; j < 3; j = j + 1){\n if(!(i === 1 && j === 1) \n && game[(r+x[i]+n)%n][(c+y[j]+n)%n] === 1){\n ans = ans + 1;\n } else {}\n }\n }\n return ans;\n}",
"function countWays (num, m) {\n\tconst result = Array(num);\n\tresult[0] = 1;\n\tresult[1] = 1;\n\tfor (let i = 2; i < num; i++) {\n\t\tresult[i] = 0;\n\t\tfor (let j = 1; j <= m && j <= i; j++) {\n\t\t\tresult[i] += result[i-j];\n\t\t}\n\t}\n\tconsole.log(result[num - 1]);\n\treturn result[num - 1];\n}",
"function perimeter(n) {\n let febSeq = [];\n \n if(n > 0){\n febSeq = [1,1]\n }\n \n for(let i = 0; i <= n - 2; i++){\n febSeq.push(febSeq[i] + febSeq[i + 1]);\n } \n \n return (getTotalSumOfArray(febSeq) > 0 ? getTotalSumOfArray(febSeq) : 1) * 4\n}",
"countNeighbours() {\n\t\tlet c = 0;\n\t\tfor(let x =- 1; x <= 1; x++) {\n\t\t\tfor(let y =- 1; y <= 1; y++) {\n\t\t\t\tlet neighbour = { x: this.x + x, y: this.y + y };\n\t\t\t\tif( this.world.isInside(neighbour.x, neighbour.y) &&\n\t\t\t\t (( neighbour.x !== this.x ) || ( neighbour.y !== this.y )) ) {\n\t\t\t\t\tif(this.world.grid[neighbour.y][neighbour.x].state) c += 1;\n\t\t\t\t\tif(c > 3) return c;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn c;\n\t}",
"function shapeArea(n) {\n let temp = 1;\n let count = 1;\n if (n === 1) {\n return count;\n } else {\n for (let i = 0; i < n - 1; i++) {\n temp += 2;\n count += temp;\n }\n for (let i = n; i > 1; i--) {\n temp -= 2;\n count += temp;\n }\n }\n return count\n}",
"function countPawns(grille)\r\n{\r\n\tvar cpt = 0;\r\n\r\n\tfor ( i=0 ; i<7 ; i++ )\r\n\t{\r\n\t\tfor ( j=0 ; j<6 ; j++ )\r\n\t\t{\r\n\t\t\tif (grille[i][j] != 0)\r\n\t\t\t{\r\n\t\t\t\tcpt++;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn cpt;\r\n}",
"function perimeter(n) {\n var fibArr = []\n for(var i = 0; i <= n; i ++){\n fibArr.push((fibArr[i-1] || 1) + (fibArr[i-2] || 0))\n }\n return fibArr.reduce((acc, curr) => acc + curr) * 4;\n}",
"function countClumps(array){\n var clump = 0;\n for(var i = 0; i < array.length; i++){\n if(array[i] === array [i+1]){\n for(var j = i +1; j < array.length; j++){\n if(array[j] !== array[j + 1]){\n i = j;\n break;\n }\n }\n clump = clump + 1;\n }\n }\n return clump;\n}",
"function Cantor(m, n){\n\treturn 1/2*(m+n)*(m+n+1)+n;\n}",
"function countNeighbors( cells, i, j )\n{\n var n = 0;\n\n n += countCell( cells, i - 1, j - 1 );\n n += countCell( cells, i - 1, j );\n n += countCell( cells, i - 1, j + 1 );\n\n n += countCell( cells, i, j - 1 );\n n += countCell( cells, i, j + 1 );\n\n n += countCell( cells, i + 1, j - 1 );\n n += countCell( cells, i + 1, j );\n n += countCell( cells, i + 1, j + 1 );\n\n return n;\n}",
"function bai6(n) {\n var tong = 0;\n for (let i = 1; i <= n; i++) {\n tong+=1/(i*(i+1));\n }\n return tong;\n}",
"function triangular( n ) {\n var counter = 0;\n for(i = 1; i <= n; i++){\n counter += 1;\n for(j = 1; j < i; j++){\n counter += 1\n }\n }\n return counter;\n }",
"function countCycles(n){\n\n\tvar cycles =1;\n\tvar remainder = 10 % n; //10 % 7 = 3\n\n\t//we know that 1 % n = 1, therefore when remainder =1\n\t//then the cycle is starting all over again\n\twhile (remainder !=1){\n\t\tremainder = 10*remainder % n;\n\t\tcycles++;\n\t}\n\treturn cycles;\n}",
"function candies(n, arr) {\n let min = Math.min(...arr);\n let max = Math.max(...arr);\n let candiesArr = Array.apply(null, Array(arr.length)).map((el) => 1);\n\n for(let j = min + 1; j <= max; j++) {\n for(let i = 0; i < arr.length; i++) {\n if(arr[i - 1] && arr[i] > arr[i - 1] && candiesArr[i] <= candiesArr[i - 1]) {\n candiesArr[i]++;\n }\n if(arr[i + 1] && arr[i] > arr[i + 1] && candiesArr[i] <= candiesArr[i + 1]) {\n candiesArr[i]++;\n }\n }\n }\n\n return candiesArr.reduce((sum, a) => sum + a, 0);\n}",
"_countNeighbours (cellX, cellY) {\n let neighbours = 0\n for (let x = -1; x < 2; x++) {\n for (let y = -1; y < 2; y++) {\n if (this.matrix[(cellX + x + this.sizeX) % this.sizeX][(cellY + y + this.sizeY) % this.sizeY] === 1) {\n neighbours++\n }\n }\n }\n neighbours -= (this.matrix[cellX][cellY] === 1 ? 1 : 0)\n return neighbours\n }",
"function climb(n){\n if(n==1){\n return 1 \n } \n else if (n==2){\n return 2\n } \n else {\n return climb(n-1) + climb(n-2)\n } \n}",
"function countClumps(array) {\n var clumpCount = 0;\n for (var i = 0; i < array.length - 1; i++) {\n var element = array[i];\n var clumpLength = 0;\n while (i < array.length && element == array[i + 1]) {\n i++;\n clumpLength++;\n }\n if (clumpLength >= 1) {\n clumpCount += 1;\n }\n }\n return clumpCount;\n}",
"function getDivisorsCnt(n) {\n let divisors = [];\n for (let i = 1; i <= n; i++) {\n if (n % i === 0) {\n divisors.push(i);\n }\n }\n return divisors.length;\n}",
"function countBombs(x,y) {\r\n\tlet count = 0;\r\n\tconsole.log(x,y);\r\n\r\n\t// left hand side\r\n\tif(x == 0) {\r\n\t\tif(y == 0) { // upper left corner\r\n\t\t\t\r\n\t\t\tif(table[x+1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y+1].getIsBomb()) {count ++};\r\n\r\n\t\t}\r\n\t\telse if(y == 15) { // lower left corner\r\n\t\t\tif(table[x][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y].getIsBomb()) {count ++};\r\n\t\t}\r\n\t\telse {\r\n\r\n\t\t\tif(table[x][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y+1].getIsBomb()) {count ++};\r\n\t\r\n\t\t}\r\n\t} \r\n\t// right hand side\r\n\telse if (x == 29) {\r\n\t\t//upper right corner\r\n\t\tif(y == 0) {\r\n\t\t\tif(table[x-1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y+1].getIsBomb()) {count ++};\r\n\t\t}\r\n\t\t// lower right corner\r\n\t\telse if (y == 15) {\r\n\t\t\tif(table[x-1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y-1].getIsBomb()) {count ++};\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif(table[x][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y+1].getIsBomb()) {count ++};\t\r\n\t\t}\r\n\t}\r\n\t// all other boxes: x does not limit these boxs, y still does \r\n\telse {\r\n\t\tif(y == 0) { // top row excpet corners\r\n\t\t\tif(table[x-1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y+1].getIsBomb()) {count ++};\t\r\n\t\t}\r\n\t\telse if (y == 15) { // bottom row except corners\r\n\t\t\tif(table[x-1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y].getIsBomb()) {count ++};\t\r\n\t\t}\r\n\t\telse { // rest of the boxes\r\n\t\t\tif(table[x-1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y].getIsBomb()) {count ++};\t\r\n\t\t\tif(table[x-1][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y+1].getIsBomb()) {count ++};\r\n\t\t}\r\n\t}\r\n\r\n\treturn count;\r\n}",
"function countSumOfTwoRepresentations(n, l, r) {\n var c=0;\n for(var i=l;i<=r;i++) {\n if(i<n) {\n for(var j=i;j<=r;j++) {\n if(i+j>n) break;\n else if(i+j<n);\n else c++;\n }\n }\n }\n return c;\n}",
"function count(n, memo=[]) {\n if (n <= 1) return 1;\n if (n == 2) {\n return 2;\n } else {\n let res = count(n - 3, memo) + count(n - 2, memo) + count(n - 1, memo);\n memo[n] = res;\n return res;\n }\n}",
"function numAttacks( M, bishops ) {\n let numAttacks = 0;\n\n for (let i = 0; i < bishops.length; i++) {\n let iX = bishops[i][0];\n let iY = bishops[i][1];\n \n for (let j = i + 1; j < bishops.length; j++) {\n let jX = bishops[j][0];\n let jY = bishops[j][1];\n if ( (iX + iY) === (jX + jY) || (jX - iX) === (jY - jY) ) {\n numAttacks++;\n }\n }\n }\n\n return numAttacks;\n}",
"function countNeighbors(row, col) {\n let count = 0;\n for (let i = -1; i <= 1; i++) {\n for (let j = -1; j <= 1; j++) {\n let r = (row + i + rows) % rows;\n let c = (col + j + cols) % cols;\n if (grid[r][c] === 1) {\n count++;\n }\n }\n }\n if (grid[row][col] === 1) {\n count--;\n }\n return count;\n}",
"function NumberOfIsland(grid) {\n let n, m, count = 0;\n n = grid.length;\n if (n <= 0) return 0;\n m = grid[0].length;\n for (let i = 0; i < n; i++){\n for (let j = 0; j < m; j++) {\n if(grid[i][j] === \"1\"){\n DFSMark(grid, i, j);\n count++;\n }\n }\n }\n return count;\n}",
"function numberOfRectangles(m, n) {\n return (m * m + m) * (n * n + n) / 4; //Math it!\n }",
"function ray_total_count() {\n let s = w.rays.length;;\n for(let i=0;i<w.beams.length;++i) \n s += w.beams[i].brays.length;\n return s; \n}"
] | [
"0.6721067",
"0.6645689",
"0.6422362",
"0.6253035",
"0.62261575",
"0.61913514",
"0.59372807",
"0.59161866",
"0.5898323",
"0.5876457",
"0.58520705",
"0.58518714",
"0.58251727",
"0.5822372",
"0.5803231",
"0.5732289",
"0.5717674",
"0.57052827",
"0.56735444",
"0.5653135",
"0.5651498",
"0.56502295",
"0.5646147",
"0.5615202",
"0.56104064",
"0.56039894",
"0.56037605",
"0.56008315",
"0.5600186",
"0.55888766"
] | 0.7278037 | 0 |
edit storage company section | async function onStorageCompanyEdit() {
event.preventDefault();
if (!$("#modalWindowBlock .modal #addForm").valid()) {
return;
}
let form = document.querySelector("#addForm");
let formData = new FormData(form);
let parameters = new URLSearchParams(formData);
await sendRequest("/storageCompanys", "put", parameters);
onModalClose();
getItemsList("storageCompanys");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"update(companyId) {\n return Resource.get(this).resource('Admin:updateCompany', {\n company: {\n ...this.displayData.company,\n margin: this.displayData.company.settings.margin,\n useAlternateGCMGR: this.displayData.company.settings.useAlternateGCMGR,\n serviceFee: this.displayData.company.settings.serviceFee\n },\n companyId\n });\n }",
"function setEditValuesCompany(index) {\n\n // generic list/ object initializer\n var jsonObject = (!Array.isArray(fetchData)) ? fetchData : fetchData[index];\n\n // general setters\n document.getElementById('edit-company-title').innerText = jsonObject['name'] + \" (cvr: \" + jsonObject['cvr'] + \")\";\n document.getElementById('edit-company-email').value = jsonObject['email'];\n\n // phones setters\n document.getElementById('company-phone-container').innerHTML = \"<h5><b>phones</b></h5>\";\n for (var phone in jsonObject['phones']) {\n document.getElementById('company-phone-container').innerHTML += \"<input type='text' class='form-control' value='\" + jsonObject['phones'][phone] + \"'>\";\n }\n\n // address setters\n if(jsonObject['address'] != undefined) document.getElementById('edit-company-street').value = jsonObject['address'];\n if(jsonObject['city'] != undefined) document.getElementById('edit-company-city').value = jsonObject['city'];\n if(jsonObject['zipCode'] != undefined) document.getElementById('edit-company-zipcode').value = jsonObject['zipCode'];\n\n // company info setters\n document.getElementById('edit-company-value').value = jsonObject['marketValue'];\n document.getElementById('edit-company-employees').value = jsonObject['numEmployees'];\n}",
"function editComics(){\n\tvar comics=JSON.parse(localStorage.getItem('Comics'));\n\tvar comic=comics[document.getElementById('editComic').getAttribute(\"number\")];\n\tcomic.Name=document.getElementById('comicName').value;\n\tcomic.Description=document.getElementById('comicDescription').value;\n\tcomic.Rate=document.getElementById('comicRate').value;\n\tcomic.Image=document.getElementById('comicImage').value;\n\tlocalStorage.setItem('Comics',JSON.stringify(comics));\n\tfilterBy();\n\t$('.overlay-bg, .overlay-content').hide();\n\talert(\"The comic has been edited successfully\");\n}",
"function editCompany(companyId, company) {\n var path = \"/api/company/\" + companyId;\n return fetch(path, {\n method: \"put\",\n headers: new Headers({\n \"Content-Type\": \"application/json\",\n }),\n body: JSON.stringify(company),\n credentials: \"include\",\n })\n .then((response) => {\n return response.json();\n })\n .catch((err) => {\n console.log(err);\n });\n}",
"editWorkAndEducation(){\n\t\tresources.workAndEducationTab().click();\n\t}",
"SetSelectedCompany(company) {\n console.debug(`ContaplusModel::SetSelectedCompany(${company})`)\n // Remove companies if folder is being changed or cleared\n if (company) {\n this.config.set(\"company\", company)\n } else {\n this.config.delete(\"company\")\n }\n }",
"function saveBusinessInfo() {\n const { company } = settings.data;\n\n const companyEntries = Object.entries(company);\n companyEntries.forEach(([key, value]) => {\n if (key === 'ids') {\n const idEntries = Object.keys(value);\n idEntries.forEach((k) => {\n settings.data.company.ids[k].name = document.getElementById(`business-${k}`).value;\n settings.data.company.ids[k].number = document.getElementById(`business-${k}-number`).value;\n });\n } else {\n settings.data.company[key] = document.getElementById(`business-${key}`).value;\n }\n });\n}",
"function linkCompany(opp, company, updateGrid){\n return RelationshipManager.linkEntity(opp, company, \"Content\", \"Company\", \n {\n \"from\": { \"name\": opp.name, \"description\": \"Primary Org\", \"isPrimary\": true}, \n \"to\" : { \"name\": company.name, \"description\": \"Primary Org\", \"isPrimary\": true}\n })\n .then(function(results){\n // console.log(results);\n $scope.data.thisContent.primaryCompany = results; \n $scope.data.prevPrimaryCompany = results; //set new current since link was changed \n //add this to entityLinks array of this opp\n $scope.data.thisContent.entityLinks.push(results); \n // console.log($scope.data.thisContent);\n \n if(updateGrid){ \n // //refresh grid\n gridManager.refreshView()\n // $rootScope.$broadcast('OPP_UPDATED', {\"id\": opp.id}); //reload opp with changes \n Logger.info('Content Updated');\n }; \n }); \n}",
"async function saveCompanyDataToPortolio(e) {\n e.preventDefault();\n\n alert(\"added \" + stockdata.Name +\" to watchlist.\");\n\n const companyDataFormVersion_2 = {\n company: companyName ? companyName : undefined,\n\t symbol: companySymbol ? companySymbol : undefined,\n\t priceAtPurchase: companyPurchasePrice ? companyPurchasePrice : undefined,\n\t sharesPurchased: companyShareCount ? companyShareCount : undefined,\n\t description: companyDescription ? companyDescription : undefined,\n };\n \n await axios.post(`${domain}stock_data/`, companyDataFormVersion_2);\n }",
"function addCompany() {\n var company = {};\n company.name = document.getElementById('c-name').value;\n company.email = document.getElementById('c-email').value;\n company.description = document.getElementById('c-desc').value;\n company.cvr = document.getElementById('c-cvr').value;\n company.numEmployees = document.getElementById('c-emps').value;\n company.marketValue = document.getElementById('c-value').value;\n var data = JSON.stringify(company);\n setData(data, \"company\");\n}",
"function storeCompanies(companies) {\n for (let company of companies) {\n loadedCompanies.push(company);\n addStorage(company);\n }\n document.querySelector(\"#companyLoader\").style.display = \"none\";\n populateList(loadedCompanies);\n }",
"function _saveProfileCompany() {\n if (vm.item.companyId === 0) {\n vm.item.companyId = vm.item.userId;\n vm.item.userId = vm.item.id;\n vm.item.modifiedBy = vm.data.name;\n vm.genericService.postById(\"/api/profile/company/\", vm.item.userId, vm.item)\n .then(_serviceCallSuccess, _serviceCallError);\n } else {\n vm.item.userId = vm.item.id;\n vm.item.modifiedBy = vm.data.name;\n vm.genericService.put(\"/api/profile/company/\", vm.item.userId, vm.item)\n .then(_serviceCallSuccess, _serviceCallError);\n }\n }",
"async editCompanyBankData(bank_account_no, ifsc_no, company_id, id) {\r\n await this.checkLogin();\r\n var response = await axios.put(\r\n Config.companyBankyApiUrl + \"\" + id + \"/\",\r\n {\r\n bank_account_no: bank_account_no,\r\n ifsc_no: ifsc_no,\r\n company_id: company_id,\r\n },\r\n {\r\n headers: { Authorization: \"Bearer \" + AuthHandler.getLoginToken() },\r\n }\r\n );\r\n return response;\r\n }",
"function setRecord (name, numEmployees, type) {\n let companyObject = new Company(name, numEmployees, type);\n localStorage.setItem(companyCount, JSON.stringify(companyObject));\n companyCount++;\n}",
"nav_helper_edit(data) {\n\t\tutil.selectDropDown(this.group,data.Group,'Group','Account Info');\n\t\tutil.selectDropDown(this.clientName,data.ClientName,'Client Name','Account Info ');\n\t\tutil.selectDropDown(this.accountNameDpn,data.AccountName,'Account Number','Account Info');\n\t\tutil.elementClickable(this.editBtn)\n\t}",
"function companyChanged() {\n var _clientId = $(\"#companyBase\").val();\n if (userType == \"SYSADMIN\") {\n $(\".ccFields\").show();\n $(\"#merchAcctField\").show();\n $(\"#amountField\").show();\n $(\"#invoiceField\").show();\n $(\"#nameField\").show();\n $(\"#emailField\").show();\n $(\"#authCode\").show();\n $(\"#terminalField\").show();\n }\n\n loadMerchAccts(_clientId);\n}",
"function editEntry(entry){\n // making entry the variable that represents the entry id which includes amount, name,type\n let ENTRY = ENTRY_LIST[entry.id];\n // if the entry type is an input, we are going to update the item name and cost in the input section\n if (ENTRY.type == \"inputs\"){\n itemTitle.value = ENTRY.title;\n itemAmount.value = ENTRY.amount;\n }\n deleteEntry(entry);\n \n}",
"function onCompanyChange(e) {\n setCompany({\n ...company,\n [e.target.name]: e.target.value\n })\n }",
"function update_entity_edit() {\n var form_record = Domain.entities[current_entity];\n Forms.init(form_record);\n update_edit_form_display();\n}",
"function addName() {\n $('#company').val(companyInfo['name']);\n}",
"function SaveCompany() {\n AsyncStorageLibrary.SaveCompany(props.symbol, props.companyName, props.lastSalePrice, props.lastUpdated, props.tradeData.trades[props.tradeData.trades.length - 1].price);\n setState((prevState) => {\n return ({\n ...prevState,\n favorited: true\n });\n });\n }",
"function editSucursal(item) {\n this.editing = false;\n item.enterprise = item.enterprise._id;\n for (var i in item.cajas) {\n item.cajas[i] = item.cajas[i]._id;\n };\n item.$update(function() {\n console.log('todo ok');\n }, function(errorResponse) {\n console.log('error');\n });\n }",
"function addDescription() {\n $('#company-description').val(companyInfo['description']);\n}",
"function edit(indice){\r\n var produto = [];\r\n\r\n var arrEd = JSON.parse(localStorage.getItem('tblProdutos')) || [];\r\n\r\n produto = arrEd[indice];\r\n\r\n localStorage.setItem('EditProd', produto);\r\n location = 'EditarProd.html';\r\n}",
"function loadForm(company) {\n var targetUrl;\n var myOrg = new Organization();\n\n // myOrg.load(loadOrganizationList);\n loadOrganizationsByCompany(company.CompanyID, populateOrganizationList, pmmodaErrorHandler)\n// loadOrganizations(loadOrganizationList, loadOrgErrorHandler);\n\n\n if (editMode == \"new\") {\n updateReady = new $.Deferred();\n // Set the org value to -1 when the form is fully loaded\n $.when(updateReady).then(function () { setFormMode(\"new\"); });\n }\n }",
"function onChangeComp (value){\n setCompanyName(value);\n for (var i in basedata){\n var name = basedata[i].name;\n if(name === value){\n // console.log(\"enter?\")\n setInspect(basedata[i]);\n getRadial();\n \n setInfoCountry(basedata[i].country_code);\n setInfocity(basedata[i].city);\n setInfoRegion(basedata[i].region);\n setInfoaddress(basedata[i].address);\n setInfodescription(basedata[i].short_description);\n \n setInfofundround(basedata[i].num_funding_rounds.toString());\n setInfofundamt(basedata[i].total_funding_usd.toString());\n setInfoemployeeSize(basedata[i].employee_count);\n \n setInfostatus(basedata[i].status);\n setInfoFundstatus(basedata[i].funding_status)\n setInforank(basedata[i].rank);\n setInfoCate(basedata[i].category_groups_list);\n setInfocrubLink(basedata[i].cb_url);\n setInfoweblink(basedata[i].homepage_url);\n idex = i;\n }\n }\n }",
"function editItem() {\n var value = localStorage.getItem($(this).attr(\"key\"));\n var item = jQuery.parseJSON(value);\n toggleControls(\"off\");\n $('#displayLink').hide();\n $('#rname').val(item.rname[1]);\n $('#dateadded').val(item.dateadded[1]);\n var radios = $('input[name=\"category\"]:checked').val();\n $('#rtype').val(item.rtype[1]);\n $('#ringredients').val(item.ringredients)[1];\n $('#rdirections').val(item.rdirections)[1];\n save.off(\"click\", storeData);\n $('#submit').val(\"Edit Recipe\");\n var editSubmit = $('#submit');\n editSubmit.on(\"click\");\n editSubmit.attr(\"key\", this.key);\n }",
"function onChangeStorage(args) {\n onChange(document.getElementById('storage'), args.value, 'GB');\n }",
"function updateCompanyCurrency(currencyId){\n var company = Companies_Live.findOne({ \"code\": Session.get(\"COMPANY_CODE\") });\n company.pivotCurrency = currencyId;\n Companies_Authorization.insert(company);\n}",
"function CreateCompanyEditString(){\n\t\t\t\n\t\t\t//alert(\"(DEBUG)CreateCompanyEditString()- starting\");\n\t\t\tvar URL = \"../engine/dBInterface.php?ActionDBToken=UpdateCompany\";\n\t\t\tURL += \"&CompanyID_Token=\"+URLParams.ID;\n\n\t\t\tif(CompanyData.CompanyEmail_FieldValue!==\"NONE\"){\n\t\t\t\tURL += \"&Email_Token=\"+CompanyData.CompanyEmail_FieldValue;\n\t\t\t}\t\t\t\n\t\t\t\n\t\t\tif(CompanyData.CompanyPhone_FieldValue!==\"NONE\"){\n\t\t\t\tURL += \"&Phone_Token=\"+CompanyData.CompanyPhone_FieldValue;\n\t\t\t}\t\n\n\t\t\tif(CompanyData.Address_FieldValue!==\"NONE\"){\n\t\t\t\tURL += \"&Address_Token=\"+CompanyData.Address_FieldValue;\n\t\t\t} \n \n //\n\t\t\t//FIXME:for demo this is commented out\t\n\t\t\t/*\n\t\t\tif(CompanyData.Address_FieldValue!==\"NONE\"){\n\t\t\t\tURL += \"&AddressToken=\"+CompanyData.Address_FieldValue;\n\t\t\t}\n\t\t\t*/\n\t\t\t\n\t\t\t//alert(\"(DEBUG)CreateCompanyEditString()-ending.URL=\"+URL);\n\t\t\treturn URL;\n\t\t\n\t\t}"
] | [
"0.6512022",
"0.6260384",
"0.6237383",
"0.6085678",
"0.5973081",
"0.59060085",
"0.5844136",
"0.56873536",
"0.56678903",
"0.5568383",
"0.5495501",
"0.54906136",
"0.54874307",
"0.5475003",
"0.5434733",
"0.54195154",
"0.54015535",
"0.53953695",
"0.53770345",
"0.5372026",
"0.5350012",
"0.53382534",
"0.53294384",
"0.53178644",
"0.5308834",
"0.5305524",
"0.53031516",
"0.52903384",
"0.5285169",
"0.52827"
] | 0.67870003 | 0 |
Appends new file form row. This changes `model`. | addFile() {
this.addCustom('type', {
inputLabel: 'Property value'
});
const index = this.model.length - 1;
const item = this.model[index];
item.schema.isFile = true;
item.schema.inputType = 'file';
this.requestUpdate();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addFile(row, col, action) {\n\t\t\tconsole.log(\"add file example\", row);\n\t\t\tvar d = new Date();\n\t\t\tvar modifyItem = row.entity;\n\t\t\tif(modifyItem != undefined){\n\t\t\t\tmodifyItem.filename='newfile.jpg';\n\t\t\t\tmodifyItem.serial=10;\n\t\t\t\tmodifyItem.date = d;\n\t\t\t}\n\t\t\t//update actions\n\t\t\tvar showButton = (modifyItem.filename && modifyItem.filename != \"\") ? false : true;\n\t\t\tmodifyItem.actions = [\n\t\t\t\t{field: modifyItem.filename, actionFieldType: enums.actionFieldType.getName(\"Text\"), cssClass: \"\"},\n\t\t\t\t{field: 'fa fa-search', actionFieldType: enums.actionFieldType.getName(\"Icon\"), function: searchFunc, showControl: !showButton},\n\t\t\t\t{field: 'fa fa-eye', actionFieldType: enums.actionFieldType.getName(\"Icon\"), function: editFunc, showControl: !showButton},\n\t\t\t\t{field: '/ignoreImages/si_close_entity_normal.png', actionFieldType: enums.actionFieldType.getName(\"Image\"), height: \"16\", width: \"16\", function: deleteFunc, cssClass: \"\", showControl: !showButton},\n\t\t\t\t{field: 'Add File', title: 'Add File', actionFieldType: enums.actionFieldType.getName(\"Button\"), function: addFile, showControl: showButton}\n\t\t\t]\n\t\t\tvar showRowLock = modifyItem.isSelected;\n\t\t\tmodifyItem.lock = [\n\t\t\t\t{field: 'fa fa-check', actionFieldType: enums.actionFieldType.getName(\"Icon\"), showControl: showRowLock}\n\t\t\t]\n\t\t}",
"createFile(text){\n this.model.push({text});\n\n // This change event can be consumed by other components which\n // can listen to this event via componentWillMount method.\n this.emit(\"change\")\n }",
"function addRow() {\n document.form1.count.value = parseInt(document.form1.count.value) + 1;\n var i = parseInt(document.form1.count.value);\n \t var table;\n\t if (document.all)\n\t table = document.all.uploadtable;\n\t else if (document.getElementById)\n\t table = document.getElementById('uploadtable');\n\t if (table && table.rows && table.insertRow) {\n\t var tr = table.insertRow(table.rows.length);\n\t var td = tr.insertCell(tr.cells.length);\n data = '<input type=\"file\" name=\"upload' + i + '\" class=\"textboxgray\"><br>';\n\t td.innerHTML = data;\n\t }\n }",
"function onAdd() {\n\n var tmp = $scope.section.rows[$scope.section.rows.length - 1];\n if (tmp.cols.length > 0) {\n if (tmp.cols[0].fields.length > 0) {\n $scope.section.rows.push(OdsFormService.newRowObject());\n }\n }\n }",
"function addRow() {\n\n $scope.section.rows.push(OdsFormService.newRowObject());\n }",
"function addModel(data) {\n modelHash = Math.random().toString(36).substring(2, 9);\n loadModelEvent.data = {\n file: data,\n modelHash: modelHash\n }\n selectors.closeModel[order].setAttribute('data-hash', modelHash);\n selectors.selectModel[order].setAttribute('data-hash', modelHash);\n document.dispatchEvent(loadModelEvent);\n resetSelectors();\n}",
"function appendModel(url, model, done){\n\t\tvar list = utils.flatten_tree(JSON.parse(JSON.stringify(model)))\n\n\t\tvar errormodel = null\n\n\t\tlist = list.filter(function(model){\n\t\t\tif(!model._digger.path || !model._digger.inode){\n\t\t\t\terrormodel = model;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true\n\t\t})\n\n\t\tif(errormodel){\n\t\t\treturn done('no path or inode in level-append: ' + JSON.stringify(model))\n\t\t}\n\n\t\tvar batch = list.map(function(model){\n\t\t\treturn {\n\t\t\t\ttype:'put',\n\t\t\t\tkey:model._digger.path + '/' + model._digger.inode,\n\t\t\t\tvalue:model\n\t\t\t}\n\t\t})\n\n\t\ttree.batch(batch, function(err){\n\t\t\tif(err) return done(err)\n\t\t\tdone(null, model)\n\t\t})\n\t}",
"function addFile(filepath)\r\n{\r\n var tbl = document.getElementById('myfilebody');\r\n\r\n if ((tbl.rows.length == 1) && (tbl.rows[0].getAttribute(\"id\") == \"nofile\")) {\r\n tbl.deleteRow(0);\r\n }\r\n\r\n var lastRow = tbl.rows.length;\r\n\r\n var box1 = document.getElementById('lineBox1');\r\n var box2 = document.getElementById('lineBox2');\r\n var revBox = document.getElementById('fileRevVal');\r\n\r\n var saveLine = filepath + \",\" + revBox.value + \",\" + box1.value + \",\" + box2.value;\r\n\r\n if(document.getElementById(saveLine + 'id') != null) {\r\n alert(\"Specified combination of filename, revision, and line numbers is already included in the file list.\");\r\n return;\r\n }\r\n\r\n var row = tbl.insertRow(lastRow);\r\n\r\n var files = document.getElementById('FilesSelected');\r\n files.setAttribute('value', files.value + saveLine + \"#\");\r\n\r\n //Create the entry in the actual table in the page\r\n\r\n row.id = saveLine + 'id';\r\n var cellLeft = row.insertCell(0);\r\n cellLeft.innerHTML = \"<\" + \"a href=\\\"javascript:removefile('\" + saveLine + \"')\\\">\" + filepath + \"</a>\";\r\n cellLeft.setAttribute('value', saveLine);\r\n row.appendChild(cellLeft);\r\n cellLeft = row.insertCell(1);\r\n cellLeft.innerHTML = box1.value;\r\n row.appendChild(cellLeft);\r\n cellLeft = row.insertCell(2);\r\n cellLeft.innerHTML = box2.value;\r\n row.appendChild(cellLeft);\r\n cellLeft = row.insertCell(3);\r\n cellLeft.innerHTML = revBox.value;\r\n row.appendChild(cellLeft);\r\n\r\n colorTable('myfilebody');\r\n}",
"function inputChange(e) {\n for(var i=0;i<e.target.files.length;i++){\n model.addItem(e.target.files[i]);\n }\n previewService.previewFiles();\n }",
"function addRow(event) {\n\n var parent;\n var newRow;\n //if event is null just add row to last line\n\tif(event == null) { \n parent = $(\"ol#card_list li:last\");\n \n\t}\n else {\n parent = $(event.target).parent();\n // Get the parent of the element invoking function\n if($(parent).length < 1) {\n return;\n }\n\n // Find <li> element\n while($(parent)[0].tagName.toLowerCase() != \"li\") {\n parent = $(parent).parent();\n }\n \n \n \n }\n \n // Clone this parent row\n newRow = parent.clone();\n \n // Call changeRowNumbering to set attributes of newRow\n\tvar isIncreasing = true;\n\tchangeRowNumbering(newRow, isIncreasing, true);\n\n // Remove event handler\n $(\"ol#card_list li:last input:last\").unbind(\"blur\");\n\n\t// Prepend row to bottom\n //skip hide if event is null because this breaks the CSV upload\n if(event != null){\n newRow.hide();\n }\n newRow.insertAfter(parent);\n\n // Run fade effect\n newRow.fadeIn(\"fast\");\n \n \n\n // Re-number the rest of the rows \n\tvar increaseNumbering = true;\n\trenumberRemainingRows(newRow, increaseNumbering);\n\n // Change focus to new row added\n var inputToFocus = newRow.find(\"input:first\");\n inputToFocus.focus();\n\n // Add +/- event handlers to plus/minus buttons\n $(newRow).find(\"div.plus\").click(function(event) { addRow(event); });\n $(newRow).find(\"div.minus\").click(function(event) { subtractRow(event); });\n\n // Add event handler to last input box\n $(\"ol#card_list li:last input:last\").blur(function(event) { addRow(event); });\n \n\n}",
"function appendNewFileInput(element){\n\n //store last element the new one gets appended after this one\n var lastElement = $('.image-upload').last();\n\n //clone it so you can append a new one\n var clone = lastElement.clone();\n\n //get the last file input\n var newFileInput = clone.children()[1];\n\n //reset the value so it's an empty file input\n $(newFileInput).get(0).value = \"\";\n $(newFileInput).attr('class', 'image[]')\n //insert the clone after the last file input\n clone.insertAfter(lastElement);\n\n //attach onchange handler to the new input.\n attachOnChangeHandler(newFileInput);\n}",
"function addFieldRow(e) {\n e.stopPropagation();\n var $ul = getUl(this)\n , id = $ul.attr('id')\n , $tgl = getToggleField($ul);\n $ul.append(getTemplate(id));\n focusInput($ul);\n if (!isChecked($tgl)) {\n setToggleField($(this), true);\n $ul.addClass('visible');\n }\n render();\n}",
"function AddAttachmentRow() {\n var rows = \"\";\n var a = $('#tblAttachment tr:last td:nth-child(1)').text();\n if (a == \"\") {\n count++;\n rows = \"<tr class='data-contact-person2'>\"\n + \"<td tabindex='10' style='display:none;'> \" + count + \"</td>\"\n + \"<td>\"\n + \"<div class='row' style='margin-top: 10px'>\"\n\n + \" <div class='col-lg-10 col-md-10 col-sm-10'>\"\n + \"<div class='form-group'>\"\n + \"<label class='control-label col-lg-3 col-md-3 col-sm-3'>Upload Attchment<label style='color: red;'>*</label></label>\"\n + \"<div class='col-lg-4 col-md-4 col-sm-4'>\"\n + \"<input type='text' placeholder='Enter Document Name' class='DocumentName form-control' name='req' id='txtDocumentName' />\"\n + \"</div>\"\n + \"<div class='col-lg-5 col-md-5 col-sm-5'>\"\n + \"<input type='file' class='form-control' name='file[]' id=\" + count + \" multiple='multiple' onchange='Attachments(this,\" + count + \")' />\"\n + \"<label style='color: lightgray; font-weight: normal;'>only pdf/jpg/jpeg/gif/bmp format</label>\"\n + \"<input type='hidden' id='PhotoSource\" + count + \"' value='' class='PhotoSource'/>\"\n + \"<input type='hidden' id='PhotoFileName\" + count + \"' value='' class='PhotoFileName' />\"\n + \"</div>\"\n + \"</div>\"\n + \"</div>\"\n + \"<div class='col-lg-1 col-md-1 col-sm-1'>\"\n + \"<a id='NewAttach'>\"\n + \"<i class='ace-icon fa fa-plus fa-2x bigger-110 icon-only'></i>\"\n + \"</a>\"\n + \"</div>\"\n + \"</div>\"\n + \"</td>\"\n + \"</tr>\"\n\n $(\"#tblAttachment\").append(rows);\n }\n else if (count == a) {\n count++;\n\n rows = \"<tr class='data-contact-person2'>\"\n + \"<td tabindex='10' style='display:none;'> \" + count + \"</td>\"\n + \"<td>\"\n + \"<div class='row' style='margin-top: 10px'>\"\n + \" <div class='col-lg-10 col-md-10 col-sm-10'>\"\n + \"<div class='form-group'>\"\n + \"<label class='control-label col-lg-3 col-md-3 col-sm-3'>Upload Attchment<label style='color: red;'>*</label></label>\"\n + \"<div class='col-lg-4 col-md-4 col-sm-4'>\"\n + \"<input type='text' placeholder='Enter Document Name' class='DocumentName form-control' name='req' id='txtDocumentName' />\"\n + \"</div>\"\n + \"<div class='col-lg-5 col-md-5 col-sm-5'>\"\n + \"<input type='file' class='form-control' name='file[]' id=\" + count + \" multiple='multiple' onchange='Attachments(this,\" + count + \")' />\"\n + \"<label style='color: lightgray; font-weight: normal;'>only pdf/jpg/jpeg/gif/bmp format</label>\"\n + \"<input type='hidden' id='PhotoSource\" + count + \"' value='' class='PhotoSource'/>\"\n + \"<input type='hidden' id='PhotoFileName\" + count + \"' value='' class='PhotoFileName' />\"\n + \"</div>\"\n + \"</div>\"\n + \"</div>\"\n + \"<div class='col-lg-1 col-md-1 col-sm-1'>\"\n + \"<a id='btndeleteattach'><i class='ace-icon fa fa-trash-o red icon-only bigger-130'></i></a>\"\n + \"</div>\"\n + \"</div>\"\n + \"</td>\"\n + \"</tr>\"\n $(\"#tblAttachment\").append(rows);\n }\n else {\n\n a++;\n count = a;\n rows = \"<tr class='data-contact-person2'>\"\n + \"<td tabindex='10' style='display:none;'> \" + count + \"</td>\"\n + \"<td>\"\n + \"<div class='row' style='margin-top: 10px'>\"\n + \" <div class='col-lg-10 col-md-10 col-sm-10'>\"\n + \"<div class='form-group'>\"\n + \"<label class='control-label col-lg-3 col-md-3 col-sm-3'>Upload Attchment<label style='color: red;'>*</label></label>\"\n + \"<div class='col-lg-4 col-md-4 col-sm-4'>\"\n + \"<input type='text' placeholder='Enter Document Name' class='DocumentName form-control' name='req' id='txtDocumentName' />\"\n + \"</div>\"\n + \"<div class='col-lg-5 col-md-5 col-sm-5'>\"\n + \"<input type='file' class='form-control' name='file[]' id=\" + count + \" multiple='multiple' onchange='Attachments(this,\" + count + \")' />\"\n + \"<label style='color: lightgray; font-weight: normal;'>only pdf/jpg/jpeg/gif/bmp format</label>\"\n + \"<input type='hidden' id='PhotoSource\" + count + \"' value='' class='PhotoSource'/>\"\n + \"<input type='hidden' id='PhotoFileName\" + count + \"' value='' class='PhotoFileName' />\"\n + \"</div>\"\n + \"</div>\"\n + \"</div>\"\n + \"<div class='col-lg-1 col-md-1 col-sm-1'>\"\n + \"<a id='btndeleteattach'><i class='ace-icon fa fa-trash-o red icon-only bigger-130'></i></a>\"\n + \"</div>\"\n + \"</div>\"\n + \"</td>\"\n + \"</tr>\"\n $(\"#tblAttachment\").append(rows);\n }\n\n\n\n\n\n}",
"function AddAttachmentRow() {\n var rows = \"\";\n var a = $('#tblAttachment tr:last td:nth-child(1)').text();\n if (a == \"\") {\n count++;\n rows = \"<tr class='data-contact-person2'>\"\n + \"<td tabindex='10' style='display:none;'> \" + count + \"</td>\"\n + \"<td>\"\n + \"<div class='row' style='margin-top: 10px'>\"\n\n + \" <div class='col-lg-10 col-md-10 col-sm-10'>\"\n + \"<div class='form-group'>\"\n + \"<label class='control-label col-lg-3 col-md-3 col-sm-3' style='color: #337ab7;'>Upload Attchment</label>\"\n + \"<div class='col-lg-4 col-md-4 col-sm-4'>\"\n + \"<input type='text' placeholder='Enter Document Name' class='DocumentName form-control' name='req' id='txtDocumentName' />\"\n + \"</div>\"\n + \"<div class='col-lg-5 col-md-5 col-sm-5'>\"\n + \"<input type='file' class='form-control' name='file[]' id=\" + count + \" multiple='multiple' onchange='Attachments(this,\" + count + \")' />\"\n + \"<label style='color: lightgray; font-weight: normal;'>only pdf/jpg/jpeg/gif/bmp format</label>\"\n + \"<input type='hidden' id='PhotoSource\" + count + \"' value='' class='PhotoSource'/>\"\n + \"<input type='hidden' id='PhotoFileName\" + count + \"' value='' class='PhotoFileName' />\"\n + \"</div>\"\n + \"</div>\"\n + \"</div>\"\n + \"<div class='col-lg-1 col-md-1 col-sm-1'>\"\n + \"<a id='NewAttach'>\"\n + \"<i class='ace-icon fa fa-plus fa-2x bigger-110 icon-only'></i>\"\n + \"</a>\"\n + \"</div>\"\n + \"</div>\"\n + \"</td>\"\n + \"</tr>\"\n\n $(\"#tblAttachment\").append(rows);\n }\n else if (count == a) {\n count++;\n\n rows = \"<tr class='data-contact-person2'>\"\n + \"<td tabindex='10' style='display:none;'> \" + count + \"</td>\"\n + \"<td>\"\n + \"<div class='row' style='margin-top: 10px'>\"\n + \" <div class='col-lg-10 col-md-10 col-sm-10'>\"\n + \"<div class='form-group'>\"\n + \"<label class='control-label col-lg-3 col-md-3 col-sm-3'>Upload Attchment</label>\"\n + \"<div class='col-lg-4 col-md-4 col-sm-4'>\"\n + \"<input type='text' placeholder='Enter Document Name' class='DocumentName form-control' name='req' id='txtDocumentName' />\"\n + \"</div>\"\n + \"<div class='col-lg-5 col-md-5 col-sm-5'>\"\n + \"<input type='file' class='form-control' name='file[]' id=\" + count + \" multiple='multiple' onchange='Attachments(this,\" + count + \")' />\"\n + \"<label style='color: lightgray; font-weight: normal;'>only pdf/jpg/jpeg/gif/bmp format</label>\"\n + \"<input type='hidden' id='PhotoSource\" + count + \"' value='' class='PhotoSource'/>\"\n + \"<input type='hidden' id='PhotoFileName\" + count + \"' value='' class='PhotoFileName' />\"\n + \"</div>\"\n + \"</div>\"\n + \"</div>\"\n + \"<div class='col-lg-1 col-md-1 col-sm-1'>\"\n + \"<a id='btndeleteattach'><i class='ace-icon fa fa-trash-o red icon-only bigger-130'></i></a>\"\n + \"</div>\"\n + \"</div>\"\n + \"</td>\"\n + \"</tr>\"\n $(\"#tblAttachment\").append(rows);\n }\n else {\n\n a++;\n count = a;\n rows = \"<tr class='data-contact-person2'>\"\n + \"<td tabindex='10' style='display:none;'> \" + count + \"</td>\"\n + \"<td>\"\n + \"<div class='row' style='margin-top: 10px'>\"\n + \" <div class='col-lg-10 col-md-10 col-sm-10'>\"\n + \"<div class='form-group'>\"\n + \"<label class='control-label col-lg-3 col-md-3 col-sm-3'>Upload Attchment</label>\"\n + \"<div class='col-lg-4 col-md-4 col-sm-4'>\"\n + \"<input type='text' placeholder='Enter Document Name' class='DocumentName form-control' name='req' id='txtDocumentName' />\"\n + \"</div>\"\n + \"<div class='col-lg-5 col-md-5 col-sm-5'>\"\n + \"<input type='file' class='form-control' name='file[]' id=\" + count + \" multiple='multiple' onchange='Attachments(this,\" + count + \")' />\"\n + \"<label style='color: lightgray; font-weight: normal;'>only pdf/jpg/jpeg/gif/bmp format</label>\"\n + \"<input type='hidden' id='PhotoSource\" + count + \"' value='' class='PhotoSource'/>\"\n + \"<input type='hidden' id='PhotoFileName\" + count + \"' value='' class='PhotoFileName' />\"\n + \"</div>\"\n + \"</div>\"\n + \"</div>\"\n + \"<div class='col-lg-1 col-md-1 col-sm-1'>\"\n + \"<a id='btndeleteattach'><i class='ace-icon fa fa-trash-o red icon-only bigger-130'></i></a>\"\n + \"</div>\"\n + \"</div>\"\n + \"</td>\"\n + \"</tr>\"\n $(\"#tblAttachment\").append(rows);\n }\n}",
"addFileX(event) {\n let aFile = event.target.files[0];\n if (aFile.type === \"text/plain\"){\n this.files[0] = aFile;\n } \n }",
"addFile()\n\t{\n\t\t// Obtenemos las filas\n\t\tthis.controlFilas++; // Aumentamos el control\n\n\t\t// Obtenemos la tabla\n\t\tlet table = document.getElementById('dato-agrupado');\n\t\t// Insertamos una fila en la penultima posicion\n\t\tlet row = table.insertRow(parseInt(table.rows.length) - 1);\n\t\t// Agregamos la primer columna\n\t\tlet cell1 = row.insertCell(0);\n\t\tlet text = document.createTextNode(this.letter[this.controlFilas - 1]);\n\t\tcell1.appendChild(text);\n\t\tlet cell2 = row.insertCell(1);\n\t\tcell2.innerHTML = \"De <input type='text' id='\"+this.controlFilas+\"1' class='agrupado' placeholder='Valor' onkeyup=datoAgrupado.moveColumn(event)>A<input type='text' id='\"+this.controlFilas+\"2' class='agrupado' onkeyup=datoAgrupado.moveColumn(event) placeholder='Valor'>\";\n\t\tlet cell3 = row.insertCell(2);\n\t\tcell3.setAttribute('id', this.controlFilas+'f');\n\t\tlet cell4 = row.insertCell(3);\n\t\tcell4.innerHTML = \"<input type='text' id='\"+this.controlFilas+\"3' onkeyup=datoAgrupado.keyAgrupado(event) placeholder='Valor'>\";\n\t\t\n\t\t// Hacemos focus\n\t\tdocument.getElementById(this.controlFilas + '1').focus();\n\t}",
"function addFile() {\n document.getElementById(\"chronovisor-converter-container\").appendChild(fileTemplate.cloneNode(true));\n maps.push(null);\n files.push(null);\n data.push(null);\n og_data.push(null);\n }",
"function addItem(evt){\n var self = evt.target;\n var template = dom.closest(self, 'wb-row');\n // we want to clone the row and it's children, but not their contents\n var newItem = template.cloneNode(true);\n template.parentElement.insertBefore(newItem, template.nextElementSibling);\n}",
"function addFile()\r\n{\r\n\tvar name = \"file-\" + maxID++;\r\n\t\r\n\tvar input = $('<input type=\"file\">')\r\n\t\t.attr('name', name)\r\n\t\t.attr('id', name);\r\n\t\r\n\tvar close = $('<a>')\r\n\t\t.addClass('close')\r\n\t\t.attr('href', 'javascript: removeFile(\"' + name + '\")')\r\n\t\t.html('×');\r\n\t\t\r\n\tvar status = $('<span>')\r\n\t\t.addClass('file-status');\r\n\t\t\r\n\tvar inputDiv = $('<div>')\r\n\t\t.addClass('file-item')\r\n\t\t.append(input)\r\n\t\t.append(status)\r\n\t\t.append(close);\r\n\t\r\n\tconsole.log(\"Adding file input\", input);\r\n\t\r\n\t$('#file-list').append(inputDiv);\r\n\t\r\n\t// Enable the upload button\r\n\t$('#submit-button').removeAttr('disabled');\r\n}",
"function addToModels(file){\n\tvar model = JSON.parse(fse.readFileSync(file, 'utf8'));\t\n\tconsole.log(\"Model Created\" + model.name);\n\tu.enhance(model);\n\tapp.models.push(model);\t\n}",
"function newfile() {\n let newFile = document.querySelector(\".add-file\");\n\n fileDiv = document.createElement(\"div\");\n fileDiv.classList.add(`file-div-${fileCounter}`);\n\n buttonRemoveFile = document.createElement(\"button\");\n buttonRemoveFile.classList.add(`file-div-${fileCounter}`);\n buttonRemoveFile.setAttribute(\"type\", \"button\");\n buttonRemoveFile.innerHTML = \"Remove File -\";\n\n labelFileComplete = document.createElement(\"label\");\n labelFileComplete.setAttribute(\"for\", \"completed-file\");\n labelFileComplete.innerHTML = \"Completed\"\n fileCompleteRadio = document.createElement(\"input\");\n fileCompleteRadio.setAttribute(\"type\", \"checkbox\");\n fileCompleteRadio.setAttribute(\"id\", \"completed-file\");\n fileCompleteRadio.setAttribute(\"name\", `file-name-${fileCounter}`);\n fileCompleteRadio.setAttribute(\"value\", \"completed\");\n fileCompleteRadio.classList.add(\"create-checkbox\");\n\n labelFileName = document.createElement(\"label\");\n labelFileName.setAttribute(\"for\", \"file-name\");\n labelFileName.classList.add(`label-filename`);\n labelFileName.innerHTML = \"File name: \";\n \n inputFileName = document.createElement(\"input\");\n inputFileName.setAttribute(\"type\", \"text\");\n inputFileName.setAttribute(\"id\", `file-name-${fileCounter}`);\n inputFileName.setAttribute(\"name\", `file-name-${fileCounter}`);\n inputFileName.setAttribute(\"size\", \"50.5\");\n\n labelFileDesc = document.createElement(\"label\");\n labelFileDesc.setAttribute(\"for\", \"file-desc\");\n labelFileDesc.classList.add(\"label-filedesc\");\n labelFileDesc.innerHTML = \"File Description: \";\n\n inputFileDesc = document.createElement(\"textarea\");\n inputFileDesc.setAttribute(\"id\", `file-desc`);\n inputFileDesc.setAttribute(\"name\", `file-name-${fileCounter}`);\n\n newBreak = document.createElement(\"br\");\n oneMoreBreak = document.createElement(\"br\");\n secMoreBreak = document.createElement(\"br\");\n\n inputFileName.append(newBreak);\n\n divAddClass = document.createElement(\"div\");\n divAddClass.classList.add(`add-class-${fileCounter}`, \"add-class\");\n \n buttonAddClass = document.createElement(\"button\");\n buttonAddClass.classList.add(`${fileCounter}`);\n buttonAddClass.classList.add(`add-class-button`);\n buttonAddClass.setAttribute(\"type\", \"button\");\n buttonAddClass.innerHTML = \"Add Class +\";\n\n divAddClass.append(buttonAddClass);\n divAddClass.append(newBreak);\n fileDiv.append(labelFileName);\n fileDiv.append(inputFileName);\n fileDiv.append(fileCompleteRadio);\n fileDiv.append(labelFileComplete);\n fileDiv.append(buttonRemoveFile);\n fileDiv.append(secMoreBreak);\n fileDiv.append(labelFileDesc);\n fileDiv.append(oneMoreBreak);\n fileDiv.append(inputFileDesc);\n fileDiv.append(divAddClass);\n fileDiv.append(newBreak);\n newFile.append(fileDiv);\n fileCounter = fileCounter + 1;\n}",
"function handleFiles () {\n document.getElementById(\"carnets\").innerHTML = '';\n filesData = this.files;\n if (filesData.length > 0){\n Array.from(filesData).forEach( file => {\n addItemTable(file.name);\n })\n }\n \n}",
"_controlUploadFile(event) {\n let file = event.target.files[0];\n let fileName = file.name;\n let fileType = fileName.split(\".\")[fileName.split(\".\").length - 1];\n\n if(this.options.tableRender) {\n let table = this._componentRoot.querySelector('[data-component=\"table-custom\"]');\n\n if(table) {\n this._inputData = [];\n table.parentNode.removeChild(table);\n }\n\n this.options.tableRender = false;\n }\n\n let chooseFields = this._componentRoot.querySelector(\"#chooseFields\");\n\n if (chooseFields) {\n chooseFields.parentNode.removeChild(chooseFields);\n }\n\n if(fileType !== 'csv') {\n\n noty({\n text: 'Файл ' + fileName + ' некорректный, выберите корректный файл, формата csv.',\n type: 'error',\n timeout: 3000\n });\n\n return;\n\n } else {\n\n noty({\n text: 'Был выбран файл ' + fileName + '.',\n type: 'success',\n timeout: 3000\n });\n }\n\n this._parseCSV(event, file);\n }",
"addRowFilter() {\n const selectedFileSourceDefaults = this.get('selectedFileSourceDefaults');\n this.send('addPolicyFileSource', selectedFileSourceDefaults);\n scheduleOnce('afterRender', this, '_scrollToAddSelectedFileTypeBtn');\n }",
"function fileAdded(file) {\n // Prepare the temp file data for file list\n var uploadingFile = {\n id : file.uniqueIdentifier,\n file : file,\n type : '',\n owner : 'Emily Bennett',\n size : '',\n modified : moment().format('MMMM D, YYYY'),\n opened : '',\n created : moment().format('MMMM D, YYYY'),\n extention: '',\n location : 'Insurance Manuals > Medical',\n offline : false,\n preview : 'assets/images/etc/sample-file-preview.jpg'\n };\n\n // Append it to the file list\n vm.files.push(uploadingFile);\n }",
"function addNewFile(fileProps, scrollToBottom = false) {\n const newFile = newStudyFileObj(serverState.study._id.$oid)\n Object.assign(newFile, fileProps)\n\n setFormState(prevFormState => {\n const newState = _cloneDeep(prevFormState)\n newState.files.push(newFile)\n return newState\n })\n if (scrollToBottom) {\n window.setTimeout(() => scroll({ top: document.body.scrollHeight, behavior: 'smooth' }), 100)\n }\n }",
"function add(){\n\n \tvar progress = Math.floor((i/(parsed.length-1))*100);\n \ttinybudget.viewmodel.csvLoadBarProgress(progress);\n\n \t//console.log(progress);\n \tvar gluedDate = parsed[i].month +\"/\"+ parsed[i].day +\"/\"+ parsed[i].year;\n // loadedFromServer set to True, prevents auto loading to server\n var row = new rowitem(true,parsed[i].desc,parsed[i].amt,gluedDate,parsed[i].cat,parsed[i].itemid,null,null);\n tinybudget.viewmodel.userItems.push(row);\n\n\n if (i >= parsed.length-1){\n \treturn;\n } else if (parsed.length - i == 2){\n // if there is 1 item left in parsed to add to the viewmodel, enable highcharts to render when triggered\n tinybudget.viewmodel.sorting = false;\n i++;\n \tsetTimeout(add,100);\n }else {\n \ti++;\n \tsetTimeout(add,100);\n }\n }",
"function add(){\n\n \tvar progress = Math.floor((i/(parsed.length-1))*100);\n \ttinybudget.viewmodel.csvLoadBarProgress(progress);\n\n \t//console.log(progress);\n \tvar gluedDate = parsed[i].month +\"/\"+ parsed[i].day +\"/\"+ parsed[i].year;\n // loadedFromServer set to True, prevents auto loading to server\n var row = new rowitem(true,parsed[i].desc,parsed[i].amt,gluedDate,parsed[i].cat,parsed[i].itemid,null,null);\n tinybudget.viewmodel.userItems.push(row);\n\n\n if (i >= parsed.length-1){\n \treturn;\n } else if (parsed.length - i == 2){\n // if there is 1 item left in parsed to add to the viewmodel, enable highcharts to render when triggered\n tinybudget.viewmodel.sorting = false;\n i++;\n \tsetTimeout(add,100);\n }else {\n \ti++;\n \tsetTimeout(add,100);\n }\n }",
"_updateContentsModel(model) {\n const newModel = {\n path: model.path,\n name: model.name,\n type: model.type,\n content: undefined,\n writable: model.writable,\n created: model.created,\n last_modified: model.last_modified,\n mimetype: model.mimetype,\n format: model.format\n };\n const mod = this._contentsModel ? this._contentsModel.last_modified : null;\n this._contentsModel = newModel;\n this._ycontext.set('last_modified', newModel.last_modified);\n if (!mod || newModel.last_modified !== mod) {\n this._fileChanged.emit(newModel);\n }\n }",
"function add_field_file() \r\n{\r\n\tif ( limit <= 4) \r\n\t{\r\n\t\t\tvar field = '<div class=\"row\">'+\r\n\t\t'\t \t\t<div class=\"col-md-3\">'+\r\n\t\t'\t \t\t\t<div class=\"form-group\">'+\r\n\t\t'\t \t\t\t\t<label for=\"\">Calsificación del documento</label>'+\r\n\t\t'\t \t\t\t\t<select name=\"clasificacion_doc\" id=\"clasificacion_doc\" class=\"form-control\" required>'+\r\n\t\t'\t \t\t\t\t\t<option value=\"\">...</option>'+\r\n '<option value=\"1\">Lista de equipos retirados</option>'+\r\n\t\t'\t \t\t\t\t</select>'+\r\n\t\t'\t \t\t\t</div>'+\r\n\t\t'\t \t\t</div>'+\r\n\t\t'\t \t\t<div class=\"col-md-9\">'+\r\n\t\t'\t \t\t\t<div class=\"form-group\">'+\r\n\t\t'\t \t\t\t\t<label for=\"\">Buscar el documento</label>'+\r\n\t\t'\t \t\t\t\t<input type=\"file\" name=\"archivo[]\" value=\"\" class=\"form-control\">'+\r\n\t\t'\t \t\t\t</div>'+\r\n\t\t'\t \t\t</div>'+\r\n\t\t'\t \t</div>';\r\n\t\t\t$('#archivos').append(field);\r\n\t\t\twindow.location.href= '#archivos';\r\n\t\t\tlimit++;\r\n\t}\r\n\telse\r\n\t{\r\n\t\talert('El limite de cargar de documentos a llegado a su limite');\r\n\t}\r\n\treturn false;\r\n}"
] | [
"0.64594394",
"0.62547046",
"0.6169036",
"0.5937158",
"0.5894436",
"0.58939934",
"0.58461946",
"0.5761837",
"0.5725706",
"0.56414187",
"0.5603139",
"0.5497808",
"0.54590863",
"0.54520863",
"0.5437351",
"0.5404809",
"0.54003686",
"0.5393868",
"0.5362818",
"0.5359372",
"0.5340681",
"0.53396934",
"0.5328735",
"0.5316693",
"0.5311318",
"0.5304402",
"0.528846",
"0.528846",
"0.5282117",
"0.527737"
] | 0.6369479 | 1 |
Appends empty text field to the form. This changes `model`. | addText() {
this.addCustom('type', {
inputLabel: 'Property value'
});
const index = this.model.length - 1;
const item = this.model[index];
item.schema.isFile = false;
item.schema.inputType = 'text';
/* istanbul ignore else */
if (hasFormDataSupport) {
item.contentType = '';
}
this.requestUpdate();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function makingInputEmpty(input){\n input.value = \"\";\n}",
"getItemEmpty() {\n this.elements.form.querySelector('.field-title').value = '';\n this.elements.form.querySelector('.field-price').value = '';\n }",
"function emptyField(event){\n\t\tvar thisObj = $(this);\n\t\tvar currVal=thisObj.val();\n\t\t\n\t\tif (currVal == thisObj.data(\"defaultValue\")){\n\t\t\tthisObj.val(\"\");\n\t\t}\n\t}",
"function emptyForm(){\n\t$('input').val('');\n\t$('textarea').val('');\n\t//TODO\n}",
"clear() {\n this.value = \"\";\n }",
"function emptyinput(input){\n input.value = '';\n}",
"function clearFields() {\n document.getElementById(\"text-field\").value = \"\";\n }",
"function SFTextModel(text) {\n this._text = (text) ? text : '';\n}",
"clearFields(){\n this.titleInput.value = '';\n this.bodyInput.value = '';\n }",
"function clearAddFormFields () {\n $('#song-name').val('')\n $('#artist-name').val('')\n }",
"function render(){\n\t\t$element.find('input').val('')\n\t}",
"set emptyText(aValue) {\n this._emptyText = aValue;\n\n // Apply the emptyText attribute right now if there are no child items.\n if (!this._itemsByElement.size) {\n this._widget.setAttribute(\"emptyText\", aValue);\n }\n }",
"function emptyphonemodelform(){\n //praznimo formu za edit modela tj za unos novog modela\n $('#modelname').val('');\n $('#year').val('');\n $('#link').val('');\n $('#smart').val('1');\n $('#ts').val('1');\n $('#showimages1').attr('src', homeurl+'/images/phonesilhouette.png');\n $('#dodatnibtni').html('');//ukklanjamo dodatne btn-e tj btn za Cancel i Obrisi za brisanje modela\n $('#phoneimg').val(null);//ako je uploadovana slika brisemo je\n //formu iz forme za update modela ponovo pretvaramo u formu za dodavanje novog modela\n $('.formazaupdatemodela').addClass('formazanovimodel').removeClass('formazaupdatemodela');\n $('.formamodelpanelheading').html('Dodaj Modele Telefona');\n}",
"function clean() {\r\n document.form.textview.value = \"\";\r\n}",
"function clearText(field){\n\n if (field.defaultValue == field.value) field.value = '';\n else if (field.value == '') field.value = field.defaultValue;\n\n}",
"static clearField(){\n document.querySelector('#title').value = '';\n document.querySelector('#author').value = '';\n document.querySelector('#isbn').value = '';\n }",
"function emptyField(event){\n\t\tvar thisObj = $(this);\n\t\tvar currVal=thisObj.val();\n\t\tif (currVal == thisObj.data(\"orgVal\")){\n\t\t\tthisObj.val(\"\");\n\t\t\tthisObj.parent().removeClass(\"g_search_default\");\n\t\t}\n\t}",
"function clearTextField() {\r\n\r\n\t/* Set default to 0 */\r\n\t$(\"#cargo_id\").val(\"0\");\r\n\t$(\"#cargo_driver\").val(null);\r\n\t$(\"#cargo_vehicletype\").val(null);\r\n\t$(\"#truck_plate_number\").val(null);\r\n\t$(\"#cargo_company\").val(null);\r\n\r\n\t/* Clear error validation message */\r\n\t$(\"#error\").empty();\r\n\r\n}",
"clearInputField() {\n this.inputField.value = '';\n }",
"clear () {\n this.setValue('');\n }",
"function form_raz(txt, initial_value) {\n\n if(txt.value == initial_value) txt.value = '';\n \n }",
"function car_model_clear_and_disable() {\n if(document.getElementById(\"car_make_input\").value === \"\"){\n document.getElementById(\"car_model_input\").value = \"\";\n document.getElementById(\"car_model_input\").disabled = true;\n }\n }",
"function addTextField(first) {\n var remove = first ? '</div>' : '<a href=\"#\" class=\"remove_field\">Remove field</a></div>';\n var emptyField = '<div><input class=\"tool_name\" name=\"tool[name][]\" placeholder=\"Tool Name\" type=\"text\">';\n emptyField = emptyField + remove;\n $(\".input_field form\").append(emptyField);\n}",
"function emptyBoxes(){\n inputBox.val(\"\")\n }",
"function clearField() {\n let emptyField = temp.value = '';\n let emptyResult = result.textContent = '';\n }",
"function emptyFields() {\n $(\"#name\").val(\"\");\n $(\"#profile-input\").val(\"\");\n $(\"#email-input\").val(\"\");\n $(\"#password-input\").val(\"\");\n $(\"#number-input\").val(\"\");\n $(\"#fav-food\").val(\"\");\n $(\"#event-types\").val(\"\");\n $(\"#zipcode\").val(\"\");\n $(\"#radius\").val(\"\");\n }",
"clearNewTodo() {\n\t\tthis.$newTodo.value = '';\n\t}",
"function clearInputField() {\n mainInputField.value = \"\";\n}",
"function clearText(thefield) {\r\n if (thefield.defaultValue==thefield.value) { thefield.value = \"\" }\r\n}",
"function ClearFields() {\r\n self.model.code = \"\";\r\n self.model.component = \"\";\r\n }"
] | [
"0.6011149",
"0.599558",
"0.5973112",
"0.5938429",
"0.58705604",
"0.5869868",
"0.5852022",
"0.58518314",
"0.58482265",
"0.583491",
"0.5822847",
"0.58139586",
"0.5799688",
"0.57825714",
"0.57810926",
"0.575355",
"0.57521373",
"0.5744637",
"0.5742645",
"0.5734894",
"0.5734518",
"0.57120645",
"0.5699345",
"0.5691258",
"0.56762815",
"0.5671296",
"0.56624067",
"0.5642942",
"0.5639233",
"0.5623847"
] | 0.6622295 | 0 |
This function represents the starting point of the program, leading straight to entering meta data and initializes the SVG output. | function start(){
var p = document.getElementById("input");
p.innerHTML = metaDataForm;
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function start() {\n const logoText = figlet.textSync(\"Employee Database Tracker!\", 'Standard');\n console.log(logoText);\n loadMainPrompt();\n}",
"function doInitialization() {\n\t\tvar svg = \"\";\n\n\t\tif (typeof theSvgElement === \"undefined\") {\n\t\t\t// Add event to body: each time a key is hit -> launch function 'doUpdate'\n\t\t\tdocument.body.addEventListener(\"keyup\", doUpdate, false);\n\n\t\t\t// Open new window for drawing\n\t\t\tvar myWindow = window.open('', 'Drawing', \"width=\" + WINDOWS_WIDTH + \", height=450\", '');\n\t\t\tmyWindow.document.open();\n\t\t\tmyWindow.document.writeln('<h2>Drawing</h2>');\n\t\t\tmyWindow.document.writeln('<div id=\\\"drawing1\\\" style=\\\"width: 600px; height: 400px; border:1px solid black; \\\"></div>');\n\t\t\tmyDoc = myWindow.document;\n\t\t\tmyWindow.document.close();\n\n\n\t\t\tsvg = \"<svg style=\\\"display: inline; width: inherit; min-width: inherit; max-width: inherit; height: inherit; min-height: inherit; max-height: inherit;\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\" version=\\\"1.1\\\">\";\n\n\t\t\t// Add basic information about SVG drawing\n\t\t\tsvg += \"<title>\" + \"My drawing\" + \"</title>\";\n\t\t\tsvg += \"<desc>Write drawing description here...</desc>\";\n\n\t\t\tsvg += `<defs><style type=\"text/css\">\n\t\t\t\tpath.basicshape {\n\t\t\t\t\tstroke-width: 2;\n\t\t\t\t\tstroke: black;\n\t\t\t\t}\n\t\t\t\tline.dim {\n\t\t\t\t\tstroke-width: 1;\n\t\t\t\t}\n\t\t\t\tpath.squeleton {\n\t\t\t\t\tstroke: red;\n\t\t\t\t\tstroke-width: 1;\n\t\t\t\t\tfill: white;\n\t\t\t\t\tfill-opacity: 0.25;\n\t\t\t\t}\n\t\t\t\ttext.squeleton {\n\t\t\t\t\tfill: red;\n\t\t\t\t}\n\t\t\t\tcircle.centerfillet {\n\t\t\t\t\tfill: pink;\n\t\t\t\t\tstroke-width: 0;\n\t\t\t\t}\n\t\t\t\tcircle.origin {\n\t\t\t\t\tfill: blue;\n\t\t\t\t\tstroke-width: 0;\n\t\t\t\t}\n\t\t\t\tcircle.circleptsfilletg {\n\t\t\t\t\tfill: green;\n\t\t\t\t\tstroke-width: 0;\n\t\t\t\t}\n\t\t\t\tcircle.circleptsfillety {\n\t\t\t\t\tfill: yellow;\n\t\t\t\t\tstroke-width: 0;\n\t\t\t\t}\n\t\t\t\t</style></defs>\n\t\t\t\t`;\n\n\t\t\t// Add containers: dimension, origin and lines\n\t\t\tsvg += \"\\n<defs id=\\\"hatchpattern\\\" ></defs>\";\n\t\t\tsvg += \"\\n<g id=\\\"dimension\\\"></g>\";\n\t\t\tsvg += \"\\n<g id=\\\"origin\\\"></g>\";\n\t\t\tsvg += \"\\n</svg>\";\n\n\t\t\t// Draw SVG in MyDoc window\n\t\t\tmyDoc.getElementById(\"drawing1\").innerHTML = svg;\n\t\t\t// catch SVG in theSvgElement variable for further function\n\t\t\ttheSvgElement = myDoc.getElementsByTagName(\"svg\")[0];\n\n\t\t\t// Pattern for Arrow (marker) with default color value\n\t\t\tdoArrowpattern();\n\n\t\t}\n\n\t\t// Start function 'doUpdate' for the first time\n\t\tdoUpdate();\n\t}",
"function init() {\n const logoText = logo({ name: \"Employee Manager\" }).render();\n console.log(logoText);\n // load our prompts\n loadPrompts();\n}",
"function main() {\n // construct svg on the fly\n var gMain = get(\"main\");\n empty(gMain); // RESET\n // handles to SVG\n var gSvg = mk(\"svg\");\n gSvg.style.height = \"380px\";\n gSvg.style.width = \"600px\";\n gSvg.style.cursor = \"default\";\n gMain.appendChild(gSvg);\n var gEdges = mk(\"g\");\n var gNodes = mk(\"g\");\n var gHover = mk(\"g\");\n gSvg.appendChild(gEdges);\n gSvg.appendChild(gHover);\n gSvg.appendChild(gNodes);\n var gLookup = {};\n var gChoices = [];\n var gPerm = random_permutation();\n var gRevealed = false;\n var gReveal = get(\"reveal\");\n var gTurbo = get(\"turbo\");\n var gConfidence = get(\"confidence\");\n var gEquivalence;\n if (globalTricky) {\n gEquivalence = random_tricky_equivalence();\n } else {\n gEquivalence = id_equivalence();\n }\n gConfidence.style.color = \"black\";\n gReveal.disabled = 0;\n gReveal.value = \"Reveal\";\n gTurbo.disabled = false;\n gReveal.onclick = function () { // RESET\n reschedule(0, function () {});\n gNodes.childNodes.map(function (x) {\n x.reveal();\n });\n gSvg.style.cursor = \"pointer\";\n gRevealed = true;\n gReveal.value = \"Reset\";\n gReveal.onclick = main;\n };\n gTurbo.onclick = function () {\n if (gTurbo.checked) {\n globalAuto = true;\n main();\n } else {\n globalAuto = false;\n reschedule(0, main);\n }\n };\n // I need this to run *before* the internal handlers.\n gSvg.addEventListener('click', function () {\n if (gRevealed) {\n main();\n }\n }, true);\n // setup nodes\n var gColors = random_pick(globalColors);\n mapWithKey(globalPoints, function (ptname, pt) {\n var shape = mk(\"circle\");\n shape.setAttribute(\"cx\", pt[0]);\n shape.setAttribute(\"cy\", pt[1]);\n shape.setAttribute(\"r\", 10);\n if (!globalAuto) {\n shape.setAttribute(\"fill\", \"black\");\n } else {\n shape.setAttribute(\"fill\", \"grey\");\n };\n shape.selected = 0;\n // a question of great philosophical importance...\n // should the true color or the permuted color be stored!\n // it's all implementation details, but the user might\n // feel cheated if they look at the source...\n shape.color = gPerm[gColors[gEquivalence[ptname]]];\n shape.reveal = function() {\n if (!shape.revealed) {\n shape.setAttribute(\"fill\", COLORS[shape.color]);\n shape.revealed = true;\n }\n };\n shape.revealed = false;\n gNodes.appendChild(shape);\n gLookup[ptname] = shape;\n });\n // setup edges\n globalDot.map( function(edge) {\n var line = mk(\"line\");\n // make it easier to actually click the line\n var hoverBox = mk(\"line\");\n [line, hoverBox].map( function(x) {\n x.setAttribute(\"x1\", globalPoints[edge[0]][0]);\n x.setAttribute(\"y1\", globalPoints[edge[0]][1]);\n x.setAttribute(\"x2\", globalPoints[edge[1]][0]);\n x.setAttribute(\"y2\", globalPoints[edge[1]][1]);\n });\n if (!globalAuto) {\n line.setAttribute(\"stroke\", \"black\");\n } else {\n line.setAttribute(\"stroke\", \"grey\");\n };\n line.setAttribute(\"stroke-width\", \"1px\");\n hoverBox.setAttribute(\"stroke\", \"rgba(255,255,255,0)\"); // none doesn't work\n hoverBox.setAttribute(\"stroke-width\", \"15px\");\n if (!globalAuto) {\n hoverBox.onmouseover = function () {\n if (!gRevealed) {\n line.setAttribute(\"stroke\", \"cyan\");\n line.setAttribute(\"stroke-width\", \"3px\");\n }\n };\n hoverBox.onmouseout = function () {\n if (!gRevealed) {\n // duplicate\n line.setAttribute(\"stroke\", \"black\");\n line.setAttribute(\"stroke-width\", \"1px\");\n }\n };\n }\n var select = function () {\n if (!gRevealed) {\n gRevealed = true;\n gLookup[edge[0]].reveal();\n gLookup[edge[1]].reveal();\n var makeGray = function () {\n gEdges.childNodes.map( function (x) {\n x.setAttribute(\"stroke\", \"gray\");\n });\n gNodes.childNodes.map( function (x) {\n if (!x.revealed) {\n x.setAttribute(\"fill\", \"gray\");\n }\n });\n };\n globalTrials++;\n if (gLookup[edge[0]].color == gLookup[edge[1]].color) {\n makeGray();\n gSvg.style.cursor = \"pointer\";\n line.setAttribute(\"stroke-width\", \"3px\");\n line.setAttribute(\"stroke\", \"red\");\n globalTrials = 0;\n gConfidence.style.color = \"red\";\n return false;\n } else {\n if (!globalAuto) {\n makeGray();\n gSvg.style.cursor = \"pointer\";\n };\n line.setAttribute(\"stroke-width\", \"3px\");\n line.setAttribute(\"stroke\", \"green\");\n gConfidence.style.color = \"black\";\n gConfidence.textContent = Math.min((1-Math.pow(1-1/globalDot.length, globalTrials))*100, 99.99).toFixed(2);\n return true;\n }\n }\n };\n if (!globalAuto) {\n hoverBox.onclick = function () { select(); };\n hoverBox.style.cursor = \"pointer\";\n }\n gEdges.appendChild(line);\n gHover.appendChild(hoverBox);\n gChoices.push(select);\n });\n if (globalAuto) {\n reschedule(0, function () {\n if(random_pick(gChoices)()) {\n // nope, try again\n reschedule(140, function () {\n main();\n });\n } else {\n // caught him! stop\n }\n });\n }\n}",
"function init() {\n createWelcomeGraphic();\n console.log('WELCOME TO ASSOCIATE MANAGER!');\n console.log('FOLLOW THE PROMPTS TO COMPLETE YOUR TASKS.');\n}",
"function main() {\r\n initFlags();\r\n fixMarkup();\r\n changeLayout();\r\n initConfiguration();\r\n}",
"function startPage() {\n background(BG_COLOR);\n\n //text info\n fill(TEXT_COLOR_START_PAGE);\n strokeWeight(1);\n stroke(TEXT_COLOR_START_PAGE);\n textSize(50);\n textAlign(CENTER, CENTER);\n text(START_WELCOME, START_PAGE_X, START_PAGE_Y);\n legend();\n textSize(25);\n text(START_KEY_TEXT, START_PAGE_X, START_PAGE_Y + 400);\n}",
"function main() {\n init(fontSize);\n\n renderModel = ReadModel();\n renderUI = ReaderBaseFrame(RootContainer);\n renderModel.init(function (data) {\n renderUI(data);\n });\n\n EventHandler();\n }",
"startup()\n\t{\n\t\tthis.angle = 1;\n\t\tthis.rows(5, 11, 1);\n\t\tthis.action(0);\n\t}",
"function init() {\n\n svg = d3\n .select(\"#d3-container-1\")\n .append(\"svg\")\n\n draw(); // calls the draw function\n }",
"function logoArt() {\n console.log(logo(config).render());\n start();\n}",
"configureStartingData() {\n // We don't use a singleton because defaults could change between calls.\n new DrawingDefaultsConfig(this, this._last_tool).render(true);\n }",
"function main(){\n\t//Initialice with first episode\n\tvar sel_episodes = [1]\n\t//collage(); //Create a collage with all the images as initial page of the app\n\tpaintCharacters();\n\tpaintEpisodes();\n\tpaintLocations(sel_episodes);\n}",
"function setup(){\n // String IDs of the 3 SVG containers\n var svgIdList = [\"vis1\", \"vis2\", \"vis3\"];\n\n // Foreach SVG container in the HTML page, save their references and dimensions into the appropriate global list variables\n for (i = 0; i < 3; i++) {\n var svgTuple = grabSvgDimensions(svgIdList[i]);\n svg_list.push(svgTuple[0]);\n svg_width_list.push(svgTuple[1]);\n svg_height_list.push(svgTuple[2]);\n }\n\n loadData(\"Pokemon-Dataset.csv\");\n}",
"function initSVG() {\n \t\tsvg = d3.select('body')\n \t\t.append('svg')\n \t\t.attr('viewBox', '0 0 600 600')\n \t\t.attr('style', 'width: 300px; height: 300px;');\n \t}",
"function SVGComic(evt, opts) {\n /// <summary>The main SVGComic object</summary>\n /// <param name=\"evt\">The calling event</param>\n /// <param name=\"opts\">The desired options</param>\n /// <option name=\"author\">The author's name (defaults to A. N. Onymous)</option>\n /// <option name=\"copyright\">The preferred copyright statement (defaults to \"© YEAR AUTHOR. All rights \n /// reserved\")</option>\n /// <option name=\"fill\">Preferred gutter color (defaults to black)</option>\n /// <option name=\"fontSize\">Preferred font size for title/author/subtitle/copyright (defaults to 12)</option>\n /// <option name=\"height\">Preferred comic height (defaults to 300)</option>\n /// <option name=\"subtitle\">Preferred secondary/episode title (defaults to blank)</option>\n /// <option name=\"textColor\">Preferred color for title/etc. text (defaults to white)</option>\n /// <option name=\"title\">Preferred title (defaults to \"untitled\")</option>\n /// <option name=\"width\">Preferred comic width (defaults to 800)</option>\n /// <option name=\"xGutter\">Preferred horizontal gutter (defaults to 10)</option>\n \n if (window.svgDocument == null) {\n svgDocument = evt.target.ownerDocument;\n }\n\n this.document = svgDocument;\n this.svg = this.document.rootElement;\n this.ns = 'http://www.w3.org/2000/svg';\n\n if (opts == null) {\n opts = new Array();\n }\n\n var date = new Date();\n\n this.author = opts['author'] || 'A. N. Onymous';\n\n this.copyright = opts['copyright'] || \"© \" + date.getFullYear() + \" \" + this.author + \". All rights reserved.\";\n this.fill = opts['fill'] || 'black';\n this.fontSize = opts['fontSize'] || 12;\n this.height = opts['height'] || 300;\n this.subtitle = opts['subtitle'] || '';\n this.textColor = opts['textColor'] || 'white';\n this.title = opts['title'] || 'Untitled';\n this.width = opts['width'] || 800;\n this.xGutter = opts['xGutter'] || 10;\n\n// this.x = opts['x'] || window.innerWidth / 2 - this.width / 2;\n// this.y = opts['y'] || window.innerHeight / 2 - this.height / 2;\n\n this.panels = new Array();\n\n this.initialize();\n}",
"function main() {\n\n var gears = createElement('img')\n gears.src = './gears.svg'\n global.app.appendChild(gears)\n\n if (global.NAV.geolocation) {\n global.NAV.geolocation.getCurrentPosition(app.onSuccess, app.onError)\n }\n}",
"function start_drawing() {\n $('#normal_ear').lazylinepainter( \n {\n \"svgData\": pathObj,\n \"strokeWidth\": 2,\n \"strokeColor\": \"#7f857f\"\n }).lazylinepainter('paint'); \n }",
"function initApp(evt) {\n SvgDoc = evt.target.ownerDocument;\n SvgInfoText = document.getElementById(\"textbox\").firstChild;\n SvgDebugText = document.getElementById(\"debugtext\").firstChild;\n SvgNoticeText = document.getElementById(\"textNotice\").firstChild;\n}",
"function start() { \n initiate_graph_builder();\n initiate_job_info(); \n initiate_aggregate_info();\n initiate_node_info();\n}",
"function initialize() {\n const logoText = logo({ name: \"Primary C M S\" }).render();\n console.log(logoText);\n mainOptions();\n}",
"function createWelcomeGraphic() {\n\n}",
"async function main() {\n new p5((p_) => {\n p = p_;\n p.setup = setup;\n // p.draw = draw;\n }, elements.container);\n\n gui\n .add(settings, 'targetClass', ['all'].concat(_.values(IMAGENET_CLASSES)))\n .onChange(restart);\n gui.add(settings, 'gridSize', 3, 100).step(1).onChange(restart);\n gui.add(settings, 'minStrokeWidth', 1, 10).step(1).onChange(restart);\n gui.add(settings, 'maxStrokeWidth', 10, 500).step(1).onChange(restart);\n gui.add(settings, 'lineCount', 1, 25).step(1).onChange(restart);\n gui.add(settings, 'lineAlpha', 0.1, 1).step(0.01).onChange(restart);\n gui.add(settings, 'linePointCurvePoint', 1, 50).step(1).onChange(restart);\n gui.add(settings, 'randomColorCount', 1, 50).step(1).onChange(restart);\n gui.add(settings, 'populationCount', 100, 1000).step(1);\n gui.add(settings, 'mutationRate', 0.1, 0.99).step(0.01);\n gui.add(settings, 'maxGeneration', 1, 100).step(1);\n gui.add(settings, 'matchThreshold', 0.1, 0.99).step(0.01);\n gui.add(settings, 'saveImage');\n gui.add(settings, 'restart');\n gui.add(settings, 'stop');\n gui.close();\n\n if (ENABLE_STATS) {\n stats.showPanel(0);\n elements.stats.appendChild(stats.dom);\n }\n}",
"function readyStart(svg){\n\t\n\n svg.input.textArea(18, 10, \"It Takes Carbon Fiber and Kevlar to Make the Best Basketball Shoes in the World\", {width: '200', class: 'heading'});\n \n svg.input.textArea(18, 97, \"When you look at basketball shoes, what do you see? A big swoosh. Three stripes. Michael Jordan. A billboard molded to your feet. But do you see the technology? Though maybe not as blatant as an Intel sticker on your laptop, every shoe showcases its own advanced technology. Don't worry, you can't miss it on these, the best basketball shoes on the planet. Because they roll with carbon fiber and Kevlar.\", {width: '200'});\n\n svg.input.list(228, 10, 'Nullam eget purus enim, quis faucibus sapien. \\nVivamus semper nulla vel sapien fringilla ullamcorper. \\nIn hac habitasse platea dictumst. ',{width: '150'});\n svg.input.list(228, 100, 'Nullam eget purus enim, quis faucibus sapien. \\nVivamus semper nulla vel sapien fringilla ullamcorper. \\nIn hac habitasse platea dictumst. ',{width: '150'});\n\t\n\t\n\t$('.svg-container').transition({ x: '0', y: '20px', height: '400px'}, 1000, 'snap');\n\t\n\t$('.view .message').removeClass('loading');\n\n\t\n}",
"function drawStart() {\n\n console.log('in landingPageStart()');\n draw_static_word_cloud();\n display_image_mortality(1);\n}",
"function init() {\n\t\tbuildBar();\n\t\tbuildBubble();\n\t\tbuildGauge();\n\t\t//buildMeta();\n\t}",
"function initializeNodeInfo() {\n var infoBox = d3\n .select(\"#sequence\")\n .append(\"svg:svg\")\n .attr(\"width\", 300)\n .attr(\"height\", 300)\n .attr(\"id\", \"infobox\");\n}",
"function instructions() {\n stroke('Black'); fill('White')\n textSize(15)\n const thecopy = `The Chaos Game! by Daniel Reeves and Cantor Soule-Reeves\n\nDrawing with math ${\" \".repeat(35)} (${width}x${height} pixels)\n${noa} attractors, ` +\n`${hub===1 ? \"w/\" : \"w/o\"} a hub, ` +\n`excluding ${cac}, partial teleport ${fracify(pat)}\n\n• SPACE to toggle hyperspeed ⟶\n• CLICK (or R) for new fractal\n• G to regenerate (or 1/2/3/etc for other color schemes)`\n/*\n N to refresh everything but number of attractors\n H to refresh everything but whether there's a hub\n P to refresh everything but the partial teleport\n*/\n text(thecopy, 5, 15)\n const baretitle = rawnamify(noa, hub, cac, pat)\n let title = titlehash[baretitle]\n if (title === undefined) title = `untitled ${baretitle}`\n fill(1, 0, .3); textSize(width < 500 ? 37 :\n width < 640 ? 65 :\n width < 800 ? 68 :\n width < 1000 ? 70 :\n width < 2000 ? 100 : \n width < 3000 ? 150 : 300)\n push()\n textAlign(LEFT, TOP)\n text(`“${title}”`, 5, 160, width-10, height-160)\n pop()\n}",
"function setup() {\n createCanvas(500, 500, SVG)\n noLoop()\n angleMode(DEGREES)\n rectMode(CENTER)\n}",
"function visualizationLogic(){\n console.log(\"Visualization Logic\")\n //text\n //INFO from: https://earthquake.usgs.gov/earthquakes/browse/significant.php#sigdef\n // let t2 = createP('Events in this list and shown in red on our real-time earthquake map and list are considered “significant events’,<br>and they are determined by a combination of magnitude, number of Did You Feel It responses, and PAGER alert level.');\n // t2.class('small');\n // t2.parent('canvas1');\n // t2.position(0,0);\n\n //-------------------------------------------------------------//\n // 1. Magnitude Level //\n //-------------------------------------------------------------//\n\n //Variables for All\n let legendW = 60;\n //Variables for Magnitude\n let Mag_Legends = [0, 1, 3, 4.5, 6, 9];\n let Mag_xPos = (cWidth - Mag_Legends.length * legendW)/2; //CENTER THEM\n let Mag_margin = 10;\n let Mag_angle = 0;\n\n //Variables for Significance\n let minSig = minValue(quakes, 'sig');\n let maxSig = maxValue(quakes, 'sig');\n console.log(`MinSig is ${minSig} MaxSig is ${maxSig}`);\n let sig_Legends = [0, 100, 200, 400, 600, 1000, 1500];\n let sig_xPos = (cWidth - sig_Legends.length * legendW)/2; //CENTER THEM\n let sig_margin = 10;\n\n textFont(font1);\n //\n push();\n translate(Mag_xPos, legendW); \n for (let i = 0; i < Mag_Legends.length; i ++) {\n let myAPT_W, myAPT_H;\n myAPT_W = map(1000, 0, 1500, 1, legendW/2); \n myAPT_H = 2 * myAPT_W;\n Mag_angle = radians ( map(Mag_Legends[i], 0, 9, 0, 90) ); //Input, min, max, 0, 90\n //This is the class for the buildings;\n //\n push();\n let xTrans = legendW/2 - myAPT_W/2;\n translate(xTrans, 0); // ****************. FIX THIS PART\n rotate(Mag_angle);\n //2. Building \n let mySigC = sigScale(1000).hex();\n let myMagC = magScale(Mag_Legends[i]).hex();\n myMagC = color(myMagC);\n myMagC.setAlpha(150); // Add Alpha\n fill(mySigC);\n strokeWeight(1);\n stroke('#000000');\n rect(0, 0, myAPT_W, - myAPT_H);//x, y, w, h\n //3. Window\n fill('#ffffff');\n strokeWeight(0.5);\n let myWindowW = map(400, 0, 1500, 1, legendW/7);\n let myWindwX1 = legendW/2 - myAPT_W/5 - myWindowW/2 - xTrans;\n let myWindwX2 = myWindwX1 + 2*(myAPT_W/5) ;\n rect(myWindwX1, - myAPT_H/4 + myWindowW/2, myWindowW, - myWindowW); \n rect(myWindwX1, - (myAPT_H/4) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(myWindwX1, - (myAPT_H/4) * 3 + myWindowW/2, myWindowW, - myWindowW);\n rect(myWindwX2, - myAPT_H/4 + myWindowW/2, myWindowW, - myWindowW); \n rect(myWindwX2, - (myAPT_H/4) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(myWindwX2, - (myAPT_H/4) * 3 + myWindowW/2, myWindowW, - myWindowW);\n //4. Rooftop\n let x1, y1;\n x1 = legendW/2 - myAPT_W/2 - xTrans;\n y1 = - myAPT_H;\n let h = map(1000, 0, 1500, 1, myWindowW);\n line(x1, y1, x1 - h, y1 - h); //Left\n line(x1 + myAPT_W, y1, x1 + myAPT_W + h, y1 - h); //Right\n line(x1 - h, y1 - h, x1 + myAPT_W + h, y1 - h); //top\n pop();\n //1. Ground\n noStroke(); \n fill(myMagC);\n rect(Mag_margin, 0, legendW - 2 * Mag_margin, 15 * map(Mag_Legends[i], 0, 9, 0, 90)/90 ); ////x, y, w, h\n //5. -- Legend Text Below -- //\n noStroke();\n fill('orange');\n textSize(12);\n textAlign(CENTER);\n text(Mag_Legends[i], legendW/2, 35); //text,x, y\n //6. //Move to the next spot to the Right (Add scale)\n translate(legendW, 0); \n }\n pop();\n //Text Description\n textAlign(CENTER);\n textSize(15);\n text(\"Magnitude Level\", cWidth/2, legendW*1.9); \n\n //-------------------------------------------------------------//\n // 2. Significance Level //\n //-------------------------------------------------------------//\n // Cali range 0 from 640, World Range from 0 to 1492\n\n push();\n translate(sig_xPos, legendYPos + legendW + sig_margin); //x, y\n for (let i = 0; i < sig_Legends.length; i ++) {\n let myAPT_W, myAPT_H;\n myAPT_W = map(sig_Legends[i], 0, 1500, 1, legendW/2); //Input, min, max,\n myAPT_H = 2 * myAPT_W; //2 Times over -> Max will be 60\n //This is the class for the buildings;\n //1. Ground\n // noStroke();\n // fill(magScale(0).hex()); //Show the Color at Mag = 0;\n // //fill('rgba(150, 75, 0, 0.5)'); // Brown //************** Should be re-written \n // rect(sig_margin, 0, legendW - 2 * sig_margin, 20); ////x, y, w, h\n //2. Building //Half Point: legendW/2\n let myC = sigScale(sig_Legends[i]).hex();\n fill(myC);\n strokeWeight(1);\n stroke('#000000');\n rect(legendW/2 - myAPT_W/2, 0, myAPT_W, - myAPT_H);//x, y, w, h\n //3. Apartment Windows\n fill('#ffffff');\n strokeWeight(0.5);\n let myWindowW = map(sig_Legends[3], 0, 1500, 1, legendW/7);\n if (sig_Legends[i] < 200) { // No Window\n console.log(\"Sig level below 200 - No Window\");\n }\n if (sig_Legends[i] >= 200 && sig_Legends[i] < 400) { //One Window\n console.log(\"Sig level between 200 & 400\"); \n rect(legendW/2 - myWindowW/2, - myAPT_H/2 + myWindowW/2, myWindowW, - myWindowW); \n } \n if (sig_Legends[i] >= 400 && sig_Legends[i] < 600) { //Two Windows\n console.log(\"Sig level between 400 & 600\"); \n rect(legendW/2 - myWindowW/2, - myAPT_H/3 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 - myWindowW/2, - (myAPT_H/3) * 2 + myWindowW/2, myWindowW, - myWindowW);\n }\n if (sig_Legends[i] >= 600 && sig_Legends[i] < 1000) { //Two Windows * 2 Cols\n console.log(\"Sig level between 600 & 1000\"); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - myAPT_H/3 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/3) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - myAPT_H/3 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/3) * 2 + myWindowW/2, myWindowW, - myWindowW);\n }\n if (sig_Legends[i] >= 1000 && sig_Legends[i] < 1500) { //Two Windows * 3 Cols\n console.log(\"Sig level between 1000 & 1500\"); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - myAPT_H/4 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/4) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/4) * 3 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - myAPT_H/4 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/4) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/4) * 3 + myWindowW/2, myWindowW, - myWindowW);\n }\n if (sig_Legends[i] >= 1500) { //Two Windows * 3 Cols\n console.log(\"Sig level Over 1500\"); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - myAPT_H/6 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 3 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 4 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 5 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - myAPT_H/6 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 3 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 4 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 5 + myWindowW/2, myWindowW, - myWindowW);\n }\n //4. RoofTop - 3 lines;\n let x1, y1, x2, y2;\n x1 = legendW/2 - myAPT_W/2;\n y1 = - myAPT_H;\n let h = map(sig_Legends[i], 0, 1500, 1, myWindowW);\n line(x1, y1, x1 - h, y1 - h); //Left\n line(x1 + myAPT_W, y1, x1 + myAPT_W + h, y1 - h); //Right\n line(x1 - h, y1 - h, x1 + myAPT_W + h, y1 - h); //top\n //5. -- Legend Text Below -- //\n noStroke();\n fill('#cccccc');\n textSize(12);\n textAlign(CENTER);\n text(sig_Legends[i], legendW/2, 15); //text,x, y\n //6. //Move to the next spot to the Right (Add scale)\n translate(legendW, 0); \n }\n pop();\n //Text Description\n textAlign(CENTER);\n textSize(15);\n fill('#000000');\n text(\"Significance Level\", cWidth/2, legendYPos + legendW*1.75);\n\n\n}"
] | [
"0.6164258",
"0.6153753",
"0.6103125",
"0.60569006",
"0.6028724",
"0.60109293",
"0.5989982",
"0.5943327",
"0.5902008",
"0.58985037",
"0.5887603",
"0.5883157",
"0.58719426",
"0.5870687",
"0.5868651",
"0.584427",
"0.582053",
"0.58100206",
"0.58062714",
"0.5795493",
"0.57847077",
"0.5780946",
"0.57773554",
"0.5740487",
"0.571522",
"0.5708252",
"0.5682751",
"0.56704116",
"0.56608415",
"0.56599355"
] | 0.6928524 | 0 |
Reads the data entered in the meta data form and saves it, leading to the source form afterwards. | function createMetaData(){
var title = document.getElementById("title").value;
var composer = document.getElementById("composer").value;
var author = document.getElementById("author").value;
var availability = document.getElementById("availability").value;
var comment = document.getElementById("comment").value;
metaData = new MetaData(title, composer, author, availability, comment);
document.getElementById("input").innerHTML = sourceForm();
document.getElementById("meiOutput").value = createMEIOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function applyMetaDataChanges(){\n var title = document.getElementById(\"title\").value;\n var composer = document.getElementById(\"composer\").value;\n var author = document.getElementById(\"author\").value;\n var availability = document.getElementById(\"availability\").value;\n var comment = document.getElementById(\"comment\").value;\n \n if(title){\n metaData.title = title;\n }\n if(composer){\n metaData.composer = composer;\n }\n if(author){\n metaData.author = author;\n }\n if(availability){\n metaData.availability = availability;\n }\n if(comment){\n metaData.comment = comment;\n }\n \n document.getElementById(\"input\").innerHTML = metaDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n}",
"function getMetadataForSubmit(){\n meta_new_value = '';\n if (meta_control_type == 'text') {\n meta_new_value = checkForNbsp( $(\"#meta_textarea\").val() );\n\n } else if (meta_control_type == 'list') {\n meta_new_value = checkForNbsp( $(\"#meta_textarea option:selected\").text() );\n\n } else if (meta_control_type == 'date') {\n var month = '', day = '', year = '';\n month = checkForNbsp( $('#month_select option:selected').text() );\n day = checkForNbsp( $('#day_select option:selected').text() );\n year = checkForNbsp( $('#year_select option:selected').text() );\n\n meta_new_value = year + '-' + month + '-' + day + ' CE';\n\n } else if (meta_control_type == 'terminus') {\n var month = '', day = '', year = '', prefix = '', era = '';\n month = checkForNbsp( $('#month_select option:selected').text() );\n day = checkForNbsp( $('#day_select option:selected').text() );\n year = checkForNbsp( $('#year_select option:selected').text() );\n prefix = checkForNbsp( $('#prefix_select option:selected').text() );\n era = checkForNbsp( $('#era_select option:selected').text() );\n\n if (prefix != '') {\n meta_new_value = prefix + ' ';\n }\n meta_new_value += year + '-' + month + '-' + day;\n\n if (era != '') {\n meta_new_value += ' ' + era;\n }\n\n } else if (meta_control_type == 'multi_input') {\n $(\"#meta_textarea option\").each(function () {\n meta_new_value += checkForNbsp( $(this).text() ) + \"\\n\";\n });\n if (meta_new_value != '') {\n meta_new_value = meta_new_value.substring(0, meta_new_value.length - 1);\n }\n\n } else if (meta_control_type == 'multi_select') {\n $(\"#meta_textarea option:selected\").each(function () {\n meta_new_value += checkForNbsp( $(this).text() ) + \"\\n\";\n });\n if (meta_new_value != '') {\n meta_new_value = meta_new_value.substring(0, meta_new_value.length - 1);\n }\n }\n }",
"function copyStorageToForm() {\n \"use strict\";\n // Set chosen hair type\n setFormHairType(sessionStorage.getItem(\"hair_type\"));\n\n // Set selected traits\n setFormTraits(sessionStorage.getItem(\"traits\"));\n}",
"function set_common_meta_input(cb) {\n common_form = $('#sample_common_form');\n var form = common_form.children('form');\n\n // Construct new callback function so that the dropdowns to select organism\n // fires change for genus/species/version before change for copying the\n // field to sample meta.\n if (typeof cb == 'function') {\n function callback() {\n set_common_checkboxes(form);\n cb();\n }\n } else {\n function callback() {\n set_common_checkboxes(form);\n }\n }\n\n // Set shared inputs.\n set_shared_inputs(form, callback);\n\n // All samples must have even number of reads for the paired-end radio\n // to be active.\n var even = true;\n for (var id in proj.samples) {\n var sample = proj.samples[id];\n var n_reads = Object.keys(proj.samples[id].reads).length;\n if (n_reads % 2 != 0) {\n even = false;\n }\n }\n if (!even) {\n form.find('input:radio[value=2]').prop('disabled', true);\n }\n\n // Set save & apply button.\n common_form.find('.save_btn').click(function () {\n var btn = $(this);\n\n btn.prop('disabled', true);\n\n // Function to show next form.\n function show_next_form() {\n var meta = $('#sample_meta')\n meta.show();\n $('#meta_footer').show();\n scroll_to_ele(meta);\n }\n\n save_proj(show_saved, btn, show_next_form);\n\n });\n\n // Enable popovers and tooltips.\n enable_popovers_tooltips(common_form);\n}",
"function saveMeta(){\n\t$('body').find('#meta_data_keys li').each(function() {\n\t\t//if($(this).children('.value').val() != '' ){\n\t\t$.ajax(\n\t\t\t{\n\t\t\t\turl: OC.filePath('meta_data', 'ajax', 'tagOps.php'),\n\t\t\t\ttype: \"POST\",\n\t\t\t\tdata: {\n\t\t\t\ttagOp: 'update_file_key',\n\t\t\t\tkeyId: $(this).attr('id'),\n\t\t\t\ttagId: $('#metadata').attr('tagid'),\n\t\t\t\tfileId:$('#metadata').attr('fileid'),\n\t\t\t\ttype:$('#metadata').attr('type'),\n\t\t\t\tvalue: $(this).find('.value').val()\n\t\t\t},\n\t\t\tsuccess: function(result) {\n\t\t\t}\n\t\t});\n\t\t//}\n\t});\n\t$('body').find('.ui-dialog').remove();\n}",
"function set_meta_input(cb) {\n // Then, set the samples metadata.\n set_samples_meta_input();\n\n // We have to set the common meta input form after setting up the samples\n // because this function assumes that the global sample_forms variable\n // is populated.\n set_common_meta_input(cb);\n\n // Deal with project meta input form last.\n set_proj_meta_input();\n\n // set_meta_input_fields();\n\n // Then, add listener to verify metadata button.\n $('#verify_meta_btn').click(show_verify_meta_modal);\n\n // Set listener for fill with test metadata button.\n $('#test_metadata_btn').click(fill_with_test_metadata);\n}",
"function meta_input() {\n var valid = fetch_sample_names();\n\n if (valid) {\n // First, save and set the project.\n write_proj(function () {\n var target = 'cgi_request.php';\n var data = {\n id: proj_id,\n action: 'set_proj'\n };\n send_ajax_request(target, data, null, false);\n });\n\n $('#sample_names_modal').modal('hide');\n\n set_meta_input();\n\n show_meta_input();\n }\n}",
"function populate() {\n $('#title').val(localStorage.getItem('title')),\n $('#description').val(localStorage.getItem('description')),\n $('#content').html(localStorage.getItem('content'));\n}",
"function processMetadataForm(theForm) {\n var props=PropertiesService.getDocumentProperties()\n\n for (var item in theForm) {\n props.setProperty(item,theForm[item])\n Logger.log(item+':::'+theForm[item]);\n }\n}",
"function get_sample_meta(id) {\n var form = sample_forms[id];\n var sample_input_fields = meta_input_fields.samples[id];\n\n var sample_meta = {};\n sample_meta['meta'] = {};\n\n sample_meta['name'] = sample_input_fields['name'].val();\n sample_meta.meta['description'] = sample_input_fields.meta['description']\n .val();\n\n // Get contributors.\n sample_meta.meta['contributors'] = [];\n for (var i = 0; i < sample_contributor_fields[id].length; i++) {\n var field = sample_contributor_fields[id][i];\n var contributor = field.children('input').val();\n\n if (contributor != '' && contributor != null) {\n sample_meta.meta['contributors'].push(contributor);\n }\n }\n\n // Get characteristics.\n sample_meta.meta['chars'] = {};\n for (var i = 0; i < sample_characteristic_fields[id].length; i++) {\n var field = sample_characteristic_fields[id][i];\n var char = field.children('input:nth-of-type(1)').val();\n var detail = field.children('input:nth-of-type(2)').val();\n\n // Add to dictionary only if both char and detail is populated.\n if (char != '' && char != null && detail != '' && detail != null) {\n sample_meta.meta['chars'][char] = detail;\n }\n }\n\n sample_meta.meta['source'] = sample_input_fields.meta['source'].val();\n sample_meta['type'] = parseInt(sample_input_fields['type']\n .find('input:checked').val());\n\n // If reads are paired-end, we need to replace the reads dictionary as well.\n if (sample_meta['type'] == 2) {\n sample_meta['reads'] = [];\n for (var i = 0; i < sample_pair_fields[id].length; i++) {\n var field = sample_pair_fields[id][i];\n var pair_1 = field.children('select:nth-of-type(1)').val();\n var pair_2 = field.children('select:nth-of-type(2)').val();\n\n var pair = [pair_1, pair_2];\n sample_meta['reads'].push(pair);\n }\n }\n\n // Parse organism.\n var org = sample_input_fields['organism'].val();\n if (org != '' && org != null) {\n var split = org.split('_');\n sample_meta['organism'] = split[0] + '_' + split[1];\n sample_meta['ref_ver'] = split.slice(2).join('_');\n } else {\n sample_meta['organism'] = '';\n sample_meta['ref_ver'] = '';\n }\n\n var length = sample_input_fields['length'].val();\n if (length != '' && length != null) {\n sample_meta['length'] = parseInt(length);\n } else {\n sample_meta['length'] = 0;\n }\n\n var stdev = sample_input_fields['stdev'].val();\n if (stdev != '' && stdev != null) {\n sample_meta['stdev'] = parseInt(stdev);\n } else {\n sample_meta['stdev'] = 0;\n }\n\n return sample_meta;\n}",
"function convert_all_meta_inputs() {\n var proj_inputs = convert_proj_meta_inputs(proj_form);\n\n for (var cat in proj_inputs) {\n proj[cat] = proj_inputs[cat];\n }\n\n for (var id in sample_forms) {\n var sample_form = sample_forms[id];\n var sample_inputs = convert_sample_meta_inputs(sample_form);\n\n for (var cat in sample_inputs) {\n proj.samples[id][cat] = sample_inputs[cat];\n }\n }\n}",
"function getForm() {\n inputNombre.value = localStorage.getItem('nombre');\n inputApellido.value = localStorage.getItem('apellido');\n inputTel.value = localStorage.getItem('tel');\n inputDir.value = localStorage.getItem('dir');\n inputObs.value = localStorage.getItem('obs');\n console.log('data loaded');\n}",
"function saveTrackData () {\n var Modal = $('#modalEditTrack');\n var Id = Modal.find('#id').val();\n var oMeta = {\n id: Id\n , title: Modal.find('#title').val()\n , name: Modal.find('#name').val()\n , artist: Modal.find('#artist').val()\n , album: Modal.find('#album').val()\n , track: Modal.find('#track').val()\n , year: Modal.find('#year').val()\n , genre: Modal.find('#track-genre').val()\n , tags: Modal.find('#track-tags').val()\n };\n\n var saveResult = F.requestAjax('/' + Id + '/meta', oMeta, 'POST');\n }",
"function setupDataForForm(){\n if(typeof(hotty) != \"undefined\"){\n $('#import_data').val(JSON.stringify(hotty.getData()));\n console.log(\"updating the data...\");\n }\n else{\n console.log(\"hotty isnt there, maybe just booting up!\");\n }\n }",
"function goto_meta_input() {\n read_proj();\n}",
"save(blockContainer) {\n let newData = {}\n\n // Get the contents of each field for this tool.\n for (let key in this.fields) {\n const element = blockContainer.querySelector(`.${this.CSS.input}[data-key=${key}]`)\n newData[key] = element.tagName == 'INPUT' ? element.value : element.innerHTML\n newData[key] = newData[key].replace(' ', ' ').trim() // Strip non-breaking whitespace\n }\n\n // TODO: Because of autosave, this strips out necessary defaults prematurely.\n //this.removeInactiveData()\n return Object.assign(this.data, newData)\n }",
"function save() {\n $editors.find('.text').each(function () {\n $(this).closest('.fields').find('textarea').val(this.innerHTML);\n });\n }",
"function storeData(){\r\n\t\tvar id \t\t\t\t= Math.floor(Math.random()*100000000001);\r\n\t\t//Gather up all our form field values and store in an object\r\n\t\t//Object properties contain an array with the form label and input value\r\n\t\tgetSelectedRadio();\r\n\t\tvar item \t\t\t\t= {};\r\n\t\t\titem.comicTitle\t\t= [\"Title of Comic:\", e('comicTitle').value];\r\n\t\t\titem.seriesTitle\t= [\"Title of Series:\", e('seriesTitle').value];\r\n\t\t\titem.issueNum\t\t= [\"Issue Number:\", e('issueNum').value];\r\n\t\t\titem.dateReleased\t= [\"Date Released:\", e('dateReleased').value];\r\n\t\t\titem.publisher\t\t= [\"Publisher:\", e('publisher').value];\r\n\t\t\titem.rateIssue\t\t= [\"Rate of Issue:\", e('rateIssue').value];\r\n\t\t\titem.genre \t\t\t= [\"Genre:\", e('genre').value];\r\n\t\t\titem.illStyle\t\t= [\"Illustration Style:\", styleValue];\r\n\t\t\titem.comments\t\t= [\"Comments:\", e('comments').value];\r\n\t\t//Save data into Local Storage: Use Stringify to convert our object to a string\r\n\t\tlocalStorage.setItem(id, JSON.stringify(item));\r\n\t\talert(\"Comic saved to index!\");\r\n\t}",
"function set_proj_meta_input() {\n proj_form = $('#proj');\n\n // Set the project id header\n var html = proj_form.html();\n proj_form.html(html.replace(new RegExp('PROJECT_ID', 'g'), proj_id));\n\n // Set up contributors.\n var contributors_group = proj_form.find('.proj_contributors_group');\n var contributors_div = contributors_group.children('.contributors_inputs');\n set_contributors(contributors_div);\n\n // Set up Factor 1 name and values.\n var factor_card = proj_form.find('.factor_card');\n set_factor(factor_card);\n\n // Enable experimental design.\n var design_group = proj_form.find('.proj_experimental_design_group');\n var design_inputs = design_group.children('.experimental_design_inputs');\n var factor_hide_radio = design_group.find('#proj_design_1_radio');\n var factor_show_radio = design_group.find('#proj_design_2_radio');\n var div_to_toggle = factor_card.clone(true);\n div_to_toggle.children('h6').text('Contrast Factor 2');\n div_to_toggle.addClass('collapse');\n design_inputs.append(div_to_toggle);\n set_radio_collapse_toggle(factor_hide_radio, factor_show_radio, div_to_toggle);\n\n // Then, we must also set up listeners to show/hide appropriate factor 1\n // and factor 2 information for each sample.\n set_factor_to_sample_listeners(factor_hide_radio, factor_show_radio, design_inputs);\n\n proj_form.find('.save_btn').click(function () {\n var btn = $(this);\n\n // Disable this button.\n btn.prop('disabled', true);\n\n // Function to show next form.\n function show_next_form() {\n var header = $('#sample_meta_header');\n header.show();\n $('#sample_meta_common').show();\n scroll_to_ele(header);\n }\n\n save_proj(show_saved, btn, show_next_form);\n });\n\n // Disable 2-factor design if there are less than 8 samples.\n if (Object.keys(proj.samples).length < 8) {\n factor_show_radio.prop('disabled', true);\n }\n\n // Enable popovers and tooltips.\n enable_popovers_tooltips(proj_form);\n}",
"function saveData(id)\n\t{\n\t\tvar f = document.fuploadr;\n\t\tvar data = ImageStore[id];\n\t\t\n\t\tdata.title\t\t = f.title.value;\n\t\tdata.description = f.description.value;\n\t\tdata.tags\t\t = f.tags.value;\n\t\tdata.is_public\t = getChecked(f.is_public, 0);\n\t\tdata.is_friend\t = getChecked(f.is_friend, 0);\n\t\tdata.is_family\t = getChecked(f.is_family, 0);\n\t\tdata.safety_level = f.safety_level.value;\n\t\tdata.hidden\t\t = getChecked(f.hidden, 1);\n\t\t//data.content_type = f.content_type.value;\n\t}",
"function set_samples_meta_input() {\n var sample_form = $('.sample_collapse');\n\n // Set sorted names.\n set_sorted_names();\n\n // Add samples in sorted order (by name).\n for (var i = 0; i < sorted_names.length; i++) {\n var name = sorted_names[i];\n var id = names_to_ids[name];\n var new_sample_form = sample_form.clone(true);\n\n // Replace all instances of SAMPLEID to the id.\n var html = new_sample_form.html();\n new_sample_form.html(html.replace(new RegExp('SAMPLEID', 'g'), id));\n\n sample_forms[id] = new_sample_form;\n\n // Set the sample name.\n new_sample_form.find('.sample_name_group').find('input').val(name);\n\n // Set the reads table for this sample.\n set_reads_table(id, new_sample_form);\n\n // Characteristics.\n var char_group = new_sample_form.find('.sample_specific_'\n + 'characteristics_group');\n set_fluid_input_rows(char_group.find('.sample_characteristics_inputs'));\n\n // Save changes button.\n var save_changes_btn = new_sample_form.find('.save_btn');\n save_changes_btn.click(function () {\n var btn = $(this);\n btn.prop('disabled', true);\n\n save_proj(show_saved, btn);\n });\n\n // Set up copy buttons.\n var copy_btns = new_sample_form.find('.copy_btn');\n copy_btns.each(function () {\n set_copy_btn($(this), id);\n })\n\n // Append new form.\n $('#sample_card').append(new_sample_form);\n }\n\n // Then, set the button handler.\n var dropdown = $('#sample_choices');\n set_choose_sample_button(dropdown, sample_forms);\n\n // Enable popovers and tooltips.\n enable_popovers_tooltips(sample_form);\n}",
"function save() {\r\n this.textarea.value = this.content();\r\n }",
"function load() {\n let savedNotes = localStorage.getItem(\"dataNotes\");\n let savedTitle = localStorage.getItem(\"dataTitle\");\n if (savedNotes) {\n notes.value = savedNotes;\n }\n if (savedTitle) {\n notesTitle.value = savedTitle;\n headerTitleChange()\n }\n}",
"function processDataFromDocusky() {\n\tparseDocInfo();\n\ttoolSetting();\n}",
"function fillEditForm() {\n let selectedBook = document.getElementById('selected-book')\n let titleInput = document.getElementById('title-edit-in')\n let authorInput = document.getElementById('author-edit-in')\n let genreInput = document.getElementById('genre-edit-in')\n let pagesInput = document.getElementById('pages-edit-in')\n let i = selectedBook.dataset.index\n\n titleInput.value = library[i].title\n authorInput.value = library[i].author\n genreInput.value = library[i].genre\n pagesInput.value = library[i].numPages \n}",
"function eventDSEditOnLoad() {\n var form = EventEditForm.getForm();\n form.setValues(eventDS.getAt(0).data);\n}",
"function save() {\n this.textarea.value = this.content();\n }",
"saveData() {\n if (this.s.unavailable()) {\n return;\n }\n\n for (const val of this.dispField.items) {\n this.s.set(val, this.dispField.checked(val));\n }\n\n this.s.set(\"unit\", this.unitField.get());\n this.s.set(\"format\", this.formatField.get());\n this.s.set(\"sort\", this.sortableField.toArray());\n }",
"save () {\n\n // Validate\n if (this.checkValidity()) {\n\n // Collect input\n this.info.item = this.collectInput();\n\n // Show modal\n this.modal.show();\n }\n }",
"function fill_with_test_metadata() {\n set_proj_meta_inputs(proj_form, test_proj_inputs);\n set_common_meta_inputs(common_form, test_common_inputs);\n\n for (var name in test_samples_inputs) {\n var test_sample_inputs = test_samples_inputs[name];\n var sample_form = sample_forms[names_to_ids[name]];\n\n set_sample_meta_inputs(sample_form, test_sample_inputs);\n }\n}"
] | [
"0.59718615",
"0.591337",
"0.57427394",
"0.5741593",
"0.5740494",
"0.5718736",
"0.5649828",
"0.56201446",
"0.54978794",
"0.54947",
"0.54677665",
"0.53675306",
"0.5363405",
"0.53455406",
"0.53410196",
"0.53374064",
"0.5306338",
"0.5278786",
"0.5275786",
"0.5230865",
"0.5230068",
"0.5221691",
"0.5213467",
"0.5201967",
"0.51999027",
"0.5192922",
"0.51913244",
"0.51764727",
"0.51665884",
"0.514595"
] | 0.61347723 | 0 |
Navigational, leads to syllable form from neume variants. | function toSyllableFromNeumeVariations(){
pushedNeumeVariations = false;
neumeVariations = new Array();
isNeumeVariant = false;
if(syllables.length > 1){
currentColor = syllables[syllables.length-1].color;
}
document.getElementById("input").innerHTML = syllableForm();
document.getElementById("meiOutput").value = createMEIOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function L() {\n if (Syllable.DEBUG) Vex.L(\"Vex.Flow.Syllable\", arguments);\n }",
"function toSyllableFromVariations(){\n pushedVariations = false;\n variations = new Array();\n \n if(syllables.length > 1){\n currentColor = syllables[syllables.length-1].color;\n }\n \n document.getElementById(\"input\").innerHTML = syllableForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function stepSyllable() {\n drums();\n try {\n var s = poem[stanza];\n\n var v = s[verse];\n if (!v) {\n stepStanza();\n return stepSyllable();\n }\n var w = v.w[word];\n if (!w) {\n stepVerse();\n return stepSyllable();\n }\n var sb = w.s[syllable];\n if (!sb) {\n stepWord();\n return stepSyllable();\n }\n\n printSyllable(sb);\n\n var note = chooseNote(sb);\n playNote(note);\n sock.write(deaccent(sb));\n syllable++\n\n } catch (e) {\n stepStanza();\n intro.draw(1);\n }\n}",
"getCodeNorm() {\n const c = this.getCode();\n return c === NL_LIKE ? NL : c;\n }",
"mapSyllableRomajiUnicode() {\n return {\n mapping: [\n {syllable: {alphabet: \"h\", consonant: \"\", vowel: \"a\"}, romaji: \"a\", unicode: \"\\u3042\"},\n {syllable: {alphabet: \"h\", consonant: \"\", vowel: \"i\"}, romaji: \"i\", unicode: \"\\u3044\"},\n {syllable: {alphabet: \"h\", consonant: \"\", vowel: \"u\"}, romaji: \"u\", unicode: \"\\u3046\"},\n {syllable: {alphabet: \"h\", consonant: \"\", vowel: \"e\"}, romaji: \"e\", unicode: \"\\u3048\"},\n {syllable: {alphabet: \"h\", consonant: \"\", vowel: \"o\"}, romaji: \"o\", unicode: \"\\u304A\"},\n {syllable: {alphabet: \"h\", consonant: \"k\", vowel: \"a\"}, romaji: \"ka\", unicode: \"\\u304B\"},\n {syllable: {alphabet: \"h\", consonant: \"k\", vowel: \"i\"}, romaji: \"ki\", unicode: \"\\u304D\"},\n {syllable: {alphabet: \"h\", consonant: \"k\", vowel: \"u\"}, romaji: \"ku\", unicode: \"\\u304F\"},\n {syllable: {alphabet: \"h\", consonant: \"k\", vowel: \"e\"}, romaji: \"ke\", unicode: \"\\u3051\"},\n {syllable: {alphabet: \"h\", consonant: \"k\", vowel: \"o\"}, romaji: \"ko\", unicode: \"\\u3053\"},\n {syllable: {alphabet: \"h\", consonant: \"s\", vowel: \"a\"}, romaji: \"sa\", unicode: \"\\u3055\"},\n {syllable: {alphabet: \"h\", consonant: \"s\", vowel: \"i\"}, romaji: \"shi\", unicode: \"\\u3057\"},\n {syllable: {alphabet: \"h\", consonant: \"s\", vowel: \"u\"}, romaji: \"su\", unicode: \"\\u3059\"},\n {syllable: {alphabet: \"h\", consonant: \"s\", vowel: \"e\"}, romaji: \"se\", unicode: \"\\u305B\"},\n {syllable: {alphabet: \"h\", consonant: \"s\", vowel: \"o\"}, romaji: \"so\", unicode: \"\\u305D\"},\n {syllable: {alphabet: \"h\", consonant: \"t\", vowel: \"a\"}, romaji: \"ta\", unicode: \"\\u305F\"},\n {syllable: {alphabet: \"h\", consonant: \"t\", vowel: \"i\"}, romaji: \"chi\", unicode: \"\\u3061\"},\n {syllable: {alphabet: \"h\", consonant: \"t\", vowel: \"u\"}, romaji: \"tsu\", unicode: \"\\u3064\"},\n {syllable: {alphabet: \"h\", consonant: \"t\", vowel: \"e\"}, romaji: \"te\", unicode: \"\\u3066\"},\n {syllable: {alphabet: \"h\", consonant: \"t\", vowel: \"o\"}, romaji: \"to\", unicode: \"\\u3068\"},\n {syllable: {alphabet: \"h\", consonant: \"n\", vowel: \"a\"}, romaji: \"na\", unicode: \"\\u306A\"},\n {syllable: {alphabet: \"h\", consonant: \"n\", vowel: \"i\"}, romaji: \"ni\", unicode: \"\\u306B\"},\n {syllable: {alphabet: \"h\", consonant: \"n\", vowel: \"u\"}, romaji: \"nu\", unicode: \"\\u306C\"},\n {syllable: {alphabet: \"h\", consonant: \"n\", vowel: \"e\"}, romaji: \"ne\", unicode: \"\\u306D\"},\n {syllable: {alphabet: \"h\", consonant: \"n\", vowel: \"o\"}, romaji: \"no\", unicode: \"\\u306E\"},\n {syllable: {alphabet: \"h\", consonant: \"h\", vowel: \"a\"}, romaji: \"ha\", unicode: \"\\u306F\"},\n {syllable: {alphabet: \"h\", consonant: \"h\", vowel: \"i\"}, romaji: \"hi\", unicode: \"\\u3072\"},\n {syllable: {alphabet: \"h\", consonant: \"h\", vowel: \"u\"}, romaji: \"fu\", unicode: \"\\u3075\"},\n {syllable: {alphabet: \"h\", consonant: \"h\", vowel: \"e\"}, romaji: \"he\", unicode: \"\\u3078\"},\n {syllable: {alphabet: \"h\", consonant: \"h\", vowel: \"o\"}, romaji: \"ho\", unicode: \"\\u307B\"},\n {syllable: {alphabet: \"h\", consonant: \"m\", vowel: \"a\"}, romaji: \"ma\", unicode: \"\\u307E\"},\n {syllable: {alphabet: \"h\", consonant: \"m\", vowel: \"i\"}, romaji: \"mi\", unicode: \"\\u307F\"},\n {syllable: {alphabet: \"h\", consonant: \"m\", vowel: \"u\"}, romaji: \"mu\", unicode: \"\\u3080\"},\n {syllable: {alphabet: \"h\", consonant: \"m\", vowel: \"e\"}, romaji: \"me\", unicode: \"\\u3081\"},\n {syllable: {alphabet: \"h\", consonant: \"m\", vowel: \"o\"}, romaji: \"mo\", unicode: \"\\u3082\"},\n {syllable: {alphabet: \"h\", consonant: \"y\", vowel: \"a\"}, romaji: \"ya\", unicode: \"\\u3084\"},\n {syllable: {alphabet: \"h\", consonant: \"y\", vowel: \"u\"}, romaji: \"yu\", unicode: \"\\u3086\"},\n {syllable: {alphabet: \"h\", consonant: \"y\", vowel: \"o\"}, romaji: \"yo\", unicode: \"\\u3088\"},\n {syllable: {alphabet: \"h\", consonant: \"r\", vowel: \"a\"}, romaji: \"ra\", unicode: \"\\u3089\"},\n {syllable: {alphabet: \"h\", consonant: \"r\", vowel: \"i\"}, romaji: \"ri\", unicode: \"\\u308A\"},\n {syllable: {alphabet: \"h\", consonant: \"r\", vowel: \"u\"}, romaji: \"ru\", unicode: \"\\u308B\"},\n {syllable: {alphabet: \"h\", consonant: \"r\", vowel: \"e\"}, romaji: \"re\", unicode: \"\\u308C\"},\n {syllable: {alphabet: \"h\", consonant: \"r\", vowel: \"o\"}, romaji: \"ro\", unicode: \"\\u308D\"},\n {syllable: {alphabet: \"h\", consonant: \"w\", vowel: \"a\"}, romaji: \"wa\", unicode: \"\\u308F\"},\n {syllable: {alphabet: \"h\", consonant: \"w\", vowel: \"o\"}, romaji: \"wo\", unicode: \"\\u3092\"},\n {syllable: {alphabet: \"h\", consonant: \"\", vowel: \"n\"}, romaji: \"n\", unicode: \"\\u3093\"},\n {syllable: {alphabet: \"h\", consonant: \"g\", vowel: \"a\"}, romaji: \"ga\", unicode: \"\\u304C\"},\n {syllable: {alphabet: \"h\", consonant: \"g\", vowel: \"i\"}, romaji: \"gi\", unicode: \"\\u304E\"},\n {syllable: {alphabet: \"h\", consonant: \"g\", vowel: \"u\"}, romaji: \"gu\", unicode: \"\\u3050\"},\n {syllable: {alphabet: \"h\", consonant: \"g\", vowel: \"e\"}, romaji: \"ge\", unicode: \"\\u3052\"},\n {syllable: {alphabet: \"h\", consonant: \"g\", vowel: \"o\"}, romaji: \"go\", unicode: \"\\u3054\"},\n {syllable: {alphabet: \"h\", consonant: \"z\", vowel: \"a\"}, romaji: \"za\", unicode: \"\\u3056\"},\n {syllable: {alphabet: \"h\", consonant: \"z\", vowel: \"i\"}, romaji: \"ji\", unicode: \"\\u3058\"},\n {syllable: {alphabet: \"h\", consonant: \"z\", vowel: \"u\"}, romaji: \"zu\", unicode: \"\\u305A\"},\n {syllable: {alphabet: \"h\", consonant: \"z\", vowel: \"e\"}, romaji: \"ze\", unicode: \"\\u305C\"},\n {syllable: {alphabet: \"h\", consonant: \"z\", vowel: \"o\"}, romaji: \"zo\", unicode: \"\\u305E\"},\n {syllable: {alphabet: \"h\", consonant: \"d\", vowel: \"a\"}, romaji: \"da\", unicode: \"\\u3060\"},\n {syllable: {alphabet: \"h\", consonant: \"d\", vowel: \"i\"}, romaji: \"ji\", unicode: \"\\u3062\"},\n {syllable: {alphabet: \"h\", consonant: \"d\", vowel: \"u\"}, romaji: \"zu\", unicode: \"\\u3065\"},\n {syllable: {alphabet: \"h\", consonant: \"d\", vowel: \"e\"}, romaji: \"de\", unicode: \"\\u3067\"},\n {syllable: {alphabet: \"h\", consonant: \"d\", vowel: \"o\"}, romaji: \"do\", unicode: \"\\u3069\"},\n {syllable: {alphabet: \"h\", consonant: \"b\", vowel: \"a\"}, romaji: \"ba\", unicode: \"\\u3070\"},\n {syllable: {alphabet: \"h\", consonant: \"b\", vowel: \"i\"}, romaji: \"bi\", unicode: \"\\u3073\"},\n {syllable: {alphabet: \"h\", consonant: \"b\", vowel: \"u\"}, romaji: \"bu\", unicode: \"\\u3076\"},\n {syllable: {alphabet: \"h\", consonant: \"b\", vowel: \"e\"}, romaji: \"be\", unicode: \"\\u3079\"},\n {syllable: {alphabet: \"h\", consonant: \"b\", vowel: \"o\"}, romaji: \"bo\", unicode: \"\\u307C\"},\n {syllable: {alphabet: \"h\", consonant: \"p\", vowel: \"a\"}, romaji: \"pa\", unicode: \"\\u3071\"},\n {syllable: {alphabet: \"h\", consonant: \"p\", vowel: \"i\"}, romaji: \"pi\", unicode: \"\\u3074\"},\n {syllable: {alphabet: \"h\", consonant: \"p\", vowel: \"u\"}, romaji: \"pu\", unicode: \"\\u3077\"},\n {syllable: {alphabet: \"h\", consonant: \"p\", vowel: \"e\"}, romaji: \"pe\", unicode: \"\\u307A\"},\n {syllable: {alphabet: \"h\", consonant: \"p\", vowel: \"o\"}, romaji: \"po\", unicode: \"\\u307D\"},\n\n {syllable: {alphabet: \"k\", consonant: \"\", vowel: \"a\"}, romaji: \"a\", unicode: \"\\u30A2\"},\n {syllable: {alphabet: \"k\", consonant: \"\", vowel: \"i\"}, romaji: \"i\", unicode: \"\\u30A4\"},\n {syllable: {alphabet: \"k\", consonant: \"\", vowel: \"u\"}, romaji: \"u\", unicode: \"\\u30A6\"},\n {syllable: {alphabet: \"k\", consonant: \"\", vowel: \"e\"}, romaji: \"e\", unicode: \"\\u30A8\"},\n {syllable: {alphabet: \"k\", consonant: \"\", vowel: \"o\"}, romaji: \"o\", unicode: \"\\u30AA\"},\n {syllable: {alphabet: \"k\", consonant: \"k\", vowel: \"a\"}, romaji: \"ka\", unicode: \"\\u30AB\"},\n {syllable: {alphabet: \"k\", consonant: \"k\", vowel: \"i\"}, romaji: \"ki\", unicode: \"\\u30AD\"},\n {syllable: {alphabet: \"k\", consonant: \"k\", vowel: \"u\"}, romaji: \"ku\", unicode: \"\\u30AF\"},\n {syllable: {alphabet: \"k\", consonant: \"k\", vowel: \"e\"}, romaji: \"ke\", unicode: \"\\u30B1\"},\n {syllable: {alphabet: \"k\", consonant: \"k\", vowel: \"o\"}, romaji: \"ko\", unicode: \"\\u30B3\"},\n {syllable: {alphabet: \"k\", consonant: \"s\", vowel: \"a\"}, romaji: \"sa\", unicode: \"\\u30B5\"},\n {syllable: {alphabet: \"k\", consonant: \"s\", vowel: \"i\"}, romaji: \"shi\", unicode: \"\\u30B7\"},\n {syllable: {alphabet: \"k\", consonant: \"s\", vowel: \"u\"}, romaji: \"su\", unicode: \"\\u30B9\"},\n {syllable: {alphabet: \"k\", consonant: \"s\", vowel: \"e\"}, romaji: \"se\", unicode: \"\\u30BB\"},\n {syllable: {alphabet: \"k\", consonant: \"s\", vowel: \"o\"}, romaji: \"so\", unicode: \"\\u30BD\"},\n {syllable: {alphabet: \"k\", consonant: \"t\", vowel: \"a\"}, romaji: \"ta\", unicode: \"\\u30BF\"},\n {syllable: {alphabet: \"k\", consonant: \"t\", vowel: \"i\"}, romaji: \"chi\", unicode: \"\\u30C1\"},\n {syllable: {alphabet: \"k\", consonant: \"t\", vowel: \"u\"}, romaji: \"tsu\", unicode: \"\\u30C4\"},\n {syllable: {alphabet: \"k\", consonant: \"t\", vowel: \"e\"}, romaji: \"te\", unicode: \"\\u30C6\"},\n {syllable: {alphabet: \"k\", consonant: \"t\", vowel: \"o\"}, romaji: \"to\", unicode: \"\\u30C8\"},\n {syllable: {alphabet: \"k\", consonant: \"n\", vowel: \"a\"}, romaji: \"na\", unicode: \"\\u30CA\"},\n {syllable: {alphabet: \"k\", consonant: \"n\", vowel: \"i\"}, romaji: \"ni\", unicode: \"\\u30CB\"},\n {syllable: {alphabet: \"k\", consonant: \"n\", vowel: \"u\"}, romaji: \"nu\", unicode: \"\\u30CC\"},\n {syllable: {alphabet: \"k\", consonant: \"n\", vowel: \"e\"}, romaji: \"ne\", unicode: \"\\u30CD\"},\n {syllable: {alphabet: \"k\", consonant: \"n\", vowel: \"o\"}, romaji: \"no\", unicode: \"\\u30CE\"},\n {syllable: {alphabet: \"k\", consonant: \"h\", vowel: \"a\"}, romaji: \"ha\", unicode: \"\\u30CF\"},\n {syllable: {alphabet: \"k\", consonant: \"h\", vowel: \"i\"}, romaji: \"hi\", unicode: \"\\u30D2\"},\n {syllable: {alphabet: \"k\", consonant: \"h\", vowel: \"u\"}, romaji: \"fu\", unicode: \"\\u30D5\"},\n {syllable: {alphabet: \"k\", consonant: \"h\", vowel: \"e\"}, romaji: \"he\", unicode: \"\\u30D8\"},\n {syllable: {alphabet: \"k\", consonant: \"h\", vowel: \"o\"}, romaji: \"ho\", unicode: \"\\u30DB\"},\n {syllable: {alphabet: \"k\", consonant: \"m\", vowel: \"a\"}, romaji: \"ma\", unicode: \"\\u30DE\"},\n {syllable: {alphabet: \"k\", consonant: \"m\", vowel: \"i\"}, romaji: \"mi\", unicode: \"\\u30DF\"},\n {syllable: {alphabet: \"k\", consonant: \"m\", vowel: \"u\"}, romaji: \"mu\", unicode: \"\\u30E0\"},\n {syllable: {alphabet: \"k\", consonant: \"m\", vowel: \"e\"}, romaji: \"me\", unicode: \"\\u30E1\"},\n {syllable: {alphabet: \"k\", consonant: \"m\", vowel: \"o\"}, romaji: \"mo\", unicode: \"\\u30E2\"},\n {syllable: {alphabet: \"k\", consonant: \"y\", vowel: \"a\"}, romaji: \"ya\", unicode: \"\\u30E4\"},\n {syllable: {alphabet: \"k\", consonant: \"y\", vowel: \"u\"}, romaji: \"yu\", unicode: \"\\u30E6\"},\n {syllable: {alphabet: \"k\", consonant: \"y\", vowel: \"o\"}, romaji: \"yo\", unicode: \"\\u30E8\"},\n {syllable: {alphabet: \"k\", consonant: \"r\", vowel: \"a\"}, romaji: \"ra\", unicode: \"\\u30E9\"},\n {syllable: {alphabet: \"k\", consonant: \"r\", vowel: \"i\"}, romaji: \"ri\", unicode: \"\\u30EA\"},\n {syllable: {alphabet: \"k\", consonant: \"r\", vowel: \"u\"}, romaji: \"ru\", unicode: \"\\u30EB\"},\n {syllable: {alphabet: \"k\", consonant: \"r\", vowel: \"e\"}, romaji: \"re\", unicode: \"\\u30EC\"},\n {syllable: {alphabet: \"k\", consonant: \"r\", vowel: \"o\"}, romaji: \"ro\", unicode: \"\\u30ED\"},\n {syllable: {alphabet: \"k\", consonant: \"w\", vowel: \"a\"}, romaji: \"wa\", unicode: \"\\u30EF\"},\n {syllable: {alphabet: \"k\", consonant: \"w\", vowel: \"o\"}, romaji: \"wo\", unicode: \"\\u30F2\"},\n {syllable: {alphabet: \"k\", consonant: \"\", vowel: \"n\"}, romaji: \"n\", unicode: \"\\u30F3\"},\n {syllable: {alphabet: \"k\", consonant: \"g\", vowel: \"a\"}, romaji: \"ga\", unicode: \"\\u30AC\"},\n {syllable: {alphabet: \"k\", consonant: \"g\", vowel: \"i\"}, romaji: \"gi\", unicode: \"\\u30AE\"},\n {syllable: {alphabet: \"k\", consonant: \"g\", vowel: \"u\"}, romaji: \"gu\", unicode: \"\\u30B0\"},\n {syllable: {alphabet: \"k\", consonant: \"g\", vowel: \"e\"}, romaji: \"ge\", unicode: \"\\u30B2\"},\n {syllable: {alphabet: \"k\", consonant: \"g\", vowel: \"o\"}, romaji: \"go\", unicode: \"\\u30B4\"},\n {syllable: {alphabet: \"k\", consonant: \"z\", vowel: \"a\"}, romaji: \"za\", unicode: \"\\u30B6\"},\n {syllable: {alphabet: \"k\", consonant: \"z\", vowel: \"i\"}, romaji: \"ji\", unicode: \"\\u30B8\"},\n {syllable: {alphabet: \"k\", consonant: \"z\", vowel: \"u\"}, romaji: \"zu\", unicode: \"\\u30BA\"},\n {syllable: {alphabet: \"k\", consonant: \"z\", vowel: \"e\"}, romaji: \"ze\", unicode: \"\\u30BC\"},\n {syllable: {alphabet: \"k\", consonant: \"z\", vowel: \"o\"}, romaji: \"zo\", unicode: \"\\u30BE\"},\n {syllable: {alphabet: \"k\", consonant: \"d\", vowel: \"a\"}, romaji: \"da\", unicode: \"\\u30C0\"},\n {syllable: {alphabet: \"k\", consonant: \"d\", vowel: \"i\"}, romaji: \"ji\", unicode: \"\\u30C2\"},\n {syllable: {alphabet: \"k\", consonant: \"d\", vowel: \"u\"}, romaji: \"zu\", unicode: \"\\u30C5\"},\n {syllable: {alphabet: \"k\", consonant: \"d\", vowel: \"e\"}, romaji: \"de\", unicode: \"\\u30C7\"},\n {syllable: {alphabet: \"k\", consonant: \"d\", vowel: \"o\"}, romaji: \"do\", unicode: \"\\u30C9\"},\n {syllable: {alphabet: \"k\", consonant: \"b\", vowel: \"a\"}, romaji: \"ba\", unicode: \"\\u30D0\"},\n {syllable: {alphabet: \"k\", consonant: \"b\", vowel: \"i\"}, romaji: \"bi\", unicode: \"\\u30D3\"},\n {syllable: {alphabet: \"k\", consonant: \"b\", vowel: \"u\"}, romaji: \"bu\", unicode: \"\\u30D6\"},\n {syllable: {alphabet: \"k\", consonant: \"b\", vowel: \"e\"}, romaji: \"be\", unicode: \"\\u30D9\"},\n {syllable: {alphabet: \"k\", consonant: \"b\", vowel: \"o\"}, romaji: \"bo\", unicode: \"\\u30DC\"},\n {syllable: {alphabet: \"k\", consonant: \"p\", vowel: \"a\"}, romaji: \"pa\", unicode: \"\\u30D1\"},\n {syllable: {alphabet: \"k\", consonant: \"p\", vowel: \"i\"}, romaji: \"pi\", unicode: \"\\u30D4\"},\n {syllable: {alphabet: \"k\", consonant: \"p\", vowel: \"u\"}, romaji: \"pu\", unicode: \"\\u30D7\"},\n {syllable: {alphabet: \"k\", consonant: \"p\", vowel: \"e\"}, romaji: \"pe\", unicode: \"\\u30DA\"},\n {syllable: {alphabet: \"k\", consonant: \"p\", vowel: \"o\"}, romaji: \"po\", unicode: \"\\u30DD\"},\n ]\n }\n }",
"viewTranslation() {\n switch(this.state.CurrentViewIndex) {\n case 0 :\n return \"By Student\";\n case 1 :\n return \"By Poem\";\n default:\n return \"\";\n }\n }",
"function isVariantLabel(v) {\n return typeof v === \"string\" || isVariantLabels(v);\n}",
"function isVariantLabel(v) {\n return typeof v === \"string\" || isVariantLabels(v);\n}",
"function isVariantLabel(v) {\n return typeof v === \"string\" || isVariantLabels(v);\n}",
"function isVariantLabel(v) {\n return typeof v === \"string\" || isVariantLabels(v);\n}",
"function translationLabels(){\n /** This help array shows the hints for this experiment */\n\t\t\t\thelpArray=[_(\"help1\"),_(\"help2\"),_(\"help3\"),_(\"help4\"),_(\"help5\"),_(\"help6\"),_(\"help7\"),_(\"Next\"),_(\"Close\"),_(\"help8\"),_(\"help9\")];\n scope.heading=_(\"Emission spectra\");\n\t\t\t\tscope.variables=_(\"Variables\"); \n\t\t\t\tscope.result=_(\"Result\"); \n\t\t\t\tscope.copyright=_(\"copyright\"); \n\t\t\t\tscope.calibrate_txt = _(\"Reset\");\n scope.calibrate_slider_txt = _(\"Calibrate Telescope :\");\n scope.select_lamp_txt = _(\"Select Lamp :\");\n light_on_txt = _(\"Switch On Light\");\n light_off_txt = _(\"Switch Off Light\");\n place_grating_txt = _(\"Place grating\");\n remove_grating_txt = _(\"Remove grating\");\n scope.telescope_angle_txt = _(\"Angle of Telescope :\");\n scope.vernier_table_angle_txt = _(\"Angle of Vernier Table :\");\n scope.fine_angle_txt = _(\"Fine Angle of Telescope :\");\n scope.start_txt = _(\"Start\");\n\t\t\t\tscope.reset_txt = _(\"Reset\");\n scope.lamp_array = [{\n lamp:_(\"Mercury\"),\n index:0\n },{\n lamp:_(\"Hydrogen\"),\n index:1\n },{\n lamp:_(\"Neon\"),\n index:2\n }];\n scope.$apply();\t\t\t\t\n\t\t\t}",
"function nounForms() {\n return [...Array(28).keys()].map(i => (plurality[i >= cases.length ? 1 : 0] + \" \" + cases[i % cases.length]));\n}",
"function __doubleMetaphone(value) {\n var primary = '',\n secondary = '',\n index = 0,\n length = value.length,\n last = length - 1,\n isSlavoGermanic = SLAVO_GERMANIC.test(value),\n isGermanic = GERMANIC.test(value),\n characters = value.split(''),\n subvalue,\n next,\n prev,\n nextnext;\n\n value = String(value).toUpperCase() + ' ';\n\n // Skip this at beginning of word.\n if (INITIAL_EXCEPTIONS.test(value))\n index++;\n\n // Initial X is pronounced Z, which maps to S. Such as `Xavier`\n if (characters[0] === 'X') {\n primary += 'S';\n secondary += 'S';\n\n index++;\n }\n\n while (index < length) {\n prev = characters[index - 1];\n next = characters[index + 1];\n nextnext = characters[index + 2];\n\n switch (characters[index]) {\n case 'A':\n case 'E':\n case 'I':\n case 'O':\n case 'U':\n case 'Y':\n case 'À':\n case 'Ê':\n case 'É':\n case 'É':\n if (index === 0) {\n // All initial vowels now map to `A`.\n primary += 'A';\n secondary += 'A';\n }\n\n index++;\n\n break;\n case 'B':\n primary += 'P';\n secondary += 'P';\n\n if (next === 'B')\n index++;\n\n index++;\n\n break;\n case 'Ç':\n primary += 'S';\n secondary += 'S';\n index++;\n\n break;\n case 'C':\n // Various Germanic:\n if (prev === 'A' &&\n next === 'H' &&\n nextnext !== 'I' &&\n !VOWELS.test(characters[index - 2]) &&\n (nextnext !== 'E' || (subvalue = value.slice(index - 2, index + 4) &&\n (subvalue === 'BACHER' || subvalue === 'MACHER')))\n ) {\n primary += 'K';\n secondary += 'K';\n index += 2;\n\n break;\n }\n\n // Special case for `Caesar`.\n if (index === 0 && value.slice(index + 1, index + 6) === 'AESAR') {\n primary += 'S';\n secondary += 'S';\n index += 2;\n\n break;\n }\n\n // Italian `Chianti`.\n if (value.slice(index + 1, index + 4) === 'HIA') {\n primary += 'K';\n secondary += 'K';\n index += 2;\n\n break;\n }\n\n if (next === 'H') {\n // Find `Michael`.\n if (index > 0 && nextnext === 'A' && characters[index + 3] === 'E') {\n primary += 'K';\n secondary += 'X';\n index += 2;\n\n break;\n }\n\n // Greek roots such as `chemistry`, `chorus`.\n if (index === 0 && GREEK_INITIAL_CH.test(value)) {\n primary += 'K';\n secondary += 'K';\n index += 2;\n\n break;\n }\n\n // Germanic, Greek, or otherwise `CH` for `KH` sound.\n if (isGermanic ||\n // Such as 'architect' but not 'arch', orchestra', 'orchid'.\n GREEK_CH.test(value.slice(index - 2, index + 4)) ||\n (nextnext === 'T' || nextnext === 'S') ||\n ((index === 0 ||\n prev === 'A' ||\n prev === 'E' ||\n prev === 'O' ||\n prev === 'U') &&\n // Such as `wachtler`, `weschsler`, but not `tichner`.\n CH_FOR_KH.test(nextnext))\n ) {\n primary += 'K';\n secondary += 'K';\n } else if (index === 0) {\n primary += 'X';\n secondary += 'X';\n } else if (value.slice(0, 2) === 'MC') { // Such as 'McHugh'.\n // Bug? Why matching absolute? what about McHiccup?\n primary += 'K';\n secondary += 'K';\n } else {\n primary += 'X';\n secondary += 'K';\n }\n\n index += 2;\n\n break;\n }\n\n // Such as `Czerny`.\n if (next === 'Z' && value.slice(index - 2, index) !== 'WI') {\n primary += 'S';\n secondary += 'X';\n index += 2;\n\n break;\n }\n\n // Such as `Focaccia`.\n if (value.slice(index + 1, index + 4) === 'CIA') {\n primary += 'X';\n secondary += 'X';\n index += 3;\n\n break;\n }\n\n // Double `C`, but not `McClellan`.\n if (next === 'C' && !(index === 1 && characters[0] === 'M')) {\n // Such as `Bellocchio`, but not `Bacchus`.\n if ((nextnext === 'I' ||\n nextnext === 'E' ||\n nextnext === 'H') &&\n value.slice(index + 2, index + 4) !== 'HU'\n ) {\n subvalue = value.slice(index - 1, index + 4);\n\n // Such as `Accident`, `Accede`, `Succeed`.\n if ((index === 1 && prev === 'A') || subvalue === 'UCCEE' || subvalue === 'UCCES') {\n primary += 'KS';\n secondary += 'KS';\n } else { // Such as `Bacci`, `Bertucci`, other Italian.\n primary += 'X';\n secondary += 'X';\n }\n\n index += 3;\n\n break;\n } else {\n // Pierce's rule.\n primary += 'K';\n secondary += 'K';\n index += 2;\n\n break;\n }\n }\n\n if (next === 'G' || next === 'K' || next === 'Q') {\n primary += 'K';\n secondary += 'K';\n index += 2;\n\n break;\n }\n\n // Italian.\n if (next === 'I' && (nextnext === 'A' || nextnext === 'E' || nextnext === 'O')) {\n primary += 'S';\n secondary += 'X';\n index += 2;\n\n break;\n }\n\n if (next === 'I' || next === 'E' || next === 'Y') {\n primary += 'S';\n secondary += 'S';\n index += 2;\n\n break;\n }\n\n primary += 'K';\n secondary += 'K';\n\n // Skip two extra characters ahead in `Mac Caffrey`, `Mac Gregor`.\n if (next === ' ' && (nextnext === 'C' || nextnext === 'G' || nextnext === 'Q')) {\n index += 3;\n break;\n }\n\n if (next === 'K' || next === 'Q' || (next === 'C' && nextnext !== 'E' && nextnext !== 'I'))\n index++;\n\n index++;\n\n break;\n case 'D':\n if (next === 'G') {\n // Such as `edge`.\n if (nextnext === 'E' || nextnext === 'I' || nextnext === 'Y') {\n primary += 'J';\n secondary += 'J';\n index += 3;\n } else { // Such as `Edgar`.\n primary += 'TK';\n secondary += 'TK';\n index += 2;\n }\n\n break;\n }\n\n if (next === 'T' || next === 'D') {\n primary += 'T';\n secondary += 'T';\n index += 2;\n\n break;\n }\n\n primary += 'T';\n secondary += 'T';\n index++;\n\n break;\n case 'F':\n if (next === 'F')\n index++;\n\n index++;\n primary += 'F';\n secondary += 'F';\n\n break;\n case 'G':\n if (next === 'H') {\n if (index > 0 && !VOWELS.test(prev)) {\n primary += 'K';\n secondary += 'K';\n index += 2;\n\n break;\n }\n\n // Such as `Ghislane`, `Ghiradelli`.\n if (index === 0) {\n if (nextnext === 'I') {\n primary += 'J';\n secondary += 'J';\n } else {\n primary += 'K';\n secondary += 'K';\n }\n index += 2;\n break;\n }\n\n // Parker's rule (with some further refinements).\n if ((// Such as `Hugh`\n subvalue = characters[index - 2],\n subvalue === 'B' ||\n subvalue === 'H' ||\n subvalue === 'D'\n ) ||\n (// Such as `bough`.\n subvalue = characters[index - 3],\n subvalue === 'B' ||\n subvalue === 'H' ||\n subvalue === 'D'\n ) ||\n (// Such as `Broughton`.\n subvalue = characters[index - 4],\n subvalue === 'B' ||\n subvalue === 'H'\n )\n ) {\n index += 2;\n\n break;\n }\n\n // Such as `laugh`, `McLaughlin`, `cough`, `gough`, `rough`, `tough`.\n if (index > 2 && prev === 'U' && G_FOR_F.test(characters[index - 3])) {\n primary += 'F';\n secondary += 'F';\n } else if (index > 0 && prev !== 'I') {\n primary += 'K';\n secondary += 'K';\n }\n\n index += 2;\n\n break;\n }\n\n if (next === 'N') {\n if (index === 1 && VOWELS.test(characters[0]) && !isSlavoGermanic) {\n primary += 'KN';\n secondary += 'N';\n } else if (\n // Not like `Cagney`.\n value.slice(index + 2, index + 4) !== 'EY' &&\n value.slice(index + 1) !== 'Y' &&\n !isSlavoGermanic\n ) {\n primary += 'N';\n secondary += 'KN';\n } else {\n primary += 'KN';\n secondary += 'KN';\n }\n\n index += 2;\n\n break;\n }\n\n //Such as `Tagliaro`.\n if (value.slice(index + 1, index + 3) === 'LI' && !isSlavoGermanic) {\n primary += 'KL';\n secondary += 'L';\n index += 2;\n\n break;\n }\n\n // -ges-, -gep-, -gel- at beginning.\n if (index === 0 && INITIAL_G_FOR_KJ.test(value.slice(1, 3))) {\n primary += 'K';\n secondary += 'J';\n index += 2;\n\n break;\n }\n\n // -ger-, -gy-.\n if ((value.slice(index + 1, index + 3) === 'ER' &&\n prev !== 'I' && prev !== 'E' &&\n !INITIAL_ANGER_EXCEPTION.test(value.slice(0, 6))\n ) ||\n (next === 'Y' && !G_FOR_KJ.test(prev))\n ) {\n primary += 'K';\n secondary += 'J';\n index += 2;\n\n break;\n }\n\n // Italian such as `biaggi`.\n if (next === 'E' || next === 'I' || next === 'Y' || (\n (prev === 'A' || prev === 'O') &&\n next === 'G' && nextnext === 'I'\n )\n ) {\n // Obvious Germanic.\n if (value.slice(index + 1, index + 3) === 'ET' || isGermanic) {\n primary += 'K';\n secondary += 'K';\n } else {\n // Always soft if French ending.\n if (value.slice(index + 1, index + 5) === 'IER ') {\n primary += 'J';\n secondary += 'J';\n } else {\n primary += 'J';\n secondary += 'K';\n }\n }\n\n index += 2;\n\n break;\n }\n\n if (next === 'G')\n index++;\n\n index++;\n\n primary += 'K';\n secondary += 'K';\n\n break;\n case 'H':\n // Only keep if first & before vowel or btw. 2 vowels.\n if (VOWELS.test(next) && (index === 0 || VOWELS.test(prev))) {\n primary += 'H';\n secondary += 'H';\n\n index++;\n }\n\n index++;\n\n break;\n case 'J':\n // Obvious Spanish, `jose`, `San Jacinto`.\n if (value.slice(index, index + 4) === 'JOSE' || value.slice(0, 4) === 'SAN ') {\n if (value.slice(0, 4) === 'SAN ' || (index === 0 && characters[index + 4] === ' ')) {\n primary += 'H';\n secondary += 'H';\n } else {\n primary += 'J';\n secondary += 'H';\n }\n\n index++;\n\n break;\n }\n\n if (index === 0) {\n // Such as `Yankelovich` or `Jankelowicz`.\n primary += 'J';\n secondary += 'A';\n } else if (// Spanish pron. of such as `bajador`.\n !isSlavoGermanic &&\n (next === 'A' || next === 'O') &&\n VOWELS.test(prev)\n ) {\n primary += 'J';\n secondary += 'H';\n } else if (index === last) {\n primary += 'J';\n } else if (prev !== 'S' && prev !== 'K' && prev !== 'L' && !J_FOR_J_EXCEPTION.test(next)) {\n primary += 'J';\n secondary += 'J';\n } else if (next === 'J') {\n index++;\n }\n\n index++;\n\n break;\n case 'K':\n if (next === 'K')\n index++;\n\n primary += 'K';\n secondary += 'K';\n index++;\n\n break;\n case 'L':\n if (next === 'L') {\n // Spanish such as `cabrillo`, `gallegos`.\n if ((index === length - 3 && ((\n prev === 'I' && (\n nextnext === 'O' || nextnext === 'A'\n )\n ) || (\n prev === 'A' && nextnext === 'E'\n )\n )) || (\n prev === 'A' && nextnext === 'E' && ((\n characters[last] === 'A' || characters[last] === 'O'\n ) || ALLE.test(value.slice(last - 1, length))\n )\n )\n ) {\n primary += 'L';\n index += 2;\n\n break;\n }\n\n index++;\n }\n\n primary += 'L';\n secondary += 'L';\n index++;\n\n break;\n case 'M':\n // Such as `dumb`, `thumb`.\n if (next === 'M' || (\n prev === 'U' && next === 'B' && (\n index + 1 === last || value.slice(index + 2, index + 4) === 'ER')\n )\n ) {\n index++;\n }\n\n index++;\n primary += 'M';\n secondary += 'M';\n\n break;\n case 'N':\n if (next === 'N')\n index++;\n\n index++;\n primary += 'N';\n secondary += 'N';\n\n break;\n case 'Ñ':\n index++;\n primary += 'N';\n secondary += 'N';\n\n break;\n case 'P':\n if (next === 'H') {\n primary += 'F';\n secondary += 'F';\n index += 2;\n\n break;\n }\n\n // Also account for `campbell` and `raspberry`.\n subvalue = next;\n\n if (subvalue === 'P' || subvalue === 'B')\n index++;\n\n index++;\n\n primary += 'P';\n secondary += 'P';\n\n break;\n case 'Q':\n if (next === 'Q') {\n index++;\n }\n\n index++;\n primary += 'K';\n secondary += 'K';\n\n break;\n case 'R':\n // French such as `Rogier`, but exclude `Hochmeier`.\n if (index === last &&\n !isSlavoGermanic &&\n prev === 'E' &&\n characters[index - 2] === 'I' &&\n characters[index - 4] !== 'M' && (\n characters[index - 3] !== 'E' &&\n characters[index - 3] !== 'A'\n )\n ) {\n secondary += 'R';\n } else {\n primary += 'R';\n secondary += 'R';\n }\n\n if (next === 'R')\n index++;\n\n index++;\n\n break;\n case 'S':\n // Special cases `island`, `isle`, `carlisle`, `carlysle`.\n if (next === 'L' && (prev === 'I' || prev === 'Y')) {\n index++;\n\n break;\n }\n\n // Special case `sugar-`.\n if (index === 0 && value.slice(1, 5) === 'UGAR') {\n primary += 'X';\n secondary += 'S';\n index++;\n\n break;\n }\n\n if (next === 'H') {\n // Germanic.\n if (H_FOR_S.test(value.slice(index + 1, index + 5))) {\n primary += 'S';\n secondary += 'S';\n } else {\n primary += 'X';\n secondary += 'X';\n }\n\n index += 2;\n break;\n }\n\n if (next === 'I' && (nextnext === 'O' || nextnext === 'A')) {\n if (!isSlavoGermanic) {\n primary += 'S';\n secondary += 'X';\n } else {\n primary += 'S';\n secondary += 'S';\n }\n\n index += 3;\n\n break;\n }\n\n /*\n * German & Anglicization's, such as `Smith` match `Schmidt`,\n * `snider` match `Schneider`. Also, -sz- in slavic language\n * although in hungarian it is pronounced `s`.\n */\n if (next === 'Z' || (\n index === 0 && (\n next === 'L' || next === 'M' || next === 'N' || next === 'W'\n )\n )\n ) {\n primary += 'S';\n secondary += 'X';\n\n if (next === 'Z')\n index++;\n\n index++;\n\n break;\n }\n\n if (next === 'C') {\n // Schlesinger's rule.\n if (nextnext === 'H') {\n subvalue = value.slice(index + 3, index + 5);\n\n // Dutch origin, such as `school`, `schooner`.\n if (DUTCH_SCH.test(subvalue)) {\n // Such as `schermerhorn`, `schenker`.\n if (subvalue === 'ER' || subvalue === 'EN') {\n primary += 'X';\n secondary += 'SK';\n } else {\n primary += 'SK';\n secondary += 'SK';\n }\n\n index += 3;\n\n break;\n }\n\n if (index === 0 && !VOWELS.test(characters[3]) && characters[3] !== 'W') {\n primary += 'X';\n secondary += 'S';\n } else {\n primary += 'X';\n secondary += 'X';\n }\n\n index += 3;\n\n break;\n }\n\n if (nextnext === 'I' || nextnext === 'E' || nextnext === 'Y') {\n primary += 'S';\n secondary += 'S';\n index += 3;\n break;\n }\n\n primary += 'SK';\n secondary += 'SK';\n index += 3;\n\n break;\n }\n\n subvalue = value.slice(index - 2, index);\n\n // French such as `resnais`, `artois`.\n if (index === last && (subvalue === 'AI' || subvalue === 'OI')) {\n secondary += 'S';\n } else {\n primary += 'S';\n secondary += 'S';\n }\n\n if (next === 'S' || next === 'Z')\n index++;\n\n index++;\n\n break;\n case 'T':\n if (next === 'I' && nextnext === 'O' && characters[index + 3] === 'N') {\n primary += 'X';\n secondary += 'X';\n index += 3;\n\n break;\n }\n\n subvalue = value.slice(index + 1, index + 3);\n\n if ((next === 'I' && nextnext === 'A') || (next === 'C' && nextnext === 'H')) {\n primary += 'X';\n secondary += 'X';\n index += 3;\n\n break;\n }\n\n if (next === 'H' || (next === 'T' && nextnext === 'H')) {\n // Special case `Thomas`, `Thames` or Germanic.\n if (isGermanic || ((nextnext === 'O' || nextnext === 'A') && characters[index + 3] === 'M')) {\n primary += 'T';\n secondary += 'T';\n } else {\n primary += '0';\n secondary += 'T';\n }\n\n index += 2;\n\n break;\n }\n\n if (next === 'T' || next === 'D')\n index++;\n\n index++;\n primary += 'T';\n secondary += 'T';\n\n break;\n case 'V':\n if (next === 'V')\n index++;\n\n primary += 'F';\n secondary += 'F';\n index++;\n\n break;\n case 'W':\n // Can also be in middle of word (as already taken care of for initial).\n if (next === 'R') {\n primary += 'R';\n secondary += 'R';\n index += 2;\n\n break;\n }\n\n if (index === 0) {\n // `Wasserman` should match `Vasserman`.\n if (VOWELS.test(next)) {\n primary += 'A';\n secondary += 'F';\n } else if (next === 'H') {\n // Need `Uomo` to match `Womo`.\n primary += 'A';\n secondary += 'A';\n }\n }\n\n // `Arnow` should match `Arnoff`.\n if (((prev === 'E' || prev === 'O') &&\n next === 'S' && nextnext === 'K' && (\n characters[index + 3] === 'I' ||\n characters[index + 3] === 'Y'\n )\n ) || value.slice(0, 3) === 'SCH' || (index === last && VOWELS.test(prev))\n ) {\n secondary += 'F';\n index++;\n\n break;\n }\n\n // Polish such as `Filipowicz`.\n if (next === 'I' && (nextnext === 'C' || nextnext === 'T') && characters[index + 3] === 'Z') {\n primary += 'TS';\n secondary += 'FX';\n index += 4;\n\n break;\n }\n\n index++;\n\n break;\n case 'X':\n // French such as `breaux`.\n if (index === last || (prev === 'U' && (\n characters[index - 2] === 'A' ||\n characters[index - 2] === 'O'\n ))\n ) {\n primary += 'KS';\n secondary += 'KS';\n }\n\n if (next === 'C' || next === 'X')\n index++;\n\n index++;\n\n break;\n case 'Z':\n // Chinese pinyin such as `Zhao`.\n if (next === 'H') {\n primary += 'J';\n secondary += 'J';\n index += 2;\n\n break;\n } else if ((next === 'Z' && (\n nextnext === 'A' || nextnext === 'I' || nextnext === 'O'\n )) || (\n isSlavoGermanic && index > 0 && prev !== 'T'\n )\n ) {\n primary += 'S';\n secondary += 'TS';\n } else {\n primary += 'S';\n secondary += 'S';\n }\n\n if (next === 'Z')\n index++;\n\n index++;\n\n break;\n default:\n index++;\n\n }\n }\n\n return [primary, secondary];\n }",
"function toSyllable(){\n if(syllables.length > 1){\n currentColor = syllables[syllables.length-1].color;\n }\n document.getElementById(\"input\").innerHTML = syllableForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n}",
"alist2string(u, elab=0, vlab=0) {\n\t\tlet s = '';\n\t\tfor (let e = this.firstAt(u); e != 0; e = this.nextAt(u, e)) {\n\t\t\tlet ns = elab(e,u);\n\t\t\tif (s.length > 0 && ns.length > 0) s += ' ';\n\t\t\ts += ns;\n\t\t}\n\t\treturn vlab(u) + (s ? `[${s}]` : '');\n\t}",
"static theRealNameOfTheVirus(extended = false){\n if(extended){\n return \"No, the SARS-CoV-2 coronavirus causes the CoVID-19 disease.\"\n }else{\n return false;\n }\n }",
"function translationLabels(){\n /** This help array shows the hints for this experiment */\n\t\t\t\thelpArray = [_(\"Next\"),_(\"Close\"),_(\"help1\"),_(\"help2\"),_(\"help3\"),_(\"help4\"),_(\"help5\"),_(\"help6\"),_(\"help7\"),_(\"help8\"),_(\"help9\"),_(\"help10\")];\n scope.heading = _(\"Young's Modulus-Uniform Bending\");\n\t\t\t\tscope.variables = _(\"Variables\"); \n\t\t\t\tscope.result = _(\"Result\"); \n\t\t\t\tscope.copyright = _(\"copyright\"); \n\t\t\t\tscope.environment_lbl = _(\"Select Environment\");\n\t\t\t\tscope.material_lbl = _(\"Select Material\");\n\t\t\t\tscope.mass_lbl = _(\"Mass of weight hanger : \");\n\t\t\t\tscope.material_lbl = _(\"Select Material\");\n\t\t\t\tscope.unit_gram = _(\"g\");\n\t\t\t\tscope.unit_cm = _(\"cm\");\n\t\t\t\tscope.breadth_lbl = _(\"Breadth of bar(b) : \");\n scope.thickness_lbl = _(\"Thickness of bar(d) : \");\n scope.blade_distance_lbl = _(\"Knife edge distance : \");\n scope.weight_hangers_distance_lbl = _(\"Weight hangers distance : \");\n scope.reset = _(\"Reset\");\n\t\t\t\tscope.result_txt = _(\"Young's Modulus of \");\n\t\t\t\tscope.environment_array = [{\n environment: _('Earth, g=9.8m/s'),\n value: 9.8\n }, {\n environment: _('Moon, g=1.63m/s'),\n value: 1.63\n }, {\n environment: _('Uranus, g=10.67m/s'),\n value: 10.67\n }, {\n environment: _('Saturn, g=11.08m/s'),\n value: 11.08\n }];\n scope.material_array = [{\n material: _('Wood'),\n value: 1.1\n }, {\n material: _('Aluminium'),\n value: 6.9\n }, {\n material: _('Copper'),\n value: 11.7\n }, {\n material: _('Steel'),\n value: 20\n }];\n\n scope.$apply();\t\t\t\t\n\t\t\t}",
"function undo_cyrillic_adjustments(graphemes) {\n\n var lzlls = { \n \"\\u043B\":\"l\", // CYRILLIC SMALL LETTER EL\n \"\\u0437\":\"z\", // CYRILLIC SMALL LETTER ZE\n \"\\u043B\\u044C\":\"ll\", // CYRILLIC SMALL LETTER EL and SMALL LETTER SOFT SIGN\n \"\\u0441\":\"s\", // CYRILLIC SMALL LETTER ES\n\n \"\\u041B\":\"L\", // CYRILLIC CAPITAL LETTER EL\n \"\\u0417\":\"Z\", // CYRILLIC CAPITAL LETTER ZE\n \"\\u0421\":\"S\", // CYRILLIC CAPITAL LETTER ES\n \"\\u041B\\u044C\":\"Ll\", // CYRILLIC CAPITAL LETTER EL and SMALL LETTER SOFT SIGN\n } \n\n var undo_lzlls = {\n \"\\u044F\\u0304\":\"\\u0430\\u0430\", // CYRILLIC SMALL LETTER YA with COMBINING MACRON to 'aa'\n \"\\u044F\":\"\\u0430\", // CYRILLIC SMALL LETTER YA to 'a'\n \"\\u044E\\u0304\":\"\\u0443\\u0443\", // CYRILLIC SMALL LETTER YA with COMBINING MACRON to 'uu'\n \"\\u044E\":\"\\u0443\", // CYRILLIC SMALL LETTER YU to 'u'\n }\n\n // Moves labialization symbol, i.e. Small Letter U with Dieresis to post-consonant position\n var undo_labialC = {\n \"\\u043A\":\"\\u043A\\u04F1\", // CYRILLIC SMALL LETTER KA and SMALL LETTER U with DIERESIS\n \"\\u049B\":\"\\u049B\\u04F1\", // CYRILLIC SMALL LETTER KA with DESCENDER and SMALL LETTER U with DIERESIS \n \"\\u04F7\":\"\\u04F7\\u04F1\", // CYRILLIC SMALL LETTER GHE with DESCENDER and SMALL LETTER U with DIERESIS \n \"\\u0445\":\"\\u0445\\u04F1\", // CYRILLIC SMALL LETTER HA and SMALL LETTER U with DIERESIS\n \"\\u04B3\":\"\\u04B3\\u04F1\", // CYRILLIC SMALL LETTER HA with DESCENDER and SMALL LETTER U with DIERESIS\n \"\\u04A3\":\"\\u04A3\\u04F1\", // CYRILLIC SMALL LETTER EN with DESCENDER and SMALL LETTER U with DIERESIS\n \"\\u04A3\\u044C\":\"\\u04A3\\u044C\\u04F1\", // CYRILLIC SMALL LETTER EN with DESCENDER & SMALL LETTER SOFT SIGN\n // & SMALL LETTER U with DIERESIS\n }\n\n var result = []\n\n for (var i = 0; i < graphemes.length; i++) {\n var grapheme = graphemes[i]\n\n // ADJUSTMENT 2: Delete the Cyrillic soft sign that is inserted between 'ya'/'yu' and a consonant\n if (i < graphemes.length - 1 && grapheme == \"\\u044C\" && graphemes[i+1] in undo_lzlls) {\n result.push(graphemes[i+1])\n i++\n }\n\n // ADJUSTMENT 3: The 'ya', 'yu' Cyrillic representations are rewritten as 'a'\n // and 'u' if they follow the Cyrillic representations of 'l', 'z', 'll', 's'\n else if (i < graphemes.length - 1 && grapheme in lzlls && graphemes[i+1] in undo_lzlls) {\n result.push(grapheme, undo_lzlls[graphemes[i+1]])\n i++\n }\n \n // ADJUSTMENT - A labialization symbol that appears before the consonant\n // it labializes is moved to a position after the consonant\n else if (i < graphemes.length - 1 && grapheme == \"\\u04F1\" && graphemes[i+1] in undo_labialC) {\n result.push(undo_labialC[graphemes[i+1]])\n i++\n }\n\n // No adjustments applicable\n else {\n result.push(grapheme)\n }\n }\n\n return result\n}",
"function HyderabadTirupati() // extends PhoneticMapper\n{\n var map = [ \n new KeyMap(\"\\u0901\", \"?\", \"z\", true), // Candrabindu\n new KeyMap(\"\\u0902\", \"\\u1E41\", \"M\"), // Anusvara\n new KeyMap(\"\\u0903\", \"\\u1E25\", \"H\"), // Visarga\n new KeyMap(\"\\u1CF2\", \"\\u1E96\", \"Z\"), // jihvamuliya\n new KeyMap(\"\\u1CF2\", \"h\\u032C\", \"V\"), // upadhmaniya\n new KeyMap(\"\\u0905\", \"a\", \"a\"), // a\n new KeyMap(\"\\u0906\", \"\\u0101\", \"A\"), // long a\n new KeyMap(\"\\u093E\", null, \"A\", true), // long a attached\n new KeyMap(\"\\u0907\", \"i\", \"i\"), // i\n new KeyMap(\"\\u093F\", null, \"i\", true), // i attached\n new KeyMap(\"\\u0908\", \"\\u012B\", \"I\"), // long i\n new KeyMap(\"\\u0940\", null, \"I\", true), // long i attached\n new KeyMap(\"\\u0909\", \"u\", \"u\"), // u\n new KeyMap(\"\\u0941\", null, \"u\", true), // u attached\n new KeyMap(\"\\u090A\", \"\\u016B\", \"U\"), // long u\n new KeyMap(\"\\u0942\", null, \"U\", true), // long u attached\n new KeyMap(\"\\u090B\", \"\\u1E5B\", \"q\"), // vocalic r\n new KeyMap(\"\\u0943\", null, \"q\", true), // vocalic r attached\n new KeyMap(\"\\u0960\", \"\\u1E5D\", \"Q\"), // long vocalic r\n new KeyMap(\"\\u0944\", null, \"Q\", true), // long vocalic r attached\n new KeyMap(\"\\u090C\", \"\\u1E37\", \"L\"), // vocalic l\n new KeyMap(\"\\u0962\", null, \"L\", true), // vocalic l attached\n new KeyMap(\"\\u0961\", \"\\u1E39\", \"LY\"), // long vocalic l\n new KeyMap(\"\\u0963\", null, \"LY\", true), // long vocalic l attached\n new KeyMap(\"\\u090F\", \"e\", \"e\"), // e\n new KeyMap(\"\\u0947\", null, \"e\", true), // e attached\n new KeyMap(\"\\u0910\", \"ai\", \"E\"), // ai\n new KeyMap(\"\\u0948\", null, \"E\", true), // ai attached\n new KeyMap(\"\\u0913\", \"o\", \"o\"), // o\n new KeyMap(\"\\u094B\", null, \"o\", true), // o attached\n new KeyMap(\"\\u0914\", \"au\", \"O\"), // au\n new KeyMap(\"\\u094C\", null, \"O\", true), // au attached\n\n // velars\n new KeyMap(\"\\u0915\\u094D\", \"k\", \"k\"), // k\n new KeyMap(\"\\u0916\\u094D\", \"kh\", \"K\"), // kh\n new KeyMap(\"\\u0917\\u094D\", \"g\", \"g\"), // g\n new KeyMap(\"\\u0918\\u094D\", \"gh\", \"G\"), // gh\n new KeyMap(\"\\u0919\\u094D\", \"\\u1E45\", \"f\"), // velar n\n\n // palatals\n new KeyMap(\"\\u091A\\u094D\", \"c\", \"c\"), // c\n new KeyMap(\"\\u091B\\u094D\", \"ch\", \"C\"), // ch\n new KeyMap(\"\\u091C\\u094D\", \"j\", \"j\"), // j\n new KeyMap(\"\\u091D\\u094D\", \"jh\", \"J\"), // jh\n new KeyMap(\"\\u091E\\u094D\", \"\\u00F1\", \"F\"), // palatal n\n\n // retroflex\n new KeyMap(\"\\u091F\\u094D\", \"\\u1E6D\", \"t\"), // retroflex t\n new KeyMap(\"\\u0920\\u094D\", \"\\u1E6Dh\", \"T\"), // retroflex th\n new KeyMap(\"\\u0921\\u094D\", \"\\u1E0D\", \"d\"), // retroflex d\n new KeyMap(\"\\u0922\\u094D\", \"\\u1E0Dh\", \"D\"), // retroflex dh\n new KeyMap(\"\\u0923\\u094D\", \"\\u1E47\", \"N\"), // retroflex n\n new KeyMap(\"\\u0933\\u094D\", \"\\u1E37\", \"lY\"), // retroflex l\n new KeyMap(\"\\u0933\\u094D\\u0939\\u094D\", \"\\u1E37\", \"lYh\"), // retroflex lh\n\n // dental\n new KeyMap(\"\\u0924\\u094D\", \"t\", \"w\"), // dental t\n new KeyMap(\"\\u0925\\u094D\", \"th\", \"W\"), // dental th\n new KeyMap(\"\\u0926\\u094D\", \"d\", \"x\"), // dental d\n new KeyMap(\"\\u0927\\u094D\", \"dh\", \"X\"), // dental dh\n new KeyMap(\"\\u0928\\u094D\", \"n\", \"n\"), // dental n\n\n // labials\n new KeyMap(\"\\u092A\\u094D\", \"p\", \"p\"), // p\n new KeyMap(\"\\u092B\\u094D\", \"ph\", \"P\"), // ph\n new KeyMap(\"\\u092C\\u094D\", \"b\", \"b\"), // b\n new KeyMap(\"\\u092D\\u094D\", \"bh\", \"B\"), // bh\n new KeyMap(\"\\u092E\\u094D\", \"m\", \"m\"), // m\n\n // sibillants\n new KeyMap(\"\\u0936\\u094D\", \"\\u015B\", \"S\"), // palatal s\n new KeyMap(\"\\u0937\\u094D\", \"\\u1E63\", \"R\"), // retroflex s\n new KeyMap(\"\\u0938\\u094D\", \"s\", \"s\"), // dental s\n new KeyMap(\"\\u0939\\u094D\", \"h\", \"h\"), // h\n\n // semivowels\n new KeyMap(\"\\u092F\\u094D\", \"y\", \"y\"), // y\n new KeyMap(\"\\u0930\\u094D\", \"r\", \"r\"), // r\n new KeyMap(\"\\u0932\\u094D\", \"l\", \"l\"), // l\n new KeyMap(\"\\u0935\\u094D\", \"v\", \"v\"), // v\n\n\n // numerals\n new KeyMap(\"\\u0966\", \"0\", \"0\"), // 0\n new KeyMap(\"\\u0967\", \"1\", \"1\"), // 1\n new KeyMap(\"\\u0968\", \"2\", \"2\"), // 2\n new KeyMap(\"\\u0969\", \"3\", \"3\"), // 3\n new KeyMap(\"\\u096A\", \"4\", \"4\"), // 4\n new KeyMap(\"\\u096B\", \"5\", \"5\"), // 5\n new KeyMap(\"\\u096C\", \"6\", \"6\"), // 6\n new KeyMap(\"\\u096D\", \"7\", \"7\"), // 7\n new KeyMap(\"\\u096E\", \"8\", \"8\"), // 8\n new KeyMap(\"\\u096F\", \"9\", \"9\"), // 9\n\n // accents\n new KeyMap(\"\\u0951\", \"|\", \"|\"), // udatta\n new KeyMap(\"\\u0952\", \"_\", \"_\"), // anudatta\n new KeyMap(\"\\u0953\", null, \"//\"), // grave accent\n new KeyMap(\"\\u0954\", null, \"\\\\\"), // acute accent\n\n // miscellaneous\n new KeyMap(\"\\u0933\\u094D\", \"\\u1E37\", \"L\"), // retroflex l\n new KeyMap(\"\\u093D\", \"'\", \"'\"), // avagraha\n new KeyMap(\"\\u0950\", null, \"om\"), // om\n new KeyMap(\"\\u0964\", \".\", \".\") // single danda\n ];\n\n PhoneticMapper.call(this, map);\n}",
"function doubleMetaphone(value) {\n var primary = ''\n var secondary = ''\n var index = 0\n var length = value.length\n var last = length - 1\n var isSlavoGermanic\n var isGermanic\n var subvalue\n var next\n var prev\n var nextnext\n var characters\n\n value = String(value).toUpperCase() + ' '\n isSlavoGermanic = slavoGermanic.test(value)\n isGermanic = germanic.test(value)\n characters = value.split('')\n\n // Skip this at beginning of word.\n if (initialExceptions.test(value)) {\n index++\n }\n\n // Initial X is pronounced Z, which maps to S. Such as `Xavier`.\n if (characters[0] === 'X') {\n primary += 'S'\n secondary += 'S'\n index++\n }\n\n while (index < length) {\n prev = characters[index - 1]\n next = characters[index + 1]\n nextnext = characters[index + 2]\n\n switch (characters[index]) {\n case 'A':\n case 'E':\n case 'I':\n case 'O':\n case 'U':\n case 'Y':\n case 'À':\n case 'Ê':\n case 'É':\n if (index === 0) {\n // All initial vowels now map to `A`.\n primary += 'A'\n secondary += 'A'\n }\n\n index++\n\n break\n case 'B':\n primary += 'P'\n secondary += 'P'\n\n if (next === 'B') {\n index++\n }\n\n index++\n\n break\n case 'Ç':\n primary += 'S'\n secondary += 'S'\n index++\n\n break\n case 'C':\n // Various Germanic:\n if (\n prev === 'A' &&\n next === 'H' &&\n nextnext !== 'I' &&\n !vowels.test(characters[index - 2]) &&\n (nextnext !== 'E' ||\n (subvalue =\n value.slice(index - 2, index + 4) &&\n (subvalue === 'BACHER' || subvalue === 'MACHER')))\n ) {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n // Special case for `Caesar`.\n if (index === 0 && value.slice(index + 1, index + 6) === 'AESAR') {\n primary += 'S'\n secondary += 'S'\n index += 2\n\n break\n }\n\n // Italian `Chianti`.\n if (value.slice(index + 1, index + 4) === 'HIA') {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n if (next === 'H') {\n // Find `Michael`.\n if (index > 0 && nextnext === 'A' && characters[index + 3] === 'E') {\n primary += 'K'\n secondary += 'X'\n index += 2\n\n break\n }\n\n // Greek roots such as `chemistry`, `chorus`.\n if (index === 0 && initialGreekCh.test(value)) {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n // Germanic, Greek, or otherwise `CH` for `KH` sound.\n if (\n isGermanic ||\n // Such as 'architect' but not 'arch', orchestra', 'orchid'.\n greekCh.test(value.slice(index - 2, index + 4)) ||\n (nextnext === 'T' || nextnext === 'S') ||\n ((index === 0 ||\n prev === 'A' ||\n prev === 'E' ||\n prev === 'O' ||\n prev === 'U') &&\n // Such as `wachtler`, `weschsler`, but not `tichner`.\n chForKh.test(nextnext))\n ) {\n primary += 'K'\n secondary += 'K'\n } else if (index === 0) {\n primary += 'X'\n secondary += 'X'\n // Such as 'McHugh'.\n } else if (value.slice(0, 2) === 'MC') {\n // Bug? Why matching absolute? what about McHiccup?\n primary += 'K'\n secondary += 'K'\n } else {\n primary += 'X'\n secondary += 'K'\n }\n\n index += 2\n\n break\n }\n\n // Such as `Czerny`.\n if (next === 'Z' && value.slice(index - 2, index) !== 'WI') {\n primary += 'S'\n secondary += 'X'\n index += 2\n\n break\n }\n\n // Such as `Focaccia`.\n if (value.slice(index + 1, index + 4) === 'CIA') {\n primary += 'X'\n secondary += 'X'\n index += 3\n\n break\n }\n\n // Double `C`, but not `McClellan`.\n if (next === 'C' && !(index === 1 && characters[0] === 'M')) {\n // Such as `Bellocchio`, but not `Bacchus`.\n if (\n (nextnext === 'I' || nextnext === 'E' || nextnext === 'H') &&\n value.slice(index + 2, index + 4) !== 'HU'\n ) {\n subvalue = value.slice(index - 1, index + 4)\n\n // Such as `Accident`, `Accede`, `Succeed`.\n if (\n (index === 1 && prev === 'A') ||\n subvalue === 'UCCEE' ||\n subvalue === 'UCCES'\n ) {\n primary += 'KS'\n secondary += 'KS'\n // Such as `Bacci`, `Bertucci`, other Italian.\n } else {\n primary += 'X'\n secondary += 'X'\n }\n\n index += 3\n\n break\n } else {\n // Pierce's rule.\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n }\n\n if (next === 'G' || next === 'K' || next === 'Q') {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n // Italian.\n if (\n next === 'I' &&\n // Bug: The original algorithm also calls for A (as in CIA), which is\n // already taken care of above.\n (nextnext === 'E' || nextnext === 'O')\n ) {\n primary += 'S'\n secondary += 'X'\n index += 2\n\n break\n }\n\n if (next === 'I' || next === 'E' || next === 'Y') {\n primary += 'S'\n secondary += 'S'\n index += 2\n\n break\n }\n\n primary += 'K'\n secondary += 'K'\n\n // Skip two extra characters ahead in `Mac Caffrey`, `Mac Gregor`.\n if (\n next === ' ' &&\n (nextnext === 'C' || nextnext === 'G' || nextnext === 'Q')\n ) {\n index += 3\n break\n }\n\n // Bug: Already covered above.\n // if (\n // next === 'K' ||\n // next === 'Q' ||\n // (next === 'C' && nextnext !== 'E' && nextnext !== 'I')\n // ) {\n // index++;\n // }\n\n index++\n\n break\n case 'D':\n if (next === 'G') {\n // Such as `edge`.\n if (nextnext === 'E' || nextnext === 'I' || nextnext === 'Y') {\n primary += 'J'\n secondary += 'J'\n index += 3\n // Such as `Edgar`.\n } else {\n primary += 'TK'\n secondary += 'TK'\n index += 2\n }\n\n break\n }\n\n if (next === 'T' || next === 'D') {\n primary += 'T'\n secondary += 'T'\n index += 2\n\n break\n }\n\n primary += 'T'\n secondary += 'T'\n index++\n\n break\n case 'F':\n if (next === 'F') {\n index++\n }\n\n index++\n primary += 'F'\n secondary += 'F'\n\n break\n case 'G':\n if (next === 'H') {\n if (index > 0 && !vowels.test(prev)) {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n // Such as `Ghislane`, `Ghiradelli`.\n if (index === 0) {\n if (nextnext === 'I') {\n primary += 'J'\n secondary += 'J'\n } else {\n primary += 'K'\n secondary += 'K'\n }\n\n index += 2\n\n break\n }\n\n // Parker's rule (with some further refinements).\n if (\n // Such as `Hugh`. The comma is not a bug.\n ((subvalue = characters[index - 2]),\n subvalue === 'B' || subvalue === 'H' || subvalue === 'D') ||\n // Such as `bough`. The comma is not a bug.\n ((subvalue = characters[index - 3]),\n subvalue === 'B' || subvalue === 'H' || subvalue === 'D') ||\n // Such as `Broughton`. The comma is not a bug.\n ((subvalue = characters[index - 4]),\n subvalue === 'B' || subvalue === 'H')\n ) {\n index += 2\n\n break\n }\n\n // Such as `laugh`, `McLaughlin`, `cough`, `gough`, `rough`, `tough`.\n if (index > 2 && prev === 'U' && gForF.test(characters[index - 3])) {\n primary += 'F'\n secondary += 'F'\n } else if (index > 0 && prev !== 'I') {\n primary += 'K'\n secondary += 'K'\n }\n\n index += 2\n\n break\n }\n\n if (next === 'N') {\n if (index === 1 && vowels.test(characters[0]) && !isSlavoGermanic) {\n primary += 'KN'\n secondary += 'N'\n // Not like `Cagney`.\n } else if (\n value.slice(index + 2, index + 4) !== 'EY' &&\n value.slice(index + 1) !== 'Y' &&\n !isSlavoGermanic\n ) {\n primary += 'N'\n secondary += 'KN'\n } else {\n primary += 'KN'\n secondary += 'KN'\n }\n\n index += 2\n\n break\n }\n\n // Such as `Tagliaro`.\n if (value.slice(index + 1, index + 3) === 'LI' && !isSlavoGermanic) {\n primary += 'KL'\n secondary += 'L'\n index += 2\n\n break\n }\n\n // -ges-, -gep-, -gel- at beginning.\n if (index === 0 && initialGForKj.test(value.slice(1, 3))) {\n primary += 'K'\n secondary += 'J'\n index += 2\n\n break\n }\n\n // -ger-, -gy-.\n if (\n (value.slice(index + 1, index + 3) === 'ER' &&\n prev !== 'I' &&\n prev !== 'E' &&\n !initialAngerException.test(value.slice(0, 6))) ||\n (next === 'Y' && !gForKj.test(prev))\n ) {\n primary += 'K'\n secondary += 'J'\n index += 2\n\n break\n }\n\n // Italian such as `biaggi`.\n if (\n next === 'E' ||\n next === 'I' ||\n next === 'Y' ||\n ((prev === 'A' || prev === 'O') && next === 'G' && nextnext === 'I')\n ) {\n // Obvious Germanic.\n if (value.slice(index + 1, index + 3) === 'ET' || isGermanic) {\n primary += 'K'\n secondary += 'K'\n } else {\n primary += 'J'\n\n // Always soft if French ending.\n if (value.slice(index + 1, index + 5) === 'IER ') {\n secondary += 'J'\n } else {\n secondary += 'K'\n }\n }\n\n index += 2\n\n break\n }\n\n if (next === 'G') {\n index++\n }\n\n index++\n\n primary += 'K'\n secondary += 'K'\n\n break\n case 'H':\n // Only keep if first & before vowel or btw. 2 vowels.\n if (vowels.test(next) && (index === 0 || vowels.test(prev))) {\n primary += 'H'\n secondary += 'H'\n\n index++\n }\n\n index++\n\n break\n case 'J':\n // Obvious Spanish, `jose`, `San Jacinto`.\n if (\n value.slice(index, index + 4) === 'JOSE' ||\n value.slice(0, 4) === 'SAN '\n ) {\n if (\n value.slice(0, 4) === 'SAN ' ||\n (index === 0 && characters[index + 4] === ' ')\n ) {\n primary += 'H'\n secondary += 'H'\n } else {\n primary += 'J'\n secondary += 'H'\n }\n\n index++\n\n break\n }\n\n if (\n index === 0\n // Bug: unreachable (see previous statement).\n // && value.slice(index, index + 4) !== 'JOSE'.\n ) {\n primary += 'J'\n\n // Such as `Yankelovich` or `Jankelowicz`.\n secondary += 'A'\n // Spanish pron. of such as `bajador`.\n } else if (\n !isSlavoGermanic &&\n (next === 'A' || next === 'O') &&\n vowels.test(prev)\n ) {\n primary += 'J'\n secondary += 'H'\n } else if (index === last) {\n primary += 'J'\n } else if (\n prev !== 'S' &&\n prev !== 'K' &&\n prev !== 'L' &&\n !jForJException.test(next)\n ) {\n primary += 'J'\n secondary += 'J'\n // It could happen.\n } else if (next === 'J') {\n index++\n }\n\n index++\n\n break\n case 'K':\n if (next === 'K') {\n index++\n }\n\n primary += 'K'\n secondary += 'K'\n index++\n\n break\n case 'L':\n if (next === 'L') {\n // Spanish such as `cabrillo`, `gallegos`.\n if (\n (index === length - 3 &&\n ((prev === 'A' && nextnext === 'E') ||\n (prev === 'I' && (nextnext === 'O' || nextnext === 'A')))) ||\n (prev === 'A' &&\n nextnext === 'E' &&\n (characters[last] === 'A' ||\n characters[last] === 'O' ||\n alle.test(value.slice(last - 1, length))))\n ) {\n primary += 'L'\n index += 2\n\n break\n }\n\n index++\n }\n\n primary += 'L'\n secondary += 'L'\n index++\n\n break\n case 'M':\n if (\n next === 'M' ||\n // Such as `dumb`, `thumb`.\n (prev === 'U' &&\n next === 'B' &&\n (index + 1 === last || value.slice(index + 2, index + 4) === 'ER'))\n ) {\n index++\n }\n\n index++\n primary += 'M'\n secondary += 'M'\n\n break\n case 'N':\n if (next === 'N') {\n index++\n }\n\n index++\n primary += 'N'\n secondary += 'N'\n\n break\n case 'Ñ':\n index++\n primary += 'N'\n secondary += 'N'\n\n break\n case 'P':\n if (next === 'H') {\n primary += 'F'\n secondary += 'F'\n index += 2\n\n break\n }\n\n // Also account for `campbell` and `raspberry`.\n subvalue = next\n\n if (subvalue === 'P' || subvalue === 'B') {\n index++\n }\n\n index++\n\n primary += 'P'\n secondary += 'P'\n\n break\n case 'Q':\n if (next === 'Q') {\n index++\n }\n\n index++\n primary += 'K'\n secondary += 'K'\n\n break\n case 'R':\n // French such as `Rogier`, but exclude `Hochmeier`.\n if (\n index === last &&\n !isSlavoGermanic &&\n prev === 'E' &&\n characters[index - 2] === 'I' &&\n characters[index - 4] !== 'M' &&\n (characters[index - 3] !== 'E' && characters[index - 3] !== 'A')\n ) {\n secondary += 'R'\n } else {\n primary += 'R'\n secondary += 'R'\n }\n\n if (next === 'R') {\n index++\n }\n\n index++\n\n break\n case 'S':\n // Special cases `island`, `isle`, `carlisle`, `carlysle`.\n if (next === 'L' && (prev === 'I' || prev === 'Y')) {\n index++\n\n break\n }\n\n // Special case `sugar-`.\n if (index === 0 && value.slice(1, 5) === 'UGAR') {\n primary += 'X'\n secondary += 'S'\n index++\n\n break\n }\n\n if (next === 'H') {\n // Germanic.\n if (hForS.test(value.slice(index + 1, index + 5))) {\n primary += 'S'\n secondary += 'S'\n } else {\n primary += 'X'\n secondary += 'X'\n }\n\n index += 2\n break\n }\n\n if (\n next === 'I' &&\n (nextnext === 'O' || nextnext === 'A')\n // Bug: Already covered by previous branch\n // || value.slice(index, index + 4) === 'SIAN'\n ) {\n if (isSlavoGermanic) {\n primary += 'S'\n secondary += 'S'\n } else {\n primary += 'S'\n secondary += 'X'\n }\n\n index += 3\n\n break\n }\n\n // German & Anglicization's, such as `Smith` match `Schmidt`, `snider`\n // match `Schneider`. Also, -sz- in slavic language although in\n // hungarian it is pronounced `s`.\n if (\n next === 'Z' ||\n (index === 0 &&\n (next === 'L' || next === 'M' || next === 'N' || next === 'W'))\n ) {\n primary += 'S'\n secondary += 'X'\n\n if (next === 'Z') {\n index++\n }\n\n index++\n\n break\n }\n\n if (next === 'C') {\n // Schlesinger's rule.\n if (nextnext === 'H') {\n subvalue = value.slice(index + 3, index + 5)\n\n // Dutch origin, such as `school`, `schooner`.\n if (dutchSch.test(subvalue)) {\n // Such as `schermerhorn`, `schenker`.\n if (subvalue === 'ER' || subvalue === 'EN') {\n primary += 'X'\n secondary += 'SK'\n } else {\n primary += 'SK'\n secondary += 'SK'\n }\n\n index += 3\n\n break\n }\n\n if (\n index === 0 &&\n !vowels.test(characters[3]) &&\n characters[3] !== 'W'\n ) {\n primary += 'X'\n secondary += 'S'\n } else {\n primary += 'X'\n secondary += 'X'\n }\n\n index += 3\n\n break\n }\n\n if (nextnext === 'I' || nextnext === 'E' || nextnext === 'Y') {\n primary += 'S'\n secondary += 'S'\n index += 3\n break\n }\n\n primary += 'SK'\n secondary += 'SK'\n index += 3\n\n break\n }\n\n subvalue = value.slice(index - 2, index)\n\n // French such as `resnais`, `artois`.\n if (index === last && (subvalue === 'AI' || subvalue === 'OI')) {\n secondary += 'S'\n } else {\n primary += 'S'\n secondary += 'S'\n }\n\n if (\n next === 'S'\n // Bug: already taken care of by `German & Anglicization's` above:\n // || next === 'Z'\n ) {\n index++\n }\n\n index++\n\n break\n case 'T':\n if (next === 'I' && nextnext === 'O' && characters[index + 3] === 'N') {\n primary += 'X'\n secondary += 'X'\n index += 3\n\n break\n }\n\n subvalue = value.slice(index + 1, index + 3)\n\n if (\n (next === 'I' && nextnext === 'A') ||\n (next === 'C' && nextnext === 'H')\n ) {\n primary += 'X'\n secondary += 'X'\n index += 3\n\n break\n }\n\n if (next === 'H' || (next === 'T' && nextnext === 'H')) {\n // Special case `Thomas`, `Thames` or Germanic.\n if (\n isGermanic ||\n ((nextnext === 'O' || nextnext === 'A') &&\n characters[index + 3] === 'M')\n ) {\n primary += 'T'\n secondary += 'T'\n } else {\n primary += '0'\n secondary += 'T'\n }\n\n index += 2\n\n break\n }\n\n if (next === 'T' || next === 'D') {\n index++\n }\n\n index++\n primary += 'T'\n secondary += 'T'\n\n break\n case 'V':\n if (next === 'V') {\n index++\n }\n\n primary += 'F'\n secondary += 'F'\n index++\n\n break\n case 'W':\n // Can also be in middle of word (as already taken care of for initial).\n if (next === 'R') {\n primary += 'R'\n secondary += 'R'\n index += 2\n\n break\n }\n\n if (index === 0) {\n // `Wasserman` should match `Vasserman`.\n if (vowels.test(next)) {\n primary += 'A'\n secondary += 'F'\n } else if (next === 'H') {\n // Need `Uomo` to match `Womo`.\n primary += 'A'\n secondary += 'A'\n }\n }\n\n // `Arnow` should match `Arnoff`.\n if (\n ((prev === 'E' || prev === 'O') &&\n next === 'S' &&\n nextnext === 'K' &&\n (characters[index + 3] === 'I' || characters[index + 3] === 'Y')) ||\n // Maybe a bug? Shouldn't this be general Germanic?\n value.slice(0, 3) === 'SCH' ||\n (index === last && vowels.test(prev))\n ) {\n secondary += 'F'\n index++\n\n break\n }\n\n // Polish such as `Filipowicz`.\n if (\n next === 'I' &&\n (nextnext === 'C' || nextnext === 'T') &&\n characters[index + 3] === 'Z'\n ) {\n primary += 'TS'\n secondary += 'FX'\n index += 4\n\n break\n }\n\n index++\n\n break\n case 'X':\n // French such as `breaux`.\n if (\n !(\n index === last &&\n // Bug: IAU and EAU also match by AU\n // (/IAU|EAU/.test(value.slice(index - 3, index))) ||\n (prev === 'U' &&\n (characters[index - 2] === 'A' || characters[index - 2] === 'O'))\n )\n ) {\n primary += 'KS'\n secondary += 'KS'\n }\n\n if (next === 'C' || next === 'X') {\n index++\n }\n\n index++\n\n break\n case 'Z':\n // Chinese pinyin such as `Zhao`.\n if (next === 'H') {\n primary += 'J'\n secondary += 'J'\n index += 2\n\n break\n } else if (\n (next === 'Z' &&\n (nextnext === 'A' || nextnext === 'I' || nextnext === 'O')) ||\n (isSlavoGermanic && index > 0 && prev !== 'T')\n ) {\n primary += 'S'\n secondary += 'TS'\n } else {\n primary += 'S'\n secondary += 'S'\n }\n\n if (next === 'Z') {\n index++\n }\n\n index++\n\n break\n default:\n index++\n }\n }\n\n return [primary, secondary]\n}",
"function showPhrase(link, path, trans, lang, explan) {\r\n}",
"function translationLabels(){\n /** This help array shows the hints for this experiment */\n\t\t\t\thelpArray=[_(\"help1\"),_(\"help2\"),_(\"help3\"),_(\"help4\"),_(\"help5\"),_(\"Next\"),_(\"Close\")];\n scope.heading=_(\"Millikan's Oil Drop Experiment\");\n\t\t\t\tscope.variables=_(\"Variables\"); \n\t\t\t\tscope.result=_(\"Result\"); \n\t\t\t\tscope.copyright=_(\"copyright\");\n buttonTxt = [_(\"Start\"),_(\"Reset\"),_(\"Voltage On\"),_(\"Voltage Off\"), _(\"X Ray On\"), _(\"X Ray Off\")];\n scope.start_txt = buttonTxt[0];\n scope.oil_type_txt = _(\"Choose Oil Type\");\n scope.voltageOnOff_txt = buttonTxt[2];\n scope.adjustVoltage_txt = _(\"Adjust Voltage(KV): \");\n scope.xRay_txt = buttonTxt[4];\n scope.reset_txt = buttonTxt[1];\n scope.voltApplied_txt = _(\"Voltage Applied (v)\");\n\t\t\t\tscope.oilDensity_txt = _(\"Oil Density (kg/m\");\n scope.oil_type = [{\n oil:_(\"Olive Oil\"),\n index:0\n },{\n oil:_(\"Glycerin\"),\n index:1\n }];\n scope.$apply();\t\t\t\t\n\t\t\t}",
"function createSimplifiedWordLabel(item) {\n return '<span class=\"simp-word\" ' +\n 'onclick=\"taeUI.getInstance().wordEvent(event, this)\">' +\n item.originalValue + \n '</span>';\n }",
"function ae(a){return a&&a.rd?a.uc():a}",
"function Assign_Lex_Other() {\r\n}",
"function LanguageUnderstandingModel() {\n }",
"static uposTags() {\n // return [ \"ADJ\", \"ADP\", \"ADV\", \"AUX\", \"CONJ\", \"DET\", \"INTJ\", \"NOUN\", \"NUM\", \"PART\", \"PRON\", \"PROPN\", \"PUNCT\", \"SCONJ\", \"SYM\", \"VERB\", \"X\" ]\n return [\n {\n \"value\": \"ADJ\",\n \"label\": \"Adjective\"\n },\n {\n \"value\": \"ADP\",\n \"label\": \"Adposition\"\n },\n {\n \"value\": \"ADV\",\n \"label\": \"Adverb\"\n },\n {\n \"value\": \"AUX\",\n \"label\": \"Auxiliary Verb\"\n },\n {\n \"value\": \"CCONJ\",\n \"label\": \"Coordinating Conjunction\"\n },\n {\n \"value\": \"DET\",\n \"label\": \"Determiner\"\n },\n {\n \"value\": \"INTJ\",\n \"label\": \"Interjection\"\n },\n {\n \"value\": \"NOUN\",\n \"label\": \"Noun\"\n },\n {\n \"value\": \"NUM\",\n \"label\": \"Numeral\"\n },\n {\n \"value\": \"PART\",\n \"label\": \"Particle\"\n },\n {\n \"value\": \"PRON\",\n \"label\": \"Pronoun\"\n },\n {\n \"value\": \"PROPN\",\n \"label\": \"Proper Noun\"\n },\n {\n \"value\": \"PUNCT\",\n \"label\": \"Punctuation\"\n },\n {\n \"value\": \"SCONJ\",\n \"label\": \"Subordinating Conjunction\"\n },\n {\n \"value\": \"SYM\",\n \"label\": \"Symbol\"\n },\n {\n \"value\": \"VERB\",\n \"label\": \"Verb\"\n },\n {\n \"value\": \"X\",\n \"label\": \"Other\"\n }\n ]\n }",
"function q(a){var c=g(a);if(c.id){\n// get the related l10n object\nvar d=n(c.id,c.args);if(!d)return void console.warn(\"#\"+c.id+\" is undefined.\");\n// translate element (TODO: security checks?)\nif(d[v]){// XXX\nif(0===r(a))a[v]=d[v];else{for(var e=a.childNodes,f=!1,h=0,i=e.length;i>h;h++)3===e[h].nodeType&&/\\S/.test(e[h].nodeValue)&&(f?e[h].nodeValue=\"\":(e[h].nodeValue=d[v],f=!0));\n// if no (non-empty) textNode is found, insert a textNode before the\n// first element child.\nif(!f){var j=b.createTextNode(d[v]);a.insertBefore(j,a.firstChild)}}delete d[v]}for(var k in d)a[k]=d[k]}}",
"function translationLabels() {\n\t\t\t\t\t/** This help array shows the hints for this experiment */\n\t\t\t\t\thelp_array = [_(\"help1\"), _(\"help2\"), _(\"help3\"), _(\"help4\"),_(\"Next\"), _(\"Close\")];\n\t\t\t\t\tscope.heading = _(\"heading\");\n\t\t\t\t\tscope.Variables = _(\"Variables\");\n\t\t\t\t\tscope.BaseValue=_(\"basevalue\");\n\t\t\t\t\tscope.Doublebond=_(\"Doublebond\");\n\t\t\t\t\tscope.Exocyclicdouble=_(\"Exocyclicdouble\");\n\t\t\t\t\tscope.Polargroups=_(\"Polargroups\");\n\t\t\t\t\tscope.AlkylSubstituent=_(\"AlkylSubstituent\");\n\t\t\t\t\tscope.ringResidue=_(\"ringResidue\");\n\t\t\t\t\tscope.Controls=_(\"Controls\");\n\t\t\t\t\tscope.lamdaMax=_(\"lamdaMax\");\n\t\t\t\t\tscope.Correct=_(\"Correct\");\n\t\t\t\t\tscope.Submit=_(\"Submit\"); \t\t\t\t\n\t\t\t\t\tscope.Aromatic=_(\"Aromatic\"); \t\t\t\t\n\t\t\t\t\tscope.Ketone=_(\"Ketone\"); \t\t\t\t\n\t\t\t\t\tscope.Conjugate=_(\"Conjugate\"); \t\t\t\t\n\t\t\t\t\tscope.AlkylSubstituentKeto=_(\"AlkylSubstituentKeto\"); \t\t\t\t\n\t\t\t\t\tscope.Polargroupsposition=_(\"Polargroupsposition\"); \t\t\t\t\n\t\t\t\t\tscope.Homodienecompound=_(\"Homodienecompound\"); \t\t\t\t\n\t\t\t\t\tscope.Ortho=_(\"Ortho\"); \t\t\t\t\n\t\t\t\t\tscope.Para=_(\"Para\"); \t\t\t\t\n\t\t\t\t\tscope.Meta=_(\"Meta\"); \t\t\t\t\n\t\t\t\t\tscope.lambdamax=_(\"lambdamax\"); \t\t\t\t\n\t\t\t\t\tscope.lambdamax=_(\"lambdamax\"); \t\t\t\t\n\t\t\t\t\tscope.result = _(\"Result\");\n\t\t\t\t\tscope.copyright = _(\"copyright\");\n\t\t\t\t\twoodward_fieser_stage.update();\n\t\t\t\t}",
"function getLabelDescriptions () {\n return {\n 'Walk' : {\n 'id' : 'Walk',\n 'text' : 'Walk'\n },\n 'StopSign' : {\n 'id' : 'StopSign',\n 'text' : 'Bus Stop Sign'\n },\n 'StopSign_OneLeg' : {\n 'id' : 'StopSign_OneLeg',\n 'text' : 'One-leg Stop Sign'\n },\n 'StopSign_TwoLegs' : {\n 'id' : 'StopSign_TwoLegs',\n 'text' : 'Two-leg Stop Sign'\n },\n 'StopSign_Column' : {\n 'id' : 'StopSign_Column',\n 'text' : 'Column Stop Sign'\n },\n 'StopSign_None' : {\n 'id' : 'StopSign_None',\n 'text' : 'Not provided'\n },\n 'Landmark_Shelter' : {\n 'id' : 'Landmark_Shelter',\n 'text' : 'Bus Stop Shelter'\n },\n 'Landmark_Bench' : {\n 'id' : 'Landmark_Bench',\n 'text' : 'Bench'\n },\n 'Landmark_TrashCan' : {\n 'id' : 'Landmark_TrashCan',\n 'text' : 'Trash Can / Recycle Can'\n },\n 'Landmark_MailboxAndNewsPaperBox' : {\n 'id' : 'Landmark_MailboxAndNewsPaperBox',\n 'text' : 'Mailbox / News Paper Box'\n },\n 'Landmark_OtherPole' : {\n 'id' : 'Landmark_OtherPole',\n 'text' : 'Traffic Sign / Pole'\n }\n }\n}"
] | [
"0.5760608",
"0.562237",
"0.5390461",
"0.5292844",
"0.52794814",
"0.5221145",
"0.5215348",
"0.5215348",
"0.5215348",
"0.5215348",
"0.519355",
"0.51407933",
"0.5074362",
"0.5043243",
"0.5035038",
"0.50228405",
"0.49539477",
"0.495328",
"0.49445188",
"0.4937989",
"0.49374697",
"0.4916687",
"0.4915139",
"0.49131477",
"0.49118263",
"0.48638466",
"0.4852628",
"0.48485267",
"0.4836091",
"0.4816314"
] | 0.59461 | 0 |
Reads the data entered in the neume form and saves it. If no pitch is given and the neume type is virga, punctum, pes, clivis, torculus, porrectus, scandicus or climacus, all needed pitches will be automatically added. | function createNeume(){
var type = document.getElementById("type").value;
if(isClimacus){
maxPitches = document.getElementById("numberofpitches").value;
}
currentNeume = new Neume();
currentNeume.type = type;
if(type == "virga" || type == "punctum"){
var p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "pes"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "clivis"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "torculus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "porrectus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "climacus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
if(maxPitches == 4){
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
if(maxPitches == 5){
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
}
else if(currentNeume.type == "scandicus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
}
currentSyllable.neumes.push(currentNeume);
document.getElementById("meiOutput").value = createMEIOutput();
document.getElementById("input").innerHTML = neumeForm();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createPitch(){\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"connection\").value;\n var tilt = document.getElementById(\"tilt\").value;\n var variation = document.getElementById(\"variation\").value;\n var supplied = document.getElementById(\"supplied\").value;\n \n var p = new Pitch(pitch, octave, comment, intm, connection, tilt, variation, supplied);\n currentNeume.pitches.push(p);\n \n if(currentNeume.type == \"virga\" || currentNeume.type == \"punctum\"){\n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(currentNeume.type == \"pes\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"clivis\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"torculus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"porrectus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"climacus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n if(maxPitches == 4 || maxPitches == 5){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else{\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(pitchCounter == 3)\n {\n if(maxPitches == 5){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else{\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(pitchCounter == 4)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"scandicus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"torculusresupinus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 3)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else{\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function createNeumeVariation(){\n var sourceID = document.getElementById(\"source\").value;\n var type = document.getElementById(\"type\").value;\n \n if(isClimacus){\n maxPitches = document.getElementById(\"numberofpitches\").value;\n }\n \n currentSID = sourceID;\n \n currentNeume = new Neume();\n currentNeume.type = type;\n \n if(type == \"virga\" || type == \"punctum\"){\n var p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"pes\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"clivis\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"torculus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"porrectus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"climacus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(maxPitches == 4){\n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n \n if(maxPitches == 5){\n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n }\n else if(currentNeume.type == \"scandicus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n \n var i;\n \n if(neumeVariations.length < 1){\n for(i = 0; i < sources.length; i++){\n var neumeVariation = new NeumeVariation(sources[i].id);\n neumeVariations.push(neumeVariation);\n }\n }\n \n for(i = 0; i < neumeVariations.length; i++){\n if(neumeVariations[i].sourceID == sourceID){\n neumeVariations[i].additionalNeumes.push(currentNeume);\n break;\n }\n }\n \n if(!pushedNeumeVariations){\n currentSyllable.neumes.push(neumeVariations);\n pushedNeumeVariations = true;\n }\n else{\n currentSyllable.neumes.pop();\n currentSyllable.neumes.push(neumeVariations);\n }\n \n isNeumeVariant = true;\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n createSVGOutput();\n}",
"function applyPitchDataChanges(){\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"connection\").value;\n var tilt = document.getElementById(\"tilt\").value;\n var variation = document.getElementById(\"variation\").value;\n var supplied = document.getElementById(\"supplied\").value;\n \n if(pitch && pitch != \"none\"){\n currentPitch.pitch = pitch;\n }\n if(octave && octave != \"none\"){\n currentPitch.octave = octave;\n }\n if(comment && comment != \"none\"){\n currentPitch.comment = comment;\n }\n if(intm && intm != \"none\"){\n currentPitch.intm = intm;\n }\n if(connection && connection != \"none\"){\n currentPitch.connection = connection;\n }\n if(tilt && tilt != \"none\"){\n currentPitch.tilt = tilt;\n }\n if(variation && variation != \"none\"){\n currentPitch.variation = variation;\n }\n if(supplied && supplied != \"none\"){\n currentPitch.supplied = supplied;\n }\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function createNeumeWithPitches(){\n var type = document.getElementById(\"type\").value;\n \n if(isClimacus){\n maxPitches = document.getElementById(\"numberofpitches\").value;\n }\n \n currentNeume = new Neume();\n currentNeume.type = type;\n \n currentSyllable.neumes.push(currentNeume);\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = pitchForm();\n createSVGOutput();\n}",
"function createNeumeVariationWithPitches(){\n var sourceID = document.getElementById(\"source\").value;\n var type = document.getElementById(\"type\").value;\n \n if(isClimacus){\n maxPitches = document.getElementById(\"numberofpitches\").value;\n }\n \n currentNeume = new Neume();\n currentNeume.type = type;\n \n var i;\n \n if(neumeVariations.length < 1){\n for(i = 0; i < sources.length; i++){\n var neumeVariation = new NeumeVariation(sources[i].id);\n neumeVariations.push(neumeVariation);\n }\n }\n \n for(i = 0; i < neumeVariations.length; i++){\n if(neumeVariations[i].sourceID == sourceID){\n neumeVariations[i].additionalNeumes.push(currentNeume);\n break;\n }\n }\n \n if(!pushedNeumeVariations){\n currentSyllable.neumes.push(neumeVariations);\n pushedNeumeVariations = true;\n }\n else{\n currentSyllable.neumes.pop();\n currentSyllable.neumes.push(neumeVariations);\n }\n \n isNeumeVariant = true;\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = pitchForm();\n createSVGOutput();\n}",
"function applyVariationDataChanges(){\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"connection\").value;\n var tilt = document.getElementById(\"tilt\").value;\n var graphicalVariation = document.getElementById(\"variation\").value;\n var supplied = document.getElementById(\"supplied\").value;\n \n if(pitch && pitch != \"none\"){\n currentVarPitch.pitch = pitch;\n }\n if(octave && octave != \"none\"){\n currentVarPitch.octave = octave;\n }\n if(comment && comment != \"none\"){\n currentPitch.comment = comment;\n }\n if(intm && intm != \"none\"){\n currentVarPitch.intm = intm;\n }\n if(connection && connection != \"none\"){\n currentPitch.connection = connection;\n }\n if(tilt && tilt != \"none\"){\n currentVarPitch.tilt = tilt;\n }\n if(graphicalVariation && graphicalVariation != \"none\"){\n currentVarPitch.variation = graphicalVariation;\n }\n if(supplied && supplied != \"none\"){\n currentPitch.supplied = supplied;\n }\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function deletePitch(){\n currentNeume.pitches.splice(currentPitchIndex, 1);\n \n currentPitchIndex = 0;\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function setPitch(\r\n pitch_)\r\n {\r\n pitch = pitch_;\r\n }",
"function deleteVariationPitch(){\n currentNeume.pitches[currentPitchIndex][currentVarSourceIndex].additionalPitches.splice(currentVarPitchIndex, 1);\n \n currentVarPitchIndex = 0;\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function detectPitch()\n{\n console.log('listening...');\n pitch = ml5.pitchDetection(model_url, audioContext, mic.stream, modelLoaded);\n}",
"function finalizeNote() {\r\n if (mel.type === \"melody\" || mel.type === \"gracenote\") {\r\n var note = mel.staffPosition.substring(0,1); // Staff position never has sharps or flats.\r\n var midiOffset = +mel.staffPosition.substring(1);\r\n if (lastKeySig && lastKeySig.data && lastKeySig.data.key && lastKeySig.data.key[note]) {\r\n note += lastKeySig.data.key[note]\r\n }\r\n mel.midiName = HD_TO_MIDINAME_XLATE[note + midiOffset];\r\n mel.midiNote = MIDINAME_TO_MIDI_NOTE[mel.midiName];\r\n mel.shortNoteName = note;\r\n }\r\n }",
"function updatePitch( time ) {\n\n\tanalyser.getFloatTimeDomainData( buf );\n\tvar ac = autoCorrelate( buf, contextAudio.sampleRate );\n\n\t\tif (ac == -1) {\n\n\t\t\tconsole.log(\"frequency not available\");\n\n\t\t\t} else {\n\t\t\t\tpitch = ac;\n\t\t\t\t// pitchElem.innerText = Math.round( pitch ) ;\n\n\t\t\t\tvar note = noteFromPitch( pitch );\n\t\t\t\tpitchElem.innerText = noteArray[note%12];\n\n\t\t\t}\n}",
"function handleNoteOn(key_number) {\n\tvar pitch = parseInt($(\"#lowestPitch\").val()) + key_number;\nif (pressed[pitch-21]) return;\n // Find the pitch\n const push = (amplitude, pitch, timeStamp, duration, type) => {\n recorded.push({'vol': amplitude, 'pitch': pitch, 'start': timeStamp, 'duration': duration, 'type': type})\n };\n \n var amplitude = parseInt($(\"#amplitude\").val());\n var timeStamp = performance.now()\n MIDI.noteOn(0, pitch, amplitude);\n pressed[pitch-21] = true;\n if (recording) push(amplitude, pitch, timeStamp, 0, document.getElementById(\"play-mode-major\").checked ? 1 : (document.getElementById(\"play-mode-minor\").checked ? 2 : 0));\n /*\n * You need to handle the chord mode here\n */\n if (document.getElementById(\"play-mode-major\").checked) {\n if (pitch+4 <= 108) {\n MIDI.noteOn(0, pitch + 4, amplitude);\n pressed[pitch+4-21] = true;\n if (recording) push(amplitude, pitch + 4, timeStamp, 0, 1);\n }\n if (pitch+7 <= 108) {\n MIDI.noteOn(0, pitch + 7, amplitude);\n pressed[pitch+7-21] = true;\n if (recording) push(amplitude, pitch + 7, timeStamp, 0, 1);\n }\n } else if (document.getElementById(\"play-mode-minor\").checked) {\n if (pitch+3 <= 108) {\n MIDI.noteOn(0, pitch + 3, amplitude);\n pressed[pitch + 3-21] = true;\n if (recording) push(amplitude, pitch + 3, timeStamp, 0, 2);\n }\n if (pitch+7 <= 108) {\n MIDI.noteOn(0, pitch + 7, amplitude);\n pressed[pitch+7-21] = true;\n if (recording) push(amplitude, pitch + 7, timeStamp, 0, 2);\n }\n }\n}",
"function startPitch() {\n pitch = ml5.pitchDetection(model_url, audioContext, mic.stream, modelLoaded);\n}",
"function createVariation(){\n var sourceID = document.getElementById(\"source\").value;\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"connection\").value;\n var tilt = document.getElementById(\"tilt\").value;\n var graphicalVariation = document.getElementById(\"variation\").value;\n var supplied = document.getElementById(\"supplied\").value;\n \n currentSID = sourceID;\n \n var p = new Pitch(pitch, octave, comment, intm, connection, tilt, graphicalVariation, supplied);\n \n var variationAvailable = false;\n \n var i;\n \n if(variations.length < 1){\n for(i = 0; i < sources.length; i++){\n var variation = new Variation(sources[i].id);\n variations.push(variation);\n }\n }\n \n for(i = 0; i < variations.length; i++){\n if(variations[i].sourceID == sourceID){\n variations[i].additionalPitches.push(p);\n variationAvailable = true;\n break;\n }\n }\n \n if(!pushedVariations){\n currentNeume.pitches.push(variations);\n pushedVariations = true;\n }\n else{\n currentNeume.pitches.pop();\n currentNeume.pitches.push(variations);\n }\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = variationForm();\n createSVGOutput();\n}",
"function store (){\n\t\tthis.sensor =senType;\n\t\tthis.unit = thisUnit;\n\t\tthis.reading=maxRead;\n\t\tthis.moteId = idMote;\n\t}",
"function store (){\n\t\tthis.sensor =senType;\n\t\tthis.unit = thisUnit;\n\t\tthis.reading=maxRead;\n\t\tthis.moteId = idMote;\n\t}",
"function store (){\n\t\tthis.sensor =senType;\n\t\tthis.unit = thisUnit;\n\t\tthis.reading=maxRead;\n\t\tthis.moteId = idMote;\n\t}",
"function applyCurrentPitch(){\n currentPitchIndex = document.getElementById(\"pitc\").value;\n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n}",
"function speak(text, pitch) {\n\n // Create a new instance of SpeechSynthesisUtterance.\n let utterThis = new SpeechSynthesisUtterance();\n\n // Set the attributes.\n utterThis.volume = 1;\n utterThis.rate = 1;\n // utterThis.pitch = parseFloat(pitchInput.value);\n utterThis.pitch = pitch;\n // console.log(\"talking\");\n\n // Set the text.\n utterThis.text = text;\n utterThis.voice = speechSynthesis.getVoices().filter(function(voice) { return voice.name == voiceSelect1.value; })[0];\n // Queue this utterance.\n window.speechSynthesis.speak(utterThis);\n}",
"function uploadPitchChangesFromFile(path) {\n fetch(path)\n .then(response => response.text())\n .then(text => {\n var pitchesArray1 = [];\n var t1 = text.split(\"&\");\n var d3 = [];\n for (var i = 0; i < t1.length; i++) {\n var temparr = t1[i].split('$');\n var t3 = [];\n var t4 = temparr[2].split(\"%\");\n var d2 = [];\n for (var j = 0; j < t4.length; j++) {\n var t5 = t4[j].split(\"?\");\n var d1 = [];\n for (var k = 0; k < t5.length; k++) {\n var t6 = t5[k].split(\",\");\n var t6f = [];\n for (var l = 0; l < t6.length; l++) {\n t6f.push(parseFloat(t6[l]));\n }\n d1.push(t6f);\n }\n d2.push(d1)\n }\n var d4 = [];\n d4.push(parseFloat(temparr[0]));\n d4.push(parseFloat(temparr[1]));\n d4.push(d2);\n d3.push(d4);\n }\n return d3;\n });\n}",
"function storeData(pos, msg) {\n //Prefix hack to keep it short.\n msg = (msg !== '' ? msg : lastMsg);\n msg = msg.replace(/\"/g, '`');\n var prefix = (pos ? 'posi' : 'nega');\n var file = 'node_modules/twss/data/' + prefix + 'tive.js';\n var message = '\\nexports.data.push(\"' + msg + '\");';\n fs.appendFile(file, message, function (err) {\n if (err) { throw err; }\n bot.log(msg + ' ajouté à la liste ' + prefix + 'tive !');\n });\n twss.trainingData[prefix.slice(0, 3)].push(msg);\n client.say(channel, 'Addition validée : ' + msg);\n bot.log(prefix + ': ' + msg);\n}",
"function createAdditionalVariation(){\n \n variations = new Array();\n \n for(i = 0; i < sources.length; i++){\n var variation = new Variation(sources[i].id);\n variations.push(variation);\n }\n \n currentNeume.pitches.splice(currentPitchIndex, 0, variations);\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n createSVGOutput();\n}",
"function toPitchesFromVariations(){\n pushedVariations = false;\n variations = new Array();\n \n document.getElementById(\"input\").innerHTML = pitchForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function readOutLoud(message) {\n //transcript/string of what you said/asked is passed in\n const speech = new SpeechSynthesisUtterance(); //the text that the AI will say\n speech.text = \"\"; //starts empty, is checked later to prevent empty responses\n //if user is greeting the AI -----\n if (message.includes('hello')) {\n //array of possible responses\n const greetings = [\n 'who said you could speak to me?',\n 'leave me alone.',\n 'die in a hole.'\n ]\n const greet = greetings[Math.floor(Math.random() * greetings.length)]; //select a random response\n speech.text = greet; //final output is set\n }\n //-------------------------------\n //if the user is asks how the AI is\n else if (message.includes('how are you')) {\n //array of possible responses\n const howWeBe = [\n 'i was doing better until you showed up',\n 'i\\'m a hardcoded speaking Javascript file you moron, what do you think?',\n 'seriously, who asks an \\\"AI\\\" made by college kids how they\\'re doing.'\n ]\n const how = howWeBe[Math.floor(Math.random() * howWeBe.length)]; //select a random response\n speech.text += how; //final output is set\n }\n //-------------------------------\n //if user asks for weather ------\n else if (message.includes('weather')) {\n getWeather(); //updates weather\n //variables for weather data --\n var temp = Math.floor(Number(document.getElementById('temp').innerHTML) - 273.15);\n var feelsLike = Math.floor(Number(document.getElementById('feelslike').innerHTML) - 273.15);\n var placeName = document.getElementById('place').innerHTML;\n placeName = placeName.charAt(0).toLowerCase() + placeName.slice(1);\n var skies = document.getElementById('weather').innerHTML;\n //----------------------------\n var weatherR = \"in \" + placeName + \", the temperature is \" + temp + \" degrees celsius\" //basic weather output\n //if it feels like something different than the actual temp\n if (temp == feelsLike) {\n weatherR += \". \";\n } else {\n weatherR += \", but it feels like \" + feelsLike + \" degrees. \";\n }\n //extra information based on if its clear, rainy, cloudy, etc.\n if (skies == 'Clear') {\n weatherR += \"today the skies are clear, meaning sadly nothing to ruin your day. At least not weather wise.\";\n } else if (skies == 'Rain') {\n weatherR += \"today there is rain, meaning you can maybe finally wash that smell off you.\";\n } else if (skies == 'Snow') {\n weatherR += \"there's snow today, so stay inside and suffer instead! I'll enjoy it.\";\n } else if (skies == \"Clouds\") {\n weatherR += \"the skies are cloudy today, so enjoy the wonderful lack of sunlight!\";\n } else if (skies == \"Haze\") {\n weatherR += \"it's hazy today, so have fun seeing clearly!\"\n }\n speech.text += weatherR; //final output is set\n }\n // //google placeholder\n // else if (message.includes(\"google\")) {\n // }\n //-------------------------------\n //generic wolfram alpha search --\n else {\n document.getElementById('generic').innerHTML = message;\n python();\n console.log(document.getElementById('generic').innerHTML);\n }\n //-------------------------------\n //voice synthesis properties ----\n speech.volume = 1;\n speech.rate = .95;\n speech.pitch = 1;\n speech.lang = 1;\n if (speech.text == \"\") { //prevent empty response with default/fallback response\n speech.text += \"At least tell me something I can understand.\"\n }\n aiOutput.textContent = speech.text;\n window.speechSynthesis.speak(speech); //makes AI actually speak + respond\n //-------------------------------\n}",
"noteOn(pitch, velocity=60) {\n this.keys[pitch].noteOn(velocity)\n }",
"function record_data(data, count){\n\t\n\tvar frame = controller.frame();\n\n\t// get data (if space had been pressed)\n\tif (count > -1 && frame.hands.length > 0) {\n\n\t\tvar frameData = [];\n\t\tvar hand = frame.hands[0];\n\n\t\t// add (x, y, z) positions\n\t\tvar position = hand.palmPosition;\n\t\tframeData.push(position[0]);\n\t\tframeData.push(position[1]);\n\t\tframeData.push(position[2]);\n\n\t\t// add yaw, pitch, and roll\n\t\tframeData.push(hand.pitch());\n\t\tframeData.push(hand.roll());\n\t\tframeData.push(hand.yaw());\n\n\t\t// add thumb angles\n\t\tvar thumb_bones = hand.thumb.bones;\n\t\tframeData.push(compute_angles(thumb_bones, \"Thumb\", 0));\n\t\tframeData.push(compute_angles(thumb_bones, \"Thumb\", 1));\n\t\tframeData.push(compute_angles(thumb_bones, \"Thumb\", 2));\n\n\t\t// add index angles\n\t\tvar index_bones = hand.indexFinger.bones;\n\t\tframeData.push(compute_angles(index_bones, \"Index Finger\", 0));\n\t\tframeData.push(compute_angles(index_bones, \"Index Finger\", 1));\n\t\tframeData.push(compute_angles(index_bones, \"Index Finger\", 2));\n\n\t\t// add middle angles\n\t\tvar middle_bones = hand.middleFinger.bones;\n\t\tframeData.push(compute_angles(middle_bones, \"Middle Finger\", 0));\n\t\tframeData.push(compute_angles(middle_bones, \"Middle Finger\", 1));\n\t\tframeData.push(compute_angles(middle_bones, \"Middle Finger\", 2));\n\n\t\t// add ring angles\n\t\tvar ring_bones = hand.ringFinger.bones;\n\t\tframeData.push(compute_angles(ring_bones, \"Ring Finger\", 0));\n\t\tframeData.push(compute_angles(ring_bones, \"Ring Finger\", 1));\n\t\tframeData.push(compute_angles(ring_bones, \"Ring Finger\", 2));\n\n\t\t// add pinky angles\n\t\tvar pinky_bones = hand.pinky.bones;\n\t\tframeData.push(compute_angles(pinky_bones, \"Pinky\", 0));\n\t\tframeData.push(compute_angles(pinky_bones, \"Pinky\", 1));\n\t\tframeData.push(compute_angles(pinky_bones, \"Pinky\", 2));\n\n\t\t// get frog angles\n\t\tframeData.push(get_angle(thumb_bones[2].direction(), index_bones[2].direction()));\n\t\tframeData.push(get_angle(index_bones[2].direction(), middle_bones[2].direction()));\n\t\tframeData.push(get_angle(middle_bones[2].direction(), ring_bones[2].direction()));\n\t\tframeData.push(get_angle(ring_bones[2].direction(), pinky_bones[2].direction()));\n\n\t\tdata.push(frameData);\n\t\tcount++;\n\t}\n\treturn count;\n}",
"function enterNote() {\n note = {}\n if (checkIfInputIsCorrect()) {\n // create note\n note.InputOfNote = txtArea.value;\n note.dateOfNote = dateEnterded;\n note.timeOfNote = timeEnterded;\n note.noteNum = noteNumber;\n note.secondsComp = dateEnterdedToCompare;\n noteNumber++;\n NoteArrey.push(note);\n addToLocalStorage();\n printNotes(false);\n }\n}",
"function fillPitches() {\n soprano.getNoteNames();\n alto.getNoteNames();\n tenor.getNoteNames();\n bass.getNoteNames();\n}",
"function addNote() {\n if (noteText.value === \"\") {\n return;\n } else {\n notesCounter++;\n var note = {\n noteId: notesCounter,\n noteText: noteText.value,\n noteHead: noteHead.value,\n colorBg: noteDiv.style.background || \"rgb(255, 255, 255)\",\n tags: [],\n noteFavorite: false,\n noteFavoritePos: null,\n };\n // Add note to front end array\n notes.unshift(note);\n noteDiv.style.background = \"#ffffff\";\n renderNote(note);\n clearInputs();\n noteHead.style.display = \"none\";\n noteBot.style.display = \"none\";\n }\n console.log(note);\n }"
] | [
"0.6827162",
"0.60986024",
"0.58212453",
"0.56243604",
"0.5201323",
"0.5145991",
"0.51065415",
"0.5074942",
"0.50642186",
"0.49391967",
"0.49211776",
"0.48684478",
"0.48668554",
"0.48605475",
"0.48126107",
"0.48085874",
"0.48085874",
"0.48085874",
"0.48049897",
"0.47893217",
"0.47872663",
"0.47326493",
"0.47303343",
"0.46946776",
"0.46339306",
"0.46279103",
"0.46095645",
"0.46065658",
"0.46020395",
"0.45958704"
] | 0.6151761 | 1 |
Reads the data entered in the neume variation form and saves it. If no pitch is given and the neume type is virga, punctum, pes, clivis, torculus, porrectus, scandicus, climacus or torculusresupinus, all needed pitches will be automatically added. | function createNeumeVariation(){
var sourceID = document.getElementById("source").value;
var type = document.getElementById("type").value;
if(isClimacus){
maxPitches = document.getElementById("numberofpitches").value;
}
currentSID = sourceID;
currentNeume = new Neume();
currentNeume.type = type;
if(type == "virga" || type == "punctum"){
var p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "pes"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "clivis"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "torculus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "porrectus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "climacus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
if(maxPitches == 4){
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
if(maxPitches == 5){
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
}
else if(currentNeume.type == "scandicus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
}
var i;
if(neumeVariations.length < 1){
for(i = 0; i < sources.length; i++){
var neumeVariation = new NeumeVariation(sources[i].id);
neumeVariations.push(neumeVariation);
}
}
for(i = 0; i < neumeVariations.length; i++){
if(neumeVariations[i].sourceID == sourceID){
neumeVariations[i].additionalNeumes.push(currentNeume);
break;
}
}
if(!pushedNeumeVariations){
currentSyllable.neumes.push(neumeVariations);
pushedNeumeVariations = true;
}
else{
currentSyllable.neumes.pop();
currentSyllable.neumes.push(neumeVariations);
}
isNeumeVariant = true;
document.getElementById("meiOutput").value = createMEIOutput();
document.getElementById("input").innerHTML = neumeVariationForm();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createPitch(){\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"connection\").value;\n var tilt = document.getElementById(\"tilt\").value;\n var variation = document.getElementById(\"variation\").value;\n var supplied = document.getElementById(\"supplied\").value;\n \n var p = new Pitch(pitch, octave, comment, intm, connection, tilt, variation, supplied);\n currentNeume.pitches.push(p);\n \n if(currentNeume.type == \"virga\" || currentNeume.type == \"punctum\"){\n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(currentNeume.type == \"pes\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"clivis\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"torculus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"porrectus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"climacus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n if(maxPitches == 4 || maxPitches == 5){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else{\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(pitchCounter == 3)\n {\n if(maxPitches == 5){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else{\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(pitchCounter == 4)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"scandicus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"torculusresupinus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 3)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else{\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function createNeume(){\n var type = document.getElementById(\"type\").value;\n \n if(isClimacus){\n maxPitches = document.getElementById(\"numberofpitches\").value;\n }\n \n currentNeume = new Neume();\n currentNeume.type = type;\n \n if(type == \"virga\" || type == \"punctum\"){\n var p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"pes\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"clivis\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"torculus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"porrectus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"climacus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(maxPitches == 4){\n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n \n if(maxPitches == 5){\n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n }\n else if(currentNeume.type == \"scandicus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n \n currentSyllable.neumes.push(currentNeume);\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = neumeForm();\n createSVGOutput();\n}",
"function applyVariationDataChanges(){\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"connection\").value;\n var tilt = document.getElementById(\"tilt\").value;\n var graphicalVariation = document.getElementById(\"variation\").value;\n var supplied = document.getElementById(\"supplied\").value;\n \n if(pitch && pitch != \"none\"){\n currentVarPitch.pitch = pitch;\n }\n if(octave && octave != \"none\"){\n currentVarPitch.octave = octave;\n }\n if(comment && comment != \"none\"){\n currentPitch.comment = comment;\n }\n if(intm && intm != \"none\"){\n currentVarPitch.intm = intm;\n }\n if(connection && connection != \"none\"){\n currentPitch.connection = connection;\n }\n if(tilt && tilt != \"none\"){\n currentVarPitch.tilt = tilt;\n }\n if(graphicalVariation && graphicalVariation != \"none\"){\n currentVarPitch.variation = graphicalVariation;\n }\n if(supplied && supplied != \"none\"){\n currentPitch.supplied = supplied;\n }\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function createNeumeVariationWithPitches(){\n var sourceID = document.getElementById(\"source\").value;\n var type = document.getElementById(\"type\").value;\n \n if(isClimacus){\n maxPitches = document.getElementById(\"numberofpitches\").value;\n }\n \n currentNeume = new Neume();\n currentNeume.type = type;\n \n var i;\n \n if(neumeVariations.length < 1){\n for(i = 0; i < sources.length; i++){\n var neumeVariation = new NeumeVariation(sources[i].id);\n neumeVariations.push(neumeVariation);\n }\n }\n \n for(i = 0; i < neumeVariations.length; i++){\n if(neumeVariations[i].sourceID == sourceID){\n neumeVariations[i].additionalNeumes.push(currentNeume);\n break;\n }\n }\n \n if(!pushedNeumeVariations){\n currentSyllable.neumes.push(neumeVariations);\n pushedNeumeVariations = true;\n }\n else{\n currentSyllable.neumes.pop();\n currentSyllable.neumes.push(neumeVariations);\n }\n \n isNeumeVariant = true;\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = pitchForm();\n createSVGOutput();\n}",
"function createAdditionalVariation(){\n \n variations = new Array();\n \n for(i = 0; i < sources.length; i++){\n var variation = new Variation(sources[i].id);\n variations.push(variation);\n }\n \n currentNeume.pitches.splice(currentPitchIndex, 0, variations);\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n createSVGOutput();\n}",
"function deleteVariationPitch(){\n currentNeume.pitches[currentPitchIndex][currentVarSourceIndex].additionalPitches.splice(currentVarPitchIndex, 1);\n \n currentVarPitchIndex = 0;\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function applyPitchDataChanges(){\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"connection\").value;\n var tilt = document.getElementById(\"tilt\").value;\n var variation = document.getElementById(\"variation\").value;\n var supplied = document.getElementById(\"supplied\").value;\n \n if(pitch && pitch != \"none\"){\n currentPitch.pitch = pitch;\n }\n if(octave && octave != \"none\"){\n currentPitch.octave = octave;\n }\n if(comment && comment != \"none\"){\n currentPitch.comment = comment;\n }\n if(intm && intm != \"none\"){\n currentPitch.intm = intm;\n }\n if(connection && connection != \"none\"){\n currentPitch.connection = connection;\n }\n if(tilt && tilt != \"none\"){\n currentPitch.tilt = tilt;\n }\n if(variation && variation != \"none\"){\n currentPitch.variation = variation;\n }\n if(supplied && supplied != \"none\"){\n currentPitch.supplied = supplied;\n }\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function createNeumeWithPitches(){\n var type = document.getElementById(\"type\").value;\n \n if(isClimacus){\n maxPitches = document.getElementById(\"numberofpitches\").value;\n }\n \n currentNeume = new Neume();\n currentNeume.type = type;\n \n currentSyllable.neumes.push(currentNeume);\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = pitchForm();\n createSVGOutput();\n}",
"function createVariation(){\n var sourceID = document.getElementById(\"source\").value;\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"connection\").value;\n var tilt = document.getElementById(\"tilt\").value;\n var graphicalVariation = document.getElementById(\"variation\").value;\n var supplied = document.getElementById(\"supplied\").value;\n \n currentSID = sourceID;\n \n var p = new Pitch(pitch, octave, comment, intm, connection, tilt, graphicalVariation, supplied);\n \n var variationAvailable = false;\n \n var i;\n \n if(variations.length < 1){\n for(i = 0; i < sources.length; i++){\n var variation = new Variation(sources[i].id);\n variations.push(variation);\n }\n }\n \n for(i = 0; i < variations.length; i++){\n if(variations[i].sourceID == sourceID){\n variations[i].additionalPitches.push(p);\n variationAvailable = true;\n break;\n }\n }\n \n if(!pushedVariations){\n currentNeume.pitches.push(variations);\n pushedVariations = true;\n }\n else{\n currentNeume.pitches.pop();\n currentNeume.pitches.push(variations);\n }\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = variationForm();\n createSVGOutput();\n}",
"function toPitchesFromVariations(){\n pushedVariations = false;\n variations = new Array();\n \n document.getElementById(\"input\").innerHTML = pitchForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function applyCurrentVariation(){\n currentVarPitchIndex = document.getElementById(\"varpitch\").value;\n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n}",
"function deletePitch(){\n currentNeume.pitches.splice(currentPitchIndex, 1);\n \n currentPitchIndex = 0;\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function toNeumeFromNeumeVariations(){\n pushedNeumeVariations = false;\n neumeVariations = new Array();\n \n isNeumeVariant = false;\n \n document.getElementById(\"input\").innerHTML = neumeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n}",
"function finalizeNote() {\r\n if (mel.type === \"melody\" || mel.type === \"gracenote\") {\r\n var note = mel.staffPosition.substring(0,1); // Staff position never has sharps or flats.\r\n var midiOffset = +mel.staffPosition.substring(1);\r\n if (lastKeySig && lastKeySig.data && lastKeySig.data.key && lastKeySig.data.key[note]) {\r\n note += lastKeySig.data.key[note]\r\n }\r\n mel.midiName = HD_TO_MIDINAME_XLATE[note + midiOffset];\r\n mel.midiNote = MIDINAME_TO_MIDI_NOTE[mel.midiName];\r\n mel.shortNoteName = note;\r\n }\r\n }",
"function uploadPitchChangesFromFile(path) {\n fetch(path)\n .then(response => response.text())\n .then(text => {\n var pitchesArray1 = [];\n var t1 = text.split(\"&\");\n var d3 = [];\n for (var i = 0; i < t1.length; i++) {\n var temparr = t1[i].split('$');\n var t3 = [];\n var t4 = temparr[2].split(\"%\");\n var d2 = [];\n for (var j = 0; j < t4.length; j++) {\n var t5 = t4[j].split(\"?\");\n var d1 = [];\n for (var k = 0; k < t5.length; k++) {\n var t6 = t5[k].split(\",\");\n var t6f = [];\n for (var l = 0; l < t6.length; l++) {\n t6f.push(parseFloat(t6[l]));\n }\n d1.push(t6f);\n }\n d2.push(d1)\n }\n var d4 = [];\n d4.push(parseFloat(temparr[0]));\n d4.push(parseFloat(temparr[1]));\n d4.push(d2);\n d3.push(d4);\n }\n return d3;\n });\n}",
"function applyNeumeDataChanges(){\n var type = document.getElementById(\"type\").value;\n \n if(type && type != \"none\"){\n currentNeume.type = type;\n }\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = neumeDataChangeForm();\n createSVGOutput();\n}",
"function store (){\n\t\tthis.sensor =senType;\n\t\tthis.unit = thisUnit;\n\t\tthis.reading=maxRead;\n\t\tthis.moteId = idMote;\n\t}",
"function store (){\n\t\tthis.sensor =senType;\n\t\tthis.unit = thisUnit;\n\t\tthis.reading=maxRead;\n\t\tthis.moteId = idMote;\n\t}",
"function store (){\n\t\tthis.sensor =senType;\n\t\tthis.unit = thisUnit;\n\t\tthis.reading=maxRead;\n\t\tthis.moteId = idMote;\n\t}",
"function storeData(pos, msg) {\n //Prefix hack to keep it short.\n msg = (msg !== '' ? msg : lastMsg);\n msg = msg.replace(/\"/g, '`');\n var prefix = (pos ? 'posi' : 'nega');\n var file = 'node_modules/twss/data/' + prefix + 'tive.js';\n var message = '\\nexports.data.push(\"' + msg + '\");';\n fs.appendFile(file, message, function (err) {\n if (err) { throw err; }\n bot.log(msg + ' ajouté à la liste ' + prefix + 'tive !');\n });\n twss.trainingData[prefix.slice(0, 3)].push(msg);\n client.say(channel, 'Addition validée : ' + msg);\n bot.log(prefix + ': ' + msg);\n}",
"variableStorage(data, varType) {\n const type = parseInt(data.storage, 10);\n if (type !== varType) return;\n return [data.varName2, \"Text\"];\n }",
"function readOutLoud(message) {\n //transcript/string of what you said/asked is passed in\n const speech = new SpeechSynthesisUtterance(); //the text that the AI will say\n speech.text = \"\"; //starts empty, is checked later to prevent empty responses\n //if user is greeting the AI -----\n if (message.includes('hello')) {\n //array of possible responses\n const greetings = [\n 'who said you could speak to me?',\n 'leave me alone.',\n 'die in a hole.'\n ]\n const greet = greetings[Math.floor(Math.random() * greetings.length)]; //select a random response\n speech.text = greet; //final output is set\n }\n //-------------------------------\n //if the user is asks how the AI is\n else if (message.includes('how are you')) {\n //array of possible responses\n const howWeBe = [\n 'i was doing better until you showed up',\n 'i\\'m a hardcoded speaking Javascript file you moron, what do you think?',\n 'seriously, who asks an \\\"AI\\\" made by college kids how they\\'re doing.'\n ]\n const how = howWeBe[Math.floor(Math.random() * howWeBe.length)]; //select a random response\n speech.text += how; //final output is set\n }\n //-------------------------------\n //if user asks for weather ------\n else if (message.includes('weather')) {\n getWeather(); //updates weather\n //variables for weather data --\n var temp = Math.floor(Number(document.getElementById('temp').innerHTML) - 273.15);\n var feelsLike = Math.floor(Number(document.getElementById('feelslike').innerHTML) - 273.15);\n var placeName = document.getElementById('place').innerHTML;\n placeName = placeName.charAt(0).toLowerCase() + placeName.slice(1);\n var skies = document.getElementById('weather').innerHTML;\n //----------------------------\n var weatherR = \"in \" + placeName + \", the temperature is \" + temp + \" degrees celsius\" //basic weather output\n //if it feels like something different than the actual temp\n if (temp == feelsLike) {\n weatherR += \". \";\n } else {\n weatherR += \", but it feels like \" + feelsLike + \" degrees. \";\n }\n //extra information based on if its clear, rainy, cloudy, etc.\n if (skies == 'Clear') {\n weatherR += \"today the skies are clear, meaning sadly nothing to ruin your day. At least not weather wise.\";\n } else if (skies == 'Rain') {\n weatherR += \"today there is rain, meaning you can maybe finally wash that smell off you.\";\n } else if (skies == 'Snow') {\n weatherR += \"there's snow today, so stay inside and suffer instead! I'll enjoy it.\";\n } else if (skies == \"Clouds\") {\n weatherR += \"the skies are cloudy today, so enjoy the wonderful lack of sunlight!\";\n } else if (skies == \"Haze\") {\n weatherR += \"it's hazy today, so have fun seeing clearly!\"\n }\n speech.text += weatherR; //final output is set\n }\n // //google placeholder\n // else if (message.includes(\"google\")) {\n // }\n //-------------------------------\n //generic wolfram alpha search --\n else {\n document.getElementById('generic').innerHTML = message;\n python();\n console.log(document.getElementById('generic').innerHTML);\n }\n //-------------------------------\n //voice synthesis properties ----\n speech.volume = 1;\n speech.rate = .95;\n speech.pitch = 1;\n speech.lang = 1;\n if (speech.text == \"\") { //prevent empty response with default/fallback response\n speech.text += \"At least tell me something I can understand.\"\n }\n aiOutput.textContent = speech.text;\n window.speechSynthesis.speak(speech); //makes AI actually speak + respond\n //-------------------------------\n}",
"function toNeumeFromVariations(){\n pushedVariations = false;\n variations = new Array();\n \n document.getElementById(\"input\").innerHTML = neumeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function createNewNote()\n{\n randomNote = int(random(notes.length - 1));\n goalNote = notes[randomNote].note\n goalFrequency = -notes[randomNote].frequency\n\n // play voice over when the new note is created\n playVoiceOver();\n}",
"function updatePitch( time ) {\n\n\tanalyser.getFloatTimeDomainData( buf );\n\tvar ac = autoCorrelate( buf, contextAudio.sampleRate );\n\n\t\tif (ac == -1) {\n\n\t\t\tconsole.log(\"frequency not available\");\n\n\t\t\t} else {\n\t\t\t\tpitch = ac;\n\t\t\t\t// pitchElem.innerText = Math.round( pitch ) ;\n\n\t\t\t\tvar note = noteFromPitch( pitch );\n\t\t\t\tpitchElem.innerText = noteArray[note%12];\n\n\t\t\t}\n}",
"function runPiano() {\n\t// input the individual note into a json object and uploaded to the\n\t// VF.StaveNote function in order to print the music note notation\n\n\t// json2obj function can convert the three array list, alphabet, repeats, and speed sound\n\t// into a object\n\tfunction json2obj(notes_list, repeat_list, timeout_list){\n\t\tvar i = 1;\n\t\t// verifying wheter there is no duplicate\n\t\tif (i == repeat_list) {\n\t\t\t// appending into a new array\n\t\t\tnotes_parsed.push(notes_list)\n\t\t\tnotes_time.push(timeout_list)\n\t\t\t// generating the syntax string in order to converted into a json\n\t\t\tvar json1 = '{\"keys\": [\"';\n\t\t\tvar json2 = notes_list + '/4\"], \"duration\": \"q\"}';\n\t\t\tvar json3 = json1.concat(json2)\n\t\t\t// parse the json into a object\n\t\t\tconst obj = JSON.parse(json3);\n\t\t\t// create a note using Vexflow\n\t\t\tvar note = new VF.StaveNote(obj);\n\t\t\t// append the final result\n\t\t\tnotes.push(note);\n\t\t\treturn notes;\n\t\t} else {\n\t\t\t\t// generate the duplicate audio\n\t\t\t\twhile( i <= repeat_list)\n\t\t\t\t{\n\t\t\t\t// append the input into a new array\n\t\t\t\tnotes_parsed.push(notes_list)\n\t\t\t\tnotes_time.push(timeout_list)\n\t\t\t\t// generating the syntax string in oreder to converted into a json\n\t\t\t\tvar json1 = '{\"keys\": [\"';\n\t\t\t\tvar json2 = notes_list + '/4\"], \"duration\": \"q\"}';\n\t\t\t\tvar json3 = json1.concat(json2)\n\t\t\t\t// parse the json into a object\n\t\t\t\tconst obj = JSON.parse(json3);\n\t\t\t\t// create a note using Vexflow\n\t\t\t\tvar note = new VF.StaveNote(obj);\n\t\t\t\t\n\t\t\t\t// append the input\n\t\t\t\tnotes.push(note);\n\t\t\t\ti = i + 1;\n\t\t\t\t\n\t\t\t}\n\t\t\t// return the final result\n\t\t\treturn notes;\n\t\t}\n\t\t\n\t}\n\n\t// getUnique function will eliminate any duplicate in the array\n\tfunction getUnique(array) {\n\t\tvar uniqueArray = [];\n\t\t// Loop through array values\n\t\tfor (i = 0; i < array.length; i++) {\n\t\t\t// check wheter there is no duplicate\n\t\t\tif (uniqueArray.indexOf(array[i]) === -1) {\n\t\t\t\t// append into the array\n\t\t\t\tuniqueArray.push(array[i]);\n\t\t\t}\n\t\t}\n\t\t// return the result\n\t\treturn uniqueArray;\n\n\t}\n\t// try and catch used for Error Handling\n\ttry {\n\n\tvar complete_note_list = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\"];\n\t// delete the lines\n\tnotes_raw = $(\"#input_notes\").val().split(/\\r?\\n/);\n\t\n\tlet onlyLetters = /[a-zA-Z]+/g\n\tlet onlyNumeric = /[+-]?(\\d+([.]\\d*)?(e[+-]?\\d+)?|[.]\\d+(e[+-]?\\d+)?)/g\n\tlet onlyFloat = /[+-]?(\\d+([.]\\d*)?(e[+-]?\\d+)?|[.]\\d+(e[+-]?\\d+)?)/g\n\t// generate an array only show the repetition\n\tnotes_repeat = $(\"#input_notes\").val().match(onlyNumeric).map(s => s.slice(0, 1));\n\t// generate an array only show the speed\n\tnotes_timeout = ($(\"#input_notes\").val().match(onlyFloat)).map(s => s.slice(1, 4));\n\t\n\n\t//////////////////////////////\n\t// Error Handling //\n\t/////////////////////////////\n\tvar max_repeat_numb_notes = 9;\n\t// Error try and catch\n\t// It constrains the user to use only one note per line.\n\n\t// This for loop clean the white spaces and appends into new string array\n\t// empty array\n\tnew_notes_raw = [];\n\tnotes_letter = [];\n\t// for loop go through alphabet notes input\n\tfor (m = 0; m < notes_raw.length; m++) {\n\t\t// trim every row that does have any white space\n\t\tnumber_rows = notes_raw[m].trim();\n\t\tif (Boolean(number_rows)) {\n\t\t\t// store the letter into a variable\n\t\t\tletter = number_rows.match(onlyLetters)[0];\n\t\t\t// append the letter,duplicate, and speed\n\t\t\tnew_notes_raw.push(number_rows);\n\t\t\t// append the letter\n\t\t\tnotes_letter.push(letter)\n\t\t}\n\t}\n\t\n\t\n\t// Sorting and Unique the Alphabet Notes\n\tsort_letters = notes_letter.sort();\n\tsort_uniq_letters = getUnique(sort_letters);\n\t\n\n\t// Debuginnin to see what is going on in the code\n\t/*console.log(new_notes_raw);\n\tconsole.log(notes_letter);\n\tconsole.log(sort_uniq_letters);\n\tconsole.log(complete_note_list);\n\tconsole.log(notes_repeat);\n\tconsole.log(notes_timeout);\n\t*/\n\t\n\n\t// Check the number of row per each line \n\t// if there is more than one note will stop the code\n\tfor (m = 0; m < new_notes_raw.length; m++) {\n\t\t// split the space of the input value note\n\t\tnumber_rows = new_notes_raw[m].split(\" \").length;\n\t\t\n\t\t//console.log(number_rows)\n\t\t// if there are two or more inputs in one row\n\t\tif (number_rows > 1) {\n\t\t\t// Give error to the user\n\t\t\tthrow \"Please add one note per line!\";\n\t\t} \n\n\t}\n\t// Use the filter command to determine the difference and it is not in the notes of the alphabet\n\tlet difference = sort_uniq_letters.filter(element => !complete_note_list.includes(element));\n\t//console.log(difference);\n\t// if there more than one in the difference array that means the user has alphabet that does not \n\t// follow the alphabet notes\n\tif (difference.length > 0 ) {\n\t\tthrow \"Please use first seven letters of the alphabet!\"\n\t}\n\t// Use only 1-9 repetitions\n\t// If statement will constraint the user and allow to use only certain number of repetitions\n\tif (max_repeat_numb_notes > 10){\n\t\tthrow \"Please use no more than 9 duplicates!\"\n\t}\n\n\t\n\t\n /////////////////////\n\t// Reference Notes //\n\t/////////////////////\n\n\t// It will print the symbol note notation for the user to help follow the audio\n\n\tVF1 = Vex.Flow;\n\t\n\t// Create an SVG renderer and attach it tot he DIV element named \"reference notes\"\n\tvar div1 = document.getElementById(\"reference_notes\")\n\n\tvar renderer = new VF1.Renderer(div1, VF1.Renderer.Backends.SVG);\n\n\tpx1=500;\n\t// Size SVG\n\trenderer.resize(px1+100, px1/4);\n\t// and get a drawing context\n\tvar context1 = renderer.getContext();\n\t\n\tcontext1.setFont(\"Times\", 10, \"\").setBackgroundFillStyle(\"#eed\");\n\n\tvar stave1 = new VF1.Stave(10, 0, px1);\n\n\tstave1.addClef(\"treble\");\n\t// Connect it to the rendering context and draw!\n\tstave1.setContext(context1).draw();\n\t// Generate your input notes\n\tvar notes_ref = [\n\t\tnew VF1.StaveNote({ keys: [\"a/4\"], duration: \"q\" }),\n\t\tnew VF1.StaveNote({ keys: [\"b/4\"], duration: \"q\" }),\n\t\tnew VF1.StaveNote({ keys: [\"c/4\"], duration: \"q\" }),\n\t\tnew VF1.StaveNote({ keys: [\"d/4\"], duration: \"q\" }),\n\t\tnew VF1.StaveNote({ keys: [\"e/4\"], duration: \"q\" }),\n\t\tnew VF1.StaveNote({ keys: [\"f/4\"], duration: \"q\" }),\n\t\tnew VF1.StaveNote({ keys: [\"g/4\"], duration: \"q\" })\n\t];\t\n\n\t// Create a voice in 4/4 and add above notes\n\tvar voice_ref = new VF1.Voice({ num_beats: 7, beat_value: 4 });\n\tvoice_ref.addTickables(notes_ref);\n\n\t// Format and justify the notes to 400 pixels.\n\tvar formatter1 = new VF1.Formatter().joinVoices([voice_ref]).format([voice_ref], px1);\n\n\t// Render voice\n\tvoice_ref.draw(context1, stave1);\n\t\n\n\t/////////////////////\n\t// Real-Time Notes //\n\t/////////////////////\n\n\tVF = Vex.Flow;\n\n\t// Create an SVG renderer and attach it to the DIV element named \"play piano\".\n\tvar div = document.getElementById(\"play_piano\")\n\tvar renderer = new VF.Renderer(div, VF.Renderer.Backends.SVG);\n\n\t//px = notes_letter.length * 500;\n\tpx=1000;\n\t// Configure the rendering context.\n\n\trenderer.resize(px+100, px/5);\n\tvar context = renderer.getContext();\n\t\n\tcontext.setFont(\"Arial\", 10, \"\").setBackgroundFillStyle(\"#eed\");\n\t// 13 notes = 500 px\n\t// Create a stave of width 400 at position 10, 40 on the canvas.\n\t\n\tvar stave = new VF.Stave(10, 0, px);\n\t\n\t// Add a clef and time signature.\n\t\n\tstave.addClef(\"treble\");\n\t// Connect it to the rendering context and draw!\n\tstave.setContext(context).draw();\n\t\n\t// empty array\n\tvar notes_parsed = []\n\tvar notes_time = []\n\tvar notes=[];\n\t\n\t\n\t// for loop will convert the array into json to object\n\tfor (index = 0; index < notes_raw.length; index++) {\n\t\t\tfor (n = 0; n < notes_raw.length; n++) {\n\t\t\t\tfor (i = 0; i < complete_note_list.length; i++){\n\t\t\t\t\t// compare if the notes are identical\n\t\t\t\t\tif (notes_raw[index][n] == complete_note_list[i]) {\n\t\t\t\t\t\t// call the json to object function\n\t\t\t\t\t\tnotes = json2obj(notes_raw[index][n], notes_repeat[index],notes_timeout[index]);\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t}\n\n\n\t\n\tconsole.log(notes)\n\t\n\t// for loop determine whether the following notes belong to the \n\t// correct audio\n\ttiming = 0\n\t//index_ms_offset = 3000\n\t// Adding a weight to speed or slow down the audio note\n\tweight=30000;\n\tfor (index = 0; index < notes_parsed.length; index++) {\n\t\tif (notes_parsed[index] == 'A') {\n\t\t\t// Time delay\n\t\t\tsetTimeout( function() {\n\t\t\t// Play Audio\t\n\t\t\t\tnew Audio('media/high_a.mp3').play()\n\t\t\t}, weight*notes_time[index] * index)\n\t\t} else if (notes_parsed[index] == 'B' ) {\t\n\t\t\t// Time delay\n\t\t\tsetTimeout(function() {\n\t\t\t// Play Audio\t\n\t\t\t\tnew Audio('media/high_b.mp3').play()\n\t\t\t}, weight*notes_time[index] * index )\n\t\t} else if (notes_parsed[index] == 'C' ) {\n\t\t\t// Time delay\t\t\n\t\t\tsetTimeout(function() {\t\n\t\t\t// Play Audio\t\n\t\t\t\tnew Audio('media/high_c.mp3').play()\n\t\t\t}, weight*notes_time[index] * index )\n\t\t} else if (notes_parsed[index] == 'D' ) {\n\t\t\t// Time delay\t\n\t\t\tsetTimeout(function() {\n\t\t\t// PLay Audio\t\n\t\t\t\tnew Audio('media/high_d.mp3').play()\n\t\t\t}, weight*notes_time[index] * index ) \n\t\t} else if (notes_parsed[index] == 'E' ) {\n\t\t\t\n\t\t\t// Time Audio\n\t\t\tsetTimeout(function() {\n\t\t\t// Play Audio\n\t\t\t\tnew Audio('media/high_e.mp3').play()\n\t\t\t}, weight*notes_time[index] * index )\n\t\t} else if (notes_parsed[index] == 'F') {\n\t\t\t\n\t\t\t// Time Audio\n\t\t\tsetTimeout(function() {\n\t\t\t// Play Audio\n\t\t\t\tnew Audio('media/high_f.mp3').play()\n\t\t\t}, weight*notes_time[index] * index )\n\t\t} else if (notes_parsed[index] == 'G') {\n\t\t\t\n\t\t\t// Time Audio\n\t\t\tsetTimeout(function() {\n\t\t\t// Play Audio\t\n\t\t\t\tnew Audio('media/high_g.mp3').play()\n\t\t\t}, weight*notes_time[index] * index )\n\n\t\t}\n\t}\n\t\n\t//alert(notes_parsed)\n\tconsole.log(notes);\n\n\n\n// Create a voice in 4/4 and add above notes\nvar voice = new VF.Voice({num_beats: notes_parsed.length, beat_value: 4});\nvoice.addTickables(notes);\n\n// Format and justify the notes to 400 pixels.\nvar formatter = new VF.Formatter().joinVoices([voice]).format([voice], px);\n\n// Render voice\nvoice.draw(context, stave);\n\n\n\t// Javascript Buttons -> HTML5\n\tvar clearBtn = document.getElementById('ClearNote');\n\tclearBtn.addEventListener('click', e => {\n\t\t\n\t\tconst staff1 = document.getElementById('reference_notes')\n\t\twhile (staff1.hasChildNodes()) {\n\t\t\tstaff1.removeChild(staff1.lastChild);\n\t\t}\n\n\t\tconst staff2 = document.getElementById('play_piano')\n\t\twhile (staff2.hasChildNodes()) {\n\t\t\tstaff2.removeChild(staff2.lastChild);\n\t\t}\n\n\t})\n\t// Generate the concatenate code for stand-alone html5\n\t\tvar htmlTEMPLATE=\"<!doctype html>\"\n\t\thtmlTEMPLATE=htmlTEMPLATE+\"<html>\\n<head><\\/head>\\n<body>\\n\"\n\t\thtmlTEMPLATE=htmlTEMPLATE+\"<script>@@@PLAY_CODE<\\/script>\"\n\t\thtmlTEMPLATE = htmlTEMPLATE+\"<\\/body>\\n<\\/html>\\n\"\n\n\n\t\t// for loop and if statement\n\t\t// generating the code for each note and audio note\n\t\tcode_output = \"\\n\"\n\t\ttiming = 0\n\t\t//index_ms_offset = 1000\n\t\tweight = 30000;\n\t\tfor (index = 0; index < notes_parsed.length; index++) {\n\t\t\tif (notes_parsed[index] == 'A') {\n\t\t\t\tcode_output = code_output + \"setTimeout( function(){\\n\"\n\t\t\t\tcode_output = code_output + \"new Audio('media/high_a.mp3').play()\"\n\t\t\t\tcode_output = code_output + \"}, \" + weight + \" * \" + notes_time[index] + \" * \" + index + \");\\n \"\n\t\t\t} else if (notes_parsed[index] == 'B') {\n\t\t\t\tcode_output = code_output + \"setTimeout( function(){\\n\"\n\t\t\t\tcode_output = code_output + \"new Audio('media/high_b.mp3').play()\"\n\t\t\t\tcode_output = code_output + \"}, \" + weight + \" * \" + notes_time[index] + \" * \" + index + \");\\n \"\n\t\t\t} else if (notes_parsed[index] == 'C') {\n\t\t\t\tcode_output = code_output + \"setTimeout( function(){\\n\"\n\t\t\t\tcode_output = code_output + \"new Audio('media/high_c.mp3').play()\"\n\t\t\t\tcode_output = code_output + \"}, \" + weight + \" * \" + notes_time[index] + \" * \" + index + \");\\n \"\n\t\t\t} else if (notes_parsed[index] == 'D') {\n\t\t\t\tcode_output = code_output + \"setTimeout( function(){\\n\"\n\t\t\t\tcode_output = code_output + \"new Audio('media/high_d.mp3').play()\"\n\t\t\t\tcode_output = code_output + \"}, \" + weight + \" * \" + notes_time[index] + \" * \" + index + \");\\n \"\n\t\t\t} else if (notes_parsed[index] == 'E') {\n\t\t\t\tcode_output = code_output + \"setTimeout( function(){\\n\"\n\t\t\t\tcode_output = code_output + \"new Audio('media/high_e.mp3').play()\"\n\t\t\t\tcode_output = code_output + \"}, \" + weight + \" * \" + notes_time[index] + \" * \" + index + \");\\n \"\n\t\t\t} else if (notes_parsed[index] == 'F') {\n\t\t\t\tcode_output = code_output + \"setTimeout( function(){\\n\"\n\t\t\t\tcode_output = code_output + \"new Audio('media/high_f.mp3').play()\"\n\t\t\t\tcode_output = code_output + \"}, \" + weight + \" * \" + notes_time[index] + \" * \" + index + \");\\n \"\n\t\t\t} else if (notes_parsed[index] == 'G') {\n\t\t\t\tcode_output = code_output + \"setTimeout( function(){\\n\"\n\t\t\t\tcode_output = code_output + \"new Audio('media/high_g.mp3').play()\"\n\t\t\t\tcode_output = code_output + \"}, \" + weight + \" * \" + notes_time[index] + \" * \" + index + \");\\n \"\n\t\t\t}\n\t\t}\n\n\t// print the code\n\t$(\"#compiled_code\").val(htmlTEMPLATE.replace(\"@@@PLAY_CODE\", code_output))\n\t} catch(err) {\n\t\talert(\"Error: \" + err);\n\t\t\n\t\t\n\t}\n\t\n}",
"function speak(text, pitch) {\n\n // Create a new instance of SpeechSynthesisUtterance.\n let utterThis = new SpeechSynthesisUtterance();\n\n // Set the attributes.\n utterThis.volume = 1;\n utterThis.rate = 1;\n // utterThis.pitch = parseFloat(pitchInput.value);\n utterThis.pitch = pitch;\n // console.log(\"talking\");\n\n // Set the text.\n utterThis.text = text;\n utterThis.voice = speechSynthesis.getVoices().filter(function(voice) { return voice.name == voiceSelect1.value; })[0];\n // Queue this utterance.\n window.speechSynthesis.speak(utterThis);\n}",
"function applyCurrentPitch(){\n currentPitchIndex = document.getElementById(\"pitc\").value;\n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n}",
"function itSays() {\n\tfs.readFile(\"random.txt\", \"utf8\", function(error, data) {\n\t\tif (error) {\n\t\t\treturn console.log(error);\n\t\t} else {\n\t\t\tvar dataArr = data.split(\",\");\n\t\t\tuserInput[3] = dataArr[1];\n\t\t\tspotifySong();\n }\n }\n )}",
"function readOutLoud(message){\n var speech = new SpeechSynthesisUtterance(); //Built-in fuction which help JS to talk to us\n\n speech.text = \"Pardon!!\"; // Default speech\n\n if(message.includes(\"how are you\")) {\n var final = greetings[Math.floor(Math.random() * greetings.length)];\n speech.text = final;\n }else if(message.includes(\"joke\")){\n var final = jokes[Math.floor(Math.random() * jokes.length)];\n speech.text = final;\n }else if(message.includes(\"your name\")){\n speech.text = \"My name is Noxi\";\n }\n\n \n speech.volume = 1;\n speech.rate = 0.7;\n speech.pitch = 1;\n\n //Now Noxi will speak\n window.speechSynthesis.speak(speech);\n}"
] | [
"0.6741597",
"0.597301",
"0.58804256",
"0.58528537",
"0.5750121",
"0.5664778",
"0.5650399",
"0.5647673",
"0.56339335",
"0.5263557",
"0.5105627",
"0.498471",
"0.48323354",
"0.48112124",
"0.47628936",
"0.47326404",
"0.47216412",
"0.47216412",
"0.47216412",
"0.46968457",
"0.45648763",
"0.4516546",
"0.4489588",
"0.44815132",
"0.44636735",
"0.44335377",
"0.44218975",
"0.44163024",
"0.4396563",
"0.43911192"
] | 0.6479758 | 1 |
Reads the data entered in the neume form and saves it. Thereby the function controls the length and intervals for neumes of the types virga, punctum, pes, clivis, torculus, porrectus, scandicus and climacus. Also if the first pitch is not specified for the previously mentioned types, the function will automatically generate the rest of the neume. | function createPitch(){
var pitch = document.getElementById("pitch").value;
var octave = document.getElementById("octave").value;
var comment = document.getElementById("comment").value;
var intm = document.getElementById("intm").value;
var connection = document.getElementById("connection").value;
var tilt = document.getElementById("tilt").value;
var variation = document.getElementById("variation").value;
var supplied = document.getElementById("supplied").value;
var p = new Pitch(pitch, octave, comment, intm, connection, tilt, variation, supplied);
currentNeume.pitches.push(p);
if(currentNeume.type == "virga" || currentNeume.type == "punctum"){
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(currentNeume.type == "pes"){
if(pitch == "none" && pitchCounter == 0){
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "u";
currentNeume.pitches.push(p);
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(pitchCounter == 0){
currentIntm = "u";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 1)
{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(currentNeume.type == "clivis"){
if(pitch == "none" && pitchCounter == 0){
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "d";
currentNeume.pitches.push(p);
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(pitchCounter == 0){
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 1)
{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(currentNeume.type == "torculus"){
if(pitch == "none" && pitchCounter == 0){
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "d";
currentNeume.pitches.push(p);
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(pitchCounter == 0){
currentIntm = "u";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 1)
{
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 2)
{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(currentNeume.type == "porrectus"){
if(pitch == "none" && pitchCounter == 0){
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "d";
currentNeume.pitches.push(p);
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(pitchCounter == 0){
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 1)
{
currentIntm = "u";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 2)
{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(currentNeume.type == "climacus"){
if(pitch == "none" && pitchCounter == 0){
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "d";
currentNeume.pitches.push(p);
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(pitchCounter == 0){
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 1)
{
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 2)
{
if(maxPitches == 4 || maxPitches == 5){
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(pitchCounter == 3)
{
if(maxPitches == 5){
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(pitchCounter == 4)
{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(currentNeume.type == "scandicus"){
if(pitch == "none" && pitchCounter == 0){
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "d";
currentNeume.pitches.push(p);
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(pitchCounter == 0){
currentIntm = "u";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 1)
{
currentIntm = "u";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 2)
{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(currentNeume.type == "torculusresupinus"){
if(pitch == "none" && pitchCounter == 0){
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "d";
currentNeume.pitches.push(p);
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "u";
currentNeume.pitches.push(p);
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(pitchCounter == 0){
currentIntm = "u";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 1)
{
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 2)
{
currentIntm = "u";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 3)
{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else{
document.getElementById("input").innerHTML = pitchForm();
}
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createNeumeVariation(){\n var sourceID = document.getElementById(\"source\").value;\n var type = document.getElementById(\"type\").value;\n \n if(isClimacus){\n maxPitches = document.getElementById(\"numberofpitches\").value;\n }\n \n currentSID = sourceID;\n \n currentNeume = new Neume();\n currentNeume.type = type;\n \n if(type == \"virga\" || type == \"punctum\"){\n var p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"pes\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"clivis\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"torculus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"porrectus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"climacus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(maxPitches == 4){\n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n \n if(maxPitches == 5){\n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n }\n else if(currentNeume.type == \"scandicus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n \n var i;\n \n if(neumeVariations.length < 1){\n for(i = 0; i < sources.length; i++){\n var neumeVariation = new NeumeVariation(sources[i].id);\n neumeVariations.push(neumeVariation);\n }\n }\n \n for(i = 0; i < neumeVariations.length; i++){\n if(neumeVariations[i].sourceID == sourceID){\n neumeVariations[i].additionalNeumes.push(currentNeume);\n break;\n }\n }\n \n if(!pushedNeumeVariations){\n currentSyllable.neumes.push(neumeVariations);\n pushedNeumeVariations = true;\n }\n else{\n currentSyllable.neumes.pop();\n currentSyllable.neumes.push(neumeVariations);\n }\n \n isNeumeVariant = true;\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n createSVGOutput();\n}",
"function createNeume(){\n var type = document.getElementById(\"type\").value;\n \n if(isClimacus){\n maxPitches = document.getElementById(\"numberofpitches\").value;\n }\n \n currentNeume = new Neume();\n currentNeume.type = type;\n \n if(type == \"virga\" || type == \"punctum\"){\n var p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"pes\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"clivis\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"torculus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"porrectus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"climacus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(maxPitches == 4){\n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n \n if(maxPitches == 5){\n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n }\n else if(currentNeume.type == \"scandicus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n \n currentSyllable.neumes.push(currentNeume);\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = neumeForm();\n createSVGOutput();\n}",
"function createNeumeWithPitches(){\n var type = document.getElementById(\"type\").value;\n \n if(isClimacus){\n maxPitches = document.getElementById(\"numberofpitches\").value;\n }\n \n currentNeume = new Neume();\n currentNeume.type = type;\n \n currentSyllable.neumes.push(currentNeume);\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = pitchForm();\n createSVGOutput();\n}",
"function createNeumeVariationWithPitches(){\n var sourceID = document.getElementById(\"source\").value;\n var type = document.getElementById(\"type\").value;\n \n if(isClimacus){\n maxPitches = document.getElementById(\"numberofpitches\").value;\n }\n \n currentNeume = new Neume();\n currentNeume.type = type;\n \n var i;\n \n if(neumeVariations.length < 1){\n for(i = 0; i < sources.length; i++){\n var neumeVariation = new NeumeVariation(sources[i].id);\n neumeVariations.push(neumeVariation);\n }\n }\n \n for(i = 0; i < neumeVariations.length; i++){\n if(neumeVariations[i].sourceID == sourceID){\n neumeVariations[i].additionalNeumes.push(currentNeume);\n break;\n }\n }\n \n if(!pushedNeumeVariations){\n currentSyllable.neumes.push(neumeVariations);\n pushedNeumeVariations = true;\n }\n else{\n currentSyllable.neumes.pop();\n currentSyllable.neumes.push(neumeVariations);\n }\n \n isNeumeVariant = true;\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = pitchForm();\n createSVGOutput();\n}",
"function applyPitchDataChanges(){\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"connection\").value;\n var tilt = document.getElementById(\"tilt\").value;\n var variation = document.getElementById(\"variation\").value;\n var supplied = document.getElementById(\"supplied\").value;\n \n if(pitch && pitch != \"none\"){\n currentPitch.pitch = pitch;\n }\n if(octave && octave != \"none\"){\n currentPitch.octave = octave;\n }\n if(comment && comment != \"none\"){\n currentPitch.comment = comment;\n }\n if(intm && intm != \"none\"){\n currentPitch.intm = intm;\n }\n if(connection && connection != \"none\"){\n currentPitch.connection = connection;\n }\n if(tilt && tilt != \"none\"){\n currentPitch.tilt = tilt;\n }\n if(variation && variation != \"none\"){\n currentPitch.variation = variation;\n }\n if(supplied && supplied != \"none\"){\n currentPitch.supplied = supplied;\n }\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function applyVariationDataChanges(){\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"connection\").value;\n var tilt = document.getElementById(\"tilt\").value;\n var graphicalVariation = document.getElementById(\"variation\").value;\n var supplied = document.getElementById(\"supplied\").value;\n \n if(pitch && pitch != \"none\"){\n currentVarPitch.pitch = pitch;\n }\n if(octave && octave != \"none\"){\n currentVarPitch.octave = octave;\n }\n if(comment && comment != \"none\"){\n currentPitch.comment = comment;\n }\n if(intm && intm != \"none\"){\n currentVarPitch.intm = intm;\n }\n if(connection && connection != \"none\"){\n currentPitch.connection = connection;\n }\n if(tilt && tilt != \"none\"){\n currentVarPitch.tilt = tilt;\n }\n if(graphicalVariation && graphicalVariation != \"none\"){\n currentVarPitch.variation = graphicalVariation;\n }\n if(supplied && supplied != \"none\"){\n currentPitch.supplied = supplied;\n }\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function prepareNovel()\r\n{\r\n novel.imagePath = \"\"; // path to your image directory\r\n novel.audioPath = \"\"; // path to your audio directory\r\n \r\n // initialize your characters, positions, and text blocks here\r\n\r\n\tskeptic = new Character(\"Лу\", {color: \"#FFD800\"});\r\n optimist = new Character(\"Ами\", {color: \"#3988FA\"});\r\n\tdreamer = new Character(\"Неос\", {color: \"#FF354E\"});\r\n realist = new Character(\"Гелиос\", {color: \"#31EA6C\"});\r\n\t\r\n\tskeptic2 = new Character(\"Кто-то\", {color: \"#FFD800\"});\r\n optimist2 = new Character(\"Кто-то\", {color: \"#3988FA\"});\r\n\tdreamer2 = new Character(\"Кто-то\", {color: \"#FF354E\"});\r\n realist2 = new Character(\"Кто-то\", {color: \"#31EA6C\"});\r\n\t\r\n\tsomeone = new Character(\"Кто-то\", {color: \"gray\"});\r\n\tdark = new Character(\"Тьма\", {color: \"black\"});\r\n\tcreator = new Character(\"Создатель\", {color: \"white\"});\r\n\tsomeone2 = new Character(\"Кто-то\", {color: \"white\"});\r\n\t\r\n n = new Character(\"\");\r\n \r\n leftSide = new Position(0.1, 0.95, 0, 1);\r\n\tleftMiddleSide = new Position(0.2, .95, 0, 1);\r\n rightSide = new Position(0.95, 0.95, 1, 1);\r\n\trightMiddleSide = new Position(0.8, 0.95, 1, 1);\r\n upperCenter = new Position(0.5, 0.5, 0.5, 0.5);\r\n rightTop = new Position(1, 0.1, 1, 0);\r\n\tCenter = new Position(0.64, 0.97, 1, 1);\r\n \r\n photo = new Character(\"\"); \r\n lionText = new TextBlock(\"myText\");\r\n\t\r\n \r\n // and put your script commands into this array\r\n script = [\r\n label, \"start\",\r\n\t\t\r\n\t\tn, \"История начинается прямо здесь, с этой минуты. Приятного прохождения!\",\r\n\t\t\r\n\t\tscene, {image: \"start.png\", position: Center, effect: \"fade\"},\r\n\t\tn, \"Представляют.\",\r\n\t\tn, \"...\",\r\n\t\tscene, \"\",\r\n\t\t\r\n\t\taudio, {src: \"bensound-memories\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\r\n\t\tn, \"— ...\",\r\n\t\tsomeone, \"— В самом начале было <strong>ни-че-го</strong>.\",\r\n\t\tsomeone, \"— ...ничего кроме тишины и полной темноты, и ведь казалось бы, ничего не может появится, как и до этого...\",\r\n\t\tscene, {image: \"BG1.png\", position: Center},\r\n\t\tsomeone, \"— Но рассеял полную темноту светом Создатель... и это было <strong>хорошо</strong>.\",\r\n\t\tsomeone, \"— То, что это было хорошо, надо просто принять.\",\r\n\t\tscene, {image: \"BG0.png\", position: Center},\r\n\t\tsomeone, \"— Свет не имел формы, но постепенно начал принимать очертания.\",\r\n\t\tscene, {image: \"BG.png\", position: Center},\r\n\t\tsomeone, \"— Очертания эти изливались в самые своеобразные формы...\",\r\n\t\tsomeone, \"— ...пока наконец не приняли форму четырёх существ, которым было подвластно формировать мир вокруг себя.\",\r\n\t\t\r\n\t\taudio, {src: \"stop\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\r\n\t \r\n\trealist2, {image: \"realist.png\", position: Center, avatar: \"avataragelious.png\"},\r\n\trealist2, \"— ...Так-так.\",\r\n\t\taudio, {src: \"bensound-sweet\", format: [\"mp3\"], action: \"play\"},\r\n\t\trealist2, \"— Ты вообще тут? Может вернемся к нашим баранам?\",\t\r\n\trealist, {image: \"realist.png\", position: leftMiddleSide, avatar: \"avataragelious.png\"},\r\n\toptimist2, {image: \"optimist2.png\", position: rightMiddleSide, avatar: \"avatarami.png\"},\r\n\t\toptimist2, \"— ...Да.\",\r\n\t\toptimist2, \"— Извини, Гелиос.\",\r\n\t\toptimist2, \"— Что-то в ностальгию ударилась…\",\r\n\toptimist2, {image: \"optimist.png\", position: rightMiddleSide},\t\t\r\n\t\tn, \"*Героиня слегка дёрнула плечами*.\",\r\n\t\toptimist2, \"— Вспоминала, зачем мы вообще здесь собрались.\",\r\n\t\toptimist2, \"— А кто такие <i>бараны</i>?\",\r\n\t\tn, \"*Гелиос отмахивается*\",\r\n\t\trealist, \"— ...Не суть важно.\",\r\n\t\trealist, \"— Давайте сосредоточимся.\",\r\n\toptimist2, {image: \"optimist.png\", position: rightMiddleSide},\r\n\trealist, {image: \"empty.png\", position: leftSide},\r\n\tskeptic2,{image: \"skeptic2.png\", position: rightMiddleSide, avatar: \"avatarlu.png\"},\r\n\t\tskeptic2, \"— ...\",\r\n\t\tskeptic2, \"— А где Неос?\",\r\n\t\tskeptic2, \"— Разве она не должна быть с нами?\",\r\n\trealist, {image: \"realist0.png\", position: leftSide},\r\n\tskeptic2,{image: \"empty.png\", position: leftMiddleSide},\r\n\toptimist2, {image: \"empty.png\", position: leftSide},\r\n\t\trealist, \"— Должна. Сейчас.\",\r\n\trealist, {image: \"realist2.png\", position: leftSide, avatar: \"avataragelious.png\"},\t\r\n\t\tn, \"*Гелиос привычно щёлкает пальцами*.\",\r\n\trealist, {image: \"empty.png\", position: leftSide},\t\r\n\t\tn, \"*Издалека появлятся маленькое светило.*\", \r\n\t\tn, \"*Спустя несколько мгновений светило приобретает вполне понятные очертания.*\", \r\n\t\tdreamer2, \"— ... \",\r\n\tdreamer, {image: \"dreamer2.png\", position: Center, avatar: \"avatarneos.png\"},\r\n\t\tdreamer2, \"— Я тут.\",\r\n\t\tdreamer, \"— И мне не нравится, когда меня призывают.\",\r\n\tdreamer, {image: \"dreamer2.png\", position: rightMiddleSide},\t\r\n\toptimist2, {image: \"optimist.png\", position: leftMiddleSide},\t\r\n\t\toptimist2, \"— Неос... Сама понимаешь... Путешествия — потом.\",\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\tskeptic2,{image: \"skeptic.png\", position: Center},\r\n\t\tskeptic2, \"— Решения не ждут.\",\r\n\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\tskeptic2,{image: \"empty.png\", position: rightMiddleSide},\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\trealist, {image: \"empty.png\", position: leftSide},\r\n\r\n\t\tlabel, \"oof\",\r\n\t\t\r\n\t\tn, \"— ...\",\r\n\toptimist2, {image: \"optimist.png\", position: Center, avatar: \"avatarami.png\"},\r\n\t\toptimist2, \"— Существам Создателя будет очень сложно в этом пространстве, конечно...\",\r\n\t\toptimist2, \"— Кто вообще в здравом уме ограничивает квинтэссенцию света всего в 3 измерениях!\",\r\n\toptimist2, {image: \"optimist.png\", position: rightSide},\t\r\n\tdreamer, {image: \"dreamer.png\", position: Center},\t\r\n\t\tdreamer, \"— Как там тебя… Ами? это от Amigo?\",\r\n\tdreamer, {image: \"dreamer.png\", position: rightMiddleSide},\t\r\n\t\tdreamer, \"— Я полагаю, всё не просто так.\",\r\n\toptimist2, {image: \"empty.png\", position: rightMiddleSide},\t\r\n\t\tdreamer, \"— Зато их индивидуальные ограничения дают им увлекательные сюжеты для жизни.\",\r\n\t\tdreamer, \"— Только посмотрите, что для них придумал Лу, наш техник вселенной.\",\r\n\t\tdreamer, \"— Они могут совершать действия только вперёд!\",\r\n\tdreamer, {image: \"dreamer3.png\", position: rightMiddleSide},\t\t\r\n\t\tdreamer, \"— Да, Лу?\",\r\n\t\tn, \"— Неос смеётся и дружески толкает плечом Лу.\",\r\n\t\t\r\n\t\r\n\tskeptic,{image: \"skeptic.png\", position: leftSide, avatar: \"avatarlu.png\"},\t\r\n\t\tskeptic, \"— Человеки позже назовут это ‘хроносом’.\",\r\n\t\tskeptic, \"— ...а ещё позже ‘временем’.\",\r\n\tdreamer, {image: \"empty.png\", position: rightMiddleSide},\t\r\n\r\n\tskeptic,{image: \"skeptic3.png\", position: Center},\t\t\t\r\n\t\tskeptic, \"— Всё дело в направлении света. Для меньших существ Создателя невозможно будет воспринимать такое количество света.\",\r\n\t\tskeptic, \"— Поэтому для них условия существования более сжаты.\",\r\n\tdreamer, {image: \"empty.png\", position: leftMiddleSide},\t\t\r\n\tskeptic,{image: \"skeptic.png\", position: rightMiddleSide},\t\r\n\toptimist2, {image: \"optimist.png\", position: leftMiddleSide},\r\n\t\toptimist, \"— Но им всё равно нужны дополнительные условия...\",\r\n\t\t\t\t\r\n\tskeptic,{image: \"skeptic.png\", position: rightSide},\t\r\n\trealist, {image: \"realist.png\", position: Center},\t\r\n\toptimist2, {image: \"empty.png\", position: leftSide},\r\n\t\trealist, \"— Подождите. Я давно хотел вам показать...\",\r\n\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\t\r\n\toptimist2,{image: \"empty.png\", position: rightMiddleSide},\r\n\trealist, {image: \"realist2.png\", position: rightMiddleSide},\t\r\n\t\trealist, \"— Для начала нам нужна концепция свободного выбора.\",\r\n\t\trealist, \"— ...с этой концепцией появляется многолинейность в потоке времени для человеков.\",\r\n\t\t\r\n\trealist, {image: \"realist0.png\", position: rightMiddleSide},\t\r\n\tdreamer, {image: \"dreamer.png\", position: leftMiddleSide},\t\r\n\t\tdreamer, \"— То есть, развитие временной спирали больше не предопределено?\",\r\n\trealist, {image: \"realist.png\", position: rightMiddleSide},\t\t\r\n\t\trealist, \"— предопределено, просто к одному и тому же последствию теперь можно прийти разными путями.\",\r\n\t\trealist, \"— правда, человеки назовут это ‘будущим’ и всё равно будут верить в неопределённость.\",\t\r\n\tdreamer, {image: \"empty.png\", position: leftMiddleSide},\t\r\n\tskeptic,{image: \"skeptic.png\", position: leftMiddleSide},\t\r\n\trealist, {image: \"realist0.png\", position: rightSide},\t\r\n\t\tskeptic, \"— Что ещё от них ожидать...\",\r\n\tskeptic,{image: \"skeptic.png\", position: Center},\t\r\n\trealist, {image: \"empty.png\", position: rightSide},\t\r\n\t\tn, \"В умных глазах Лу отражается сомнение.\", \r\n\t\tskeptic, \"— Концепция работает?\",\r\n\tskeptic,{image: \"empty.png\", position: Center},\t\r\n\trealist,{image: \"Head Gelious.png\", position: upperCenter},\r\n\t\r\n label, \"menu0\",\r\n menu, [\r\n\t\t\t\"Концепция работает?\",\r\n\t\t\t\"Да.\", [jump, \"main0\"],\r\n \"Другое да.\", [jump, \"main0\"],\r\n ],\r\n \r\n label, \"main0\",\r\n scene, {image: \"BG10.png\", position: Center},\r\n\t\t\t\t\r\n\trealist, {image: \"realist.png\", position: leftMiddleSide},\t\t\r\n\t\trealist, \"— Как видишь.\",\r\n\trealist, {image: \"realist2.png\", position: leftMiddleSide},\t\r\n\t\trealist, \"— Что насчёт элементов?.\",\r\n\t\t\r\n\trealist, {image: \"realist.png\", position: rightSide},\t\r\n\tskeptic,{image: \"skeptic.png\", position: leftMiddleSide},\t\r\n\t\tskeptic, \"— Вода и огонь, земля и воздух. Кстати, эти элементы между собой неожиданно сгенерировали целую систему механизмов.\",\r\n\t\tskeptic, \"— Живые существа будут называть это Природой.\",\r\n\t\t\r\n\tskeptic,{image: \"skeptic.png\", position: rightMiddleSide},\r\n\tdreamer, {image: \"dreamer.png\", position: leftSide},\t\r\n\t\tdreamer, \"— Невероятно большая...\", \r\n\tdreamer, {image: \"empty.png\", position: leftMiddleSide},\t\r\n\toptimist,{image: \"optimist.png\", position: leftMiddleSide, avatar: \"avatarami.png\"},\r\n\t\toptimist, \"— Это не будет опасно?.\",\r\n\t\t\r\n\tdreamer, {image: \"dreamer.png\", position: Center},\r\n\toptimist,{image: \"empty.png\", position: leftSide},\r\n\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\tdreamer, \"— Ха, поверь мне, человеки только и будут мечтать о том, чтобы познать эту систему.\", \r\n\t\tn, \"*Неос вскидывает голову*\",\r\n\t\t\r\n\tdreamer, {image: \"dreamer.png\", position: rightMiddleSide},\t\r\n\t\tdreamer, \"— Природа будет важна для всех живых существ.\",\r\n\t\r\n\toptimist,{image: \"optimist.png\", position: leftMiddleSide},\t\r\n\t\toptimist, \"— Но ведь огонь может их ранить!\",\r\n\t\toptimist, \"— Воздух не пригоден для жизни, вода — вообще яд!\",\r\n\tdreamer, {image: \"empty.png\", position: rightMiddleSide},\t\t\r\n\toptimist,{image: \"optimist.png\", position: leftSide},\t\r\n\trealist, {image: \"empty.png\", position: rightSide},\r\n\t\tn, \"Можно заметить, как Ами нервничает.\", \r\n\t\r\n\toptimist,{image: \"empty.png\", position: leftSide},\t\r\n\tskeptic,{image: \"skeptic.png\", position: Center},\r\n\t\tskeptic, \"— Да, по отдельности эти элементы нестабильны.\",\r\n\t\tskeptic, \"— Но вместе они создают нечто прекрасное.\",\r\n\t\t\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\r\n\tskeptic,{image: \"Head Lu.png\", position: upperCenter},\r\n\t\r\n\t\tlabel, \"menu1\",\r\n menu, [\r\n\t\t\t\"Выбор\",\r\n\t\t\t\"Оставить жизнь без базовых элементов. \", [jump, \"end1\"],\r\n \"Природа\", [jump, \"main1\"],\r\n ],\r\n\t\t\r\n\t\t\t\tlabel, \"end1\",\r\n\t\t\t\tscene, {image: \"BG.png\", position: Center},\r\n\t\t\t\t\r\n\t\t\r\n\t\t\tskeptic,{image: \"skeptic2.png\", position: rightMiddleSide},\r\n\t\t\t\tskeptic, \"— Кхм...\",\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightSide},\t\r\n\t\t\tdreamer, {image: \"dreamer2.png\", position: leftMiddleSide},\t\r\n\t\t\t\tdreamer, \"— Что-то мы запутались.\", \r\n\t\t\t\tn, \"*Неос хмурит брови*\", \r\n\t\t\t\tdreamer, \"— Разве мы не должны были создавать условия для жизни?.\", \r\n\t\t\t\tdreamer, \"— Ами, зачем? Доверься Лу!\", \r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\t\t\r\n\t\t\t\taudio, {src: \"bensound-tomorrow\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\t\tn, \"— ...\",\r\n\t\t\t\tn, \"Без материального мира вы не смогли существовать.\",\r\n\t\t\t\tn, \"Пожалуйста, следите внимательнее за тем, что происходит в диалоге.\",\r\n\t\t\t\tn, \"Персонажи часто говорят важные детали, помогающие сделать правильный выбор.\",\r\n\t\t\t\r\n\t\t\t\tlabel, \"menuend1\",\r\n\t\t\t\tmenu, [\r\n\t\t\t\t\t\"Вселенная будет пересоздана. Будьте аккуратны, принимая решения!\",\r\n\t\t\t\t\t\"Переродиться.\", [jump, \"menu1\"],\r\n\t\t\t\t],\r\n\r\n\t\tlabel, \"main1\",\r\n scene, {image: \"BG.png\", position: Center},\r\n\t\taudio, {src: \"bensound-sweet\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\r\n\t\t\r\n\trealist, {image: \"realist2.png\", position: rightMiddleSide},\t\t\r\n\t\trealist, \"— Ну что-ж, вот и решили.\",\r\n\trealist, {image: \"realist.png\", position: rightMiddleSide},\t\t\t\r\n\t\trealist, \"— Предлагаю заодно поселить их на огромных сферах, бесконечно парящих с определённой скоростью в пространстве.\",\r\n\tdreamer, {image: \"dreamer.png\", position: leftSide},\t\r\n\t\tdreamer, \"— Человеков? Гелиос, зачем?\",\r\n\trealist, {image: \"realist2.png\", position: rightMiddleSide},\t\r\n\t\trealist, \"— Концентрировать их в одном месте удобнее, и давать условия для их существования тоже.\",\r\n\tdreamer, {image: \"empty.png\", position: leftSide},\t\r\n\tskeptic, {image: \"skeptic.png\", position: leftMiddleSide},\t\r\n\t\tskeptic, \"— Звучит логично.\",\r\n\toptimist, {image: \"optimist.png\", position: rightMiddleSide},\t\r\n\trealist, {image: \"empty.png\", position: rightMiddleSide},\r\n\t\toptimist, \"— Да, а сверху можно расположить защитный купол от внешних угроз.\",\r\n\tskeptic, {image: \"skeptic.png\", position: leftMiddleSide},\r\n\t\tskeptic, \"— Кстати, геометрически, это не сферы, а шары.\",\r\n\toptimist, {image: \"optimist.png\", position: rightSide},\t\r\n\t\toptimist, \"— Геометрия?\",\r\n\t\tskeptic, \"— Да, я добавил, хотя смысла в этом....\",\r\n\t\tskeptic, \"— Меня будут ненавидеть за это.\",\r\n\toptimist, {image: \"optimist.png\", position: rightMiddleSide},\t\r\n\t\tn, \"*Ами пожимает плечами*\", \r\n\t\toptimist, \" — Ну, если это зачем-то было нужно.\",\r\n\t\t\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\r\n\t\t\r\n\trealist, {image: \"realist0.png\", position: leftMiddleSide},\t\r\n\t\trealist, \"— ...\",\r\n\t\trealist, \"— Ребят, тут вообще есть проблемка...\",\r\n\trealist, {image: \"realist0.png\", position: rightMiddleSide},\t\r\n\tdreamer, {image: \"dreamer.png\", position: leftMiddleSide},\t\r\n\t\tdreamer, \"— Что случилось??\",\r\n\tskeptic, {image: \"skeptic.png\", position: leftSide},\t\r\n\tdreamer, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\tskeptic, \"*шёпотом* — Как всегда, одни проблемы.\",\r\n\tskeptic, {image: \"empty.png\", position: rightMiddleSide},\t\r\n\trealist, {image: \"realist0.png\", position: leftMiddleSide},\t\r\n\t\trealist, \"— Помните ту концепцию времени, которую мы добавили?\",\r\n\t\trealist, \"— ...В общем, из-за неё человеки... как это...\",\r\n\t\trealist, \"— Их материальные тела рассыпаются, и их свету больше негде находиться.\",\r\n\tskeptic, {image: \"skeptic.png\", position:rightMiddleSide},\t\r\n\t\tskeptic, \"*продолжая шёпотом* — Ну я не удивлён, что что-то не работает.\",\r\n\tskeptic,{image: \"empty.png\", position: leftSide},\t\r\n\t\trealist, \"— ...Мы можем что-то придумать?\",\r\n\t\t\r\n\toptimist, {image: \"optimist.png\", position: leftMiddleSide},\t\r\n\trealist, {image: \"realist.png\", position: rightSide},\r\n\t\toptimist, \"— Нам нужен защитный механизм для этого процесса.\",\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\t\r\n\tdreamer, {image: \"dreamer.png\", position: leftMiddleSide},\t\r\n\t\tdreamer, \"— Можем создать концепцию перехода их света от предыдущего объекта к новому.\",\r\n\t\tdreamer, \"— Бесконечное существование!\",\r\n\tdreamer, {image: \"empty.png\", position: leftMiddleSide},\t\r\n\toptimist, {image: \"optimist.png\", position: leftSide},\t\r\n\trealist, {image: \"empty.png\", position: rightSide},\r\n\t\toptimist, \"— Мне кажется, это не разумно.\",\r\n\t\tn, \"*Ами хватается за голову*\", \r\n\t\toptimist, \"— Человеки сойдут с ума пребывать в разных телах навечно...\",\r\n\t\t\r\n\t\toptimist, \"— Пусть лучше их опыт обнуляется.\",\r\n\tdreamer, {image: \"empty.png\", position: rightMiddleSide},\t\r\n\trealist, {image: \"realist3.png\", position: rightMiddleSide},\t\r\n\t\trealist, \"— Да, мы не можем дать им существовать вечно.\",\r\n\t\t\r\n\t\toptimist, \"— Пусть свет стремится из тела человека в новое тело, а цикл между телами будет называться жизнью.\",\r\n\toptimist, {image: \"empty.png\", position: leftSide},\t\r\n\trealist, {image: \"empty.png\", position: leftMiddleSide},\t\r\n\tdreamer, {image: \"dreamer.png\", position: Center},\t\t\r\n\t\tdreamer, \"— Так...\",\r\n\r\n\t\tlabel, \"menu2\",\r\n\t\tdreamer, {image: \"Head Neos.png\", position: upperCenter},\r\n menu, [\r\n\t\t\t\"Неос выбирает\",\r\n\t\t\t\"Оставить переход между объектами.\", [jump, \"end2\"],\r\n \"Послушать Ами и Гелиоса\", [jump, \"main2\"],\r\n ],\r\n\t\t\r\n\t\t\t\tlabel, \"end2\",\r\n\t\t\t\tscene, {image: \"BG10.png\", position: Center},\r\n\t\t\t\taudio, {src: \"bensound-tomorrow\", format: [\"mp3\"], action: \"play\"},\r\n\r\n\t\t\tdreamer, {image: \"dreamer.png\", position: leftMiddleSide},\t\t\r\n\t\t\t\tdreamer, \"— Это не зачем.\", \r\n\t\t\t\tdreamer, \"— Сможем придумать сверх этого другой механизм.\", \r\n\t\t\tskeptic, {image: \"skeptic.png\", position: rightMiddleSide},\t\r\n\t\t\t\tskeptic, \"— Конечно, это то, что нам стоит делать — нагромождать механизмы один на другой!\",\r\n\t\t\tskeptic, {image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"optimist.png\", position: rightMiddleSide},\r\n\t\t\t\toptimist, \"— ...Они же сойдут с ума...\",\r\n\t\t\trealist, {image: \"realist0.png\", position: leftMiddleSide},\t\t\r\n\t\t\tdreamer, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\t\trealist, \"*смотрит в будущее* — Хватит. Сейчас мы увидим, что там происходит.\",\r\n\t\t\t\tdreamer, \"— Оу. \",\r\n\t\t\t\toptimist, \"— ...оуу.\",\r\n\t\t\t\tskeptic, \"— А я говорил...\",\r\n\t\t\trealist, {image: \"realist3.png\", position: leftMiddleSide},\t\r\n\t\t\t\trealist, \"— Они решили прекратить существовать...\",\r\n\t\t\t\t\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\t\r\n\r\n\t\t\t\tn, \"— ...\",\r\n\t\t\t\tn, \"Человечество не смогло найти реализации себя через бессмертие сознания.\",\r\n\t\t\t\tn, \"Пожалуйста, следите внимательнее за тем, что происходит в диалоге.\",\r\n\t\t\t\tn, \"Персонажи часто говорят важные детали, помогающие сделать правильный выбор.\",\r\n\t\t\t\r\n\t\t\t\tlabel, \"menuend2\", \t\r\n\t\t\t\tmenu, [\r\n\t\t\t\t\t\"Вселенная будет пересоздана. Будьте аккуратны, принимая решения!\",\r\n\t\t\t\t\t\"Переродиться.\", [jump, \"menu2\"],\r\n\t\t\t\t],\r\n\t\t\t\r\n\t\tlabel, \"main2\",\r\n\t\tscene, {image: \"BG10.png\", position: Center},\r\n\t\taudio, {src: \"bensound-sweet\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\r\n\tdreamer, {image: \"dreamer.png\", position: leftMiddleSide},\t\r\n\t\tdreamer, \"— Ну хорошо... \",\r\n\t\tdreamer, \"— Не то, чтобы мне это нравится, но, кажется, так действительно лучше.\",\r\n\tdreamer, {image: \"empty.png\", position: leftMiddleSide},\t\r\n\tskeptic,{image: \"skeptic.png\", position: leftMiddleSide},\r\n\t\tskeptic, \"— ...ого, мы договорились без всяких ссор.\",\r\n\trealist, {image: \"realist.png\", position: rightSide},\t\r\n\t\tn, \"*Гелиос ставит руки в бока, но по нему видно, что он улыбается*\",\r\n\trealist, {image: \"realist2.png\", position: rightMiddleSide},\t\r\n\t\trealist, \"— Ты такой скептик!\",\r\n\t\trealist, \"— ...А ссоры? Что это?\",\r\n\t\t\r\n\t\tskeptic, \"— Так человеки будут называть неспособность услышать друг друга в определённый момент.\",\r\n\t\tskeptic, \"— А ещё я очень устал, мы немного отклоняемся от поставленных задач.\",\r\n\trealist, {image: \"empty.png\", position: rightMiddleSide},\t\r\n\tskeptic,{image: \"skeptic.png\", position: rightMiddleSide},\r\n\tdreamer, {image: \"dreamer.png\", position: leftMiddleSide},\t\t\r\n\t\tdreamer, \"— Ну хватит уже бурчать.\",\r\n\t\tskeptic, \"— Я не бурчу!.\",\r\n\tdreamer, {image: \"empty.png\", position: leftMiddleSide},\t\t\r\n\t\tskeptic, \"— ...\",\r\n\t\tskeptic, \"— Ну и ладно. Я в любом случае собирался поработать над некоторыми деталями отдельно.\",\r\n\t\tskeptic, \"— Всё-таки природа очень комплексная по своей системе.\",\r\n\t\tskeptic, \"— Позовите, если буду нужен.\",\r\n\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\t\r\n\t\tn, \"*Лу удаляется в неопределённом напрапвлении*\",\r\n\t\r\n\tdreamer, {image: \"dreamer.png\", position: leftMiddleSide},\t\r\n\t\tdreamer, \"— ...как там человеки говорят… 'ну и лол!'.\",\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\r\n\toptimist, {image: \"optimist.png\", position: leftMiddleSide},\t\r\n\t\toptimist, \"*про себя* — надеюсь он там ничего не сломает своими проработками...\",\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\t\r\n\trealist, {image: \"realist.png\", position: leftMiddleSide},\r\n\t\trealist, \"— Но в чём-то он может и прав. Возможно, нам нужно немного подумать в одиночестве.\",\r\n\tdreamer, {image: \"dreamer.png\", position: rightMiddleSide},\t\r\n\t\tdreamer, \"— Тогда давайте разойдемся. Мне нужно отдохнуть от всего этого.\",\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\t\t\r\n\trealist, {image: \"realist2.png\", position: leftMiddleSide},\t\r\n\t\tn, \"Гелиос кривит губы в саркатисческой улыбке, показывая иронию.\",\r\n\t\trealist, \"— В таком случае, выбора здесь нет.\",\r\n\t\t\r\n\t\tlabel, \"menu3\",\r\n menu, [\r\n\t\t\t\"Выбор без выбора\",\r\n\t\t\t\"Разойтись ненадолго.\", [jump, \"main3\"],\r\n ],\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\t\tlabel, \"main3\",\r\n\t\tscene, {image: \"BG.png\", position: Center},\r\n\t\taudio, {src: \"bensound-memories\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\r\n\t\tn, \"— ...\",\r\n\t\tn, \"— Свет всё преломлялся и изменялся, порождая жизнь на своём пути.\",\r\n\t\tn, \"— Механизмы и структуры, разработанные 4 богами, функционировали и помогали жизни адаптироваться.\",\r\n\t\tn, \"— ...но настал момент, когда им снова пришлось собраться.\",\r\n\t\tn, \"— Что-то неладное происходило в мире.\",\r\n\r\n\t\taudio, {src: \"bensound-sweet\", format: [\"mp3\"], action: \"play\"},\r\n\t\tscene, {image: \"BG.png\", position: Center},\r\n\trealist, {image: \"realist.png\", position: leftMiddleSide},\t\r\n\t\tn, \"Гелиос машет рукой издалека.\", \r\n\t\trealist, \" — Ну здравствуй.\",\r\n\t\trealist, \" — Ты тут одна?\",\r\n\toptimist, {image: \"optimist.png\", position: rightMiddleSide},\t\r\n\t\toptimist, \"— ...А мы тут только вдвоём? Где остальные?\",\r\n\t\tn, \"Ами хмурится.\",\r\n\t\toptimist, \"— Особенно Лу меня волнует, негодяй...\",\r\n\trealist, {image: \"realist2.png\", position: leftMiddleSide},\t\r\n\toptimist, {image: \"empty.png\", position: rightMiddleSide},\t\r\n\t\trealist, \"— Ну сейчас.\",\r\n\t\tn, \"*Гелиос привычно щёлкает пальцами*\", \r\n\t\taudio, {src: \"bensound-sweet\", format: [\"mp3\"], action: \"stop\"},\r\n\trealist, {image: \"realist0.png\", position: leftSide},\t\r\n\t\trealist, \"— ...\",\r\n\t\trealist, \"— ......\",\r\n\toptimist, {image: \"optimist.png\", position: rightSide},\t\t\r\n\t\toptimist, \"— .......\",\r\n\t\trealist, \"— ................\",\r\n\t\trealist, \"— В смысле????.\",\r\n\toptimist, {image: \"optimist3.png\", position: rightSide},\t\r\n\t\toptimist, \"— Они... не могут прийти?!\",\r\n\t\tn, \"Гелиос и Ами ошеломлённо смотрят друг на друга.\", \r\n\trealist, {image: \"realist0.png\", position: leftMiddleSide},\t\r\n\toptimist, {image: \"optimist.png\", position: rightMiddleSide},\t\t\r\n\t\trealist, \"— Что вообще могло случиться...\",\r\n\t\trealist, \"— Нужно найти их, пока не случилось что-то действительно ужасное..\",\r\n\t\toptimist, \"— Надеюсь, они наткнулись хотя бы друг на друга... \",\r\n\t\trealist, \"— Вперёд!\",\r\n\r\n\r\n\t\tlabel, \"menu4\",\r\n\t\tmenu, [\r\n\t\t\t\"— Ради всех остальных.\",\r\n\t\t\t\"Отправиться на поиски.\", [jump, \"main4\"],\r\n ],\r\n\r\n\t\tlabel, \"main4\",\r\n\t\tscene, {image: \"BG10.png\", position: Center},\r\n\t\taudio, {src: \"bensound-scifi\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\r\n\toptimist, {image: \"optimist.png\", position: leftMiddleSide},\t\r\n\t\toptimist, \"— ...\",\r\n\t\toptimist, \"— Что делаем?\",\r\n\trealist, {image: \"realist.png\", position: rightMiddleSide},\t\r\n\t\trealist, \"— Так-с.\",\r\n\t\trealist, \"— Из-за того, что скорость света ограничена, у нас получаются отдельные участки космоса, в которые мы не можем попасть сразу.\",\r\n\t\trealist, \"— И это значит, что нам надо искать где-то там.\",\r\n\trealist, {image: \"realist0.png\", position: rightMiddleSide},\t\r\n\t\tn, \"Гелиос берёт Ами за руку и закрывает глаза.\",\r\n\t\trealist, \"— Говори, куда отправимся.\",\r\n\trealist, {image: \"empty.png\", position: rightMiddleSide},\t\t\r\n\toptimist, {image: \"Head Ami.png\", position: upperCenter},\t\r\n\r\n\t\tlabel, \"menu5\",\r\n\t\tmenu, [\r\n\t\t\t\"Выбрать за Ами, куда отправиться.\",\r\n\t\t\t\"1. Большая Медведица I (UMa I dSph).\", [jump, \"end3\"],\r\n\t\t\t\"2. Segue 2 — карликовая сфероидальная галактика.\", [jump, \"end3\"],\r\n\t\t\t\"3. Галактика в Драконе (Draco dSph).\", [jump, \"end3\"],\r\n\t\t\t\"4. Волосы Вероники (Com) — карликовая сфероидальная галактика.\", [jump, \"end3\"],\r\n\t\t\t\"5. Гончие Псы II (CVn II).\", [jump, \"end3\"],\r\n\t\t\t\"6. Большой Пёс (лат. Canis Major) — Искать около Сириуса.\", [jump, \"main5\"],\r\n\t\t\t\"7. Большое Магелланово Облако (Large Magellanic Cloud, LMC).\", [jump, \"end3\"],\r\n\t\t\t\"8. Ма́лое Магелла́ново О́блако (SMC, NGC 292).\", [jump, \"end3\"],\r\n ],\r\n\t\t\r\n\t\tlabel, \"end3\",\r\n\t\tscene, {image: \"BG20.png\", position: Center},\r\n\t\t\r\n\t\tn, \"Здесь никого нет.\",\r\n\t\t\r\n\t\tlabel, \"menuend3\",\r\n\t\tmenu, [\r\n\t\t\t\"— Нужно пойти назад.\",\r\n\t\t\t\"— Вернуться.\", [jump, \"menu5\"],\r\n ],\r\n\t\t\r\n\t\tlabel, \"main5\",\r\n\t\tscene, {image: \"BG.png\", position: Center},\r\n\t\t\t\r\n\t\tdreamer, \"— ...\",\r\n\t\t\r\n\t\trealist, \"— ох...\",\r\n\toptimist, {image: \"optimist.png\", position: leftSide},\r\n\trealist, {image: \"realist3.png\", position: leftMiddleSide},\t\r\n\t\r\n\t\tn, \"Гелиос и Ами находят Неос.\", \r\n\t\t\r\n\tdreamer, {image: \"dreamerdead.png\", position: rightSide},\t\t\r\n\t\tn, \"Её свёт был тусклый, а она сама еле живая.\", \r\n\t\toptimist, \"— Ч-что произошло?\",\r\n\t\trealist, \"— Мда, тут бы никто не смог прийти на встречу...\",\r\n\t\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\r\n\t\tn, \"*Гелиос и Ами помогают Неос прийти в себя*\",\r\n\t\r\n\tdreamer, {image: \"dreamer2.png\", position: rightSide},\t\r\n\t\tdreamer, \"— угхх...\",\r\n\t\tdreamer, \"— ...вот это жесть, конечно...\",\r\n\toptimist, {image: \"optimist.png\", position: leftMiddleSide},\r\n\trealist, {image: \"realist0.png\", position: leftSide},\t\t\r\n\t\trealist, \"— Что случилось?\",\r\n\t\toptimist, \"— Ты в порядке?\",\r\n\t\t\r\n\tdreamer, {image: \"dreamer2.png\", position: rightMiddleSide},\t\t\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\r\n\t\tdreamer, \"— Теперь вроде бы да.\",\r\n\t\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\toptimist, {image: \"optimist.png\", position: leftMiddleSide},\r\n\trealist, {image: \"realist.png\", position: leftSide},\t\r\n\t\t\r\n\t\t\r\n\t\toptimist, \"— Кто сделал это с тобой?\",\r\n\tdreamer, {image: \"dreamer2.png\", position: rightMiddleSide},\t\t\t\r\n\t\tdreamer, \"— кхх… скорее что, а не кто. Это очень странно, но... \",\r\n\t\tdreamer, \"— Это было что-то невероятно ужасное и неприятное\",\r\n\t\tdreamer, \"— Как будто оно поглощает свет\",\r\n\t\t\r\n\trealist, {image: \"empty.png\", position: leftSide},\t\r\n\toptimist, {image: \"optimist.png\", position: leftSide},\t\r\n\t\toptimist, \"*боязливо*— Ч-что... Что оно хотело?\",\r\n\tdreamer, {image: \"dreamer2.png\", position: leftMiddleSide},\t\t\r\n\t\tdreamer, \"— Кушать оно хотело!\",\r\n\t\tn, \"*Неос немного пугает Ами*\",\r\n\t\tn, \"*Ами визжит*\",\r\n\t\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\r\n\trealist, {image: \"realist.png\", position: rightMiddleSide},\t\r\n\t\tn, \"*Гелиос улыбается*\",\r\n\t\trealist, \" — Спокойнее. Ты снова светишь, и это главное.\",\r\n\tdreamer, {image: \"dreamer2.png\", position: rightSide},\t\t\r\n\t\tdreamer, \"— Да нужно найти это нечто и разобраться!\",\r\n\toptimist, {image: \"optimist.png\", position: leftSide},\t\r\n\t\toptimist, \"— Ааа...! Я не хочу… я...\",\r\n\t\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\trealist, {image: \"empty.png\", position: leftSide},\r\n\r\n\t\tlabel, \"menu6\",\r\n\t\tscene, {image: \"BG.png\", position: Center},\r\n\t\taudio, {src: \"bensound-scifi\", format: [\"mp3\"], action: \"play\"},\r\n\t\tskeptic, {image: \"skeptic2.png\", position: Center},\r\n\t\tskeptic, \"— ...\",\r\n\t\tskeptic, {image: \"Head Lu.png\", position: upperCenter},\r\n\t\tmenu, [\r\n\t\t\t\"Сказать фразу за Лу:\",\r\n\t\t\t\"<strong>Дослушать |</strong> Не хотелось бы вас перебивать, но...\", [jump, \"main6\"],\r\n\t\t\t\"<strong>Перебить |</strong> Короче,смотрите...\", [jump, \"end4\"],\r\n ],\r\n\r\n\t\t\t\tlabel, \"end4\",\r\n\t\t\t\tscene, {image: \"BG10.png\", position: Center},\r\n\t\t\r\n\t\t\tskeptic,{image: \"skeptic2.png\", position: leftMiddleSide},\r\n\t\t\t\tskeptic, \"— Короче, смотрите...\",\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\t\r\n\t\t\trealist, {image: \"realist3.png\", position: rightMiddleSide},\r\n\t\t\t\trealist, \"— Ты где вообще был? Почему не отзывался?\",\r\n\t\t\toptimist, {image: \"optimist.png\", position: leftMiddleSide},\t\r\n\t\t\t\toptimist, \"— Совсем уже...\",\r\n\t\t\tdreamer, {image: \"dreamer2.png\", position: rightSide},\t\r\n\t\t\t\tdreamer, \"— Лу тоже пропадал? Пока меня пытались съесть заживо?\",\r\n\t\t\t\t\t\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\t\r\n\t\r\n\t\t\tskeptic,{image: \"skeptic.png\", position: leftMiddleSide},\r\n\t\t\t\tskeptic, \"— Ребят, у меня....\",\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\t\r\n\t\t\tdreamer, {image: \"dreamer2.png\", position: rightSide},\t\r\n\t\t\t\tdreamer, \"*перебивает* — Лу, меня тут чуть не стало, а ты ходишь непонятно где.\",\r\n\t\t\t\tdreamer, \"— Просто невыносимо!\",\r\n\t\t\toptimist, {image: \"optimist.png\", position: leftMiddleSide},\t\r\n\t\t\t\toptimist, \"— Тебе всё равно на нас, да?\",\r\n\t\t\trealist, {image: \"realist3.png\", position: rightMiddleSide},\t\r\n\t\t\t\trealist, \"— Лу, это всё нехорошо, ты же понимаешь..\",\r\n\t\t\t\t\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\t\t\r\n\t\t\t\r\n\t\t\tskeptic,{image: \"skeptic.png\", position: leftMiddleSide},\r\n\t\t\t\tskeptic, \"— Да что-ж вы... я... кхгшш… хфф...\",\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\t\r\n\t\t\t\taudio, {src: \"bensound-tomorrow\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\tscene, {image: \"BGDark.png\", position: Center},\t\r\n\t\t\t\tdark, \"*приглушённо* — шшшш....\",\r\n\t\t\t\tdark, \"*приглушённо* — ......\",\r\n\t\t\r\n\t\t\t\tn, \"— ...\",\r\n\t\t\t\tn, \"— Пока вы не могли услышать друг друга, к вам незаметно подкралась Тьма и поглотила вас.\",\r\n\t\t\r\n\t\t\t\tlabel, \"menuend4\",\r\n\t\t\t\tmenu, [\r\n\t\t\t\t\t\"— Вселенная будет пересоздана. Будьте аккуратны, принимая решения!\",\r\n\t\t\t\t\t\"Переродиться.\", [jump, \"menu6\"],\r\n\t\t\t\t],\r\n\r\n\t\tlabel, \"main6\",\r\n\t\tscene, {image: \"BG10.png\", position: Center},\r\n\t\t\r\n\tskeptic,{image: \"skeptic.png\", position: leftSide},\t\r\n\t\tskeptic, \"— Не хотелось бы вас перебивать, но….\",\r\n\trealist, {image: \"realist3.png\", position: rightMiddleSide},\t\r\n\t\trealist, \"— Лу? Где ты был?\",\r\n\tskeptic,{image: \"skeptic2.png\", position: leftMiddleSide},\t\t\r\n\t\tskeptic, \"— Я был около Магелланового скопления. Послушайте!\",\r\n\t\tskeptic, \"— Я встретил там существ, которых ранее не видел никогда.\",\r\n\t\tskeptic, \"— В них просто нет никакого света!\",\r\n\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\t\r\n\trealist, {image: \"empty.png\", position: leftSide},\t\r\n\tdreamer, {image: \"dreamer2.png\", position: rightMiddleSide},\t\r\n\t\tdreamer, \"— Ага… Вот что <em>пыталось меня сожрать</em>.\",\r\n\trealist, {image: \"realist0.png\", position: rightSide},\r\n\t\trealist, \"— Мы как раз наткнулись на такое, буквально только что!\",\r\n\t\r\n\tskeptic,{image: \"empty.png\", position: leftMiddleSide},\t\r\n\t\tskeptic, \"— Невообразимо просто, как такое вообще может быть...\",\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\trealist, {image: \"empty.png\", position: leftSide},\r\n\toptimist, {image: \"optimist.png\", position: leftMiddleSide},\r\n\t\toptimist, \"— А главное, что нам делать?\",\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\t\r\n\tdreamer, {image: \"dreamer2.png\", position: rightMiddleSide},\t\r\n\t\tn, \"*Неос сжимает кулаки*.\", \r\n\t\tdreamer, \"Мы должны противостоять.\",\r\n\toptimist, {image: \"optimist.png\", position: leftMiddleSide},\r\n\t\toptimist, \"— ...Но как?\",\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\trealist, {image: \"empty.png\", position: leftSide},\r\n\r\n\t\t\r\n\trealist, {image: \"realist3.png\", position: leftMiddleSide},\r\n\t\trealist, \"— Тьма — это отсутствие Света. Мы должны рассеять её.\",\r\n\tskeptic,{image: \"skeptic2.png\", position: rightMiddleSide},\t\r\n\t\tskeptic, \"— Это какая-то странная игра Создателя, внутри которой мы оказались.\",\r\n\t\tskeptic, \"— Нам теперь ничего не остается.\",\r\n\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\t\r\n\r\n\t\trealist, \"— Готовимся к битве...\",\r\n\r\n\trealist,{image: \"Head Gelious.png\", position: upperCenter},\t\r\n\r\n\t\tlabel, \"menu7\",\r\n\t\tmenu, [\r\n\t\t\t\"— \",\r\n\t\t\t\"Подготовиться к битве.\", [jump, \"main7\"],\r\n\t\t],\r\n\r\n\t\tlabel, \"main7\",\r\n\t\taudio, {src: \"bensound-epicbattle\", format: [\"mp3\"], action: \"play\"},\r\n\t\tscene, {image: \"BG.png\", position: Center},\r\n\t\t\r\n\t\tn, \"Наши герои собрались вместе, собирая свои силы.\", \r\n\t\tn, \"Подготовка шла полным ходом.\", \r\n\t\tn, \"Всё, что нужно сделать — это принять правильную последовательность шагов против действий врага.\", \r\n\t\tn, \"И только умея слушать других, умея вести диалог, можно противостоять Вселенской Тьме.\",\r\n\t\t\r\n\trealist, {image: \"realist0.png\", position: leftMiddleSide},\r\n\t\trealist, \"— ...Все помнят план?\",\r\n\t\trealist, \"— Я ставлю щит под атаку Тьмы, Неос меня поддерживает, Лу атакует Светом вместе с Ами.\",\r\n\tskeptic,{image: \"skeptic.png\", position: rightMiddleSide},\t\r\n\t\tskeptic, \"— Да.. да, мы помним.\",\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\trealist, {image: \"empty.png\", position: leftSide},\t\r\n\t\t\r\n\tdreamer, {image: \"dreamer2.png\", position: leftMiddleSide},\t\r\n\t\tdreamer, \"— Чшш...\",\r\n\tskeptic,{image: \"skeptic2.png\", position: rightMiddleSide},\t\r\n\t\tskeptic, \"— М?\",\r\n\t\tdreamer, \"— <i>Оно</i> приближается...\",\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\trealist, {image: \"empty.png\", position: leftSide},\t\r\n\t\t\r\n\t\tsomeone, \" — ...\",\r\n\tdark, {image: \"dark.png\", position: upperCenter},\t\r\n\t\tdark, \" — шшшшфффф......\",\r\n\tdark, {image: \"empty.png\", position: upperCenter},\t\t\r\n\trealist, {image: \"realist3.png\", position: leftSide},\t\r\n\t\tn, \"*Гелиос глубоко вдыхает и выдыхает*\",\r\n\t\tn, \"*...затем резко щёлкает пальцами*\",\r\n\trealist, {image: \"empty.png\", position: leftSide},\r\n\tskeptic,{image: \"skeptic2.png\", position: rightSide},\t\r\n\t\trealist, \"— Создаю концепцию защиты!\",\r\n\t\tn, \"*Лу вскидывает руки*\",\r\n\t\tskeptic, \"— Беру на себя оптику преломлений.\",\r\n\tskeptic,{image: \"empty.png\", position: leftMiddleSide},\t\r\n\t\t\r\n\trealist, {image: \"realist0.png\", position: leftMiddleSide},\t\r\n\t\trealist, \"— Начинаем!\",\t\r\n\r\n\trealist, {image: \"empty.png\", position: leftMiddleSide},\r\n\r\n\r\n\t\t\r\n\t\tlabel, \"mainBattleStart\",\r\n\t\t\r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Световой щит Гелиоса\",\r\n\t\t\t\t\"Поставить световой щит справа\", [jump, \"mainBattleRight\"],\r\n\t\t\t\t\"Поставить световой щит слева\", [jump, \"mainBattleLeft\"],\r\n\t\t\t],\r\n\r\n\t\tlabel, \"mainBattleRight\",\r\n\t\t\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\t\r\n\t\t\trealist, \"— Атакуем слева.\",\r\n\t\t\tskeptic, \"— Направляю луч света!\",\r\n\t\t\r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Оптика световых лучей\",\r\n\t\t\t\t\"Направить налево\", [jump, \"mainBattleRight2\"],\r\n\t\t\t\t\"Направить направо\", [jump, \"mainBattleLeft2\"],\r\n\t\t\t],\r\n\t\t\r\n\t\tlabel, \"mainBattleLeft\",\r\n\t\t\t\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\t\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\r\n\t\t\t\r\n\t\t\trealist, \"— Атакуем справа.\",\r\n\t\t\tskeptic, \"— Направляю этот сверх-тяжелый луч света...\",\r\n\t\t\t\r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\t\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Оптика световых лучей\",\r\n\t\t\t\t\"Направить налево\", [jump, \"mainBattleLeft2\"],\r\n\t\t\t\t\"Направить направо\", [jump, \"mainBattleRight2\"],\r\n\t\t\t],\r\n\t\t\r\n\t\tlabel, \"mainBattleLeft2\",\r\n\t\t\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\r\n\t\t\toptimist, \"— Ты целишься не туда!\",\r\n\t\t\tskeptic, \"— Ты не видишь, я пытаюсь!\",\r\n\t\t\tdreamer, \"— Ну же, давай...\", \r\n\t\t\trealist, \"— Приготовьтесь, теперь будет сложно!\",\r\n\t\t\t\r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\t\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Выставить новую защиту\",\r\n\t\t\t\t\"Поставить световой щит справа\", [jump, \"mainBattleLeft3\"],\r\n\t\t\t\t\"Поставить световой щит слева\", [jump, \"mainBattleLeftLeft3\"],\r\n\t\t\t],\r\n\t\t\r\n\t\t\r\n\t\tlabel, \"mainBattleRight2\",\r\n\t\t\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\r\n\r\n\t\t\trealist, \"— Приготовьтесь, теперь будет сложно!\",\r\n\t\t\tskeptic, \"— Ами, атакуй сверху!\",\r\n\t\t\t\r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\t\r\n\t\t\tmenu, [\r\n\t\t\t\t\"— Ами, давай!\",\r\n\t\t\t\t\"Атаковать сверху\", [jump, \"mainBattleSkip\"],\r\n\t\t\t],\r\n\r\n\t\t\r\n\t\tlabel, \"mainBattleSkip\",\r\n\t\t\t\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\t\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\r\n\t\t\trealist, {image: \"realist.png\", position: leftMiddleSide},\r\n\t\t\trealist, \"— Аккуратнее!\",\r\n\t\t\tskeptic,{image: \"skeptic.png\", position: rightMiddleSide},\t\r\n\t\t\tskeptic, \"— Сам аккуратнее!\",\r\n\t\t\tskeptic, \"— Давай выбирай, что делать дальше!\",\r\n\t\t\t\r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Сделать выбор за Гелиоса:\",\r\n\t\t\t\t\"Новая атака\", [jump, \"mainBattleRight3\"],\r\n\t\t\t\t\"Укрепить позиции\", [jump, \"mainBattleRight4\"],\r\n\t\t\t],\r\n\t\t\r\n\t\tlabel, \"mainBattleLeft3\", \r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\r\n\t\t\trealist, \"— Атакуй снова, теперь с нужной стороны!\",\r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Оптика световых лучей — вторая попытка\",\r\n\t\t\t\t\"Направить налево\", [jump, \"mainBattleRight3\"],\r\n\t\t\t\t\"Направить направо\", [jump, \"mainBattleLeft4\"],\r\n\t\t\t],\r\n\r\n\t\tlabel, \"mainBattleLeftLeft3\",\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\r\n\t\t\trealist, {image: \"realist.png\", position: leftMiddleSide},\r\n\t\t\trealist, \"— Атакуй снова, теперь с нужной стороны!\",\r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Оптика световых лучей — вторая попытка\",\r\n\t\t\t\t\"Направить налево\", [jump, \"mainBattleLeft4\"],\r\n\t\t\t\t\"Направить направо\", [jump, \"mainBattleRight3\"],\r\n\t\t\t],\r\n\t\t\t\r\n\t\t\r\n\t\tlabel, \"mainBattleRight3\",\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\tdreamer, {image: \"dreamer.png\", position: leftMiddleSide},\r\n\t\t\tdreamer, \"— Так, что теперь?\", \r\n\t\t\tskeptic,{image: \"skeptic.png\", position: rightMiddleSide},\r\n\t\t\tskeptic, \"— Новая атака, нужно только выбрать <i>правильное</i> направление..\",\r\n\t\t\t\r\n\t\t\tskeptic, {image: \"skeptic.png\", position: rightMiddleSide},\r\n\t\t\tskeptic, \"— А вот теперь будет по-настоящему сложно...\",\r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\tmenu, [\r\n\t\t\t\t\"— Скорее решай!\",\r\n\t\t\t\t\"Атака сверху\", [jump, \"mainBattleLeftLeft4\"],\r\n\t\t\t\t\"Атака снизу\", [jump, \"mainBattleLeftLeft4\"],\r\n\t\t\t\t\"Атака слева\", [jump, \"mainBattleLeftLeft4\"],\r\n\t\t\t\t\"Атака справа\", [jump, \"mainBattleRight4\"],\r\n\t\t\t],\r\n\t\t\r\n\t\tlabel, \"mainBattleRight4\",\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\r\n\t\t\tdreamer, {image: \"dreamer.png\", position: leftMiddleSide},\r\n\t\t\tdreamer, \"— Осталось немного.\", \r\n\t\t\tdreamer, \"— Дайте мне атаковать!\", \r\n\t\t\toptimist, {image: \"optimist.png\", position: rightMiddleSide},\r\n\t\t\toptimist, \"— Неос, нет, ты нужна мне здесь!\",\r\n\t\t\toptimist, \"— Лучше дайте мне поставить щит!\",\r\n\t\t\t\r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\t\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Командная работа — ключ к победе.\",\r\n\t\t\t\t\"Перестроить всех стратегически по кругу \", [jump, \"mainBattleRight5\"],\r\n\t\t\t\t\"Выпустить Неос вперёд\", [jump, \"mainBattleLeft5\"],\r\n\t\t\t\t\"Перестроить Ами в авангард\", [jump, \"mainBattleLeftLeft4\"],\r\n\t\t\t],\r\n\t\t\r\n\t\tlabel, \"mainBattleRight5\",\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\r\n\t\t\trealist, {image: \"realist2.png\", position: Center},\r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Решение на миллион.\",\r\n\t\t\t\t\"<strong>Непредсказуемая атака |</strong> Серия резких ударов светом\", [jump, \"mainBattleLeft7\"],\r\n\t\t\t\t\"<strong>Совместная атака |</strong> Концентрация света на Тьме\", [jump, \"mainBattleRight6\"],\r\n\t\t\t\t\"<strong>Защита |</strong> Укрепить позиции против Тьмы\", [jump, \"mainBattleLeft5\"],\r\n\t\t\t],\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\tlabel, \"mainBattleLeftLeft4\",\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\t\r\n\t\t\t\r\n\t\t\trealist, {image: \"realist3.png\", position: leftMiddleSide},\r\n\t\t\trealist, \"— Нет, мы не угадали. Тьма парировала нашим действиям.\",\r\n\t\t\trealist, \"— ...\",\r\n\t\t\trealist, \"— Всё очень плохо...\",\r\n\t\t\toptimist, {image: \"optimist.png\", position: rightMiddleSide},\r\n\t\t\toptimist, \"— Теперь что?\",\r\n\t\t\tskeptic,{image: \"skeptic.png\", position: leftSide},\r\n\t\t\tskeptic, \" — Теперь погибель наша, вот что...\",\r\n\t\t\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\t\r\n\t\t\tdreamer, {image: \"dreamer.png\", position: rightSide},\r\n\t\t\tdreamer, \"— Эта битва ещё не проиграна, соберитесь!\", \r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Быстрое решение\",\r\n\t\t\t\t\"<strong>Исправить ошибку |</strong> Переместиться назад во времени\", [jump, \"mainBattleLeft6\"],\r\n\t\t\t\t\"<strong>Убежать |</strong> Переместиться на пару парсек от места битвы\", [jump, \"mainBattleLeft6\"],\r\n\t\t\t\t\"<strong>Командное действие |</strong> Выстроить щиты и подготовиться к атаке\", [jump, \"mainBattleLeft5\"],\r\n\t\t\t],\r\n\t\t\r\n\t\tlabel, \"mainBattleLeft4\",\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\t\r\n\t\t\trealist, {image: \"realist3.png\", position: leftMiddleSide},\r\n\t\t\trealist, \"— Да как же так... Мы не можем защищаться и атаковать с одной и той же стороны!\",\r\n\t\t\trealist, \"— Перед атакой всегда должна быть защита.\",\r\n\t\t\t\r\n\t\t\toptimist, {image: \"optimist.png\", position: rightMiddleSide},\r\n\t\t\toptimist, \"— Блин...\",\r\n\t\t\toptimist, \"— Какая там обстановка?\",\r\n\t\t\trealist, \"— ...\",\r\n\t\t\trealist, \"— Всё очень плохо...\",\r\n\t\t\toptimist, \"— Теперь что?\",\r\n\t\t\tskeptic,{image: \"skeptic.png\", position: leftSide},\r\n\t\t\tskeptic, \" — Теперь погибель наша, вот что...\",\r\n\t\t\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\t\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\r\n\t\t\tdreamer, \"— Эта битва ещё не проиграна, соберитесь!\", \r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Быстрое решение\",\r\n\t\t\t\t\"<strong>Исправить ошибку |</strong> Переместиться назад во времени\", [jump, \"mainBattleLeft6\"],\r\n\t\t\t\t\"<strong>Убежать |</strong> Переместиться на пару парсек от места битвы\", [jump, \"mainBattleLeft6\"],\r\n\t\t\t\t\"<strong>Командное действие |</strong> Выстроить щиты и подготовиться к атаке\", [jump, \"mainBattleLeft5\"],\r\n\t\t\t],\r\n\t\t\t\r\n\t\t\r\n\t\tlabel, \"mainBattleLeft5\",\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\t\r\n\t\t\toptimist, {image: \"optimist.png\", position: leftMiddleSide},\r\n\t\t\toptimist, \"— Кажется, получается!\",\r\n\t\t\toptimist, \"— Нужно перегруппироваться и атаковать снова!\",\r\n\t\t\tdreamer, {image: \"dreamer.png\", position: rightMiddleSide},\r\n\t\t\tdreamer, \"— Вперёд!\", \r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Последний шанс\",\r\n\t\t\t\t\"<strong>Командная Атака|</strong> 4 мощные атаки каждого героя\", [jump, \"mainBattleRightRight4\"],\r\n\t\t\t\t\"<strong>Индивидуальная атака|</strong> 4 разных приёма героев для победы\", [jump, \"mainBattleLeft7\"],\t\r\n\t\t\t\t\"<strong>Атака + Защита|</strong> Ами и Гелиос ставят щиты, Неос и Лу атакуют\", [jump, \"mainBattleWellEnd\"],\t\t\t\r\n\t\t\t],\r\n\t\t\t\r\n\t\tlabel, \"mainBattleRightRight4\", \r\n\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\tscene, {image: \"battle.png\", position: Center},\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Нет поражения хуже.\",\r\n\t\t\t\t\"<strong>Индивидуальная защита|</strong> Световые щиты для каждого героя\", [jump, \"mainBattleLeft7\"],\r\n\t\t\t\t\"<strong>Командная защита|</strong> Командный световой щит\", [jump, \"mainBattleWellEnd\"],\r\n\t\t\t],\r\n\r\n\t\t\r\n\t\tlabel, \"mainBattleLeft6\",\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\r\n\t\t\t\tscene, \"\",\r\n\t\t\t\t\r\n\t\t\tskeptic,{image: \"skeptic.png\", position: leftMiddleSide},\r\n\t\t\t\tskeptic, \"— \",\r\n\t\t\t\taudio, {src: \"bensound-tomorrow\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\t\tdark, \"*приглушённо* — шшшш....\",\r\n\t\t\t\tdark, \" ......\",\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\r\n\t\t\r\n\t\t\t\tn, \"— ...\",\r\n\t\t\t\tn, \"— Как известно, убегать от проблем никогда не было хорошим решением..\",\r\n\t\t\t\tphoto, {image: \"1-1.png\", position: upperCenter},\r\n\t\t\t\tn, \"— Вам пришел конец.\",\r\n\t\t\t\tn, \"— Вы прошли игру на 1/3 звёзд.\",\r\n\t\t\t\t\r\n\t\t\t\tmenu, [\r\n\t\t\t\t\t\"Better Luck Next Time.\",\r\n\t\t\t\t\t\"Перейти в конец.\", [jump, \"lastlabel\"],\r\n\t\t\t\t],\r\n\t\t\r\n\t\tlabel, \"mainBattleLeft7\",\r\n\t\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\r\n\t\t\t\tscene, \"\",\r\n\t\t\t\taudio, {src: \"bensound-tomorrow\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\t\t\r\n\t\t\t\tn, \"— ...\",\r\n\t\t\t\tn, \"— Недоговорившись о своих действиях, каждый сделал какое-то действие, которое помешало другому. \",\r\n\t\t\t\tn, \"— Замешкавшись, вы потеряли контроль над светом, и Тьма этим воспользовалась.\",\r\n\t\t\tphoto, {image: \"1-1.png\", position: upperCenter},\r\n\t\t\t\tn, \"— Вам пришел конец.\",\r\n\t\t\t\tn, \"— Вы прошли игру на 1/3 звёзд.\",\r\n\t\t\r\n\t\t\t\tmenu, [\r\n\t\t\t\t\t\"Ну может в следующий раз.\",\r\n\t\t\t\t\t\"Перейти в конец.\", [jump, \"lastlabel\"],\r\n\t\t\t\t],\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\tlabel, \"mainBattleWellEnd\",\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\r\n\t\t\taudio, {src: \"piano\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\t\r\n\t\t\tn, \"...\", \r\n\t\tdreamer, {image: \"dreamer2.png\", position: leftMiddleSide},\t\r\n\t\t\tdreamer, \"— ...Оно отступает.\",\r\n\t\toptimist, {image: \"optimist.png\", position: leftSide},\t\r\n\t\t\toptimist, \"— ...кажется, да!\",\r\n\t\tskeptic,{image: \"skeptic2.png\", position: rightMiddleSide},\r\n\t\tdreamer, {image: \"empty.png\", position: rightSide},\r\n\t\t\tskeptic, \"— Существовать в одном мире с этой тварью стало как-то мрачновато.\",\r\n\t\t\tskeptic, \"— Откуда оно вообщё взялось, и зачем?\",\r\n\t\toptimist, {image: \"optimist.png\", position: leftMiddleSide},\t\r\n\t\t\toptimist, \"— Вот бы мы могли призвать Создателя и понять, зачем...\",\r\n\t\t\t\r\n\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\t\r\n\t\trealist, {image: \"realist4.png\", position: leftMiddleSide},\t\r\n\t\t\trealist, \"— Предлагаю узнать прямо сейчас.\",\r\n\t\t\tn, \"Гелиос складывает руки в молитвенной позе.\",\r\n\t\t\tn, \"Яркий свет отражался сквозь его полу-закрытые глаза.\",\r\n\t\t\tn, \"Гелиос засиял.\",\r\n\t\t\t\r\n\t\tlabel, \"wellEndingX\",\r\n\t\t\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Призвать Создателя.\",\r\n\t\t\t\t\"Прочитать молитву.\", [jump, \"nothingHappened\"],\r\n\t\t\t],\r\n\t\t\r\n\t\t\r\n\t\tlabel, \"nothingHappened\",\r\n\t\t\r\n\t\t\r\n\t\t\taudio, {src: \"piano\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\tn, \"...\", \r\n\t\t\tn, \"....\",\r\n\t\t\tn, \".....\",\r\n\t\t\tn, \"Ничего не произошло\",\r\n\t\t\t\r\n\t\trealist, {image: \"realist0.png\", position: leftMiddleSide},\t\t\r\n\t\t\trealist, \"— Мда.\",\r\n\t\t\trealist, \"— Ладно, в любом случае...\",\r\n\t\t\trealist, \"— Не расслабляйтесь.\",\r\n\t\t\trealist, \"— Нам ещё предстоит сражаться с этим, в любой момент.\",\r\n\t\t\trealist, \"— Создатель говорил, у него всегда есть план.\",\r\n\t\t\trealist, \"— И мы должны ему следовать.\",\r\n\t\t\r\n\t\trealist, {image: \"Head Gelious.png\", position: upperCenter},\r\n\t\t\r\n\t\tlabel, \"wellEnding0\",\r\n\t\t\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Выбрать за Гелиоса.\",\r\n\t\t\t\t\"Поверить в значимость плана Создателя.\", [jump, \"WellEnding1\"],\r\n\t\t\t\t\"Это всё бред.\", [jump, \"WellEnding2\"],\r\n\t\t\t],\r\n\t\t\r\n\t\tlabel, \"WellEnding1\",\r\n\t\t\r\n\t\trealist, {image: \"realist.png\", position: leftMiddleSide},\t\t\r\n\t\t\trealist, \"— Всегда есть план...\",\r\n\t\tskeptic,{image: \"skeptic2.png\", position: rightMiddleSide},\t\r\n\t\t\tskeptic, \"— Будешь слепо верить каким-то словам?\",\r\n\t\t\tskeptic, \"— Я устал от всей этой лжи.\",\r\n\t\tdreamer, {image: \"dreamer2.png\", position: leftMiddleSide},\t\r\n\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\tdreamer, \"— Не надо, Лу..\",\r\n\t\t\r\n\t\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\trealist, {image: \"realist0.png\", position: leftMiddleSide},\t\t\r\n\t\t\trealist, \"— В любом случае.\",\r\n\t\t\trealist, \"— Мы ничего не можем поделать, кроме как подготовиться к следующей битве.\",\r\n\t\toptimist, {image: \"optimist.png\", position: leftMiddleSide},\t\r\n\t\t\toptimist, \"— ...получается, что так.\",\r\n\t\toptimist, {image: \"empty.png\", position: rightMiddleSide},\r\n\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\r\n\t\t\r\n\t\tskeptic,{image: \"skeptic.png\", position: leftMiddleSide},\r\n\t\t\tskeptic, \"— Как хотите.\",\r\n\t\t\tskeptic, \"— В таком случае я лучше подготовлюсь в одиночку.\",\r\n\t\t\tskeptic, \"— Я уверен, что если мы возможно сможем выстоять против <i>этого существа</i>.\",\r\n\t\t\tskeptic, \"— То люди точно не смогут.\",\r\n\t\tskeptic,{image: \"skeptic3.png\", position: rightMiddleSide},\t\r\n\t\t\tskeptic, \"— Я отправляюсь на ближайшую заселенную ими планету.\",\r\n\t\t\tskeptic, \"— Она недалеко, Млечный Путь.\",\r\n\t\t\tskeptic, \"— Вы знаете, где меня искать.\",\r\n\t\toptimist, {image: \"optimist2.png\", position: leftMiddleSide},\t\r\n\t\t\toptimist, \"— Подожди!\",\r\n\t\t\toptimist, \"— Я пойду с тобой.\",\r\n\t\t\toptimist, \"— Я не выдержу в одиночестве открытого пространства.\",\r\n\t\t\t\r\n\t\t\t\r\n\t\trealist, {image: \"realist.png\", position: Center},\t\r\n\t\t\trealist, \"— Ну может тогда и ты, Неос, пойдешь с ними?\",\r\n\t\t\r\n\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\r\n\t\tdreamer, {image: \"dreamer2.png\", position: leftMiddleSide},\r\n\t\t\tdreamer, \"— Не-е...\",\r\n\t\t\tdreamer, \"— Мне с вами не по пути.\",\r\n\t\t\tdreamer, \"— Слишком много вопросов к одной занимательной персоне...\",\r\n\t\t\tdreamer, \"— Я лучше погибну, но найду Создателя.\",\r\n\t\t\tn, \"*Неос скрипит зубами*\",\r\n\t\t\tdreamer, \"— Он ответит за всё...\",\r\n\t\t\t\r\n\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\r\n\t\trealist, {image: \"realist.png\", position: Center},\t\r\n\t\t\trealist, \"— Что-ж...\",\r\n\t\t\trealist, \"— Тогда удачи вам всем в пути.\",\r\n\t\t\trealist, \"— Мне было счастьем быть с вами...\",\r\n\t\t\t\r\n\t\tdreamer, {image: \"dreamer.png\", position: rightSide},\r\n\t\t\tdreamer, \"— А что будет с тобой, Гелиос?\",\t\r\n\t\t\r\n\t\trealist, {image: \"realist2.png\", position: Center},\t\r\n\t\t\tn, \"Гелиос многозначительно улыбнулся самой грустной улыбкой, какая вообще может существовать.\",\r\n\t\t\trealist, \"— Увидишь.\",\r\n\t\t\r\n\t\t\tscene, \"\",\r\n\t\t\t\r\n\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\t\r\n\t\t\r\n\t\t\tsomeone2, \"— ...\",\r\n\t\t\tsomeone2, \"— Герои разбрелись в разные стороны.\",\r\n\t\t\tsomeone2, \"— Теперь их путь — долгий и полный скорби.\",\r\n\t\t\t\r\n\t\t\tscene, {image: \"luandami1.png\", position: Center},\r\n\t\t\t\r\n\t\t\tsomeone2, \"— Ами с Лу спустятся девой и мужем на Землю утренней звездой.\",\r\n\t\t\tsomeone2, \"— Ами разделит свой свет на крылатых человеко-подобных существ.\",\r\n\t \t\tscene, {image: \"luandami2.png\", position: Center},\r\n\t\t\tsomeone2, \"— Чтобы контролировать и оберегать жизнь людей.\",\r\n\t\t\t\r\n\t\t\tsomeone2, \"— Лу же взял на себя обязанности после смерти.\",\r\n\t\t\tsomeone2, \"— Он присматривает за смертными в своём огненном царстве.\",\r\n\t\t\tsomeone2, \"...\",\r\n\t\t\t\r\n\t\t\tscene, {image: \"neos1.png\", position: Center},\r\n\t\t\t\r\n\t\t\tsomeone2, \"— Неос была с трудным характером.\",\r\n\t\t\tsomeone2, \"— Но она просто хочет понять, что не так...\",\r\n\t \t\tscene, {image: \"neos2.png\", position: Center},\r\n\t\t\tsomeone2, \"— Отчаявшись найти Создателя в одной вселенной, она отправилась в другие.\",\r\n\t\t\tsomeone2, \"— И теперь люди гадают, действительно ли работает теория мультивселенных.\",\r\n\t\t\tsomeone2, \"...\",\r\n\t\t\t\r\n\t\t\tscene, {image: \"gelious1.png\", position: Center},\r\n\t\t\t\r\n\t\t\tsomeone2, \"— Гелиос же решился на очень отважный поступок.\",\r\n\t\t\tsomeone2, \"— Пытаясь защитить живые существа против Тьмы, он понял, насколько мало Света вокруг...\",\r\n\t \t\tscene, {image: \"gelious2.png\", position: Center},\r\n\t\t\tsomeone2, \"— И он сам стал этим светом, обернувшись в яркий шар света — Солнце.\",\r\n\t\t\tsomeone2, \"— Испуская свет в разные стороны, Гелиос освещает вселенную...\",\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t \r\n\t\t\tsomeone2, \"— ...\",\r\n\t\t\tsomeone2, \"— Герои разбрелись в разные стороны, но Тьма не дремлет.\",\r\n\t\t\tsomeone2, \"— Героям удалось отпугнуть её, но она всё ещё существует.\",\r\n\t\t\tsomeone2, \"— И существует она в их сердцах.\",\r\n\t\t\tsomeone2, \"— И пускай они разошлись своими путями, им предстоит ещё встретиться с Тьмой прямо у себя под носом.\",\r\n\t\t\t\r\n\t\t\tsomeone2, \"— ...\",\r\n\t\t\tcreator, \"— Ведь это я их такими создал.\",\r\n\t\t\tcreator, \"— Именно Тьма внутри наших сердец мешает нам услышать других.\",\r\n\t\t\tcreator, \"— Увидеть наши светлые души...\",\r\n\t\t\tcreator, \"— Понять и принять.\",\r\n\t\t\t\r\n\t\t\tcreator, \"— Теперь герои заняты — присматривают за Вами, людьми.\",\r\n\t\t\tcreator, \"— Но Вселенская Тьма всё ещё рядом.\",\r\n\t\t\tcreator, \"— 2020 по Григорианскому календарю год может стать губительным.\",\r\n\t\t\tcreator, \"— Удачи вам всем.\",\r\n\t\t\t\r\n\t\t\tphoto, {image: \"2-2.png\", position: upperCenter},\r\n\t\t\tn, \"— Вы прошли игру на 2/3 звёзд.\",\r\n\t\t\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Частичная победа.\",\r\n\t\t\t\t\"Перейти в конец.\", [jump, \"lastlabel\"],\r\n\t\t\t],\r\n\t\t\t\r\n\t\tlabel, \"WellEnding2\",\t\r\n\t\t\t\r\n\t\t\tscene, \"\",\r\n\t\t\t\r\n\t\trealist, {image: \"realist3.png\", position: leftMiddleSide},\t\r\n\t\t\trealist, \"— Но я не хочу верить этому.\",\r\n\t\t\trealist, \"— Зачем ему понадобилось это всё?!\",\r\n\t\tskeptic,{image: \"skeptic2.png\", position: rightMiddleSide},\t\r\n\t\t\tskeptic, \"— Согласен, это просто смертельная игра.\",\r\n\t\toptimist, {image: \"optimist.png\", position: leftSide},\t\r\n\t\t\toptimist, \"— Не надо так о Создателе!\",\r\n\t\t\toptimist, \"— Никто даже не погиб.\",\r\n\t\tdreamer, {image: \"dreamer2.png\", position: leftMiddleSide},\t\r\n\t\t\tdreamer, \"— Она права!\",\r\n\t\t\tdreamer, \"— Выстояли сейчас, сможем и потом.\",\r\n\t\trealist, {image: \"realist3.png\", position: leftMiddleSide},\t\r\n\t\t\tn, \"*Гелиос саркастически поднял брови*\",\r\n\t\t\trealist, \"— Да, конечно.\",\r\n\t\t\t\r\n\t\t\tskeptic, \"— Издеваетесь? Нас чуть живьем не поглотили!\",\r\n\t\t\tdreamer, \"— Перестань орать, скептик несчастный!\",\r\n\t\t\tskeptic, \"— Что ты мне ска...\",\r\n\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\trealist, {image: \"empty.png\", position: leftSide},\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\taudio, {src: \"bensound-tomorrow\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\tdark, {image: \"dark.png\", position: upperCenter},\t\r\n\t\t\tdark, \"*приглушённо* — шшшш....\",\r\n\t\t\tdark, \" ......\",\r\n\t\t\r\n\t\t\tn, \"— ...\",\r\n\t\t\tn, \"— Ваши споры и ругань дали возможность Тьме подкрастаться незаметно.\",\r\n\t\t\tn, \"— Тьма поглотила вас.\",\r\n\t\t\tn, \"— В общем-то...\",\r\n\t\t\tphoto, {image: \"1-1.png\", position: upperCenter},\r\n\t\t\tn, \"— ...вам пришел конец.\",\r\n\t\t\tn, \"— Вы удалось прийти игру только на 1/3 звёзд.\",\r\n\t\t\t\t\r\n\t\t\tmenu, [\r\n\t\t\t\"Ну ничего страшного.\",\r\n\t\t\t\"Перейти в конец.\", [jump, \"lastlabel\"],\r\n\t\t\t],\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\tlabel, \"mainBattleRight6\",\r\n\t\taudio, {src: \"bensound-memories\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\r\n\t\t\tscene, \"\", \r\n\t\t\t\r\n\t\t\tn, \"...\", \r\n\t\tdreamer, {image: \"dreamer2.png\", position: leftMiddleSide},\r\n\t\t\tdreamer, \"— ...а?\",\r\n\t\t\tdreamer, \"— Оно... оно кончилось?\",\r\n\t\toptimist, {image: \"optimist.png\", position: rightMiddleSide},\t\r\n\t\t\toptimist, \"— ...кажется, да\",\r\n\t\t\t\r\n\t\trealist, {image: \"realist0.png\", position: Center},\t\t\r\n\t\t\trealist, \"— Вот это было жёстко, конечно...\",\r\n\t\t\trealist, \"— Столько взаимодействия командного, вот это у нас сплочённость!\",\r\n\t\t\t\r\n\t\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\t\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\t\trealist, {image: \"empty.png\", position: leftSide},\t\r\n\t\t\t\r\n\t\t\tn, \"*Всё медленно расслабляются, не веря в свою победу*\", \r\n\t\tskeptic,{image: \"skeptic3.png\", position: leftMiddleSide},\t\r\n\t\t\tn, \"*Лу медленно выдыхает*\", \r\n\t\t\tskeptic, \"— Как же хорошо, что всё это кончилось...\",\r\n\t\t\r\n\t\tskeptic,{image: \"skeptic.png\", position: rightMiddleSide},\r\n\t\t\tskeptic, \"— У меня есть только один вопрос...\",\r\n\t\t\tskeptic, \"— Это существо... оно состоит не из света.\",\r\n\t\t\tskeptic, \"— Откуда оно взялось и зачем?\",\r\n\t\t\r\n\t\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\t\r\n\t\trealist, {image: \"realist4.png\", position: leftMiddleSide},\t\r\n\t\t\trealist, \"— Предлагаю узнать прямо сейчас.\",\r\n\t\t\tn, \"Гелиос складывает руки в молитвенной позе.\",\r\n\t\t\tn, \"Яркий свет отражался сквозь его полу-закрытые глаза.\",\r\n\t\t\tn, \"Гелиос засиял. Связь была установлена.\",\r\n\t\t\r\n\t\tlabel, \"mainEnding0\",\r\n\t\t\r\n\t\t\tmenu, [\r\n\t\t\t\t\"Призвать Создателя.\",\r\n\t\t\t\t\"Прочитать молитву.\", [jump, \"mainEnding1\"],\r\n\t\t\t],\r\n\t\t\r\n\t\t\r\n\t\tlabel, \"mainEnding1\",\r\n\t\t\r\n\t\t\r\n\t\taudio, {src: \"piano\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\r\n\t\tscene, \"\",\r\n\t\tn, \"...\", \r\n\t\tn, \"Неожиданно, послышался невероятно спокойный, мягкий голос, сразу со всех сторон.\", \r\n\t\tn, \"Как будто его источник был везде.\", \r\n\t\tcreator, \"Sit vis vobiscum.\",\r\n\t\tcreator, \"...Приветствую вас.\",\r\n\tskeptic,{image: \"skeptic3.png\", position: leftMiddleSide},\t\r\n\t\tskeptic, \"— Кхм...\",\r\n\tskeptic,{image: \"empty.png\", position: leftMiddleSide},\t\r\n\tdreamer, {image: \"dreamer3.png\", position: leftMiddleSide},\r\n\t\tdreamer, \"— Создатель!\",\r\n\tdreamer, {image: \"dreamer2.png\", position: leftMiddleSide},\t\r\n\t\tdreamer, \"— Скажи, зачем существовало это... <i>Оно</i>...?\",\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\t\t\r\n\trealist, {image: \"realist0.png\", position: leftMiddleSide},\r\n\t\trealist, \"*напряжён*\",\r\n\trealist, {image: \"empty.png\", position: leftMiddleSide},\t\r\n\t\r\n\t\r\n\t\tcreator, \"— ...\",\r\n\t\tcreator, \"— ...Видите-ли.\",\r\n\t\tcreator, \"— ...Эта <i>Тьма</i> — ваша персональная борьба.\",\r\n\toptimist, {image: \"optimist.png\", position: leftMiddleSide},\t\r\n\t\toptimist, \"— ...но зачем?\",\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\t\r\n\t\tcreator, \"— ...Для меня нет возможности создавать себе подобных, милые мои создания.\",\r\n\t\tcreator, \"— ..И только сами вы можете не воссоединиться со мной, но стать, как я, пройдя свой путь..\",\r\n\t\tcreator, \"— ...Вы победили Тьму ради других, но главное — вы победили её в себе.\",\r\n\t\tcreator, \"— ...И это был первый шаг к вашему пониманию сути бытия.\",\r\n\t\tcreator, \"— ...Светославляю вас...\",\r\n\t\t\r\n\tdreamer, {image: \"dreamer.png\", position: rightMiddleSide},\t\r\n\t\tdreamer, \"— ...Но создатель? Что нам делать теперь?\",\r\n\tdreamer, {image: \"empty.png\", position: rightMiddleSide},\t\t\r\n\t\tn, \"*Создатель загадочно улыбается*\",\r\n\t\tcreator, \"— ...На самом деле вы всегда знали, что делать.\",\r\n\t\tcreator, \"— ...\",\r\n\t\tsomeone2, \"— .........\",\r\n\t\t\r\n\t\tlabel, \"mainEnding2\",\r\n\t\t\r\n\tdreamer, {image: \"dreamer2.png\", position: leftMiddleSide},\t\r\n\t\tdreamer, \"— ...\",\r\n\toptimist, {image: \"optimist.png\", position: rightMiddleSide},\t\r\n\t\toptimist, \"— Невероятно, конечно.\",\r\n\trealist, {image: \"realist0.png\", position: leftSide},\t\r\n\t\tn, \"*Гелиос вздыхает*\",\r\n\tskeptic,{image: \"skeptic2.png\", position: rightSide},\t\r\n\t\tskeptic, \"— Получается, нам всем нужно разойтись своим путём?\",\r\n\t\r\n\t\trealist, \"— Да.\",\r\n\t\trealist, \"— Вы прекрасно знаете, что теперь нужно делать.\",\r\n\r\n\tdreamer, {image: \"empty.png\", position: rightSide},\t\r\n\tskeptic,{image: \"empty.png\", position: rightMiddleSide},\r\n\toptimist, {image: \"empty.png\", position: leftMiddleSide},\r\n\trealist, {image: \"empty.png\", position: leftSide},\r\n\t\r\n\t\tn, \"*Произошли коллективные объятья. Без выбора*\", \r\n\t\t\r\n\t\tskeptic, \"Тогда прощаемся...\",\r\n\t\tskeptic, \"Теперь мы должны защищать людей от Тьмы..\",\r\n\t\t\r\n\t\tscene, \"\",\r\n\t\tskeptic, \"*Ярким светом сбрасывает себя на Землю вместе с Ами*\",\r\n\t\t\r\n\t\tscene, \"\",\r\n\t\tdreamer, \"*Выходит из за пределы галактических пространств в параллельную вселенную.*\",\r\n\t\t\r\n\t\tn, \"...\",\r\n\t\trealist, \"— ...\",\r\n\trealist, {image: \"realist.png\", position: Center},\r\n\t\trealist, \"— Хей.\",\r\n\t\trealist, \"— Надеюсь, ты понимаешь, для чего тебе всё это было показано.\",\r\n\r\n\t\trealist, \"— Будь осторожен. Тьма среди людей всё ещё существует.\",\r\n\t\trealist, \"— ...\",\r\n\t\trealist, \"— ...Я всегда буду рядом с тобой, светить для тебя.\",\r\n\trealist, {image: \"empty.png\", position: leftSide},\t\r\n\t\tn, \"*Гелиос ушёл*\",\r\n\t\t\r\n\t\tsomeone2, \"— ...\",\r\n\t\tsomeone2, \"— ...\",\r\n\t\t\tsomeone2, \"— Герои разбрелись в разные стороны.\",\r\n\t\t\tsomeone2, \"— Их путь великий и прекрасный.\",\r\n\t\t\t\r\n\t\t\tscene, {image: \"luandami1.png\", position: Center},\r\n\t\t\t\r\n\t\t\tsomeone2, \"— Ами с Лу спустятся девой и мужем на Землю утренней звездой.\",\r\n\t\t\tsomeone2, \"— Ами разделит свой свет на крылатых человеко-подобных существ.\",\r\n\t \t\tscene, {image: \"luandami2.png\", position: Center},\r\n\t\t\tsomeone2, \"— Чтобы контролировать и оберегать жизнь людей.\",\r\n\t\t\t\r\n\t\t\tsomeone2, \"— Лу же взял на себя обязанности после смерти.\",\r\n\t\t\tsomeone2, \"— Он присматривает за смертными в своём огненном царстве.\",\r\n\t\t\tsomeone2, \"...\",\r\n\t\t\t\r\n\t\t\tscene, {image: \"neos1.png\", position: Center},\r\n\t\t\t\r\n\t\t\tsomeone2, \"— Неос была с трудным характером.\",\r\n\t\t\tsomeone2, \"— Но она просто хочет понять, что не так...\",\r\n\t \t\tscene, {image: \"neos2.png\", position: Center},\r\n\t\t\tsomeone2, \"— Отчаявшись найти Создателя в одной вселенной, она отправилась в другие.\",\r\n\t\t\tsomeone2, \"— И теперь люди гадают, действительно ли работает теория мультивселенных.\",\r\n\t\t\tsomeone2, \"...\",\r\n\t\t\t\r\n\t\t\tscene, {image: \"gelious1.png\", position: Center},\r\n\t\t\t\r\n\t\t\tsomeone2, \"— Гелиос же решился на очень отважный поступок.\",\r\n\t\t\tsomeone2, \"— Пытаясь защитить живые существа против Тьмы, он понял, насколько мало Света вокруг...\",\r\n\t \t\tscene, {image: \"gelious2.png\", position: Center},\r\n\t\t\tsomeone2, \"— И он сам стал этим светом, обернувшись в яркий шар света — Солнце.\",\r\n\t\t\tsomeone2, \"— Испуская свет в разные стороны, Гелиос освещает вселенную...\",\r\n\t\t\tscene, {image: \"empty.png\", position: Center},\r\n\t\t\tsomeone2, \"— ...\",\r\n\t\t\tsomeone2, \"— Героям удалось победить Тьму, но она всё ещё существует.\",\r\n\t\t\tsomeone2, \"— И существует она в сердцах всего живого.\",\r\n\t\t\tsomeone2, \"— ...\",\r\n\t\t\t\r\n\t\t\tsomeone2, \"— ...\",\r\n\t\t\tcreator, \"— Ведь это я их такими создал.\",\r\n\t\t\tcreator, \"— Именно Тьма внутри наших сердец мешает нам услышать других.\",\r\n\t\t\tcreator, \"— Увидеть наши светлые души.\",\r\n\t\t\tcreator, \"— Понять и принять...\",\r\n\t\t\t\r\n\t\t\tcreator, \"— 4 героя Света теперь заняты — присматривают за Вами, людьми.\",\r\n\t\t\tcreator, \"— Но Вселенская Тьма всё ещё рядом.\",\r\n\t\t\tcreator, \"— 2020 по Григорианскому календарю год может стать губительным.\",\r\n\t\t\tcreator, \"— Удачи вам всем.\",\r\n\t\t\r\n\t\tn, \"— ...\",\r\n\t\tphoto, {image: \"3-3.png\", position: upperCenter},\r\n\t\tn, \"— Поздравляем!.\",\r\n\t\tn, \"— Вы прошли игру на 3/3 звёзд.\",\r\n\t\t\r\n\t\tmenu, [\r\n\t\t\t\"Победа.\",\r\n\t\t\t\"Перейти в конец.\", [jump, \"lastlabel\"],\r\n\t\t],\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\tlabel, \"lastlabel\",\r\n\t\t\t\r\n\t\t\taudio, {src: \"bensound-memories\", format: [\"mp3\"], action: \"play\"},\r\n\t\t\tn, \"...\",\r\n\t\t\tn, \"Поздравляем вас с успешным (или не очень) прохождением игры.\",\r\n\t\t\tn, \"Мы очень надеемся, что вам она понравилась.\",\r\n\t\t\tn, \"Перед тем, как закончить, пожалуйста, пройдите небольшой опросник об игре, а после вернитесь на readymag, чтобы посмотреть интервью с разработчиками\",\r\n\t\t\t\r\n\t\tlionText, {\r\n width: 0.6, color: \"grey\", border: \"1px solid grey\",\r\n backgroundColor: \"#2E3540\",\r\n position: new Position(0.20, 0.3), align: \"wenter\",\r\n visibility: \"visible\",\r\n text:\"Пожалуйста, пройдите небольшой опросник об игре: <a href='https://forms.gle/rQmxfJ2UVu1t2SzT9' style='color:white'> Google Forms</a>\"},\r\n\t\t\t\r\n\t\t\tn, \"Ещё раз спасибо <3.\",\r\n\t\t\tn, \"Перепройти игру?\",\r\n\t\t\r\n\t\t\r\n ];\r\n}",
"function toNeumeFromNeumeVariations(){\n pushedNeumeVariations = false;\n neumeVariations = new Array();\n \n isNeumeVariant = false;\n \n document.getElementById(\"input\").innerHTML = neumeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n}",
"function applyNeumeDataChanges(){\n var type = document.getElementById(\"type\").value;\n \n if(type && type != \"none\"){\n currentNeume.type = type;\n }\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = neumeDataChangeForm();\n createSVGOutput();\n}",
"calculateType() {\n let ret;\n\n if (this.NoteLength === 4) {\n ret = 'w';\n } else if (this.NoteLength >= 2 && this.NoteLength <= 3) {\n ret = 'h';\n } else if (this.NoteLength >= 1 && this.NoteLength < 2) {\n ret = 'w';\n } else if (this.NoteLength === 0.25) {\n ret = 'q';\n } else if (this.NoteLength === 0.5) {\n ret = 'h';\n } else if (this.NoteLength <= (1 / 8)) {\n ret = Math.round(1 / (1 / 8)).toString();\n }\n return ret;\n }",
"function createAdditionalVariation(){\n \n variations = new Array();\n \n for(i = 0; i < sources.length; i++){\n var variation = new Variation(sources[i].id);\n variations.push(variation);\n }\n \n currentNeume.pitches.splice(currentPitchIndex, 0, variations);\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n createSVGOutput();\n}",
"function input () {\n ny = inputNumber(ipNy,3,false,0.1,100); // Frequenz (Hz)\n u0 = inputNumber(ipU0,3,false,0.1,100); // Maximale Spannung (V)\n if (dPhi == 0) r = inputNumber(ipRCL,3,false,10,1000); // Falls Widerstand, Eingabe in Ohm\n else if (dPhi > 0) // Falls Kondensator ...\n c = 1e-6*inputNumber(ipRCL,3,false,1,100); // ... Eingabe der Kapazität in Mikrofarad, Umrechnung in Farad\n else l = inputNumber(ipRCL,3,false,10,1000); // Falls Spule, Eingabe der Induktivität in Henry \n } // ---!",
"function save_notes(){\n var result = '';\n var result_decode = '';\n var $addition = 0;\n var $num_notes = 0;\n var $average = 0;\n\n for (var prop in $notes){\n result_decode += ''+$.base64.decode(prop)+'/'+$.base64.decode($notes[prop]) + '/';\n }\n\n if ($partial == 1) {\n if($notes[$.base64.encode('nota1_i')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota1_i')])); $num_notes += 1;}\n if($notes[$.base64.encode('nota2_i')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota2_i')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota3_i')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota3_i')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota4_i')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota4_i')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota5_i')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota5_i')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota6_i')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota6_i')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota7_i')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota7_i')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota8_i')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota8_i')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota9_i')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota9_i')]));$num_notes += 1;}\n\n $average = Math.floor(floatval($addition/$num_notes));\n // alert($average);\n $notes[$.base64.encode('promedio1')] = $average;\n $notes[$.base64.encode('promedio1')] = $.base64.encode($notes[$.base64.encode('promedio1')]);\n\n\n }else{\n if ($partial == 2) {\n if($notes[$.base64.encode('nota1_ii')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota1_ii')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota2_ii')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota2_ii')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota3_ii')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota3_ii')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota4_ii')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota4_ii')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota5_ii')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota5_ii')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota6_ii')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota6_ii')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota7_ii')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota7_ii')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota8_ii')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota8_ii')]));$num_notes += 1;}\n if($notes[$.base64.encode('nota9_ii')]){$addition += intval($.base64.decode($notes[$.base64.encode('nota9_ii')]));$num_notes += 1;}\n\n $average = Math.floor(floatval($addition/$num_notes));\n $notes[$.base64.encode('promedio2')]= $average;\n $before = intval($.base64.decode($notes[$.base64.encode('promedio1')])) + $average;\n\n $notes[$.base64.encode('notafinal')] = roundNumber($before/2,0);\n $notes[$.base64.encode('promedio2')] = $.base64.encode($notes[$.base64.encode('promedio2')]);\n $notes[$.base64.encode('notafinal')] = $.base64.encode($notes[$.base64.encode('notafinal')]);\n\n }\n }\n\n $($tr[0].children).each(function(){\n if (this.firstElementChild != null) {\n if (this.firstElementChild.nodeName == 'INPUT') {\n $input_text = $(this.firstElementChild);\n $name = $input_text.attr('name');\n if ($name == 'promedio1') {\n // alert($.base64.decode($notes_prom[$.base64.encode('promedio1')]));\n $input_text.val($.base64.decode($notes[$.base64.encode('promedio1')]));\n }\n if ($name == 'promedio2') {\n $input_text.val($.base64.decode($notes[$.base64.encode('promedio2')]));\n }\n if ($name == 'notafinal') {\n $input_text.val($.base64.decode($notes[$.base64.encode('notafinal')]));\n }\n }\n }\n\n });\n\n for (var prop in $notes){\n result += '' + prop + '/' + $notes[prop] + '/';\n }\n result = result.substring(0,result.length-1);\n result = result + '/' + $.base64.encode('partial') + '/' + $.base64.encode($partial);\n var $url = '/docente/fillnotes/savetargetnotes/' + result;\n /**************************************************************/\n if(result_decode.toLowerCase().indexOf(\"nota\") >= 0){\n $indexTmp = $index_tmp;\n $.ajax({\n url:$url,\n async:false,\n success:function($data){\n \n if ($data.status==true) {\n $(\"#edit-note-\" + $indexTmp).removeClass();\n $(\"#edit-note-\" + $indexTmp).attr('src','/img/accept_page.png');\n $tr.css('color','none');\n }else{\n $(\"#edit-note-\" + $indexTmp).removeClass();\n $(\"#edit-note-\" + $indexTmp).attr('src','/img/accept_page.png');\n $tr.css(\"color\", \"#FC4141\");\n }\n $tr.attr(\"edition\",false); \n },\n error:function($data){\n $tr.css(\"color\", \"#FC4141\");\n $(\"#edit-note-\" + $indexTmp).attr('src','/img/delete_page.png');\n $tr.attr(\"edition\",false); \n\n }\n });\n }\n\n $notes = {};\n return true;\n}",
"function toPitchesFromVariations(){\n pushedVariations = false;\n variations = new Array();\n \n document.getElementById(\"input\").innerHTML = pitchForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function createVariation(){\n var sourceID = document.getElementById(\"source\").value;\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"connection\").value;\n var tilt = document.getElementById(\"tilt\").value;\n var graphicalVariation = document.getElementById(\"variation\").value;\n var supplied = document.getElementById(\"supplied\").value;\n \n currentSID = sourceID;\n \n var p = new Pitch(pitch, octave, comment, intm, connection, tilt, graphicalVariation, supplied);\n \n var variationAvailable = false;\n \n var i;\n \n if(variations.length < 1){\n for(i = 0; i < sources.length; i++){\n var variation = new Variation(sources[i].id);\n variations.push(variation);\n }\n }\n \n for(i = 0; i < variations.length; i++){\n if(variations[i].sourceID == sourceID){\n variations[i].additionalPitches.push(p);\n variationAvailable = true;\n break;\n }\n }\n \n if(!pushedVariations){\n currentNeume.pitches.push(variations);\n pushedVariations = true;\n }\n else{\n currentNeume.pitches.pop();\n currentNeume.pitches.push(variations);\n }\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = variationForm();\n createSVGOutput();\n}",
"write(addToPaper,onPaper){cov_1rtpcx8cw8.f[1]++;let availableLetters=(cov_1rtpcx8cw8.s[2]++,this.pointDegradation(addToPaper));// Write the letters of the string you can write with the pencil\ncov_1rtpcx8cw8.s[3]++;if(onPaper){cov_1rtpcx8cw8.b[0][0]++;cov_1rtpcx8cw8.s[4]++;return`${onPaper} ${availableLetters}`;}else{cov_1rtpcx8cw8.b[0][1]++;cov_1rtpcx8cw8.s[5]++;return availableLetters;}}",
"function readOutLoud(message) {\n //transcript/string of what you said/asked is passed in\n const speech = new SpeechSynthesisUtterance(); //the text that the AI will say\n speech.text = \"\"; //starts empty, is checked later to prevent empty responses\n //if user is greeting the AI -----\n if (message.includes('hello')) {\n //array of possible responses\n const greetings = [\n 'who said you could speak to me?',\n 'leave me alone.',\n 'die in a hole.'\n ]\n const greet = greetings[Math.floor(Math.random() * greetings.length)]; //select a random response\n speech.text = greet; //final output is set\n }\n //-------------------------------\n //if the user is asks how the AI is\n else if (message.includes('how are you')) {\n //array of possible responses\n const howWeBe = [\n 'i was doing better until you showed up',\n 'i\\'m a hardcoded speaking Javascript file you moron, what do you think?',\n 'seriously, who asks an \\\"AI\\\" made by college kids how they\\'re doing.'\n ]\n const how = howWeBe[Math.floor(Math.random() * howWeBe.length)]; //select a random response\n speech.text += how; //final output is set\n }\n //-------------------------------\n //if user asks for weather ------\n else if (message.includes('weather')) {\n getWeather(); //updates weather\n //variables for weather data --\n var temp = Math.floor(Number(document.getElementById('temp').innerHTML) - 273.15);\n var feelsLike = Math.floor(Number(document.getElementById('feelslike').innerHTML) - 273.15);\n var placeName = document.getElementById('place').innerHTML;\n placeName = placeName.charAt(0).toLowerCase() + placeName.slice(1);\n var skies = document.getElementById('weather').innerHTML;\n //----------------------------\n var weatherR = \"in \" + placeName + \", the temperature is \" + temp + \" degrees celsius\" //basic weather output\n //if it feels like something different than the actual temp\n if (temp == feelsLike) {\n weatherR += \". \";\n } else {\n weatherR += \", but it feels like \" + feelsLike + \" degrees. \";\n }\n //extra information based on if its clear, rainy, cloudy, etc.\n if (skies == 'Clear') {\n weatherR += \"today the skies are clear, meaning sadly nothing to ruin your day. At least not weather wise.\";\n } else if (skies == 'Rain') {\n weatherR += \"today there is rain, meaning you can maybe finally wash that smell off you.\";\n } else if (skies == 'Snow') {\n weatherR += \"there's snow today, so stay inside and suffer instead! I'll enjoy it.\";\n } else if (skies == \"Clouds\") {\n weatherR += \"the skies are cloudy today, so enjoy the wonderful lack of sunlight!\";\n } else if (skies == \"Haze\") {\n weatherR += \"it's hazy today, so have fun seeing clearly!\"\n }\n speech.text += weatherR; //final output is set\n }\n // //google placeholder\n // else if (message.includes(\"google\")) {\n // }\n //-------------------------------\n //generic wolfram alpha search --\n else {\n document.getElementById('generic').innerHTML = message;\n python();\n console.log(document.getElementById('generic').innerHTML);\n }\n //-------------------------------\n //voice synthesis properties ----\n speech.volume = 1;\n speech.rate = .95;\n speech.pitch = 1;\n speech.lang = 1;\n if (speech.text == \"\") { //prevent empty response with default/fallback response\n speech.text += \"At least tell me something I can understand.\"\n }\n aiOutput.textContent = speech.text;\n window.speechSynthesis.speak(speech); //makes AI actually speak + respond\n //-------------------------------\n}",
"function calculateNutation() {\n\t// IAU 1980 calculateNutation theory:\n\n\t// Mean anomaly of the Moon\n\tlet Mm = 134.962981389 + 198.867398056 * TE + Utils.norm360Deg(477000 * TE) + 0.008697222222 * TE2 + TE3 / 56250;\n\n\t// Mean anomaly of the Sun\n\tlet M = 357.527723333 + 359.05034 * TE + Utils.norm360Deg(35640 * TE) - 0.0001602777778 * TE2 - TE3 / 300000;\n\n\t// Mean distance of the Moon from ascending node\n\tlet F = 93.271910277 + 82.017538055 * TE + Utils.norm360Deg(483120 * TE) - 0.0036825 * TE2 + TE3 / 327272.7273;\n\n\t// Mean elongation of the Moon\n\tlet D = 297.850363055 + 307.11148 * TE + Utils.norm360Deg(444960 * TE) - 0.001914166667 * TE2 + TE3 / 189473.6842;\n\n\t// Longitude of the ascending node of the Moon\n\tlet omega = 125.044522222 - 134.136260833 * TE - Utils.norm360Deg(1800 * TE) + 0.002070833333 * TE2 + TE3 / 450000;\n\n\t// Periodic terms for nutation\n\tlet nut = [\n\t\t[ 0, 0, 0, 0, 1, -171996, -174.2, 92025, 8.9 ],\n\t\t[ 0, 0, 2, -2, 2, -13187, -1.6, 5736, -3.1 ],\n\t\t[ 0, 0, 2, 0, 2, -2274, -0.2, 977, -0.5 ],\n\t\t[ 0, 0, 0, 0, 2, 2062, 0.2, -895, 0.5 ],\n\t\t[ 0, -1, 0, 0, 0, -1426, 3.4, 54, -0.1 ],\n\t\t[ 1, 0, 0, 0, 0, 712, 0.1, -7, 0.0 ],\n\t\t[ 0, 1, 2, -2, 2, -517, 1.2, 224, -0.6 ],\n\t\t[ 0, 0, 2, 0, 1, -386, -0.4, 200, 0.0 ],\n\t\t[ 1, 0, 2, 0, 2, -301, 0.0, 129, -0.1 ],\n\t\t[ 0, -1, 2, -2, 2, 217, -0.5, -95, 0.3 ],\n\t\t[ -1, 0, 0, 2, 0, 158, 0.0, -1, 0.0 ],\n\t\t[ 0, 0, 2, -2, 1, 129, 0.1, -70, 0.0 ],\n\t\t[ -1, 0, 2, 0, 2, 123, 0.0, -53, 0.0 ],\n\t\t[ 1, 0, 0, 0, 1, 63, 0.1, -33, 0.0 ],\n\t\t[ 0, 0, 0, 2, 0, 63, 0.0, -2, 0.0 ],\n\t\t[ -1, 0, 2, 2, 2, -59, 0.0, 26, 0.0 ],\n\t\t[ -1, 0, 0, 0, 1, -58, -0.1, 32, 0.0 ],\n\t\t[ 1, 0, 2, 0, 1, -51, 0.0, 27, 0.0 ],\n\t\t[ -2, 0, 0, 2, 0, -48, 0.0, 1, 0.0 ],\n\t\t[ -2, 0, 2, 0, 1, 46, 0.0, -24, 0.0 ],\n\t\t[ 0, 0, 2, 2, 2, -38, 0.0, 16, 0.0 ],\n\t\t[ 2, 0, 2, 0, 2, -31, 0.0, 13, 0.0 ],\n\t\t[ 2, 0, 0, 0, 0, 29, 0.0, -1, 0.0 ],\n\t\t[ 1, 0, 2, -2, 2, 29, 0.0, -12, 0.0 ],\n\t\t[ 0, 0, 2, 0, 0, 26, 0.0, -1, 0.0 ],\n\t\t[ 0, 0, 2, -2, 0, -22, 0.0, 0, 0.0 ],\n\t\t[ -1, 0, 2, 0, 1, 21, 0.0, -10, 0.0 ],\n\t\t[ 0, 2, 0, 0, 0, 17, -0.1, 0, 0.0 ],\n\t\t[ 0, 2, 2, -2, 2, -16, 0.1, 7, 0.0 ],\n\t\t[ -1, 0, 0, 2, 1, 16, 0.0, -8, 0.0 ],\n\t\t[ 0, 1, 0, 0, 1, -15, 0.0, 9, 0.0 ],\n\t\t[ 1, 0, 0, -2, 1, -13, 0.0, 7, 0.0 ],\n\t\t[ 0, -1, 0, 0, 1, -12, 0.0, 6, 0.0 ],\n\t\t[ 2, 0, -2, 0, 0, 11, 0.0, 0, 0.0 ],\n\t\t[ -1, 0, 2, 2, 1, -10, 0.0, 5, 0.0 ],\n\t\t[ 1, 0, 2, 2, 2, -8, 0.0, 3, 0.0 ],\n\t\t[ 0, -1, 2, 0, 2, -7, 0.0, 3, 0.0 ],\n\t\t[ 0, 0, 2, 2, 1, -7, 0.0, 3, 0.0 ],\n\t\t[ 1, 1, 0, -2, 0, -7, 0.0, 0, 0.0 ],\n\t\t[ 0, 1, 2, 0, 2, 7, 0.0, -3, 0.0 ],\n\t\t[ -2, 0, 0, 2, 1, -6, 0.0, 3, 0.0 ],\n\t\t[ 0, 0, 0, 2, 1, -6, 0.0, 3, 0.0 ],\n\t\t[ 2, 0, 2, -2, 2, 6, 0.0, -3, 0.0 ],\n\t\t[ 1, 0, 0, 2, 0, 6, 0.0, 0, 0.0 ],\n\t\t[ 1, 0, 2, -2, 1, 6, 0.0, -3, 0.0 ],\n\t\t[ 0, 0, 0, -2, 1, -5, 0.0, 3, 0.0 ],\n\t\t[ 0, -1, 2, -2, 1, -5, 0.0, 3, 0.0 ],\n\t\t[ 2, 0, 2, 0, 1, -5, 0.0, 3, 0.0 ],\n\t\t[ 1, -1, 0, 0, 0, 5, 0.0, 0, 0.0 ],\n\t\t[ 1, 0, 0, -1, 0, -4, 0.0, 0, 0.0 ],\n\t\t[ 0, 0, 0, 1, 0, -4, 0.0, 0, 0.0 ],\n\t\t[ 0, 1, 0, -2, 0, -4, 0.0, 0, 0.0 ],\n\t\t[ 1, 0, -2, 0, 0, 4, 0.0, 0, 0.0 ],\n\t\t[ 2, 0, 0, -2, 1, 4, 0.0, -2, 0.0 ],\n\t\t[ 0, 1, 2, -2, 1, 4, 0.0, -2, 0.0 ],\n\t\t[ 1, 1, 0, 0, 0, -3, 0.0, 0, 0.0 ],\n\t\t[ 1, -1, 0, -1, 0, -3, 0.0, 0, 0.0 ],\n\t\t[ -1, -1, 2, 2, 2, -3, 0.0, 1, 0.0 ],\n\t\t[ 0, -1, 2, 2, 2, -3, 0.0, 1, 0.0 ],\n\t\t[ 1, -1, 2, 0, 2, -3, 0.0, 1, 0.0 ],\n\t\t[ 3, 0, 2, 0, 2, -3, 0.0, 1, 0.0 ],\n\t\t[ -2, 0, 2, 0, 2, -3, 0.0, 1, 0.0 ],\n\t\t[ 1, 0, 2, 0, 0, 3, 0.0, 0, 0.0 ],\n\t\t[ -1, 0, 2, 4, 2, -2, 0.0, 1, 0.0 ],\n\t\t[ 1, 0, 0, 0, 2, -2, 0.0, 1, 0.0 ],\n\t\t[ -1, 0, 2, -2, 1, -2, 0.0, 1, 0.0 ],\n\t\t[ 0, -2, 2, -2, 1, -2, 0.0, 1, 0.0 ],\n\t\t[ -2, 0, 0, 0, 1, -2, 0.0, 1, 0.0 ],\n\t\t[ 2, 0, 0, 0, 1, 2, 0.0, -1, 0.0 ],\n\t\t[ 3, 0, 0, 0, 0, 2, 0.0, 0, 0.0 ],\n\t\t[ 1, 1, 2, 0, 2, 2, 0.0, -1, 0.0 ],\n\t\t[ 0, 0, 2, 1, 2, 2, 0.0, -1, 0.0 ],\n\t\t[ 1, 0, 0, 2, 1, -1, 0.0, 0, 0.0 ],\n\t\t[ 1, 0, 2, 2, 1, -1, 0.0, 1, 0.0 ],\n\t\t[ 1, 1, 0, -2, 1, -1, 0.0, 0, 0.0 ],\n\t\t[ 0, 1, 0, 2, 0, -1, 0.0, 0, 0.0 ],\n\t\t[ 0, 1, 2, -2, 0, -1, 0.0, 0, 0.0 ],\n\t\t[ 0, 1, -2, 2, 0, -1, 0.0, 0, 0.0 ],\n\t\t[ 1, 0, -2, 2, 0, -1, 0.0, 0, 0.0 ],\n\t\t[ 1, 0, -2, -2, 0, -1, 0.0, 0, 0.0 ],\n\t\t[ 1, 0, 2, -2, 0, -1, 0.0, 0, 0.0 ],\n\t\t[ 1, 0, 0, -4, 0, -1, 0.0, 0, 0.0 ],\n\t\t[ 2, 0, 0, -4, 0, -1, 0.0, 0, 0.0 ],\n\t\t[ 0, 0, 2, 4, 2, -1, 0.0, 0, 0.0 ],\n\t\t[ 0, 0, 2, -1, 2, -1, 0.0, 0, 0.0 ],\n\t\t[ -2, 0, 2, 4, 2, -1, 0.0, 1, 0.0 ],\n\t\t[ 2, 0, 2, 2, 2, -1, 0.0, 0, 0.0 ],\n\t\t[ 0, -1, 2, 0, 1, -1, 0.0, 0, 0.0 ],\n\t\t[ 0, 0, -2, 0, 1, -1, 0.0, 0, 0.0 ],\n\t\t[ 0, 0, 4, -2, 2, 1, 0.0, 0, 0.0 ],\n\t\t[ 0, 1, 0, 0, 2, 1, 0.0, 0, 0.0 ],\n\t\t[ 1, 1, 2, -2, 2, 1, 0.0, -1, 0.0 ],\n\t\t[ 3, 0, 2, -2, 2, 1, 0.0, 0, 0.0 ],\n\t\t[ -2, 0, 2, 2, 2, 1, 0.0, -1, 0.0 ],\n\t\t[ -1, 0, 0, 0, 2, 1, 0.0, -1, 0.0 ],\n\t\t[ 0, 0, -2, 2, 1, 1, 0.0, 0, 0.0 ],\n\t\t[ 0, 1, 2, 0, 1, 1, 0.0, 0, 0.0 ],\n\t\t[ -1, 0, 4, 0, 2, 1, 0.0, 0, 0.0 ],\n\t\t[ 2, 1, 0, -2, 0, 1, 0.0, 0, 0.0 ],\n\t\t[ 2, 0, 0, 2, 0, 1, 0.0, 0, 0.0 ],\n\t\t[ 2, 0, 2, -2, 1, 1, 0.0, -1, 0.0 ],\n\t\t[ 2, 0, -2, 0, 1, 1, 0.0, 0, 0.0 ],\n\t\t[ 1, -1, 0, -2, 0, 1, 0.0, 0, 0.0 ],\n\t\t[ -1, 0, 0, 1, 1, 1, 0.0, 0, 0.0 ],\n\t\t[ -1, -1, 0, 2, 1, 1, 0.0, 0, 0.0 ],\n\t\t[ 0, 1, 0, 1, 0, 1, 0.0, 0, 0.0 ]\n\t];\n\n\t// Reading periodic terms\n\tlet fMm, fM, fF, fD, f_omega, dp = 0, de = 0, x;\n\n\tx = 0;\n\twhile (x < nut.length) {\n\t\tfMm = nut[x][0];\n\t\tfM = nut[x][1];\n\t\tfF = nut[x][2];\n\t\tfD = nut[x][3];\n\t\tf_omega = nut[x][4];\n\t\tdp += (nut[x][5] + TE * nut[x][6]) * Utils.sind(fD * D + fM * M + fMm * Mm + fF * F + f_omega * omega);\n\t\tde += (nut[x][7] + TE * nut[x][8]) * Utils.cosd(fD * D + fM * M + fMm * Mm + fF * F + f_omega * omega);\n\t\tx++;\n\t}\n\n\t// Corrections (Herring, 1987)\n\tlet corr = [\n\t\t[ 0, 0, 0, 0, 1,-725, 417, 213, 224 ],\n\t\t[ 0, 1, 0, 0, 0, 523, 61, 208, -24 ],\n\t\t[ 0, 0, 2,-2, 2, 102,-118, -41, -47 ],\n\t\t[ 0, 0, 2, 0, 2, -81, 0, 32, 0 ]\n\t];\n\tx = 0;\n\twhile (x < corr.length) {\n\t\tfMm = corr[x][0];\n\t\tfM = corr[x][1];\n\t\tfF = corr[x][2];\n\t\tfD = corr[x][3];\n\t\tf_omega = corr[x][4];\n\t\tdp += 0.1 * (corr[x][5] * Utils.sind(fD * D + fM * M + fMm * Mm + fF * F + f_omega * omega) + corr[x][6] * Utils.cosd(fD * D + fM * M + fMm * Mm + fF * F + f_omega * omega));\n\t\tde += 0.1 * (corr[x][7] * Utils.cosd(fD * D + fM * M + fMm * Mm + fF * F + f_omega * omega) + corr[x][8] * Utils.sind(fD * D + fM * M + fMm * Mm + fF * F + f_omega * omega));\n\t\tx++;\n\t}\n\n\n\t// calculateNutation in longitude\n\tdeltaPsi = dp / 36000000;\n\n\t// calculateNutation in obliquity\n\tdeltaEps = de / 36000000;\n\n\t// Mean obliquity of the ecliptic\n\teps0 = (84381.448 - 46.815 * TE - 0.00059 * TE2 + 0.001813 * TE3) / 3600;\n\n\t// True obliquity of the ecliptic\n\teps = eps0 + deltaEps;\n}",
"function store (){\n\t\tthis.sensor =senType;\n\t\tthis.unit = thisUnit;\n\t\tthis.reading=maxRead;\n\t\tthis.moteId = idMote;\n\t}",
"function store (){\n\t\tthis.sensor =senType;\n\t\tthis.unit = thisUnit;\n\t\tthis.reading=maxRead;\n\t\tthis.moteId = idMote;\n\t}",
"function store (){\n\t\tthis.sensor =senType;\n\t\tthis.unit = thisUnit;\n\t\tthis.reading=maxRead;\n\t\tthis.moteId = idMote;\n\t}",
"write(whatToWriteOnPaper,writtenOnPaper){cov_14q771vu2z.f[1]++;// Used to figure out what letters I can write\nlet whatICanWrite=(cov_14q771vu2z.s[3]++,this.pointDegradation(whatToWriteOnPaper));// Write the letters of the string you can write with the pencil\ncov_14q771vu2z.s[4]++;if(writtenOnPaper){cov_14q771vu2z.b[0][0]++;cov_14q771vu2z.s[5]++;onPaper=`${writtenOnPaper} ${whatICanWrite}`;}else{cov_14q771vu2z.b[0][1]++;cov_14q771vu2z.s[6]++;onPaper=whatICanWrite;}cov_14q771vu2z.s[7]++;return onPaper;}",
"function runPiano() {\n\t// input the individual note into a json object and uploaded to the\n\t// VF.StaveNote function in order to print the music note notation\n\n\t// json2obj function can convert the three array list, alphabet, repeats, and speed sound\n\t// into a object\n\tfunction json2obj(notes_list, repeat_list, timeout_list){\n\t\tvar i = 1;\n\t\t// verifying wheter there is no duplicate\n\t\tif (i == repeat_list) {\n\t\t\t// appending into a new array\n\t\t\tnotes_parsed.push(notes_list)\n\t\t\tnotes_time.push(timeout_list)\n\t\t\t// generating the syntax string in order to converted into a json\n\t\t\tvar json1 = '{\"keys\": [\"';\n\t\t\tvar json2 = notes_list + '/4\"], \"duration\": \"q\"}';\n\t\t\tvar json3 = json1.concat(json2)\n\t\t\t// parse the json into a object\n\t\t\tconst obj = JSON.parse(json3);\n\t\t\t// create a note using Vexflow\n\t\t\tvar note = new VF.StaveNote(obj);\n\t\t\t// append the final result\n\t\t\tnotes.push(note);\n\t\t\treturn notes;\n\t\t} else {\n\t\t\t\t// generate the duplicate audio\n\t\t\t\twhile( i <= repeat_list)\n\t\t\t\t{\n\t\t\t\t// append the input into a new array\n\t\t\t\tnotes_parsed.push(notes_list)\n\t\t\t\tnotes_time.push(timeout_list)\n\t\t\t\t// generating the syntax string in oreder to converted into a json\n\t\t\t\tvar json1 = '{\"keys\": [\"';\n\t\t\t\tvar json2 = notes_list + '/4\"], \"duration\": \"q\"}';\n\t\t\t\tvar json3 = json1.concat(json2)\n\t\t\t\t// parse the json into a object\n\t\t\t\tconst obj = JSON.parse(json3);\n\t\t\t\t// create a note using Vexflow\n\t\t\t\tvar note = new VF.StaveNote(obj);\n\t\t\t\t\n\t\t\t\t// append the input\n\t\t\t\tnotes.push(note);\n\t\t\t\ti = i + 1;\n\t\t\t\t\n\t\t\t}\n\t\t\t// return the final result\n\t\t\treturn notes;\n\t\t}\n\t\t\n\t}\n\n\t// getUnique function will eliminate any duplicate in the array\n\tfunction getUnique(array) {\n\t\tvar uniqueArray = [];\n\t\t// Loop through array values\n\t\tfor (i = 0; i < array.length; i++) {\n\t\t\t// check wheter there is no duplicate\n\t\t\tif (uniqueArray.indexOf(array[i]) === -1) {\n\t\t\t\t// append into the array\n\t\t\t\tuniqueArray.push(array[i]);\n\t\t\t}\n\t\t}\n\t\t// return the result\n\t\treturn uniqueArray;\n\n\t}\n\t// try and catch used for Error Handling\n\ttry {\n\n\tvar complete_note_list = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\"];\n\t// delete the lines\n\tnotes_raw = $(\"#input_notes\").val().split(/\\r?\\n/);\n\t\n\tlet onlyLetters = /[a-zA-Z]+/g\n\tlet onlyNumeric = /[+-]?(\\d+([.]\\d*)?(e[+-]?\\d+)?|[.]\\d+(e[+-]?\\d+)?)/g\n\tlet onlyFloat = /[+-]?(\\d+([.]\\d*)?(e[+-]?\\d+)?|[.]\\d+(e[+-]?\\d+)?)/g\n\t// generate an array only show the repetition\n\tnotes_repeat = $(\"#input_notes\").val().match(onlyNumeric).map(s => s.slice(0, 1));\n\t// generate an array only show the speed\n\tnotes_timeout = ($(\"#input_notes\").val().match(onlyFloat)).map(s => s.slice(1, 4));\n\t\n\n\t//////////////////////////////\n\t// Error Handling //\n\t/////////////////////////////\n\tvar max_repeat_numb_notes = 9;\n\t// Error try and catch\n\t// It constrains the user to use only one note per line.\n\n\t// This for loop clean the white spaces and appends into new string array\n\t// empty array\n\tnew_notes_raw = [];\n\tnotes_letter = [];\n\t// for loop go through alphabet notes input\n\tfor (m = 0; m < notes_raw.length; m++) {\n\t\t// trim every row that does have any white space\n\t\tnumber_rows = notes_raw[m].trim();\n\t\tif (Boolean(number_rows)) {\n\t\t\t// store the letter into a variable\n\t\t\tletter = number_rows.match(onlyLetters)[0];\n\t\t\t// append the letter,duplicate, and speed\n\t\t\tnew_notes_raw.push(number_rows);\n\t\t\t// append the letter\n\t\t\tnotes_letter.push(letter)\n\t\t}\n\t}\n\t\n\t\n\t// Sorting and Unique the Alphabet Notes\n\tsort_letters = notes_letter.sort();\n\tsort_uniq_letters = getUnique(sort_letters);\n\t\n\n\t// Debuginnin to see what is going on in the code\n\t/*console.log(new_notes_raw);\n\tconsole.log(notes_letter);\n\tconsole.log(sort_uniq_letters);\n\tconsole.log(complete_note_list);\n\tconsole.log(notes_repeat);\n\tconsole.log(notes_timeout);\n\t*/\n\t\n\n\t// Check the number of row per each line \n\t// if there is more than one note will stop the code\n\tfor (m = 0; m < new_notes_raw.length; m++) {\n\t\t// split the space of the input value note\n\t\tnumber_rows = new_notes_raw[m].split(\" \").length;\n\t\t\n\t\t//console.log(number_rows)\n\t\t// if there are two or more inputs in one row\n\t\tif (number_rows > 1) {\n\t\t\t// Give error to the user\n\t\t\tthrow \"Please add one note per line!\";\n\t\t} \n\n\t}\n\t// Use the filter command to determine the difference and it is not in the notes of the alphabet\n\tlet difference = sort_uniq_letters.filter(element => !complete_note_list.includes(element));\n\t//console.log(difference);\n\t// if there more than one in the difference array that means the user has alphabet that does not \n\t// follow the alphabet notes\n\tif (difference.length > 0 ) {\n\t\tthrow \"Please use first seven letters of the alphabet!\"\n\t}\n\t// Use only 1-9 repetitions\n\t// If statement will constraint the user and allow to use only certain number of repetitions\n\tif (max_repeat_numb_notes > 10){\n\t\tthrow \"Please use no more than 9 duplicates!\"\n\t}\n\n\t\n\t\n /////////////////////\n\t// Reference Notes //\n\t/////////////////////\n\n\t// It will print the symbol note notation for the user to help follow the audio\n\n\tVF1 = Vex.Flow;\n\t\n\t// Create an SVG renderer and attach it tot he DIV element named \"reference notes\"\n\tvar div1 = document.getElementById(\"reference_notes\")\n\n\tvar renderer = new VF1.Renderer(div1, VF1.Renderer.Backends.SVG);\n\n\tpx1=500;\n\t// Size SVG\n\trenderer.resize(px1+100, px1/4);\n\t// and get a drawing context\n\tvar context1 = renderer.getContext();\n\t\n\tcontext1.setFont(\"Times\", 10, \"\").setBackgroundFillStyle(\"#eed\");\n\n\tvar stave1 = new VF1.Stave(10, 0, px1);\n\n\tstave1.addClef(\"treble\");\n\t// Connect it to the rendering context and draw!\n\tstave1.setContext(context1).draw();\n\t// Generate your input notes\n\tvar notes_ref = [\n\t\tnew VF1.StaveNote({ keys: [\"a/4\"], duration: \"q\" }),\n\t\tnew VF1.StaveNote({ keys: [\"b/4\"], duration: \"q\" }),\n\t\tnew VF1.StaveNote({ keys: [\"c/4\"], duration: \"q\" }),\n\t\tnew VF1.StaveNote({ keys: [\"d/4\"], duration: \"q\" }),\n\t\tnew VF1.StaveNote({ keys: [\"e/4\"], duration: \"q\" }),\n\t\tnew VF1.StaveNote({ keys: [\"f/4\"], duration: \"q\" }),\n\t\tnew VF1.StaveNote({ keys: [\"g/4\"], duration: \"q\" })\n\t];\t\n\n\t// Create a voice in 4/4 and add above notes\n\tvar voice_ref = new VF1.Voice({ num_beats: 7, beat_value: 4 });\n\tvoice_ref.addTickables(notes_ref);\n\n\t// Format and justify the notes to 400 pixels.\n\tvar formatter1 = new VF1.Formatter().joinVoices([voice_ref]).format([voice_ref], px1);\n\n\t// Render voice\n\tvoice_ref.draw(context1, stave1);\n\t\n\n\t/////////////////////\n\t// Real-Time Notes //\n\t/////////////////////\n\n\tVF = Vex.Flow;\n\n\t// Create an SVG renderer and attach it to the DIV element named \"play piano\".\n\tvar div = document.getElementById(\"play_piano\")\n\tvar renderer = new VF.Renderer(div, VF.Renderer.Backends.SVG);\n\n\t//px = notes_letter.length * 500;\n\tpx=1000;\n\t// Configure the rendering context.\n\n\trenderer.resize(px+100, px/5);\n\tvar context = renderer.getContext();\n\t\n\tcontext.setFont(\"Arial\", 10, \"\").setBackgroundFillStyle(\"#eed\");\n\t// 13 notes = 500 px\n\t// Create a stave of width 400 at position 10, 40 on the canvas.\n\t\n\tvar stave = new VF.Stave(10, 0, px);\n\t\n\t// Add a clef and time signature.\n\t\n\tstave.addClef(\"treble\");\n\t// Connect it to the rendering context and draw!\n\tstave.setContext(context).draw();\n\t\n\t// empty array\n\tvar notes_parsed = []\n\tvar notes_time = []\n\tvar notes=[];\n\t\n\t\n\t// for loop will convert the array into json to object\n\tfor (index = 0; index < notes_raw.length; index++) {\n\t\t\tfor (n = 0; n < notes_raw.length; n++) {\n\t\t\t\tfor (i = 0; i < complete_note_list.length; i++){\n\t\t\t\t\t// compare if the notes are identical\n\t\t\t\t\tif (notes_raw[index][n] == complete_note_list[i]) {\n\t\t\t\t\t\t// call the json to object function\n\t\t\t\t\t\tnotes = json2obj(notes_raw[index][n], notes_repeat[index],notes_timeout[index]);\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t}\n\n\n\t\n\tconsole.log(notes)\n\t\n\t// for loop determine whether the following notes belong to the \n\t// correct audio\n\ttiming = 0\n\t//index_ms_offset = 3000\n\t// Adding a weight to speed or slow down the audio note\n\tweight=30000;\n\tfor (index = 0; index < notes_parsed.length; index++) {\n\t\tif (notes_parsed[index] == 'A') {\n\t\t\t// Time delay\n\t\t\tsetTimeout( function() {\n\t\t\t// Play Audio\t\n\t\t\t\tnew Audio('media/high_a.mp3').play()\n\t\t\t}, weight*notes_time[index] * index)\n\t\t} else if (notes_parsed[index] == 'B' ) {\t\n\t\t\t// Time delay\n\t\t\tsetTimeout(function() {\n\t\t\t// Play Audio\t\n\t\t\t\tnew Audio('media/high_b.mp3').play()\n\t\t\t}, weight*notes_time[index] * index )\n\t\t} else if (notes_parsed[index] == 'C' ) {\n\t\t\t// Time delay\t\t\n\t\t\tsetTimeout(function() {\t\n\t\t\t// Play Audio\t\n\t\t\t\tnew Audio('media/high_c.mp3').play()\n\t\t\t}, weight*notes_time[index] * index )\n\t\t} else if (notes_parsed[index] == 'D' ) {\n\t\t\t// Time delay\t\n\t\t\tsetTimeout(function() {\n\t\t\t// PLay Audio\t\n\t\t\t\tnew Audio('media/high_d.mp3').play()\n\t\t\t}, weight*notes_time[index] * index ) \n\t\t} else if (notes_parsed[index] == 'E' ) {\n\t\t\t\n\t\t\t// Time Audio\n\t\t\tsetTimeout(function() {\n\t\t\t// Play Audio\n\t\t\t\tnew Audio('media/high_e.mp3').play()\n\t\t\t}, weight*notes_time[index] * index )\n\t\t} else if (notes_parsed[index] == 'F') {\n\t\t\t\n\t\t\t// Time Audio\n\t\t\tsetTimeout(function() {\n\t\t\t// Play Audio\n\t\t\t\tnew Audio('media/high_f.mp3').play()\n\t\t\t}, weight*notes_time[index] * index )\n\t\t} else if (notes_parsed[index] == 'G') {\n\t\t\t\n\t\t\t// Time Audio\n\t\t\tsetTimeout(function() {\n\t\t\t// Play Audio\t\n\t\t\t\tnew Audio('media/high_g.mp3').play()\n\t\t\t}, weight*notes_time[index] * index )\n\n\t\t}\n\t}\n\t\n\t//alert(notes_parsed)\n\tconsole.log(notes);\n\n\n\n// Create a voice in 4/4 and add above notes\nvar voice = new VF.Voice({num_beats: notes_parsed.length, beat_value: 4});\nvoice.addTickables(notes);\n\n// Format and justify the notes to 400 pixels.\nvar formatter = new VF.Formatter().joinVoices([voice]).format([voice], px);\n\n// Render voice\nvoice.draw(context, stave);\n\n\n\t// Javascript Buttons -> HTML5\n\tvar clearBtn = document.getElementById('ClearNote');\n\tclearBtn.addEventListener('click', e => {\n\t\t\n\t\tconst staff1 = document.getElementById('reference_notes')\n\t\twhile (staff1.hasChildNodes()) {\n\t\t\tstaff1.removeChild(staff1.lastChild);\n\t\t}\n\n\t\tconst staff2 = document.getElementById('play_piano')\n\t\twhile (staff2.hasChildNodes()) {\n\t\t\tstaff2.removeChild(staff2.lastChild);\n\t\t}\n\n\t})\n\t// Generate the concatenate code for stand-alone html5\n\t\tvar htmlTEMPLATE=\"<!doctype html>\"\n\t\thtmlTEMPLATE=htmlTEMPLATE+\"<html>\\n<head><\\/head>\\n<body>\\n\"\n\t\thtmlTEMPLATE=htmlTEMPLATE+\"<script>@@@PLAY_CODE<\\/script>\"\n\t\thtmlTEMPLATE = htmlTEMPLATE+\"<\\/body>\\n<\\/html>\\n\"\n\n\n\t\t// for loop and if statement\n\t\t// generating the code for each note and audio note\n\t\tcode_output = \"\\n\"\n\t\ttiming = 0\n\t\t//index_ms_offset = 1000\n\t\tweight = 30000;\n\t\tfor (index = 0; index < notes_parsed.length; index++) {\n\t\t\tif (notes_parsed[index] == 'A') {\n\t\t\t\tcode_output = code_output + \"setTimeout( function(){\\n\"\n\t\t\t\tcode_output = code_output + \"new Audio('media/high_a.mp3').play()\"\n\t\t\t\tcode_output = code_output + \"}, \" + weight + \" * \" + notes_time[index] + \" * \" + index + \");\\n \"\n\t\t\t} else if (notes_parsed[index] == 'B') {\n\t\t\t\tcode_output = code_output + \"setTimeout( function(){\\n\"\n\t\t\t\tcode_output = code_output + \"new Audio('media/high_b.mp3').play()\"\n\t\t\t\tcode_output = code_output + \"}, \" + weight + \" * \" + notes_time[index] + \" * \" + index + \");\\n \"\n\t\t\t} else if (notes_parsed[index] == 'C') {\n\t\t\t\tcode_output = code_output + \"setTimeout( function(){\\n\"\n\t\t\t\tcode_output = code_output + \"new Audio('media/high_c.mp3').play()\"\n\t\t\t\tcode_output = code_output + \"}, \" + weight + \" * \" + notes_time[index] + \" * \" + index + \");\\n \"\n\t\t\t} else if (notes_parsed[index] == 'D') {\n\t\t\t\tcode_output = code_output + \"setTimeout( function(){\\n\"\n\t\t\t\tcode_output = code_output + \"new Audio('media/high_d.mp3').play()\"\n\t\t\t\tcode_output = code_output + \"}, \" + weight + \" * \" + notes_time[index] + \" * \" + index + \");\\n \"\n\t\t\t} else if (notes_parsed[index] == 'E') {\n\t\t\t\tcode_output = code_output + \"setTimeout( function(){\\n\"\n\t\t\t\tcode_output = code_output + \"new Audio('media/high_e.mp3').play()\"\n\t\t\t\tcode_output = code_output + \"}, \" + weight + \" * \" + notes_time[index] + \" * \" + index + \");\\n \"\n\t\t\t} else if (notes_parsed[index] == 'F') {\n\t\t\t\tcode_output = code_output + \"setTimeout( function(){\\n\"\n\t\t\t\tcode_output = code_output + \"new Audio('media/high_f.mp3').play()\"\n\t\t\t\tcode_output = code_output + \"}, \" + weight + \" * \" + notes_time[index] + \" * \" + index + \");\\n \"\n\t\t\t} else if (notes_parsed[index] == 'G') {\n\t\t\t\tcode_output = code_output + \"setTimeout( function(){\\n\"\n\t\t\t\tcode_output = code_output + \"new Audio('media/high_g.mp3').play()\"\n\t\t\t\tcode_output = code_output + \"}, \" + weight + \" * \" + notes_time[index] + \" * \" + index + \");\\n \"\n\t\t\t}\n\t\t}\n\n\t// print the code\n\t$(\"#compiled_code\").val(htmlTEMPLATE.replace(\"@@@PLAY_CODE\", code_output))\n\t} catch(err) {\n\t\talert(\"Error: \" + err);\n\t\t\n\t\t\n\t}\n\t\n}",
"parseLevelFromData() {\n //print string for level inspection\n let str = \"\"\n\n //step counter\n let i = 0\n\n //byte position calculated from step counter\n let byteAddress = 0\n\n //init level position field\n this.field = []\n\n //counts the index in the individual field positions\n let fieldIndex = -1\n\n //string used to mark unused/empty fields\n const placeholder = \"___\"\n\n //read whole file\n while (byteAddress < this.data.length) {\n //for print, insert break every line\n if (i % 14 === 0) {\n str += \"\\n\"\n }\n\n //insert another break when the block finishes\n if (i % (14 * 22) === 0) {\n str += \"\\n\"\n\n //also increment piece counter\n fieldIndex++\n }\n\n //chars to put in the field/string print\n const add = this.data[byteAddress] || placeholder\n\n //add padded to\n str += LevelFileReader.padString(add)\n\n //if still in interesting field part\n if (fieldIndex <= 1) {\n //set in field with coordinates\n this.setField(fieldIndex, Math.floor(i / 14) % 22, i % 14, add)\n }\n\n //increment byte position\n i++\n byteAddress = i * 128 + 2\n }\n\n //read level name at end of file\n this.levelName = this.data\n .slice(128 * 14 * 22 * 2 + 2)\n //by parsing into chars from char codes\n .reduce((str, c) => str + String.fromCharCode(parseInt(c, 10)), \"\")\n\n //print fields visually\n console.log(str)\n\n //print combined field\n console.log(\n this.fileName +\n \"\\n\" +\n this.field\n .map(\n //process each line\n l =>\n l\n .map(i => i.map(f => LevelFileReader.padString(f)).join(\"\"))\n .join(\"\")\n )\n .join(\"\\n\")\n )\n\n //build level descriptor from field chars, for each line\n const levelDescriptor = this.field.map(line => {\n //map line, for each item\n line = line\n .map(item => {\n //start off position as water base\n let pos = [\"w\"]\n\n //terrain is in the first position\n const terrain = item[0]\n\n //if terrain is a type of flat land object\n const flatLandObject =\n LevelFileReader.binFormatMaps.terrainTypes[terrain]\n if (flatLandObject) {\n //use whole array if given\n if (Array.isArray(flatLandObject)) {\n pos = flatLandObject.slice(0)\n } else {\n //is land with this object\n pos = [\"l\", flatLandObject]\n }\n } else {\n //is land if byte is certain ranges\n //10 is the green small flower but all others 1-12 are land types\n if (terrain <= 12) {\n pos[0] = \"l\"\n } else if (terrain <= 24) {\n pos[0] = \"g\"\n } else if (terrain !== placeholder) {\n //unknown terrain if out of range but still specified\n pos[0] = \"u\"\n }\n }\n\n //if second item is number\n if (typeof item[1] === \"number\") {\n //map to object abbrev or unknown if not present\n //add all objects, enabled adding of multiple objects in bin format map\n pos = pos.concat(\n LevelFileReader.binFormatMaps.objectTypes[item[1]] || \"uk\"\n )\n }\n\n //return processed position\n return pos\n })\n .reduce((prev, item) => {\n //reduce to simplify\n //if this item is just one piece\n if (item.length === 1) {\n //when last is string\n if (typeof prev[prev.length - 1] === \"string\") {\n //add string to it\n prev[prev.length - 1] += item[0]\n } //if last is array or prev is empty, push only string\n else {\n prev.push(item[0])\n }\n } else {\n //push whole item\n prev.push(item)\n }\n return prev\n }, [])\n\n //if line collapses into one piece, don't use array to contain\n if (line.length === 1) {\n line = line[0]\n }\n\n //return processed line\n return line\n })\n\n //create object for level creation\n this.levelInfo = {\n name: `${this.levelName} (${this.fileName})`,\n noPadding: true,\n field: levelDescriptor,\n dim: Vector(20, 12),\n }\n\n //create level with descriptor, file name as name and standard size\n this.level = Level(this.levelInfo)\n }",
"function toNeumeFromVariations(){\n pushedVariations = false;\n variations = new Array();\n \n document.getElementById(\"input\").innerHTML = neumeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function generate(network, length) {\n\tlet init = getInitialNotes();\n\tnetwork.resetState();\n\tnetwork.calculateState(init);\n\tlet melody = [];\n\tfor (let i=0; i<length; i++) {\n\t\tmelody[i] = network.getOutput().matrix;\n\t\tnetwork.calculateState(new Matrix(melody[i]));\n\t}\n\t\n\tfor (let i=0; i<melody.length; i++) {\n\t\tmelody[i] = melody[i][0];\n\t\t\n\t\t// convert to 0s and 1s\n\t\tmelody[i] = melody[i].map(x => x > 0.12 ? 1 : 0);\n\t\tconsole.log(melody[i]);\n\t}\n\t\n\tsaveObject(melody, \"melody\");\n}",
"determineTypeAlectoV1(data) {\n let datastr = data.join('');\n let type = 'TH';\n if (datastr.slice(9, 11) === '11') {\n type = undefined;\n if (datastr.slice(12, 16) === '1100') {\n type = 'R';\n } else if (datastr.slice(12, 15) === '111' || datastr.slice(12, 24) === '100000000000') {\n type = 'W';\n }\n }\n return type;\n }",
"function setUpreload(world) {\n if (window.File && window.FileReader && window.FileList && window.Blob) {\n var fileSelected = document.getElementById(\"txtfiletoread\");\n fileSelected.addEventListener(\n \"change\",\n function(e) {\n //Get the file object\n var fileTobeRead = fileSelected.files[0];\n //Initialize the FileReader object to read the 2file\n var fileReader = new FileReader();\n fileReader.onload = function(e) {\n var result = fileReader.result.split(/\\s+/);\n if (result.length % 6 != 0 || result.length < 18) {\n console.log(result);\n alert(\"Wrong data format or too few data entries\");\n }\n // re-setup the world\n world.renderer.setAnimationLoop(null);\n removeAllPoints(world);\n\n // add points\n for (var i = 0; i < result.length / 6; i++) {\n var new_point = new ControlPoint(\n parseInt(result[i * 6]),\n parseInt(result[i * 6 + 1]),\n parseInt(result[i * 6 + 2]),\n world\n );\n new_point.setOrient(\n parseInt(result[i * 6 + 3]),\n parseInt(result[i * 6 + 4]),\n parseInt(result[i * 6 + 5])\n );\n world.addObject(new_point.mesh);\n console.log(new_point);\n }\n\n // initial calculations\n drawCurves(params.CurveSegments);\n computeNormals(params.CurveSegments);\n computerTimeIncrements();\n drawRail(params.CurveSegments);\n world.renderer.setAnimationLoop(render);\n };\n fileReader.readAsText(fileTobeRead);\n },\n false\n );\n } else {\n alert(\"Files are not supported\");\n }\n}",
"function auxLetras(promedio) {\n let simbolo;\n\n if (promedio > 0 && promedio <= 15)\n simbolo = 'M';\n else if (promedio >= 16 && promedio <= 31)\n simbolo = 'N';\n else if (promedio >= 32 && promedio <= 47)\n simbolo = 'H';\n else if (promedio >= 48 && promedio <= 63)\n simbolo = '#';\n else if (promedio >= 64 && promedio <= 79)\n simbolo = 'Q';\n else if (promedio >= 80 && promedio <= 95)\n simbolo = 'U';\n else if (promedio >= 96 && promedio <= 111)\n simbolo = 'A';\n else if (promedio >= 112 && promedio <= 127)\n simbolo = 'D';\n else if (promedio >= 128 && promedio <= 143)\n simbolo = '0';\n else if (promedio >= 144 && promedio <= 159)\n simbolo = 'Y';\n else if (promedio >= 160 && promedio <= 175)\n simbolo = '2';\n else if (promedio >= 176 && promedio <= 191)\n simbolo = '$';\n else if (promedio >= 192 && promedio <= 209)\n simbolo = '%';\n else if (promedio >= 210 && promedio <= 225)\n simbolo = '+';\n else if (promedio >= 226 && promedio <= 239)\n simbolo = '.';\n else if (promedio >= 240 && rgbPromedio <= 255)\n simbolo = ' ';\n return simbolo;\n\n}",
"function msg_int(v){\n if(v>=128 && v<=239){ \n counter = 0;\n midichunk = new Array();\n\t}\n if(v>=128 && v<=143) miditype = 7; //notes off <noteID&ch,note#,vel>\n if(v>=144 && v<=159) miditype = 1; //notes <noteID&ch,note#,vel>\n if(v>=160 && v<=175) miditype = 2; //after(poly)touch <polyID&ch,note#,val>\n if(v>=176 && v<=191) miditype = 3; //ctlr <ctlID&ch, cc#, val>\n if(v>=192 && v<=207) miditype = 4; //pgm ch <pgmID&ch,val>\n if(v>=208 && v<=223) miditype = 5; //ch. pressure <chprID&ch, val>\n if(v>=224 && v<=239) miditype = 6; //pitch bend <pbID&ch, msb, lsb>\n\n switch(miditype){\n case 1: //note ON\n midichunk[counter] = v;\n\t\t\tif (counter==2) {\n\t\t\t\tlog(\"noteon:\",midichunk[0],midichunk[1],midichunk[2]);\n\t\t\t\tif (playingNote > 0 && this.patcher.getnamed('forceMono').getvalueof() > 0)\n\t\t\t\t{\t//if its in force mono mode and a note was already playing then kill it\n\t\t\t\t\toutlet(0,midichunk[0]-16); outlet(0,playingNote); outlet(0,64);\n\t\t\t\t\tlog(\"force note off:\",midichunk[0]-16,midichunk[1]);\n\t\t\t\t}\n\t\t\t\tplayingNote = midichunk[1];\n\t\t\t\tif (holdingNote == 0) \n\t\t\t\t{ //if a note isn't already being held\n\t\t\t\t\tif (pedalHeld > 0) \n\t\t\t\t\t{//if the pedal is already down and this is the next note, then hold it\n\t\t\t\t\t\tholdingNote = midichunk[1];\n\t\t\t\t\t\toutlet(0,midichunk[0]); outlet(0,holdingNote ); outlet(0,midichunk[2]);\n\t\t\t\t\t\t//this.patcher.getnamed('holdingText').hidden = false;\n\t\t\t\t\t\tlog(\"holding note:\",midichunk[0],holdingNote);\n\t\t\t\t\t} else {//the pedal isn't down\n\t\t\t\t\t\tif (this.patcher.getnamed('toggleUnheldNotes').getvalueof() == 0 ) \n\t\t\t\t\t\t{ //if its set to play notes inbetween holders then output the note\n\t\t\t\t\t\t\toutlet(0,midichunk[0]); outlet(0,midichunk[1]); outlet(0,midichunk[2]);\n\t\t\t\t\t\t\tlog(\"playing note:\",midichunk[0],midichunk[1],midichunk[2]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlog(\"ignore\");\n\t\t\t\t\t//a note is being held. ignore this note\n\t\t\t\t}\n\t\t\t}\n counter++;\n break;\n \n case 2: //after(poly)touch\n midichunk[counter] = v;\n //if (counter==2) printlet(\"aftertouch\",midichunk[1],midichunk[2]);\n counter++;\n break;\n \n case 3: //cc\n midichunk[counter] = v;\n if (counter==2) {\n //printlet(\"cc\",midichunk[1],midichunk[2]);\n }\n counter++;\n break;\n \n case 4: //pgm changes\n midichunk[counter] = v;\n if (counter==1) {\n\t\t\t\tlog(\"pgm\")\n\t\t\t\tif (0 <= midichunk[1] <= (arrMasterList.length/2 -1)) {\n\t\t\t\t\tfor (var midiByte in midichunk) outlet(0,midiByte);\n\t\t\t\t\t//currentPatch = midichunk[1]; //can cause infinte loop\n\t\t\t\t\t//Refresh();\n\t\t\t\t}\n\t\t\t}\n counter++;\n break;\n \n case 5: //ch. pressure\n midichunk[counter] = v;\n //if (counter==1) printlet(\"ch. pressure\",midichunk[1]);\n counter++;\n break;\n \n case 6://pitch bend\n midichunk[counter] = v;\n //if (counter==2) printlet(\"bend\",midichunk[0]-223,midichunk[1]);\n counter++;\n break;\n \n case 7: //note OFF \n midichunk[counter] = v;\n if (counter==2) {\n\t\t\t\tlog(\"noteoff:\",midichunk[0],midichunk[1],midichunk[2]);\n\t\t\t\tmidichunk[2] = 64; //hack:ableton only responds to nonzero but it receives as 0\n\t\t\t\tif (holdingNote == 0 && this.patcher.getnamed('toggleUnheldNotes').getvalueof() == 0)\n\t\t\t\t{ //if no note is being held then send the note off\n\t\t\t\t\toutlet(0,midichunk[0]); outlet(0,midichunk[1]); outlet(0,midichunk[2]);\n\t\t\t\t\tlog(\"note off:\",midichunk[0],midichunk[1]);\n\t\t\t\t}\n\t\t\t\tif (playingNote == midichunk[1])\n\t\t\t\t{ //if the most recently played note released then mark nothing as recent\n\t\t\t\t\toutlet(0,127+midichunk[0]); outlet(0,midichunk[1]); outlet(0,midichunk[2]);\n\t\t\t\t\tplayingNote = 0;\n\t\t\t\t}\n\t\t\t}\n counter++;\n break;\n }\n}"
] | [
"0.6208604",
"0.6010984",
"0.5994155",
"0.59246314",
"0.52992785",
"0.51781476",
"0.5166663",
"0.50967073",
"0.5086359",
"0.49839997",
"0.49170277",
"0.4833895",
"0.48119894",
"0.48114663",
"0.47898984",
"0.47560632",
"0.47492164",
"0.47482073",
"0.47360724",
"0.47360724",
"0.47360724",
"0.47279993",
"0.472618",
"0.4724686",
"0.47137263",
"0.4701903",
"0.4654095",
"0.46324193",
"0.4627273",
"0.46153218"
] | 0.6293426 | 0 |
Deletes the selected source and adjusts variations. | function deleteSource(id){
var i;
for(i = 0; i < sources.length; i++){
if(sources[i].id == id){
if(sources.length == 1){
document.getElementById("input").innerHTML = sourceDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
return;
}
else if(i != 0){
currentSID = sources[i - 1].id;
currentSource = sources[i - 1];
}
else{
currentSID = sources[i + 1].id;
currentSource = sources[i + 1];
}
sources.splice(i, 1);
}
}
for(i = 0; i < syllables.length; i++){
for(var j = 0; j < syllables[i].neumes.length; j++){
if(Array.isArray(syllables[i].neumes[j])){
for(var k = 0; k < syllables[i].neumes[j].length; k++){
if(syllables[i].neumes[j][k].sourceID == id){
syllables[i].neumes[j].splice(k, 1);
}
}
}
else{
for(var l = 0; l < syllables[i].neumes[j].pitches.length; l++){
if(Array.isArray(syllables[i].neumes[j].pitches[l])){
for(var k = 0; k < syllables[i].neumes[j].pitches[l].length; k++){
if(syllables[i].neumes[j].pitches[l][k].sourceID == id){
syllables[i].neumes[j].pitches[l].splice(k, 1);
}
}
}
}
}
}
}
document.getElementById("input").innerHTML = sourceDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteOpportunitySource(req, res) {\n if (!validator.isValid(req.body.sourceId)) {\n res.json({code: Constant.ERROR_CODE, message: Constant.REQUIRED_FILED_MISSING});\n } else {\n source.findByIdAndUpdate(req.body.sourceId, {deleted: true}, function(err, data) {\n if (err) {\n res.json({code: Constant.ERROR_CODE, message: err});\n } else {\n res.json({code: Constant.SUCCESS_CODE, data: data});\n }\n });\n }\n}",
"function deleteSource(oid)\n{\n $.parse.delete('sources/' + oid, function(json){\n $(\"[oid='\" + oid + \"']\").parent(\".source\").remove();\n });\n}",
"delete () {\n Api.delete(null, ApiUrls.sources, this.id);\n }",
"function del_variant_option(d) {\n\td.parentNode.parentNode.remove();\n}",
"removeSource(source) {\n const sourceIdx = this._sources.findIndex((s) => s === source);\n if (sourceIdx > -1) {\n arrayRemoveAt(this._sources, sourceIdx);\n source.dispose();\n }\n }",
"removeSources(contents) {}",
"function deleteDynamicSource(sourceName, bindingName)\r\n{\r\n var siteURL = dw.getSiteRoot();\r\n \r\n if (siteURL.length)\r\n {\r\n //For localized object name\r\n if (sourceName != \"URL\")\r\n {\r\n sourceName = \"URL\";\r\n }\r\n\r\n dwscripts.deleteListValueFromNote(siteURL, sourceName, bindingName);\r\n }\r\n}",
"del(source = true) {\n return new Promise((resolve, reject) => {\n this.doc.del({ source }, (err) => {\n if (err) {\n reject(err);\n }\n else {\n this.sdb.deleteDoc(this);\n resolve();\n }\n });\n });\n }",
"removeSelected() {\n\n Model.clearSelected(this.currentCartItems);\n }",
"clearVariant() {\n const container = this.container();\n container.removeItem(this.experimentKey);\n }",
"function thumb_select_delete() {\n\tvar $elem = $('.thumb_current');\n\t\n\tremove_watermark();\n\t$('#container').find('.selected').removeClass('selected');\n\t$elem.addClass('selected');\n\t$elem.addClass('delete_watermark');\n\t$('#container').isotope('reLayout', thumb_adjust_container_position);\n }",
"deleteSelectedObjects() {\n var objects = this.selection.getSelectedObjects();\n this.selection.clear();\n objects.forEach(object => {\n object.remove && object.remove();\n });\n }",
"function deleteNeumeInVariant(){\n currentSyllable.neumes[currentNeumeIndex][currentNeumeVariationIndex].additionalNeumes.splice(currentNeumeInVariationIndex, 1);\n \n currentNeumeInVariationIndex = 0;\n \n document.getElementById(\"input\").innerHTML = neumeDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function _destroy() {\n selected = null;\n }",
"clearSelected() {\n this.getSelectedIds().forEach(id => {\n if(this.get(id).created === false) {\n this.get(id).onStopDrawing({});\n }\n this.delete(id);\n });\n }",
"removeSelected(option, options) {\n let index = options.indexOf(option);\n if (index > -1) {\n options = options.splice(index, 1);\n }\n }",
"delete() {\n const source = internal(this).source;\n const model = internal(source).model;\n internal(model).connections.remove(this);\n }",
"function _destroy() {\n\t\t\t\tselected = null;\n\t\t\t}",
"function deleteSelectedDevice() {\n // TODO diagram: delete selected device\n if (selectedDevice){\n $(document).find(\"#\"+selectedDevice.type+selectedDevice.index).remove();\n devicesCounter.alterCount(-1);\n }\n }",
"onRemove(e) {\n e.stopImmediatePropagation();\n const model = this.model;\n\n if (confirm(config.deleteAssetConfirmText)) {\n model.collection.remove(model);\n }\n }",
"function deleteVariationPitch(){\n currentNeume.pitches[currentPitchIndex][currentVarSourceIndex].additionalPitches.splice(currentVarPitchIndex, 1);\n \n currentVarPitchIndex = 0;\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function _destroy() {\n\t\t\tselected = null;\n\t\t}",
"function _destroy() {\n\t\t\tselected = null;\n\t\t}",
"function clean() {\n\t\tvar settings = config.script.clean;\n\n\t\tplugins.del( settings.src ).then( function () {\n\t\t\tplugins.util.log( plugins.util.colors.bgGreen( 'Scripts are now clean....[clean()]' ) );\n\t\t\tconcat();\n\t\t} );\n\t}",
"function deleteSource(id) {\n return new Promise((resolve, reject) => {\n db.run(\n `UPDATE source\n SET deleted_at = datetime('now')\n WHERE id = $id;`,\n {\n $id: id\n },\n err => (err ? reject(err) : resolve())\n );\n });\n}",
"function delClick(e) {\n const index = getItemIndex(\n srcList,\n e.target.parentElement.getAttribute('name'),\n );\n\n if (index < 0) return;\n\n srcList.splice(index, 1);\n chrome.storage.sync.set({ storageSrcKey: srcList }, () =>\n console.log(`${storageSrcKey} value saved. List : ${srcList}`),\n );\n e.target.closest('tr').remove();\n }",
"function deleteSelected() {\n // TODO: first check if any matches are selected\n if (confirm('Are you sure you want to delete all selected matches?')) {\n let containers = $('input[type=\"checkbox\"]:checked').parents('tr');\n let matches = JSON.parse(localStorage.getItem('storedMatches'));\n for (let i of containers) {\n let index = $(i).attr('data-index');\n matches.splice(index, 1);\n $(i).remove();\n }\n localStorage.setItem('storedMatches', JSON.stringify(matches));\n }\n}",
"function _destroy() {\n selected = null;\n}",
"function _destroy() {\n selected = null;\n}",
"function _destroy() {\n selected = null;\n}"
] | [
"0.6051235",
"0.59864193",
"0.5911509",
"0.5821981",
"0.56926495",
"0.55836654",
"0.5563558",
"0.55533856",
"0.55462766",
"0.5451462",
"0.5419775",
"0.53814393",
"0.5349823",
"0.53339475",
"0.5304059",
"0.52924186",
"0.5276334",
"0.5257821",
"0.5257723",
"0.52446765",
"0.52256465",
"0.5225193",
"0.5225193",
"0.5224883",
"0.5222782",
"0.51722777",
"0.5157126",
"0.5154316",
"0.5154316",
"0.5154316"
] | 0.6068513 | 0 |
Navigational, leads to change staff data form, setting the current staff to the first of all staffs. | function toChangeStaffData(){
if(staffs.length > 0){
currentN = staffs[0].n;
}
document.getElementById("input").innerHTML = staffDataChangeForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"SYS_STF_LST_READY(state, p){\n state.staff.list = p.list;\n }",
"function setListStaff(){\n vm.listStaff.$promise.then(function(data) {\n $timeout(function() {\n var arr_tmp = [];\n for(var i = 0; i < data.length; i++) {\n data[i].id = data[i]._id;\n arr_tmp.push(data[i]);\n }\n vm.staffOfCompany = vm.staffOfCompany.concat(arr_tmp);\n vm.newService.staffs = vm.staffOfCompany.concat([]);\n });\n })\n }",
"function updateLangStaff() {\n showOrder(currentTableID);\n showAccountBox();\n}",
"function selecionarEmpleadoStaff(id){\n\tvar url =$('.staff_empleado_url').attr('id');\n\turl = url+'?empleadoStaff='+id;\n\n\t$.post(url, function( data ) {\n\t\tdata.forEach( function(valor, indice, array) {\n\t\t\t$('#staff_empleado').val(valor.empleado_codigo).trigger('change');\n\t\t\t$('#staff_tarea').val(valor.tarea_codigo).trigger('change');\n\t\t\t$('#estado_staff_empleado').val(valor.activo).trigger('change');\n\t\t\t$('#id_staff').val(id);\n\n\n\t\t});\n\t});\n}",
"function applyCurrentStaff(){\n currentN = document.getElementById(\"staff\").value;\n document.getElementById(\"input\").innerHTML = staffDataChangeForm();\n}",
"function showEditForm(currentList, currentUser) {\n console.log(list);\n self.name = currentList.name;\n\n $state.go('updateList', {\n userId: currentUser._id,\n listId: currentList._id,\n currentList: currentList\n });\n }",
"function activate() {\n return StaffService.getAllStaffMembers().then(function (data) {\n vm.staffMembers = data;\n vm.selectedMember = data[0];\n loggerFactory.info('Staff Members: ', data);\n }, function (err) {\n loggerFactory.error('Get Staff Members: ', err);\n });\n }",
"function settIndex()\n {\n\n for (var i=0;i<self.personsObj().length-1;i++)\n { \n if ( self.data()[self.selectedIndex()].person_number==self.personsObj()[i].personNumber)\n {\n self.personIndex(i);\n break;\n \n }\n }\n return;\n }",
"function EditStaff(CargoID)\n{\n\tvar datos={\n\t\t'action': \"StaffsEditStaff\",\n\t\t'id':CargoID, \n\t\t'name':jQuery(\"#nameStaff\").val(), \n\t\t'cargo':jQuery(\"select#cargoStaff option:selected\").val(), \n\t\t'estado':jQuery(\"select#estadoStaff option:selected\").val()\n\t};\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: \"admin-ajax.php\",\n\t\tdata: datos,\n\t\tdataType: 'json',\n\t\tbeforeSend:function(){StaffFormWaiting();},\t\t\n\t\tsuccess: function(data) {\n if(data.request==\"success\")\n {\n \tRefreshStaff(datos,-1);\n }else if(data.request==\"error\")\n {\n \tjQuery(\"#Staff-form-cover\").remove();\n \talert(data.error);\n }else if(data.request==\"nochange\")\n {\n \tjQuery(\"#Staff-cover\").remove();\n }\n\t\t},\n\t\terror: function(XMLHttpRequest, textStatus, errorThrown) {\n\t\t\tif(typeof console === \"undefined\") {\n\t\t\t\tconsole = {\n\t\t\t\t\tlog: function() { },\n\t\t\t\t\tdebug: function() { },\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (XMLHttpRequest.status == 404) {\n\t\t\t\tconsole.log('Element not found.');\n\t\t\t} else {\n\t\t\t\tconsole.log('Error: ' + errorThrown);\n\t\t\t}\n\t\t}\n\t});\n\treturn false;\n}",
"function buildStaffList(staff) {\n cleanContainer();\n $.each(staff, function(index, value) {\n createStaffCard(value);\n });\n $('#loadingMessage').remove();\n $('#directoryContainer').removeClass('hidden');\n }",
"function App() {\n // This useState hook takes in an array of 2, the first value being the state and the second being the function used to change the value of the state, the useState() function sets the state and passes the states initial value.\n let [staffName, setStaffName] = useState('');\n let [staffID, setStaffID] = useState('');\n let [staffType, setStaffType] = useState('');\n let [staffData, setData] = useState('');\n\n // This is a the callback function used to retrieve the staffInfo Array which contains the staff information displayed on the top of every page.\n const getStaffInfo = (data) => {\n setData(data);\n setStaffType(data[0]);\n setStaffID(data[2]);\n setStaffName(data[1]);\n }\n\n return (\n <div className=\"App\">\n <Router>\n <Switch>\n <Route exact path=\"/\">\n <Login getStaffInfo={getStaffInfo}/>\n </Route>\n <Route exact path=\"/viewBlank\">\n <ViewBlank staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/viewBlankSA\">\n <ViewBlankSA staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/createCustomer\">\n <CreateCustomer staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/viewCustomer\">\n <ViewCustomer staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/setFrequency\">\n <SetFrequency staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/mainMenu\">\n <MainMenu staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/latePayment\">\n <LatePayment staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/refund\">\n <Refund staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/sellTicket\">\n <SellTicket staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/rateNavigator\">\n <RateNavigator staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/setCommissionRate\">\n <SetCommissionRate staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/setExchangeRate\">\n <SetExchangeRate staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/viewRefund\">\n <ViewRefund staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/generateReportManager\">\n <GenerateReportManager staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/generateReportStaff\">\n <GenerateReportStaff staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/generateReportType\">\n <GenerateReportType staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/viewStaff\">\n <ViewStaff staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/advisorReport\">\n <AdvisorReport staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/domesticReport\">\n <DomesticReport staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/individualReport\">\n <IndividualReport staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/interlineReport\">\n <InterlineReport staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/stockTurnOverReport\">\n <StockTurnOverReport staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/viewLatePayment\">\n <ViewLatePayment staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/restoreSystem\">\n <RestoreSystem staffType={staffType} staffName={staffName} staffID={staffID}/>\n </Route>\n <Route exact path=\"/404\">\n <h1>PAGE DOES NOT EXIST</h1>\n </Route>\n <Redirect to=\"/\" />\n </Switch>\n </Router>\n </div>\n )\n}",
"function multiselectModalEditStaffList() {\n\tmultiselectModal(\"editStaffList\", $('#FFSEditStaffList_AvailableAndAssignedStaffSVIDs > option').length, 'Select Assigned Staff', $(window).height() - (240));\n}",
"optionClickedStaff(optionsList) {\r\n this.getGroupStaff(optionsList);\r\n}",
"onStaffSelect(event){\n let staffId = { key: \"staffMemberId\", value: event.target.value == '' ? -1 : event.target.value };\n this.onCheckoutEditorChange(staffId);\n }",
"function StaffController(StaffService, loggerFactory, $mdSidenav, $mdToast, $window) {\n var vm = this;\n vm.staffMembers = [];\n vm.appointment = {};\n vm.selectedMember = null;\n vm.isFabOpen = false;\n vm.isSelected = false;\n vm.selectedMemberIndex = 0;\n vm.selectStaffMember = selectStaffMember;\n vm.toggleMemberList = toggleMemberList;\n vm.toggleSelection = toggleSelection;\n vm.openSideMenu = openSideMenu;\n vm.navigateTo = navigateTo;\n vm.desiredDate = new Date();\n vm.currentTime = new Date().getTime();\n\n activate();\n\n /**\n * Initial execution function on page load.\n */\n function activate() {\n return StaffService.getAllStaffMembers().then(function (data) {\n vm.staffMembers = data;\n vm.selectedMember = data[0];\n loggerFactory.info('Staff Members: ', data);\n }, function (err) {\n loggerFactory.error('Get Staff Members: ', err);\n });\n }\n\n /**\n * Select the current staff member.\n * @param memberId\n */\n function selectStaffMember(member, index) {\n vm.isSelected = false;\n vm.selectedMemberIndex = index;\n vm.selectedMember = angular.isDefined(member) ? member : vm.staffMembers[0];\n if (!$mdSidenav('left').isLockedOpen()) {\n $mdSidenav('left').close();\n }\n }\n\n /**\n * Hide or Show the 'left' SideNav when small screen.\n */\n function toggleMemberList() {\n $mdSidenav('left').toggle();\n }\n\n function toggleSelection() {\n vm.isSelected = !vm.isSelected;\n if(vm.isSelected){\n showFavoriteToast();\n }\n }\n\n /**\n * Open the side menu when small screen.\n */\n function openSideMenu($mdMenu, event) {\n $mdMenu.open(event);\n }\n\n /**\n * Open favorite selected tooltip.\n */\n function showFavoriteToast() {\n $mdToast.show({\n hideDelay: 3000,\n position: 'top right',\n controller: 'ToastController',\n controllerAs: 'toast',\n templateUrl: 'fav_toast_template.html',\n bindToController: true\n });\n }\n\n /**\n * Go to requested URL..\n * @param url\n */\n function navigateTo(url){\n $window.open(url, '_blank');\n }\n }",
"function RefreshStaff(info_json,insid)\n{\n\tinfo_json.action=\"RefreshStaff\";\n\tif(insid!=-1)\n\t{\n\t\tinfo_json.id=insid;\n\t}\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: \"admin-ajax.php\",\n\t\tdata: info_json,\n\t\tdataType: 'json',\t\t\n\t\tsuccess: function(data) {\n if(data.request==\"success\")\n {\n \t//if ( typeof info_json.id == \"undefined\")\n \tif(insid!=-1)\n \t{ \t\n\t \tjQuery(\"#staffs-details\").append(\"<div class='staff-detail-line' id='detail-line-\"+data.id+\"'></div>\");\n \t \tjQuery(\"#detail-line-\"+data.id).append(\"<p class='staff-name staff-line'><span>Nombre: </span>\"+info_json.name+\"</p>\");\n \t \tjQuery(\"#detail-line-\"+data.id).append(\"<p class='staff-niv staff-line'><span>Cargo: </span>\"+data.cargo+\"</p>\");\t\n \t \tjQuery(\"#detail-line-\"+data.id).append(\"<p class='staff-est staff-line'><span>Estado: </span>\"+data.estado+\"</p>\");\n \t\tjQuery(\"#detail-line-\"+data.id).append(\"<a class='Staff-edit-icon' title='Editar Staff' rel-id='\"+data.id+\"' rel-name='\"+info_json.name+\"' rel-cargo='\"+info_json.cargo+\"' rel-status='\"+info_json.estado+\"'></a>\");\n \t}else\n \t{\n \t\tjQuery(\"#detail-line-\"+data.id+\" .staff-name\").remove();\n\t \t\tjQuery(\"#detail-line-\"+data.id).append(\"<p class='staff-name staff-line'><span>Nombre: </span>\"+info_json.name+\"</p>\");\n \t \t\tjQuery(\"#detail-line-\"+data.id+\" .staff-niv\").remove();\n \t\t \tjQuery(\"#detail-line-\"+data.id).append(\"<p class='staff-niv staff-line'><span>Cargo: </span>\"+data.cargo+\"</p>\");\n \t \t\tjQuery(\"#detail-line-\"+data.id+\" .staff-est\").remove();\t\n \t \t\tjQuery(\"#detail-line-\"+data.id).append(\"<p class='staff-est staff-line'><span>Estado: </span>\"+data.estado+\"</p>\");\n \t \tjQuery(\"#detail-line-\"+data.id+\" .Staff-edit-icon\").remove();\n\t \t\tjQuery(\"#detail-line-\"+data.id).append(\"<a class='Staff-edit-icon' title='Editar Staff' rel-id='\"+data.id+\"' rel-name='\"+info_json.name+\"' rel-cargo='\"+info_json.cargo+\"' rel-status='\"+info_json.estado+\"'></a>\");\n \t}\n \tjQuery(\"#Staff-cover\").remove();\n \t\tjQuery(\"#staff-empty\").remove();\n }else if(data.request==\"error\")\n {\n \tjQuery(\"#Staff-form-cover\").remove();\n \talert(data.error);\n }else if(data.request==\"nochange\")\n {\n \tjQuery(\"#Staff-form-cover\").remove();\n }\n\t\t},\n\t\terror: function(XMLHttpRequest, textStatus, errorThrown) {\n\t\t\tif(typeof console === \"undefined\") {\n\t\t\t\tconsole = {\n\t\t\t\t\tlog: function() { },\n\t\t\t\t\tdebug: function() { },\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (XMLHttpRequest.status == 404) {\n\t\t\t\tconsole.log('Element not found.');\n\t\t\t} else {\n\t\t\t\tconsole.log('Error: ' + errorThrown);\n\t\t\t}\n\t\t}\n\t});\n}",
"function selectStaffMember(member, index) {\n vm.isSelected = false;\n vm.selectedMemberIndex = index;\n vm.selectedMember = angular.isDefined(member) ? member : vm.staffMembers[0];\n if (!$mdSidenav('left').isLockedOpen()) {\n $mdSidenav('left').close();\n }\n }",
"update(currentState, payload) {\n currentState.userIdentity.staffInfo = null;\n currentState.userIdentity.customerInfo = null;\n currentState.userIdentity.authenticated = false\n }",
"function getStaff(){\n Synergy4Service.getSynergyStaff($scope.totalSynergyKey).then(function(success){\n if(success.data){\n $scope.data = success.data;\n sortEmails2(success.data, success.data.length);\n }\n });\n }",
"function updateContactList() {\r\n\tsupervisorsStore.load( {params: { method: \"loadSupervisors\"} } );\r\n\texpertsStore.load( {params: { method: \"loadExperts\"} } );\r\n\tpeersStore.load( {params: { method: \"loadPeers\"} } );\r\n agentsStore.load( {params: { method: \"loadFavorites\"} } );\r\n}",
"function directUserFromUpdateInfo () {\n if (nextStep == \"The role for an existing employee\") {\n updateEmployeeRole();\n }\n }",
"function buildStaffList(staff) { \n cleanContainer();\n $.each(staff, function(index, value) {\n createStaffCard(value);\n });\n $('#loadingMessage').remove();\n $('#directory').removeClass('hidden'); \n }",
"function setGoToData(){\n\t\t\t//set links array\n\t\t\t$scope.goToData.links.push({type: 'user id', namePath: 'id', sref: 'spa.user.userEdit', paramKey: 'userId', paramPath: 'id'});\n\t\t\tif(hasAccountsPermissions) $scope.goToData.links.push({type: 'account', namePath: 'accountName', sref: 'spa.account.accountEdit', paramKey: 'accountId', paramPath: 'accountId'});\n\t\t\t//$scope.goToData.links.push({type: 'permissions', namePath: 'id', sref: 'spa.user.userPermissions', paramKey: 'userId', paramPath: 'id'});\n\n\t\t\t//due to the fact that HISTORY action was already added by entityLayout.js, needs to reorder the actions and add HISTORY to be last\n\t\t\t//set actions array\n\t\t\t$scope.goToData.actions.splice(0, 0, {name: 'New User', func: addNewUser});\n\t\t\t$scope.goToData.actions.splice(1, 0, {name: 'Delete', func: deleteEntity});\n\t\t}",
"function updateStudent() {\n var student = $scope.selectedStudent;\n if ($scope.includeSiblings === true) {\n updateSiblings(student);\n }\n var updatedStudent = StudentsModel.updateStudent(student);\n updateMarkerPosition(student.id);\n loadStudents();\n $scope.showEdit = false;\n $scope.includeSiblings = false;\n gotoTop();\n }",
"function updateStaff(id){\r\n id = $('#modal_id').val();\r\n name = $('#modal_name').val();\r\n gender = $('#modal_gender').val();\r\n uni = $('#modal_uni').val();\r\n room = $('#modal_room').val();\r\n $.post(\"update.act\",{\r\n id:id,\r\n name:name,\r\n gender:gender,\r\n uni:uni,\r\n room:room,\r\n },function(data){\r\n clearChild();\r\n getList();\r\n swal({ type: \"success\", title: \"Update Successfully!\", timer: 1000, showConfirmButton: false });\r\n });\r\n}",
"function updateStudent(id) {\n let list = students[id - 1];\n console.log(list);\n setName(list.name)\n setRollNo(list.rollno)\n setStudentID(list.id)\n setFlag(false);\n }",
"function setGoToData(){\n\t\t\t$scope.childModel.accountCount = $scope.childModel.siteAccounts ? $scope.childModel.siteAccounts.length : 0;\n\t\t\t//set links array\n\t\t\t$scope.goToData.links.push({type: 'site id', namePath: 'id', sref: 'spa.site.siteEdit', paramKey: 'siteId', paramPath: 'id'});\n\t\t\tif(hasCampaignsPermissions) $scope.goToData.links.push({type: 'campaigns', namePath: 'relationsBag.children.campaigns.count', sref: 'spa.site.campaigns', paramKey: 'siteId', paramPath: 'id'});\n\t\t\tif(hasAccountsPermissions) $scope.goToData.links.push({type: 'accounts', namePath: 'accountCount', sref: 'spa.site.accounts', paramKey: 'siteId', paramPath: 'id'});\n\t\t\t//$scope.goToData.links.push({type: 'site sections', namePath: 'id', sref: 'spa.site.sitesections', paramKey: 'siteId', paramPath: 'id'});\n\n\t\t\t//due to the fact that HISTORY action was already added by entityLayout.js, needs to reorder the actions and add HISTORY to be last\n\t\t\t//set actions array\n\t\t\tvar indx = 0;\n\t\t\tif(hasCreateSitePermission) $scope.goToData.actions.splice(indx++, 0, {name: 'New Site', func: newSite});\n\t\t\t$scope.goToData.actions.splice(indx++, 0, {name: 'New Site Section', func: newSiteSection});\n\t\t\t$scope.goToData.actions.splice(indx, 0, {name: 'Delete', func: deleteEntity});\n\t\t}",
"function directUserFromAddInfo() {\n if (nextStep == \"A new department\") {\n addDepartmenet();\n }\n if (nextStep == \"A new role\") {\n addRole();\n }\n if (nextStep == \"A new employee\") {\n addEmployee();\n } \n }",
"changeActiveMenu(newMenu) {\n this.setState({ activeMenu: newMenu });\n this.changeEmployee(\"0\", \"\");\n this.changeTrip(\"0\");\n this.changePanel(newMenu);\n this.changeActiveSubMenu(\"Last Notifications\");\n }",
"function onCreateNewStaffClick() {\n $('#modal-register-staff').modal('show');\n }"
] | [
"0.6424013",
"0.626715",
"0.5780946",
"0.5619246",
"0.5508845",
"0.5502562",
"0.5488556",
"0.5407104",
"0.53879005",
"0.5325747",
"0.53236014",
"0.5302032",
"0.52616704",
"0.5252225",
"0.5250208",
"0.5208702",
"0.5191996",
"0.51850426",
"0.51532906",
"0.5118942",
"0.51098365",
"0.5101476",
"0.5062526",
"0.5059997",
"0.5055987",
"0.5040717",
"0.503742",
"0.50339216",
"0.49947184",
"0.4989781"
] | 0.6435792 | 0 |
Deletes the selected staff and the syllables using that staff. | function deleteStaff(n){
var i;
for(i = 0; i < staffs.length; i++){
if(staffs[i].n == n){
if(staffs.length == 1){
document.getElementById("input").innerHTML = staffDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
return;
}
else if( i != 0){
currentN = staffs[i-1].n;
currentStaff = staffs[i-1];
}
else{
currentN = staffs[i + 1].n;
currentStaff = staffs[i + 1];
}
staffs.splice(i, 1);
}
}
for(i = 0; i < syllables.length; i++){
if(syllables[i].staff == n){
syllables.splice(i, 1);
i--;
}
}
document.getElementById("input").innerHTML = staffDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteSyllable(){\n syllables.splice(currentSyllableIndex, 1);\n \n currentSyllableIndex = 0;\n \n document.getElementById(\"input\").innerHTML = syllableDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function delSelect(){\n\tvar activeObject = c.getActiveObject();\n if (activeObject['_objects']) {\n activeObject['_objects'].map(x => c.remove(x));\n } else if (activeObject) {\n c.remove(activeObject);\n }\n}",
"deleteSelectedSets() {\n let ic = this.icn3d,\n me = ic.icn3dui\n let nameArray = $('#' + ic.pre + 'atomsCustom').val()\n\n for (let i = 0; i < nameArray.length; ++i) {\n let selectedSet = nameArray[i]\n\n if (\n (ic.defNames2Atoms === undefined || !ic.defNames2Atoms.hasOwnProperty(selectedSet)) &&\n (ic.defNames2Residues === undefined || !ic.defNames2Residues.hasOwnProperty(selectedSet))\n )\n continue\n\n if (ic.defNames2Atoms !== undefined && ic.defNames2Atoms.hasOwnProperty(selectedSet)) {\n delete ic.defNames2Atoms[selectedSet]\n }\n\n if (ic.defNames2Residues !== undefined && ic.defNames2Residues.hasOwnProperty(selectedSet)) {\n delete ic.defNames2Residues[selectedSet]\n }\n } // outer for\n\n ic.hlUpdateCls.updateHlMenus()\n }",
"function deleteMenuDeleteClicked() {\n canvas.removeLabel(canvas.getCurrentLabel());\n oPublic.hideDeleteLabel();\n myActionStack.push('deleteLabel', canvas.getCurrentLabel());\n }",
"function removeD_text(){\r\n d_text.destroy();\r\n}",
"function removeCSIList()\n {\n if (obj_selectedCSI.length > 0 && obj_selectedCSI.selectedIndex >= 0)\n {\n //check context of cs with ac context\n var selCS_name = obj_selectedCS[obj_selectedCS.selectedIndex].text;\n var isContextValid = checkContextCS_AC(selCS_name);\n if (isContextValid == false)\n {\n alert(\"Please make sure that the selected classification scheme's context is within the user's context\");\n return;\n }\n var removeOK = confirm(\"Click OK to continue with removing selected Class Scheme Items.\");\n if (removeOK == false) return;\n //continue removing\n var cscsi_id = obj_selectedCSI[obj_selectedCSI.selectedIndex].value;\n var cs_id;\n if (obj_selectedCS.selectedIndex >= 0)\n cs_id = obj_selectedCS[obj_selectedCS.selectedIndex].value;\n csiIdx = 0;\n var isDeleted = false;\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 && selACCSIArray[idx][0] == cs_id)\n {\n //alert(\"removed \" + selACCSIArray[idx][3]);\n selACCSIArray.splice(idx,1); //(start and number of elements)\n isDeleted = true;\n idx--; //do not increase the index number\n }\n }\n if (isDeleted == true)\n {\n //call the method to fill selCSIArray\n makeSelCSIList();\n addSelectCSI(false, true, ''); //re populate csi list after removing.\n //remove associated DE from the list\n if (obj_selCSIACList != null)\n obj_selCSIACList.length = 0;\n\n //remove selected CS from the list if selectedCSI is null (nothing left)\n if (obj_selectedCSI.length == 0)\n {\n for (var i=0; i<obj_selectedCS.length; i++)\n {\n if (obj_selectedCS.options[i].value == cs_id)\n {\n obj_selectedCS.options[i] = null;\n break;\n }\n }\n }\n }\n }\n else\n alert(\"Please select a Class Scheme Item from the list\");\n }",
"function removeCSList()\n {\n if (obj_selectedCS.length > 0 && obj_selectedCS.selectedIndex >= 0)\n {\n //check context of cs with ac context\n var selCS_name = obj_selectedCS[obj_selectedCS.selectedIndex].text;\n var isContextValid = checkContextCS_AC(selCS_name);\n if (isContextValid == false)\n {\n alert(\"Please make sure that the selected classification scheme's context is within the user's context\");\n return;\n }\n var removeOK = confirm(\"Click OK to continue with removing selected Classification Scheme and its Class Scheme Items.\");\n if (removeOK == false) return;\n //continue removing\n var cs_id = obj_selectedCS[obj_selectedCS.selectedIndex].value;\n //first remove the associated cs from the selectedCSI array and the selection list.\n var isCSDeleted = false;\n for (var idx=0; idx<selACCSIArray.length; idx++)\n { \n //remove the csi for the matching cs \n if (selACCSIArray[idx][0] == cs_id)\n {\n selACCSIArray.splice(idx, 1); //(parameters : start and number of elements to remove)\n isCSDeleted = true;\n idx--; //do not increase the index number\n }\n }\n if (isCSDeleted == true)\n {\n obj_selectedCSI.length = 0;\n //remove associated DE from the list\n if (obj_selCSIACList != null)\n obj_selCSIACList.length = 0;\n\n //call the method to fill selCSIArray\n makeSelCSIList(); \n }\n //removing the cs from the list.\n var tempCSArray = new Array();\n var csIdx = 0;\n //store the all other cs from the selectionList in to the array \n for (var i=0; i<obj_selectedCS.length; i++)\n {\n if (obj_selectedCS[i].value != cs_id)\n {\n tempCSArray[csIdx] = new Array(obj_selectedCS[i].value, obj_selectedCS[i].text)\n csIdx++;\n }\n }\n obj_selectedCS.length =0;\n //re-populate the cs selection list from the array.\n if (tempCSArray.length > 0)\n {\n for (var j=0; j<tempCSArray.length; j++)\n {\n obj_selectedCS[j] = new Option(tempCSArray[j][1], tempCSArray[j][0]);\n }\n }\n } \n else\n alert(\"Please select a Classification Scheme from the list\");\n }",
"function unselectAll() {\n d3.selectAll(\"#synoptic .selection\")\n .remove();\n }",
"removeErrors() {\n if (!isNullOrUndefined(this.errorText) && this.parent.spellChecker.errorWordCollection.containsKey(this.errorText)) {\n let textElement = this.parent.spellChecker.errorWordCollection.get(this.errorText);\n textElement.splice(0, 1);\n if (textElement.length === 0) {\n this.parent.spellChecker.errorWordCollection.remove(this.errorText);\n }\n }\n if (this.parent.spellChecker.errorWordCollection.length === 0) {\n this.owner.dialog.hide();\n }\n }",
"function removeText2(){\r\n t_text_2.destroy();\r\n}",
"function deleteFN() {\n let sel = $('.selected');\n $('#' + sel.attr('line-target')).remove();\n sel.find('.node').each(function() {\n // Remove the linking lines.\n let attr = $(this).attr('line-target');\n if (typeof attr !== typeof undefined && attr !== false) {\n $('#' + attr).remove();\n }\n });\n sel.remove();\n targets = ['body'];\n }",
"function deleteNeume(){\n currentSyllable.neumes.splice(currentNeumeIndex, 1);\n \n currentNeumeIndex = 0;\n \n document.getElementById(\"input\").innerHTML = neumeDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function bindRemoveStaff(){\n\t$('.removeOfficialPassengerButton').off('click');\n\t$('.removeOfficialPassengerButton').on('click',function(){\n\t\tvar context=($(contextSelectedElement).attr('data-selection'));\n\t\tremoveOfficialTravelPassengerStaff(context)\n\t})\n}",
"deleteFantasmas(){\n this.fantasmas.forEach((fantasma) => {\n this.remove(fantasma);\n });\n }",
"deleteCallback() {\n if(this.selectionList[0] !== undefined) {\n while(this.selectionList.length > 0) {\n fs.rm(this.selectionList.pop(), {recursive: true, force: true}, () => {});\n }\n this.refreshDirectory(this.processCWD, this.fatherNode);\n }\n }",
"deleteSelectedObjects() {\n var objects = this.selection.getSelectedObjects();\n this.selection.clear();\n objects.forEach(object => {\n object.remove && object.remove();\n });\n }",
"function removeLabel(e, label){\n for(var i = 0; i < label.length; i++){\n if(label[i].selected === true && label[i].labels.includes(e.target.value) === true){\n label[i].labels.splice(label[i].labels.indexOf(e.target.value),1)\n }\nupdate(passUp)\n}\n}",
"static DeleteSelected(){\n ElmentToDelete.parentElement.remove();\n UI.ShowMessage('Elemento eliminado satisfactoriamente','info');\n }",
"deleteDSP(todelete) {\n if (todelete)\n faust.deleteDSPWorkletInstance(todelete);\n }",
"function _destroy() {\n selected = null;\n }",
"function removeNoteFromFolder(selects) {\n console.log(selects);\n if (selects) {\n selects.forEach(select => {\n var key = select.getAttribute('id');\n \n var folderName = document.querySelector('.folder-section__title h2').innerHTML;\n \n // REMOVE FROM LOCALSTORAGE\n \n var foldersArray = getFoldersArray();\n var folder;\n \n for (let i = 0; i < foldersArray.length; i++) {\n if (foldersArray[i].title == folderName) {\n folder = foldersArray[i];\n break;\n } \n }\n \n for (let i = 0; i < folder.list.length; i++) {\n if (folder.list[i] == key) {\n folder.list.splice(i,1);\n break;\n }\n }\n \n \n if (folder.list.length == 0) {\n msg.style.display = \"\";\n msg.innerHTML = \"You haven't add any note into this folder yet\";\n \n } else {\n msg.style.display = \"none\";\n }\n \n \n localStorage.setItem('foldersArray', JSON.stringify(foldersArray)); \n \n // REMOVE NOTE FROM DOM\n \n select.parentNode.removeChild(select);\n \n \n del.classList.remove('btn-active');\n confirmDelOverLay.classList.remove('show_overlay');\n \n \n });\n }\n\n }",
"function removeAllTextTwoSided() {\r\n svgTwoSided.selectAll(\"#score\").remove();\r\n svgTwoSided.selectAll(\"#ageGroups\").remove();\r\n svgTwoSided.selectAll(\".axisTitle\").remove();\r\n}",
"function _cmdDeleteFormation(msg) {\n let player = getObj('player', msg.playerid);\n if (playerIsGM(msg.playerid)) {\n let argv = msg.content.split(' ');\n if (argv.length < 2)\n throw new Error(\"DELETE_FORMATION_CMD takes 2 parameters: The name \" +\n \"for the formation and a confirmation for whether you want to \" +\n \"delete the formation.\");\n let formationName = argv.slice(1, -1).join(' ');\n\n let isSure = (_.last(argv) === 'yes');\n if (isSure) {\n MarchingOrder.deleteFormation(formationName);\n MarchingOrder.Wizard.showMainMenu(player);\n }\n }\n else\n MarchingOrder.utils.Chat.tattle(player, 'Delete Saved Formation');\n }",
"function deleteSelection() {\n tempSelectedDates.forEach(function (e) {\n dateRangeChart.dispatchAction({\n type: 'downplay',\n dataIndex: e[1],\n seriesIndex: e[2]\n });\n });\n tempSelectedDates = new Set([]);\n //update the selection date list\n var $ul = createSelectionUl(tempSelectedDates);\n $(\"#daysSelectedList\").empty().append($ul);\n }",
"function clearTopicList() {\r\n// alert('entro en clear');\r\n// var select = document.getElementById(\"wlidpersona_turnar\");\r\n while (wlselect.length > 0) {\r\n wlselect.remove(0);\r\n }\r\n}",
"function deleteSelectedDevice() {\n // TODO diagram: delete selected device\n if (selectedDevice){\n $(document).find(\"#\"+selectedDevice.type+selectedDevice.index).remove();\n devicesCounter.alterCount(-1);\n }\n }",
"removeWordLeft() {\n if (this.selection.isEmpty())\n this.selection.selectWordLeft();\n\n this.session.remove(this.getSelectionRange());\n this.clearSelection();\n }",
"function removeLine(count,school){\n\tif($('#toBeDeleted').length > 0){\n\t\t$('#toBeDeleted').val($('#toBeDeleted').val()+$(\"#dept\"+count).val() + \"_\");\n\t\t$('#toBeDeleted').val($('#toBeDeleted').val()+$(\"#courseSelector\"+count).val() + \"/\");\n\t\tconsole.log($('#toBeDeleted').val());\n\t}\n\n\t$(\"#dept\"+count).remove();\n\t$(\"#courseSelector\"+count).remove();\n\t/*if($(\".deptSelector\").length >= 2){\n\t\t$(\"#plus\"+count).remove();\n\t}*/\n\t$(\"#remove\"+count).remove();\n\t$(\"#coursetitle\"+count).remove();\n\t$(\"#break\"+count).remove();\n}",
"function clearSelected() {\n var query = \"#corpus-topics li.selected\";\n if (tenMode) {\n query = \"#corpus-ten-topics li.selected\"\n }\n d3.selectAll(query).each(function(){\n removeTopicFromSelected(this.dataset.topic);\n });\n}",
"remove() {\n\t\tthis.active = false;\n\t\tthis.ctx.remove();\n\t\tthis.parent.removeDot(this.id);\n\t}"
] | [
"0.6465517",
"0.581751",
"0.57589823",
"0.57563466",
"0.55770546",
"0.5530611",
"0.5504792",
"0.5500302",
"0.54334754",
"0.5417416",
"0.54026306",
"0.53906167",
"0.53874385",
"0.5372126",
"0.53588396",
"0.53256476",
"0.5320947",
"0.5294121",
"0.5274152",
"0.5269597",
"0.52666646",
"0.5261613",
"0.52606803",
"0.5255972",
"0.5255469",
"0.5255409",
"0.5249946",
"0.52462226",
"0.5231707",
"0.5231496"
] | 0.68533444 | 0 |
Navigational, leads to syllable change form. | function toChangeSyllableData(){
if(syllables.length > 0){
currentType = syllables[0].type;
currentColor = syllables[0].color;
}
pushedNeumeVariations = false;
document.getElementById("input").innerHTML = syllableDataChangeForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function applyCurrentSyllable(){\n currentSyllableIndex = document.getElementById(\"syllable\").value;\n document.getElementById(\"input\").innerHTML = syllableDataChangeForm();\n}",
"function applySyllableDataChanges(){\n \n var page = document.getElementById(\"page\").value;\n var line = document.getElementById(\"line\").value;\n var staff = document.getElementById(\"staff\").value;\n var syllable = document.getElementById(\"syllabletext\").value;\n var initial = document.getElementById(\"initial\").checked;\n var color = document.getElementById(\"color\").value;\n var comment = document.getElementById(\"comment\").value;\n \n if(page){\n currentSyllable.page = page;\n }\n if(line){\n currentSyllable.line = line;\n }\n \n if(staff){\n currentSyllable.staff = staff;\n }\n \n if(syllable){\n currentSyllable.syllable = syllable;\n }\n \n currentSyllable.initial = initial;\n \n if(color && color != \"none\"){\n currentSyllable.color = color;\n }\n \n if(comment){\n currentSyllable.comment = comment;\n }\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = syllableDataChangeForm();\n createSVGOutput();\n}",
"UpdateAriaLabel() {\n // subclasses should override\n }",
"function L() {\n if (Syllable.DEBUG) Vex.L(\"Vex.Flow.Syllable\", arguments);\n }",
"function toSyllable(){\n if(syllables.length > 1){\n currentColor = syllables[syllables.length-1].color;\n }\n document.getElementById(\"input\").innerHTML = syllableForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n}",
"function translationLabels(){\n /** This help array shows the hints for this experiment */\n\t\t\t\thelpArray=[_(\"help1\"),_(\"help2\"),_(\"help3\"),_(\"help4\"),_(\"help5\"),_(\"help6\"),_(\"help7\"),_(\"Next\"),_(\"Close\"),_(\"help8\"),_(\"help9\")];\n scope.heading=_(\"Emission spectra\");\n\t\t\t\tscope.variables=_(\"Variables\"); \n\t\t\t\tscope.result=_(\"Result\"); \n\t\t\t\tscope.copyright=_(\"copyright\"); \n\t\t\t\tscope.calibrate_txt = _(\"Reset\");\n scope.calibrate_slider_txt = _(\"Calibrate Telescope :\");\n scope.select_lamp_txt = _(\"Select Lamp :\");\n light_on_txt = _(\"Switch On Light\");\n light_off_txt = _(\"Switch Off Light\");\n place_grating_txt = _(\"Place grating\");\n remove_grating_txt = _(\"Remove grating\");\n scope.telescope_angle_txt = _(\"Angle of Telescope :\");\n scope.vernier_table_angle_txt = _(\"Angle of Vernier Table :\");\n scope.fine_angle_txt = _(\"Fine Angle of Telescope :\");\n scope.start_txt = _(\"Start\");\n\t\t\t\tscope.reset_txt = _(\"Reset\");\n scope.lamp_array = [{\n lamp:_(\"Mercury\"),\n index:0\n },{\n lamp:_(\"Hydrogen\"),\n index:1\n },{\n lamp:_(\"Neon\"),\n index:2\n }];\n scope.$apply();\t\t\t\t\n\t\t\t}",
"_updateAriaLabel() {\n var displayable = this.getTopDisplayable();\n if (displayable && !dvt.Agent.deferAriaCreation())\n displayable.setAriaProperty('label', this.getAriaLabel());\n }",
"function translationLabels(){\n /** This help array shows the hints for this experiment */\n helpArray=[_(\"Next\"),_(\"Close\"),_(\"help1\"),_(\"help2\"),_(\"help3\"),_(\"help4\"),_(\"help5\")];\n scope.heading=_(\"Moment of Inertia of Flywheel\");\n scope.variables=_(\"Variables\"); \n scope.result=_(\"Result\"); \n scope.copyright=_(\"copyright\"); \n scope.choose_enviornment = _(\"Choose Environment:\");\n cm = _(\" cm\");\n scope.kg = _(\"kg\");\n scope.cm = cm;\n scope.gm = _(\"gm\");\n scope.earth = _(\"Earth, g=9.8m/s\");\n scope.mass_of_fly_wheel_lbl = _(\"Mass of fly wheel:\");\n scope.dia_of_fly_wheel_lbl = _(\"Diameter of fly wheel:\");\n scope.mass_of_rings_lbl = _(\"Mass of rings:\");\n scope.axle_diameter_lbl = _(\"Diameter of axle:\");\n scope.no_of_wound_lbl = _(\"No. of wound of chord:\");\n scope.mInertia_lbl = _(\"First start experiment..!\");\n scope.mInertia_val = \"\";\n btn_lbls = [_(\"Release fly wheel\"),_(\"Hold fly wheel\")];\n scope.release_hold_txt = btn_lbls[0];\n scope.reset = _(\"Reset\");\n scope.enviornment_array = [{\n enviornment: _('Earth, g=9.8m/s'),\n type: 9.8\n }, {\n enviornment: _('Moon, g=1.63m/s'),\n type: 1.63\n }, {\n enviornment: _('Uranus, g=10.5m/s'),\n type: 10.5\n }, {\n enviornment: _('Saturn, g=11.08m/s'),\n type: 11.08\n }, {\n enviornment: _('Jupiter, g=25.95m/s'),\n type: 25.95\n }];\n scope.$apply(); \n }",
"changeLanguageStrings () {\n\t\tthis.emojiInformationModalMarkup = \tthis.emojiInformationModalMarkup.replace(\"REPLACE_modal_header_text\", this.labels.modal_header_text);\n\t\tthis.emojiInformationModalMarkup = \tthis.emojiInformationModalMarkup.replace(\"REPLACE_btn_ok_text\", this.labels.btn_ok_text);\n\t\tthis.emojiInformationModalMarkup = \tthis.emojiInformationModalMarkup.replace(\"REPLACE_btn_all_text\", this.labels.btn_all_text);\n\n\t\tthis.emojiserverTitlesMarkup = \t\tthis.emojiserverTitlesMarkup.replace(\"REPLACE_modal_titlesicon-label\", this.labels.modal_titlesicon_text);\n\t\tthis.emojiserverTitlesMarkup = \t\tthis.emojiserverTitlesMarkup.replace(\"REPLACE_modal_titlesname_text\", this.labels.modal_titlesname_text);\n\t\tthis.emojiserverTitlesMarkup = \t\tthis.emojiserverTitlesMarkup.replace(\"REPLACE_modal_titlestotal_text\", this.labels.modal_titlestotal_text);\n\t\tthis.emojiserverTitlesMarkup = \t\tthis.emojiserverTitlesMarkup.replace(\"REPLACE_modal_titlesglobal_text\", this.labels.modal_titlesglobal_text);\n\t\tthis.emojiserverTitlesMarkup = \t\tthis.emojiserverTitlesMarkup.replace(\"REPLACE_modal_titleslocal_text\", this.labels.modal_titleslocal_text);\n\t\tthis.emojiserverTitlesMarkup = \t\tthis.emojiserverTitlesMarkup.replace(\"REPLACE_modal_titlescopies_text\", this.labels.modal_titlescopies_text);\n\t}",
"function translationLabels(){\n /** This help array shows the hints for this experiment */\n\t\t\t\thelpArray=[_(\"help1\"),_(\"help2\"),_(\"help3\"),_(\"help4\"),_(\"help5\"),_(\"Next\"),_(\"Close\")];\n scope.heading=_(\"Millikan's Oil Drop Experiment\");\n\t\t\t\tscope.variables=_(\"Variables\"); \n\t\t\t\tscope.result=_(\"Result\"); \n\t\t\t\tscope.copyright=_(\"copyright\");\n buttonTxt = [_(\"Start\"),_(\"Reset\"),_(\"Voltage On\"),_(\"Voltage Off\"), _(\"X Ray On\"), _(\"X Ray Off\")];\n scope.start_txt = buttonTxt[0];\n scope.oil_type_txt = _(\"Choose Oil Type\");\n scope.voltageOnOff_txt = buttonTxt[2];\n scope.adjustVoltage_txt = _(\"Adjust Voltage(KV): \");\n scope.xRay_txt = buttonTxt[4];\n scope.reset_txt = buttonTxt[1];\n scope.voltApplied_txt = _(\"Voltage Applied (v)\");\n\t\t\t\tscope.oilDensity_txt = _(\"Oil Density (kg/m\");\n scope.oil_type = [{\n oil:_(\"Olive Oil\"),\n index:0\n },{\n oil:_(\"Glycerin\"),\n index:1\n }];\n scope.$apply();\t\t\t\t\n\t\t\t}",
"toggleLanguage(){\n\t\tconst langs = this.app.getService(\"locale\"); //dapatkan layanan lokal\n\t\t/*\n\t\tGunakan this.getRoot() untuk membuka widget Webix teratas di dalam JetView\n\t\tIni dia Toolbar\n\t\t*/\n\t\tconst value = this.getRoot().queryView(\"segmented\").getValue(); //dapatkan nilai tersegmentasi\n\t\tlangs.setLang(value); //atur nilai Lokal\n\t}",
"function TI18n() { }",
"function TI18n() { }",
"function setLang() {\n\n // first update text fields based on selected mode\n var selId = $(\"#mode-select\").find(\":selected\").attr(\"id\");\n setText(\"text-timedomain\",\n \"Zeitbereich: \" + lang_de.text[selId],\n \"Time domain: \" + lang_en.text[selId]);\n setText(\"text-headline-left\",\n \"Federpendel: \" + lang_de.text[selId],\n \"Spring Pendulum: \" + lang_en.text[selId]);\n\n // then loop over all ids to replace the text\n for(var id in Spring.langObj.text) {\n $(\"#\"+id).text(Spring.langObj.text[id].toLocaleString());\n }\n // finally, set label of language button\n // $('#button-lang').text(Spring.langObj.otherLang);\n $('#button-lang').button(\"option\", \"label\", Spring.langObj.otherLang);\n }",
"function setLocalizedLabel() {\n var getI18nMsg = chrome.i18n.getMessage;\n\n $('save_button').innerText = 'save'; //getI18nMsg('save');\n// $('delete_button').value = 'delete'; //getI18nMsg('deleteTitle');\n deleteLabel = 'delete';\n $('submit_button').value = 'add'; //getI18nMsg('submitButton');\n}",
"function translationLabels() {\n\t\t\t\t\t/** This help array shows the hints for this experiment */\n\t\t\t\t\thelp_array = [_(\"help1\"), _(\"help2\"), _(\"help3\"), _(\"help4\"),_(\"Next\"), _(\"Close\")];\n\t\t\t\t\tscope.heading = _(\"heading\");\n\t\t\t\t\tscope.Variables = _(\"Variables\");\n\t\t\t\t\tscope.BaseValue=_(\"basevalue\");\n\t\t\t\t\tscope.Doublebond=_(\"Doublebond\");\n\t\t\t\t\tscope.Exocyclicdouble=_(\"Exocyclicdouble\");\n\t\t\t\t\tscope.Polargroups=_(\"Polargroups\");\n\t\t\t\t\tscope.AlkylSubstituent=_(\"AlkylSubstituent\");\n\t\t\t\t\tscope.ringResidue=_(\"ringResidue\");\n\t\t\t\t\tscope.Controls=_(\"Controls\");\n\t\t\t\t\tscope.lamdaMax=_(\"lamdaMax\");\n\t\t\t\t\tscope.Correct=_(\"Correct\");\n\t\t\t\t\tscope.Submit=_(\"Submit\"); \t\t\t\t\n\t\t\t\t\tscope.Aromatic=_(\"Aromatic\"); \t\t\t\t\n\t\t\t\t\tscope.Ketone=_(\"Ketone\"); \t\t\t\t\n\t\t\t\t\tscope.Conjugate=_(\"Conjugate\"); \t\t\t\t\n\t\t\t\t\tscope.AlkylSubstituentKeto=_(\"AlkylSubstituentKeto\"); \t\t\t\t\n\t\t\t\t\tscope.Polargroupsposition=_(\"Polargroupsposition\"); \t\t\t\t\n\t\t\t\t\tscope.Homodienecompound=_(\"Homodienecompound\"); \t\t\t\t\n\t\t\t\t\tscope.Ortho=_(\"Ortho\"); \t\t\t\t\n\t\t\t\t\tscope.Para=_(\"Para\"); \t\t\t\t\n\t\t\t\t\tscope.Meta=_(\"Meta\"); \t\t\t\t\n\t\t\t\t\tscope.lambdamax=_(\"lambdamax\"); \t\t\t\t\n\t\t\t\t\tscope.lambdamax=_(\"lambdamax\"); \t\t\t\t\n\t\t\t\t\tscope.result = _(\"Result\");\n\t\t\t\t\tscope.copyright = _(\"copyright\");\n\t\t\t\t\twoodward_fieser_stage.update();\n\t\t\t\t}",
"function translationLabels(){\n /** This help array shows the hints for this experiment */\n\t\t\t\thelpArray = [_(\"Next\"),_(\"Close\"),_(\"help1\"),_(\"help2\"),_(\"help3\"),_(\"help4\"),_(\"help5\"),_(\"help6\"),_(\"help7\"),_(\"help8\"),_(\"help9\"),_(\"help10\")];\n scope.heading = _(\"Young's Modulus-Uniform Bending\");\n\t\t\t\tscope.variables = _(\"Variables\"); \n\t\t\t\tscope.result = _(\"Result\"); \n\t\t\t\tscope.copyright = _(\"copyright\"); \n\t\t\t\tscope.environment_lbl = _(\"Select Environment\");\n\t\t\t\tscope.material_lbl = _(\"Select Material\");\n\t\t\t\tscope.mass_lbl = _(\"Mass of weight hanger : \");\n\t\t\t\tscope.material_lbl = _(\"Select Material\");\n\t\t\t\tscope.unit_gram = _(\"g\");\n\t\t\t\tscope.unit_cm = _(\"cm\");\n\t\t\t\tscope.breadth_lbl = _(\"Breadth of bar(b) : \");\n scope.thickness_lbl = _(\"Thickness of bar(d) : \");\n scope.blade_distance_lbl = _(\"Knife edge distance : \");\n scope.weight_hangers_distance_lbl = _(\"Weight hangers distance : \");\n scope.reset = _(\"Reset\");\n\t\t\t\tscope.result_txt = _(\"Young's Modulus of \");\n\t\t\t\tscope.environment_array = [{\n environment: _('Earth, g=9.8m/s'),\n value: 9.8\n }, {\n environment: _('Moon, g=1.63m/s'),\n value: 1.63\n }, {\n environment: _('Uranus, g=10.67m/s'),\n value: 10.67\n }, {\n environment: _('Saturn, g=11.08m/s'),\n value: 11.08\n }];\n scope.material_array = [{\n material: _('Wood'),\n value: 1.1\n }, {\n material: _('Aluminium'),\n value: 6.9\n }, {\n material: _('Copper'),\n value: 11.7\n }, {\n material: _('Steel'),\n value: 20\n }];\n\n scope.$apply();\t\t\t\t\n\t\t\t}",
"viewTranslation() {\n switch(this.state.CurrentViewIndex) {\n case 0 :\n return \"By Student\";\n case 1 :\n return \"By Poem\";\n default:\n return \"\";\n }\n }",
"function setHeadLabel(){\n ctrl.headlabel = ctrl.itemTypes[ctrl.editedItem.type][ctrl.editedItem.id?'update':'create'];\n }",
"function changeText() {\n \n }",
"function onchange() {\n\n updateLanguage();\n\n}",
"function onRestoreOriginal() {\n alert(\"The page was reverted to the original language. This message is not part of the widget.\");\n}",
"function toggleButtonTooltipLanguage(){\n\n document.getElementById(\"english-button\").title = $.i18n(\"english_submenu_option_title_id\");\n document.getElementById(\"spanish-button\").title = $.i18n(\"spanish_submenu_option_title_id\");\n document.getElementById(\"clear-map-button\").title = $.i18n(\"clear_map_menu_option_title_id\");\n\n}",
"static get BUTTON_L() {\n return \"tl\";\n }",
"get text(){ return this.__label.text; }",
"function TI18n() {}",
"function TI18n() {}",
"function TI18n() {}",
"function _updateLabelFor(){\n\t\tvar aFields = this.getFields();\n\t\tvar oField = aFields.length > 0 ? aFields[0] : null;\n\n\t\tvar oLabel = this._oLabel;\n\t\tif (oLabel) {\n\t\t\toLabel.setLabelFor(oField); // as Label is internal of FormElement, we can use original labelFor\n\t\t} else {\n\t\t\toLabel = this.getLabel();\n\t\t\tif (oLabel instanceof Control /*might also be a string*/) {\n\t\t\t\toLabel.setAlternativeLabelFor(oField);\n\t\t\t}\n\t\t}\n\t}",
"function applyLanguage() {\n\t\t//nav bar on top\n\t\t$('#menuLinkSitePrefs').html(p.translate('sitePreferences'));\n\t\t$('#menuLinkInfo').html(p.translate('contact'));\n\n\t\t//sidebar left\n\t\t$('#routeLabel').html(p.translate('routePlanner'));\n\t\t$('#searchLabel').html(p.translate('search'));\n\n\t\t//route options\n\t\t$('#routeOptions').html(p.translate('routeOptions') + ':' + '<br/>');\n\t\t$('#fastestLabel').html(p.translate('Fastest'));\n\t\t$('#shortestLabel').html(p.translate('Shortest'));\n\t\t$('#BicycleLabel').html(p.translate('Bicycle'));\n\t\t$('#BicycleSafetyLabel').html(p.translate('BicycleSafety'));\n\t\t$('#BicycleRouteLabel').html(p.translate('BicycleRoute'));\n\t\t$('#BicycleMtbLabel').html(p.translate('BicycleMTB'));\n\t\t$('#BicycleRacerLabel').html(p.translate('BicycleRacer'));\n\t\t$('#PedestrianLabel').html(p.translate('Pedestrian'));\n\t\t$('#avoidMotorLabel').html(p.translate('avoidMotorways'));\n\t\t$('#avoidTollLabel').html(p.translate('avoidTollways'));\n\t\t$('#avoidAreasTitle').html(p.translate('avoidAreas'));\n\n\t\t//routing\n\t\t$('#resetRoute').html(p.translate('resetRoute'));\n\t\t$('.searchWaypoint').attr('placeholder', p.translate('enterAddress'));\n\t\t$('#addWaypoint').html(p.translate('addWaypoint'));\n\t\t$('#routeSummaryHead').html(p.translate('routeSummary') + ':');\n\t\t$('#routeInstructionHead').html(p.translate('routeInstructions') + ':');\n\t\t$('#zoomToRouteButton').html(p.translate('zoomToRoute'));\n\n\t\t//route extras\n\t\t$('#routeExtrasHead').html(p.translate('routeExtras') + ':');\n\t\t//permalink\n\t\t$('#permalinkLabel').html(p.translate('routeLinkText'));\n\t\t$('#fnct_permalink').html(p.translate('permalinkButton'));\n\t\t//accessibility\n\t\t$('#accessibilityAnalysisLabel').html(p.translate('accessibilityAnalysis'));\n\t\t$('#accessibilityAnalysisMinutes').html(p.translate('setAccessibilityMinutes'));\n\t\t$('#analyzeAccessibility').html(p.translate('analyze'));\n\t\t$('#accessibilityCalculation').html(p.translate('calculatingAccessibility'));\n\t\t$('#accessibilityError').html(p.translate('accessibilityError'));\n\t\t//export/ import\n\t\t$('#imExportLabel').html('<b>' + p.translate('imExport') + '</b>');\n\t\t$('#exportInfoLabel').html(p.translate('gpxDownloadText'));\n\t\t$('#exportRouteGpx').html(p.translate('gpxDownloadButton'));\n\t\t$('#exportGpxError').html(p.translate('gpxDownloadError'));\n\t\t$('#importRouteInfoLabel').html(p.translate('gpxUploadRouteText'));\n\t\t$('#importTrackInfoLabel').html(p.translate('gpxUploadTrackText'));\n\t\t$('#importGpxError').html(p.translate('gpxUploadError'));\n\t\t$('.fileUploadNewLabel').html(p.translate('selectFile'));\n\t\t$('.fileUploadExistsLabel').html(p.translate('changeFile'));\n\n\t\t//geolocation\n\t\t$('#geolocationHead').html(p.translate('currentLocation'));\n\t\t$('#fnct_geolocation').html(p.translate('showCurrentLocation'));\n\n\t\t//search address\n\t\t$('#searchAddressHead').html(p.translate('searchForPoints'));\n\t\t$('#fnct_searchAddress').attr('placeholder', p.translate('enterAddress'));\n\n\t\t//search POI\n\t\t$('#searchPoiHead').html(p.translate('searchForPoi'));\n\t\t$('#searchPoiWithin1').html(' ' + p.translate('poiNearRoute1'));\n\t\t$('#searchPoiWithin2').html(p.translate('poiNearRoute2'));\n\t\t$('#fnct_searchPoi').attr('placeholder', p.translate('enterPoi'));\n\n\t\t//preference popup\n\t\t$('#sitePrefs').html(p.translate('sitePreferences'));\n\t\t$('#versionLabel').html(p.translate('version'));\n\t\t$('#versionText').html(p.translate('versionText'));\n\t\t$('#languageLabel').html(p.translate('language'));\n\t\t$('#languageText').html(p.translate('languageText'));\n\t\t$('#routingLanguageLabel').html(p.translate('routingLanguage'));\n\t\t$('#routingLanguageText').html(p.translate('routingLanguageText'));\n\t\t$('#distanceUnitLabel').html(p.translate('distance'));\n\t\t$('#distanceUnitText').html(p.translate('distanceText'));\n\t\t$('#preferencesClose').html(p.translate('closeBtn'));\n\t\t$('#savePrefsBtn').html(p.translate('saveBtn'));\n\n\t\t//context menu\n\t\t$('#contextStart').html(p.translate('useAsStartPoint'));\n\t\t$('#contextVia').html(p.translate('useAsViaPoint'));\n\t\t$('#contextEnd').html(p.translate('useAsEndPoint'));\n\t}"
] | [
"0.67458194",
"0.57106864",
"0.56991607",
"0.5685656",
"0.5662797",
"0.56036144",
"0.55806",
"0.5488491",
"0.547239",
"0.5461994",
"0.542756",
"0.5423051",
"0.5423051",
"0.53920394",
"0.53740466",
"0.5349346",
"0.5333484",
"0.5317176",
"0.53145134",
"0.5292881",
"0.5279999",
"0.52669877",
"0.52551943",
"0.5248769",
"0.52177763",
"0.5207591",
"0.5207591",
"0.5207591",
"0.5182325",
"0.5172033"
] | 0.62301207 | 1 |
Applies changes made to the selected syllable. | function applySyllableDataChanges(){
var page = document.getElementById("page").value;
var line = document.getElementById("line").value;
var staff = document.getElementById("staff").value;
var syllable = document.getElementById("syllabletext").value;
var initial = document.getElementById("initial").checked;
var color = document.getElementById("color").value;
var comment = document.getElementById("comment").value;
if(page){
currentSyllable.page = page;
}
if(line){
currentSyllable.line = line;
}
if(staff){
currentSyllable.staff = staff;
}
if(syllable){
currentSyllable.syllable = syllable;
}
currentSyllable.initial = initial;
if(color && color != "none"){
currentSyllable.color = color;
}
if(comment){
currentSyllable.comment = comment;
}
document.getElementById("meiOutput").value = createMEIOutput();
document.getElementById("input").innerHTML = syllableDataChangeForm();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function applyCurrentSyllable(){\n currentSyllableIndex = document.getElementById(\"syllable\").value;\n document.getElementById(\"input\").innerHTML = syllableDataChangeForm();\n}",
"function toChangeSyllableData(){\n if(syllables.length > 0){\n currentType = syllables[0].type;\n currentColor = syllables[0].color;\n }\n pushedNeumeVariations = false;\n document.getElementById(\"input\").innerHTML = syllableDataChangeForm();\n}",
"function labelUpdate(axis, clickText) {\n // Switch old choice off\n d3.selectAll(\".aText\")\n .filter(\".\" + axis)\n .filter(\".active\")\n .classed(\"active\", false)\n .classed(\"inactive\", true);\n \n // switches new choice on\n clickText.classed(\"inactive\", false).classed(\"active\", true);\n }",
"function toSyllable(){\n if(syllables.length > 1){\n currentColor = syllables[syllables.length-1].color;\n }\n document.getElementById(\"input\").innerHTML = syllableForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n}",
"function deleteSyllable(){\n syllables.splice(currentSyllableIndex, 1);\n \n currentSyllableIndex = 0;\n \n document.getElementById(\"input\").innerHTML = syllableDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function UpdateLabelHandler() {\n /**\n * Set the label and return the changed elements.\n *\n * Element parameter can be label itself or connection (i.e. sequence flow).\n *\n * @param {djs.model.Base} element\n * @param {String} text\n */\n function setText(element, text) {\n // external label if present\n var label = element.label || element;\n var labelTarget = element.labelTarget || element;\n setLabel(label, text, labelTarget !== label);\n return [label, labelTarget];\n }\n\n function execute(ctx) {\n ctx.oldLabel = getLabel(ctx.element);\n return setText(ctx.element, ctx.newLabel);\n }\n\n function revert(ctx) {\n return setText(ctx.element, ctx.oldLabel);\n } // API\n\n\n this.execute = execute;\n this.revert = revert;\n }",
"changeLblTxt(newTxt) {\r\n this.HTMLElement.textContent = newTxt;\r\n }",
"function updateLabel() {\n\t\tlabelVal.text( slider._getLabelValCallback( brush.extent()[0] ) );\n\t\tlabelLabel.attr(\"transform\", \"translate(\" + (+sliderWidth + \n \t\t\t\t\t\t \t +labelVal[0][0].offsetWidth + \n \t\t\t\t\t\t \t +margin.labelSpace) + \n \t \",\" + sliderHeight/2 + \")\");\n\t}",
"function stepSyllable() {\n drums();\n try {\n var s = poem[stanza];\n\n var v = s[verse];\n if (!v) {\n stepStanza();\n return stepSyllable();\n }\n var w = v.w[word];\n if (!w) {\n stepVerse();\n return stepSyllable();\n }\n var sb = w.s[syllable];\n if (!sb) {\n stepWord();\n return stepSyllable();\n }\n\n printSyllable(sb);\n\n var note = chooseNote(sb);\n playNote(note);\n sock.write(deaccent(sb));\n syllable++\n\n } catch (e) {\n stepStanza();\n intro.draw(1);\n }\n}",
"updateLabel() {\n this.text = this._text;\n }",
"updateLabel() {\n this.text = this._text;\n }",
"function toSyllableFromVariations(){\n pushedVariations = false;\n variations = new Array();\n \n if(syllables.length > 1){\n currentColor = syllables[syllables.length-1].color;\n }\n \n document.getElementById(\"input\").innerHTML = syllableForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function toSyllableFromNeumeVariations(){\n pushedNeumeVariations = false;\n neumeVariations = new Array();\n \n isNeumeVariant = false;\n \n if(syllables.length > 1){\n currentColor = syllables[syllables.length-1].color;\n }\n \n document.getElementById(\"input\").innerHTML = syllableForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n}",
"function stylingApply() {\n var index = getSelectedIndex();\n var lView = getLView();\n var tNode = getTNode(index, lView);\n var renderer = getRenderer(tNode, lView);\n var native = getNativeFromLView(index, lView);\n var directiveIndex = getActiveDirectiveStylingIndex();\n applyClasses(renderer, lView, getClassesContext(tNode), native, directiveIndex);\n var sanitizer = getCurrentOrLViewSanitizer(lView);\n applyStyles(renderer, lView, getStylesContext(tNode), native, directiveIndex, sanitizer);\n setCurrentStyleSanitizer(null);\n}",
"updateCursorLabels() {\n const cursorInfo = this.engine.getSession().selection.getCursor();\n this.uiHandler.updateCursorLabels(cursorInfo);\n }",
"function applyChange(para, raw) {\n para.attr('raw', raw);\n updateRefs(para);\n para.removeClass('changed');\n}",
"__applyModelChanges() {\n this.buildLookupTable();\n this._applyDefaultSelection();\n }",
"_updateLabels() {\n this._updateLabel(this._$fixItLabel,\n this._reviewView.hasOpenIssues(),\n 'has-issues');\n this._updateLabel(this._$shipItLabel,\n this.model.get('review').get('shipIt'),\n 'ship-it');\n }",
"function editLabel(label) {\n if(!isNaN(label)) {\n return label;\n } else {\n var newlabel = label\n .replaceAll(\"Inapplicable \\\\(\", \"Inapplicable<br>(\")\n .replaceAll(\"hysician\", \"hys.\")\n .replaceAll(\"Emergency room\", \"ER\");\n return newlabel;\n }\n }",
"function updateStateTexts(dataLabel, axis, newScale, chosenAxis) {\n dataLabel.transition()\n .duration(1000)\n .attr(axis, d => newScale(d[chosenAxis]));\n return dataLabel;\n}",
"function addSyllables(){\n const reducer = (accumulator, currentValue) => accumulator + currentValue;\n return syllableArray.reduce(reducer);\n}",
"selectionChanged(selected) {\n const vizConf = this.visualConfig;\n this.selected = selected;\n if (selected) {\n this.label.tint = vizConf.ui.label.font.highlight;\n this.labelBgContainer.forEach((labelBg) => {\n labelBg.tint = vizConf.ui.label.background.highlight;\n });\n } else {\n this.label.tint = vizConf.ui.label.font.color;\n this.labelBgContainer.forEach((labelBg) => {\n labelBg.tint = vizConf.ui.label.background.color;\n });\n }\n }",
"function labelChange(axis, clickedText) {\n // Switch the currently active to inactive.\n d3\n .selectAll(\".aText\")\n .filter(\".\" + axis)\n .filter(\".active\")\n .classed(\"active\", false)\n .classed(\"inactive\", true);\n\n // Switch the text just clicked to active.\n clickedText.classed(\"inactive\", false).classed(\"active\", true);\n }",
"function monkeyPatchReplace(label, term)\n{\n var new_label = '';\n for (var i = 0; i < label.length; i++)\n {\n var c = label[i];\n if (c.toLowerCase() == term.toLowerCase())\n {\n c = \"<span class='highlight'>\" + c + \"</span>\";\n }\n new_label += c;\n }\n\n return new_label;\n}",
"#updateLabel() {\n this.container.querySelector('.label').innerHTML = this.label;\n }",
"function labelChange(axis, clickedText) {\n // Switch the currently active to inactive.\n d3.selectAll(\".aText\")\n .filter(\".\" + axis)\n .filter(\".active\")\n .classed(\"active\", false)\n .classed(\"inactive\", true);\n\n // Switch the text just clicked to active.\n clickedText.classed(\"inactive\", false).classed(\"active\", true);\n }",
"function reapplyStyle()\n\t{\n//\t\tvar script = \"select all;\" +\n//\t\t _styleScripts[style];\n\t\t// regenerate visual style script\n\t\tvar script = _scriptGen.generateVisualStyleScript(_selection, _chain, _options);\n\n\t\t// regenerate highlight script\n\t\tscript = script.concat(generateHighlightScript(_highlighted));\n\n\t\t// convert array to a single string\n\t\tscript = script.join(\" \");\n\t\t_3dApp.script(script);\n\t}",
"function updateLabel(text){\n\n\tif(labelEl === undefined){\n\n\t\thint = document.createElement(\"li\"); \n hint.setAttribute('id', 'safeSave');\n hint.setAttribute('style', 'padding-left: 0.5em; color: blue; font-decoration: italic; '); //float: right;\n hint.appendChild(document.createTextNode('...'));\n\n\n\t\tseparator = document.createElement('img');\n\t\t\tseparator.setAttribute('src', 'web-pub/component/grid/images/seperator.jpg');\n\t\t\tseparator.setAttribute('class', 'separator');\n\n\t\tsepLi = document.createElement(\"li\"); \n \tsepLi.appendChild(separator);\n\n\n\n \ttoolbar = document.getElementById('toolbar').getElementsByTagName('ul')[0];\n\n\t\ttoolbar.appendChild(sepLi);\n \ttoolbar.appendChild(hint);\t\t\n\t}\n\n\tlabelEl = document.getElementById('safeSave');\n\n\tlabelEl.innerHTML = text;\n\n}",
"function changeState(wordToChange) {\r\n var $wordToChange = $(wordToChange);\r\n if ($wordToChange.attr(\"language\") === \"original\") {\r\n $wordToChange.css('color', 'blue')\r\n .text($wordToChange.attr(\"translation\"))\r\n .attr(\"language\", \"translated\");\r\n } else {\r\n $wordToChange.css('color', 'blue')\r\n .text($wordToChange.attr(\"original\"))\r\n .attr(\"language\", \"original\");\r\n }\r\n}",
"function autoLabel() {\n\n app.beginUndoGroup(\"Auto Label\")\n\n var comp = app.project.activeItem;\n\n if (comp == null || !(comp instanceof CompItem)) {\n alert(\"Please pick a composition\")\n return false\n }\n\n var layers = comp.selectedLayers;\n\n //If no layers selected apply to all layers.\n if (layers.length == 0) {\n for (var i = 1; i <= comp.numLayers; i++) {\n layers.push(comp.layers[i]);\n }\n }\n\n for (var i = 0; i < layers.length; i++) {\n\n var type = layerType(layers[i]);\n if (type === false) return false;\n applyLabel(layers[i], type);\n\n }\n\n function layerType(layer) {\n\n if (layer.source instanceof CompItem) {\n return \"composition\"\n } else if (layer instanceof ShapeLayer) {\n return \"shape\"\n } else if (layer instanceof CameraLayer) {\n return \"camera\"\n } else if (layer instanceof LightLayer) {\n return \"light\"\n } else if (layer instanceof TextLayer) {\n return \"text\"\n } else if (layer.nullLayer == true) {\n return \"nullLayer\"\n } else if (layer.adjustmentLayer == true) {\n return \"adjustment\"\n } else if (layer.source.mainSource instanceof SolidSource) {\n return \"solid\"\n } else if (layer.source instanceof FootageItem && layer.source.mainSource.isStill) {\n if (layer.hasVideo) {\n return \"still\"\n } else return false\n } else if (layer.source instanceof FootageItem) {\n return \"video\"\n }\n\n return false\n\n }\n\n function applyLabel(layer, type) {\n\n var isChild = (layer.parent == null) ? false : true;\n var isParent = false;\n var subType;\n\n for (var j = 1; j <= comp.numLayers; j++) {\n if (comp.layers[j].parent == layer) {\n isParent = true\n break\n }\n }\n\n if (layer.isTrackMatte == true) {\n subType = \"matte\";\n } else if (isParent == true && isChild == true) {\n subType = \"parentChild\";\n } else if (isParent == true) {\n subType = \"parented\";\n } else if (isChild == true) {\n subType = \"child\";\n }\n\n if (subType == undefined) {\n layer.label = parseInt(labels.propertyColour(settings[type].colour));\n return false\n }\n\n var stringIntColour = (typeof settings[type].properties[subType].colour == \"string\")\n ? labels.propertyColour(settings[type].properties[subType].colour) :\n settings[type].properties[subType].colour;\n\n layer.label = parseInt(stringIntColour);\n\n }\n\n app.endUndoGroup()\n }"
] | [
"0.6954043",
"0.63057995",
"0.5626521",
"0.5541029",
"0.54764396",
"0.5379822",
"0.52435076",
"0.5228192",
"0.52049494",
"0.5200517",
"0.5200517",
"0.50805396",
"0.50448585",
"0.5040489",
"0.50388575",
"0.5013113",
"0.5009509",
"0.50055045",
"0.49421582",
"0.49377894",
"0.4891079",
"0.48908207",
"0.4883892",
"0.48811942",
"0.48811474",
"0.48774996",
"0.4873799",
"0.48530394",
"0.48519084",
"0.4835505"
] | 0.65288746 | 1 |
Deletes currently selected syllable. | function deleteSyllable(){
syllables.splice(currentSyllableIndex, 1);
currentSyllableIndex = 0;
document.getElementById("input").innerHTML = syllableDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"deleteLabel() {\n /** @type {number} */\n let rowIdx = this.labels.indexOf(this.label);\n\n if (rowIdx > -1) {\n this.labels.splice(rowIdx, 1);\n }\n }",
"function deleteMenuDeleteClicked() {\n canvas.removeLabel(canvas.getCurrentLabel());\n oPublic.hideDeleteLabel();\n myActionStack.push('deleteLabel', canvas.getCurrentLabel());\n }",
"removeSelection() {\n this.simcirWorkspace.removeSelected();\n }",
"_destroyLabel () {\n this._label && this._label.dispose();\n }",
"function removeD_text(){\r\n d_text.destroy();\r\n}",
"function clearLabel() {\n}",
"function clickedDelete()\n{\n\tvar selectedObj = dw.databasePalette.getSelectedNode();\n\tif (selectedObj && selectedObj.objectType==\"Connection\")\n\t{\n\t\tvar connRec = MMDB.getConnection(selectedObj.name);\n\t\tif (connRec) \n\t\t{\n\t\t\tif( MMDB.deleteConnection(selectedObj.name) )\n\t\t\t{\n\t\t\t if (isDisplayingColdfusionConnections())\n\t\t\t {\n\t\t\t \tdeleteDSN(selectedObj.name);\n\t\t\t }\n\t\t\t clickedRefresh();\n\t\t\t}\n\t\t}\n\t}\n}",
"function deleteName() {\r\n globalNames.splice(index, 1);\r\n render();\r\n }",
"function remove() {\r\n if (!inExtensionPage && !confirm(\"Do you really want to remove this script?\"))\r\n return;\r\n \r\n API_GetTabURL(function(url) {\r\n var domain = url.match(/^[\\w-]+:\\/*\\[?([\\w\\.:-]+)\\]?(?::\\d+)?/)[1];\r\n storage.deleteScript([\"ss\", domain], function() {\r\n chrome.runtime.sendMessage({method:\"UpdateIconForDomain\", data: domain });\r\n });\r\n \r\n \r\n $(\"#jstcb\").removeAttr(\"checked\");\r\n $(\"#jstcb\").button(\"refresh\");\r\n \r\n // Update status to let user know options were saved.\r\n showMessage(\"Options deleted. <br/>Please refresh the page.\");\r\n });\r\n }",
"function deleteNeume(){\n currentSyllable.neumes.splice(currentNeumeIndex, 1);\n \n currentNeumeIndex = 0;\n \n document.getElementById(\"input\").innerHTML = neumeDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function del_variant_option(d) {\n\td.parentNode.parentNode.remove();\n}",
"function labelDeleteIconClick () {\n // Deletes the current label\n if (!status.disableLabelDelete) {\n svl.tracker.push('Click_LabelDelete');\n var currLabel = self.getCurrentLabel();\n if (!currLabel) {\n //\n // Sometimes (especially during ground truth insertion if you force a delete icon to show up all the time),\n // currLabel would not be set properly. In such a case, find a label underneath the delete icon.\n var x = $divHolderLabelDeleteIcon.css('left');\n var y = $divHolderLabelDeleteIcon.css('top');\n x = x.replace(\"px\", \"\");\n y = y.replace(\"px\", \"\");\n x = parseInt(x, 10) + 5;\n y = parseInt(y, 10) + 5;\n var item = isOn(x, y);\n if (item && item.className === \"Point\") {\n var path = item.belongsTo();\n currLabel = path.belongsTo();\n } else if (item && item.className === \"Label\") {\n currLabel = item;\n } else if (item && item.className === \"Path\") {\n currLabel = item.belongsTo();\n }\n }\n\n if (currLabel) {\n svl.labelContainer.removeLabel(currLabel);\n svl.actionStack.push('deleteLabel', self.getCurrentLabel());\n $divHolderLabelDeleteIcon.css('visibility', 'hidden');\n // $divHolderLabelEditIcon.css('visibility', 'hidden');\n\n\n //\n // If showLabelTag is blocked by GoldenInsertion (or by any other object), unlock it as soon as\n // a label is deleted.\n if (lock.showLabelTag) {\n self.unlockShowLabelTag();\n }\n }\n }\n }",
"function _destroy() {\n selected = null;\n}",
"function _destroy() {\n selected = null;\n}",
"function _destroy() {\n selected = null;\n}",
"function removeLabel(e, label){\n for(var i = 0; i < label.length; i++){\n if(label[i].selected === true && label[i].labels.includes(e.target.value) === true){\n label[i].labels.splice(label[i].labels.indexOf(e.target.value),1)\n }\nupdate(passUp)\n}\n}",
"function removeWord() {\n document.getElementById(\"word-display\").innerHTML = \"\";\n }",
"remove() {\n\t\tthis.active = false;\n\t\tthis.ctx.remove();\n\t\tthis.parent.removeDot(this.id);\n\t}",
"function releaseDottedSelection() {\n\t\tdocument.body.removeChild(document.getElementById(this.id));\n\t}",
"function _destroy() {\n selected = null;\n }",
"unselectSelectedLabel() {\n const label = this._.selectedLabel;\n if (label) {\n if (this._.mode === MODES.EDITION) {\n if (this._.selectedLabelTextDirty) {\n this.notifyLabelsChanged();\n this._.selectedLabelTextDirty = false;\n }\n document.getElementById(getLabelFocusId(label.id, this._.componentId)).blur();\n }\n this._.selectedLabel = null;\n this.renderForAWhile();\n this.forceUpdate();\n }\n }",
"function deleteLine(){\n\t\tul.removeChild(li);\n\t\tli.removeChild(btn);\n\t}",
"function unselectAll() {\n d3.selectAll(\"#synoptic .selection\")\n .remove();\n }",
"clearSendedLabel()\n\t{\n\t\tthis.sendedLabel = [];\n\t}",
"delete() {\n this.removeAllConnections()\n \n let parent = this.getParent()\n let diagram = this.getDiagram()\n \n if (parent) {\n parent.removeChild(this)\n } else {\n diagram.removePane(this)\n }\n \n this.redrawAllConnectionsInDiagram()\n }",
"function delSelect(){\n\tvar activeObject = c.getActiveObject();\n if (activeObject['_objects']) {\n activeObject['_objects'].map(x => c.remove(x));\n } else if (activeObject) {\n c.remove(activeObject);\n }\n}",
"function deleteSelectedDevice() {\n // TODO diagram: delete selected device\n if (selectedDevice){\n $(document).find(\"#\"+selectedDevice.type+selectedDevice.index).remove();\n devicesCounter.alterCount(-1);\n }\n }",
"function _destroy() {\n\t\t\t\tselected = null;\n\t\t\t}",
"function _destroy() {\n\t\t\tselected = null;\n\t\t}",
"function _destroy() {\n\t\t\tselected = null;\n\t\t}"
] | [
"0.6352314",
"0.6223733",
"0.59342545",
"0.58443886",
"0.58173317",
"0.571928",
"0.56487775",
"0.5629056",
"0.5611144",
"0.5610573",
"0.55932754",
"0.55804163",
"0.55733085",
"0.55733085",
"0.55733085",
"0.55298275",
"0.5529695",
"0.5520145",
"0.55065244",
"0.5461864",
"0.5452415",
"0.54283375",
"0.54263735",
"0.542153",
"0.53963614",
"0.5395257",
"0.53939015",
"0.5381634",
"0.53815097",
"0.53815097"
] | 0.7606057 | 0 |
Deletes the currently selected pitch. | function deletePitch(){
currentNeume.pitches.splice(currentPitchIndex, 1);
currentPitchIndex = 0;
document.getElementById("input").innerHTML = pitchDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteVariationPitch(){\n currentNeume.pitches[currentPitchIndex][currentVarSourceIndex].additionalPitches.splice(currentVarPitchIndex, 1);\n \n currentVarPitchIndex = 0;\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"noteOff(pitch) {\n this.keys[pitch].noteOff()\n }",
"removePoint() {\n const i = this.pointObjects.indexOf(this.selectedPoint);\n this.splinePoints.splice(i, 1);\n this.deselectPoint();\n this.updateTrajectory();\n }",
"destroy() {\n this.keystrokeCount.remove();\n }",
"function deleteShape() {\n if(instrumentMode == 7){\n instrumentMode=2;\n }\n shp1.splice(selectedShape-1,1);\n rot1.splice(selectedShape-1,1);\n maxNumShapes--;\n //start from skratch\n if(maxNumShapes == 0){\n instrumentMode = 0;\n }\n selectedShape=maxNumShapes;\n }",
"function dotWindow_deleteKey(dotWindow, evt) {\n if (dotWindow.selected != null) {\n dotWindow.points.splice(dotWindow.selected,1);\n dotWindow.selected = null;\n dotWindow.listChanged();\n }\n}",
"function deleteNote() {\n if (oSelectedNote != null) {\n oData.jsFormula.removeNote(oSelectedNote.nuNote);\n oNotesTable.row('.selected').remove().draw( false );\n initNote();\n }\n}",
"function deleteSelectedParticle()\n{\n if (selectedParticle) {\n // Flag the particle for deletion.\n selectedParticle.delete = true;\n\n // Now loop though the particles array and find the index of this particle.\n particleIndex = null;\n\n for (var x = 0; x < particles.length; x ++) {\n if (particles[x].delete) {\n particleIndex = x;\n break;\n }\n }\n\n // Shorten the array (take out the deleted particle and move all others down to fill the gap).\n if (particleIndex !== null) {\n particles.splice(particleIndex, 1);\n }\n }\n}",
"function removePitchSamples(\r\n numSamples)\r\n {\r\n if(numSamples == 0) {\r\n return;\r\n }\r\n move(pitchBuffer, 0, pitchBuffer, numSamples, numPitchSamples - numSamples);\r\n numPitchSamples -= numSamples;\r\n }",
"noteOff() {\n this.keyRect.fill(this.displayOptions.color);\n grid.highlightPitch(this.pitch, false, this.displayOptions);\n audio.noteOff(this.pitch)\n }",
"function deleteSelectedDevice() {\n // TODO diagram: delete selected device\n if (selectedDevice){\n $(document).find(\"#\"+selectedDevice.type+selectedDevice.index).remove();\n devicesCounter.alterCount(-1);\n }\n }",
"function onDeleteClick() {\n setValue( '', onAudioCleared );\n function onAudioCleared() {\n element.page.form.raise( 'valueChanged', element );\n Y.log( 'Cleared audio element value: ' + element.value, 'info', NAME );\n element.isDirty = true;\n window.setTimeout( function() { element.page.redraw(); }, 500 );\n }\n }",
"function deleteNote() {\n const note = notes.value;\n window.localStorage.removeItem(note);\n editor.value = '';\n for (let i = 0; i < notes.length; i++) {\n const option = notes[i];\n if (option.value === note) {\n notes.removeChild(option);\n }\n }\n}",
"function eraseShape() {\r\n\tif (anySelected) {\r\n\t\tshapes.splice(shapes.indexOf(previousSelectedShape), 1);\r\n\t\tpreviousSelectedShape = null;\r\n\t\tdrawShapes();\r\n\t\tanySelected = false;\r\n\t}\r\n}",
"function _destroy() {\n selected = null;\n }",
"remove() {\n player.dispose();\n }",
"removePoint() {\n this.points -= 1;\n this.updateScore();\n }",
"function clearSlide()\n {\n var ok = confirm(\"Delete notes and board on this slide?\");\n if ( ok )\n {\n activeStroke = null;\n closeWhiteboard();\n\n clearCanvas( drawingCanvas[0].context );\n clearCanvas( drawingCanvas[1].context );\n\n mode = 1;\n var slideData = getSlideData();\n slideData.events = [];\n\n mode = 0;\n var slideData = getSlideData();\n slideData.events = [];\n }\n }",
"erasePlayer() {\n ctx.clearRect(this.positionX, this.positionY, this.height, this.width);\n }",
"function _destroy() {\n selected = null;\n}",
"function _destroy() {\n selected = null;\n}",
"function _destroy() {\n selected = null;\n}",
"remove() {\n stopSound(this.throwSound);\n this.isShot = false;\n this.player.hookNumber ++;\n this.size = this.player.totalHeight;\n }",
"function deleteButtonClick(){\n\t\tdisplayNotes();\n\t\tvar h = prompt(\"Wich one you want to delete? Example: 1, 2, 3\");\n\t\tstorage.splice(0,1);\n\t\t\n\t\tdisplayNotes();\t\n\t}",
"removeSpeech() {\n delete this._response.speech;\n }",
"delVertex(){\n if(this.selectedVert != null){\n this.selectedVert.delete();\n\n this.vertices.delete(this.selectedVert);\n\n this.selectedVert = null; //pretty simple using OOP\n }\n }",
"remove() {\n\t\tthis.active = false;\n\t\tthis.ctx.remove();\n\t\tthis.parent.removeDot(this.id);\n\t}",
"removeCharacter() {\n\t\t\tif (this.sndKeyDelete) this.sndKeyDelete.play();\n\t}",
"deleteBackward(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n unit = 'character'\n } = options;\n editor.deleteBackward(unit);\n }",
"deleteBackward(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n unit = 'character'\n } = options;\n editor.deleteBackward(unit);\n }"
] | [
"0.67750955",
"0.577435",
"0.56466293",
"0.56040037",
"0.5565921",
"0.54883426",
"0.5440928",
"0.5363801",
"0.5356186",
"0.5355239",
"0.5349126",
"0.534746",
"0.5335379",
"0.5254939",
"0.5249522",
"0.5247628",
"0.5236143",
"0.52346873",
"0.5182655",
"0.51549447",
"0.51549447",
"0.51549447",
"0.51504934",
"0.51483995",
"0.5128578",
"0.512259",
"0.5114532",
"0.5095759",
"0.5095077",
"0.5095077"
] | 0.7280706 | 0 |
Creates a new variation which can later be tweaked by the user. | function createAdditionalVariation(){
variations = new Array();
for(i = 0; i < sources.length; i++){
var variation = new Variation(sources[i].id);
variations.push(variation);
}
currentNeume.pitches.splice(currentPitchIndex, 0, variations);
document.getElementById("meiOutput").value = createMEIOutput();
document.getElementById("input").innerHTML = pitchDataChangeForm();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Interpreter_AddVariation(theObject, eProp, strValue)\n{\n\t//get this object's variations map\n\tvar objectMap = this.Variations[theObject.DataObject.Id];\n\t//no map?\n\tif (!objectMap)\n\t{\n\t\t//create a new one\n\t\tobjectMap = {};\n\t\t//set it\n\t\tthis.Variations[theObject.DataObject.Id] = objectMap;\n\t}\n\n\t//some variations need to be forced as the user could have manually changed the value\n\tvar bForceVariation = false;\n\t//check the class\n\tswitch (theObject.DataObject.Class)\n\t{\n\t\tcase __NEMESIS_CLASS_EDIT:\n\t\tcase __NEMESIS_CLASS_COMBO_BOX:\n\t\t\t//these are easilly changed by the user, check the property\n\t\t\tswitch (eProp)\n\t\t\t{\n\t\t\t\tcase __NEMESIS_PROPERTY_CAPTION:\n\t\t\t\t\t//force these\n\t\t\t\t\tbForceVariation = true;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t}\n\n\t//get this variation\n\tvar variation = objectMap[eProp];\n\t//first time? or its a new value\n\tif (!variation || variation.Variation != strValue || bForceVariation)\n\t{\n\t\t//create a new variation\n\t\tvariation = { Original: theObject.DataObject.Properties[eProp], Variation: strValue, State: __INTERPRETER_VARIATION_NEW };\n\t\t//set the variation\n\t\tobjectMap[eProp] = variation;\n\t}\n\t//so we have a variation with the same value\n\telse\n\t{\n\t\t//check the state\n\t\tswitch (variation.State)\n\t\t{\n\t\t\tcase __INTERPRETER_VARIATION_DELETE:\n\t\t\t\t//dont delete this one, keep it\n\t\t\t\tvariation.State = __INTERPRETER_VARIATION_KEEP;\n\t\t\t\tbreak;\n\t\t}\n\t}\n}",
"function Interpreter_AddDesignerVariation(uidObject, eProp, strValue)\n{\n\t//have we got a variation map for this already?\n\tif (!this.DesignerVariations[uidObject])\n\t{\n\t\t//create a map for this one\n\t\tthis.DesignerVariations[uidObject] = {};\n\t}\n\t//store the variation\n\tthis.DesignerVariations[uidObject][eProp] = strValue;\n}",
"function createVariation(){\n var sourceID = document.getElementById(\"source\").value;\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"connection\").value;\n var tilt = document.getElementById(\"tilt\").value;\n var graphicalVariation = document.getElementById(\"variation\").value;\n var supplied = document.getElementById(\"supplied\").value;\n \n currentSID = sourceID;\n \n var p = new Pitch(pitch, octave, comment, intm, connection, tilt, graphicalVariation, supplied);\n \n var variationAvailable = false;\n \n var i;\n \n if(variations.length < 1){\n for(i = 0; i < sources.length; i++){\n var variation = new Variation(sources[i].id);\n variations.push(variation);\n }\n }\n \n for(i = 0; i < variations.length; i++){\n if(variations[i].sourceID == sourceID){\n variations[i].additionalPitches.push(p);\n variationAvailable = true;\n break;\n }\n }\n \n if(!pushedVariations){\n currentNeume.pitches.push(variations);\n pushedVariations = true;\n }\n else{\n currentNeume.pitches.pop();\n currentNeume.pitches.push(variations);\n }\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = variationForm();\n createSVGOutput();\n}",
"function toVariant(){\n document.getElementById(\"input\").innerHTML = variationForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n}",
"function displayVariation(varObj) {\r\n}\t// end of displayVariation",
"function createVariableBlock(initialValue) {\n // Make ourselves a clone of the original.\n var originalSetVariable = dom.find('sidebar wb-step[script=\"control.setVariable\"]');\n console.assert(originalSetVariable, 'Could not find setVariable block');\n var variableStep = originalSetVariable.cloneNode(true);\n\n // Set the expression here.\n variableStep\n .querySelector('wb-value[type=\"any\"]')\n .appendChild(initialValue);\n // TODO: autogenerate a good name.\n\n return variableStep;\n}",
"function createNeumeVariation(){\n var sourceID = document.getElementById(\"source\").value;\n var type = document.getElementById(\"type\").value;\n \n if(isClimacus){\n maxPitches = document.getElementById(\"numberofpitches\").value;\n }\n \n currentSID = sourceID;\n \n currentNeume = new Neume();\n currentNeume.type = type;\n \n if(type == \"virga\" || type == \"punctum\"){\n var p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"pes\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"clivis\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"torculus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"porrectus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n else if(currentNeume.type == \"climacus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(maxPitches == 4){\n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n \n if(maxPitches == 5){\n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n }\n }\n else if(currentNeume.type == \"scandicus\"){\n var p;\n \n p = new Pitch();\n p.pitch = \"none\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch();\n p.pitch = \"none\";\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n }\n \n var i;\n \n if(neumeVariations.length < 1){\n for(i = 0; i < sources.length; i++){\n var neumeVariation = new NeumeVariation(sources[i].id);\n neumeVariations.push(neumeVariation);\n }\n }\n \n for(i = 0; i < neumeVariations.length; i++){\n if(neumeVariations[i].sourceID == sourceID){\n neumeVariations[i].additionalNeumes.push(currentNeume);\n break;\n }\n }\n \n if(!pushedNeumeVariations){\n currentSyllable.neumes.push(neumeVariations);\n pushedNeumeVariations = true;\n }\n else{\n currentSyllable.neumes.pop();\n currentSyllable.neumes.push(neumeVariations);\n }\n \n isNeumeVariant = true;\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n createSVGOutput();\n}",
"function createNewProduct(itemName) {\n var product = document.createElement(\"div\");\n product.className = \"product\";\n product.innerHTML = `<span>${itemName}</span>`;\n\n return product;\n}",
"createProductInstance (\n id,\n name = 'product',\n price = '1',\n brand = '',\n category = '',\n quantity = 1\n ) {\n return {\n id, name, price, brand, category, quantity\n };\n }",
"function applyCurrentNeumeVariation(){\n currentNeumeVariationIndex = document.getElementById(\"neumevariation\").value;\n document.getElementById(\"input\").innerHTML = neumeDataChangeForm();\n}",
"function makeProduct(name) {\n\treturn {\n\t\tname: name,\n\t\timage: null,\n\t\tcalories: Math.floor(Math.random() * 50),\n\t\tgluten_free: (Math.random() > 0.5), \n\t\tvegetarian: (Math.random() > 0.5)\n\t};\n}",
"participating() {\n const allocateVariant = () => {\n const randomVariant = this.options.random();\n let cumerlativeWeight = 0;\n\n for(let variant of this.variants) {\n cumerlativeWeight += variant.options.weight;\n if(cumerlativeWeight >= randomVariant) {\n return variant;\n }\n }\n\n return { id: 'no-chosen-variant' };\n };\n\n const allocatedVariant = allocateVariant();\n this.setVariant(allocatedVariant);\n }",
"function createNeumeVariationWithPitches(){\n var sourceID = document.getElementById(\"source\").value;\n var type = document.getElementById(\"type\").value;\n \n if(isClimacus){\n maxPitches = document.getElementById(\"numberofpitches\").value;\n }\n \n currentNeume = new Neume();\n currentNeume.type = type;\n \n var i;\n \n if(neumeVariations.length < 1){\n for(i = 0; i < sources.length; i++){\n var neumeVariation = new NeumeVariation(sources[i].id);\n neumeVariations.push(neumeVariation);\n }\n }\n \n for(i = 0; i < neumeVariations.length; i++){\n if(neumeVariations[i].sourceID == sourceID){\n neumeVariations[i].additionalNeumes.push(currentNeume);\n break;\n }\n }\n \n if(!pushedNeumeVariations){\n currentSyllable.neumes.push(neumeVariations);\n pushedNeumeVariations = true;\n }\n else{\n currentSyllable.neumes.pop();\n currentSyllable.neumes.push(neumeVariations);\n }\n \n isNeumeVariant = true;\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = pitchForm();\n createSVGOutput();\n}",
"function toNeumeFromVariations(){\n pushedVariations = false;\n variations = new Array();\n \n document.getElementById(\"input\").innerHTML = neumeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function createItem() {\n vm.learningPath = datacontext.createLearningItem();\n }",
"get defaultVariation() {\n // We don't have to check invalid itemData because we've filtered them out when initialize.\n return this.catalogItemObj.itemData.variations[0];\n }",
"function createProduct() {\n //... your code goes here\n}",
"setSelectedViewedItemVariation(state, variation) {\n state.selectedViewedItemVariation = variation;\n }",
"get defaultVariationId() {\n return this.defaultVariation.id;\n }",
"function applyCurrentNeumeInVariation(){\n currentNeumeInVariationIndex = document.getElementById(\"neumeinvariation\").value;\n document.getElementById(\"input\").innerHTML = neumeDataChangeForm();\n}",
"function specialty(size, pizza, price) {\n this.size = size;\n this.pizza = pizza;\n this.price = price;\n}",
"function addPlant(elt) {\n \n //class name for all plants and their shapes is \"plant\"\n elt.cls = \"plant\";\n \n //if the id of elt (pId) is 0 then this is a new plant, as opposed to \n //one loaded from localStorage; this new plant's pId needs to be set \n //to either a 1 for a very first plant (when there is nothing in \n //localStorage.aas_myGardenVs_plnts) or the highest number in \n //localStorage.aas_myGardenVs_plnts plus one\n if (!elt.pId || elt.pId===0){ \n if (!localStorage.aas_myGardenVs_plnts){\n elt.pId = 1;\n //record new plant id in the local storage plnts counter\n localStorage.setItem(\"aas_myGardenVs_plnts\",\"1\");\n } else {\n //pull all IDs into an array\n let IDs = localStorage.aas_myGardenVs_plnts.split(\",\");\n //take the last (highest) ID and add one to it\n elt.pId = Number(IDs[IDs.length-1])+1;\n //record new plant id in the local storage plnts counter\n localStorage.aas_myGardenVs_plnts += \",\"+elt.pId.toString();\n }\n \n //when a new plant is created, make sure it's not placed outside of screen boundaries\n if (elt.x < 0) elt.x = 1;\n if (elt.x > Number(svgPlace.getAttribute(\"width\"))) {\n elt.x = Number(svgPlace.getAttribute(\"width\")) - munit;} \n if (elt.y > Number(svgPlace.getAttribute(\"height\"))) {\n elt.y = Number(svgPlace.getAttribute(\"height\")) - munit*1.5;}\n \n //record the new plant data in the local storage; round x,y,w,h to 2 decimals\n localStorage.setItem(\n `aas_myGardenVs_plnt${elt.pId}`,\n `${elt.x.toFixed(1)},${elt.y.toFixed(1)},${elt.w.toFixed(1)},${elt.h.toFixed(1)},${elt.nm},${elt.gId},${elt.lnm},${elt.shp},${elt.clr},${elt.blm}`);\n }\n\n //the group below (grp) keeps all elements of one plant together\n const grp = document.createElementNS(xmlns, \"g\");\n\n //if the garden id is 0, the plant is free-standing, not a part of a garden\n //note: when data is added to localStorage, null or 0 value is converted to string\n if (!elt.gId || elt.gId === \"0\") {\n grp.setAttribute(\"transform\", \"translate(0,0)\");\n svgPlace.appendChild(grp);\n }\n //otherwise, if garden id is not 0, put the plant in its garden (capture the translate of the garden for the plants added to the garden; the stored value combines x,y with tx,ty)\n else {\n let inGarden = svgPlace.getElementById(elt.gId);\n grp.setAttribute(\n \"transform\",\n \"translate (\" + \n inGarden.transform.baseVal.getItem(\"translate\").matrix.e * -1 + \" \" +\n inGarden.transform.baseVal.getItem(\"translate\").matrix.f * -1 + \")\");\n inGarden?inGarden.appendChild(grp):svgPlace.appendChild(grp);\n }\n \n //the id attribute of the plant SVG element is prefixed with a \"p_\" to differentiate from garden id, where it's prefixed with a \"g_\"\n grp.setAttribute(\"id\", \"p_\" + elt.pId);\n grp.setAttribute(\"class\", \"plantGrp\");\n \n //create a text element with plant's common name\n elt.cls += \" plantName\";\n elt.txt = elt.nm.length > 12 ? elt.nm.slice(0,12) + \"...\" : elt.nm;\n elt.ttl = elt.nm.length > 12 && elt.nm; //shorter ternary, for if only\n// elt.fntSz = elt.nm.length > 15 && \"smaller\";\n grp.appendChild(mkText(elt));\n \n// const plantNameWidth = parseInt(window.getComputedStyle(grp.children[0]).width);\n \n function sizeRanger(sz) {\n let szGrp = 8;\n if (sz > 6) szGrp = 16;\n if (sz > 24) szGrp = 32;\n if (sz > 72) szGrp = 48;\n return szGrp;\n }\n \n //draw the plant's shape: bush, tree, etc.; color the plant if it's blooming this month\n if (elt.shp) {\n drawPlantShape(grp, {\n// x:elt.x - sizeRanger(elt.w),\n x:elt.x + parseInt(window.getComputedStyle(grp.children[0]).width) / 3 - sizeRanger(elt.w) / 2,\n y:elt.y - sizeRanger(elt.h) - munit,\n w:sizeRanger(elt.w),\n h:sizeRanger(elt.h),\n cls:\"plant\",\n shp:elt.shp,\n clr:elt.clr ? elt.clr : \"green\", //color (clr) includes i_ for inconspicuous flowers; if no color is specified, go with green\n blm:elt.blm\n });\n }\n \n //return the group with the plant\n return grp;\n \n}",
"function create() {\n\n}",
"function createNewProductQuantity() {\n var newItemProductQuantityDiv = document.createElement(\"div\");\n var newItemProductQuantitySpan = document.createElement(\"span\");\n var newItemProductQuantityInput = document.createElement(\"input\");\n \n newItemProductQuantitySpan.setAttribute(\"class\",\"quantity-label quantity\");\n newItemProductQuantitySpan.innerHTML=\"QTY\";\n newItemProductQuantityDiv.appendChild(newItemProductQuantitySpan);\n newItemProductQuantityInput.setAttribute(\"class\",\"quantity-input\");\n newItemProductQuantityInput.setAttribute(\"type\",\"text\");\n newItemProductQuantityDiv.appendChild(newItemProductQuantityInput);\n return newItemProductQuantityDiv;\n }",
"function createRandomProduct () {\n var typeArray = ['Electronics', 'Book', 'Clothing', 'Food']\n var price = (Math.random() * 500).toFixed(2)\n var type = typeArray[Math.floor(Math.random() * 4)]\n\n return {price: price, type: type}\n }",
"function createSpecimen() {\n if (_.isUndefined(vm.selectedSpecimenSpec)) {\n throw new Error('specimen type not selected');\n }\n\n return new Specimen(\n {\n inventoryId: vm.inventoryId,\n originLocationId: vm.selectedLocationId,\n locationId: vm.selectedLocationId,\n timeCreated: timeService.dateToUtcString(vm.timeCollected),\n amount: vm.amount\n },\n vm.selectedSpecimenSpec);\n }",
"function _generateNewParticle() {\n\t\t\treturn new Particle({\n\t\t\t\tx: stage.width * Math.random(),\n\t\t\t\ty: stage.height * Math.random(),\n\t\t\t\tspeed: getRandomWithinRange(options.particle.velocityRange) / stage.pixelRatio,\n\t\t\t\tradius: getRandomWithinRange(options.particle.sizeRange),\n\t\t\t\ttheta: Math.round(Math.random() * 360),\n\t\t\t\tinfluence: options.particle.influence * stage.pixelRatio,\n\t\t\t\tcolor: options.particle.color\n\t\t\t});\n\t\t\t// random number generator within a given range object defined by a max and min property\n\t\t\tfunction getRandomWithinRange(range) {\n\t\t\t\treturn ((range.max - range.min) * Math.random() + range.min) * stage.pixelRatio;\n\t\t\t}\n\t\t}",
"function createPlanet() {\n //This randomizes a single planet. Maybe one could give parameters\n //to instruct what kind of planet it will be. parameters could be\n //in key=>value array.\n }",
"function createVariation(variation){\n const durSecInterval = setInterval(function(){\n outputDurSec++;\n },1000);\n\n const headerMargin = windowW - d3.select('#header').node().clientWidth;\n d3.select('#header')\n .style('margin-left', '-'+(headerMargin/2)+'px')\n .style('margin-right', '-'+(headerMargin/2)+'px');\n\n const w = d3.select('#content-empathy').node().clientWidth;\n\n if(variation == 'narrative description'){\n createDescription();\n }\n\n d3.json(session).then(function(data){\n // console.log(data);\n\n /* VARIABLES */\n const mlScore = data.scores.globals.empathy;\n const percentOpenQuestions = data.scores.behaviorCounts.percentOpenQuestions.percentOpenQuestions;\n const closedQuestions = data.scores.behaviorCounts.percentOpenQuestions.closedQuestions;\n const openQuestions = data.scores.behaviorCounts.percentOpenQuestions.openQuestions;\n const percentComplexReflections = data.scores.behaviorCounts.percentComplexReflections.percentComplexReflections;\n const complexReflections = data.scores.behaviorCounts.percentComplexReflections.complexReflections;\n const simpleReflections = data.scores.behaviorCounts.percentComplexReflections.simpleReflections;\n\n const openArr = [];\n const closeArr = [];\n const complexArr = [];\n const simpleArr = [];\n\n data.session.talkTurn.forEach(function(d){\n d.influence = (Number(Math.random().toFixed(3))*2) - 1; // randomize influence scores per talk turn - placeholder for real output\n if(d.codes[0]=='QUO'){\n openArr.push({\n id: d.id,\n })\n }\n if(d.codes[0]=='QUC'){\n closeArr.push({\n id: d.id,\n })\n }\n if(d.codes[0]=='REC'){\n complexArr.push({\n id: d.id,\n })\n }\n if(d.codes[0]=='RES'){\n simpleArr.push({\n id: d.id,\n })\n }\n });\n\n /************* EMPATHY BARS *************/\n\n const svgEmpathy = d3.select('#content-empathy')\n .append('svg');\n\n svgEmpathy\n .attr('class','bars-empathy')\n .attr('id','svg-empathy')\n .attr('width',w)\n .attr('height',h);\n\n const mlScoreG = svgEmpathy\n .append('g')\n .attr('id','mlScoreG')\n .attr('transform','translate(0,160)');\n\n const userScoreG = svgEmpathy\n .append('g')\n .attr('id','userScoreG')\n .attr('transform','translate(0,40)');\n\n const userScoreT = userScoreG.append('text')\n .attr('class','textScore userScore')\n .attr('id','textScore-user')\n .attr('x','0px');\n userScoreT.append('tspan')\n .text('You rated the session ');\n userScoreT.append('tspan')\n .attr('id','userNum')\n .text(userScore)\n .style('font-weight','bold');\n\n userScoreG.append('rect')\n .attr('class','rect-background userScore');\n\n const mlScoreT = mlScoreG.append('text')\n .attr('class','textScore mlScore')\n .attr('id','textScore-ml')\n .attr('x','0px');\n mlScoreT.append('tspan')\n .text('The software rated the session ');\n mlScoreT.append('tspan')\n .attr('id','mlNum')\n .text(mlScore.toFixed(1))\n .style('font-weight','bold');\n mlScoreT.append('tspan')\n .attr('id','mlNumChange');\n\n mlScoreG.append('rect')\n .attr('class','rect-background mlScore');\n\n if(variation == 'confidence'){\n makeEmpathyBars(mlScore);\n makeConfidenceLabels(mlScore);\n }else{\n userScoreG.append('rect')\n .attr('class','rect-foreground userScore')\n .attr('id','userScore')\n .attr('width',scaleX(userScore));\n mlScoreG.append('rect')\n .attr('class','rect-foreground mlScore')\n .attr('id','mlScore')\n .attr('width',scaleX(mlScore));\n svgEmpathy.selectAll('.rect-foreground')\n .attr('height',barH+'px')\n .attr('x','0px')\n .attr('y',barY+'px');\n svgEmpathy.selectAll('.rect-background')\n .attr('y',barY+'px');\n };\n\n svgEmpathy.selectAll('.rect-background')\n .attr('width',barW+'px')\n .attr('height',barH+'px')\n .attr('x','0px');\n\n // append visual indicators for empathy score changes by user interaction\n if(variation == 'manipulation' || variation == 'influential n-grams'){\n mlScoreG.append('rect')\n .attr('class','rect-foreground mlScore mlScoreChange')\n .attr('id','scoreChangeNeg')\n .attr('x',0)\n .attr('width',scaleX(mlScore));\n mlScoreG.append('rect')\n .attr('class','rect-background mlScore mlScoreChange')\n .attr('id','scoreChangePos')\n .attr('x',scaleX(mlScore))\n .attr('width',scaleX(scoreMax-mlScore));\n mlScoreG.selectAll('.mlScoreChange')\n .attr('height',barH/10)\n .attr('y',barY+(9*barH/20));\n mlScoreG.append('circle')\n .attr('id','scoreChange')\n .attr('cx',scaleX(mlScore))\n .attr('cy',barY+(barH/2))\n .attr('r',barH/8)\n .style('opacity',0);\n }\n\n /************* LOWER LEFT CONTENT *************/\n\n if(variation == 'manipulation'){\n const sliderObj = {\n openPerc: percentOpenQuestions,\n openCount: openQuestions,\n closedCount: closedQuestions,\n complexPerc: percentComplexReflections,\n complexCount: complexReflections,\n simpleCount: simpleReflections\n };\n const questionsObj = {\n open: openArr,\n close: closeArr\n };\n const reflectionsObj = {\n complex: complexArr,\n simple: simpleArr\n };\n createSliders(sliderObj,questionsObj,reflectionsObj,mlScore,w);\n\n }else if(variation == 'confidence' || variation == 'narrative description'){\n d3.select('#content-empathy')\n .append('h6')\n .attr('id','title-aboutAlg')\n .html('ABOUT THE SOFTWARE');\n d3.select('#content-empathy')\n .append('p')\n .attr('id','desc-aboutAlg')\n .style('width',barW+'px')\n .html(aboutAlg);\n }else if(variation == 'influential n-grams'){\n influenceLegend(data.session.talkTurn);\n }\n\n /************** SESSION TRANSCRIPT **************/\n\n d3.select('#content-session')\n .append('p')\n .attr('id','transcript-desc')\n .style('font-size','12px')\n .style('width',barW+'px')\n .style('margin-top','30px')\n .html('Here is a software-generated transcript of the role-played session.')\n\n if(variation == 'influential n-grams'){\n d3.select('#transcript-desc')\n .html('Here is a software-generated transcript of the role-played session. ' +\n 'Click the buttons below to see how changing the ' +\n 'most influential words and phrases to all pro-empathy or anti-empathy affect the empathy score.')\n influenceFunctionality(mlScore);\n }\n\n d3.select('#content-session')\n .append('div')\n .attr('id','container-session');\n d3.select('#content-session')\n .append('div')\n .attr('id','manipulation-tracking');\n\n // text for each talk turn\n d3.select('#container-session').selectAll('.session-text')\n .data(data.session.talkTurn)\n .enter()\n .append('div')\n .attr('class',function(d){\n if(d.speaker == 'therapist'){\n return 'session-div therapist-div';\n }\n else{\n return 'session-div client-div';\n }\n })\n .append('text')\n .attr('class',function(d){\n if(d.speaker == 'therapist' && d.codes[0]=='QUO'){\n return 'session-text therapist-text openQ-text';\n }\n else if(d.speaker == 'therapist' && d.codes[0]=='REC'){\n return 'session-text therapist-text complexR-text';\n }\n else if(d.speaker == 'therapist'){\n return 'session-text therapist-text';\n }\n else{\n return 'session-text client-text';\n }\n })\n .attr('id',function(d){\n return d.speaker + '-' + d.id;\n })\n .append('tspan')\n .text(function(d){\n if(d.speaker == 'therapist'){\n return 't: ';\n }else{\n return 'c: ';\n }\n })\n\n d3.selectAll('.session-text')\n .append('tspan')\n .attr('class',function(d){\n return d.speaker + '-original';\n })\n .attr('id',function(d){\n return d.speaker + '-original-' + d.id;\n })\n // commented code below indicated bolded text in transcript\n // .classed('in-scope',function(d){\n // if(session == sessionGood){\n // if(d.id >= 74 && d.id <= 119){\n // return true;\n // }else{ return false; }\n // }else if(session == sessionBad){\n // if(d.id >= 51 && d.id <= 88){\n // return true;\n // }else{ return false; }\n // }\n // })\n .html(function(d){\n if(d.speaker == 'therapist'){\n return d.asrText;\n }else{\n return d.asrText;\n }\n });\n\n if(variation == 'similar sessions'){\n similarSessions();\n d3.select('#container-session')\n .style('height','480px');\n }\n else if(variation == 'influential n-grams'){\n d3.select('#container-session')\n .style('margin-top','30px')\n .style('height','470px');\n influenceInTranscript();\n influence();\n }\n else if(variation == 'narrative description'){\n d3.select('#container-session')\n .style('height','450px');\n }else if(variation == 'confidence'){\n d3.select('#container-session')\n .style('height','470px');\n }else if(variation == 'manipulation'){\n d3.select('#container-session')\n .style('height','560px');\n d3.select('#manipulation-tracking')\n .style('top',function(){\n var rect = document.getElementById('container-session').getBoundingClientRect(),\n greaterRect = document.getElementById('content-session').getBoundingClientRect(),\n \t scrollTop = window.pageYOffset || document.documentElement.scrollTop;\n return (rect.top - greaterRect.top + scrollTop) + 'px';\n })\n .style('height','560px');\n trackingH = document.getElementById('manipulation-tracking').clientHeight;\n trackingW = document.getElementById('manipulation-tracking').clientWidth;\n d3.select('#manipulation-tracking')\n .append('svg')\n .attr('id','tracking-svg')\n .attr('width',trackingW)\n .attr('height',trackingH);\n d3.select('#btn-to-survey')\n .style('position','relative')\n .style('top','-160px');\n }\n\n });\n\n var generateId = function () {\n return '_' + Math.random().toString(36).substr(2, 9);\n };\n\n // data storage\n dataObj.user = generateId();\n dataObj.rating = rating;\n dataObj.session = sessionType;\n dataObj.listenTime = +listenMaxDur.toFixed(0);\n dataObj.variation = variation.replace(/ /g,\"_\");\n // currently omitting ip address capture\n // d3.json('http://api.db-ip.com/v2/free/self', function(data) {\n // dataObj.ip = data.ipAddress;\n // });\n\n d3.select('#btn-to-survey')\n .style('color','black')\n .on('click',function(){\n dataObj.interactionCount = interaction;\n dataObj.outputTime = outputDurSec;\n clearInterval(durSecInterval);\n d3.select('#modal-next')\n .style('display','block');\n })\n\n // modal content\n d3.select('#modal-next').selectAll('.modal-body')\n .append('p')\n .style('font-size','14px')\n .style('text-align','center')\n .style('margin-top','40px')\n .html('You will now be directed to the survey site.');\n\n d3.select('#modal-next').selectAll('.modal-body')\n .append('a')\n .attr('id','modal-content-btn')\n .attr('class','btn')\n .html('okay')\n .on('click',function(){\n d3.select(this).attr('href','https://sri.utah.edu/epnew/bypass/anon.jsp?gid=4196738'+\n '&randomsessionid=' + dataObj.user +\n // '&ip=' + dataObj.ip +\n '&empathy=' + dataObj.rating +\n '&sessiongoodbad=' + dataObj.session +\n '&listentime=' + dataObj.listenTime +\n '&variation=' + dataObj.variation +\n '×pentlooking=' + dataObj.outputTime +\n '&interactioncount=' + dataObj.interactionCount);\n });\n\n}",
"static create( spec = {} ) {\n \n // 3. Setup default values or use arguments\n \n let {\n name = \"icosahedron\",\n x = 0.0,\n y = 0.0,\n z = 0.0,\n mesh = IcosahedronFactory.createMesh( spec ),\n } = spec;\n \n let { geometry, material } = mesh; \n \n // 4. Use ThreeJS to define a 3D icosahedron\n \n var icosahedron = new THREE.Mesh( geometry, material );\n \n // 5. Use the name property to specify a type\n icosahedron.name = name;\n \n // 6. Using ThreeJS methods on the icosahedron, move it to a specific offset\n icosahedron.translateX(x);\n icosahedron.translateY(y);\n icosahedron.translateZ(z);\n \n // 7. Return the new icosahedron\n return icosahedron;\n }"
] | [
"0.694004",
"0.62396306",
"0.6203838",
"0.5590959",
"0.5456772",
"0.5446231",
"0.53901875",
"0.5368162",
"0.5363705",
"0.5279377",
"0.5266426",
"0.52592355",
"0.5250064",
"0.523601",
"0.52161443",
"0.5201425",
"0.51934534",
"0.518344",
"0.51736003",
"0.51620394",
"0.51599216",
"0.5153875",
"0.5148073",
"0.51468706",
"0.51135963",
"0.5077327",
"0.50766724",
"0.5067086",
"0.50525516",
"0.50440407"
] | 0.6720598 | 1 |
Deletes the pitch of a variation. | function deleteVariationPitch(){
currentNeume.pitches[currentPitchIndex][currentVarSourceIndex].additionalPitches.splice(currentVarPitchIndex, 1);
currentVarPitchIndex = 0;
document.getElementById("input").innerHTML = pitchDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deletePitch(){\n currentNeume.pitches.splice(currentPitchIndex, 1);\n \n currentPitchIndex = 0;\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function deleteShape() {\n if(instrumentMode == 7){\n instrumentMode=2;\n }\n shp1.splice(selectedShape-1,1);\n rot1.splice(selectedShape-1,1);\n maxNumShapes--;\n //start from skratch\n if(maxNumShapes == 0){\n instrumentMode = 0;\n }\n selectedShape=maxNumShapes;\n }",
"function removePitchSamples(\r\n numSamples)\r\n {\r\n if(numSamples == 0) {\r\n return;\r\n }\r\n move(pitchBuffer, 0, pitchBuffer, numSamples, numPitchSamples - numSamples);\r\n numPitchSamples -= numSamples;\r\n }",
"remove() {\n stopSound(this.throwSound);\n this.isShot = false;\n this.player.hookNumber ++;\n this.size = this.player.totalHeight;\n }",
"noteOff(pitch) {\n this.keys[pitch].noteOff()\n }",
"removePoint() {\n this.points -= 1;\n this.updateScore();\n }",
"function deleteChamp(l){\n\tvar supprimer = document.getElementById('line'+l);\n\tsupprimer.remove();\n}",
"function onDeleteClick() {\n setValue( '', onAudioCleared );\n function onAudioCleared() {\n element.page.form.raise( 'valueChanged', element );\n Y.log( 'Cleared audio element value: ' + element.value, 'info', NAME );\n element.isDirty = true;\n window.setTimeout( function() { element.page.redraw(); }, 500 );\n }\n }",
"removeSpeech() {\n delete this._response.speech;\n }",
"clearVariant() {\n const container = this.container();\n container.removeItem(this.experimentKey);\n }",
"function removeNote(){\n\t$('.playerNotes .notesWrapper').each(function(index, element) {\n\t\tif($(this).attr('data-array')==curNote){\n\t\t\t$(this).remove();\n\t\t}\n });\n\tgenerateArray(false);\n\thighLightNote(false);\n\tstopGame();\n}",
"removeSound() {\n this._soundAssetUUID = null;\n }",
"function deleteSelectedParticle()\n{\n if (selectedParticle) {\n // Flag the particle for deletion.\n selectedParticle.delete = true;\n\n // Now loop though the particles array and find the index of this particle.\n particleIndex = null;\n\n for (var x = 0; x < particles.length; x ++) {\n if (particles[x].delete) {\n particleIndex = x;\n break;\n }\n }\n\n // Shorten the array (take out the deleted particle and move all others down to fill the gap).\n if (particleIndex !== null) {\n particles.splice(particleIndex, 1);\n }\n }\n}",
"removeParticle(i){\n console.assert(\n Number.isInteger(i) && i>=0 && i<this.#particles.length,\n \"remove particle failed; line 56 Model.mjs\"\n );\n\n this.#particles.splice(i, 1);\n }",
"remove(which, index, count = 1) {\n let param = (index < 0) ? [index * -1 - 1, count] : [index, count];\n if (which == \"body\") {\n this._bodies.splice(param[0], param[1]);\n }\n else {\n this._particles.splice(param[0], param[1]);\n }\n return this;\n }",
"removePoint() {\n const i = this.pointObjects.indexOf(this.selectedPoint);\n this.splinePoints.splice(i, 1);\n this.deselectPoint();\n this.updateTrajectory();\n }",
"function deleteNeumeInVariant(){\n currentSyllable.neumes[currentNeumeIndex][currentNeumeVariationIndex].additionalNeumes.splice(currentNeumeInVariationIndex, 1);\n \n currentNeumeInVariationIndex = 0;\n \n document.getElementById(\"input\").innerHTML = neumeDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"handleSoundPlaying(that,instrument, note){\n var i = instrument.lastPlayedNotes.indexOf(note);\n instrument.lastPlayedNotes.splice(i,1);\n }",
"function deleteNote(note) {\n note.remove();\n borderedNote = null;\n}",
"function handlenoteDelete() {\n var currentnote = $(this).parents(\".note-panel\").data(\"id\");\n deletenote(currentnote);\n }",
"deleteSlide(data){\n const index = slides.findIndex((slide) => slide.id === data );\n console.log(slides[index]);\n slides.splice(index, 1);\n this.rendering();\n }",
"removeFromHand(index){\n this.hand.splice(index, 1);\n }",
"deletePacman(){\n this.remove(this.pacman);\n }",
"function remove(speaker) {\n return $http.delete('/api/speakers/' + speaker.id);\n }",
"function deleteRecording() {\n\tstrokeRecording = new Track(\"Recording\", []);\n\tresetTime();\n}",
"function removeFromDatabase(index) {\n\tvar removed = positionArray.splice(index, 1); //removes sound once it's played\n\tconsole.log(removed[0]);\n\tremoved = sndArray.splice(index, 1);\n\tconsole.log(removed[0]);\n\t\n}",
"noteOff() {\n this.keyRect.fill(this.displayOptions.color);\n grid.highlightPitch(this.pitch, false, this.displayOptions);\n audio.noteOff(this.pitch)\n }",
"destroy() {\n this.keystrokeCount.remove();\n }",
"function removeAudioFile() {\n var audioFile = Ti.Filesystem.getFile(res.data.filePath);\n audioFile.deleteFile();\n }",
"function stopNote(audioID, pnoKeyID) {\n\tvar vol = 65;\n\n\t//do short fadeout when stopping the note to avoid pops\n\tvar fadeOut = setInterval(\n\t\tfunction(){\n\t\t\tif (vol > 10) {\n\t\t\t\tvol -= 12;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tvol--;\n\t\t\t}\n\n\t\t\tif (vol > 0){\n\t\t\t\t$('#' + audioID).jWebAudio('options', {\n\t \t\t\t'volume': parseInt(vol),\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$('#' + audioID).jWebAudio('stop');\n\t\t\t\t$('#' + audioID).jWebAudio('options', {\n\t \t\t\t'volume': parseInt(65),\n\t\t\t\t});\n\t\t\t\tclearInterval(fadeOut);\n\t\t\t}\n\t\t}, \n\t\t1 //miliseconds for setInterval\n\t);\n}"
] | [
"0.6880858",
"0.57012665",
"0.56136405",
"0.5587377",
"0.5557648",
"0.55111945",
"0.542531",
"0.54174113",
"0.5399664",
"0.53873914",
"0.5384007",
"0.53207153",
"0.530118",
"0.52598375",
"0.5217453",
"0.5209899",
"0.5203828",
"0.5190707",
"0.5187357",
"0.5131172",
"0.5121391",
"0.5114186",
"0.50946814",
"0.50865245",
"0.50819457",
"0.50221443",
"0.50164753",
"0.5006918",
"0.499615",
"0.49713248"
] | 0.77226067 | 0 |
Deletes the neume in a variation. | function deleteNeumeInVariant(){
currentSyllable.neumes[currentNeumeIndex][currentNeumeVariationIndex].additionalNeumes.splice(currentNeumeInVariationIndex, 1);
currentNeumeInVariationIndex = 0;
document.getElementById("input").innerHTML = neumeDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteNeume(){\n currentSyllable.neumes.splice(currentNeumeIndex, 1);\n \n currentNeumeIndex = 0;\n \n document.getElementById(\"input\").innerHTML = neumeDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function deleteVariationPitch(){\n currentNeume.pitches[currentPitchIndex][currentVarSourceIndex].additionalPitches.splice(currentVarPitchIndex, 1);\n \n currentVarPitchIndex = 0;\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"delete(node) {\n mona_dish_1.DQ.byId(node.id.value, true).delete();\n }",
"delete() {\n this.eachElem((node) => {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n });\n }",
"delete() {\n this.eachElem((node) => {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n });\n }",
"function del_variant_option(d) {\n\td.parentNode.parentNode.remove();\n}",
"function deleteDisc(nome) {\n window.disciplinas = window.disciplinas.filter(function(item) {\n return item.nome != nome;\n });\n global.save();\n}",
"function Excluir() {\n var par = $(this).parent().parent(); //tr\n\n par.remove();\n\n $(\"#total\").text(CalcularTotal());\n\n // produtos.splice(i,1);\n }",
"function Interpreter_InvalidateVariations()\n{\n\t//loop through all objects within variations\n\tfor (var uidObject in this.Variations)\n\t{\n\t\t//get the map\n\t\tvar objectMap = this.Variations[uidObject];\n\t\t//loop through them\n\t\tfor (var eProp in objectMap)\n\t\t{\n\t\t\t//convert ep to number\n\t\t\teProp = Get_Number(eProp);\n\t\t\t//get the variation\n\t\t\tvar variation = objectMap[eProp];\n\t\t\t//mark it for deletion\n\t\t\tvariation.State = __INTERPRETER_VARIATION_DELETE;\n\t\t}\n\t}\n}",
"delete(){\n let td = this.getCase();\n let img = td.lastChild;\n if(img != undefined) td.removeChild(img);\n }",
"function eliminarDetalle(indice, idproducto, idlote) {\n\n\tvar datadetalledelete = concatenate(idproducto, idlote, 10);\n\n\t$(\"#fila\" + indice).remove();\n\n\tArray.prototype.compacta = function(){\n\t\tfor(var i = 0; i < this.length; i++){\n\t\t\tif(this[i] === datadetalledelete){\n\t\t\t\t\tthis.splice(i , 1);\n\t\t\t}\n\t\t}\n\t}\n\tcontains.compacta();\n\n\tcalcularTotales();\n\tdetalles = detalles - 1;\n\tevaluar()\n}",
"function deleteNewVar(node){\n var p = node.parentNode;\n p.parentNode.removeChild(p);\n}",
"function eliminarViaje(e) {\n eaux = e\n let idDel = e.parentElement.getAttribute('data-id')\n db.collection(\"Viajes\").doc(idDel).delete()\n\n}",
"function remove() {\n var index = Math.floor(Math.random() * values.length);\n console.log(\"DEL \" + values[index]);\n tree.remove(values[index]);\n values.splice(index, 1);\n}",
"clearVariant() {\n const container = this.container();\n container.removeItem(this.experimentKey);\n }",
"function handleDeleteItem(_event) {\n let aktuellertIndex = parseInt(_event.target.getAttribute(\"index\"));\n warenkorbsumme = warenkorbsumme - carticles[aktuellertIndex].preis;\n gesamtSumme.innerText = \"Gesamtsumme: \" + warenkorbsumme.toLocaleString(\"de-DE\", { style: \"currency\", currency: \"EUR\" });\n (_event.target.parentElement?.remove());\n }",
"function excluir(aux) {\n aux.remove();\n}",
"function node_delete(_nodeindex){\r\n\tvar currentnode = nodes[_nodeindex];\r\n\tvar temp = delete_relatededges(currentnode, edges, edges_tangents);\r\n\tedges = temp.edges;\r\n\tedges_tangents = temp.edges_tangents;\r\n\tif(matchnodeindex(nodes,currentnode.id)>= 0 & matchnodeindex(nodes,currentnode.id)< nodes.length){\r\n\t\tswitch (currentnode.type){\r\n\t\t\tcase \"ellipse\": \r\n\t\t\t\tnumElli--;\r\n\t\t\t\tnumNode--;\t\t\t\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"rect\":\r\n\t\t\t\tnumRec--;\r\n\t\t\t\tnumNode--;\t\t\t\t\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase \"triangle\":\r\n\t\t\t\tnumTri--;\r\n\t\t\t\tnumNode--;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tdefault:;\r\n\t\t}//end of switch (_type) \r\n\t\tnodes.splice(_nodeindex,1);\r\n\t}\r\n}",
"function eliminarLinea(indice){\n $(\"#fila\" + indice).remove();\n calculaTotalAjusteInv();\n detalles=detalles-1;\n evaluarAjusteInv();\n}",
"delete(clave) {\n // Buscar la clave en el array y borrar.\n var indx = this.findIndex(this.#elementos, clave);\n if (indx != -1)\n this.#elementos.splice(indx, 1);\n else\n return NaN;\n }",
"function elimnaproducto(ident, id) {\n lista.splice(lista.indexOf(id), 1)\n let ele = document.getElementById(ident);\n ele.remove();\n}",
"function deleteItem(e) {\n // get weight of item from span\n const weightString = e.target.previousSibling.previousSibling.innerHTML;\n // convert item weight from string to number\n const newNum = parseInt(weightString, 10);\n\n // loop thru array\n for (let i = 0; i < kitArray.length; i++) {\n // find matching value of target\n if (kitArray[i] === newNum) {\n // delete match from array\n kitArray.splice(i, 1);\n // break loop after 1 match\n break;\n }\n }\n \n // recalculate weight for head\n if (kitArray.length > 1) {\n const add = (a, b) =>\n a + b;\n const sum = kitArray.reduce(add);\n weight.innerHTML = (sum + ' oz');\n \n } else if (kitArray.length === 1) {\n let numb = kitArray[0];\n weight.innerHTML = (numb + ' oz');\n } else {\n kitArray = [];\n weight.innerHTML = (0 + ' oz');\n }\n \n // remove li\n e.target.parentNode.parentNode.removeChild(e.target.parentNode);\n\n weightGauge();\n calculateGauge4();\n\n }",
"function eliminarPino() {\r\n\r\n document.getElementById(\"fila1\").remove();\r\n subT = 0;\r\n actualizarCostos();\r\n\r\n\r\n}",
"function deleteStock() {\n\n console.log($(\".actparent .id\").html());\n prodnam = $(\".product_name.act\").html();\n $(\"#product-list\").css(\"opacity\", \"0\");\n data = \"id=\" + String($(\".actparent .id\").html()) + \"^del=Stock^class=Stock\";\n dbOperations(\"del\", \"delete_operation\", data, [\"product_name\", \"stock\"], [\"#product-list\", \".pro-item .product_name\", prodnam]);\n //$(\"tr.actparent\").remove(); \n}",
"function memeDeletion(event) {\n event.target.parentNode.remove();\n}",
"function borrarProductoCesta(){\n //recuperar id del producto que queremos eliminar\n let idproductocesta=this.getAttribute('item');\n //borrar todos los productos\n arrayCesta=arrayCesta.filter(function(idcesta){\n return idcesta !== idproductocesta;\n });\n //volver a renderizar\n renderCesta();\n //calcular el total\n calcularTotal();\n}",
"function deleteProduct(prodId){\n\n $(`#n${prodId}`).remove()\n $(`#n${prodId}`).remove()\n $(`#n${prodId}`).remove()\n\n}",
"function adicionarouRemoverIngredienteProduto(tipo, id) {\r\n if (tipo == 'adicionar') {\r\n if (validaDadosCampo([`#quanti${id}`]) && validaValoresCampo([`#quanti${id}`])) {\r\n VETORDEINGREDIENTESCLASSEPRODUTO.push(JSON.parse(`{\"material\":\"${id}\", \"quantity\":${parseInt(document.getElementById(`quanti${id}`).value)}}`))\r\n document.getElementById(`select${id}`).checked = true\r\n } else {\r\n document.getElementById(`select${id}`).checked = false\r\n mensagemDeErro('Preencha o campo quantidade com valores válidos!')\r\n }\r\n } else if (tipo == 'remover') {\r\n const ingredientePosition = VETORDEINGREDIENTESCLASSEPRODUTO.findIndex((element) => element.material == id);\r\n VETORDEINGREDIENTESCLASSEPRODUTO.splice(ingredientePosition, 1);\r\n }\r\n}",
"remove(e){\n let x = e.target.id.substr(0,18);\n console.log(x + ' Product__c');\n \n // eslint-disable-next-line no-alert\n let cf = confirm('Do you want to delete this entry?')\n if(cf===true){\n let i = this.newProds.findIndex(prod => prod.Product__c === x)\n console.log(i +' here is i');\n \n this.newProds.splice(i,1)\n //console.log(this.newProds.length)\n }\n }",
"function removeProduto(nameObj) {\n if (confirm(\"Deseja mesmo excluir este Produto ?\"))\n \tgetObj(nameObj).parentNode.removeChild(getObj(nameObj));\n \t\n //removendo o indice no array(como o array começa em 0, subtraimos 1)\n markFlagProduto(extractIdProduto(nameObj), extractIdProduto(nameObj), false); \n \n //atualizando a soma do peso\n if (window.updateSum != null){\n \tupdateSum(true); \n }\n}"
] | [
"0.70665705",
"0.6344076",
"0.611338",
"0.61124647",
"0.61124647",
"0.60330266",
"0.6019716",
"0.5986053",
"0.5861187",
"0.57542586",
"0.574653",
"0.57440805",
"0.5741301",
"0.57347727",
"0.5734445",
"0.5731595",
"0.57023925",
"0.5695025",
"0.56697977",
"0.5653932",
"0.562234",
"0.5612542",
"0.560542",
"0.55899656",
"0.5559162",
"0.5553911",
"0.55456966",
"0.55445176",
"0.5512154",
"0.5499355"
] | 0.795165 | 0 |
Set the selected source ID to be current source ID according to the form and reload it. | function applyCurrentSource(){
currentSID = document.getElementById("source").value;
document.getElementById("input").innerHTML = sourceDataChangeForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toChangeSourceData(){\n isChangingSources = true;\n if(sources.length > 0){\n currentSID = sources[0].id;\n }\n document.getElementById(\"input\").innerHTML = sourceDataChangeForm();\n}",
"function setSource(aSrc) {\n\n\tdocument.getElementById('frmFacturation').hdnSource.value = aSrc;\n\tdocument.getElementById('frmFacturation').submit();\n\n}",
"function editSelectedInv(source) {\n INV_ACTION = 'updateInv';\n clearInvForm();\n displayInvWell();\n fillInvWell(source);\n}",
"function editSelectedInv(source)\n{\n\t//alert(source.id);\n\tINV_ACTION = \"updateInv\";\n\tclearInvForm();\n\tdisplayInvWell();\n\tfillInvWell(source);\n\thideExtraValues();\n}",
"function changeSourceRecordFK() {\r\n\r\n if (getObjectValue(\"listDisplayed\") == 'Y') {\r\n if (isChanged || isPageDataChanged()) {\r\n if (!confirm(ciDataChangedConfirmation)) {\r\n setObjectValue(\"phoneNumber_sourceRecordFK\", getObjectValue(\"currentSourceRecordFK\"));\r\n return;\r\n }\r\n }\r\n }\r\n setObjectValue(\"process\", \"loadPhoneList\");\r\n submitFirstForm();\r\n\r\n}",
"function update_entity_selection_id(id) {\n current_id = id;\n\n //setup the selected record\n var existing_record;\n if(current_id != undefined) {\n existing_record = Controller.get_record(current_id);\n Forms.set_scope_can_record(existing_record);\n }\n\n //only update the display, don't reinit the form\n update_edit_form_display();\n\n}",
"function setSource(source){\n\tif(source == currSource){\n\t\talert('Fuente ya seleccionada');\n\t\treturn;\n\t}\n\telse if(choropleth_objects[source]==undefined){\n\t\talert('Fuente no disponible');\n\t\treturn;\n\t}\n\telse{\n\t\tif(lastMarkerGroup!=undefined){\n\t\t\tlayerSelector.removeLayer(lastMarkerGroup);\n\t\t\tmymap.removeLayer(lastMarkerGroup);\n\t\t\tlayerSelector.showGControl();\n\t\t}\n\t\t//desseleccionar checkbox doc.getElement... (?)\n\n\t\tcurrSource = source;\n\t\t//updateMarkers(currSource);\n\t\tif(choropleth_objects[currSource].markerLayer.getLayers().length>0){\n\t\t\tlastMarkerGroup = choropleth_objects[currSource].markerLayer;\n\t\t\tlayerSelector.addOverlay(lastMarkerGroup,\"Marcadores\");\n\t\t\tlayerSelector.showGControl();\n\t\t}\n\n\n\t\tchoroplethize(currSource);\n\t\tif(initChoroGran == 1)\n\t\t\tsetGranProvincia();\n\t\telse if(initChoroGran == 2)\n\t\t\tsetGranComuna();\n\t\tsetTimechartData(currSource, timeChartGran);\n\t}\n}",
"function addSource(source) {\n $('select').append($('<option>', {\n value: source.id.replace(\":\", \"\"),\n text: source.name\n }));\n $('select option[value=\"' + source.id.replace(\":\", \"\") + '\"]').attr('data-img-src', source.thumbnail.toDataURL());\n refresh();\n }",
"updateDestination() {\n this.selectedValue = this.destination.key;\n }",
"function goToInvoices(source) {\n hideExtraInvoiceValues();\n\n //sets the selected PE to a global var\n SELECTED_PE_ID = source;\n displayInvDisplay();\n}",
"function setSource(newSource) {\n\n source = newSource;\n\n // TODO: fix lazy loading!\n //if (isRendered) {\n // renderSource();\n //}\n renderSource();\n\n }",
"function sourceClick(index)\n{\n var\tcitForm\t\t= document.citForm;\n var\telt\t\t = citForm.elements['IDSR'];\n if (elt.length > 1)\n {\t\t// select element has already been populated\n\t\treturn;\n }\t\t// select element has already been populated\n\n // get the subdistrict information file\n HTTP.getXML('/FamilyTree/getSourcesXml.php?name=IDSR',\n\t\t\t\tgotSources,\n\t\t\t\tnoSources);\n}",
"function applyCurrentVarSource(){\n currentVarSourceIndex = document.getElementById(\"varsource\").value;\n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n}",
"function assign(id){\n selectedForm=id;\n console.log(selectedForm+ \" selected\");\n}",
"updateSource(source) {\n this.set('source', source);\n }",
"function editProjectInfo(source_id) {\n if (source_id) prepareProjectData(source_id);\n document.getElementById('projectManager').style.display = 'none';\n getProjectEnums_PROJECT_DATA(true);\n currentDivLocation = 'projectData';\n document.getElementById('projectData').style.display = 'inline';\n //window.location.href = PROJECTINFO + '?type=edit&id=' + projectID;\n}",
"registerSourceModuleChange() {\n\t\t\tlet select = this.container.find('#inputSourceModule');\n\t\t\tlet blocks = this.container.find('.js-dynamic-blocks');\n\t\t\tselect.on('change', (e) => {\n\t\t\t\tthis.sourceModule = select.find('option:selected').data('module');\n\t\t\t\tblocks.html('');\n\t\t\t\tAppConnector.request({\n\t\t\t\t\tmodule: app.getModuleName(),\n\t\t\t\t\tparent: app.getParentModuleName(),\n\t\t\t\t\tview: 'Edit',\n\t\t\t\t\tmode: 'dynamic',\n\t\t\t\t\tselectedModule: this.sourceModule\n\t\t\t\t}).done((data) => {\n\t\t\t\t\tblocks.html(data);\n\t\t\t\t\tApp.Fields.Picklist.changeSelectElementView(blocks);\n\t\t\t\t\tthis.loadConditionBuilderView();\n\t\t\t\t});\n\t\t\t});\n\t\t}",
"function selectYear() {\n\tyearSelected = document.getElementById(\"year\").value;\t// Save the new year\n\trefreshIFrame();\t// Refresh the preview with the new variables\n}",
"function scm_source_select_replace(selectItem, idMatch) {\n if(selectItem.attr('id').endsWith(idMatch)\n && !selectItem.attr('id').endsWith(\"ZZ\")) {\n selectItem.select2({\n ajax: {\n url: function() {\n var query = snacUrl+\"/vocabulary?type=ic_sources&id=\";\n query += $(\"#constellationid\").val()+\"&version=\"+$(\"#version\").val();\n query += \"&entity_type=\"+$(\"#entityType\").val();\n return query;\n },\n dataType: 'json',\n delay: 250,\n data: function (params) {\n return {\n q: params.term,\n page: params.page\n };\n },\n processResults: function (data, page) {\n // Modify the results to be in the format we want\n lastSourceSearchResults = data.results;\n // need id, text\n var results = new Array();\n data.results.forEach(function(res) {\n results.push({id: res.id, text: res.citation});\n });\n results.sort(function (a, b) {\n if (a.text > b.text) { return 1; }\n if (a.text < b.text) { return -1; }\n return 0;\n })\n return { results: results };\n },\n cache: true\n },\n width: '100%',\n minimumInputLength: 0,\n allowClear: true,\n theme: 'bootstrap',\n placeholder: 'Select'\n });\n\n selectItem.on('change', function (evt) {\n // TODO: Get the current selected value and update the well in the page to reflect it!\n // Note: all the selections are available in the global lastSourceSearchResults variable.\n var sourceID = $(this).val();\n var inPageID = $(this).attr(\"id\");\n var idArray = inPageID.split(\"_\");\n if (idArray.length >= 6) {\n var i = idArray[5];\n var j = idArray[4];\n var shortName = idArray[1];\n lastSourceSearchResults.forEach(function(source) {\n if (source.id == sourceID) {\n // Update the text of the source\n if (typeof source.text !== 'undefined') {\n $(\"#scm_\" + shortName + \"_source_text_\" + j + \"_\" + i).html(addbr(source.text)).removeClass('hidden');\n $(\"#scm_\" + shortName + \"_source_text_\" + j + \"_\" + i).closest(\".panel-body\").removeClass('hidden');\n } else {\n $(\"#scm_\" + shortName + \"_source_text_\" + j + \"_\" + i).text(\"\").addClass('hidden');\n $(\"#scm_\" + shortName + \"_source_text_\" + j + \"_\" + i).closest(\".panel-body\").addClass('hidden');\n\n }\n // Update the URI of the source\n if (typeof source.uri !== 'undefined')\n $(\"#scm_\" + shortName + \"_source_uri_\" + j + \"_\" + i).html('<a href=\"'+source.uri+'\" target=\"_blank\">'+source.uri+'</a>');\n else\n $(\"#scm_\" + shortName + \"_source_uri_\" + j + \"_\" + i).html('');\n // Update the URI of the source\n if (typeof source.citation !== 'undefined')\n $(\"#scm_\" + shortName + \"_source_citation_\" + j + \"_\" + i).html(source.citation).removeClass('hidden');\n else\n $(\"#scm_\" + shortName + \"_source_citation_\" + j + \"_\" + i).html('').addClass('hidden');\n }\n });\n }\n });\n\n }\n}",
"function refreshPaisZona(source,target){\r\n\t$j(source).change(function(){\t\t\r\n\t\t$j(target).empty();\r\n\t\t$j(target).append('<option value=\"\">--Seleccionar--</option>');\r\n\t\t$j(listaProvincias).each(function(i,item){\r\n\t\t\tif ( item.id_pais==$j(source).val() )\r\n\t\t\t\t$j(target).append( $j('<option value='+item.id+'>'+item.provincia+'</option>') );\r\n\t\t});\r\n\t});\r\n}",
"function storeSelectedId() {\n if(this.value === \"\"){\n if(this.getAttribute(\"id\") === \"currencyFrom\"){\n flagFrom.innerHTML = \"\";\n } else{\n flagTo.innerHTML = \"\";\n } \n return;\n }\n let val = this.value;\n let id = document.querySelector(`#countries option[value='${val}']`).getAttribute(\"data-id\");\n let flagId = document.querySelector(`#countries option[value='${val}']`).getAttribute(\"data-alph\");\n if (this.getAttribute(\"id\") === \"currencyFrom\") {\n selectedFrom = id;\n let img = `<img src=\"https://www.countryflags.io/${flagId}/flat/24.png\"/>`\n flagFrom.innerHTML = img;\n } else {\n selectedTo = id;\n let img = `<img src=\"https://www.countryflags.io/${flagId}/flat/24.png\"/>`\n flagTo.innerHTML = img;\n }\n }",
"function make_ready_for_edit(source) {\n var tr = source.parentNode;\n remove_gray_bg_from_user_list();\n make_appearance_ready_for_edit(tr);\n //load input forms.................\n show_in_form(tr);\n // load referred table.............\n load_ref_table(tr);\n // create buy time select..........\n var id = tr.getAttribute('data-id');\n create_buy_time_part_for_edit(tr,id);\n load_cheque_table(tr);\n // this is for keep editable row after paging\n document.getElementById('userTable').setAttribute('data-selectedId', id);\n}",
"function setSource(newSource) {\n\t\t\tsource = newSource;\n\n\t\t\t// TODO: fix lazy loading!\n\t\t\tif (isRendered) {\n\t\t\t\trenderSource();\n\t\t\t}\n\t\t\t// renderSource();\n\t\t}",
"function prepare_reload() {\t\n\n\tdocument.getElementById(\"reload_\").value = \"1\";\n\tdocument.getElementById(\"reload_\").ref = window.location.href;\n} // ------------------------------------------------------------------------",
"function update() {\n document.getElementById('target').value = document.getElementById('source').value;\n}",
"function handleSourceChange(sourceCode, sourceName) {\n basicMsg(\"Loading...\");\n $(\"#countriesList\").prop('selectedIndex', 0);\n $(\"#sourcesList\").val(sourceCode);\n\n if (sourceCode === 'All') {\n displayFilterValues('ALL', '');\n showAllNews();\n return;\n }\n\n displayFilterValues('SOURCE -', sourceName)\n\n const url = 'news/bySource/' + sourceCode + '?socketId=' + getSocketId();\n displayNewsInfo(url, sourceCode);\n}",
"changeSource(source) {\n\t\tthis.info.source = source\n\t\tthis.config.source = source\n\t}",
"function navigateTo(source) {\n EDIT_INTENTION = true;\n console.log($(source).attr('id'));\n if (taskFinder) {\n window.location.href =\n TASK_CREATOR + '?id=' + $(source).attr('id').replace('project', '');\n } else {\n document.getElementById('findProject').style.display = 'none';\n $(source).attr('id').replace('project', '');\n var proj_id = $(source).attr('id');\n proj_id = proj_id.replace('project', '');\n console.log('PROJ MAN: ', proj_id, PROJECT_DATA);\n projectID = proj_id;\n getProject_PROJECT_MANAGER(proj_id);\n $('#projectInformationTabLink').addClass('active');\n $('#projectInformation').addClass('active');\n $('#projectInformation').addClass('active');\n $('#closeout').removeClass('active');\n\n $('.autofill_NA').each(function (index) {\n $(this).val('false');\n });\n\n currentDivLocation = 'projectManager';\n document.getElementById('projectManager').style.display = 'inline';\n }\n}",
"onChangeSource(newSourceName) {\n\t\tvar sources = this.props.sources;\n\n\t\tfor(let source in sources) {\n\n\t\t\tlet sourceName = sources[source].sourceName;\n\n\t\t\tif(sourceName === newSourceName) {\n\n\t\t\t\tthis.setState({\n\t\t\t\t\tcurrentSource: sources[source],\n\t\t\t\t\tcurrentCategory: sources[source].categories[0]\n\t\t\t\t});\n\n\t\t\t}\n\n\t\t}\n\t}",
"select(id) { this._updateActiveId(id, false); }"
] | [
"0.70406044",
"0.64564556",
"0.6252756",
"0.6245405",
"0.6176669",
"0.5838951",
"0.58054924",
"0.568314",
"0.5662627",
"0.564564",
"0.56438553",
"0.5641112",
"0.5638255",
"0.5630472",
"0.56117994",
"0.55540216",
"0.55443627",
"0.5513411",
"0.550988",
"0.54959524",
"0.54640895",
"0.54373425",
"0.5435732",
"0.5420163",
"0.54100525",
"0.5408703",
"0.5405431",
"0.53678304",
"0.5360809",
"0.53180945"
] | 0.6893277 | 1 |
Set the selected staff to be current staff according to the form and reload it. | function applyCurrentStaff(){
currentN = document.getElementById("staff").value;
document.getElementById("input").innerHTML = staffDataChangeForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function selecionarEmpleadoStaff(id){\n\tvar url =$('.staff_empleado_url').attr('id');\n\turl = url+'?empleadoStaff='+id;\n\n\t$.post(url, function( data ) {\n\t\tdata.forEach( function(valor, indice, array) {\n\t\t\t$('#staff_empleado').val(valor.empleado_codigo).trigger('change');\n\t\t\t$('#staff_tarea').val(valor.tarea_codigo).trigger('change');\n\t\t\t$('#estado_staff_empleado').val(valor.activo).trigger('change');\n\t\t\t$('#id_staff').val(id);\n\n\n\t\t});\n\t});\n}",
"function toChangeStaffData(){\n if(staffs.length > 0){\n currentN = staffs[0].n;\n }\n document.getElementById(\"input\").innerHTML = staffDataChangeForm();\n}",
"function EditStaff(CargoID)\n{\n\tvar datos={\n\t\t'action': \"StaffsEditStaff\",\n\t\t'id':CargoID, \n\t\t'name':jQuery(\"#nameStaff\").val(), \n\t\t'cargo':jQuery(\"select#cargoStaff option:selected\").val(), \n\t\t'estado':jQuery(\"select#estadoStaff option:selected\").val()\n\t};\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: \"admin-ajax.php\",\n\t\tdata: datos,\n\t\tdataType: 'json',\n\t\tbeforeSend:function(){StaffFormWaiting();},\t\t\n\t\tsuccess: function(data) {\n if(data.request==\"success\")\n {\n \tRefreshStaff(datos,-1);\n }else if(data.request==\"error\")\n {\n \tjQuery(\"#Staff-form-cover\").remove();\n \talert(data.error);\n }else if(data.request==\"nochange\")\n {\n \tjQuery(\"#Staff-cover\").remove();\n }\n\t\t},\n\t\terror: function(XMLHttpRequest, textStatus, errorThrown) {\n\t\t\tif(typeof console === \"undefined\") {\n\t\t\t\tconsole = {\n\t\t\t\t\tlog: function() { },\n\t\t\t\t\tdebug: function() { },\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (XMLHttpRequest.status == 404) {\n\t\t\t\tconsole.log('Element not found.');\n\t\t\t} else {\n\t\t\t\tconsole.log('Error: ' + errorThrown);\n\t\t\t}\n\t\t}\n\t});\n\treturn false;\n}",
"function multiselectModalEditStaffList() {\n\tmultiselectModal(\"editStaffList\", $('#FFSEditStaffList_AvailableAndAssignedStaffSVIDs > option').length, 'Select Assigned Staff', $(window).height() - (240));\n}",
"function updateLangStaff() {\n showOrder(currentTableID);\n showAccountBox();\n}",
"function inactive_staff_option_open()\n\t\t\t{\n\t\t\t\tdocument.getElementById(\"inactive_staff_loader\").innerHTML = document.getElementById(\"inactive_staff_div\").innerHTML; \n\t\t\t}",
"function setListStaff(){\n vm.listStaff.$promise.then(function(data) {\n $timeout(function() {\n var arr_tmp = [];\n for(var i = 0; i < data.length; i++) {\n data[i].id = data[i]._id;\n arr_tmp.push(data[i]);\n }\n vm.staffOfCompany = vm.staffOfCompany.concat(arr_tmp);\n vm.newService.staffs = vm.staffOfCompany.concat([]);\n });\n })\n }",
"function showEditForm(currentList, currentUser) {\n console.log(list);\n self.name = currentList.name;\n\n $state.go('updateList', {\n userId: currentUser._id,\n listId: currentList._id,\n currentList: currentList\n });\n }",
"function setCurrent(){\n\t\t//set ls items\n\t\tlocalStorage.setItem('currentMiles', $(this).data('miles'));\n\t\tlocalStorage.setItem('currentDate', $(this).data('date'));\n\n\t\t//insert into the edit form\n\t\t$('#editMiles').val(localStorage.getItem('currentMiles'));\n\t\t$('#editDate').val(localStorage.getItem('currentDate'));\n\t}",
"SYS_STF_LST_READY(state, p){\n state.staff.list = p.list;\n }",
"function selectForm(e){\n setActiveForm(e.target.name)\n }",
"function toStaffs(){\n document.getElementById(\"input\").innerHTML = staffForm();\n}",
"function onCreateNewStaffClick() {\n $('#modal-register-staff').modal('show');\n }",
"function AddNewStaff()\n{\n\tvar datos={\n\t\t'action': \"StaffsAddStaff\", \n\t\t'name':jQuery(\"#nameStaff\").val(), \n\t\t'cargo':jQuery(\"select#cargoStaff option:selected\").val(), \n\t\t'estado':jQuery(\"select#estadoStaff option:selected\").val()\n\t};\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: \"admin-ajax.php\",\n\t\tdata: datos,\n\t\tdataType: 'json',\n\t\tbeforeSend:function(){StaffFormWaiting();},\t\t\n\t\tsuccess: function(data) {\n if(data.request==\"success\")\n {\n \tRefreshStaff(datos, data.lastid);\n }else if(data.request==\"error\")\n {\n \tjQuery(\"#Staff-form-cover\").remove();\n \talert(data.error);\n }\n\t\t},\n\t\terror: function(XMLHttpRequest, textStatus, errorThrown) {\n\t\t\tif(typeof console === \"undefined\") {\n\t\t\t\tconsole = {\n\t\t\t\t\tlog: function() { },\n\t\t\t\t\tdebug: function() { },\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (XMLHttpRequest.status == 404) {\n\t\t\t\tconsole.log('Element not found.');\n\t\t\t} else {\n\t\t\t\tconsole.log('Error: ' + errorThrown);\n\t\t\t}\n\t\t}\n\t});\n\treturn false;\n}",
"onStaffSelect(event){\n let staffId = { key: \"staffMemberId\", value: event.target.value == '' ? -1 : event.target.value };\n this.onCheckoutEditorChange(staffId);\n }",
"function RefreshStaff(info_json,insid)\n{\n\tinfo_json.action=\"RefreshStaff\";\n\tif(insid!=-1)\n\t{\n\t\tinfo_json.id=insid;\n\t}\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: \"admin-ajax.php\",\n\t\tdata: info_json,\n\t\tdataType: 'json',\t\t\n\t\tsuccess: function(data) {\n if(data.request==\"success\")\n {\n \t//if ( typeof info_json.id == \"undefined\")\n \tif(insid!=-1)\n \t{ \t\n\t \tjQuery(\"#staffs-details\").append(\"<div class='staff-detail-line' id='detail-line-\"+data.id+\"'></div>\");\n \t \tjQuery(\"#detail-line-\"+data.id).append(\"<p class='staff-name staff-line'><span>Nombre: </span>\"+info_json.name+\"</p>\");\n \t \tjQuery(\"#detail-line-\"+data.id).append(\"<p class='staff-niv staff-line'><span>Cargo: </span>\"+data.cargo+\"</p>\");\t\n \t \tjQuery(\"#detail-line-\"+data.id).append(\"<p class='staff-est staff-line'><span>Estado: </span>\"+data.estado+\"</p>\");\n \t\tjQuery(\"#detail-line-\"+data.id).append(\"<a class='Staff-edit-icon' title='Editar Staff' rel-id='\"+data.id+\"' rel-name='\"+info_json.name+\"' rel-cargo='\"+info_json.cargo+\"' rel-status='\"+info_json.estado+\"'></a>\");\n \t}else\n \t{\n \t\tjQuery(\"#detail-line-\"+data.id+\" .staff-name\").remove();\n\t \t\tjQuery(\"#detail-line-\"+data.id).append(\"<p class='staff-name staff-line'><span>Nombre: </span>\"+info_json.name+\"</p>\");\n \t \t\tjQuery(\"#detail-line-\"+data.id+\" .staff-niv\").remove();\n \t\t \tjQuery(\"#detail-line-\"+data.id).append(\"<p class='staff-niv staff-line'><span>Cargo: </span>\"+data.cargo+\"</p>\");\n \t \t\tjQuery(\"#detail-line-\"+data.id+\" .staff-est\").remove();\t\n \t \t\tjQuery(\"#detail-line-\"+data.id).append(\"<p class='staff-est staff-line'><span>Estado: </span>\"+data.estado+\"</p>\");\n \t \tjQuery(\"#detail-line-\"+data.id+\" .Staff-edit-icon\").remove();\n\t \t\tjQuery(\"#detail-line-\"+data.id).append(\"<a class='Staff-edit-icon' title='Editar Staff' rel-id='\"+data.id+\"' rel-name='\"+info_json.name+\"' rel-cargo='\"+info_json.cargo+\"' rel-status='\"+info_json.estado+\"'></a>\");\n \t}\n \tjQuery(\"#Staff-cover\").remove();\n \t\tjQuery(\"#staff-empty\").remove();\n }else if(data.request==\"error\")\n {\n \tjQuery(\"#Staff-form-cover\").remove();\n \talert(data.error);\n }else if(data.request==\"nochange\")\n {\n \tjQuery(\"#Staff-form-cover\").remove();\n }\n\t\t},\n\t\terror: function(XMLHttpRequest, textStatus, errorThrown) {\n\t\t\tif(typeof console === \"undefined\") {\n\t\t\t\tconsole = {\n\t\t\t\t\tlog: function() { },\n\t\t\t\t\tdebug: function() { },\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (XMLHttpRequest.status == 404) {\n\t\t\t\tconsole.log('Element not found.');\n\t\t\t} else {\n\t\t\t\tconsole.log('Error: ' + errorThrown);\n\t\t\t}\n\t\t}\n\t});\n}",
"function createNewStaff(){\n document.getElementById(\"input\").innerHTML = staffForm();\n \n document.getElementsByClassName(\"staffdependant\")[0].disabled = false;\n}",
"function updateStaff(id){\r\n id = $('#modal_id').val();\r\n name = $('#modal_name').val();\r\n gender = $('#modal_gender').val();\r\n uni = $('#modal_uni').val();\r\n room = $('#modal_room').val();\r\n $.post(\"update.act\",{\r\n id:id,\r\n name:name,\r\n gender:gender,\r\n uni:uni,\r\n room:room,\r\n },function(data){\r\n clearChild();\r\n getList();\r\n swal({ type: \"success\", title: \"Update Successfully!\", timer: 1000, showConfirmButton: false });\r\n });\r\n}",
"optionClickedStaff(optionsList) {\r\n this.getGroupStaff(optionsList);\r\n}",
"function refreshSelect() {\n if(selectedIndex == -1) {\n return;\n }\n\n if(selectFlag == \"ONE\") {\n selectUserFromList(userSelected.username, userSelected.contact_id, userSelected.id, \"CONTACT\");\n }\n else {\n selectGrpFromList(grpSelected.grpID, grpSelected.grpName);\n }\n}",
"function activate() {\n return StaffService.getAllStaffMembers().then(function (data) {\n vm.staffMembers = data;\n vm.selectedMember = data[0];\n loggerFactory.info('Staff Members: ', data);\n }, function (err) {\n loggerFactory.error('Get Staff Members: ', err);\n });\n }",
"function staffupdate()\r\n{\r\n //call the GetXmlHttpObject() to see what browser you are using\r\n xmlhttp = GetXmlHttpObject();\r\n if (xmlhttp == null) {\r\n alert(\"Browser does not support HTTP Request\");\r\n return;\r\n }\r\n\t//sets the variables that make up the URL\r\n var id = document.getElementById('id').value;\r\n\tvar name = document.getElementById('name').value;\r\n\tvar title = document.getElementById('title').value;\r\n\tvar bio = document.getElementById('bio').value;\r\n var action = \"xx\";\r\n var url = \"../includes/staffedit.php\";\r\n url = url + \"?action=\" + action;\r\n url = url + \"&id=\" + id;\r\n\t\turl = url + \"&name=\" + name;\r\n\t\turl = url + \"&title=\" + title;\r\n\t\turl = url + \"&bio=\" + bio;\r\n\t//opens and sends the HTTP request\r\n xmlhttp.open(\"GET\", url, true);\r\n xmlhttp.send(null);\r\n\t//calls the showKitsetData function when the readystate changes\r\n xmlhttp.onreadystatechange = showCubaData3;\r\n \r\n}",
"function renderStudForm(data) {\n $('#studId').val(data.id);\n $('#first_name').val(data.first_name);\n $('#last_name').val(data.last_name);\n \n $('#gender').find(`option[value=${data.gender}]`).prop('selected', true);\n $('#gender').formSelect();\n \n $('#grade').find(`option[value=${data.grade}]`).prop('selected', true);\n $('#grade').formSelect();\n \n $('#textarea_allergies').val(data.allergies);\n // add the focus to the alleriges so the test does not lay ontop of the lable\n $('#textarea_allergies').focus();\n // change back to first name so focus is at top of form\n $('#first_name').focus();\n }",
"function setSavedState() {\n const state = JSON.parse(localStorage.getItem('collecting_together_form'));\n if (state) {\n cfSelect.value = state.cf ? state.cf : '';\n gfSelect.value = state.gf ? state.gf : '';\n mfSelect.value = state.mf ? state.mf : '';\n amSelect.value = state.am ? state.am : '';\n }\n }",
"function applyStaffDataChanges(){\n var linecount = document.getElementById(\"linecount\").value;\n var linecolor = document.getElementById(\"linecolor\").value;\n var mode = document.getElementById(\"mode\").value;\n \n if(linecount && linecount != \"none\"){\n currentStaff.linecount = linecount;\n }\n if(linecolor && linecolor != \"none\"){\n currentStaff.linecolor = linecolor;\n }\n if(mode && mode != \"none\"){\n currentStaff.mode = mode;\n }\n document.getElementById(\"input\").innerHTML = staffDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function select_meal_in_meal_list(meal_id) {\n // Only do this if not in edit mode\n if (!is_edit_mode) {\n // Chage the current meal to the newly selected/clicked meal\n set_current_meal(meal_id);\n\n current_meal.is_calendar_meal = false;\n\n // Populate the meal editor with the current meal\n populate_meal_editor(current_meal);\n\n // Set that you're selecting a meal from the meal list\n is_selected_meal_from_meal_list = true;\n\n // Highlight the selected/clicked meal\n highlight_current_meal(meal_id, true);\n }\n}",
"fillForm(fSalut) {\n this.salutationForm.setValue({\n firstname: fSalut.firstname,\n gender: fSalut.gender,\n // language: fSalut.language,\n language: this.convertLanguage(fSalut.language),\n lastname: fSalut.lastname,\n letterSalutation: fSalut.letterSalutation,\n salutation: fSalut.salutation,\n salutationTitle: fSalut.salutationTitle,\n title: fSalut.title,\n });\n }",
"function setCurrent(){\n //Set local storage items\n \n localStorage.setItem('currentMiles', $(this).data('miles'));\n localStorage.setItem('currentDate', $(this).data('date'));\n \n \n //Insert the above values in edit form\n $('#editMiles').val(localStorage.getItem('currentMiles'));\n $('#editDate').val(localStorage.getItem('currentDate'));\n }",
"function saveEmpleadoStaff(){\n\tvar empleado_staff = $('#staff_empleado').val();\n\tvar tarea_staff = $('#staff_tarea').val();\n\tvar estado_staff = $('#estado_staff_empleado').val();\n\tvar staff_codigo = $('#id_staff').val();\n\tvar evento_codigo = $('#evento_codigo').val();\n\tvar url =$('.save_staff_empleado').attr('id');\n\turl = url+'?staff_codigo='+staff_codigo+'&staff_empleado='+empleado_staff+'&tarea_codigo='+tarea_staff+'&activo='+estado_staff+'&evento_codigo='+evento_codigo;\n\t$.post(url, function( data ) {\n\t\t$.pjax.reload({\n container:\"#staff_evento\",\n replace: false,\n push:false,\n timeout:5000\n });\n\t\ttoastr.success('<div style=\"font-size:16px\">Se ha actualizado el staff exitosamente.</div>');\n\n\t}).fail(function() {\n\t toastr.error('<div style=\"font-size:16px\">Ocurrió un error al actualizar.</div>');\n \t});\n\t$('#staff_empleado').val('').trigger('change');\n\t$('#staff_tarea').val('').trigger('change');\n\t$('#estado_staff_empleado').val('').trigger('change');\n\t$('#id_staff').val(0);\n\n}",
"function SP_SelectOriginatorLaunched()\n{\n \tvar oListOriginator = document.getElementById(\"mastercontrol.task.originator\"); \n\tvar sCurrentUser = document.getElementById(\"mastercontrol.form.currentuser\").value.toLowerCase();\n\tvar i;\n\tvar sItemValue = \"\";\n\tfor (i=0; i<oListOriginator.length;i++)\n\t{\n\t\tsItemValue = oListOriginator[i].value;\n\t\tif (sItemValue.toLowerCase() === sCurrentUser)\n\t\t{\n oListOriginator.selectedIndex = i;\n\t\t\t break; \n }\n\t} \n}"
] | [
"0.6330211",
"0.6120926",
"0.6079444",
"0.5784053",
"0.57264775",
"0.57064766",
"0.5625",
"0.5576152",
"0.5551675",
"0.5512408",
"0.5479664",
"0.5473718",
"0.54386705",
"0.5428659",
"0.53851527",
"0.5380228",
"0.53154707",
"0.5297902",
"0.52948344",
"0.52673614",
"0.5265763",
"0.5264245",
"0.5236346",
"0.52349925",
"0.51988333",
"0.5192894",
"0.5164143",
"0.5153403",
"0.51455927",
"0.5107406"
] | 0.6225552 | 1 |
Set the selected clef to be current clef according to the form and reload it. | function applyCurrentClef(){
currentClefIndex = document.getElementById("clef").value;
document.getElementById("input").innerHTML = clefDataChangeForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updatePreviewWithClef(sender, clef) {\r\n // console.log(\"clef changed to \" + clef)\r\n selectedClef = clef\r\n updateNotesSVG()\r\n}",
"function setCurrent(current) {\n deselectFeature();\n\n $.each($(\"#editorFeatures\").find(\"div.panel-body div input\"), function (index, input) {\n $(input).val(\"\");\n });\n\n _current = current;\n\n selectFeature();\n}",
"function toChangeClefData(){\n currentClefIndex = 0;\n document.getElementById(\"input\").innerHTML = clefDataChangeForm();\n}",
"function changeFree() {\n //Set init data\n if (settings.initData === undefined) {\n settings.initData = {\n curp: $(curpInput).val()\n };\n }\n\n //Set old function\n settings.oldFunction = \"curp\";\n\n $(element).html(\"\");\n $(element).formDatos(settings);\n }",
"function setSavedState() {\n const state = JSON.parse(localStorage.getItem('collecting_together_form'));\n if (state) {\n cfSelect.value = state.cf ? state.cf : '';\n gfSelect.value = state.gf ? state.gf : '';\n mfSelect.value = state.mf ? state.mf : '';\n amSelect.value = state.am ? state.am : '';\n }\n }",
"function setCurrent(){\n\t\t//set ls items\n\t\tlocalStorage.setItem('currentMiles', $(this).data('miles'));\n\t\tlocalStorage.setItem('currentDate', $(this).data('date'));\n\n\t\t//insert into the edit form\n\t\t$('#editMiles').val(localStorage.getItem('currentMiles'));\n\t\t$('#editDate').val(localStorage.getItem('currentDate'));\n\t}",
"function reload(){\n\t\t$(\".form_action\").val(\"\");\n\t\t$(\".form_detail\").html(\"\");\n\t\t\n\t\t}",
"function ccls_change() {\r\n GM_setValue('Context',csel.childNodes[csel.selectedIndex].value);\r\n}",
"function changeFree() {\n //Set init data\n if (settings.initData === undefined) {\n settings.initData = {\n curp: $(curpInput).val(),\n nombre: $(nombreInput).val(),\n aPaterno: $(aPaternoInput).val(),\n aMaterno: $(aMaternoInput).val(),\n sexo: $(sexoInput1).is(\":checked\") ? $(sexoInput1).val() : $(sexoInput2).val(),\n fNacimiento: {\n dia: $(fNacimientoDiaInput).val(),\n mes: $(fNacimientoMesInput).val(),\n anio: $(fNacimientoAnioInput).val()\n },\n eNacimiento: $(eNacimientoInput).val()\n };\n }\n\n //Set old function\n settings.oldFunction = \"datos\";\n\n $(element).html(\"\");\n $(element).formDatos(settings);\n }",
"switchToFaveConv() {\n\t\tif(this.m_faves.category !== \"\") {\n\t\t\tthis.m_catMenu.value = this.m_faves.category;\n\t\t\tthis.populateUnitMenus();\n\t\t\tthis.m_unitAMenu.value = this.m_faves.unitA;\n\t\t\tthis.m_unitBMenu.value = this.m_faves.unitB;\n\t\t\tthis.updateStar(0);\n\t\t}\n\t}",
"function setClearForm()\r\n{\r\n $(\".clearForm\").each(function()\r\n {\r\n $(this).click(function()\r\n {\r\n var targetFormId = $(this).attr(\"name\");\r\n if (targetFormId != undefined)\r\n {\r\n var targetForm = $(\"#\" + targetFormId);\r\n targetForm.find(\"input[type=text]\").val(\"\");\r\n targetForm.find(\"select option:first-child\").prop(\"selected\", \"selected\");\r\n targetForm.find(\"input[type=checkbox]\").prop(\"checked\", false);\r\n }\r\n });\r\n });\r\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 abrirFormCanelarCita(){\n\t\n\t$(\"#motivoCancelacion\").val(\"\");\n\t\n\t$(\"#label_motivoCancelacion\").removeClass(\"active\");\n\t$(\"#motivoCancelacion\").removeClass(\"valid\");\n\t$(\"#motivoCancelacion\").removeClass(\"invalid\");\n\t\n\t$(\"#divHiddenCancelarCita\").show(\"slower\");\n\n}",
"function resetform()\n{\n\t\t\t$('#note_title').val('');\n\t\t\t$('#note_text').val('');\n\t\t\t$('#note_quotes').val('');\n\t\t\tdocument.getElementById('note_quotes').focus();\n\t\t\tdocument.getElementById('note_text').focus();\n\t\t\tdocument.getElementById('note_title').focus();\n\t\t\t$('#warning').html('');\n\t\t\tdocument.noteform.note_category.options[0].selected=true;\n\t\t\tcurNote=null;\t\t\n}",
"function setCurrent(){\n //Set local storage items\n \n localStorage.setItem('currentMiles', $(this).data('miles'));\n localStorage.setItem('currentDate', $(this).data('date'));\n \n \n //Insert the above values in edit form\n $('#editMiles').val(localStorage.getItem('currentMiles'));\n $('#editDate').val(localStorage.getItem('currentDate'));\n }",
"function selection(){\n $('#selectionPraticien').ready(function(){\n $('#selectionPraticien').change(function(){\n optionSelected = $(this).find(\".choixPraticien:selected\");\n idPraticien = optionSelected.attr('id');\n nomPraticien = optionSelected.val();\n $('#form_nomPraticien').val(nomPraticien);\n $('#form_praticien').val(idPraticien);\n $('#selectionPraticien').remove();\n });\n });\n}",
"function vider_examenBio_selectionne(id) {\n\t$(\"#SelectExamenBio_\"+id+\" option[value='']\").attr('selected','selected');\n\t$(\"#noteExamenBio_\"+id+\" input\").val(\"\");\n}",
"function limpiar() {\n\t\t\n\t\t$(\"#nresolucion\").val(\"\");\n\t\t$(\"#nproyecto\").val(\"\");\n\t\t$(\"#id_motivo\").selectpicker('refresh');//refrescamos el motivo\n\t\t$(\"#id_area\").val(\"\");\n\t\t$(\"#est\").val(\"\");\n\t\t$(\"#f_emision\").val(\"\");\n\t\t$(\"#id_resolucion\").val(\"\");\n\t}",
"function restore_options() {\n chrome.storage.sync.get(['lang'], function (result) {\n let lang = result.lang;\n if (lang !== undefined) {\n document.querySelector(\"select#country\").value = lang;\n let elems = document.querySelectorAll('select');\n let instances = M.FormSelect.init(elems);\n }\n });\n}",
"function cadSelect() {\n //clearing selected node\n $(\"img.CAD\").each(function(){\n $(this).hide();\n });\n console.log(\"Clearing selection... \");\n //assigning new selected CAD\n $(\"#\"+ currentCad).show();\n console.log(\"New selected Cad is:\" + currentCad);\n }",
"function sync() {\n $('.competition-closed-form .text').each(function(i, v){\n var $this = $(this);\n $this.val(_[v.name]);\n });\n }",
"function restore_options() {\n\n left.value \t= localStorage[\"left\"];\n right.value \t= localStorage[\"right\"];\n tops.value \t= localStorage[\"tops\"];\n bottom.value \t= localStorage[\"bottom\"];\n\n //alert(\"Test\");\n /* var select = document.getElementById(\"color\");\n for (var i = 0; i < select.children.length; i++) {\n var child = select.children[i];\n if (child.value == favorite) {\n child.selected = \"true\";\n break;\n }\n }*/\n}",
"function resetContentForm () {\n\t $(\"#contentId\").val('');\n\t $(\"#selectComponentId\").val('');\n\t $(\"#txtUrl\").val('');\n\t $(\"#txtTitle\").val('');\n\t if (tinymce.get('txtContent') != null) {\n\t\t tinymce.get('txtContent').setContent ('');\n\t }\t \n\t document.getElementById (\"chkStatusContent\").checked = true;\n\t}",
"function fulfilchoice(){\n $('input.fulfilhash').replaceWith(\n $('<select>').addClass('fulfilhash').append(\n '<option value=\"\" disabled=\"disabled\" selected=\"selected\">select a fulfil</option>'\n // Update form when fulfil is selected.\n ).change(function(e){\n var select = $(e.target);\n var fulfil = fulfils[select.val()];\n var proposal = proposals[fulfil.proposalhash];\n var form = select.parent();\n var give = form.find('div.give');\n var take = form.find('div.take');\n give.find('select.colordef').val(proposal['give']['colordef']);\n give.find('input.quantity').val(proposal['give']['quantity']);\n give.find('textarea.utxos').val(JSON.stringify(proposal['give']['utxos']));\n take.find('select.colordef').val(proposal['take']['colordef']);\n take.find('input.quantity').val(proposal['take']['quantity']);\n take.find('input.address').val(proposal['take']['address']);\n })\n );\n}",
"function clearForm(){\n\t$('.horario > option[value=0]').removeAttr('selected');\n\t$('.horario > option[value=0]').attr('selected', 'selected');\n\t$('.materia > option[value=0]').removeAttr('selected');\n\t$('.materia > option[value=0]').attr('selected', 'selected');\n\t$('.dia > option[value=0]').removeAttr('selected');\n\t$('.dia > option[value=0]').attr('selected', 'selected');\n}",
"function restore_options() {\n\n forEachField(function(id){\n\n val = localStorage[id];\n $('#' + id).val(val);\n\n });\n\n}",
"rmFaveConv() {\n\t\tthis.m_faves.category = \"\";\n\t\tthis.m_faves.unitA = \"\";\n\t\tthis.m_faves.unitB = \"\";\n\t\tthis.updateStar(0);\n\t}",
"function initEditContent(){\n\t\t\t\n\t\t\t\tif (idItem != '' && idItem != 'nuevo') {\n\t\t\t\t\t\t\n\t\t\t\t\t//CAMPOS DE EDICION\t\t\t\t\t\t\t\n\t\t\t\t\t $.ajax({\n\t\t\t\t\t\tdataType:'JSON',\n\t\t\t\t\t\ttype: 'POST',\n\t\t\t\t\t\turl: 'database/TipoIdentificacioneGet.php?action_type=edit&id='+idItem,\n\t\t\t\t\t\tsuccess:function(data){\n\t\t\t\t\t\t\t//INICIO DE PERSONALIZACION DE CAMPOS\n\t\t\t\t\t\t\t$('#tipo_identificacion').val(data.tipo_identificacion);\n\t\t\t\t\t\t\t$(\"#estado_tipo_identificacion\").val(data.estado_tipo_identificacion).change();\n\t\t\t\t\t\t\t//FIN DE PERSONALIZACION DE CAMPOS\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror: function(xhr) { \n\t\t\t\t\t\t\tconsole.log(xhr.statusText + xhr.responseText);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t}else{\n\t\t\t\t\t\n\t\t\t\t\t$(\"#estado_tipo_identificacion\").val(1).change().selectpicker('refresh');\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\n\t\t}",
"function restore_options() {\n var fontSize=localStorage[\"readerFontSize\"];\n if(fontSize){\n \t$(\"#fontsize\").val(fontSize);\n }\n\n var font = localStorage[\"readerFont\"];\n if (!font) {\n return;\n }\n var select = $(\"#fonts\");\n for (var i = 0; i < select.children().length; i++) {\n var child = select.children()[i];\n if ($(child).val() == font) {\n $(child).attr('selected', \"true\");\n break;\n }\n }\n\n}",
"function carga() {\n\n var concepto = $(\"#concepto option:selected\").text();\n $(\"#concepto-res\").val(concepto);\n\n}"
] | [
"0.62188315",
"0.60764533",
"0.5962494",
"0.59495044",
"0.5940669",
"0.5797134",
"0.5691537",
"0.5642058",
"0.5637858",
"0.55275893",
"0.5476251",
"0.5464947",
"0.54585445",
"0.54477674",
"0.5432277",
"0.54301274",
"0.54079443",
"0.5403106",
"0.53918",
"0.53680503",
"0.53675354",
"0.5339454",
"0.53340834",
"0.5325281",
"0.532037",
"0.5319064",
"0.53173596",
"0.52905554",
"0.5287731",
"0.52768356"
] | 0.63718075 | 0 |
Set the selected syllable to be current syllable according to the form and reload it. | function applyCurrentSyllable(){
currentSyllableIndex = document.getElementById("syllable").value;
document.getElementById("input").innerHTML = syllableDataChangeForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toChangeSyllableData(){\n if(syllables.length > 0){\n currentType = syllables[0].type;\n currentColor = syllables[0].color;\n }\n pushedNeumeVariations = false;\n document.getElementById(\"input\").innerHTML = syllableDataChangeForm();\n}",
"function applySyllableDataChanges(){\n \n var page = document.getElementById(\"page\").value;\n var line = document.getElementById(\"line\").value;\n var staff = document.getElementById(\"staff\").value;\n var syllable = document.getElementById(\"syllabletext\").value;\n var initial = document.getElementById(\"initial\").checked;\n var color = document.getElementById(\"color\").value;\n var comment = document.getElementById(\"comment\").value;\n \n if(page){\n currentSyllable.page = page;\n }\n if(line){\n currentSyllable.line = line;\n }\n \n if(staff){\n currentSyllable.staff = staff;\n }\n \n if(syllable){\n currentSyllable.syllable = syllable;\n }\n \n currentSyllable.initial = initial;\n \n if(color && color != \"none\"){\n currentSyllable.color = color;\n }\n \n if(comment){\n currentSyllable.comment = comment;\n }\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n document.getElementById(\"input\").innerHTML = syllableDataChangeForm();\n createSVGOutput();\n}",
"function setLang() {\n\n // first update text fields based on selected mode\n var selId = $(\"#mode-select\").find(\":selected\").attr(\"id\");\n setText(\"text-timedomain\",\n \"Zeitbereich: \" + lang_de.text[selId],\n \"Time domain: \" + lang_en.text[selId]);\n setText(\"text-headline-left\",\n \"Federpendel: \" + lang_de.text[selId],\n \"Spring Pendulum: \" + lang_en.text[selId]);\n\n // then loop over all ids to replace the text\n for(var id in Spring.langObj.text) {\n $(\"#\"+id).text(Spring.langObj.text[id].toLocaleString());\n }\n // finally, set label of language button\n // $('#button-lang').text(Spring.langObj.otherLang);\n $('#button-lang').button(\"option\", \"label\", Spring.langObj.otherLang);\n }",
"function _updateLabelFor(){\n\t\tvar aFields = this.getFields();\n\t\tvar oField = aFields.length > 0 ? aFields[0] : null;\n\n\t\tvar oLabel = this._oLabel;\n\t\tif (oLabel) {\n\t\t\toLabel.setLabelFor(oField); // as Label is internal of FormElement, we can use original labelFor\n\t\t} else {\n\t\t\toLabel = this.getLabel();\n\t\t\tif (oLabel instanceof Control /*might also be a string*/) {\n\t\t\t\toLabel.setAlternativeLabelFor(oField);\n\t\t\t}\n\t\t}\n\t}",
"function toSyllable(){\n if(syllables.length > 1){\n currentColor = syllables[syllables.length-1].color;\n }\n document.getElementById(\"input\").innerHTML = syllableForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n}",
"function reloadOption(lang)\r\n{\r\n\t\tdocument.getElementById('firsttxt').textContent = lang.optiontxt;\r\n\t\tdocument.getElementById('secondtxt').textContent = lang.optiontxt2;\r\n\t\tcheck_for_update(lang);\r\n}",
"function updateDropdownLabel() {\n // code goes here\n semesterDropLabel.innerHTML = semester\n}",
"changeLblTxt(newTxt) {\r\n this.HTMLElement.textContent = newTxt;\r\n }",
"set _label(value) {\n Helper.UpdateInputAttribute(this, \"label\", value);\n }",
"set _label(value) {\n Helper.UpdateInputAttribute(this, \"label\", value);\n }",
"updateLabel() {\n this.text = this._text;\n }",
"updateLabel() {\n this.text = this._text;\n }",
"function deleteSyllable(){\n syllables.splice(currentSyllableIndex, 1);\n \n currentSyllableIndex = 0;\n \n document.getElementById(\"input\").innerHTML = syllableDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function updateOption(whatToUpdate){\n var currInd = GlistOptions.selectedIndex;\n var updateInd = 0;\n var newTextStr = \"\";\n \n if (whatToUpdate == \"Label\"){\n newTextStr = GtfLabel.value;\n } else {\n updateInd = 1;\n newTextStr = GtfURL.value;\n if (GtfLabel.value.indexOf(TEXT_defaultItemText)==0) { //if default label, change to simple file name\n var startPos = newTextStr.lastIndexOf(\"/\");\n var endPos = newTextStr.lastIndexOf(\".\");\n if (endPos > 0) {\n GtfLabel.value = newTextStr.substring(startPos+1,endPos);\n updateOption('Label');\n }\n }\n }\n GarrMenuOptions[currInd][updateInd] = newTextStr;\n populateMenuOptions(currInd);\n}",
"function onchange() {\n\n updateLanguage();\n\n}",
"function tx_pttools_formTemplateHandler_setchoice(fname)\n{\n\tvar selname = \"choices-\" + fname;\n\tvar selector = document.getElementById(selname);\n\tdocument.getElementById(fname).value\n\t\t= selector.options[selector.selectedIndex].text;\n\treturn true;\n}",
"function assignLabel(labelName, tableName, sysId, viewName) {\n var url = new GlideAjax(\"LabelsAjax\");\n url.addParam(\"sysparm_name\", tableName);\n url.addParam(\"sysparm_value\", sysId);\n url.addParam(\"sysparm_chars\", labelName);\n url.addParam(\"sysparm_type\", \"create\");\n if (viewName)\n url.addParam(\"sysparm_view\", viewName);\n url.getXML(refreshNav);\n}",
"#updateLabel() {\n this.container.querySelector('.label').innerHTML = this.label;\n }",
"function _updateLabelFor(){\n\n\t\tvar oField = this._getFieldRelevantForLabel();\n\n\t\tif (oField) {\n\t\t\tif (this._oLabel) {\n\t\t\t\tthis._oLabel.setLabelFor(oField); // as Label is internal of FormElement, we can use original labelFor\n\t\t\t}\n\t\t\treturn; // use SmartField logic\n\t\t}\n\n\t\tvar aFields = this.getFields();\n\t\toField = aFields.length > 0 ? aFields[0] : null;\n\n\t\tif (oField instanceof VBox) {\n\t\t\tvar aItems = oField.getItems();\n\t\t\tif (aItems[1] instanceof HBox) {\n\t\t\t\toField = aItems[1].getItems()[0];\n\t\t\t} else {\n\t\t\t\toField = aItems[1];\n\t\t\t}\n\t\t}\n\n\t\tvar oLabel = this._oLabel;\n\t\tif (oLabel) {\n\t\t\toLabel.setLabelFor(oField); // as Label is internal of FormElement, we can use original labelFor\n\t\t} else {\n\t\t\toLabel = this.getLabel();\n\t\t\tif (oLabel instanceof sap.ui.core.Control /*might also be a string*/) {\n\t\t\t\toLabel.setAlternativeLabelFor(oField);\n\t\t\t}\n\t\t}\n\n\t}",
"function updateLabel(text){\n\n\tif(labelEl === undefined){\n\n\t\thint = document.createElement(\"li\"); \n hint.setAttribute('id', 'safeSave');\n hint.setAttribute('style', 'padding-left: 0.5em; color: blue; font-decoration: italic; '); //float: right;\n hint.appendChild(document.createTextNode('...'));\n\n\n\t\tseparator = document.createElement('img');\n\t\t\tseparator.setAttribute('src', 'web-pub/component/grid/images/seperator.jpg');\n\t\t\tseparator.setAttribute('class', 'separator');\n\n\t\tsepLi = document.createElement(\"li\"); \n \tsepLi.appendChild(separator);\n\n\n\n \ttoolbar = document.getElementById('toolbar').getElementsByTagName('ul')[0];\n\n\t\ttoolbar.appendChild(sepLi);\n \ttoolbar.appendChild(hint);\t\t\n\t}\n\n\tlabelEl = document.getElementById('safeSave');\n\n\tlabelEl.innerHTML = text;\n\n}",
"function updateFieldLabel (event) {\n lib.updateActiveFieldLabel(this.value);\n }",
"function labelChange(value){\n\t$(\"#\" + selected ).removeClass(\"userSelect\");\n\t$(\"#\" + value + \"Select\").addClass(\"userSelect\");\n\tselected = value + \"Select\";\n}",
"function setLocalizedLabel() {\n var getI18nMsg = chrome.i18n.getMessage;\n\n $('save_button').innerText = 'save'; //getI18nMsg('save');\n// $('delete_button').value = 'delete'; //getI18nMsg('deleteTitle');\n deleteLabel = 'delete';\n $('submit_button').value = 'add'; //getI18nMsg('submitButton');\n}",
"function restoreLabelState(label){\n\t\t\t\t\n\t\t\t\t\tvar token = labelMap[label];\n\t\t\t\t\t\n\t\t\t\t\tif(token === undefined){\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tvar newsize = token.size;\n\t\t\t\t\tvar newbrushType = token.brushType;\n\t\t\t\t\tvar newbrushShape = token.brushShape;\n\t\t\t\t\t\n\t\t\t\t\tif (token.invisible == true){\n\t\t\t\t\t\tdocument.getElementById('btn-visibility-brush').innerHTML = 'Reveal';\n\t\t\t\t\t}else{\n\t\t\t\t\t\tdocument.getElementById('btn-visibility-brush').innerHTML = 'Hide';\n\t\t\t\t\t}\n\t\t\t\t\t//make sure brushshape is round or square\n\t\t\t\t\tif((token.brushShape === 'round') || (token.brushShape === 'square')){\n\t\t\t\t\t\tbrushShape = token.brushShape;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t//error brush type\n\t\t\t\t\t\tconsole.log(\"error brush shape lookup\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t//update the size\n\t\t\t\t\tvar slider = document.getElementById(\"size_input\");\n\t\t\t\t\tslider.value = newsize;\n\t\t\t\t\t\n\t\t\t\t\t//update brush type\n\t\t\t\t\tbrushShape = newbrushShape;\n\t\t\t\t\t\n\t\t\t\t\tindBrush.setBrushType(newbrushType);\n\t\t\t\t\t\n\t\t\t\t\t//update label\n\t\t\t\t\tdocument.getElementById('labelTextInput').value = label;\n\t\t\t\t\tupdateMsg();\n\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\tif (brushShape === 'square') {\n\t\t\t\t\t\tdocument.getElementById('btn-shape-brush').innerHTML = 'Circle Brush';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdocument.getElementById('btn-shape-brush').innerHTML = 'Square Brush';\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}",
"set label(label) {\n if (typeof label == s && s.length > 0) {\n this.element.setAttribute('label', label);\n }\n }",
"function updateYlabel() {\n if (options.ylabel && ylabel) {\n ylabel.text(options.ylabel);\n } else {\n ylabel.style(\"display\", \"none\");\n }\n }",
"function lsLimpaLabel( input )\r\n{\r\n\tif ( input )\r\n\t{\r\n\t\tvar label = document.getElementById( 'LSLabel_' + input.id );\r\n\t\tif ( label )\r\n\t\t{\r\n\t\t\tlabel.innerHTML = '';\r\n\t\t}\r\n\t}\r\n}",
"function languageSelect(l){\n var locale = l10n[l.getAttribute('data-locale')];\n document.getElementById('dropButton').innerHTML = l.innerHTML + \" ▾\"; // set the button text to the selected option\n document.getElementById('translatorCredit').innerHTML = locale.translator ? locale.translator : l10n['en'].translator;\n document.getElementById('standardDescription').innerHTML = locale.standard ? locale.standard : l10n['en'].standard;\n document.getElementById('uniqueDescription').innerHTML = locale.unique ? locale.unique : l10n['en'].unique;\n document.getElementById('curatorString').innerHTML = locale.curators ? locale.curators : l10n['en'].curators;\n}",
"function survey_update() {\n $('#survey_type_input_custom').hide();\n // TODO test\n switch (this.selected) {\n case 'Custom':\n $('#survey_type_input_custom').show();\n $('#resno_input_single').show();\n break;\n }\n }",
"function saveLabel() {\n labelSave = true;\n labelCanc = false;\n $('#labelEditModal').modal('hide');\n}"
] | [
"0.6784174",
"0.6132346",
"0.5928821",
"0.5838092",
"0.5741207",
"0.5551991",
"0.5539273",
"0.5481438",
"0.5383608",
"0.5383608",
"0.53811604",
"0.53811604",
"0.53734535",
"0.53444487",
"0.5330527",
"0.53058916",
"0.5289711",
"0.5289358",
"0.52828467",
"0.5253412",
"0.5251887",
"0.52501124",
"0.52393085",
"0.521702",
"0.52146506",
"0.5177468",
"0.51585615",
"0.515297",
"0.51321614",
"0.5130772"
] | 0.7612395 | 0 |
Set the selected pitch index to be current pitch index according to the form and reload it. | function applyCurrentPitch(){
currentPitchIndex = document.getElementById("pitc").value;
document.getElementById("input").innerHTML = pitchDataChangeForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function applyCurrentVariation(){\n currentVarPitchIndex = document.getElementById(\"varpitch\").value;\n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n}",
"function applyCurrentOctave(){\n currentOctave = document.getElementById(\"octave\").value;\n document.getElementById(\"input\").innerHTML = pitchForm();\n}",
"function applyCurrentVarSource(){\n currentVarSourceIndex = document.getElementById(\"varsource\").value;\n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n}",
"function selectHandler(index) {\n\tif (answer['shown']) return;\n\tresetPianoKeys();\n\tpianoKeys[index].classList.add('selected');\n\tplayNote(index, index === answer['index'] ? error : 0);\n\tsubmitButton.disabled = false;\n}",
"onUpKey() {\n var len = this.opt.choices.realLength;\n this.selected = this.selected > 0 ? this.selected - 1 : len - 1;\n this.render();\n }",
"onUpKey() {\n var len = this.opt.choices.realLength;\n this.selected = this.selected > 0 ? this.selected - 1 : len - 1;\n this.render();\n }",
"function spiralizePick(e) {\n var spiralIndex = 1 + this.selectedIndex;\n var spiralOption = this.options[this.selectedIndex].text;\n\n document.getElementById('spiralDesc').value = spiralIndex + ':' + spiralOption;\n\n// document.getElementById('spiralDesc').value = spiralSaved.selected;\n\n console.log(\"OBJ-P\", spiralSaved[1].xOrg);\n\n document.getElementById('xOrg').value = spiralSaved[spiralIndex].xOrg;\n document.getElementById('yOrg').value = spiralSaved[spiralIndex].yOrg;\n document.getElementById('aSca').value = spiralSaved[spiralIndex].aSca;\n document.getElementById('pPow').value = spiralSaved[spiralIndex].pPow;\n document.getElementById('cSca').value = spiralSaved[spiralIndex].cSca;\n document.getElementById('iSca').value = spiralSaved[spiralIndex].iSca;\n document.getElementById('jSca').value = spiralSaved[spiralIndex].jSca;\n document.getElementById('kSca').value = spiralSaved[spiralIndex].kSca;\n document.getElementById('bSca').value = spiralSaved[spiralIndex].bSca;\n document.getElementById('qPow').value = spiralSaved[spiralIndex].qPow;\n document.getElementById('nTurns').value = spiralSaved[spiralIndex].nTurns;\n document.getElementById('sSteps').value = spiralSaved[spiralIndex].sSteps;\n\n// update the selected radio btn\n spiralSelected = spiralSaved[spiralIndex].selected;\n radiobtn = document.getElementById(spiralSelected);\n radiobtn.checked = true;\n\n\n}",
"function refreshIndex () {\n ctrl.selectedIndex = getNearestSafeIndex(ctrl.selectedIndex);\n ctrl.focusIndex = getNearestSafeIndex(ctrl.focusIndex);\n }",
"function refreshIndex () {\n ctrl.selectedIndex = getNearestSafeIndex(ctrl.selectedIndex);\n ctrl.focusIndex = getNearestSafeIndex(ctrl.focusIndex);\n }",
"function refreshIndex () {\n ctrl.selectedIndex = getNearestSafeIndex(ctrl.selectedIndex);\n ctrl.focusIndex = getNearestSafeIndex(ctrl.focusIndex);\n }",
"function refreshIndex () {\n ctrl.selectedIndex = getNearestSafeIndex(ctrl.selectedIndex);\n ctrl.focusIndex = getNearestSafeIndex(ctrl.focusIndex);\n }",
"function setPitch(\r\n pitch_)\r\n {\r\n pitch = pitch_;\r\n }",
"function setPresets() {\n\n //check the buttons id, whatever id it has is the preset it needs to select\n let myID = event.srcElement.id;\n presetID = myID\n\n let idArray = myID.split(\" \")\n let seqID = parseInt(idArray[0]) + 1\n let preID = idArray[1]\n\n console.log(seqID, preID)\n\n let whichButton = {...userPresets[seqID][preID]};\n\n // deep clone an array of arrays\n let setSequence = whichButton.sequence.map(i => ([...i]));\n let setEnvelope = {...whichButton.envelope};\n\n let setAttack = setEnvelope.attack\n let setDecay = setEnvelope.decay\n let setSustain = setEnvelope.sustain\n let setRelease = setEnvelope.release\n\n let setWaveform = whichButton.waveform;\n waveform = setWaveform\n let setPitchScheme = whichButton.pitchArray;\n console.log(setPitchScheme)\n \n userSequencer[seqID-1].polyMatrix = setSequence;\n userSequencer[seqID-1].polyNotes = setPitchScheme;\n\n userSynth[seqID-1].set({\n 'oscillator': {\n 'type': setWaveform\n },\n 'envelope': {\n 'attack': setAttack,\n 'decay': setDecay,\n 'sustain': setSustain,\n 'release': setRelease\n }\n });\n\n attackSlider[seqID - 1].value(setAttack);\n decaySlider[seqID - 1].value(setDecay);\n sustainSlider[seqID - 1].value(setSustain);\n releaseSlider[seqID - 1].value(setRelease);\n \n userSequencer[seqID - 1].drawMatrix();\n userSequencer[seqID - 1].polyMatrixNotes();\n\n let placeholderString = setPitchScheme.toString();\n let newPitchString = placeholderString.replace(/,/g, ' ')\n pitchInput[seqID - 1].attribute(\"placeholder\", newPitchString)\n\n waveInput[seqID - 1].attribute(\"placeholder\", setWaveform)\n \n //When Votes selected\n if (whichButton.haveVoted === false){\n yesButton[seqID - 1].show();\n noButton[seqID - 1].show();\n questionP[seqID - 1].show();\n voteP[seqID - 1].hide();\n }else{\n yesButton[seqID - 1].hide();\n noButton[seqID - 1].hide();\n questionP[seqID - 1].hide();\n voteP[seqID - 1].show();\n }\n}",
"function pitchUpdate()\n{\n pitchHistory[9] = -currentFrequency;\n pitchHistory.shift();\n}",
"function applyPitchDataChanges(){\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"connection\").value;\n var tilt = document.getElementById(\"tilt\").value;\n var variation = document.getElementById(\"variation\").value;\n var supplied = document.getElementById(\"supplied\").value;\n \n if(pitch && pitch != \"none\"){\n currentPitch.pitch = pitch;\n }\n if(octave && octave != \"none\"){\n currentPitch.octave = octave;\n }\n if(comment && comment != \"none\"){\n currentPitch.comment = comment;\n }\n if(intm && intm != \"none\"){\n currentPitch.intm = intm;\n }\n if(connection && connection != \"none\"){\n currentPitch.connection = connection;\n }\n if(tilt && tilt != \"none\"){\n currentPitch.tilt = tilt;\n }\n if(variation && variation != \"none\"){\n currentPitch.variation = variation;\n }\n if(supplied && supplied != \"none\"){\n currentPitch.supplied = supplied;\n }\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function matchFormToModel() {\n maxspdslider[0].value = tsdParams.maxspdslider;\n\t scaleslider[0].value = tsdParams.scaleslider;\n }",
"function setUpForm (index) {\n $(\"#layerIndex\").text(index);\n $(\"#units\").val(importedData[index]['units']); \n}",
"function refreshIndex(){ctrl.selectedIndex=getNearestSafeIndex(ctrl.selectedIndex);ctrl.focusIndex=getNearestSafeIndex(ctrl.focusIndex);}",
"function toChangePitchData(){\n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n createSVGOutput();\n}",
"function deletePitch(){\n currentNeume.pitches.splice(currentPitchIndex, 1);\n \n currentPitchIndex = 0;\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"choosenPersonToEdit(index) {\n this.setState({\n chosenIndexToEdit: index\n });\n }",
"onKeypress() {\n var index = this.rl.line.length ? Number(this.rl.line) - 1 : 0;\n\n if (this.opt.choices.getChoice(index)) {\n this.selected = index;\n } else {\n this.selected = undefined;\n }\n\n this.render();\n }",
"onKeypress() {\n var index = this.rl.line.length ? Number(this.rl.line) - 1 : 0;\n\n if (this.opt.choices.getChoice(index)) {\n this.selected = index;\n } else {\n this.selected = undefined;\n }\n\n this.render();\n }",
"function select(index){//-- force form to update state for validation\n\t$mdUtil.nextTick(function(){getDisplayValue(ctrl.matches[index]).then(function(val){var ngModel=elements.$.input.controller('ngModel');ngModel.$setViewValue(val);ngModel.$render();})[\"finally\"](function(){$scope.selectedItem=ctrl.matches[index];setLoading(false);});},false);}",
"switchLyricIndex(state, index) {\n\t\t\t\t\tstate.songState.currentLyricIndex = index;\n\t\t\t\t}",
"function createPitch(){\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"connection\").value;\n var tilt = document.getElementById(\"tilt\").value;\n var variation = document.getElementById(\"variation\").value;\n var supplied = document.getElementById(\"supplied\").value;\n \n var p = new Pitch(pitch, octave, comment, intm, connection, tilt, variation, supplied);\n currentNeume.pitches.push(p);\n \n if(currentNeume.type == \"virga\" || currentNeume.type == \"punctum\"){\n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(currentNeume.type == \"pes\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"clivis\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"torculus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"porrectus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"climacus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n if(maxPitches == 4 || maxPitches == 5){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else{\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(pitchCounter == 3)\n {\n if(maxPitches == 5){\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else{\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(pitchCounter == 4)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"scandicus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else if(currentNeume.type == \"torculusresupinus\"){\n if(pitch == \"none\" && pitchCounter == 0){\n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"d\";\n currentNeume.pitches.push(p);\n \n p = new Pitch(pitch, octave, comment, intm, connection, tilt);\n p.intm = \"u\";\n currentNeume.pitches.push(p);\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n else if(pitchCounter == 0){\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 1)\n {\n currentIntm = \"d\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 2)\n {\n currentIntm = \"u\";\n pitchCounter++;\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n else if(pitchCounter == 3)\n {\n currentIntm = \"none\";\n pitchCounter = 0;\n \n if(isNeumeVariant){\n document.getElementById(\"input\").innerHTML = neumeVariationForm();\n }\n else{\n document.getElementById(\"input\").innerHTML = neumeForm();\n }\n }\n }\n else{\n document.getElementById(\"input\").innerHTML = pitchForm();\n }\n \n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function select (index) {\n //-- force form to update state for validation\n $mdUtil.nextTick(function () {\n getDisplayValue(ctrl.matches[ index ]).then(function (val) {\n var ngModel = elements.$.input.controller('ngModel');\n ngModel.$setViewValue(val);\n ngModel.$render();\n }).finally(function () {\n $scope.selectedItem = ctrl.matches[ index ];\n setLoading(false);\n });\n }, false);\n }",
"function select (index) {\n //-- force form to update state for validation\n $mdUtil.nextTick(function () {\n getDisplayValue(ctrl.matches[ index ]).then(function (val) {\n var ngModel = elements.$.input.controller('ngModel');\n ngModel.$setViewValue(val);\n ngModel.$render();\n }).finally(function () {\n $scope.selectedItem = ctrl.matches[ index ];\n setLoading(false);\n });\n }, false);\n }",
"function select (index) {\n //-- force form to update state for validation\n $mdUtil.nextTick(function () {\n getDisplayValue(ctrl.matches[ index ]).then(function (val) {\n var ngModel = elements.$.input.controller('ngModel');\n ngModel.$setViewValue(val);\n ngModel.$render();\n }).finally(function () {\n $scope.selectedItem = ctrl.matches[ index ];\n setLoading(false);\n });\n }, false);\n }",
"function setSelectedIndex(idx) {\n if (idx != selectedIndex) {\n selectedIndex = idx;\n triggerItemSelected(getSelectedItem());\n }\n }"
] | [
"0.6336565",
"0.5809133",
"0.55543834",
"0.54844683",
"0.53527266",
"0.53527266",
"0.53513706",
"0.53462267",
"0.53462267",
"0.53462267",
"0.53462267",
"0.533309",
"0.5288151",
"0.5266077",
"0.52589005",
"0.5233567",
"0.51925147",
"0.51778054",
"0.51749754",
"0.5151192",
"0.51126474",
"0.5086314",
"0.5086314",
"0.50820076",
"0.507575",
"0.506626",
"0.505765",
"0.505765",
"0.505765",
"0.50515324"
] | 0.6773352 | 0 |
Set the selected octave to be current octave according to the form and reload it. | function applyCurrentOctave(){
currentOctave = document.getElementById("octave").value;
document.getElementById("input").innerHTML = pitchForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setOctave(keyAdjust) {\n\tvar octaves = document.getElementsByName('octave');\n\tvar octaveSet = \"\";\n\n\t//find which octave button is selected\n\tfor(var i = 0; i < octaves.length; i++){\n\t if(octaves[i].checked){\n\t octaveSet = octaves[i].value;\n\t }\n\t}\n\t\n\t//if it's a positive octave change (octave up)\n\tif (octaveSet.substring(0,1) === '+') {\n\t\t//find value of change\n\t\tvar octaveUpAmount = octaveSet.substring(1,2);\n\n\t\t//change string to number for manipulation\n\t\tvar octaveUp = parseInt(octaveUpAmount);\n\n\t\t//find original value\n\t\tvar calcUpOctave = parseInt(keyAdjust.charAt(keyAdjust.length-1));\n\n\t\t//add both value to make the octave change\n\t\tvar octaveUpChange = octaveUp + calcUpOctave;\n\n\t\t//convert back to string for freq conversion\n\t\tkeyAdjust = keyAdjust.substring(0, keyAdjust.length-1) + octaveUpChange.toString();\n\t\t\n\t\tmakeMusic(keyAdjust);\n\t};\n\n\t//octave down\n\tif (octaveSet.substring(0,1) === '-') {\n\t\t//find value of change\n\t\tvar octaveDownAmount = octaveSet.substring(1,2);\n\n\t\t//change string to number for manipulation\n\t\tvar octaveDown = parseInt(octaveDownAmount);\n\n\t\t//find original value\n\t\tvar calcDownOctave = parseInt(keyAdjust.charAt(keyAdjust.length-1));\n\n\t\t//add both value to make the octave change\n\t\tvar octaveDownChange = octaveDown - calcDownOctave;\n\n\t\t//remove the negative sign\n\t\tvar octaveDownChangeStr = octaveDownChange.toString();\n\n\t\t//convert back to string for freq conversion and remove '-'\n\t\tkeyAdjust = keyAdjust.substring(0, keyAdjust.length-1) + octaveDownChangeStr.charAt(octaveDownChangeStr.length-1);\n\t\t\n\t\tmakeMusic(keyAdjust);\n\t\t\n\t}\n\n\t//for no octave change\n\telse {\n\t\tmakeMusic(keyAdjust);\n\t}\n\n}",
"function setOctave(compKeyID){\n\toctaveOffset = compKeyID - 53;\n\toctaveImgURL = 'images/oct_' + (octaveOffset - 1) + '.png';\n\t$('#octaveNum').attr('src', octaveImgURL);\n}",
"function getOctave(oct) {\r\n octave = oct;\r\n closeOctave();\r\n}",
"function shiftTrackOctave() {\n\tcancelPlayback();\n\ttracks[selectedTrack].octaveShift = parseInt(document.getElementById('octaveShift').value, 10);\n\ttracks[selectedTrack].semitoneShift = parseInt(document.getElementById('semitones').value, 10);\n\tlevel.noteGroups[selectedTrack].ofsY = tracks[selectedTrack].octaveShift * 12 + tracks[selectedTrack].semitoneShift;\n\tcalculateNoteRange();\n\tadjustZoom();\n\tsoftRefresh();\n\tupdateInstrumentContainer();\n}",
"function selectYear() {\n\tyearSelected = document.getElementById(\"year\").value;\t// Save the new year\n\trefreshIFrame();\t// Refresh the preview with the new variables\n}",
"function update(){\n\tvar el=document.getElementById('content');\n\tvar savedSel = saveSelection(el);\n\tdocument.getElementById(\"content\").innerHTML=''+wave.getState().get(\"content\");\n\trestoreSelection(el, savedSel);\n}",
"function codepad_set_selected_scene(scene_id) {\n var scenes_elem = document.getElementById(\"scene\");\n var scene_options = scenes_elem.options;\n for (var option, i = 0; option = scene_options[i]; i++) {\n if (option.value == scene_id) {\n scenes_elem.selectedIndex = i;\n break;\n }\n }\n}",
"function octaveUp() {\n\tif(octaveOffset < 2) {\n\t\toctaveOffset++;\n\t\toctaveImgURL = 'images/oct_' + (octaveOffset - 1) + '.png';\n\t\t$('#octaveNum').attr('src', octaveImgURL);\n\t\tstopAllNotes();\n\t}\n}",
"function spiralizePick(e) {\n var spiralIndex = 1 + this.selectedIndex;\n var spiralOption = this.options[this.selectedIndex].text;\n\n document.getElementById('spiralDesc').value = spiralIndex + ':' + spiralOption;\n\n// document.getElementById('spiralDesc').value = spiralSaved.selected;\n\n console.log(\"OBJ-P\", spiralSaved[1].xOrg);\n\n document.getElementById('xOrg').value = spiralSaved[spiralIndex].xOrg;\n document.getElementById('yOrg').value = spiralSaved[spiralIndex].yOrg;\n document.getElementById('aSca').value = spiralSaved[spiralIndex].aSca;\n document.getElementById('pPow').value = spiralSaved[spiralIndex].pPow;\n document.getElementById('cSca').value = spiralSaved[spiralIndex].cSca;\n document.getElementById('iSca').value = spiralSaved[spiralIndex].iSca;\n document.getElementById('jSca').value = spiralSaved[spiralIndex].jSca;\n document.getElementById('kSca').value = spiralSaved[spiralIndex].kSca;\n document.getElementById('bSca').value = spiralSaved[spiralIndex].bSca;\n document.getElementById('qPow').value = spiralSaved[spiralIndex].qPow;\n document.getElementById('nTurns').value = spiralSaved[spiralIndex].nTurns;\n document.getElementById('sSteps').value = spiralSaved[spiralIndex].sSteps;\n\n// update the selected radio btn\n spiralSelected = spiralSaved[spiralIndex].selected;\n radiobtn = document.getElementById(spiralSelected);\n radiobtn.checked = true;\n\n\n}",
"function optionChanged(selection) {\n // Select the input value from the form\n plottingAll(selection);\n}",
"function changeEpisode(elem)\n{\n var chosen = document.getElementById(\"episodeName\").object.getSelectedIndex();\n updateEpisode(results[chosen]);\n}",
"function applyCurrentVariation(){\n currentVarPitchIndex = document.getElementById(\"varpitch\").value;\n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n}",
"function copyPlays() {\n\n var theForm = document.forms[\"changeinfo\"]\n box = theForm.elements['scenecopy'];\n\n cce = parseInt(parseFloat(box.options[box.selectedIndex].value));\n ccesave = cce;\n boxa = theForm.elements['sceneon'];\n ccea = parseInt(parseFloat(boxa.options[boxa.selectedIndex].value));\n\n //theForm.elements['Scene' + ccea].value = theForm.elements['Scene' + cce].value;\n theForm.elements['SceneO' + ccea].value = theForm.elements['SceneO' + cce].value;\n ChangeScene();\n //cce = ccesave;\n\n //theForm.sceneon.options[ccea - 1].text = theForm.elements['scenarioname'].value;\n //theForm.scenecopy.options[ccea - 1].text = theForm.elements['scenarioname'].value;\n\n}",
"getNameSelected() {\n var option = this.saveView.existingSceneSelect.options[this.saveView.existingSceneSelect.selectedIndex];\n this.saveView.inputLocalStorage.value = option.value;\n }",
"changePreset() {\n this.model.presetInProcess = true;\n this.model.reloadPreset();\n this.reset();\n this.timeline.changePreset();\n this.model.presetInProcess = false;\n }",
"function previous()\n{\nprevdate= getSelectedDate();\nlocation.reload();\nsetSelectedMonth(-1,prevdate);\t\n}",
"saveSelection(){\n this.selected = this.model.document.selection.getSelectedElement()\n }",
"function changeNote() {\n editor.value = window.localStorage.getItem(notes.value);\n}",
"function setNotationValue(note)\n{\n RMPApplication.debug(\"begin setNotationValue\");\n c_debug(dbug.eval, \"=> setNotationValue: note = \", note);\n $(\"#id_selectedNotation\").val(note);\n RMPApplication.debug(\"end setNotationValue\");\n}",
"function next()\n{\nnextdate= getSelectedDate();\nlocation.reload();\nsetSelectedMonth(1,nextdate);\n}",
"editSelectionParameters() {\n this.simcirWorkspace.editSelectionParameters();\n }",
"function reload() {\r\n this.selection.setBookmark();\r\n this.save();\r\n this.load();\r\n this.selection.moveToBookmark();\r\n }",
"function reload() {\n this.selection.setBookmark();\n this.save();\n this.load();\n this.selection.moveToBookmark();\n }",
"function setLabor()\n\t{\n\t\tvar rows = auxJobGrid.getSelectionModel().getSelections();\n\t\t\t\n\t\tif (rows.length > 0) \n\t\t{\n\t\t\tvar value = labor.getValue();\n\t\t\t\n\t\t\tvar index = labor.store.find('name', value);\n\t\t\tvar record = labor.store.getAt(index);\n\t\t\t\n\t\t\tif(record != undefined)\n\t\t\t{\n\t\t\t\trows[0].set('labor_cost', record.get('cost'));\n\t\t\t\trows[0].set('labor', value);\n\t\t\t\t\n\t\t\t\tif(record.data.job_id == 21)//Weed\n\t\t\t\t{\n\t\t\t\t\trows[0].set('days', record.get('days'));\n\t\t\t\t\t\n\t\t\t\t\tsetScheduledDate(rows[0]);\t\n\t\t\t\t}\n\t\t\t\tauxJobGrid.startEditing(dsAuxJob.indexOf(rows[0]), 4);\n\t\t\t}\t\n\t\t}\n\t}",
"function setEditForm(that) {\n $('#currency').val(that.attr('data-currency'));\n $('#input-exchange-rate').val(that.attr('data-value'));\n $('#save-exchange-rate').attr('data-rid', that.attr('data-rid'));\n $('#frm-exchange').attr('title', 'Update exchange rate');\n $('#save-exchange-rate').val('Update');\n}",
"function changeVPSExposure() {\n logMessage('Frame[' + lstFrames.selectedIndex + ']');\n logMessage('Current Exposure Value =' + frameControllers[lstFrames.selectedIndex].exposureControl.value);\n var control = document.getElementById(vpsPerFrameControlList[0].control);\n logMessage('Set Exposure Value =' + control.value);\n frameControllers[lstFrames.selectedIndex].exposureControl.value = control.value;\n var label = document.getElementById('lblExposure');\n label.value = \"Exposure:\" + control.value;\n}",
"function revertShowExp(){\n\tif(opt1OldCode != \"\" && stopPressed == 1){\n\t\ttaCode.value = opt1OldCode;\n\t\topt1OldCode = \"\";\n\t}\n}",
"function setDmgModal(num) {\n $('#dmgSelect').val(num);\n}",
"function changeData(){\n\tcurYear = sel.value();\n\tmyTitle.html(curYear + \": \" + lev);\n}",
"function setInitalClimateVariable() {\n $('.climate-variables :selected').val('rh_wt');\n $(\"select\").material_select(); \n }"
] | [
"0.64532727",
"0.6226794",
"0.59063274",
"0.5747786",
"0.5722116",
"0.5243063",
"0.52056074",
"0.5198421",
"0.51464415",
"0.51365244",
"0.5114822",
"0.507811",
"0.5076945",
"0.5055766",
"0.50290275",
"0.501767",
"0.49903986",
"0.49648476",
"0.4961119",
"0.4949368",
"0.49456984",
"0.49416366",
"0.4937957",
"0.49065122",
"0.48900315",
"0.48747078",
"0.48513404",
"0.4844768",
"0.4827233",
"0.48211762"
] | 0.709136 | 0 |
Factory method to create a TerrainRenderer from img urls instead of img objects | static async fromImgUrl (shapeCanvas, opts) {
const imgOpts = Object.assign({}, opts, {
groundImg: await loadImage(opts.groundImg)
})
return new TerrainRenderer(shapeCanvas, imgOpts)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function initRasterFactory(getURL) {\n // Input getURL returns a tile URL for given indices z, x, y, t (t optional)\n\n return { create };\n\n function create(z, x, y, t) {\n const tileHref = getURL(z, x, y, t);\n const img = loadImage(tileHref, checkData);\n\n const tile = { \n z, x, y, t, // t may be undefined, for 3D tile services\n img,\n cancel,\n canceled: false,\n rendered: false,\n };\n\n function checkData(err) {\n if (tile.canceled) return;\n if (err) return console.log(err);\n tile.rendered = true;\n }\n\n function cancel() {\n img.src = \"\";\n tile.canceled = true;\n }\n\n return tile;\n }\n }",
"function makeTexture( imageURL, material )\r\n{\r\n function callback()\r\n {\r\n if (material) {\r\n material.map = texture;\r\n material.needsUpdate = true;\r\n }\r\n // not necessary to call render() since the scene is continually updating.\r\n }\r\n let loader = new THREE.TextureLoader();\r\n let texture = loader.load(imageURL, callback);\r\n texture.wrapS = THREE.RepeatWrapping;\r\n texture.wrapT = THREE.RepeatWrapping;\r\n texture.repeat = new THREE.Vector2(10,10);\r\n texture.anisotropy = renderer.getMaxAnisotropy();\r\n return texture;\r\n}",
"open(url, data, device) {\n const texture = new Texture(device, {\n name: url,\n // #if _PROFILER\n profilerHint: TEXHINT_ASSET,\n // #endif\n addressU: data.cubemap ? ADDRESS_CLAMP_TO_EDGE : ADDRESS_REPEAT,\n addressV: data.cubemap ? ADDRESS_CLAMP_TO_EDGE : ADDRESS_REPEAT,\n width: data.width,\n height: data.height,\n format: data.format,\n cubemap: data.cubemap,\n levels: data.levels\n });\n\n texture.upload();\n\n return texture;\n }",
"function makeDrawImgPlane(regl, params) {\n // const {width, height} = params\n var texture = params.texture;\n\n return regl({\n vert: \"precision mediump float;\\n#define GLSLIFY 1\\nattribute vec3 position;\\nattribute vec2 uv;\\nvarying vec2 vUv;\\nuniform mat4 model, view, projection;\\nvoid main() {\\n vUv = uv;\\n gl_Position = projection * view * model * vec4(position, 1);\\n}\\n\",\n frag: \"precision mediump float;\\n#define GLSLIFY 1\\n\\n varying vec2 vUv;\\n uniform sampler2D texture;\\n uniform vec4 color;\\n\\nvec4 colorize(in vec4 color, in vec4 modColor)\\n{\\n float average = (color.r + color.g + color.b) / 3.0;\\n return vec4(modColor.r, modColor.g, modColor.b, color.a);\\n}\\n void main () {\\n gl_FragColor = colorize(texture2D(texture,vUv), color);//*vec4(1.,0,0,1);\\n }\\n\",\n\n attributes: {\n position: [[-1, +1, 0], [+1, +1, 0], [+1, -1, 0], [-1, -1, 0]],\n uv: [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]\n },\n elements: [[2, 1, 0], [2, 0, 3]],\n uniforms: {\n model: function model(context, props) {\n return props.model || _glMat2.default.identity([]);\n },\n color: function color(context, props) {\n return props.color || [0, 0, 0, 1];\n },\n texture: texture },\n cull: {\n enable: false,\n face: 'back'\n },\n blend: {\n enable: true,\n func: {\n srcRGB: 'src alpha',\n srcAlpha: 1,\n dstRGB: 'one minus src alpha',\n dstAlpha: 1\n },\n equation: {\n rgb: 'add',\n alpha: 'add'\n },\n color: [0, 1, 0, 1]\n }\n });\n}",
"function makeTextureMaps(img) {\n var n = img.width / 16;\n var textures = [];\n for (var i=0; i < n; i++) {\n var texture = new THREE.Texture(img);\n texture.needsUpdate = true; // arrgh!\n texture.magFilter = THREE.NearestFilter;\n texture.minFilter = THREE.NearestFilter;\n texture.repeat.x = 1 / n;\n texture.offset.x = i / n;\n texture.wrapT = texture.wrapS = THREE.RepeatWrapping;\n textures.push(texture);\n }\n return textures;\n }",
"static createXYZImageryLayer(options) {\n return new Cesium.UrlTemplateImageryProvider(options)\n }",
"function initTextures() {\r\n return [loadImageAsCubemapTexture('WebGL.png', 0)];\r\n}",
"function makeTexture(images){\n\tfor (var i = 0; i < images.length; ++i) {\n \tvar texture = gl.createTexture();\n \tgl.bindTexture(gl.TEXTURE_2D, texture);\n \tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n \tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n \tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n \tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n \tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n \tgl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[i]);\n \ttrisphereTexture.push(texture);\n }\n}",
"function Terrain() {\r\n\r\n function loadFileToString(path) {\r\n\r\n var client = new XMLHttpRequest();\r\n\r\n client.open('GET', path, false);\r\n client.send();\r\n\r\n if(client.status == 200) {\r\n return client.responseText;\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n\r\n // Tiles that sit next to a tile of a greater scale need to have their edges morphed to avoid\r\n // edges. Mark which edges need morphing using flags. These flags are then read by the vertex\r\n // shader which performs the actual morph\r\n var Edge = {\r\n NONE: 0,\r\n TOP: 1,\r\n LEFT: 2,\r\n BOTTOM: 4,\r\n RIGHT: 8\r\n };\r\n\r\n var this_ = this;\r\n var terrainVert, terrainFrag, terrainSnowFrag, terrainToonFrag;\r\n var texturePath = \"textures/\";\r\n var textures;\r\n var offset;\r\n\r\n var fragShaders;\r\n var fragShader;\r\n\r\n var resolution, heightData, worldWidth, levels;\r\n\r\n var tileGeometry;\r\n\r\n var mesh = new THREE.Object3D();\r\n var pi = 3.1415926535897932384626433832795;\r\n\r\n this.update = function(x, y){\r\n offset.x = x;\r\n offset.y = y;\r\n }\r\n\r\n // Terrain is an extension of Object3D and thus can be added directly to the stage\r\n this.initialize = function( height_parm, width_parm, level_parm, res_param ) {\r\n\r\n terrainVert = loadFileToString(\"./shaders/terrain.vert\");\r\n terrainFrag = loadFileToString(\"./shaders/terrain.frag\");\r\n terrainSnowFrag = loadFileToString(\"./shaders/terrainSnow.frag\");\r\n terrainToonFrag = loadFileToString(\"./shaders/terrainToon.frag\");\r\n\r\n textures = {\r\n // grass: THREE.ImageUtils.loadTexture( texturePath + \"grass.jpg\" ),\r\n rock: THREE.ImageUtils.loadTexture( texturePath + \"rock.jpg\" ),\r\n // snow: THREE.ImageUtils.loadTexture( texturePath + \"snow.jpg\" )\r\n };\r\n\r\n for ( var t in textures ) {\r\n if ( textures.hasOwnProperty( t ) ) {\r\n textures[t].wrapS = textures[t].wrapT = THREE.RepeatWrapping;\r\n }\r\n }\r\n\r\n THREE.Object3D.call( this );\r\n\r\n worldWidth = ( width_parm !== undefined ) ? width_parm : 1024;\r\n levels = ( level_parm !== undefined ) ? level_parm : 6;\r\n resolution = ( res_param !== undefined ) ? res_param : 128;\r\n heightData = height_parm;\r\n\r\n // Offset is used to re-center the terrain, this way we get the greates detail\r\n // nearest to the camera. In the future, should calculate required detail level per tile\r\n offset = new THREE.Vector3( 0, 0, 0 );\r\n\r\n // Which shader should be used for rendering\r\n fragShaders = [terrainFrag, terrainSnowFrag, terrainToonFrag];\r\n mesh.fragShader = terrainSnowFrag;\r\n\r\n // Create geometry that we'll use for each tile, just a standard plane\r\n tileGeometry = new THREE.PlaneGeometry( 1, 1, resolution, resolution );\r\n // Place origin at bottom left corner, rather than center\r\n var m = new THREE.Matrix4();\r\n m.makeTranslation( 0.5, 0.5, 0 );\r\n tileGeometry.applyMatrix( m );\r\n\r\n // Create collection of tiles to fill required space\r\n /*jslint bitwise: true */\r\n var initialScale = worldWidth / Math.pow( 2, levels );\r\n\r\n // Create center layer first\r\n // +---+---+\r\n // | O | O |\r\n // +---+---+\r\n // | O | O |\r\n // +---+---+\r\n createTile( -initialScale, -initialScale, initialScale, Edge.NONE );\r\n createTile( -initialScale, 0, initialScale, Edge.NONE );\r\n createTile( 0, 0, initialScale, Edge.NONE );\r\n createTile( 0, -initialScale, initialScale, Edge.NONE );\r\n\r\n // Create \"quadtree\" of tiles, with smallest in center\r\n // Each added layer consists of the following tiles (marked 'A'), with the tiles\r\n // in the middle being created in previous layers\r\n // +---+---+---+---+\r\n // | A | A | A | A |\r\n // +---+---+---+---+\r\n // | A | | | A |\r\n // +---+---+---+---+\r\n // | A | | | A |\r\n // +---+---+---+---+\r\n // | A | A | A | A |\r\n // +---+---+---+---+\r\n for ( var scale = initialScale; scale < worldWidth; scale *= 2 ) {\r\n createTile( -2 * scale, -2 * scale, scale, Edge.BOTTOM | Edge.LEFT );\r\n createTile( -2 * scale, -scale, scale, Edge.LEFT );\r\n createTile( -2 * scale, 0, scale, Edge.LEFT );\r\n createTile( -2 * scale, scale, scale, Edge.TOP | Edge.LEFT );\r\n\r\n createTile( -scale, -2 * scale, scale, Edge.BOTTOM );\r\n // 2 tiles 'missing' here are in previous layer\r\n createTile( -scale, scale, scale, Edge.TOP );\r\n\r\n createTile( 0, -2 * scale, scale, Edge.BOTTOM );\r\n // 2 tiles 'missing' here are in previous layer\r\n createTile( 0, scale, scale, Edge.TOP );\r\n\r\n createTile( scale, -2 * scale, scale, Edge.BOTTOM | Edge.RIGHT );\r\n createTile( scale, -scale, scale, Edge.RIGHT );\r\n createTile( scale, 0, scale, Edge.RIGHT );\r\n createTile( scale, scale, scale, Edge.TOP | Edge.RIGHT );\r\n }\r\n\r\n var m = new THREE.Matrix4();\r\n m.makeRotationX(pi * 1.5);\r\n m.multiplyScalar(10);\r\n mesh.applyMatrix( m );\r\n\r\n /*jslint bitwise: false */\r\n };\r\n\r\n this.getMesh = function() {\r\n mesh.receiveShadow = true;\r\n return mesh;\r\n }\r\n\r\n function createTile( x, y, scale, edgeMorph ) {\r\n var terrainMaterial = createTerrainMaterial( heightData,\r\n offset,\r\n new THREE.Vector2( x, y ),\r\n scale,\r\n resolution,\r\n edgeMorph );\r\n var plane = new THREE.Mesh( tileGeometry, terrainMaterial );\r\n mesh.add( plane );\r\n }\r\n\r\n \r\n function createTerrainMaterial( heightData, globalOffset, offset, scale, resolution, edgeMorph ) {\r\n // Is it bad to change this for every tile?\r\n modifyDefine(terrainVert, \"TILE_RESOLUTION\", resolution.toFixed(1));\r\n\r\n return new THREE.ShaderMaterial( {\r\n uniforms: {\r\n uEdgeMorph: { type: \"i\", value: edgeMorph },\r\n uGlobalOffset: { type: \"v3\", value: globalOffset },\r\n uHeightData: { type: \"t\", value: heightData },\r\n //uGrass: { type: \"t\", value: textures.grass },\r\n uRock: { type: \"t\", value: textures.rock },\r\n //uSnow: { type: \"t\", value: textures.snow },\r\n uTileOffset: { type: \"v2\", value: offset },\r\n uScale: { type: \"f\", value: scale }\r\n },\r\n vertexShader: terrainVert,\r\n fragmentShader: mesh.fragShader,\r\n transparent: true\r\n } );\r\n };\r\n\r\n function modifyDefine(target ,define, value ) {\r\n var regexp = new RegExp(\"#define \" + define + \" .*\", \"g\");\r\n var newDefine = \"#define \" + define + ( value ? \" \" + value : \"\" );\r\n if ( target.match( regexp ) ) {\r\n // #define already exists, update its value\r\n target = target.replace( regexp, newDefine );\r\n }\r\n else {\r\n // New #define, prepend to start of file\r\n target = newDefine + \"\\n\" + target.value;\r\n }\r\n }\r\n\r\n this.cycleShader = function() {\r\n // Swap between different terrains\r\n var f = mesh.fragShaders.indexOf( mesh.fragShader );\r\n f = ( f + 1 ) % mesh.fragShaders.length;\r\n this.fragShader = mesh.fragShaders[f];\r\n\r\n // Update all tiles\r\n for ( var c in mesh.children ) {\r\n var tile = mesh.children[c];\r\n tile.material.fragmentShader = mesh.fragShader.value;\r\n tile.material.needsUpdate = true;\r\n }\r\n\r\n return f;\r\n };\r\n}",
"_getTextureURLHandler() {\n//--------------------\nreturn (turl) => {\nif (typeof lggr.debug === \"function\") {\nlggr.debug(`Texture: Handler for URL ${turl.substr(0, 50)} ...`);\n}\nif (turl) {\nreturn this._texture.image.src = turl;\n} else {\nreturn typeof lggr.debug === \"function\" ? lggr.debug(\"Texture: URL is null.\") : void 0;\n}\n};\n}",
"constructor(map, tileset){\n var cnvs = document.createElement(\"canvas\");\n cnvs.width = map[0].length * tileset.tileW;\n cnvs.height = map.length * tileset.tileH;\n this.canvas = cnvs;\n var ctx = this.canvas.getContext(\"2d\");\n ctx.imageSmoothingEnabled = false;\n this.ctx = ctx;\n this.buildImage(map, tileset);\n }",
"function setTextureFromUrl(mesh, url) {\n mesh.material.map = new THREE.TextureLoader().load(url);;\n mesh.material.needsUpdate = true;\n }",
"function mk_renderer(ops) { // returns a function that renders all the uri's contained in a single line\n var container, interval, render; // of the poem data struct asynchroneously to @param ops.container, ops.interval\n container = ops.container; // ms break inbetween each frame. If image uri's are not found, it returns an error to\n interval = ops.interval; // to @param callback\n return function render(line, callback) {\n console.log(\"Rendering line \" + line);\n document.getElementById(\"current-line\").innerHTML = line;\n var self = this,\n uris, count, loop;\n console.log(line);\n uris = poem.lines[line];\n if (!uris) {\n return callback(\"uris not found\");\n }\n async.eachSeries(uris, function set_img_render(uri, callback) {\n render_img(uri);\n setTimeout(callback, interval);\n }, callback)\n\n function render_img(uri) {\n console.log(\"Rendering img@\" + uri);\n container.innerHTML = '<img src=\"' + uri + '\"/>';\n }\n }\n}",
"createSingleImageProvider(ol_lyr) {\n var src = ol_lyr.getSource();\n var params = src.getParams();\n params.VERSION = params.VERSION || '1.1.1';\n if (params.VERSION.indexOf('1.1.') == 0) params.CRS = 'EPSG:4326';\n if (params.VERSION.indexOf('1.3.') == 0) params.SRS = 'EPSG:4326';\n params.FROMCRS = 'EPSG:4326';\n var prm_cache = {\n url: src.getUrl(),\n layers: src.getParams().LAYERS,\n dimensions: ol_lyr.get('dimensions'),\n getFeatureInfoFormats: [new Cesium.GetFeatureInfoFormat('text', 'text/plain')],\n enablePickFeatures: true,\n parameters: params,\n getFeatureInfoParameters: { VERSION: params.VERSION, CRS: 'EPSG:4326', FROMCRS: 'EPSG:4326' },\n minimumTerrainLevel: params.minimumTerrainLevel || 12,\n tileWidth: 1024,\n tileHeight: 1024,\n proxy: new MyProxy('/cgi-bin/hsproxy.cgi?url=', ol_lyr.getMaxResolution())\n };\n \n var tmp = new Cesium.ImageryLayer(new Cesium.WebMapServiceImageryProvider(me.removeUnwantedParams(prm_cache, src)), {\n alpha: 0.7,\n show: ol_lyr.getVisible()\n });\n tmp.prm_cache = prm_cache;\n return tmp;\n }",
"loadTextures() {\n // loading a texture uses the ImageLoader\n // Texture object - https://threejs.org/docs/#api/en/textures/Texture\n const loader = new THREE.TextureLoader()\n loader.crossOrigin = ''\n\n // background images\n this.bg = []\n this.images.forEach((image) => {\n const img = loader.load(`${image}?v=${Date.now()}`, this.render)\n // リピートしないように\n img.wrapS = THREE.ClampToEdgeWrapping\n img.wrapT = THREE.ClampToEdgeWrapping\n // いい感じに縮小 (ノイズ少ない)\n img.minFilter = THREE.LinearFilter\n this.bg.push(img)\n })\n\n // texture for distortion\n this.disp = loader.load(this.texture, this.render)\n // いい感じに拡大\n this.disp.magFilter = this.disp.minFilter = THREE.LinearFilter\n // リピートさせる\n this.disp.wrapS = this.disp.wrapT = THREE.RepeatWrapping\n }",
"function Renderer(layer, sql, attrs, options) {\n options = options || {};\n\n this.sql = sql;\n this.attrs = attrs;\n this.layer = layer;\n\n this.tile_size = options.tileSize || 256;\n this.tile_max_geosize = options.maxGeosize || 40075017; // earth circumference in webmercator 3857\n this.buffer_size = options.bufferSize || 0;\n}",
"createTilesetsAndWaterTextures() {\n let tilesets = this.tilesetTextures;\n let tilesetsCount = tilesets.length;\n let canvas = document.createElement('canvas');\n let ctx = canvas.getContext('2d');\n\n canvas.width = 2048;\n canvas.height = 64 * (tilesetsCount + 1); // 1 is added for a black tileset, to remove branches from the fragment shader, at the cost of 512Kb.\n\n for (let tileset = 0; tileset < tilesetsCount; tileset++) {\n let imageData = tilesets[tileset].imageData;\n if (!imageData) {\n continue;\n }\n\n for (let variation = 0; variation < 16; variation++) {\n let x = (variation % 4) * 64;\n let y = ((variation / 4) | 0) * 64;\n\n ctx.putImageData(imageData, variation * 64 - x, (tileset + 1) * 64 - y, x, y, 64, 64);\n }\n\n if (imageData.width === 512) {\n for (let variation = 0; variation < 16; variation++) {\n let x = 256 + (variation % 4) * 64;\n let y = ((variation / 4) | 0) * 64;\n\n ctx.putImageData(imageData, 1024 + variation * 64 - x, (tileset + 1) * 64 - y, x, y, 64, 64);\n }\n }\n }\n\n let gl = this.gl;\n let texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas);\n\n this.tilesetsTexture = texture;\n\n canvas.height = 128 * 3; // up to 48 frames.\n\n let waterTextures = this.waterTextures;\n\n for (let i = 0, l = waterTextures.length; i < l; i++) {\n let x = i % 16;\n let y = (i / 16) | 0;\n\n ctx.putImageData(waterTextures[i].imageData, x * 128, y * 128);\n }\n\n let waterTexture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, waterTexture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas);\n\n this.waterTexture = waterTexture;\n }",
"constructor(id, src, environment, w=100, h=100) {\n this.id = id;\n this.image = new Image(w, h);\n this.image.src = src;\n this.environment = environment;\n }",
"function renderCurrentTerrain(viewportTop, viewportLeft, viewportWidth, \r\n viewportHeight, tileSide, tileClass, maxIndexX, maxIndexY){\r\n\r\n\tvar minX = Math.floor(viewportLeft / tileSide);\r\n\tvar maxX = Math.floor( (viewportLeft + viewportWidth) / tileSide ) + 1;\r\n\tvar minY = Math.floor(viewportTop / tileSide);\r\n\tvar maxY = Math.floor( (viewportTop + viewportHeight) / tileSide ) + 1;\r\n\tvar innerDiv = document.getElementById(\"map\");\r\n\tfor ( i = minX; i <= maxX; i++ ){\r\n\t\tif ((i <= maxIndexX)&&(i >= 0)){\r\n\t\t\tfor ( j = minY; j <= maxY; j++){\r\n\t\t\t\tif ((j <= maxIndexY)&&(j >= 0)){\r\n\t\t\t\t\tvar tileName = \"x\" + i + \"y\" + j + \"z0.jpg\";\r\n\t\t\t\t\tif (!$(tileName)){\r\n\t\t\t\t\t var terrain = document.createElement(\"img\");\r\n\t\t\t\t\t terrain.src = \"images/terrain/\" + tileName;\r\n\t\t\t\t\t terrain.style.position = \"absolute\";\r\n\t\t\t\t\t terrain.style.left = i*tileSide + \"px\";\r\n\t\t\t\t\t terrain.style.top = j*tileSide + \"px\";\r\n\t\t\t\t\t terrain.style.zIndex = 2;\r\n\t\t\t\t\t\tterrain.title = \"\";\r\n\t\t\t\t\t //terrain.setAttribute(\"class\", tileClass);\r\n\t\t\t\t\t\tterrain.setAttribute(\"id\", tileName);\r\n\t\t\t\t\t\tterrain.className = tileClass;\r\n\t\t\t\t\t innerDiv.appendChild(terrain);\r\n\t\t\t\t\t}\r\n\t\t\t }\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tvar terrains = document.getElementsByClassName(tileClass);\t\r\n\tfor (k = 0; k < terrains.length; k++){\r\n\t\tvar inside = false;\r\n\t\tvar xValue = terrains[k].id.replace(\"z0.jpg\",\"\");\r\n\t\tvar yValue = terrains[k].id.replace(\"z0.jpg\",\"\");\r\n\t\txValue = xValue.substring(1,xValue.indexOf(\"y\"));\r\n\t\tyValue = yValue.substring(yValue.indexOf(\"y\") + 1,yValue.length);\r\n\t\txValue = xValue*1;\r\n\t\tyValue = yValue*1;\r\n\t\tif ((xValue >= minX)&&(xValue <= maxX)&&(yValue >= minY)&&(yValue <= maxY)){\r\n\t\t\tinside = true;\r\n\t\t}\r\n\t\tif (inside === false){\r\n\t\t\tvar innerDiv = document.getElementById(\"map\");\r\n\t\t innerDiv.removeChild(terrains[k]);\r\n\t\t}\r\n\t}\r\n\t\r\n\t/////calculations////\r\n\tvar tnr = document.getElementsByClassName(tileClass);\r\n\ttnr = tnr.length;\r\n\t$('terrains_nr').innerHTML = tnr;\r\n\t//////////////////////\r\n\t\t\r\n}",
"function setRenderer(type) {\n if (type === \"original\") {\n layer.renderer = null;\n } else if (type === \"select\") {\n // In this case we want to keep the texture unmodified for the buildings we are interested in\n // color and colorMixMode should be set to null, otherwise they default to \"white\" and \"multiply\"\n layer.renderer = getUniqueValueRenderer(null, null);\n } else if (type === \"emphasize\") {\n // We apply a color to make buildings stand out, but we also want to keep the texture, so we use tint\n layer.renderer = getUniqueValueRenderer(\"#F5D5A9\", \"tint\");\n } else {\n // Applying a white color with tint option will desaturate the texture\n // Use replace if the texture should be removed\n var colorMixMode = type === \"desaturate\" ? \"tint\" : \"replace\";\n\n // Create a SimpleRenderer and apply it to the layer\n var locationRenderer = {\n type: \"simple\", // autocastear como nuevo SimpleRenderer()\n symbol: {\n type: \"mesh-3d\", // autocastear como nuevo MeshSymbol3D()\n symbolLayers: [\n {\n type: \"fill\", // autocastear como nuevo FillSymbol3DLayer()\n material: {\n color: \"white\",\n colorMixMode: colorMixMode\n }\n }\n ]\n }\n };\n layer.renderer = locationRenderer;\n }\n }",
"function makeImage(imageUrl, rect, layout) {\n var zrImg = new zrender_lib_graphic_Image__WEBPACK_IMPORTED_MODULE_5__[/* default */ \"a\"]({\n style: {\n image: imageUrl,\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height\n },\n onload: function (img) {\n if (layout === 'center') {\n var boundingRect = {\n width: img.width,\n height: img.height\n };\n zrImg.setStyle(centerGraphic(rect, boundingRect));\n }\n }\n });\n return zrImg;\n}",
"function makeImage(imageUrl, rect, layout) {\n\t var zrImg = new ZRImage({\n\t style: {\n\t image: imageUrl,\n\t x: rect.x,\n\t y: rect.y,\n\t width: rect.width,\n\t height: rect.height\n\t },\n\t onload: function (img) {\n\t if (layout === 'center') {\n\t var boundingRect = {\n\t width: img.width,\n\t height: img.height\n\t };\n\t zrImg.setStyle(centerGraphic(rect, boundingRect));\n\t }\n\t }\n\t });\n\t return zrImg;\n\t }",
"function createTexture(width, height, vertices){\n // Finding the max height\n const max_height = FindMax(vertices);\n \n const map_size = width * height;\n var data = new Uint8Array(map_size * 3);\n\n // Colouring the normal area\n for(let i = 0; i < width; ++i){\n for(let j = 0; j < height; ++j){\n // Flipping the orientation about the x - axis\n const index = ((height - i - 1) * width + j) * 3;\n\n // These points are the corner points : Sand\n if(i == 0 || j == 0 || i == width - 1 || j == height - 1){\n data[index] = 194;\n data[index + 1] = 178;\n data[index + 2] = 128;\n }\n else{\n if(vertices[i - 1][j - 1] < 0){\n data[index] = 194;\n data[index + 1] = 178;\n data[index + 2] = 128;\n }\n // Creating gradients of colors for each level\n else{\n // Getting the height\n const height = vertices[i - 1][j - 1];\n const norm_height = height / max_height;\n\n // If height is < 0.4 of max height : Sand brown\n if(norm_height < 0.4){\n // Deciding on the starting and finishing colors \n const r1 = 62;\n const g1 = 86;\n const b1 = 61;\n\n const r2 = 95;\n const g2 = 99;\n const b2 = 80;\n\n // Setting the colors\n data[index] = Math.floor(r1 + (r2 - r1) * norm_height / 0.4);\n data[index + 1] = Math.floor(g1 + (g2 - g1) * norm_height / 0.4);\n data[index + 2] = Math.floor(b1 + (b2 - b1) * norm_height / 0.4); \n }\n\n // If height is betweeen 0.4 and 0.65 : Greenish\n else if(norm_height < 0.65){\n // Deciding on the starting and finishing colors \n const r1 = 95;\n const g1 = 99;\n const b1 = 80;\n\n const r2 = 155;\n const g2 = 177;\n const b2 = 189;\n\n // Setting the colors\n data[index] = Math.floor(r1 + (r2 - r1) * (norm_height - 0.4) / 0.25);\n data[index + 1] = Math.floor(g1 + (g2 - g1) * (norm_height - 0.4) / 0.25);\n data[index + 2] = Math.floor(b1 + (b2 - b1) * (norm_height - 0.4) / 0.25); \n }\n\n // Highest peaks : Snowy peaks\n else if(norm_height < 0.85){\n const r1 = 155;\n const g1 = 177;\n const b1 = 189;\n\n const r2 = 181;\n const g2 = 205;\n const b2 = 214;\n\n // Setting the colors\n data[index] = Math.floor(r1 + (r2 - r1) * (norm_height - 0.65) / 0.2);\n data[index + 1] = Math.floor(g1 + (g2 - g1) * (norm_height - 0.65) / 0.2);\n data[index + 2] = Math.floor(b1 + (b2 - b1) * (norm_height - 0.65) / 0.2); \n }\n\n // Peaks \n else{\n const r1 = 181;\n const g1 = 205;\n const b1 = 214;\n\n const r2 = 209;\n const g2 = 229;\n const b2 = 231;\n\n // Setting the colors\n data[index] = Math.floor(r1 + (r2 - r1) * (norm_height - 0.85) / 0.15);\n data[index + 1] = Math.floor(g1 + (g2 - g1) * (norm_height - 0.85) / 0.15);\n data[index + 2] = Math.floor(b1 + (b2 - b1) * (norm_height - 0.85) / 0.15); \n }\n }\n }\n }\n }\n\n const texture = new THREE.DataTexture(data, width, height, THREE.RGBFormat);\n texture.needsUpdate = true;\n\n return texture;\n}",
"function Terrain()\n{\n this.terrain = {};\n this.current_collision_activation_chunks_id = 0;\n this.width = 0\n this.height = 0;\n this.single_width = 16;\n this.single_height = 16;\n this.chunk_size = 2;\n /*\n add chunks object\n */\n this.addChunks = function(chunks)\n {\n this.terrain[chunks.x+\"_\"+chunks.y] = chunks;\n this.width += chunks.width;\n this.height += chunks.height;\n this.chunk_size = chunks.chunk_size;\n }\n /*\n activate chunks check collision\n otherwise stop it.\n */\n this.activateCheckCollision = function(player_x, player_y)\n {\n var coord_x = player_x/(16*this.chunk_size);\n var coord_y = player_y/(16*this.chunk_size);\n }\n}",
"function genMap(type) {\n let start = performance.now();\n setMapSize();\n\n map = []; // Create new 2D array populated with 'random' numbers.\n\n // Fill map.\n switch (type) {\n case \"random-noise\":\n for (let x = ctx.canvas.width; x-- > 0;) {\n map[x] = new Array(ctx.canvas.height);\n for (let y = map[x].length; y-- > 0;) {\n map[x][y] = Math.floor(Math.random() * detail);\n }\n }\n break;\n\n case \"simplex-noise\":\n if (document.getElementById(\"reseed_simplex\").checked) {\n simplex = new SimplexNoise();\n }\n\n for (let x = ctx.canvas.width; x-- > 0;) {\n map[x] = new Array(ctx.canvas.height);\n for (let y = map[x].length; y-- > 0;) {\n // This assigns an hsv value based on simplex noise.\n // This operation produces a *detail scaled* colour number.\n map[x][y] = Math.floor((simplex.noise2D(x * g_kSimplex, y * g_kSimplex) + 1) / 2 * detail);\n }\n }\n break;\n\n case \"web-img\": /// Sorry in advace, I don't know the proper way to format callbacks so here you go. ///\n g_tmpImg = new Image();\n\n // Feature detection\n if ( !window.XMLHttpRequest ) { alert(\"Not good... -> you're using a shitty browser, aren't you?\"); }\n\n // TODO: make sure image exists first. case if not: give warning.\n // Also TODO: if this proxy breaks or dies, look for another one.\n var url = \"https://cors-anywhere.herokuapp.com/\" + document.getElementById(\"link_input\").value\n g_tmpImg.src = url;\n\n var xhr = new XMLHttpRequest();\n xhr.open('get', g_tmpImg.src);\n //xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); //TODO: do i need this?\n\n xhr.responseType = 'blob';\n xhr.onload = function() {\n var fr = new FileReader();\n fr.onload = function() {\n g_tmpImg.src = this.result; // This gets the data from the loaded image and sets it to the image variable.\n setTimeout(loadImg, 50); // wait 0.05s for img to load.\n };\n fr.readAsDataURL(xhr.response); // async call\n };\n\n loadImg = function() {\n ctx.canvas.width = document.getElementById(\"width_slider\").value = g_tmpImg.width;\n ctx.canvas.height = document.getElementById(\"height_slider\").value = g_tmpImg.height;\n updateSliders();\n\n // I have to go draw the image to canvas first, just to get the image's pixel data.\n ctx.drawImage(g_tmpImg, 0, 0); // Draw img to canvas.\n\n var tmpImageData;\n try {\n tmpImageData = ctx.getImageData(0, 0, g_tmpImg.width, g_tmpImg.height); // get img data from canvas.\n } catch(e) { //case: security error, img on diff domain.\n console.log(e);\n }\n\n var step = 4;\n for (let x = 0; x<g_tmpImg.width*step; x+=step) {\n map[x/step] = new Array(g_tmpImg.height);\n for (let y = 0; y<g_tmpImg.height*step; y+=step) {\n map[x/step][y/step] = Math.floor(rgbToHue(\n tmpImageData.data[g_tmpImg.width*y+x],\n tmpImageData.data[g_tmpImg.width*y+x+1],\n tmpImageData.data[g_tmpImg.width*y+x+2])*detail);\n }\n }\n\n if (DEBUG) { console.log(\"Canvas updated with web-img!\"); }\n show(ctx); // Draw map.\n }\n\n xhr.send(); // Actaully request the image and wait for callbacks to be triggered.\n break;\n }\n if (DEBUG) { console.log(`Generation time: ${performance.now() - start}ms`); }\n\n switch (type) {\n case \"random-noise\":\n case \"simplex-noise\":\n show(ctx); // Update map.\n return;\n case \"web-img\":\n // Map gets updated in load function.\n return;\n }\n}",
"function createImagePlanes(input) {\n var resultArray = [];\n var imageArray = [];\n\n input.files.forEach(function (element) {\n imageArray.push(element.pic);\n });\n\n input.files.forEach(function (element) {\n var loader = new THREE.TextureLoader();\n\n // Load image file into a custom material\n var material = new THREE.MeshLambertMaterial({\n map: loader.load(element.pic)\n });\n\n // Allow the transparencies to work\n material.transparent = true;\n\n // create a plane geometry for the image with a width of 10\n // and a height that preserves the image's aspect ratio\n var geometry = new THREE.PlaneBufferGeometry(radius, radius);\n\n // combine our image geometry and material into a mesh\n var print = new THREE.Mesh(geometry, material);\n\n // set the position of the image mesh in the x,y,z dimensions\n print.position.set(0, -3, 0);\n // print.url = element.url;\n // print.name = \"print\";\n\n var loader = new THREE.SVGLoader();\n loader.load( element.svg, function ( paths ) {\n\n var group = new THREE.Group();\n group.scale.multiplyScalar( 0.25 );\n group.position.x = - 70;\n group.position.y = 70;\n group.scale.y *= -1;\n\n for ( var i = 0; i < paths.length; i ++ ) {\n\n var path = paths[ i ];\n\n var material = new THREE.MeshBasicMaterial( {\n color: path.color,\n side: THREE.DoubleSide\n } );\n\n var shapes = path.toShapes( true );\n\n for ( var j = 0; j < shapes.length; j ++ ) {\n\n var shape = shapes[ j ];\n\n var geometry = new THREE.ShapeBufferGeometry( shape );\n var mesh = new THREE.Mesh( geometry, material );\n mesh.material.visible = false;\n\n group.add( mesh );\n\n }\n\n }\n loader.load( element.shop, function ( paths ) {\n\n // var group = new THREE.Group();\n // group.scale.multiplyScalar( 0.25 );\n // group.position.x = - 70;\n // group.position.y = 70;\n // group.scale.y *= -1;\n \n for ( var i = 0; i < paths.length; i ++ ) {\n \n var path = paths[ i ];\n \n var buttonMaterial = new THREE.MeshBasicMaterial( {\n color: path.color,\n side: THREE.DoubleSide\n } );\n \n var shapes = path.toShapes( true );\n \n for ( var j = 0; j < shapes.length; j ++ ) {\n \n var shape = shapes[ j ];\n \n var buttonGeometry = new THREE.ShapeBufferGeometry( shape );\n\n // var buttonGeometry = new THREE.PlaneBufferGeometry(200,100);\n var buttonMesh = new THREE.Mesh( buttonGeometry, buttonMaterial );\n // mesh.material.opacity =0;\n var scaleMesh = 0.6666;\n buttonMesh.scale.set(scaleMesh,scaleMesh,scaleMesh);\n buttonMesh.position.x = 0;\n buttonMesh.position.y = 85;\n buttonMesh.material.visible = false;\n buttonMesh.button = true;\n // buttonMesh.url = element.url;\n casterObjects2.push(buttonMesh);\n \n group.add( buttonMesh );\n \n }\n \n }});\n // var buttonMaterial = new THREE.MeshBasicMaterial( {\n // color: 0xff0000,\n // side: THREE.DoubleSide\n // } );\n // var buttonMesh = new THREE.Mesh(buttonGeometry, buttonMaterial);\n // buttonMesh.position.x = 200;\n // buttonMesh.position.y = 200;\n // buttonMesh.material.opacity = 0;\n // buttonMesh.button = true;\n // buttonMesh.url = element.url;\n // casterObjects2.push(buttonMesh);\n\n\n // group.add(buttonMesh);\n\n group.position.set(100, -10, 1);\n // group.name = \"svg\";\n print.add( group );\n casterObjects.push(print);\n\n } );\n\n\n\n \n\n resultArray.push(print);\n });\n return resultArray;\n}",
"function mapTerrain(name, isPassable)\n{\n this.name = name;\n this.isPassable = isPassable;\n}",
"function initTextures(name, index) {\r\n textures[index] = gl.createTexture();\r\n textures[index].image = new Image();\r\n textures[index].image.onload = function () {\r\n handleTextureLoaded(textures[index])\r\n }\r\n textures[index].image.src = name;\r\n}",
"define(name, x, y) { //creating a buffer where we keep the tile/subset derived from the big image so we don't have to draw from the big image every time.\n const buffer = document.createElement('canvas'); //programatically making a canvas element just like jsx behind the scenes.\n buffer.width = this.width;\n buffer.height = this.height;\n \n //now drawing the subset to the canvas, just like we did below in context.drawImage(..)\n buffer.\n getContext('2d')\n .drawImage(\n this.image,\n x * this.width,\n y* this.height,\n this.width,\n this.height,\n 0,\n 0,this.width,\n this.height\n );\n\n this.tiles.set(name, buffer);//add the buffer to the new map instantiated in the constructor above by using the \"tiles\" name.\n\n }",
"createRenderTexture(source){\n if(this.gl == null){\n throw new Error('webgl not initialized');\n }\n \n let gl = this.gl;\n let fTex = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, fTex);\n const level = 0;\n const internalFormat = gl.RGB;\n const width = this.vertexNum;\n const height = 1;\n const border = 0;\n const format = gl.RGB;\n const type = gl.FLOAT;\n let data = new Float32Array(source);\n\n const alignment = 1;\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, alignment);\n gl.texImage2D(gl.TEXTURE_2D, level, internalFormat, width, height, border,\n format, type, data);\n // set the filtering so we don't need mips and it's not filtered\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n //gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n //gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n \n gl.bindTexture(gl.TEXTURE_2D, null);\n return fTex;\n\n }"
] | [
"0.5914441",
"0.5603538",
"0.5532649",
"0.5461344",
"0.543083",
"0.54229",
"0.53484315",
"0.53467107",
"0.53092444",
"0.53054607",
"0.5298784",
"0.5286089",
"0.52688277",
"0.52600914",
"0.52369606",
"0.52326185",
"0.51437235",
"0.5139459",
"0.5138149",
"0.5136494",
"0.51300347",
"0.51207036",
"0.5078616",
"0.50689083",
"0.50573325",
"0.5052442",
"0.5046637",
"0.5029907",
"0.5022924",
"0.5011801"
] | 0.7094668 | 0 |
callback function to handle submit on the form to add an activity | function addActivity(event) {
event.preventDefault();
let form = event.target;
let memberName = form.name;
let newActivity = form.elements[0].value;
// add the activity to the object
if (newActivity)
{
let list = document.getElementById(memberName);
let li = document.createElement("li");
li.textContent = newActivity;
list.appendChild(li);
getMember(memberName).activities.push(newActivity);
}
else{
window.alert("Please enter an activity");
return;
}
form.elements[0].value = null;
} // End of callback function addActivity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"submitForm(e) {\n e.preventDefault();\n window.M.updateTextFields();\n let data = Util.getDataElementsForm(e.target, false);\n\n MakeRequest({\n method: 'post',\n url: 'actividad/post',\n data : data\n }).then(response => {\n if (response.error) {\n return Util.getMsnDialog('danger', Util.getModelErrorMessages(response.message));\n }\n\n this.getActivitiesByCategory();\n return Util.getMsnDialog('success', 'Created');\n });\n }",
"submitExtra() {\n }",
"function submit() {\n saveForm(applicant)\n}",
"function addNewActivity() {\n\n // get the name of the activity\n // and check that it's not empty\n var name = view.activityName.val();\n if (name == '') {\n event.preventDefault();\n event.stopPropagation();\n view.activityNameErrorLabel.addClass('error');\n return;\n }\n\n // get the length of the activity\n // and check that the value is numerical and greater than 0\n var length = view.activityLength.val();\n if (isNumber(length)) {\n if (length <= 0) {\n event.preventDefault();\n event.stopPropagation();\n view.activityLengthErrorLabel.html('Length must be greater than 0.');\n view.activityLengthErrorLabel.addClass('error');\n return;\n }\n } else {\n event.preventDefault();\n event.stopPropagation();\n view.activityLengthErrorLabel.html('Value must be numerical.');\n view.activityLengthErrorLabel.addClass('error');\n return;\n }\n // the value we got from the dialog is a string and we have to convert\n // it to an integer, otherwise we get weird results when computing the total\n // length of a day (found out the hard way ;-))\n length = parseInt(length);\n\n // get the type of the activity\n var type = view.activityType.val();\n switch (type) {\n case '0':\n type = 0; break;\n case '1':\n type = 1; break;\n case '2':\n type = 2; break;\n case '3':\n type = 3; break;\n default:\n console.log(\"Error: unknown activity type\");\n }\n\n // get the description of the activity\n var description = view.activityDescription.val();\n\n // create new activity and add it to the model\n var newActivity = new Activity(name, length, type, description);\n model.addParkedActivity(newActivity);\n\n }",
"function addActivity(e) {\n\te.preventDefault();\n\n\tvar activity = $(\"#activity-input\").val();\n\n\tif (activity !== \"\") {\n\t\t$(\"#activity-list\").append(\n\t\t\t`<li data-text=\"${activity}\">${activity}<button class=\"material-icons cyan pulse\" onclick=\"removeActivity(this, '${activity}')\">clear</button></li>`\n\t\t);\n\t} else {\n\t\tshowModal(\"Error: Empty activity\", \"Please enter a valid activity\");\n\t}\n\n\t$(\"#activity-input\").val(\"\");\n}",
"function onCreateSubmit(event) {\n event.preventDefault();\n const newTestimony = {\n userTestimony: $(\"#userTestimony\").val(),\n userDisplayName: $(\"#userDisplayName\").val()\n };\n HTTP.createTestimony({\n authToken: STATE.authUser.authToken,\n newTestimony: newTestimony,\n onSuccess: function() {\n $(\".notification\").html(` Testimony was submitted successfully`);\n pastSubmittedTestimonies();\n },\n onError: err => {\n $(\".notification\").html(\n `ERROR: Testimony was not submitted successfully`\n );\n }\n });\n}",
"function leadActivityForms() {\n $('form').submit(function anonFormActivity() {\n var $this = $(this),\n formId = $this.find('input[name=\"form_id\"]').val(),\n data = {\n nid: $this.find('input[name=\"nid\"]').val(),\n keyword: Tabia.util.getUrlParameter('kw'),\n leadSource: $this.find('input[name=\"lead_source\"]').val(),\n leadSourceDetail: $this.find('input[name=\"lead_source_detail\"]').val(),\n campaignId: $this.find('input[name=\"campaign_id\"]').val()\n };\n\n // Admin configured forms.\n if (($.inArray(formId, Drupal.settings.tableauEloqua.queueForms) >= 0) &&\n data.leadSource !== null && data.campaignId !== null) {\n // Add submit event to a localStorage queue.\n $.jQueue.push(data, 'Drupal.behaviors.tableauEloquaQueue.eloquaPost');\n }\n });\n }",
"onSubmitHandler(ev) {\n //Prevent refreshing the page\n ev.preventDefault();\n createMeeting(\n this.props.location.pathname.split('/')[2]\n ,this.state.topic,\n this.state.time,\n this.state.date,\n this.onCreateSuccess);\n }",
"function add_activity() {\n\n create_new_activity.style.display = \"block\";\n let new_title = d.getElementById(\"title\");\n let new_desc = d.getElementById(\"desc\");\n let new_goal = d.getElementById(\"goal\");\n let confirm_new_activity = d.getElementById(\"confirm_new_activity\");\n\n function confirm() {\n let newActivity = new Activity();\n newActivity.title = new_title.value;\n newActivity.description = new_desc.value;\n newActivity.current_goal = new_goal.value;\n\n new_title.value = \"\";\n new_desc.value = \"\";\n new_goal.value = \"\";\n\n create_new_activity.style.display = \"none\";\n MyActivities.set(newActivity.title, newActivity);\n sauvegarde();\n list_activities();\n }\n\n confirm_new_activity.addEventListener('click', confirm);\n}",
"function addTaskEvents() {\n\n // On submit\n newTaskForm.addEventListener('submit', function(event) {\n event.preventDefault();\n\n var title = this.querySelector('input').value;\n\n if(title) {\n addNewTask(title);\n }\n\n });\n}",
"handleAddSubmit() {}",
"function submitForm(evt) {\n\n // create new jaydata Todo instance\n var todoInstance = new SpaStack.NET.Models.TodoItem({\n 'Id': $data.createGuid(),\n 'Task': taskInput(),\n 'Completed': true,\n 'InSync': false\n });\n\n \n // add new item to observable\n localTodos.push(todoInstance);\n \n // add item to offline fb\n datacontext.offlinedb.TodoItems.add(todoInstance);\n\n // save offline db\n datacontext.offlinedb.saveChanges();\n \n return false;\n\n }",
"registerSubmitEvent() {\n\t\tthis.container.on('click', '.js-modal__save', (e) => {\n\t\t\tAppConnector.request({\n\t\t\t\tmodule: app.getModuleName(),\n\t\t\t\taction: 'ChangeCompany',\n\t\t\t\trecord: this.container.find('#companyId').val()\n\t\t\t}).done(() => {\n\t\t\t\twindow.location.href = 'index.php';\n\t\t\t});\n\t\t\te.preventDefault();\n\t\t});\n\t}",
"function onSubmit(evt) {\n evt.preventDefault();\n const finalForm = {...todoFormData, id: uuid()};\n\n dispatch({type: ADD_TODO, payload: finalForm});\n }",
"function submitForm () {\n\n\t\t\t// Add submitting state\n\t\t\tform.setAttribute('data-submitting', true);\n\n\t\t\t// Send the data to the MailChimp API\n\t\t\tsendData(serializeForm(form));\n\n\t\t}",
"submit () {\n\n // Add to saved A/B tests\n const saved = document.querySelector('#saved');\n saved.add(this.info.item);\n saved.clearFilters();\n\n // Switch to tab saved\n const tabs = document.querySelector('#tabs');\n tabs.selectTab('saved');\n\n // Hide modal\n this.modal.hide();\n\n // Reset create form\n document.querySelector('#create').innerHTML = '<fedex-ab-create></fedex-ab-create>';\n }",
"function onSubmit (fields, { setSubmitting } ) {\n console.log(\"From onSubmit these are the fields: \" + JSON.stringify(fields)); \n alertService.clear();\n subService.create(fields)\n .then(() => {\n // const { from } = location.state || { from: { pathname: \"/\" } };\n // history.push(from);\n alertService.success('Application submitted successfully', { keepAfterRouteChange: true });\n history.push('.');\n })\n .catch(error => {\n setSubmitting(false);\n alertService.error(error);\n });\n\n }",
"static newTaskForm() {\n if (didInit) return\n const newTaskSubmit = document.querySelector('#newTaskSubmit')\n newTaskSubmit.addEventListener('click', DomInput.newTaskSubmit);\n }",
"handleFormSubmit(e) {\n this.addComic();\n }",
"formSubmit() {\n if(this.get('disableSubmit')) { return; }\n \n this.sendAction('submitUserContact', {\n contactType: this.get('selectedContactType'),\n name: this.get('nameValue'),\n fromEmail: this.get('emailValue'),\n content: this.get('commentValue')\n });\n\n if(this.attrs.onContactSubmit) {\n this.attrs.onContactSubmit();\n }\n }",
"function addSubmitEventListener(handler) {\n $(\"#welcome-modal-form\").submit(handler);\n }",
"function handleAdd(){\n console.log('clicked on Submit button');\n\n let newTask = {\n task: $('#taskIn').val()\n }\n // run addTask with newTask variable\n addTask(newTask);\n\n // empty input task\n $('#taskIn').val('')\n} // end handleAdd",
"function handleNewItemSubmit() {\r\n $('main').on('submit','#new-bookmark-form', event => {\r\n console.log(\"new item submit is listening\");\r\n event.preventDefault();\r\n let data = serializeJson(event.target)\r\n console.log(data)\r\n api.createBookmark(data)\r\n .then((newItem) => {\r\n console.log(newItem);\r\n store.addItem(newItem);\r\n store.error=null;\r\n store.filter = 0;\r\n store.adding = false;\r\n render();\r\n })\r\n .catch((error) => {\r\n store.setError(error.message);\r\n renderError();\r\n });\r\n })\r\n}",
"function submit() {\n axios.post('/api/jobs', {\n company_name: company,\n job_title: job_title,\n status: status,\n color: color\n })\n .then(res => {\n props.add(res.data);\n props.hide();\n })\n }",
"function submitPressed() {\n \n}",
"function submit(){\n\n if (!this.formtitle) return;\n const obj = Program.createWithTitle(this.formtitle).toObject();\n\n if (this.formvideo){\n obj.fields.video = {value: this.formvideo, type: 'STRING'};\n }\n\n ckrecordService.save(\n 'PRIVATE', // cdatabaseScope, PUBLIC or PRIVATE\n null, // recordName,\n null, // recordChangeTag\n 'Program', // recordType\n null, // zoneName, null is _defaultZone, PUBLIC databases can only be default\n null, // forRecordName,\n null, // forRecordChangeTag,\n null, // publicPermission,\n null, // ownerRecordName,\n null, // participants,\n null, // parentRecordName,\n obj.fields // fields\n ).then( record => {\n // Save new value\n this.formtitle = '';\n this.formvideo = '';\n $scope.$apply();\n this.add( {rec: new Program(record)} );\n this.close();\n }).catch((error) => {\n // Revert to previous value\n console.log('addition ERROR', error);\n //TODO: Show message when current user does not have permission.\n // error message will be: 'CREATE operation not permitted'\n });\n\n }",
"function AttachEventThingAddForm() {\n $(\"#ThingAddForm\").on(\"submit\", function (event) {\n event.preventDefault();\n var url = $(this).attr(\"action\");\n var formData = $(this).serialize();\n $.ajax({\n url: url,\n type: \"POST\",\n data: formData,\n dataType: \"json\",\n success: function (resp) {\n ServerResponse(resp);\n LoadPart_ThingListDiv();\n },\n error: function () {\n ServerResponse(resp);\n }\n\n })\n\n LoadPart_ThingListDiv();\n $('#mdl').modal('hide');\n });\n}",
"function submit_fillter(){\n\n\t}",
"function onAddNewArtifactSubmit() {\n let form = new FormData(this);\n form.append('action', 'addArtifact');\n\n api.post('/artifacts.php', form, true)\n .then(res => {\n snackbar(res.message, 'success');\n onAddArtifactSuccess(\n res.content.id,\n form.get('name'),\n form.get('description'),\n form.get('artifactType'),\n form.get('artifactLink')\n );\n })\n .catch(err => {\n snackbar(err.message, 'error');\n });\n\n return false;\n}",
"function submitNewEntryForm() {\n // get values to submit\n let entry = new Entry(getNewEntryData());\n\n $('#new-entry .input-error').hide();\n\n if (entry.isValid()) {\n // disable button until a response is received\n disableAddEntryButton();\n\n // send ajax request\n $.ajax({\n url: '/entry/add/',\n type: 'POST',\n dataType: 'json',\n data: entry.getSubmitData(),\n success: addNewEntrySuccessFuncGenerator(entry),\n error: addNewEntryFail,\n });\n } else {\n for (let i = 0; i < Entry.fields.length; i++) {\n let field = Entry.fields[i];\n if (entry.errors.hasOwnProperty(field)) {\n let errorHTML = entry.errors[field].join('<br>');\n $('#entry-' + field.replace('_', '-') + '-error').html(errorHTML).show();\n }\n }\n }\n}"
] | [
"0.69341975",
"0.68606526",
"0.6770345",
"0.6732411",
"0.6714598",
"0.6586078",
"0.656666",
"0.65280867",
"0.6518199",
"0.65049475",
"0.64693755",
"0.63927644",
"0.63830346",
"0.63198674",
"0.63124996",
"0.630023",
"0.62911195",
"0.6286407",
"0.62854224",
"0.6280558",
"0.6278791",
"0.62731993",
"0.6268841",
"0.6242064",
"0.6241808",
"0.62315583",
"0.6206524",
"0.61925244",
"0.61868656",
"0.618337"
] | 0.75676477 | 0 |
options can be: Local options: lineRegex: defaults to /[\n\r]/. Better know what your doing if you change it. Parent options: decodeStrings: If you want strings to be buffered (Default: true) highWaterMark: Memory for internal buffer of stream (Default: 16kb) objectMode: Streams convert your data into binary, you can opt out of by setting this to true (Default: false) | constructor(options) {
super(options);
this._lineRegex = (is.notNil(options) && is.notNil(options.lineRegex)) ? options.lineRegex : DEFAULT_LINE_REGEX;
this._last = null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"constructor(options) {\n this.context = options.context;\n this.dryRun = options.dryRun;\n this.logger = options.logger;\n this.encoding = options.encoding || 'utf-8';\n }",
"function Source(obj, options) {\n Readable.call(this, options);\n this.obj = obj;\n this.arrLen = this.arrInd = 0;\n this.keys = Object.keys(obj);\n this.keysLen = this.keys.length;\n this.keyInd = -1;\n}",
"function parseLineOptions(options) {\n let typeFlag;\n if (typeof options === \"object\") {\n const {\n color = \"white\",\n length = 59,\n character = \"-\",\n quantity = 1\n } = options;\n typeFlag = \"object\";\n return [\n typeFlag,\n {\n color,\n length,\n character,\n quantity\n }\n ];\n } else if (typeof options === \"string\") {\n typeFlag = \"string\";\n let color = options;\n return [typeFlag, color];\n }\n}",
"function Stream(options) {\n Scriptum.call(this);\n options = options || {};\n this._stream = options.stream || null; // a writable stream\n this.addNewLine = options.addNewLine || false; // adds new line at each write\n}",
"constructor(source, options = {}) {\n super();\n this.avroPaused = true;\n this.source = source;\n this.onProgress = options.onProgress;\n this.onError = options.onError;\n this.avroReader = new AvroReader(new AvroReadableFromStream(this.source));\n this.avroIter = this.avroReader.parseObjects({ abortSignal: options.abortSignal });\n }",
"constructor(source, options = {}) {\n super();\n this.avroPaused = true;\n this.source = source;\n this.onProgress = options.onProgress;\n this.onError = options.onError;\n this.avroReader = new AvroReader(new AvroReadableFromStream(this.source));\n this.avroIter = this.avroReader.parseObjects({ abortSignal: options.abortSignal });\n }",
"function UseDeserialization(options = {}) {\n return UsePipe(exports.DeserializerPipe, options);\n}",
"function makeLineReader( filepath, options ) {\n options = options || {};\n var readBufferSize = 128000;\n\n var lineBufLength = options.lineBufLength || 5;\n\n var rl, stream = options.stream;\n var reader = { lines: [], _eof: true, error: undefined };\n\n function reopen() {\n reader._eof = false;\n stream = stream || fs.createReadStream(filepath, { highWaterMark: readBufferSize, start: options.start || 0 });\n stream.on('error', function(err) { reader.error || (reader.error = err) });\n rl = readline.createInterface(stream, { console: false, isTTY: false });\n rl.on('close', function() { reader._eof = true; emitBufferedLine(rl) });\n rl.on('line', function(line) {\n // tracking the byte offset drops read speed 25%, from 3.2m/s to 2.6m/s\n reader.lines.push(trimTrailingNewline(line));\n if (reader.lines.length >= lineBufLength) reader.pause() });\n rl.pause();\n reader.rl = rl;\n }\n\n reader = {\n _eof: false,\n paused: true,\n lines: new Array(),\n error: reader.error,\n rl: rl,\n gets: function gets() {\n return reader.lines.length ? reader.lines.shift() : ((!reader.error && !reader._eof && reader.resume()), undefined) },\n flush: function flush() { var lines = reader.lines; reader.lines = new Array(); return lines },\n reopen: function _reopen() { reader._eof = false; return reopen() },\n pause: function pause() { if (!reader.paused) reader.rl.pause(); reader.paused = true },\n resume: function resume() { if (reader.paused) reader.rl.resume(); reader.paused = false },\n isEof: function isEof() { return !!(!reader.lines.length && (reader._eof || reader.error)) },\n };\n // Object.defineProperty(reader, 'eof', { get: function() { return reader.isEof() } });\n\n reader.reopen();\n return reader;\n}",
"function IconvLiteDecoderStream(conv, options) {\n }",
"function IconvLiteDecoderStream(conv, options) {\n }",
"decode(input, options = {}) {\n let more = \"stream\" in options ? options.stream : false;\n // There are cases where this is called without input.\n if (!input) {\n return \"\";\n }\n this.collectInput += bytesToString(input);\n if (more) {\n return \"\";\n }\n return this.manager.utf7ToUnicode(this.collectInput);\n }",
"constructor(options = {}) {\n this.options = getOptions(options);\n\n // Construct regexes for reserved words, according to settings\n this.keywordsJs = keywordRegexp([].concat(keywords));\n this.keywords = keywordRegexp([].concat(keywords, reservedWords.tacoscript));\n this.reservedWords = keywordRegexp(reservedWords.es2015);\n this.reservedWordsStrict = keywordRegexp([].concat(reservedWords.es2015, reservedWords.strict));\n this.reservedWordsStrictBind = keywordRegexp([].concat(reservedWords.es2015, reservedWords.strict, reservedWords.strictBind))\n\n // These will be populated by `open()`\n this.file = this.input = this.state = null;\n }",
"function VFile(options) {\n var prop\n var index\n var length\n\n if (!options) {\n options = {}\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options}\n } else if ('message' in options && 'messages' in options) {\n return options\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options)\n }\n\n this.data = {}\n this.messages = []\n this.history = []\n this.cwd = process.cwd()\n\n // Set path related properties in the correct order.\n index = -1\n length = order.length\n\n while (++index < length) {\n prop = order[index]\n\n if (own.call(options, prop)) {\n this[prop] = options[prop]\n }\n }\n\n // Set non-path related properties.\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop]\n }\n }\n}",
"initialize(options={}) {\n this._files = [];\n this._editor = null;\n this._prevClientHeight = null;\n\n this.options = _.defaults(options, this.defaultOptions);\n this.richText = !!this.options.richText;\n this._dropTarget = null;\n this._value = this.options.text || '';\n this._richTextDirty = false;\n\n if (this.options.bindRichText) {\n this.bindRichTextAttr(this.options.bindRichText.model,\n this.options.bindRichText.attrName);\n }\n\n /*\n * If the user is defaulting to rich text, we're going to want to\n * show the rich text UI by default, even if any bound rich text\n * flag is set to False.\n *\n * This requires cooperation with the template or API results\n * that end up backing this TextEditor. The expectation is that\n * those will be providing escaped data for any plain text, if\n * the user's set to use rich text by default. If this expectation\n * holds, the user will have a consistent experience for any new\n * text fields.\n */\n if (RB.UserSession.instance.get('defaultUseRichText')) {\n this.setRichText(true);\n }\n }",
"function VFile(options) {\n var prop\n var index\n\n if (!options) {\n options = {}\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options}\n } else if ('message' in options && 'messages' in options) {\n return options\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options)\n }\n\n this.data = {}\n this.messages = []\n this.history = []\n this.cwd = proc.cwd()\n\n // Set path related properties in the correct order.\n index = -1\n\n while (++index < order.length) {\n prop = order[index]\n\n if (own.call(options, prop)) {\n this[prop] = options[prop]\n }\n }\n\n // Set non-path related properties.\n for (prop in options) {\n if (order.indexOf(prop) < 0) {\n this[prop] = options[prop]\n }\n }\n}",
"function VFile(options) {\n var prop\n var index\n\n if (!options) {\n options = {}\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options}\n } else if ('message' in options && 'messages' in options) {\n return options\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options)\n }\n\n this.data = {}\n this.messages = []\n this.history = []\n this.cwd = proc.cwd()\n\n // Set path related properties in the correct order.\n index = -1\n\n while (++index < order.length) {\n prop = order[index]\n\n if (own.call(options, prop)) {\n this[prop] = options[prop]\n }\n }\n\n // Set non-path related properties.\n for (prop in options) {\n if (order.indexOf(prop) < 0) {\n this[prop] = options[prop]\n }\n }\n}",
"function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}",
"function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}",
"function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}",
"function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}",
"function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}",
"function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}",
"constructor(options) {\n options = options || {};\n options.objectMode = true;\n super(options);\n }",
"parse(arrayBuffer, options = {}) {\n return this.parseSync(arrayBuffer, options);\n }",
"constructor(options) {\n this._cleared = new Signal(this);\n this._disposed = new Signal(this);\n this._editor = null;\n this._inspected = new Signal(this);\n this._isDisposed = false;\n this._pending = 0;\n this._standby = true;\n this._connector = options.connector;\n this._rendermime = options.rendermime;\n this._debouncer = new Debouncer(this.onEditorChange.bind(this), 250);\n }",
"static readFile(filePath, options) {\n return FileSystem._wrapException(() => {\n options = Object.assign(Object.assign({}, READ_FILE_DEFAULT_OPTIONS), options);\n let contents = FileSystem.readFileToBuffer(filePath).toString(options.encoding);\n if (options.convertLineEndings) {\n contents = Text_1.Text.convertTo(contents, options.convertLineEndings);\n }\n return contents;\n });\n }",
"function add_to_buffer(data, callback){\n\t\t\tif(!options.to || options.to === 'undefined'){\n\t\t\t\tlog.error('undefined to');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlog.trace('add_to_buffer data', data);\n\n\t\t\tvar new_data_obj = [];\n\n\t\t\tfunction split_string(str){\n\t\t\t\tif(options.join !== '\\n' && options.skip_verify !== true) str = x.verify_string(str);\n\t\t\t\tvar pat = new RegExp('.{' + _this.max_str_len + '}\\w*\\W*|.*.', 'g');\n\t\t\t\tstr.match(pat).forEach(function(entry) {\n\t\t\t\t\tif(entry === '' || entry === null || entry === undefined) return;\n\t\t\t\t\tentry = options.skip_verify ? entry : x.verify_string(entry);\n\t\t\t\t\tnew_data_obj.push(entry);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif(data === undefined || data === null || data === false || data === '' || data.length < 1){ //no data\n\t\t\t\tnew_data_obj = [];\n\t\t\t} else if (typeof data === 'string'){ //string\n\t\t\t\tsplit_string(data);\n\t\t\t} else if(typeof data === 'object' && Array.isArray(data)){ //array\n\t\t\t\tdata.forEach(function(item, i){\n\t\t\t\t\tsplit_string(item);\n\t\t\t\t});\n\t\t\t} else if(typeof data === 'object' && !Array.isArray(data)){ //object\n\t\t\t\toptions.join = '\\n';\n\t\t\t\tvar data_arr = format_obj(data);\n\t\t\t\tdata_arr.forEach(function(item, i){\n\t\t\t\t\tsplit_string(item);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tlog.error('verify_string: str is a', typeof data, data)\n\t\t\t\tsplit_string(JSON.stringify(data));\n\t\t\t}\n\n\t\t\tlog.trace('add_to_buffer new_data_obj', new_data_obj);\n\n\t\t\tif(new_data_obj.length <= options.lines){\n\t\t\t\toptions.ellipsis = false;\n\t\t\t\tcallback(new_data_obj.join(options.join + '\\u000f'));\n\t\t\t} else {\n\t\t\t\tnew_data_obj.unshift({\n\t\t\t\t\tfirst_len: new_data_obj.length,\n\t\t\t\t\tjoin: options.join,\n\t\t\t\t\tid: x.guid(),\n\t\t\t\t\tellipsis: options.ellipsis\n\t\t\t\t});\n\n\t\t\t\tlog.trace('adding buffer to', '/buffer/' + options.to, new_data_obj.slice(0,3), '...');\n\t\t\t\tdb.update('/buffer/' + options.to, new_data_obj, true, function(act){\n\t\t\t\t\tif(act === 'add'){\n\t\t\t\t\t\tpage_buffer(function(data){\n\t\t\t\t\t\t if(options.is_pm){\n\t\t\t\t\t\t\t\tdata = _this.t.highlight('To page through buffer, type ' + config.command_prefix + 'next. (type ' + config.command_prefix + 'next help for more info)\\n') + data;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tlog.trace('added to ' + options.to + '\\'s buffer!')\n\t\t\t\t\t\t\tcallback(data);\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.trace('cleared ' + options.to + '\\'s buffer!')\n\t\t\t\t\t}\n\t\t\t\t}, options.to);\n\t\t\t}\n\t\t}",
"constructor(options) {\n this.options = options;\n this.configureMonacoEditor();\n\n if (this.options.isMarkdown) {\n this.fetchMarkdownExtension();\n }\n\n this.initModePanesAndLinks();\n this.initFileSelectors();\n this.initSoftWrap();\n this.editor.focus();\n }",
"static isSmartBufferOptions(options) {\n const castOptions = options;\n return castOptions && (castOptions.encoding !== undefined || castOptions.size !== undefined || castOptions.buff !== undefined);\n }",
"_transform( data, encoding, streamCallback )\n {\n // convert buffer to string\n const text = data.toString( this.stringEncoding )\n\n // split data at newline\n const lines = text.split( this.newlineCharacter )\n\n // prepend previously buffered data to first line\n lines[0] = this.lineBuffer + lines[0]\n\n // last \"line\" is probably not a complete line,\n // remove it from the processing array and store it for next time\n this.lineBuffer = lines.pop()\n\n // process and push data with adding newline back\n this.handleLines( streamCallback, this.transformCallback, lines, this.newlineCharacter )\n }"
] | [
"0.598805",
"0.5458345",
"0.53923386",
"0.53203326",
"0.5241645",
"0.5241645",
"0.5212115",
"0.51200736",
"0.51083565",
"0.51083565",
"0.50362635",
"0.5031804",
"0.50278515",
"0.5024184",
"0.5013628",
"0.5013628",
"0.50017864",
"0.50017864",
"0.50017864",
"0.50017864",
"0.50017864",
"0.50017864",
"0.49733877",
"0.49626094",
"0.49511814",
"0.49485794",
"0.49387798",
"0.4937403",
"0.4908389",
"0.49075368"
] | 0.63171875 | 0 |
Base pairs are a pair of AT and CG. pairElement("ATCGA") should return [["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]]. pairElement("TTGAG") should return [["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]]. pairElement("CTCTA") should return [["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]]. split("") the str to turn into an array create a for loop for the newly created array create the switch() statement for each iterated element. case "A" : ["A", "T"]; break; case "C" : newArr.push(["C", "G"]); break; return newArr; | function pairElement(str) {
let arr = str.split("");
let newArr = [];
let len = arr.length;
for (let i = 0; i < len; i++) {
switch(arr[i]) {
case 'A':
newArr.push(['A', 'T']);
break;
case 'T':
newArr.push(['T', 'A']);
break;
case 'C':
newArr.push(['C', 'G']);
break;
case 'G':
newArr.push(['G','C']);
break;
}
}
return newArr;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function pairElement(str) {\n let at = ['A','T'];\n let ta = ['T','A'];\n let gc = ['G','C'];\n let cg = ['C','G'];\n let returnArr = [];\n let arr = str.split(\"\");\n \n arr.map(k => {\n if(k === \"A\") {\n returnArr.push(at);\n } else if(k === \"T\") {\n returnArr.push(ta);\n } else if(k === \"G\") {\n returnArr.push(gc);\n } else {\n returnArr.push(cg);\n } \n })\n return returnArr;\n}",
"function pairElement(str) {\n var result = [];\n var twoDeeArray = [];\n for (var x = 0; x < str.length; x++){\n switch(str[x].toUpperCase()){\n case \"A\":\n twoDeeArray.push(\"A\");\n twoDeeArray.push(\"T\");\n result.push(twoDeeArray);\n twoDeeArray = [];\n break;\n case \"C\":\n twoDeeArray.push(\"C\");\n twoDeeArray.push(\"G\");\n result.push(twoDeeArray);\n twoDeeArray = [];\n break;\n case \"G\":\n twoDeeArray.push(\"G\");\n twoDeeArray.push(\"C\");\n result.push(twoDeeArray);\n twoDeeArray = [];\n break;\n case \"T\":\n twoDeeArray.push(\"T\");\n twoDeeArray.push(\"A\");\n result.push(twoDeeArray);\n twoDeeArray = [];\n break;\n default:\n break;\n }\n }\n return result;\n}",
"function pairElement(str) {\n let arr = str.split('');\n let newArr = []\n //console.log(arr)\n for (let i = 0; i < arr.length; i++){\n if(arr[i] == 'G'){\n newArr.push(['G', 'C']); \n } else if (arr[i] == 'C'){\n newArr.push(['C', 'G']);\n } else if (arr[i] == 'A'){\n newArr.push(['A', 'T']);\n } else if (arr[i] == 'T'){\n newArr.push(['T', 'A']);\n }\n }\n return newArr\n}",
"function pairElement(str) {\n var charArray = str.split(\"\");\n console.log(charArray);\n // var firstChar = charArray[1];\n // console.log(charArray[1]);\n var pairArray = [];\n console.log(pairArray);\n for (var i = 0; i < charArray.length; i++) {\n if (charArray[i] === \"G\") {\n pairArray.push([\"G\", \"C\"]);\n console.log(pairArray);\n }\n else if (charArray[i] == \"C\") {\n pairArray.push([\"C\", \"G\"]);\n console.log(pairArray);\n }\n else if (charArray[i] === \"A\") {\n pairArray.push([\"A\", \"T\"]);\n console.log(pairArray);\n }\n else if (charArray[i] === \"T\") {\n pairArray.push([\"T\", \"A\"]);\n console.log(pairArray);\n }\n }\n return pairArray;\n\n //return str;\n}",
"function pairElement(str) {\r\n let arr=str.split('')\r\n\r\n for(var i = 0; i< arr.length; i++){\r\n if(arr[i] === 'C'){\r\n arr[i]=['C','G']\r\n }else if(arr[i] === 'G'){\r\n arr[i]=['G','C']\r\n }else if(arr[i] === 'A'){\r\n arr[i]=['A','T'] \r\n }else if(arr[i] === 'T'){\r\n arr[i]=['T', 'A']\r\n }\r\n }\r\n return arr;\r\n}",
"function pairElement(str) {\n // array that will hold base pair arrays\n var dnaPairs = [];\n /* basePairs object that holds (ATGC) and their appropriate pairs. \n Used to return correct pair based on input. */ \n var basePairs = {\n \"A\" : \"T\",\n \"T\" : \"A\",\n \"G\" : \"C\",\n \"C\" : \"G\"\n };\n // Iterating through each character of str\n for (var character of str) {\n // Pair array where original char and it's pair will be pushed onto\n var pair = [];\n // Push onto pair -- the original character and value from basePairs that corresponds to that char.\n pair.push(character , basePairs[character]);\n // Push pair onto dnaPairs\n dnaPairs.push(pair);\n }\n\n return dnaPairs;\n }",
"function pairElement6(str) {\n let newArr = [];\n\n for (let i = 0; i < str.length; i++) {\n switch (str[i]) {\n case \"A\":\n newArr.push([\"A\", \"T\"]);\n break;\n case \"T\":\n newArr.push([\"T\", \"A\"]);\n break;\n case \"C\":\n newArr.push([\"C\", \"G\"]);\n break;\n case \"G\":\n newArr.push([\"G\", \"C\"]);\n break;\n }\n };\n\n return newArr;\n}",
"function pairElement(str) {\n var paired = [];\n \n var search = function(char){\n switch(char){\n case \"A\":\n paired.push(['A', 'T']);\n break;\n \n case \"T\":\n paired.push(['T', 'A']);\n break;\n case \"C\":\n paired.push([\"C\", \"G\"]);\n break;\n case \"G\":\n paired.push([\"G\", \"C\"]);\n break;\n }\n };\n \n for(var i = 0; i < str.length; i++){\n search(str[i])\n }\n return paired;\n }",
"function pairElement(str) {\n var a = [];\n var pairs = {\n \"T\": \"A\",\n \"A\": \"T\",\n \"G\": \"C\",\n \"C\": \"G\"\n };\n for(i=0; i<str.length; i++){\n var temp = [];\n temp.push(str.charAt(i));\n temp.push(pairs[str.charAt(i)]);\n a.push(temp);\n }\n return a;\n}",
"function pair(str) {\r\n\tvar pair1 = [\"A\", \"T\"];\r\n\tvar pair2 = [\"C\", \"G\"];\r\n\tvar toPair = str.split(\"\");\r\n\tvar result = [];\r\n\tfor(var i = 0; i < toPair.length; i++) {\r\n\t\tvar arr = [];\r\n\t\tarr.push(toPair[i]);\r\n\t\tif(pair1[0] === toPair[i]) {\r\n\t\t\tarr.push(pair1[1]);\r\n\t\t}\r\n\t\telse if(pair1[1] === toPair[i]) {\r\n\t\t\tarr.push(pair1[0]);\r\n\t\t}\r\n\r\n\t\telse if(pair2[0] === toPair[i]) {\r\n\t\t\tarr.push(pair2[1]);\r\n\t\t}\r\n\t\telse if(pair2[1] === toPair[i]) {\r\n\t\t\tarr.push(pair2[0]);\r\n\t\t}\r\n\t\tresult.push(arr);\r\n\r\n\t}\t\r\n\tconsole.log(result);\r\n return result;\r\n}",
"function pairElement(str) {\r\n var paired = [];\r\n str = str.split(\"\");\r\n for (let i = 0; i < str.length; i++) {\r\n if (str[i] === \"G\") {\r\n paired.push([\"G\", \"C\"]);\r\n } else if (str[i] === \"C\") {\r\n paired.push([\"C\", \"G\"]);\r\n } else if (str[i] === \"A\") {\r\n paired.push([\"A\", \"T\"]);\r\n } else if (str[i] === \"T\") {\r\n paired.push([\"T\", \"A\"]);\r\n } \r\n }\r\n console.table(paired);\r\n}",
"function pairElement(str) {\n let pairArray = str.split(\"\");\n let newArray = [];\n //console.log(pairArray);\n\n //encapsulate each individual item in its own array\n for (let i = 0; i < pairArray.length; i++) {\n newArray.push([pairArray[i]]);\n }\n\n for (let i = 0; i < newArray.length; i++) {\n //access first element of index i array and check its first letter, based on first\n //letter decide what character needs to be added to complete pair.\n if (newArray[i][0] === \"T\") {\n console.log(\"yes\");\n newArray[i].push(\"A\");\n } else if (newArray[i][0] === \"A\") {\n console.log(\"yes\");\n newArray[i].push(\"T\");\n } else if (newArray[i][0] === \"C\") {\n console.log(\"yes\");\n newArray[i].push(\"G\");\n } else if (newArray[i][0] === \"G\") {\n console.log(\"yes\");\n newArray[i].push(\"C\");\n }\n console.log(newArray[0][i]);\n }\n console.log(newArray);\n return newArray;\n}",
"function pairElement(str){\n var str = str.split(\"\");\n var newStr = [];\n var pairs = {\n A: \"T\",\n T: \"A\",\n C: \"G\",\n G: \"C\"\n }\n for(var i = 0; i < str.length; i++){\n newStr.push([str[i], pairs[str[i]]]);\n }\n return newStr;\n}",
"function pairElement(str) {\n\tlet parts = Array.from(str);\n\n\t// mapping of pairs to other half\n\tconst getOtherHalf = function(character) {\n\t\tlet pair = [];\n\n\t\tswitch (character) {\n\t\t case 'T':\n\t\t pair.push(character, 'A');\n\t\t break;\n\n\t\t case 'A':\n\t\t \tpair.push(character, 'T');\n\t\t \tbreak;\n\n\t\t case 'G':\n\t\t \tpair.push(character, 'C');\n\t\t break;\n\n\t\t default:\n\t\t \t// possibly bit bad practice to set an option here as default!\n\t\t \tpair.push(character, 'G');\n\t\t}\n\t\treturn pair;\n\t}\n\n\tlet pairs = parts.map(halfpair => getOtherHalf(halfpair));\n return pairs;\n}",
"function pairElement(str) {\n\treturn str\n\t\t.split('')\n\t\t.map((letter) =>\n\t\t\tletter === 'A'\n\t\t\t\t? ['A', 'T']\n\t\t\t\t: letter === 'T'\n\t\t\t\t? ['T', 'A']\n\t\t\t\t: letter === 'C'\n\t\t\t\t? ['C', 'G']\n\t\t\t\t: ['G', 'C']\n\t\t);\n}",
"static pairElement(str) {\n\n const Pair = {\n A() {return \"T\";},\n T() {return \"A\";},\n C() {return \"G\";},\n G() {return \"C\";} \n };\n let singleElements = str.split(\"\");\n return singleElements.map(element => [element, Pair[element]()]);\n }",
"function pairElement(str) {\n let dnaArr = [...str];\n let finalArr = [];\n for(let i = 0; i < dnaArr.length; i++){\n var paired;\n switch (dnaArr[i]){\n case \"C\":\n paired = \"G\";\n break;\n case \"A\":\n paired = \"T\";\n break;\n case \"G\":\n paired = \"C\";\n break;\n case \"T\":\n paired = \"A\";\n break;\n default:\n paired = \"N/A\";\n }\n finalArr.push([dnaArr[i], paired]);\n }\n return finalArr;\n}",
"function pair(str) {\n // get length of str and loop through\n var len = str.length,\n counter = 0,\n list = str.split('');\n\n for (var i = 0; i < len; i++) {\n switch (list[i]) {\n case 'A':\n list.push(['A', 'T']);\n break;\n case 'C':\n list.push(['C', 'G']);\n break;\n case 'T':\n list.push(['T', 'A']);\n break;\n case 'G':\n list.push(['G', 'C']);\n break;\n }\n }\n while (counter < len) {\n list.shift();\n counter++;\n }\n console.log(list);\n return list;\n}",
"function pairElement(str) {\n // Return each strand as an array of two elements, the original and the pair.\n var paired = [];\n\n // Function to check with strand to pair.\n var search = function(char) {\n switch (char) {\n case \"A\":\n paired.push([\"A\", \"T\"]);\n break;\n case \"T\":\n paired.push([\"T\", \"A\"]);\n break;\n case \"C\":\n paired.push([\"C\", \"G\"]);\n break;\n case \"G\":\n paired.push([\"G\", \"C\"]);\n break;\n }\n };\n\n // Loops through the input and pair.\n for (var i = 0; i < str.length; i++) {\n search(str[i]);\n }\n\n return paired;\n}",
"function pairElement(str) {\n let result = \"\"\n for (let i = 0; i < str.length; i++) {\n // if (str[i] == 'A') {\n // result = result + 'T'\n // } else if (str[i] == 'T') {\n // result = result + 'A'\n // } else if (str[i] == 'C') {\n // result = result + 'G'\n // } else if (str[i] == 'G') {\n // result = result + 'C'\n // }\n switch (str[i]) {\n case 'A':\n result = result + 'T'\n break\n case 'T':\n result = result + 'A'\n break;\n case 'C':\n result = result + 'G'\n break\n case 'G':\n result = result + 'C'\n break\n }\n }\n return result;\n}",
"function pair(str) {\n //define a map object with all pair possibilities\n var map = {T:'A', A:'T', G:'C', C:'G'};\n //split str into a char Array\n strArr = str.split('');\n //replace each Array item with a 2d Array using map\n for (var i=0;i<strArr.length;i++){\n strArr[i]=[strArr[i], map[strArr[i]]];\n }\n return strArr;\n}",
"function pairElement(str) {\r\n return str.split(\"\").map(p => [p, pairs[p]]);\r\n}",
"function pairDNA(str) {\r\n var pairs = {\r\n A: \"T\",\r\n T: \"A\",\r\n C: \"G\",\r\n G: \"C\"\r\n };\r\n return str.split(\"\").map(x => [x, pairs[x]]);\r\n}",
"function pairElement(str) {\n let dnaPairs = {\n A: ['A', 'T'],\n T: ['T', 'A'],\n C: ['C', 'G'],\n G: ['G', 'C'],\n }\n return str.split('').map(dnaCharacter => dnaPairs[dnaCharacter]);\n}",
"function pairElement7(str) {\n const pairs = {\n A: \"T\",\n T: \"A\",\n C: \"G\",\n G: \"C\"\n };\n const arr = str.split(\"\");\n return arr.map(char => [char, pairs[char]]);\n}",
"function dnaPair(str){\n var pairs = {\n \"A\": \"T\",\n \"T\": \"A\",\n \"C\": \"G\",\n \"G\": \"C\"\n }\n var arr = str.split(\"\");\n return arr.map(x => [x , pairs[x]]);\n}",
"function stringCreation(str) {\n var pair = \"\";\n for(var i = 0; i <= str.length; i++){\n if(str[i] === \"C\"){\n pair = pair + \"G\";\n } else if(str[i] === \"G\"){\n pair = pair + \"C\";\n } else if (str[i] === \"A\"){\n pair = pair + \"T\";\n } else if (str[i] === \"T\"){\n pair = pair + \"A\";\n }\n }\n return pair;\n}",
"function pairDna(str){\n let dnaArr = [...str];\n let dnaObj = {\n \"A\": \"T\",\n \"T\": \"A\",\n \"C\": \"G\",\n \"G\": \"C\"\n }\n let finalArr = [];\n for(let i = 0; i < dnaArr.length; i++){\n finalArr.push([dnaArr[i], dnaObj[dnaArr[i]]]);\n }\n return finalArr;\n}",
"function splitPairs(input) {\n\n //for even lengths:\n //split into pairs of characters\n if (input.length % 2 === 0) {\n input = input.split('')\n }\n\n let newStrEven = [];\n if (input.length % 2 === 0) {\n for (let i = 0; i < input.length; i++) {\n newStrEven.push(input[i] + input[i + 1]) //ok\n input = input.slice(1) //[a, y]\n }\n return newStrEven\n }\n// newStrEven = newStrEven.toString()\nlet newStrOdd = [];\n if (input.length % 2 !== 0) {\n for (let j = 0; j < input.length; j++) {\n if (input.length >= 2) {\n if (input[j] === input[input.length - 1] && input[j] !== input[0]) {\n newStrOdd.push(input[j] + \"_\")\n } else {\n newStrOdd.push(input[j] + input[j + 1])\n input = input.slice(1)\n // console.log(input)\n }\n }\n }\n return newStrOdd\n }\n}",
"function arrayPairs(arr) {\n // YOUR WORK HERE\n let result = [];\n function pairArr(i) {\n if (i >= arr.length) return;\n result.push([arr[i], arr[i + 1]]);\n pairArr(i + 2);\n }\n pairArr(0);\n return result;\n}"
] | [
"0.8297701",
"0.82293373",
"0.820291",
"0.8188886",
"0.8101683",
"0.7922902",
"0.7810319",
"0.7804721",
"0.77858955",
"0.77729666",
"0.77284795",
"0.7638515",
"0.7618238",
"0.7614296",
"0.75772583",
"0.7571956",
"0.7476376",
"0.74648416",
"0.739352",
"0.7204998",
"0.719899",
"0.7125688",
"0.69753844",
"0.69051707",
"0.6898468",
"0.651129",
"0.6445357",
"0.5861952",
"0.5744374",
"0.5680821"
] | 0.83368564 | 0 |
takes a JSON or YAML string, returns YAML string | function load(string) {
var jsonError, yamlError;
if (!angular.isString(string)) {
throw new Error('load function only accepts a string');
}
// Try figuring out if it's a JSON string
try {
JSON.parse(string);
} catch (error) {
jsonError = error;
}
// if it's a JSON string, convert it to YAML string and return it
if (!jsonError) {
return jsyaml.dump(JSON.parse(string));
}
// Try parsing the string as a YAML string and capture the error
try {
jsyaml.load(string);
} catch (error) {
yamlError = error;
}
// If there was no error in parsing the string as a YAML string
// return the original string
if (!yamlError) {
return string;
}
// If it was neither JSON or YAML, throw an error
throw new Error('load function called with an invalid string');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function yamlString2JsonObject (data) {\n // 1. Render YAML template\n // nunjucks.configure({ autoescape: false });\n // const contents = nunjucks.renderString(template, params);\n // 2. Convert YAML text to JSON Object\n return yaml.load(data);\n}",
"function yaml(hljs) {\n var LITERALS = 'true false yes no null';\n\n // Define keys as starting with a word character\n // ...containing word chars, spaces, colons, forward-slashes, hyphens and periods\n // ...and ending with a colon followed immediately by a space, tab or newline.\n // The YAML spec allows for much more than this, but this covers most use-cases.\n var KEY = {\n className: 'attr',\n variants: [\n { begin: '\\\\w[\\\\w :\\\\/.-]*:(?=[ \\t]|$)' },\n { begin: '\"\\\\w[\\\\w :\\\\/.-]*\":(?=[ \\t]|$)' }, //double quoted keys\n { begin: '\\'\\\\w[\\\\w :\\\\/.-]*\\':(?=[ \\t]|$)' } //single quoted keys\n ]\n };\n\n var TEMPLATE_VARIABLES = {\n className: 'template-variable',\n variants: [\n { begin: '\\{\\{', end: '\\}\\}' }, // jinja templates Ansible\n { begin: '%\\{', end: '\\}' } // Ruby i18n\n ]\n };\n var STRING = {\n className: 'string',\n relevance: 0,\n variants: [\n {begin: /'/, end: /'/},\n {begin: /\"/, end: /\"/},\n {begin: /\\S+/}\n ],\n contains: [\n hljs.BACKSLASH_ESCAPE,\n TEMPLATE_VARIABLES\n ]\n };\n\n var DATE_RE = '[0-9]{4}(-[0-9][0-9]){0,2}';\n var TIME_RE = '([Tt \\\\t][0-9][0-9]?(:[0-9][0-9]){2})?';\n var FRACTION_RE = '(\\\\.[0-9]*)?';\n var ZONE_RE = '([ \\\\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?';\n var TIMESTAMP = {\n className: 'number',\n begin: '\\\\b' + DATE_RE + TIME_RE + FRACTION_RE + ZONE_RE + '\\\\b',\n };\n\n return {\n name: 'YAML',\n case_insensitive: true,\n aliases: ['yml', 'YAML'],\n contains: [\n KEY,\n {\n className: 'meta',\n begin: '^---\\s*$',\n relevance: 10\n },\n { // multi line string\n // Blocks start with a | or > followed by a newline\n //\n // Indentation of subsequent lines must be the same to\n // be considered part of the block\n className: 'string',\n begin: '[\\\\|>]([0-9]?[+-])?[ ]*\\\\n( *)[\\\\S ]+\\\\n(\\\\2[\\\\S ]+\\\\n?)*',\n },\n { // Ruby/Rails erb\n begin: '<%[%=-]?', end: '[%-]?%>',\n subLanguage: 'ruby',\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n },\n { // local tags\n className: 'type',\n begin: '!' + hljs.UNDERSCORE_IDENT_RE,\n },\n { // data type\n className: 'type',\n begin: '!!' + hljs.UNDERSCORE_IDENT_RE,\n },\n { // fragment id &ref\n className: 'meta',\n begin: '&' + hljs.UNDERSCORE_IDENT_RE + '$',\n },\n { // fragment reference *ref\n className: 'meta',\n begin: '\\\\*' + hljs.UNDERSCORE_IDENT_RE + '$'\n },\n { // array listing\n className: 'bullet',\n // TODO: remove |$ hack when we have proper look-ahead support\n begin: '\\\\-(?=[ ]|$)',\n relevance: 0\n },\n hljs.HASH_COMMENT_MODE,\n {\n beginKeywords: LITERALS,\n keywords: {literal: LITERALS}\n },\n TIMESTAMP,\n // numbers are any valid C-style number that\n // sit isolated from other words\n {\n className: 'number',\n begin: hljs.C_NUMBER_RE + '\\\\b'\n },\n STRING\n ]\n };\n}",
"function yamlParse(input) {\n return jsYaml.load(input, { schema: schema });\n}",
"function YAMLParser(data) {\n return yaml.safeLoad(data, 'utf8');\n}",
"function yaml(hljs) {\n var LITERALS = 'true false yes no null';\n\n // YAML spec allows non-reserved URI characters in tags.\n var URI_CHARACTERS = '[\\\\w#;/?:@&=+$,.~*\\'()[\\\\]]+';\n\n // Define keys as starting with a word character\n // ...containing word chars, spaces, colons, forward-slashes, hyphens and periods\n // ...and ending with a colon followed immediately by a space, tab or newline.\n // The YAML spec allows for much more than this, but this covers most use-cases.\n var KEY = {\n className: 'attr',\n variants: [\n { begin: '\\\\w[\\\\w :\\\\/.-]*:(?=[ \\t]|$)' },\n { begin: '\"\\\\w[\\\\w :\\\\/.-]*\":(?=[ \\t]|$)' }, // double quoted keys\n { begin: '\\'\\\\w[\\\\w :\\\\/.-]*\\':(?=[ \\t]|$)' } // single quoted keys\n ]\n };\n\n var TEMPLATE_VARIABLES = {\n className: 'template-variable',\n variants: [\n { begin: /\\{\\{/, end: /\\}\\}/ }, // jinja templates Ansible\n { begin: /%\\{/, end: /\\}/ } // Ruby i18n\n ]\n };\n var STRING = {\n className: 'string',\n relevance: 0,\n variants: [\n { begin: /'/, end: /'/ },\n { begin: /\"/, end: /\"/ },\n { begin: /\\S+/ }\n ],\n contains: [\n hljs.BACKSLASH_ESCAPE,\n TEMPLATE_VARIABLES\n ]\n };\n\n // Strings inside of value containers (objects) can't contain braces,\n // brackets, or commas\n var CONTAINER_STRING = hljs.inherit(STRING, {\n variants: [\n { begin: /'/, end: /'/ },\n { begin: /\"/, end: /\"/ },\n { begin: /[^\\s,{}[\\]]+/ }\n ]\n });\n\n var DATE_RE = '[0-9]{4}(-[0-9][0-9]){0,2}';\n var TIME_RE = '([Tt \\\\t][0-9][0-9]?(:[0-9][0-9]){2})?';\n var FRACTION_RE = '(\\\\.[0-9]*)?';\n var ZONE_RE = '([ \\\\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?';\n var TIMESTAMP = {\n className: 'number',\n begin: '\\\\b' + DATE_RE + TIME_RE + FRACTION_RE + ZONE_RE + '\\\\b'\n };\n\n var VALUE_CONTAINER = {\n end: ',',\n endsWithParent: true,\n excludeEnd: true,\n contains: [],\n keywords: LITERALS,\n relevance: 0\n };\n var OBJECT = {\n begin: /\\{/,\n end: /\\}/,\n contains: [VALUE_CONTAINER],\n illegal: '\\\\n',\n relevance: 0\n };\n var ARRAY = {\n begin: '\\\\[',\n end: '\\\\]',\n contains: [VALUE_CONTAINER],\n illegal: '\\\\n',\n relevance: 0\n };\n\n var MODES = [\n KEY,\n {\n className: 'meta',\n begin: '^---\\\\s*$',\n relevance: 10\n },\n { // multi line string\n // Blocks start with a | or > followed by a newline\n //\n // Indentation of subsequent lines must be the same to\n // be considered part of the block\n className: 'string',\n begin: '[\\\\|>]([1-9]?[+-])?[ ]*\\\\n( +)[^ ][^\\\\n]*\\\\n(\\\\2[^\\\\n]+\\\\n?)*'\n },\n { // Ruby/Rails erb\n begin: '<%[%=-]?',\n end: '[%-]?%>',\n subLanguage: 'ruby',\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n },\n { // named tags\n className: 'type',\n begin: '!\\\\w+!' + URI_CHARACTERS\n },\n // https://yaml.org/spec/1.2/spec.html#id2784064\n { // verbatim tags\n className: 'type',\n begin: '!<' + URI_CHARACTERS + \">\"\n },\n { // primary tags\n className: 'type',\n begin: '!' + URI_CHARACTERS\n },\n { // secondary tags\n className: 'type',\n begin: '!!' + URI_CHARACTERS\n },\n { // fragment id &ref\n className: 'meta',\n begin: '&' + hljs.UNDERSCORE_IDENT_RE + '$'\n },\n { // fragment reference *ref\n className: 'meta',\n begin: '\\\\*' + hljs.UNDERSCORE_IDENT_RE + '$'\n },\n { // array listing\n className: 'bullet',\n // TODO: remove |$ hack when we have proper look-ahead support\n begin: '-(?=[ ]|$)',\n relevance: 0\n },\n hljs.HASH_COMMENT_MODE,\n {\n beginKeywords: LITERALS,\n keywords: { literal: LITERALS }\n },\n TIMESTAMP,\n // numbers are any valid C-style number that\n // sit isolated from other words\n {\n className: 'number',\n begin: hljs.C_NUMBER_RE + '\\\\b',\n relevance: 0\n },\n OBJECT,\n ARRAY,\n STRING\n ];\n\n var VALUE_MODES = [...MODES];\n VALUE_MODES.pop();\n VALUE_MODES.push(CONTAINER_STRING);\n VALUE_CONTAINER.contains = VALUE_MODES;\n\n return {\n name: 'YAML',\n case_insensitive: true,\n aliases: ['yml', 'YAML'],\n contains: MODES\n };\n}",
"function yaml(hljs) {\n var LITERALS = 'true false yes no null';\n\n // YAML spec allows non-reserved URI characters in tags.\n var URI_CHARACTERS = '[\\\\w#;/?:@&=+$,.~*\\'()[\\\\]]+';\n\n // Define keys as starting with a word character\n // ...containing word chars, spaces, colons, forward-slashes, hyphens and periods\n // ...and ending with a colon followed immediately by a space, tab or newline.\n // The YAML spec allows for much more than this, but this covers most use-cases.\n var KEY = {\n className: 'attr',\n variants: [\n { begin: '\\\\w[\\\\w :\\\\/.-]*:(?=[ \\t]|$)' },\n { begin: '\"\\\\w[\\\\w :\\\\/.-]*\":(?=[ \\t]|$)' }, // double quoted keys\n { begin: '\\'\\\\w[\\\\w :\\\\/.-]*\\':(?=[ \\t]|$)' } // single quoted keys\n ]\n };\n\n var TEMPLATE_VARIABLES = {\n className: 'template-variable',\n variants: [\n { begin: /\\{\\{/, end: /\\}\\}/ }, // jinja templates Ansible\n { begin: /%\\{/, end: /\\}/ } // Ruby i18n\n ]\n };\n var STRING = {\n className: 'string',\n relevance: 0,\n variants: [\n { begin: /'/, end: /'/ },\n { begin: /\"/, end: /\"/ },\n { begin: /\\S+/ }\n ],\n contains: [\n hljs.BACKSLASH_ESCAPE,\n TEMPLATE_VARIABLES\n ]\n };\n\n // Strings inside of value containers (objects) can't contain braces,\n // brackets, or commas\n var CONTAINER_STRING = hljs.inherit(STRING, {\n variants: [\n { begin: /'/, end: /'/ },\n { begin: /\"/, end: /\"/ },\n { begin: /[^\\s,{}[\\]]+/ }\n ]\n });\n\n var DATE_RE = '[0-9]{4}(-[0-9][0-9]){0,2}';\n var TIME_RE = '([Tt \\\\t][0-9][0-9]?(:[0-9][0-9]){2})?';\n var FRACTION_RE = '(\\\\.[0-9]*)?';\n var ZONE_RE = '([ \\\\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?';\n var TIMESTAMP = {\n className: 'number',\n begin: '\\\\b' + DATE_RE + TIME_RE + FRACTION_RE + ZONE_RE + '\\\\b'\n };\n\n var VALUE_CONTAINER = {\n end: ',',\n endsWithParent: true,\n excludeEnd: true,\n contains: [],\n keywords: LITERALS,\n relevance: 0\n };\n var OBJECT = {\n begin: /\\{/,\n end: /\\}/,\n contains: [VALUE_CONTAINER],\n illegal: '\\\\n',\n relevance: 0\n };\n var ARRAY = {\n begin: '\\\\[',\n end: '\\\\]',\n contains: [VALUE_CONTAINER],\n illegal: '\\\\n',\n relevance: 0\n };\n\n var MODES = [\n KEY,\n {\n className: 'meta',\n begin: '^---\\\\s*$',\n relevance: 10\n },\n { // multi line string\n // Blocks start with a | or > followed by a newline\n //\n // Indentation of subsequent lines must be the same to\n // be considered part of the block\n className: 'string',\n begin: '[\\\\|>]([1-9]?[+-])?[ ]*\\\\n( +)[^ ][^\\\\n]*\\\\n(\\\\2[^\\\\n]+\\\\n?)*'\n },\n { // Ruby/Rails erb\n begin: '<%[%=-]?',\n end: '[%-]?%>',\n subLanguage: 'ruby',\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n },\n { // named tags\n className: 'type',\n begin: '!\\\\w+!' + URI_CHARACTERS\n },\n // https://yaml.org/spec/1.2/spec.html#id2784064\n { // verbatim tags\n className: 'type',\n begin: '!<' + URI_CHARACTERS + \">\"\n },\n { // primary tags\n className: 'type',\n begin: '!' + URI_CHARACTERS\n },\n { // secondary tags\n className: 'type',\n begin: '!!' + URI_CHARACTERS\n },\n { // fragment id &ref\n className: 'meta',\n begin: '&' + hljs.UNDERSCORE_IDENT_RE + '$'\n },\n { // fragment reference *ref\n className: 'meta',\n begin: '\\\\*' + hljs.UNDERSCORE_IDENT_RE + '$'\n },\n { // array listing\n className: 'bullet',\n // TODO: remove |$ hack when we have proper look-ahead support\n begin: '-(?=[ ]|$)',\n relevance: 0\n },\n hljs.HASH_COMMENT_MODE,\n {\n beginKeywords: LITERALS,\n keywords: { literal: LITERALS }\n },\n TIMESTAMP,\n // numbers are any valid C-style number that\n // sit isolated from other words\n {\n className: 'number',\n begin: hljs.C_NUMBER_RE + '\\\\b',\n relevance: 0\n },\n OBJECT,\n ARRAY,\n STRING\n ];\n\n var VALUE_MODES = [...MODES];\n VALUE_MODES.pop();\n VALUE_MODES.push(CONTAINER_STRING);\n VALUE_CONTAINER.contains = VALUE_MODES;\n\n return {\n name: 'YAML',\n case_insensitive: true,\n aliases: ['yml', 'YAML'],\n contains: MODES\n };\n}",
"function yaml(hljs) {\n var LITERALS = 'true false yes no null';\n\n // YAML spec allows non-reserved URI characters in tags.\n var URI_CHARACTERS = '[\\\\w#;/?:@&=+$,.~*\\\\\\'()[\\\\]]+';\n\n // Define keys as starting with a word character\n // ...containing word chars, spaces, colons, forward-slashes, hyphens and periods\n // ...and ending with a colon followed immediately by a space, tab or newline.\n // The YAML spec allows for much more than this, but this covers most use-cases.\n var KEY = {\n className: 'attr',\n variants: [\n { begin: '\\\\w[\\\\w :\\\\/.-]*:(?=[ \\t]|$)' },\n { begin: '\"\\\\w[\\\\w :\\\\/.-]*\":(?=[ \\t]|$)' }, // double quoted keys\n { begin: '\\'\\\\w[\\\\w :\\\\/.-]*\\':(?=[ \\t]|$)' } // single quoted keys\n ]\n };\n\n var TEMPLATE_VARIABLES = {\n className: 'template-variable',\n variants: [\n { begin: '{{', end: '}}' }, // jinja templates Ansible\n { begin: '%{', end: '}' } // Ruby i18n\n ]\n };\n var STRING = {\n className: 'string',\n relevance: 0,\n variants: [\n { begin: /'/, end: /'/ },\n { begin: /\"/, end: /\"/ },\n { begin: /\\S+/ }\n ],\n contains: [\n hljs.BACKSLASH_ESCAPE,\n TEMPLATE_VARIABLES\n ]\n };\n\n // Strings inside of value containers (objects) can't contain braces,\n // brackets, or commas\n var CONTAINER_STRING = hljs.inherit(STRING, {\n variants: [\n { begin: /'/, end: /'/ },\n { begin: /\"/, end: /\"/ },\n { begin: /[^\\s,{}[\\]]+/ }\n ]\n });\n\n var DATE_RE = '[0-9]{4}(-[0-9][0-9]){0,2}';\n var TIME_RE = '([Tt \\\\t][0-9][0-9]?(:[0-9][0-9]){2})?';\n var FRACTION_RE = '(\\\\.[0-9]*)?';\n var ZONE_RE = '([ \\\\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?';\n var TIMESTAMP = {\n className: 'number',\n begin: '\\\\b' + DATE_RE + TIME_RE + FRACTION_RE + ZONE_RE + '\\\\b'\n };\n\n var VALUE_CONTAINER = {\n end: ',',\n endsWithParent: true,\n excludeEnd: true,\n contains: [],\n keywords: LITERALS,\n relevance: 0\n };\n var OBJECT = {\n begin: '{',\n end: '}',\n contains: [VALUE_CONTAINER],\n illegal: '\\\\n',\n relevance: 0\n };\n var ARRAY = {\n begin: '\\\\[',\n end: '\\\\]',\n contains: [VALUE_CONTAINER],\n illegal: '\\\\n',\n relevance: 0\n };\n\n var MODES = [\n KEY,\n {\n className: 'meta',\n begin: '^---\\s*$',\n relevance: 10\n },\n { // multi line string\n // Blocks start with a | or > followed by a newline\n //\n // Indentation of subsequent lines must be the same to\n // be considered part of the block\n className: 'string',\n begin: '[\\\\|>]([0-9]?[+-])?[ ]*\\\\n( *)[\\\\S ]+\\\\n(\\\\2[\\\\S ]+\\\\n?)*'\n },\n { // Ruby/Rails erb\n begin: '<%[%=-]?',\n end: '[%-]?%>',\n subLanguage: 'ruby',\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n },\n { // named tags\n className: 'type',\n begin: '!\\\\w+!' + URI_CHARACTERS\n },\n // https://yaml.org/spec/1.2/spec.html#id2784064\n { // verbatim tags\n className: 'type',\n begin: '!<' + URI_CHARACTERS + \">\"\n },\n { // primary tags\n className: 'type',\n begin: '!' + URI_CHARACTERS\n },\n { // secondary tags\n className: 'type',\n begin: '!!' + URI_CHARACTERS\n },\n { // fragment id &ref\n className: 'meta',\n begin: '&' + hljs.UNDERSCORE_IDENT_RE + '$'\n },\n { // fragment reference *ref\n className: 'meta',\n begin: '\\\\*' + hljs.UNDERSCORE_IDENT_RE + '$'\n },\n { // array listing\n className: 'bullet',\n // TODO: remove |$ hack when we have proper look-ahead support\n begin: '\\\\-(?=[ ]|$)',\n relevance: 0\n },\n hljs.HASH_COMMENT_MODE,\n {\n beginKeywords: LITERALS,\n keywords: { literal: LITERALS }\n },\n TIMESTAMP,\n // numbers are any valid C-style number that\n // sit isolated from other words\n {\n className: 'number',\n begin: hljs.C_NUMBER_RE + '\\\\b'\n },\n OBJECT,\n ARRAY,\n STRING\n ];\n\n var VALUE_MODES = [...MODES];\n VALUE_MODES.pop();\n VALUE_MODES.push(CONTAINER_STRING);\n VALUE_CONTAINER.contains = VALUE_MODES;\n\n return {\n name: 'YAML',\n case_insensitive: true,\n aliases: ['yml', 'YAML'],\n contains: MODES\n };\n}",
"function yamlDump(input) {\n return jsYaml.dump(input, { schema: schema });\n}",
"cleanYaml(yaml, mode = 'edit') {\n try {\n const obj = jsyaml.load(yaml);\n\n if (mode !== 'edit') {\n this.$dispatch(`cleanForNew`, obj);\n }\n\n if (obj._type) {\n obj.type = obj._type;\n delete obj._type;\n }\n const out = jsyaml.dump(obj, { skipInvalid: true });\n\n return out;\n } catch (e) {\n return null;\n }\n }",
"function $ce6ca07b3ed13bb6$var$yaml(hljs) {\n var LITERALS = \"true false yes no null\";\n // YAML spec allows non-reserved URI characters in tags.\n var URI_CHARACTERS = \"[\\\\w#;/?:@&=+$,.~*'()[\\\\]]+\";\n // Define keys as starting with a word character\n // ...containing word chars, spaces, colons, forward-slashes, hyphens and periods\n // ...and ending with a colon followed immediately by a space, tab or newline.\n // The YAML spec allows for much more than this, but this covers most use-cases.\n var KEY = {\n className: \"attr\",\n variants: [\n {\n begin: \"\\\\w[\\\\w :\\\\/.-]*:(?=[ \t]|$)\"\n },\n {\n begin: '\"\\\\w[\\\\w :\\\\/.-]*\":(?=[ \t]|$)'\n },\n {\n begin: \"'\\\\w[\\\\w :\\\\/.-]*':(?=[ \t]|$)\"\n } // single quoted keys\n ]\n };\n var TEMPLATE_VARIABLES = {\n className: \"template-variable\",\n variants: [\n {\n begin: /\\{\\{/,\n end: /\\}\\}/\n },\n {\n begin: /%\\{/,\n end: /\\}/\n } // Ruby i18n\n ]\n };\n var STRING = {\n className: \"string\",\n relevance: 0,\n variants: [\n {\n begin: /'/,\n end: /'/\n },\n {\n begin: /\"/,\n end: /\"/\n },\n {\n begin: /\\S+/\n }\n ],\n contains: [\n hljs.BACKSLASH_ESCAPE,\n TEMPLATE_VARIABLES\n ]\n };\n // Strings inside of value containers (objects) can't contain braces,\n // brackets, or commas\n var CONTAINER_STRING = hljs.inherit(STRING, {\n variants: [\n {\n begin: /'/,\n end: /'/\n },\n {\n begin: /\"/,\n end: /\"/\n },\n {\n begin: /[^\\s,{}[\\]]+/\n }\n ]\n });\n var DATE_RE = \"[0-9]{4}(-[0-9][0-9]){0,2}\";\n var TIME_RE = \"([Tt \\\\t][0-9][0-9]?(:[0-9][0-9]){2})?\";\n var FRACTION_RE = \"(\\\\.[0-9]*)?\";\n var ZONE_RE = \"([ \\\\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\";\n var TIMESTAMP = {\n className: \"number\",\n begin: \"\\\\b\" + DATE_RE + TIME_RE + FRACTION_RE + ZONE_RE + \"\\\\b\"\n };\n var VALUE_CONTAINER = {\n end: \",\",\n endsWithParent: true,\n excludeEnd: true,\n contains: [],\n keywords: LITERALS,\n relevance: 0\n };\n var OBJECT = {\n begin: /\\{/,\n end: /\\}/,\n contains: [\n VALUE_CONTAINER\n ],\n illegal: \"\\\\n\",\n relevance: 0\n };\n var ARRAY = {\n begin: \"\\\\[\",\n end: \"\\\\]\",\n contains: [\n VALUE_CONTAINER\n ],\n illegal: \"\\\\n\",\n relevance: 0\n };\n var MODES = [\n KEY,\n {\n className: \"meta\",\n begin: \"^---\\\\s*$\",\n relevance: 10\n },\n {\n // Blocks start with a | or > followed by a newline\n //\n // Indentation of subsequent lines must be the same to\n // be considered part of the block\n className: \"string\",\n begin: \"[\\\\|>]([1-9]?[+-])?[ ]*\\\\n( +)[^ ][^\\\\n]*\\\\n(\\\\2[^\\\\n]+\\\\n?)*\"\n },\n {\n begin: \"<%[%=-]?\",\n end: \"[%-]?%>\",\n subLanguage: \"ruby\",\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n },\n {\n className: \"type\",\n begin: \"!\\\\w+!\" + URI_CHARACTERS\n },\n // https://yaml.org/spec/1.2/spec.html#id2784064\n {\n className: \"type\",\n begin: \"!<\" + URI_CHARACTERS + \">\"\n },\n {\n className: \"type\",\n begin: \"!\" + URI_CHARACTERS\n },\n {\n className: \"type\",\n begin: \"!!\" + URI_CHARACTERS\n },\n {\n className: \"meta\",\n begin: \"&\" + hljs.UNDERSCORE_IDENT_RE + \"$\"\n },\n {\n className: \"meta\",\n begin: \"\\\\*\" + hljs.UNDERSCORE_IDENT_RE + \"$\"\n },\n {\n className: \"bullet\",\n // TODO: remove |$ hack when we have proper look-ahead support\n begin: \"-(?=[ ]|$)\",\n relevance: 0\n },\n hljs.HASH_COMMENT_MODE,\n {\n beginKeywords: LITERALS,\n keywords: {\n literal: LITERALS\n }\n },\n TIMESTAMP,\n // numbers are any valid C-style number that\n // sit isolated from other words\n {\n className: \"number\",\n begin: hljs.C_NUMBER_RE + \"\\\\b\",\n relevance: 0\n },\n OBJECT,\n ARRAY,\n STRING\n ];\n var VALUE_MODES = [\n ...MODES\n ];\n VALUE_MODES.pop();\n VALUE_MODES.push(CONTAINER_STRING);\n VALUE_CONTAINER.contains = VALUE_MODES;\n return {\n name: \"YAML\",\n case_insensitive: true,\n aliases: [\n \"yml\",\n \"YAML\"\n ],\n contains: MODES\n };\n}",
"function loadYaml (filename) {\n const file = findFile(`${filename}.yml`)\n return file ? YAML.parse(fs.readFileSync(file, 'utf8')) : {}\n }",
"function yaml(c) {\n return c.pushWhitespaceInsignificantSingleLine().one(value);\n}",
"function readInputConfigFileReturnJSON(file) {\n 'use strict';\n let yamlConfig = fs.readFileSync(file).toString();\n return yaml.safeLoad(yamlConfig);\n}",
"getLanguageName() {\n return \"YAML\";\n }",
"getConfig() {\n try {\n let contents = fs.readFileSync(this.getFilePath(), 'utf8');\n return yaml.load(contents);\n }\n catch (err) {\n console.log(err.stack || String(err));\n }\n }",
"function parseJsonSchema(schema) {\n // we use the presence of the double quoted string to differentiate JSON from YAML\n if (schema.indexOf('\"$schema\"') !== -1) {\n return JSON.parse(schema)\n } else {\n return yaml.safeLoad(schema)\n }\n}",
"function yamlConfig() {\n var Parser = this.Parser\n var Compiler = this.Compiler\n var parser = Parser && Parser.prototype.blockTokenizers\n var compiler = Compiler && Compiler.prototype.visitors\n\n if (parser && parser.yamlFrontMatter) {\n parser.yamlFrontMatter = factory(parser.yamlFrontMatter)\n }\n\n if (compiler && compiler.yaml) {\n compiler.yaml = factory(compiler.yaml)\n }\n}",
"function YAMLDumper(dataObj) {\n return yaml.safeDump(dataObj);\n}",
"function jsonize(str) {\n try {\n JSON.parse(str);\n return str;\n }\n catch (e) {\n return str\n .replace(/([\\$\\w]+)\\s*:/g, // wrap keys without double quote\n function (_, $1) {\n return '\"' + $1 + '\":';\n })\n .replace(/'([^']+)'/g, // replacing single quote to double quote\n function (_, $1) {\n return '\"' + $1 + '\"';\n });\n }\n}",
"loadConfig() {\n // TODO: Make Private\n const configPath = path.join(__dirname, '../config.yml');\n return yaml.safeLoad(fs.readFileSync(configPath));\n }",
"function readYAMLFile(filePath, isEncrypted) {\n const cleanedPath = filePath.replace(/\\//g, '\\\\/');\n let results;\n if (isEncrypted) {\n results = execSync(`sops --decrypt ${cleanedPath}`);\n } else {\n // Don't try to change this to `fs.readFileSync` to avoid the useless cat:\n // readFileSync can't find this path, cat can.\n results = execSync(`cat ${cleanedPath}`);\n }\n return YAML.parse(results.toString());\n}",
"function yamlTheme() {\n return gulp.src('src/yml/theme.yml')\n .pipe(yaml({ schema: 'DEFAULT_SAFE_SCHEMA' }))\n .pipe(gulp.dest('src/tmp/'));\n}",
"function validateYaml(filename, content) {\n if (!content.hasOwnProperty('name')) {\n console.error(`Missing 'name' in ${filename}`)\n }\n if (!content.hasOwnProperty('blip')) {\n console.error(`Missing 'blip' in ${filename}`)\n }\n if (!Array.isArray(content.blip)) {\n console.error(`'blip' is not an array in ${filename}`)\n }\n for (var blip of content.blip) {\n if (!blip.hasOwnProperty('version')) {\n console.error(`Missing 'blip[*].version' in ${filename}`)\n }\n if (!blip.hasOwnProperty('ring')) {\n console.error(`Missing 'blip[*].ring' in ${filename}`)\n }\n }\n if (!content.hasOwnProperty('description')) {\n console.error(`Missing 'description' in ${filename}`)\n }\n}",
"function JSONize(str) {\r\n return str\r\n // Wrap keys without quote with double quotes\r\n .replace(/([\\$\\w]+)\\s*:/g, function (_, $1) { return '\"' + $1 + '\":' })\r\n // Replace single quote wrapped ones to double quotes\r\n .replace(/'([^']+)'/g, function (_, $1) { return '\"' + $1 + '\"' })\r\n}",
"function parseAsStory(jsonString) {\n let json = null;\n\n try {\n json = JSON.parse(jsonString);\n\n // Handle standard reelyActive API response case\n if(json.hasOwnProperty('stories')) {\n let storyId = Object.keys(json.stories)[0];\n let story = json.stories[storyId];\n return story;\n }\n }\n catch(e) { }\n\n return json;\n }",
"function yaml2json() {\n console.log(\"Converting YAML to JSON...\");\n let addresses = {};\n let ips = {};\n let blacklist = [];\n let whitelist = [];\n fs.readFile(\"./_data/archive_compiled.yaml\", function(err, archive) {\n var archive = yaml.safeLoad(archive);\n Object.keys(legiturls).forEach(function(key) {\n whitelist.push(legiturls[key]['url'].toLowerCase().replace('www.', '').replace(/(^\\w+:|^)\\/\\//, ''));\n whitelist.push('www.' + legiturls[key]['url'].toLowerCase().replace('www.', '').replace(/(^\\w+:|^)\\/\\//, ''));\n });\n Object.keys(data).reverse().forEach(function(key) {\n if ('addresses' in data[key]) {\n data[key]['addresses'].forEach(function(addr) {\n if (!(addr in addresses)) {\n addresses[addr] = [];\n }\n addresses[addr].unshift(data[key]['id']);\n });\n }\n if ('url' in data[key]) {\n blacklist.push(data[key]['url'].toLowerCase().replace(/(^\\w+:|^)\\/\\//, ''));\n blacklist.push('www.' + data[key]['url'].toLowerCase().replace(/(^\\w+:|^)\\/\\//, ''));\n }\n if (data[key]['id'] in archive) {\n if (\"ip\" in archive[data[key]['id']]) {\n if (!(archive[data[key]['id']]['ip'] in ips)) {\n ips[archive[data[key]['id']]['ip']] = [];\n }\n ips[archive[data[key]['id']]['ip']].unshift(data[key]['id']);\n data[key]['ip'] = archive[data[key]['id']]['ip'];\n }\n if (\"nameservers\" in archive[data[key]['id']]) {\n data[key]['nameservers'] = archive[data[key]['id']]['nameservers'];\n }\n if (\"status\" in archive[data[key]['id']]) {\n data[key]['status'] = archive[data[key]['id']]['status'];\n }\n }\n });\n if (job == \"build\" || job == false) {\n if (!fs.existsSync(\"./_site\")) {\n fs.mkdirSync(\"./_site/\");\n }\n if (!fs.existsSync(\"./_site/data\")) {\n fs.mkdirSync(\"./_site/data\");\n }\n }\n fs.writeFile(\"./_site/data/scams.json\", JSON.stringify(data), function(err) {\n console.log(\"Scam file compiled.\");\n fs.writeFile(\"./_site/data/addresses.json\", JSON.stringify(addresses), function(err) {\n console.log(\"Address file compiled.\");\n fs.writeFile(\"./_site/data/ips.json\", JSON.stringify(ips), function(err) {\n console.log(\"IPs file compiled.\");\n fs.writeFile(\"./_site/data/blacklist.json\", JSON.stringify(blacklist, null, \" \"), function(err) {\n console.log(\"Blacklist file compiled.\");\n fs.writeFile(\"./_site/data/whitelist.json\", JSON.stringify(whitelist, null, \" \"), function(err) {\n console.log(\"Whitelist file compiled.\");\n if (job == \"build\" || job == false) {\n generatestatic();\n } else if (job == \"update\") {\n finish(\"updating\");\n } else if (job == \"archive\") {\n archiveorg();\n }\n });\n });\n });\n });\n });\n });\n}",
"function yamlparser(filep, field) {\n try {\n var src = fs.readFileSync(filep,'utf8')\n var doc = yaml.safeLoad(src)\n if (!doc[field]) {\n console.log('Error in ',field,' data:',doc)\n return null\n } else {\n const keyn = slugify(doc[field]).toLowerCase()\n return {\n [keyn]: doc\n }\n }\n }\n catch (e) {\n console.log('Cannot read', filep, \"\\n\", e)\n return null\n }\n}",
"function processYAML(yamlFile) {\n try {\n console.log('convert Yaml file', yamlFile);\n // Get document, or throw exception on error\n var yamlObject = yaml.safeLoad(fs.readFileSync(yamlFile, 'utf8'));\n //console.log('yaml json string', JSON.stringify(yamlObject));\n console.log('processYAML', yamlObject);\n yamlObject.application.java.tomcat.components.forEach(function(e) {\n downloadFile(e.artifact, false)\n });\n } catch (e) {\n console.log(e);\n }\n}",
"function parse(data, options) {\n // Allow the initial '---' to be omitted.\n // Note: this hack does not allow the block\n // to contain blank lines, although YAML\n // does support such expressions!\n var view = lodash__WEBPACK_IMPORTED_MODULE_3___default.a.assign({}, options);\n\n var dataStr = data;\n\n if (!dataStr.match(/^---/) && dataStr.match(/^([\\s\\S]*)[\\r\\n]+---/)) {\n dataStr = '---\\n' + dataStr;\n }\n\n var references = view.references;\n view = lodash__WEBPACK_IMPORTED_MODULE_3___default.a.assign({}, view, gray_matter__WEBPACK_IMPORTED_MODULE_0___default()(dataStr));\n var props = view.data;\n view = lodash__WEBPACK_IMPORTED_MODULE_3___default.a.assign(view, props);\n\n if (references) {\n // the YAML 'references' property uses a format that is\n // different from markdown-it's 'references' object\n view.references = references;\n }\n\n view.content = Object(_markdown__WEBPACK_IMPORTED_MODULE_5__[\"markdown\"])(view.content, view);\n return view;\n}",
"function blowUpHierarchy(yamlLines) {\n var fullKey = \"\";\n var indent = 0;\n var currentIndent = 0;\n var indentSteps = [];\n var postLines = [];\n\n for (var index = 0; index < yamlLines.length; null) {\n var line = yamlLines[index];\n\n var match = line.trim().match(\".*:\");\n currentIndent = yamlLines[index].search(/\\S|$/);\n\n // We're in a list, simply push the content\n if (line.trim().indexOf(\"- \") === 0) {\n while (index < yamlLines.length && (yamlLines[index].trim().indexOf(\"- \") === 0 || yamlLines[index].search(/\\S|$/) > currentIndent)) {\n postLines.push(yamlLines[index]);\n index++;\n }\n continue;\n }\n\n // Down the tree\n if (match && (currentIndent > indent)) {\n if (currentIndent !== 0) {\n fullKey += DOT;\n } else {\n fullKey = \"\";\n }\n fullKey += match[0].replace(/:.*/, \"\");\n if ((currentIndent - indent) > 0) {\n indentSteps.push(currentIndent - indent);\n }\n }\n\n // Up the tree or peer property\n if (match && (currentIndent <= indent)) {\n if (currentIndent === 0) {\n fullKey = \"\";\n }\n\n var keyArr = fullKey.split(DOT);\n keyArr.pop();\n\n var steps = 0;\n // Get the number of steps to travel up the hierarchy tree\n while (indent > currentIndent) {\n indent -= indentSteps.pop();\n keyArr.pop();\n steps++;\n }\n\n fullKey = keyArr.join(DOT);\n if (currentIndent !== 0) {\n fullKey += DOT;\n }\n fullKey += match[0].replace(/:.*/, \"\");\n }\n\n if (line.trim().match(/.*:/)) {\n postLines.push(line.replace(line.split(\":\")[0], fullKey));\n } else {\n postLines.push(line);\n }\n\n indent = currentIndent;\n index++;\n }\n return postLines;\n}"
] | [
"0.7436097",
"0.63431114",
"0.62323123",
"0.6145358",
"0.6144687",
"0.6144687",
"0.6138018",
"0.5777885",
"0.5621768",
"0.5467203",
"0.54542303",
"0.538984",
"0.52895117",
"0.523634",
"0.52218056",
"0.5184282",
"0.5152882",
"0.5137597",
"0.5083414",
"0.50124794",
"0.50003785",
"0.4966437",
"0.4869989",
"0.4857552",
"0.48565143",
"0.48551264",
"0.48325795",
"0.47543663",
"0.47007883",
"0.46653003"
] | 0.7127248 | 1 |
calcule de la moyenne des notes de l'eleve avec les coefficients | static moyenneNote(tableauNotes,idStagiaire = -1) {
// sommes des notes*coef
// sommes des coef
let sommeNoteCoef = 0
let sommeCoef = 0
tableauNotes.forEach(function(element) {
if (element.id === idStagiaire || idStagiaire === -1) {
sommeNoteCoef += element.note * element.coef
sommeCoef += element.coef
}
});
if (sommeCoef != 0 && tableauNotes.length !=0) {
return sommeNoteCoef /sommeCoef
}
else {
return -1
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"pow22523(z) {\r\n const t0 = new FieldElement();\r\n const t1 = new FieldElement();\r\n const t2 = new FieldElement();\r\n let i;\r\n t0.square(z);\r\n // for (i = 1; i < 1; i++) {\r\n // t0.square(t0);\r\n // }\r\n t1.square(t0);\r\n for (i = 1; i < 2; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(z, t1);\r\n t0.mul(t0, t1);\r\n t0.square(t0);\r\n // for (i = 1; i < 1; i++) {\r\n // t0.square(t0);\r\n // }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 5; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 10; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(t1, t0);\r\n t2.square(t1);\r\n for (i = 1; i < 20; i++) {\r\n t2.square(t2);\r\n }\r\n t1.mul(t2, t1);\r\n t1.square(t1);\r\n for (i = 1; i < 10; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 50; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(t1, t0);\r\n t2.square(t1);\r\n for (i = 1; i < 100; i++) {\r\n t2.square(t2);\r\n }\r\n t1.mul(t2, t1);\r\n t1.square(t1);\r\n for (i = 1; i < 50; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t0.square(t0);\r\n for (i = 1; i < 2; i++) {\r\n t0.square(t0);\r\n }\r\n this.mul(t0, z);\r\n }",
"function simplificationSysteme()\n\t{\n\t var i = null; //variables de boucles\n\t var j = null;\n\t var premiere_ligne_ok = false; //variable indiquant si la premiere ligne de la matrice est bien traité (premier coeff egal à 1)\n\t var colonne_full_zero = false; //variable indiquant si la colonne en cours est uniquement constitué de 0\n\t var sous_systeme = null;\n\t \n\t for(i = 0; i < this.matrice_systeme.length; i++) //on parcourt la matrice du systeme\n\t {\n\t if(this.matrice_systeme[i][0] == 1) //si le premier coefficient de la ligne i vaut 1\n\t {\n\t this.P(i, 0); //on place la ligne i en premiere position\n\t premiere_ligne_ok = true; //on indique que la premiere ligne est bien traité\n\t break; //on casse la boucle\n\t }\n\t }\n\t \n\t if(premiere_ligne_ok == false) //si la premiere ligne n'a pas été bien traité\n\t {\n\t for(i = 0; i < this.matrice_systeme.length; i++) //on parcourt la matrice du systeme\n\t {\n\t if(this.matrice_systeme[i][0] != 0) //des que le premier coefficient d'une est non nul\n\t {\n\t this.P(i, 0); //on place cette ligne en premiere position\n\t\t this.M(0, 1/this.matrice_systeme[0][0]); //on divise cette ligne par le premier coefficient pour reduire celui ci à 1\n\t\t premiere_ligne_ok = true; //on indique que la premiere ligne est bien traité\n\t\t break; //on casse la boucle\n\t }\n\t else //si apres avoir parcouru la matrice aucun premier coefficient non nul n'a été trouvé\n\t {\n\t if(i == this.matrice_systeme.length - 1)\n\t\t{\n\t\t colonne_full_zero = true; //on indique que la colonne est rempli de 0\n\t\t}\n\t }\n\t }\n\t }\n\t \n\t if(this.matrice_systeme.length != 1) //si la matrice du systeme n'est pas une matrice ligne\n\t {\n\t for(i = 1; i < this.matrice_systeme.length; i++) //on parcourt toutes les lignes en dessous de la premiere\n\t {\n\t if(this.matrice_systeme[i][0] != 0) //si le premier coeff est non nul\n\t {\n\t this.S(0, i, -this.matrice_systeme[i][0]); //on lui ajoute/retire une combinaison lineaire de la premiere ligne pr reduire son premier coeff à 0\n\t }\n\t }\n\t \n\t sous_systeme = new Array(); //on crée la matrice du sous systeme de notre systeme\n\t sous_systeme[0] = new Array();\n\t sous_systeme[1] = new Array();\n\t \n\t for(i = 0; i < this.matrice_systeme.length - 1; i++) //on remplit les lignes du sous systeme \n\t {\n\t sous_systeme[0][i] = new Array(); //on crée une matrice ligne pr chaque ligne\n\t sous_systeme[1][i] = this.second_membre[i+1]; //on remplit le second membre\n\t \n\t for(j = 0; j < this.matrice_systeme[i].length - 1; j++) //on remplit chaque case de la matrice du systeme du sous systeme\n\t {\n\t sous_systeme[0][i][j] = this.matrice_systeme[i+1][j+1];\n\t }\n\t }\n\t \n\t sous_systeme = new systeme(sous_systeme); //on instance le sous systeme comme une instance de la classe systeme\n\t sous_systeme.simplificationSysteme(); //on simplifie le sous systeme\n\t \n\t for(i = 0; i < this.matrice_systeme.length - 1; i++) //on recupere le sous systeme simplifié dans notre systeme actuel\n\t {\n\t this.second_membre[i+1] = sous_systeme.second_membre[i];\n\t \n\t for(j = 0; j < this.matrice_systeme[i].length - 1; j++)\n\t {\n\t this.matrice_systeme[i+1][j+1] = sous_systeme.matrice_systeme[i][j];\n\t }\n\t }\n\t }\n\t \n\t this.systeme_simplifie = true;\n\t}",
"Cr(){\n return 0.721 + 0.00725*(this.Lj*12/this.Dj)\n }",
"Fj(){\n return 0.18*Math.pow(386/this.Deff(),0.5)\n }",
"calcularIMC() {\n const peso = this.peso;\n const altura = this.altura;\n return (peso / altura * altura)\n }",
"function coefficient([n00, n01, n10, n11]) {\n return (n11 * n00 - n10 * n01) /\n Math.sqrt((n10 + n11) * (n00 + n01) * (n01 + n11) * (n00 + n10));\n}",
"Deff(){\n return 5*(this.wt()*this.Sj/(12*12))*Math.pow(this.Lj,4)*Math.pow(12,4)/(384*29000000*this.Ieff())\n }",
"function getPelnas(pajamos, mokesciai, mokesciai2){\nvar pelnas = (pajamos - (pajamos * mokesciai)) - (pajamos - (pajamos * mokesciai)) * mokesciai2;\n return pelnas;\n}",
"function IMC(peso,altura) {\n\n indice = peso/(Math.pow(altura,2));\n imc = indice.toFixed(2);\n console.log(`El IMC es de: ${imc}.`);\n //return imc;\n}",
"function m_ln(x){ // x>0\r\n var xx=x;\r\n var xxabs = Number(m_abs(xx)); //轉數字\r\n\r\n\r\n if ( xx == 0){ var ans_t = message_1(13); return ans_t; }\r\n if ( xx < 0) { var ans_t =message_1(5); return ans_t; }\r\n\r\n\r\n \r\n\r\n var ee = 2.718281828459045235360287471353; //常數\r\n var count_m = m_cut_nub_m(xxabs); // count 整數位數 >0 位數 , 含 -符號\r\n \r\n\r\n var count_p = m_cut_nub_p(xxabs); // count 小數位數 <0 位數 , 不含 -符號 不含 point\r\n \r\n\r\n var count_t = count_m+count_p+1;\r\n var ans_0 = 0;\r\n\r\n \r\n\r\n var ee_10 =m_pow_m(ee,10); //ee 10次方 = 22026.465794806707\r\n var ee_7 =m_pow_m(ee,7); // ee 7次方 = 1096.633158428458\r\n var ee_5 =m_pow_m(ee,5); // ee 5次方 = 148.4131591025766\r\n var ee_3 =m_pow_m(ee,3); //ee 3次方 = 20.08553692318766 //ee =2.718281828459045\r\n\r\n \r\n\r\n while(xxabs >= ee_10){\r\n //快數取出10 的指數部分 \r\n xxabs = xxabs/ee_10;\r\n ans_0=ans_0+10;\r\n \r\n }\r\n\r\n\r\n while(xxabs >= ee_7){\r\n //快數取出10 的指數部分 \r\n xxabs = xxabs/ee_7;\r\n ans_0=ans_0+7;\r\n \r\n \r\n }\r\n\r\n while(xxabs >= ee_5){\r\n //快數取出5 的指數部分 \r\n xxabs = xxabs/ee_5;\r\n ans_0=ans_0+5;\r\n \r\n }\r\n\r\n while(xxabs >= ee_3){\r\n //快數取出5 的指數部分 \r\n xxabs = xxabs/ee_3;\r\n ans_0=ans_0+3;\r\n \r\n }\r\n\r\n\r\n\r\n while(xxabs >= ee){ //ee=2.718281828459045\r\n //取出1 的指數部分 +5 增加回圈數\r\n xxabs = xxabs/ee;\r\n ans_0=ans_0+1;\r\n \r\n }\r\n\r\n\r\n while(xxabs > 1.5 && xxabs < ee){ \r\n \r\n //取出1 的指數部分\r\n xxabs = (xxabs)/(ee); \r\n ans_0=ans_0 + 1;\r\n \r\n }\r\n\r\n \r\n \r\n\r\n\r\n\r\n while(xxabs < 0.00005 ){ \r\n //取出1 的指數部分\r\n xxabs = (xxabs)*(ee_10); \r\n ans_0=ans_0 - 10;\r\n \r\n }\r\n\r\n\r\n\r\n\r\n\r\n while(xxabs < 0.5 ){ \r\n //取出1 的指數部分\r\n xxabs = (xxabs)*(ee); \r\n ans_0=ans_0 - 1;\r\n\r\n }\r\n\r\n\r\n\r\n\r\n var ans_1 = m_series_ln_a_z(xxabs) ; //由公式作法 0.5 < xxabs <1.5 \r\n \r\n \r\n var ans_t =ans_0 + ans_1;\r\n\r\n if(xx<0){ //負值\r\n ans_t=1.0/ans_t; \r\n }\r\n \r\n\r\n \r\n return ans_t;\r\n}",
"function Metallic() {\n var a = [\n 0, -0.7, -0.4, -0.6,\n -0.45, -0.1, -0.3, -0.35,\n 0.4, 0.6, 0.7, 0.5,\n 0.3, 0.2, -0.13, -0.07,\n 0, -0.06, -0.12, -0.18\n\n -0.2, -0.18, -0.1, -0.03,\n 0.25, 1, 0, -0.05,\n -0.15, -0.2, -0.25, -0.3,\n -0.32, -0.33, -0.33, -0.32,\n -0.25, -0.2, -0.15, -0.1\n ];\n var b = [\n 0, -0.1, -0.2, -0.3,\n 0, 0.5, 1, 0.5,\n -0.4, -0.6, -0.7, -0.6,\n -0.4, -0.6, -0.7, -0.8,\n -0.9, -0.6, -0.2, -0.1,\n\n 0, 0.1, 0.2, 0.3,\n 0, -0.5, -1, -0.5,\n 0.4, 0.6, 0.7, 0.6,\n 0.4, 0.6, 0.7, 0.6,\n 0.25, 0.2, 0.15, 0.1\n ];\n var c = [\n 0, 0.1, -0.05, 0.08,\n -0.12, 0, -0.12, 0,\n -0.15, -0.4, -0.9, -0.95,\n -1, -1, -0.5, -0.4,\n -0.1, -0.3, -0.2, -0.3,\n -0.65, -0.6, -0.7, -0.3,\n -0.1, -0.2, 0, 0.2,\n 0.1, 0.2, 0.16, 0.7,\n 0.6, 0.3, 0.3, 0.05,\n 0.3, 0.6, 1, 0.95,\n 0.9, 0.7, 0.8, 0.1\n ];\n this.waveforms = [b, c];\n}",
"function prix() {\n return 50 * (nbMultiplicateur * nbMultiplicateur * 0.2);\n}",
"function kelimasKvadratu(skaicius) {\n // atsakymas = skaicius * skaicius;\n atsakymas = Math.pow(skaicius, 2);\n console.log(atsakymas);\n}",
"Exp() {\n if (options.dual) {\n var f = Math.exp(this.s);\n return this.map((x, i) => i ? x * f : f);\n }\n if (r == 1 && tot <= 4 && Math.abs(this[0]) < 1E-9 && !options.over) {\n var u = Math.sqrt(Math.abs(this.Dot(this).s));\n if (Math.abs(u) < 1E-5) {\n return this.Add(Element.Scalar(1));\n }\n var v = this.Wedge(this).Scale(-1 / (2 * u));\n var res2 = Element.Add(\n Element.Sub(Math.cos(u), v.Scale(Math.sin(u))), Element.Div(Element.Mul((Element.Add(Math.sin(u), v.Scale(Math.cos(u)))), this),\n (Element.Add(u, v)))\n );\n return res2;\n }\n var res = Element.Scalar(1);\n var y = 1;\n var M = this.Scale(1);\n var N = this.Scale(1);\n for (var x = 1; x < 15; x++) {\n res = res.Add(M.Scale(1 / y));\n M = M.Mul(N);\n y = y * (x + 1);\n }\n return res;\n }",
"function calculateM() {\n return d['T'] * (d['L'] / d['v'] + d['B']) / d['H']\n}",
"Ec(){\n return 1.35*Math.pow(145,1.5)*Math.pow(this.Fc,0.5)\n }",
"function e$j(){return [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}",
"function eqsol(anno){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) ottobre 2010.\n // calcola la data degli equinozi e dei solstizi per l'anno indicato nel parametro.\n\n\nvar Y=anno;\nvar y1=Y/1000;\n\nvar jd1=1721139.2855+365.2421376*Y+0.0679190*y1*y1-0.0027879*y1*y1*y1; // EQUINOZIO DI MARZO\n\nvar jd2=1721233.2486+365.2417284*Y-0.0530180*y1*y1+0.0093320*y1*y1*y1; // SOLSTIZIO DI GIUGNO\n\nvar jd3=1721325.6978+365.2425055*Y-0.1266890*y1*y1+0.0019401*y1*y1*y1; // EQUINOZIO DI SETTEMBRE\n\nvar jd4=1721414.3920+365.2428898*Y-0.0109650*y1*y1-0.0084885*y1*y1*y1; // SOLSTIZIO DI DICEMBRE\n\nvar tempi= new Array(jd1,jd2,jd3,jd4);\n\nreturn tempi;\n\n\n}",
"function moons_jup(jd){\n\n // funzione per il calcolo della posizione dei satelliti medicei di Giove\n // by Salvatore Ruiu -05-2012 Irgoli (Sardegna)\n // jd= numero del giorno giuliano per la data.\n\n var d=jd-2415020; // numero di giorni dal 31-12-1899 \n var V=134.63+0.00111587*d; // argomento del termine a lungo periodo.\n var M=358.476+0.9856003*d;\n var N=225.328+0.0830853*d+0.33*Math.sin(Rad(V));\n\n var J=221.647+0.9025179*d-0.33*Math.sin(Rad(V));\n\n var A=1.916*Math.sin(Rad(M))+0.020*Math.sin(Rad(2*M));\n var B=5.552*Math.sin(Rad(N))+0.167*Math.sin(Rad(2*N));\n\n var K=J+A-B;\n\n var R=1.00014-0.01672*Math.cos(Rad(M))-0.00014*Math.cos(Rad(2*M)); // raggio vettore della Terra.\n\n var RJ=5.20867-0.25192*Math.cos(Rad(N))-0.00610*Math.cos(Rad(2*N)); // raggio vettore di Giove.\n\n var dist=Math.sqrt(RJ*RJ+R*R-2*RJ*R*Math.cos(Rad(K))); // distanza Terra-Giove.\n\n // phi=angolo di fase in radianti.\n\n var phi=Math.asin(R*Math.sin(Rad(K))/dist); \n\n phi=Rda(phi); // angolo di fase in gradi.\n\n var LON_ELIOC=238.05+0.083091*d+0.33*Math.sin(Rad(V))+B;\n\n var Ds=3.07*Math.sin(Rad(LON_ELIOC+44.5));\n var De=Ds-2.15*Math.sin(Rad(phi))*Math.cos(Rad(LON_ELIOC+24))-1.31*((RJ-dist)/dist)*Math.sin(Rad(LON_ELIOC-99.4));\n\n // *** posizione dei satelliti di Giove - inizio.\n\n var u1= 84.5506+203.4058630*(d-dist/173)+phi-B; // Io.\n var u2= 41.5015+101.2916323*(d-dist/173)+phi-B; // Europa.\n var u3=109.9770+ 50.2345169*(d-dist/173)+phi-B; // Ganimede.\n var u4=176.3586+ 21.4879802*(d-dist/173)+phi-B; // Callisto.\n\n var G=187.3+50.310674*(d-dist/173);\n var H=311.1+21.569229*(d-dist/173);\n\n // correzioni\n\n var delta_u1=0.472*Math.sin(Rad(2*(u1-u2)));\n var delta_u2=1.073*Math.sin(Rad(2*(u2-u3)));\n var delta_u3=0.174*Math.sin(Rad(G));\n var delta_u4=0.845*Math.sin(Rad(H));\n\n // distanze dei satelliti dal centro di Giove, in unità del raggio equatoriale di Giove.\n\n var r1= 5.9061-0.0244*Math.cos(Rad(2*(u1-u2)));\n var r2= 9.3972-0.0889*Math.cos(Rad(2*(u2-u3)));\n var r3=14.9894-0.0227*Math.cos(Rad(G));\n var r4=26.3649-0.1944*Math.cos(Rad(H));\n\n // u1,u2,u3,u4 corretti\n\n u1=gradi_360(u1+delta_u1);\n u2=gradi_360(u2+delta_u2);\n u3=gradi_360(u3+delta_u3);\n u4=gradi_360(u4+delta_u4);\n\n // coordinate apparenti rettangolari dei satelliti di Giove\n\n X1=r1*Math.sin(Rad(u1)); Y1=-r1*Math.cos(Rad(u1))*Math.sin(Rad(De));\n X2=r2*Math.sin(Rad(u2)); Y2=-r2*Math.cos(Rad(u2))*Math.sin(Rad(De));\n X3=r3*Math.sin(Rad(u3)); Y3=-r3*Math.cos(Rad(u3))*Math.sin(Rad(De));\n X4=r4*Math.sin(Rad(u4)); Y4=-r4*Math.cos(Rad(u4))*Math.sin(Rad(De));\n \n// Meridiano centrale di Giove: sistema II\n\n var long_m2=290.28+870.1869088*(d-dist/173)+phi-B;\n\n long_m2=gradi_360(long_m2);\n\n // *** posizione dei satelliti di Giove - fine. \n // \n // u=0-360 corrisponde alla congiunzione inferiore del satellite (transita sul disco del pianeta se X,Y<1).\n // u= 90 corrisponde all'elongazione massima occidentale.\n // u= 180 corriponde alla congiunzione superiore.\n // u= 270 corriponde all'elongazione massima orintale.\n\nvar pos_sat= new Array(X1,Y1,u1,X2,Y2,u2,X3,Y3,u3,X4,Y4,u4,long_m2,De);\n\nreturn pos_sat;\n\n}",
"function montaConjuntos(){\r\n\treturn quantidadeDeLinha() / valorDeN();\r\n}",
"recalculate () {\n const n = this.knots.length\n\n this.curves = []\n if (n < 3) return\n\n let k = new Array(n)\n for (let i = 1; i < n - 1; ++i) {\n k[i] = Array.isArray(this.weights) ? this.weights[i] : this.weights(i, this.knots)\n }\n\n let a = new Array(n - 1)\n let b = new Array(n - 1)\n let c = new Array(n - 1)\n let d = new Array(n - 1)\n\n a[0] = 0\n b[0] = 2\n c[0] = k[1]\n d[0] = this.knots[0].plus(this.knots[1].times(1 + k[1]))\n for (let i = 1; i < n - 2; ++i) {\n a[i] = 1\n b[i] = 2 * (k[i] + (k[i] * k[i]))\n c[i] = k[i + 1] * k[i] * k[i]\n d[i] = this.knots[i].times(1 + (2 * k[i]) + (k[i] * k[i]))\n .plus(this.knots[i + 1].times(1 + k[i + 1]).times(k[i] * k[i]))\n }\n a[n - 2] = 1\n b[n - 2] = (2 * k[n - 2]) + (1.5 * k[n - 2] * k[n - 2])\n c[n - 2] = 0\n d[n - 2] = this.knots[n - 2].times(1 + (2 * k[n - 2]) + (k[n - 2] * k[n - 2]))\n .plus(this.knots[n - 1].times(0.5 * k[n - 2] * k[n - 2]))\n\n let p1s = thomas(a, b, c, d)\n let p2s = []\n for (let i = 0; i < n - 2; ++i) {\n p2s.push(this.knots[i + 1].minus(p1s[i + 1].minus(this.knots[i + 1]).times(k[i + 1])))\n }\n p2s.push(this.knots[n - 1].plus(p1s[n - 2]).times(0.5))\n\n for (let i = 0; i < n - 1; ++i) {\n this.curves.push(new BezierCurve([this.knots[i], p1s[i], p2s[i], this.knots[i + 1]]))\n }\n }",
"function Co(t,e,n,r){var i=4,a=.001,o=1e-7,s=10,l=11,u=1/(l-1),c=\"undefined\"!==typeof Float32Array;if(4!==arguments.length)return!1;for(var d=0;d<4;++d)if(\"number\"!==typeof arguments[d]||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;t=Math.min(t,1),n=Math.min(n,1),t=Math.max(t,0),n=Math.max(n,0);var h=c?new Float32Array(l):new Array(l);function f(t,e){return 1-3*e+3*t}function p(t,e){return 3*e-6*t}function v(t){return 3*t}function g(t,e,n){return((f(e,n)*t+p(e,n))*t+v(e))*t}function m(t,e,n){return 3*f(e,n)*t*t+2*p(e,n)*t+v(e)}function y(e,r){for(var a=0;a<i;++a){var o=m(r,t,n);if(0===o)return r;var s=g(r,t,n)-e;r-=s/o}return r}function b(){for(var e=0;e<l;++e)h[e]=g(e*u,t,n)}function x(e,r,i){var a,l,u=0;do{l=r+(i-r)/2,a=g(l,t,n)-e,a>0?i=l:r=l}while(Math.abs(a)>o&&++u<s);return l}function _(e){for(var r=0,i=1,o=l-1;i!==o&&h[i]<=e;++i)r+=u;--i;var s=(e-h[i])/(h[i+1]-h[i]),c=r+s*u,d=m(c,t,n);return d>=a?y(e,c):0===d?c:x(e,r,r+u)}var w=!1;function M(){w=!0,t===e&&n===r||b()}var S=function(i){return w||M(),t===e&&n===r?i:0===i?0:1===i?1:g(_(i),e,r)};S.getControlPoints=function(){return[{x:t,y:e},{x:n,y:r}]};var O=\"generateBezier(\"+[t,e,n,r]+\")\";return S.toString=function(){return O},S}",
"function eq_tempo(){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) ottobre 2011.\n // funzione per il calcolo del valore dell'equazione del tempo per la data odierna.\n // algoritmo di P.D. SMITH.\n \nvar njd=calcola_jd(); // giorno giuliano in questo istante a Greenwich.\n njd=jdHO(njd)+0.5; // g. g. a mezzogiorno di Greenwich.\n\nvar ar_sole=pos_sole(njd); // calcolo dell'ascensione retta del sole.\nvar anno=jd_data(njd); // anno di riferimento.\n\nvar Tempo_medio_Greenw=tsg_tmg_data(ar_sole[0],anno[2],njd); // tempo medio di Greenwich.\nvar valore_et=12-Tempo_medio_Greenw; // valore dell'equazione del tempo.\n\n valore_et=valore_et*60; // valore in minuti.\n\n valore_et=valore_et.toFixed(6);\n\n\n\nreturn valore_et\n\n}",
"function obli_ecli(njd){\n\n // calcola l'obliquità dell'eclittica.\n // per l'equinozio della data.\n // T= numero di secoli giuliani dallo 0.5 gennaio 1900.\n\n var T=(njd-2415020.0)/36525;\n\n var obli_eclittica=23.452294-0.0130125*T-0.00000164*T*T+0.000000503*T*T*T;\n\nreturn obli_eclittica; //obliquità in gradi\n\n}",
"determinant() {\n return (\n this.a00*this.adj(0, 0)\n +this.a01*this.adj(0, 1)\n +this.a02*this.adj(0, 2)\n +this.a03*this.adj(0, 3)\n );\n }",
"function JJPower() {\n JJPower.easeArray = [0, 0.004, 0.008, 0.013, 0.019, 0.026, 0.033, 0.041, 0.05, 0.06, 0.071, 0.082, 0.095, 0.108, 0.122, 0.137, 0.152, 0.169, 0.185, 0.203, 0.221, 0.239, 0.257, 0.276, 0.295, 0.314, 0.333, 0.352, 0.371, 0.39, 0.409, 0.427, 0.445, 0.462, 0.48, 0.497, 0.513, 0.53, 0.545, 0.561, 0.576, 0.591, 0.605, 0.619, 0.632, 0.645, 0.658, 0.67, 0.683, 0.694, 0.706, 0.717, 0.727, 0.738, 0.748, 0.758, 0.767, 0.776, 0.785, 0.794, 0.802, 0.811, 0.818, 0.826, 0.834, 0.841, 0.848, 0.855, 0.861, 0.867, 0.874, 0.879, 0.885, 0.891, 0.896, 0.901, 0.906, 0.911, 0.916, 0.92, 0.925, 0.929, 0.933, 0.937, 0.941, 0.944, 0.948, 0.951, 0.954, 0.958, 0.96, 0.963, 0.966, 0.969, 0.971, 0.973, 0.976, 0.978, 0.98, 0.982, 0.983, 0.985, 0.987, 0.988, 0.99, 0.991, 0.992, 0.993, 0.994, 0.995, 0.996, 0.997, 0.998, 0.998, 0.999, 0.999, 0.999, 1, 1, 1, 1];\n JJPower.isMobile = false;\n\n /** Prep Static Functions **/\n JJPower.enhance = function (element) {\n if (element) {\n Object.assign(element, JJPower.prototype);\n }\n return element;\n };\n\n JJPower.query = function () {\n const queryText = getGeneratedQueryText(...arguments);\n\n const element = document.querySelector(queryText);\n\n JJPower.enhance(element);\n return element;\n };\n\n JJPower.jjCreateElement = function (tagName) {\n var element;\n if (tagName.toUpperCase() == 'SVG') {\n element = document.createElementNS('http://www.w3.org/2000/svg', tagName);\n } else {\n element = document.createElement(tagName);\n }\n return JJPower.enhance(element);\n };\n\n /** *Commonly used****/\n JJPower.prototype.jjWidth = function () {\n return this.getBoundingClientRect().width;\n };\n\n JJPower.prototype.jjAppend = function (tagName) {\n const me = this;\n let child;\n if (isSVGElement(tagName)) {\n child = document.createElementNS('http://www.w3.org/2000/svg', tagName);\n } else {\n child = document.createElement(tagName);\n }\n JJPower.enhance(child);\n\n this.appendChild(child);\n return child;\n\n\n // Inner functions\n // Either the tag itself is SVG, or it's parent (this) is an SVG element\n function isSVGElement(tagName) {\n const isIt = (tagName.toUpperCase() == 'SVG' || (me instanceof SVGElement));\n return isIt;\n }\n };\n\n JJPower.prototype.jjQuery = function () {\n const queryText = getGeneratedQueryText(...arguments);\n\n const element = this.querySelector(queryText);\n JJPower.enhance(element);\n return element;\n };\n\n JJPower.prototype.jjQueryAll = function () {\n const queryText = getGeneratedQueryText(...arguments);\n\n let elements = this.querySelectorAll(queryText);\n elements = Array.from(elements);\n elements.forEach(JJPower.enhance);\n return elements;\n };\n\n JJPower.prototype.jjGetChildren = function () {\n let elements = this.children || this.childNodes;\n elements = Array.from(elements);\n elements.forEach(JJPower.enhance);\n return elements;\n };\n\n JJPower.prototype.jjStyle = function (styleMap) {\n const keys = Object.keys(styleMap);\n for (const key of keys) {\n this.style[key] = styleMap[key];\n }\n return this;\n };\n\n JJPower.prototype.jjAttr = function (attrMap) {\n const keys = Object.keys(attrMap);\n let val;\n for (const key of keys) {\n val = attrMap[key];\n this.setAttribute(key, attrMap[key]);\n if (!val) {\n this.removeAttribute(key);\n }\n }\n return this;\n };\n\n JJPower.prototype.jjAddEventListener = function (eventName, callBack, useCapture) {\n let jjEventName = eventName;\n if (JJPower.isMobile) {\n jjEventName = getMobileEventName(eventName, this);\n }\n if (jjEventName) {\n this.addEventListener(jjEventName, callBack, useCapture);\n }\n\n return this;\n };\n\n JJPower.prototype.jjRemoveEventListener = function (eventName, callBack, useCapture) {\n let jjEventName = eventName;\n if (JJPower.isMobile) {\n jjEventName = getMobileEventName(eventName, this);\n }\n if (jjEventName) {\n this.removeEventListener(jjEventName, callBack, useCapture);\n }\n\n return this;\n };\n\n JJPower.prototype.jjAddClass = function () {\n try { // If the user gives bad dataList (eg. empty string) don't overreact, stay cool\n const styleModuleObject = arguments[0];\n if (typeof styleModuleObject === 'string') { // This means we're in sandbox\n this.classList.add(...arguments);\n } else { // this means we're using css modules\n let className;\n for (let i = 1; i < arguments.length; i++) {\n className = arguments[i];\n this.classList.add(styleModuleObject[className]);\n }\n }\n } catch (e) {\n }\n\n return this;\n };\n\n JJPower.prototype.jjRemoveClass = function () {\n const styleModuleObject = arguments[0];\n if (typeof styleModuleObject === 'string') { // This means we're in sandbox\n this.classList.remove(...arguments);\n } else { // this means we're using css modules\n let className;\n for (let i = 1; i < arguments.length; i++) {\n className = arguments[i];\n this.classList.remove(styleModuleObject[className]);\n }\n }\n\n return this;\n };\n\n JJPower.prototype.jjToggleClass = function () {\n const styleModuleObject = arguments[0];\n let hasStyleModuleObject = false;\n let startIndex = 0;\n let className;\n if (typeof styleModuleObject !== 'string') { // this means we're using css modules\n hasStyleModuleObject = true;\n startIndex = 1;\n }\n\n for (let i = startIndex; i < arguments.length; i++) {\n className = (hasStyleModuleObject ? styleModuleObject[arguments[i]] : arguments[i]);\n if (this.classList.contains(className)) {\n this.classList.remove(className);\n } else {\n this.classList.add(className);\n }\n }\n\n return this;\n };\n\n JJPower.prototype.jjContainsClass = function () {\n let className = getGeneratedClassName(...arguments);\n let classList = this.classList;\n return classList.contains(className);\n };\n\n\n JJPower.prototype.jjClear = function () {\n while (this.firstChild) { // If the user gives bad dataList (eg. empty string) don't overreact, stay cool\n this.removeChild(this.firstChild);\n }\n return this;\n };\n\n JJPower.prototype.jjRemoveMe = function () {\n let parentNode = this.parentNode;\n if (parentNode) {\n parentNode.removeChild(this);\n }\n };\n\n JJPower.prototype.jjText = function (textContent) {\n this.textContent = textContent;\n return this;\n };\n\n JJPower.prototype.jjAddText = function (textContent) {\n let textNode = document.createTextNode(textContent);\n this.appendChild(textNode);\n return this;\n };\n\n JJPower.prototype.jjAddBoldText = function (textContent) {\n this.jjAppend(\"b\")\n .jjText(textContent);\n return this;\n };\n\n JJPower.prototype.jjAddTextBreak = function () {\n this.jjAppend(\"br\");\n return this;\n };\n\n JJPower.prototype.jjClone = function (isDeep) {\n const element = this.cloneNode(isDeep);\n JJPower.enhance(element);\n return element;\n };\n\n JJPower.prototype.jjSetData = function (dataObject) {\n this.__data__ = dataObject;\n return this;\n };\n\n JJPower.prototype.jjGetData = function () {\n return this.__data__;\n };\n\n JJPower.prototype.jjSetIndex = function (index) {\n this.setAttribute('jjIndex', index);\n return this;\n };\n\n JJPower.prototype.jjGetIndex = function () {\n return +this.getAttribute('jjIndex');\n };\n\n //Returns null if no papa found\n JJPower.prototype.jjGetClosestPapaWithClass = function () {\n const className = getGeneratedClassName(...arguments);\n let bingoPapa = this.closest(\".\" + className);\n return JJPower.enhance(bingoPapa);\n };\n\n //Returns null if no papa found\n JJPower.prototype.jjClosest = function () {\n const selectorStr = getGeneratedQueryText(...arguments);\n let bingoPapa = this.closest(selectorStr);\n return JJPower.enhance(bingoPapa);\n };\n\n JJPower.prototype.jjIsAncestor = function (ancestor) {\n let papa = this;\n while (papa && (papa !== ancestor)) {\n papa = papa.parentNode;\n }\n return papa;\n };\n\n\n JJPower.prototype.jjGetStylePixelNumberValue = function (styleName) {\n let strOrig = this.style[styleName];\n let numStr = strOrig.replace(\"px\", \"\");\n return +numStr;\n };\n\n /** Measurements Calculations **/\n //This is expensive! Uses getBoundingClientRect\n JJPower.prototype.jjMouseCoordinatesRelativeToMe = function (event) {\n let clientRect = this.getBoundingClientRect();\n let x = event.clientX - clientRect.left;\n let y = event.clientY - clientRect.top;\n\n return {\n x: x,\n y: y,\n rect: clientRect\n }\n };\n\n /** Inline Style **/\n JJPower.prototype.jjApplyTransform = function (x, y, rotation, rotateFirst, translateUnit) {\n let hasTranslate = (x !== undefined || y !== undefined);\n\n if (!y) {\n y = 0;\n }\n if (!x) {\n x = 0;\n }\n if (!translateUnit) {\n translateUnit = \"px\";\n }\n\n let transformStr = \"\";\n let isSVG = this instanceof SVGElement;\n\n let translateStr = \"\";\n let rotateStr = \"\";\n\n if (hasTranslate) {\n translateStr = getTranslateStr();\n }\n if (rotation) {\n rotateStr = getRotateStr();\n }\n\n if (rotateFirst) {\n transformStr = rotateStr + \" \" + translateStr;\n } else {\n transformStr = translateStr + \" \" + rotateStr;\n }\n transformStr.trim();\n\n\n if (isSVG) {\n this.setAttribute(\"transform\", transformStr);\n } else {\n this.style.transform = transformStr;\n }\n\n this.jjTotallyUnreliableY = y; //Ugly workaround for specific issue\n this.jjTotallyUnreliableX = x; //Ugly workaround for specific issue\n\n return this;\n\n //Inner functions\n function getTranslateStr() {\n let translateStr;\n if (isSVG) {\n translateStr = `translate(${x}, ${y})`;\n } else {\n translateStr = `translate(${x}${translateUnit}, ${y}${translateUnit})`;\n }\n return translateStr;\n }\n\n function getRotateStr() {\n let rotateStr;\n if (isSVG) {\n rotateStr = `rotate(${rotation})`;\n } else {\n rotateStr = `rotate(${rotation}deg)`;\n }\n return rotateStr;\n }\n };\n\n /** Animation **/\n JJPower.prototype.jjAnimate = function (frameFunction, animationDuration, endFunction, isLinear, timingArr) { // Frame function runs each frame, and takes the current progress param!\n timingArr = timingArr || JJPower.easeArray;\n let timingLen = timingArr.length - 1;\n let me = this;\n let animationObj = {stopNow: false, t: 0};\n\n const startTime = new Date().getTime();\n isLinear = isLinear || animationDuration > 4000;\n\n\n if (!me.animationList) {\n me.animationList = [];\n }\n me.animationList.push(animationObj);\n\n requestAnimationFrame(repeatAnimation);\n\n return animationObj;\n\n /* Inner Functions */\n function repeatAnimation() {\n if (animationObj.stopNow) { //It hurts my soul to return in the middle of a function, but had to. God forgive me.\n return;\n }\n\n const nowTime = new Date().getTime();\n let progressTime = nowTime - startTime;\n progressTime = Math.min(animationDuration, progressTime);\n\n let t = progressTime / animationDuration;\n if (!isLinear) {\n t = JJPower.easeInTiming(t, timingArr, timingLen);\n }\n\n frameFunction(t);\n\n if (t < 1) {\n requestAnimationFrame(repeatAnimation);\n } else if (endFunction) {\n endFunction();\n }\n\n animationObj.t = t;\n }\n };\n\n JJPower.easeInTiming = function (t, timingArr, timingLen) {\n let real = t * timingLen;\n let base = Math.floor(real);\n let next = Math.ceil(real);\n let retT = getValueByProgress(timingArr[base], timingArr[next], real - base);\n return retT;\n\n /* Inner Function */\n function getValueByProgress(startValue, endValue, t){\n return startValue + (endValue - startValue) * t;\n }\n };\n\n JJPower.prototype.jjStopAnimation = function () {\n let me = this;\n if (me.animationList) {\n for (let animationObj of me.animationList) {\n animationObj.stopNow = true;\n }\n }\n return me;\n };\n\n /** *Awful but necessary *****/\n // Used to time css animations. We need to assign the animation start state, then reflow so it will be set, and then assign the end state\n JJPower.prototype.jjForceStyleRecalc = function () {\n let computedStyle = window.getComputedStyle(this);\n return computedStyle.transform;\n };\n\n /******* Private Functions ******/\n\n /** Mobile **/\n function getMobileEventName(origEventName, element) {\n if (element == document && origEventName == \"click\") {\n return \"touchstart\";\n }\n\n switch (origEventName) {\n case \"mousedown\":\n return \"touchstart\";\n case \"mousemove\":\n return \"touchmove\";\n case \"mouseup\":\n return \"touchend\";\n case \"mouseenter\":\n return \"\";\n case \"mouseleave\":\n return \"\";\n case \"mouseover\":\n return \"\";\n case \"mouseout\":\n return \"\";\n default:\n return origEventName\n }\n }\n\n /** CSS Modules **/\n function getGeneratedClassName() {\n let className;\n const param1 = arguments[0];\n const param2 = arguments[1];\n\n if (!param2) { // This means we received only a string representing the selector\n className = param1;\n } else { // this means we're using css modules, and also received the styles object\n className = param2;\n const stylesObject = param1;\n className = stylesObject[className] || param2;\n }\n\n return className;\n };\n\n function getGeneratedQueryText() {\n let queryText;\n const param1 = arguments[0];\n const param2 = arguments[1];\n const stylesObject = param1;\n\n if (!param2) { // This means we received only a string representing the selector\n queryText = param1;\n } else { // this means we're using css modules, and also received the styles object\n queryText = param2;\n queryText = queryText.replace(/(\\.[a-zA-Z0-9]+)/g, replaceFunction);\n }\n return queryText;\n\n\n /* Inner Function */\n function getStyleObjectClassSelector(origQueryText) {\n let classSelector = origQueryText.replace('.', '');\n classSelector = stylesObject[classSelector];\n if (!classSelector) {\n classSelector = origQueryText.replace('.', '');\n }\n classSelector = `.${classSelector}`;\n\n return classSelector;\n }\n\n function replaceFunction(match, p1) {\n let classSelector = getStyleObjectClassSelector(p1, stylesObject);\n return classSelector;\n }\n };\n\n /** Finally. Enhance the document (mainly for attaching mobile friendly event listeners) **/\n JJPower.enhance(document);\n}",
"function telMutaties(){\n\t\t// - Tel de mutaties in tabel 'trLine' per grootboekrekening 'accID'. Update velden aantMut, debet en credit.\n\t\t// - Grootboekrekening is positie 9-1=8\n\t\t// - Bedrag is positie 13-1=12\n\t\t// - DC is positie 14-1=13\n\t\tvar bronTabel = document.getElementById('trLine');\n\t\tvar aantalRijen = bronTabel.rows.length;\n\t\tfor (var i = 1; i < aantalRijen; i++){\n\t\t\tvar rekening = bronTabel.rows.item(i).cells.item(8).innerHTML;\n\t\t\tvar bedrag = parseFloat(bronTabel.rows.item(i).cells.item(12).innerHTML);\n\t\t\tvar dc = bronTabel.rows.item(i).cells.item(13).innerHTML;\n\t\t\tvar debet = 0.0;\n\t\t\tvar credit = 0.0;\n\t\t\tif (dc===\"C\"){ credit+=bedrag; } else {debet+=bedrag;}\n\t\t\tvar positie=rekeningIndex.indexOf(rekening);\n\t\t\tif (positie<0){\n\t\t\t\t// Nog niet aanwezig, toevoegen\n\t\t\t\trekeningIndex.push(rekening);\n\t\t\t\tmatrix.push(new legeMatrix(rekening));\n\t\t\t\tpositie=rekeningIndex.indexOf(rekening);\n\t\t\t}\n\t\t\t// Optellen\n\t\t\tmatrix[positie].aantMut+=1;\n\t\t\tmatrix[positie].debet+=debet;\n\t\t\tmatrix[positie].credit+=credit;\n\t\t}\n\t}",
"function crystal () {\"use strict\"; \n var antenna = Calc.calc ({\n name: \"antenna_loop\",\n input : {\n f : [1e3],\n d : [1e0],\n s : [1e0],\n w : [1e0],\n b : [1e-3],\n h : [1e0],\n N : [],\n design: [\"O\", \"[]\", \"[ ]\", \"[N]\"],\n wire_d : [1e-3],\n material : [\"Perfect\", \"Cu\", \"Al\"]\n },\n output : { \n // part 1\n lambda : [1e+0, 3],\n mu : [1e0, 1],\n g : [1e0, 2, \"exp\"], \n l : [1e0, 2],\n ll : [1e0, 2],\n ll0 : [1e0, 2],\n p : [1e0, 2],\n pl : [1e0, 2],\n S : [1e0, 2],\n \n W : [1e0, 2],\n\n D : [1e0, 2],\n G : [1e-1, 2],\n hg : [1e0, 2],\n RS : [1e0, 2, \"exp\"],\n R1 : [1e0, 2],\n Rl : [1e0, 2],\n Qa : [1e0, 2],\n C : [1e-12, 2],\n C0 : [1e-12, 2],\n L0 : [1e-6, 2],\n eta : [1e0, 2, \"exp\"], \n Za : [1e0, 2, \"complex\"],\n f0 : [1e6, 2],\n lambda0 : [1e0, 2]\n }\n }, function () { \n var KWH = 10;\n var KL = 0.14;\n \n this.check (this.f >= 1e3 && this.f <= 30e6, \"f\"); \n this.check ((this.w > this.h && this.w / this.h <= KWH) || (this.h > this.w && this.h / this.w <= KWH) || (this.h == this.w), \"wh\");\n this.check (this.wire_d > 0, \"wire_d\");\n \n this.lambda = Phys.C / this.f;\n \n // характеристики материала проводника\n var material = Materials [this.material];\n this.g = material.g;\n this.mu = material.mu;\n \n // непосредственно рамка\n if (this.design === \"O\") {\n \tthis.check (this.d > 0, \"d\");\n \t\n this.S = Math.PI * Math.pow (this.d / 2, 2);\n this.p = Math.PI * this.d;\n this.w = 0;\n this.h = 0;\n this.N = 1;\n } else if (this.design === \"[]\") {\n\t\t\tthis.check (this.s > 0, \"s\");\n\t\t\t\n this.S = Math.pow (this.s, 2);\n this.p = this.s * 4;\n this.w = this.s;\n this.h = this.s;\n this.d = 0;\n this.N = 1;\n } else if (this.design === \"[N]\") {\n this.check (this.N >= 2 && this.N <= 60, \"N\");\n this.check (this.b >= 5 * this.wire_d && this.b <= this.s / (5 * this.N), \"b\");\n this.check (this.s > 0, \"s\");\n \n this.S = Math.pow (this.s, 2);\n this.p = this.s * 4;\n this.w = this.s;\n this.h = this.s;\n this.d = 0;\n } else {\n \tthis.check (this.w > 0, \"w\");\n\t\t\tthis.check (this.h > 0, \"h\");\n\t\t\t\n this.S = this.h * this.w;\n this.p = (this.h + this.w) * 2;\n this.d = 0;\n this.N = 1;\n }\n \n var antenna = new MagneticLoop (this.d, this.w, this.h, this.wire_d, this.b, this.N, this.g, this.mu);\n this.antenna = antenna;\n \n var antennaAtLambda = this.antenna.fn (this.lambda);\n this.antennaAtLambda = antennaAtLambda;\n \n this.R1 = antennaAtLambda.R1;\n this.eta = antennaAtLambda.eta;\n this.RS = antennaAtLambda.RS;\n this.Rl = antennaAtLambda.Rl;\n this.Za = antennaAtLambda.Z;\n this.hg = antennaAtLambda.lg;\n this.D = antennaAtLambda.D; \n this.W = antennaAtLambda.W; \n this.Qa = antennaAtLambda.Q;\n this.S = antennaAtLambda.S;\n this.p = antennaAtLambda.p;\n this.l = antennaAtLambda.l;\n this.ll = this.l / this.lambda;\n this.pl = this.p / this.lambda;\n this.f0 = antennaAtLambda.f0;\n this.C0 = antennaAtLambda.C0;\n this.L0 = antennaAtLambda.L0;\n this.lambda0 = antennaAtLambda.lambda0;\n this.ll0 = this.lambda / this.lambda0;\n\n // ограничение на периметр 0,14 lambda (Кочержевский)\n this.suggest (this.p <= this.lambda * KL, \"pL\"); \n this.suggest (!isNaN (this.f0), \"f0\"); \n\n this.check (this.l <= this.lambda * KL || this.N === 1, \"lL\");\n this.check (this.p <= this.lambda, \"pl\"); \n this.check (this.wire_d <= this.p / 20, \"wire_d\"); \n \n // http://www.chipinfo.ru/literature/radio/200404/p67.html\n // this.Q = 3 * Math.log (this.d / this.wire_d) * Math.pow (this.lambda / this.p, 3) / Math.PI * this.eta; \n this.G = Math.log10 (this.D * this.eta);\n\n // fmax ограничиваем l = 0.14 * lambda\n this.band = Plots.band (this.f, KL * Phys.C / this.l);\n this.fnZ = function (freq) {\n return antenna.fn (Phys.C / freq).Z;\n };\n \n this.plot (Plots.impedanceResponseData (this.fnZ, this.band, 200), Plots.impedanceResponseAxes (this.band), 0);\n });\n \n var circuit = Calc.calc ({\n name: \"circuit\",\n input : {\n E : [1e-3],\n Ctype : [\"A12-495x1\", \"A12-495x2\", \"A12-495x3\", \"A12-365x1\", \"A12-365x2\", \"A12-365x3\", \n \"A4-15x1\", \"A4-15x2\", \n \"S5-270x1\", \"S5-270x2\", \"S5-180x1\", \"S5-180x2\"],\n R : [1e3],\n Cx : [1e-12],\n f : antenna.f\n },\n output : { \n C : [1e-12, 2],\n \n // part 2\n Pn : [1e0, 1, \"exp\"],\n Ea : [1e-3, 2],\n Ee : [1e-3, 2],\n Cmin : [1e-12, 2],\n Cmax : [1e-12, 2],\n Ct : [1e-12, 2],\n QC : [1e0, 3],\n rC : [1e0, 2],\n etaF : [1e0, 2, \"exp\"],\n Rn : [1e3, 2],\n KU : [1e-1, 2],\n Un : [1e-3, 2],\n Qn : [1e0, 2],\n dF : [1e3, 2]\n }\n }, function () { \n this.check (this.E <= 10 && this.E > 0, \"E\"); \n this.check (this.R > 0, \"R\");\n \n // -------------------------------------------------------\n var capacitor = Capacitors [this.Ctype];\n \n this.Ea = antenna.antennaAtLambda.fnE (this.E);\n this.QC = capacitor.Q;\n \n this.C = 1 / (2 * Math.PI * this.f * antenna.antennaAtLambda.Z.y); \n this.check (this.C >= 0, \"C\");\n this.C = this.C < 0 ? 0 : this.C;\n \n this.check (this.Cx >= 0, \"Cx\"); \n this.Ct = this.C - this.Cx;\n\n this.Cmin = capacitor.Cmin * capacitor.N + this.Cx;\n this.Cmax = capacitor.Cmax * capacitor.N + this.Cx;\n this.check (this.C >= this.Cmin, \"Cmin\");\n this.check (this.C <= this.Cmax, \"Cmax\");\n \n this.Ct = Math.clamp (this.Ct, this.Cmin - this.Cx, this.Cmax - this.Cx);\n this.CC = this.Ct + this.Cx;\n \n function fnCircuit (f, aerial, C, QC, R) {\n var result = [];\n \n result.zC = Phys.fnCapacitor (f, C, QC).Z;\n result.zRC = result.zC.par (new Complex (R, 0));\n result.z = aerial.Z.sum (result.zRC);\n result.fnU = function (E) {\n return new Complex (aerial.fnE (E), 0).div (result.z).mul (result.zRC);\n };\n \n return result;\n };\n\n this.fnCircuit = function (f) {\n var aerial = antenna.antenna.fn (Phys.C / f);\n return {\n x : fnCircuit (f, aerial, this.CC, this.QC, this.R),\n min : fnCircuit (f, aerial, this.Cmax, this.QC, this.R),\n max : fnCircuit (f, aerial, this.Cmin, this.QC, this.R)\n };\n }; \n \n var p0 = Math.pow (antenna.lambda * this.E / (2 * Math.PI), 2) / (4 * Phys.Z0 / Math.PI);\n var circuit = fnCircuit (this.f, antenna.antennaAtLambda, this.CC, this.QC, this.R);\n \n this.Ee = fnCircuit (this.f, antenna.antennaAtLambda, this.CC, this.QC, 1e12).fnU (this.E).mod ();\n this.rC = circuit.zC.x;\n // TODO: Точный расчет\n this.Qn = -circuit.zC.y / circuit.z.x;\n this.dF = this.f / this.Qn;\n this.Un = circuit.fnU (this.E).mod ();\n this.Rn = antenna.Za.par (circuit.zC).mod ();\n this.Pn = this.Un * this.Un / this.R;\n this.etaF = this.RS / (this.rC + antenna.Za.x);\n this.KU = Math.log10 (this.Pn / p0);\n \n var Ux = [];\n var Umin = [];\n var Umax = [];\n \n var fmin = antenna.band [0];\n var fmax = antenna.band [1];\n\n if (fmax > fmin) {\n for (var freq = fmin; freq <= fmax; freq += (fmax - fmin) / 200) {\n \tvar p0 = Math.pow (Phys.C / freq * this.E / (2 * Math.PI), 2) / (4 * Phys.Z0 / Math.PI);\n\n var circuit = this.fnCircuit (freq);\n \n\t\t\t\tvar px = Math.pow (circuit.x.fnU (this.E).mod (), 2) / this.R;\n\t\t\t\tvar pmin = Math.pow (circuit.min.fnU (this.E).mod (), 2) / this.R;\n\t\t\t\tvar pmax = Math.pow (circuit.max.fnU (this.E).mod (), 2) / this.R;\n \n\t\t\t\tUx.push ( [freq, 10 * Math.log10 (px / p0)]);\n\t\t\t\tUmin.push ( [freq, 10 * Math.log10 (pmin / p0)]);\n\t\t\t\tUmax.push ( [freq, 10 * Math.log10 (pmax / p0)]); \n }\n \n\t\t\tvar options1;\n\t\t\toptions1 = {\n\t\t\t\tseries : {\n\t\t\t\t\tlines : {\n\t\t\t\t\t\tshow : true,\n\t\t\t\t\t\tlineWidth : 2,\n\t\t\t\t\t\tzero : false\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\txaxis : Plots.linFx (),\n\t\t\t\tyaxes : [Plots.logDB ()],\n\t\t\t\tlegend : {\n\t\t\t\t\tshow : true,\n\t\t\t\t\tnoColumns : 1,\n\t\t\t\t\tposition : \"se\"\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tthis.plot ( [{\n\t\t\t\tdata : Ux,\n\t\t\t\tcolor : \"#030\",\n\t\t\t\tlabel : \"При настройке на расчетную частоту\",\n\t\t\t\tshadowSize : 0\n\t\t\t}, {\n\t\t\t\tdata : Umin,\n\t\t\t\tcolor : \"#F00\",\n\t\t\t\tlabel : \"При максимальной ёмкости КПЕ\",\n\t\t\t\tshadowSize : 0\n\t\t\t}, {\n\t\t\t\tdata : Umax,\n\t\t\t\tcolor : \"#00F\",\n\t\t\t\tlabel : \"При минимальной ёмкости КПЕ\",\n\t\t\t\tshadowSize : 0\n\t\t\t}], options1, 0);\n } \n });\n}",
"get imc() {\n const IMC = this.peso / (this.altura ** 2);\n return IMC.toFixed(2);\n }",
"function MiePotential (r) {\n return 10*(4*epsilon)*(Math.pow((sigma/r), 12) - Math.pow((sigma/r), 6));\n}"
] | [
"0.6165908",
"0.59032685",
"0.5873705",
"0.5796195",
"0.57925344",
"0.5783441",
"0.57514644",
"0.5713553",
"0.5702795",
"0.56911266",
"0.5604644",
"0.55746",
"0.55706394",
"0.55626744",
"0.554239",
"0.5528351",
"0.5527571",
"0.55149704",
"0.5494513",
"0.5465213",
"0.5457862",
"0.5456239",
"0.5442834",
"0.54379886",
"0.54287386",
"0.54137105",
"0.54065144",
"0.54027927",
"0.5393485",
"0.5393236"
] | 0.6571702 | 0 |
Method to load a random card (callable from any component) | loadRandomCard(currentCardId, a) {
//document.getElementById(card.id).title = "test test test";
document.getElementById("frontface").style.display = "block";
//card.testest();
// Remove current card so we don't randomly select it
const cards = this.get('cards').filter(card => card.id !== currentCardId)
const card = cards[Math.floor(Math.random() * cards.length)]
this.set({
currentCard: card.id,
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function newRndCard() {\n $.getJSON('https://api.scryfall.com/cards/random?q=-type%3Aland+legal%3Alegacy+not%3Atoken+not%3Asplit+not%3Atransform', function (data) {\n saveCard(data);\n })\n }",
"function newRandomCard() {\n currentCard = getRandomCard(cardList);\n // ignore transform and meld cards for now\n while (currentCard.layout == \"transform\" || currentCard.layout == \"meld\") {\n currentCard = getRandomCard(cardList);\n }\n displayCurrentCard(currentCard);\n displayDefaultText(currentCard);\n}",
"function randomCard(){\n let randomIndex = Math.floor(Math.random()*13);\n return blackjackGame.cards[randomIndex];\n}",
"getRandomCard (currentCards) {\n var card = currentCards[Math.floor(Math.random() * currentCards.length)];\n return (card);\n }",
"function getCard() {\n const randomIndex = Math.floor(Math.random() * deck.length);\n let card = deck[randomIndex];\n return card;\n}",
"function randomCard(){\n let randomIndex = Math.floor(Math.random()*13)\n return blackjackGame['cards'][randomIndex]\n}",
"function selectRandomCard(cards) {\n const card = cards[ Math.floor(Math.random()*cards.length) ];\n if(card) return card;\n return null;\n}",
"function randomCards() {\n let randomIndex = Math.floor(Math.random() * 13);\n return BlackJack['cards'][randomIndex];\n\n}",
"function getCard() {\n return {\n value: VALUES[getRandom(VALUES)],\n suit: SUITS[getRandom(SUITS)]\n };\n}",
"function pick(cards) {\n\treturn cards[Math.floor(Math.random()*cards.length)];\n }",
"function randomCard() {\r\n var randCard = shuffledDeck.pop();\r\n return randCard;\r\n }",
"function randomCard() {\n return getRandomCard(state).back;\n }",
"draw(){\n let cardNumber = Math.round(Math.random() * 77);\n return this.cards[cardNumber];\n }",
"function generate_card() {\n var card_pos = Math.floor(Math.random() * deck.length);\n var card = deck[card_pos];\n deck.splice(card_pos, 1); // Remove the card from deck\n scriptProperties.setProperty('Deck', JSON.stringify(deck)); // Save the updated deck to prevent duplicates\n return card;\n}",
"function initializeCard() {\n var cardInfo = getStats();\n cardInfo.push(getRandomImage());\n cardInfo.push(getRandomName());\n enemyCards.push(cardInfo);\n}",
"function addCardsObject(randomNumber) {\n return cards[randomNumber] = {\n id: randomNumber,\n elementId: `card_${randomNumber}`,\n img: `./img/${randomNumber}.jpg`,\n active: false\n }\n}",
"componentWillMount() {\n if(!this.state.card) {\n this.getRandomCard();\n }\n }",
"function selectRandom(cards){\n // we need an integer in [0,cards.length]\n index=Math.floor(Math.random()*cards.length); // multiply by cards.length and floor\n return cards[index]; // return card at that index\n}",
"static load(){\n var suit = String();\n var value = String();\n \n // Loop 4 times, once for each suit\n for(let i = 1; i <= 4; i++){\n \n // Determine suit\n switch (i){\n case 1:\n suit = 'C';\n break;\n\n case 2:\n suit = 'D';\n break;\n\n case 3:\n suit = 'H';\n break;\n\n case 4:\n suit = 'S';\n break;\n\n default:\n }\n\n // Loop 13 times, once for each card for this suit\n for(let h = 1; h <= 13; h++){\n \n // Determine card number\n switch (h){\n case 1:\n value = 'A';\n break;\n \n case 11:\n value = 'J';\n break;\n \n case 12:\n value = 'Q';\n break;\n \n case 13:\n value = 'K';\n break;\n \n default:\n value = h;\n }\n }\n\n // Add this card to our deck\n let card = new Card(value, suit);\n this.deck.push(card);\n }\n\n return this;\n }",
"function shuffleCard(cards){\n return cards[Math.floor(Math.random() * cards.length)];\n }",
"loadCards(){\n let cards = require(\"C:\\\\Users\\\\Tony\\\\Desktop\\\\Programming\\\\Yugiosu\\\\Yugiosu - Python (Discord)\\\\yugiosu discord bot\\\\cogs\\\\Yugiosu\\\\cards.json\");\n for(let card of cards){\n this.cards[card[\"id\"]] = new Card(card['id'], card[\"name\"], card[\"cardtype\"], card[\"copies\"], card[\"description\"], card[\"properties\"]);\n }\n }",
"function getCard() {\n\tvar i = Math.floor(Math.random() * cardsArray.length);\n\tvar c = cardsArray[i];\n\n\t// remove card from array, so that every card can be chosen only once\n\tcardsArray.splice(i, 1);\n\treturn c;\n}",
"function getPlayerCard() {\n \n}",
"componentWillMount() {\n this.randomizeCards();\n }",
"function Card (seed) {\n\n this.rarita=seed%19;//rarita della carta\n this.name=getName(seed);//generazione nome carta\n this.tipo=getTypeImage(seed%3);//recupero simbolo del tipo\n this.attacco=1000+100*(seed%20);//calcolo attacco\n this.img=getImage(seed%3,this.rarita);//recupero illustrazione\n this.seed=seed;//seme carta\n}",
"getNextCard() {\n // If the Deck is empty, null is returned.\n if (this.numCardsRemaining() == 0) {\n return null;\n }\n \n // Get a random value between 0 and the length of the array of Card objects minus 1. \n let randomCardIndex = Deck.getRandomInt(this.cards.length);\n // Use that random value as an index into the array of Card objects to get one random Card object.\n let card = this.cards[randomCardIndex];\n // Remove that Card object from the array of Card objercts.\n this.cards.splice(randomCardIndex, 1);\n // Return the Card object.\n return card;\n }",
"function use_card(num_card)\n{\n\tthis.carte[num_card].use();\n}",
"function getPlayerCards() {\n //Randomly select player cards\n var selectFirstPlayerCard = possibleCards[Math.floor(Math.random() * possibleCards.length)];\n var selectSecondPlayerCard = possibleCards[Math.floor(Math.random() * possibleCards.length)];\n //Display player cards in document\n document.getElementById('card1').innerHTML = selectFirstPlayerCard;\n document.getElementById('card2').innerHTML = selectSecondPlayerCard;\n }",
"function getRandomCard() {\n var deck = 'A23456789TJQK';\n return deck[Math.floor(Math.random() * (12 - 0 + 1))];\n}",
"randomPlayerCard () {\n return Math.floor(Math.random() * this.cardsInDeck.length)\n }"
] | [
"0.6958431",
"0.6816011",
"0.6625624",
"0.6609234",
"0.6605706",
"0.6546299",
"0.6516402",
"0.6473475",
"0.6454191",
"0.641102",
"0.63849986",
"0.6367232",
"0.63656986",
"0.6342588",
"0.63051146",
"0.62916833",
"0.62818265",
"0.62649316",
"0.62610537",
"0.62522215",
"0.6237639",
"0.6223769",
"0.6223712",
"0.6219415",
"0.620252",
"0.61984885",
"0.6155319",
"0.6131842",
"0.61289006",
"0.6128337"
] | 0.7514743 | 0 |
getStorage will test to see if the requested storage type is available, if it is not, it will try sessionStorage, and if that is also not available, it will fallback to InMemoryStorage. | function getStorage(type) {
try {
// Get the desired storage from the window and test it out.
const storage = window[type];
testStorageAccess(storage);
// Storage test was successful! Return it.
return storage;
} catch (err) {
// When third party cookies are disabled, session storage is readable/
// writable, but localStorage is not. Try to get the sessionStorage to use.
if (type !== 'sessionStorage') {
console.warn('Could not access', type, 'trying sessionStorage', err);
return getStorage('sessionStorage');
}
console.warn(
'Could not access sessionStorage falling back to InMemoryStorage',
err
);
}
// No acceptable storage could be found, returning the InMemoryStorage.
return new InMemoryStorage();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _getStorageImpl() {\n\tif (_storageImpl) {\n\t\treturn _storageImpl;\n\t}\n\n\t_impls.some(function(impl) {\n\t\tif (impl.isAvailable()) {\n\t\t\tvar ctor = impl.StorageInterface;\n\t\t\t_storageImpl = new ctor();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t});\n\n\treturn _storageImpl;\n}",
"getStorage() {\n if (!this._storage) {\n this._storage = new BrowserStorage_1.default();\n }\n\n return this._storage;\n }",
"function getStorage(storage) {\n if (storage) {\n return storage;\n }\n\n return {\n store: {},\n getItem: function getItem(key) {\n return this.store[key];\n },\n setItem: function setItem(key, value) {\n return this.store[key] = value;\n },\n removeItem: function removeItem(key) {\n delete this.store[key];\n return this;\n }\n };\n}",
"_storage() {\n return getStorage(get(this, '_storageType'));\n }",
"function getStorage(storage) {\n\t if (storage) {\n\t return storage;\n\t }\n\t\n\t return {\n\t store: {},\n\t getItem: function getItem(key) {\n\t return this.store[key];\n\t },\n\t setItem: function setItem(key, value) {\n\t return this.store[key] = value;\n\t },\n\t removeItem: function removeItem(key) {\n\t delete this.store[key];\n\t return this;\n\t }\n\t };\n\t}",
"function getStorage(storage) {\n\t if (storage) {\n\t return storage;\n\t }\n\n\t return {\n\t store: {},\n\t getItem: function getItem(key) {\n\t return this.store[key];\n\t },\n\t setItem: function setItem(key, value) {\n\t return this.store[key] = value;\n\t },\n\t removeItem: function removeItem(key) {\n\t delete this.store[key];\n\t return this;\n\t }\n\t };\n\t}",
"function getStorage() {\n\t\t\treturn localStorageObj;\n\t\t}",
"function getStorage(key) {\r\n sessionStorage.getItem(key);\r\n}",
"function getSessionStorage(name){\r\n\t\tvar value = sessionstorage.get(name); \r\n\t\treturn((value!=null&&typeof(value) != undefined)?value:\"\");\r\n\t}",
"async function getStorage(key = null){\n\treturn key \n\t? (await browser.storage.local.get(key))[key] \n\t: (await browser.storage.local.get())\n}",
"function getStorage() {\n if (sessionStorage.getItem(\"order\") != null) {\n var storage = JSON.parse(sessionStorage.getItem(\"order\"));\n } else {\n var storage = {\n \"custom\": []\n };\n }\n return storage;\n}",
"getStorage(key) {\n const now = Date.now(); //epoch time, lets deal only with integer\n // set expiration for storage\n let expiresIn = this.$localStorage.get(key + \"_expiresIn\");\n if (expiresIn === undefined || expiresIn === null) {\n expiresIn = 0;\n }\n if (expiresIn < now) {\n // Expired\n this.removeStorage(key);\n return null;\n } else {\n try {\n const value = this.$localStorage.get(key);\n return value;\n } catch (e) {\n logger.publish(\n 4,\n \"store\",\n `getStorage: Error reading key [\n ${key}\n ] from localStorage: `,\n e\n );\n return null;\n }\n }\n }",
"function getSessionStorageIfAvailable() {\r\n var _a;\r\n try {\r\n return ((_a = _getSelfWindow()) === null || _a === void 0 ? void 0 : _a.sessionStorage) || null;\r\n }\r\n catch (e) {\r\n return null;\r\n }\r\n}",
"function getStorage() {\r if (!isHtml5StorageAvailable) {\r /* Dummy temporary local storage object. */\r window.localStorage = new Object(); \r }\r return localStorage;\r}",
"getStorage() {\n return this.storage;\n }",
"getStorage() {\n return this.storage;\n }",
"function checkStorage(){\r\n\t\t\ttry {\r\n\t\t\t\t\tvar x = 'test-sessionStorage-' + Date.now();\r\n\t\t\t\t\tsessionStorage.setItem(x, x);\r\n\t\t\t\t\tvar y = sessionStorage.getItem(x);\r\n\t\t\t\t\tsessionStorage.removeItem(x);\r\n\t\t\t\t\tif (y !== x) {throw new Error();}\r\n\t\t\t\t\tdb = sessionStorage; // sessionStorage is fully functional!\r\n\t\t\t} catch (e) {\r\n\t\t\t\tdb = new MemoryStorage('GW-sessionStorage'); // fall back to a memory-based implementation\r\n\t\t\t}\r\n\t\t}",
"function getStorage(){\r\n var getting = browser.storage.local.get(\"api_key\"); //Call to get local storage\r\n getting.then(gatherStorage, getError);\r\n}",
"function getStorage(provider, prefix) {\n if (storage[provider] === void 0) {\n storage[provider] = Object.create(null);\n }\n const providerStorage = storage[provider];\n if (providerStorage[prefix] === void 0) {\n providerStorage[prefix] = newStorage(provider, prefix);\n }\n return providerStorage[prefix];\n}",
"function getStorage(e) {\n try {\n return wx.getStorageSync(e)\n } catch (e) {\n errorEvent(\"getStorageSync\", e)\n }\n}",
"function _load_storage(){\n /* if jStorage string is retrieved, then decode it */\n if(_storage_service.jStorage){\n try{\n _storage = json_decode(String(_storage_service.jStorage));\n }catch(E6){_storage_service.jStorage = \"{}\";}\n }else{\n _storage_service.jStorage = \"{}\";\n }\n _storage_size = _storage_service.jStorage?String(_storage_service.jStorage).length:0; \n }",
"function getStore(useLocal) {\n return useLocal ? localStorage : sessionStorage;\n }",
"function checkForStorage() {\n return typeof(Storage) !== \"undefined\"\n}",
"setupStorage(type = \"local\") {\n if (type == \"local\") {\n this._storage =\n window && window.localStorage\n ? window.localStorage\n : window.sessionStorage;\n }\n }",
"function supportsStorage() {\n let key = '__lscachetest__';\n let value = key;\n\n if(this.cachedStorage !== undefined) {\n return this.cachedStorage;\n }\n\n // some browsers will throw an error if you try to access local storage (e.g. brave browser)\n // hence check is inside a try/catch\n try {\n if(!localStorage) {\n return false;\n }\n } catch(ex) {\n return false;\n }\n\n try {\n Implementations.localStorage.setItem.call(this, key, value);\n Implementations.localStorage.removeItem.call(this, key);\n this.cachedStorage = true;\n } catch(e) {\n // If we hit the limit, and we don't have an empty localStorage then it means we have support\n if(Implementations.localStorage.supported() /*isOutOfSpace.call(this, e) && localStorage.length*/) {\n this.cachedStorage = true; // just maxed it out and even the set test failed.\n } else {\n this.cachedStorage = false;\n }\n }\n return this.cachedStorage;\n}",
"function getStorage(key)\n{\n localStorage.length;\n var value = localStorage.getItem(key);\n if (value && (value.indexOf(\"{\") == 0 || value.indexOf(\"[\") == 0))\n {\n return JSON.parse(value);\n }\n return value;\n}",
"function setupBrowserStorage(){\n if(browser || storageMock){\n if(storageMock){\n store = storageMock;\n storageKey = 'cache-module-storage-mock';\n }\n else{\n var storageType = (config.storage === 'local' || config.storage === 'session') ? config.storage : null;\n store = (storageType && typeof Storage !== void(0)) ? window[storageType + 'Storage'] : false;\n storageKey = (storageType) ? self.type + '-' + storageType + '-storage' : null;\n }\n if(store){\n var db = store.getItem(storageKey);\n try {\n cache = JSON.parse(db) || cache;\n } catch (err) { /* Do nothing */ }\n }\n // If storageType is set but store is not, the desired storage mechanism was not available\n else if(storageType){\n log(true, 'Browser storage is not supported by this browser. Defaulting to an in-memory cache.');\n }\n }\n }",
"function getLocalStorage(){\n if (typeof localStorage == \"object\"){\n return localStorage;\n } else if (typeof globalStorage == \"object\"){\n return globalStorage[location.host];\n } else {\n \tstorage = {};\n } \n}",
"function _load_storage(){\n /* if jStorage string is retrieved, then decode it */\n if(_storage_service.jStorage){\n try{\n _storage = JSON.parse(String(_storage_service.jStorage));\n }catch(E6){_storage_service.jStorage = \"{}\";}\n }else{\n _storage_service.jStorage = \"{}\";\n }\n _storage_size = _storage_service.jStorage?String(_storage_service.jStorage).length:0;\n\n if(!_storage.__jstorage_meta){\n _storage.__jstorage_meta = {};\n }\n if(!_storage.__jstorage_meta.CRC32){\n _storage.__jstorage_meta.CRC32 = {};\n }\n }",
"function checkStorage(){\r\n\t\t\ttry {\r\n\t\t\t\tvar x = 'test-localstorage-' + Date.now();\r\n\t\t\t\tlocalStorage.setItem(x, x);\r\n\t\t\t\tvar y = localStorage.getItem(x);\r\n\t\t\t\tlocalStorage.removeItem(x);\r\n\t\t\t\tif (y !== x) {throw new Error();}\r\n\t\t\t\tdb = localStorage; // localStorage is fully functional!\r\n\t\t\t} catch (e) {\r\n\t\t\t\tdb = new MemoryStorage('GW-localstorage'); // fall back to a memory-based implementation\r\n\t\t\t}\r\n\t\t}"
] | [
"0.73001933",
"0.7217747",
"0.7106509",
"0.708953",
"0.7034303",
"0.70313287",
"0.6801023",
"0.6793784",
"0.67905945",
"0.6764917",
"0.67363673",
"0.67202085",
"0.66941226",
"0.66817075",
"0.6681604",
"0.6681604",
"0.6677933",
"0.6471737",
"0.6456842",
"0.6394462",
"0.6381311",
"0.6370582",
"0.63593805",
"0.634225",
"0.62805665",
"0.6264467",
"0.6253021",
"0.62502676",
"0.62416935",
"0.62144506"
] | 0.80599177 | 0 |
verifies whether the given packageJson dependencies require an update given the deps & devDeps passed in | function requiresAddingOfPackages(packageJsonFile, deps, devDeps) {
let needsDepsUpdate = false;
let needsDevDepsUpdate = false;
packageJsonFile.dependencies = packageJsonFile.dependencies || {};
packageJsonFile.devDependencies = packageJsonFile.devDependencies || {};
if (Object.keys(deps).length > 0) {
needsDepsUpdate = Object.keys(deps).some((entry) => !packageJsonFile.dependencies[entry]);
}
if (Object.keys(devDeps).length > 0) {
needsDevDepsUpdate = Object.keys(devDeps).some((entry) => !packageJsonFile.devDependencies[entry]);
}
return needsDepsUpdate || needsDevDepsUpdate;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function determineDependents({\n releases,\n packagesByName,\n dependencyGraph,\n preInfo,\n config\n}) {\n let updated = false; // NOTE this is intended to be called recursively\n\n let pkgsToSearch = [...releases.values()];\n\n while (pkgsToSearch.length > 0) {\n // nextRelease is our dependency, think of it as \"avatar\"\n const nextRelease = pkgsToSearch.shift();\n if (!nextRelease) continue; // pkgDependents will be a list of packages that depend on nextRelease ie. ['avatar-group', 'comment']\n\n const pkgDependents = dependencyGraph.get(nextRelease.name);\n\n if (!pkgDependents) {\n throw new Error(`Error in determining dependents - could not find package in repository: ${nextRelease.name}`);\n }\n\n pkgDependents.map(dependent => {\n let type;\n const dependentPackage = packagesByName.get(dependent);\n if (!dependentPackage) throw new Error(\"Dependency map is incorrect\");\n\n if (config.ignore.includes(dependent)) {\n type = \"none\";\n } else {\n const dependencyVersionRanges = getDependencyVersionRanges(dependentPackage.packageJson, nextRelease.name);\n\n for (const {\n depType,\n versionRange\n } of dependencyVersionRanges) {\n if (shouldBumpMajor({\n dependent,\n depType,\n versionRange,\n releases,\n nextRelease,\n preInfo,\n onlyUpdatePeerDependentsWhenOutOfRange: config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange\n })) {\n type = \"major\";\n } else {\n if ( // TODO validate this - I don't think it's right anymore\n (!releases.has(dependent) || releases.get(dependent).type === \"none\") && (config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.updateInternalDependents === \"always\" || !semver__default['default'].satisfies(incrementVersion(nextRelease, preInfo), // to deal with a * versionRange that comes from workspace:* dependencies as the wildcard will match anything\n versionRange === \"*\" ? nextRelease.oldVersion : versionRange))) {\n switch (depType) {\n case \"dependencies\":\n case \"optionalDependencies\":\n case \"peerDependencies\":\n if (type !== \"major\" && type !== \"minor\") {\n type = \"patch\";\n }\n\n break;\n\n case \"devDependencies\":\n {\n // We don't need a version bump if the package is only in the devDependencies of the dependent package\n if (type !== \"major\" && type !== \"minor\" && type !== \"patch\") {\n type = \"none\";\n }\n }\n }\n }\n }\n }\n }\n\n if (releases.has(dependent) && releases.get(dependent).type === type) {\n type = undefined;\n }\n\n return {\n name: dependent,\n type,\n pkgJSON: dependentPackage.packageJson\n };\n }).filter(({\n type\n }) => type).forEach( // @ts-ignore - I don't know how to make typescript understand that the filter above guarantees this and I got sick of trying\n ({\n name,\n type,\n pkgJSON\n }) => {\n // At this point, we know if we are making a change\n updated = true;\n const existing = releases.get(name); // For things that are being given a major bump, we check if we have already\n // added them here. If we have, we update the existing item instead of pushing it on to search.\n // It is safe to not add it to pkgsToSearch because it should have already been searched at the\n // largest possible bump type.\n\n if (existing && type === \"major\" && existing.type !== \"major\") {\n existing.type = \"major\";\n pkgsToSearch.push(existing);\n } else {\n let newDependent = {\n name,\n type,\n oldVersion: pkgJSON.version,\n changesets: []\n };\n pkgsToSearch.push(newDependent);\n releases.set(name, newDependent);\n }\n });\n }\n\n return updated;\n}",
"function checkAgainstClearlyApi(dependencies, config, callback) {\r\n dependencies.forEach(function(d) {\r\n d.coordinate = \"npm/npmjs/-/\" + d.name + \"/\" + d.version;\r\n });\r\n var coords = dependencies.map(function(d) {\r\n return d.coordinate;\r\n });\r\n var chunks = []; // Splitting targets into arrays to avoid a huge single request\r\n while (coords.length > 0)\r\n chunks.push(JSON.stringify(coords.splice(0, MAX_REQUEST)));\r\n mapLimit(chunks, 2, makeRequest, function(error, results) {\r\n if (error) {\r\n callback(error);\r\n } else {\r\n results = results.reduce(function(acc, curr) {\r\n return Object.assign(acc, curr);\r\n }, {});\r\n dependencies.forEach(function(d) {\r\n rootDir = RegExp(\"^package/\");\r\n if (\r\n results.hasOwnProperty(d.coordinate) &&\r\n results[d.coordinate].hasOwnProperty(\"files\")\r\n ) {\r\n d.apiResult = true;\r\n var matches = results[d.coordinate].files.reduce(function(\r\n all,\r\n current\r\n ) {\r\n if (\r\n current.hasOwnProperty(\"license\") &&\r\n rootDir.test(current.path)\r\n ) {\r\n current.path = current.path.replace(rootDir, \"/\");\r\n all.hasOwnProperty(current.license)\r\n ? all[current.license].push(current.path)\r\n : (all[current.license] = [current.path]);\r\n }\r\n return all;\r\n },\r\n {});\r\n if (Object.keys(matches).length > 0) {\r\n d.licenseMatches = matches;\r\n var badMatches = Object.keys(matches).reduce(function(bad, key) {\r\n if (\r\n d.hasOwnProperty(\"license\") &&\r\n d.license &&\r\n isBad(key, d.license, config)\r\n ) {\r\n bad.push({ match: key, files: matches[key] });\r\n }\r\n return bad;\r\n }, []);\r\n if (badMatches.length > 0 && !d.whitelisted) {\r\n d.badLicenseMatches = badMatches;\r\n d.approved = false;\r\n }\r\n }\r\n } else {\r\n d.apiResult = false;\r\n if (\r\n config.hasOwnProperty(\"requireClearlyDefined\") &&\r\n config.requireClearlyDefined === true\r\n ) {\r\n d.approved = false;\r\n }\r\n }\r\n });\r\n callback(null, dependencies);\r\n }\r\n });\r\n}",
"function checkDependencies() {\n console.log('Reading package.json'.green);\n fs.readFile('./package.json', (err, data) => {\n const pkgJson = JSON.parse(data);\n for (let dependency in pkgJson.dependencies) {\n // console.log(dependency);\n for (let package of packages) {\n if (dependency === package) {\n\n let index = packages.indexOf(package);\n console.log(index, dependency + ' already exist! '.yellow);\n packages.splice(index, 1);\n }\n }\n }\n // console.log(packages.length);\n if (packages.length == 0) {\n console.log('All dependencies are already exist skipping installation process!'.rainbow);\n updateAngularJson();\n } else {\n installDependencies();\n }\n });\n\n\n}",
"async function haveChangesOccurred() {\n const parentPackage = core.getInput('parent-package');\n const versionResult = await exec(`npm view ${parentPackage}@latest version`);\n const version = versionResult.stdout.trim();\n const diffResult = await exec(`git diff --stat v${version}..master frontend-shared/`)\n return diffResult.stdout.length > 0;\n}",
"function addDepsToPackageJson(deps, devDeps, addInstall = true) {\n return (host, context) => {\n const currentPackageJson = readJsonInTree(host, 'package.json');\n if (requiresAddingOfPackages(currentPackageJson, deps, devDeps)) {\n return schematics_1.chain([\n updateJsonInTree('package.json', (json, context) => {\n json.dependencies = Object.assign(Object.assign(Object.assign({}, (json.dependencies || {})), deps), (json.dependencies || {}));\n json.devDependencies = Object.assign(Object.assign(Object.assign({}, (json.devDependencies || {})), devDeps), (json.devDependencies || {}));\n json.dependencies = sortObjectByKeys(json.dependencies);\n json.devDependencies = sortObjectByKeys(json.devDependencies);\n return json;\n }),\n add_install_task_1.addInstallTask({\n skipInstall: !addInstall,\n }),\n ]);\n }\n else {\n return schematics_1.noop();\n }\n };\n}",
"checkIfDependenciesAvailable(resource, memo) {\n\n const isEconsentSpecific = resource.object.startsWith('ec__'),\n isEconsentInstalled = !!memo.availableApps.eConsentConfig,\n isTelevisitSpecific = resource.object.startsWith('tv__'),\n isTelevisitInstalled = !!memo.availableApps.televisitConfig,\n isIntegrationsSpecfic = resource.object.startsWith('int__'),\n isIntegrationsInstalled = !!memo.availableApps.integrationsConfig,\n isOracleSpecific = resource.object.startsWith('orac__'),\n isOracleInstalled = memo.availableApps.oracleConfig\n\n if (isEconsentSpecific && !isEconsentInstalled) {\n // eslint-disable-next-line no-undef\n throw Fault.create('kInvalidArgument', { reason: 'Target environment has not installed eConsent, please install eConsent and try again' })\n }\n\n if (isTelevisitSpecific && !isTelevisitInstalled) {\n // eslint-disable-next-line no-undef\n throw Fault.create('kInvalidArgument', { reason: 'Target environment has not installed Televisit, please install Televisit and try again' })\n }\n\n if (isIntegrationsSpecfic && !isIntegrationsInstalled) {\n // eslint-disable-next-line no-undef\n throw Fault.create('kInvalidArgument', { reason: 'Target environment has not installed Integrations, please install Integrations and try again' })\n }\n\n if (isOracleSpecific && !isOracleInstalled) {\n // eslint-disable-next-line no-undef\n throw Fault.create('kInvalidArgument', { reason: 'Target environment has not installed Oracle Integration, please install Oracle Integration and try again' })\n }\n\n return true\n }",
"function updateUnifiedDeps(pathToUnifiedDeps, pathToNewUnifiedDeps, outputPath) {\n const currentDeps = fs.readFileSync(pathToUnifiedDeps, 'utf8');\n const newDeps = fs.readFileSync(pathToNewUnifiedDeps, 'utf8');\n\n const currentDepsArr = currentDeps.split('\\n');\n const newDepsArr = newDeps.split('\\n');\n const newDepsDict = formatDeps(newDepsArr);\n\n const updatedDeps = [];\n // Tasks that was updated and should be presented in TfsServer.Servicing.core.xml\n const changedTasks = [];\n\n currentDepsArr.forEach(currentDep => {\n const depDetails = currentDep.split('\"');\n const name = depDetails[1];\n\n // find if there is a match in new (ignoring case)\n if (name) {\n const newDepsKey = Object.keys(newDepsDict).find(key => key.toLowerCase() === name.toLowerCase());\n if (newDepsKey && newDepsDict[newDepsKey]) {\n // update the version\n depDetails[3] = newDepsDict[newDepsKey];\n updatedDeps.push(depDetails.join('\"'));\n\n changedTasks.push(newDepsKey);\n delete newDepsDict[newDepsKey];\n } else {\n updatedDeps.push(currentDep);\n console.log(`\"${currentDep}\"`);\n }\n } else {\n updatedDeps.push(currentDep);\n }\n });\n\n // add the new deps from the start\n // working only for generated deps\n\n if (Object.keys(newDepsDict).length > 0) {\n for (let packageName in newDepsDict) {\n // new deps should include old packages completely\n // Example:\n // Mseng.MS.TF.DistributedTask.Tasks.AndroidSigningV2-Node16(packageName) should include \n // Mseng.MS.TF.DistributedTask.Tasks.AndroidSigningV2(basePackageName)\n const depToBeInserted = newDepsArr.find(dep => dep.includes(packageName));\n const pushingIndex = updatedDeps.findIndex(basePackage => {\n if (!basePackage) return false;\n\n const depDetails = basePackage.split('\"');\n const name = depDetails[1];\n return name && name.startsWith(msPrefix) && packageName.includes(name)\n });\n\n if (pushingIndex !== -1) {\n // We need to insert new package after the old one\n updatedDeps.splice(pushingIndex + 1, 0, depToBeInserted);\n changedTasks.push(packageName);\n }\n }\n }\n // write it as a new file where currentDeps is\n fs.writeFileSync(outputPath, updatedDeps.join('\\n'));\n console.log('Updating Unified Dependencies file done.');\n return changedTasks;\n}",
"async function has_satisfied_deps(pkg) {\n const deps = await get_pkg_deps(pkg);\n DEBUG(\"deps for \" + pkg + \":\");\n DEBUG(deps);\n /* Discard pkg (last element) from the deps array */\n const answers = await Promise.all(deps.slice(0, -1).map(dep => is_finished(dep)));\n return answers.reduce((acc, cur) => { return acc && cur; }, true);\n}",
"function isDependencyWarning(params) {\n function paramsHasComponent(name) {\n return params.some((param) => param.includes(name));\n }\n\n return params[0].includes('Please update the following components:') && (\n\n // React Bootstrap\n paramsHasComponent('Modal') ||\n paramsHasComponent('Portal') ||\n paramsHasComponent('Overlay') ||\n paramsHasComponent('Position') ||\n\n // React-Select\n paramsHasComponent('Select')\n );\n}",
"function warnForPackageDependencies({\n dependencies,\n consumer,\n installNpmPackages\n}) {\n const warnings = {\n notInPackageJson: [],\n notInNodeModules: [],\n notInBoth: []\n };\n if (installNpmPackages) return Promise.resolve(warnings);\n const projectDir = consumer.getPath();\n\n const getPackageJson = dir => {\n try {\n return _fsExtra().default.readJSONSync(path().join(dir, 'package.json'));\n } catch (e) {\n return {};\n } // do we want to inform the use that he has no package.json\n\n };\n\n const packageJson = getPackageJson(projectDir);\n const packageJsonDependencies = (0, _merge2().default)(packageJson.dependencies || {}, packageJson.devDependencies || {});\n\n const getNameAndVersion = pj => ({\n [pj.name]: pj.version\n });\n\n const nodeModules = (0, _mergeAll2().default)(_glob().default.sync(path().join(projectDir, 'node_modules', '*')).map((0, _compose2().default)(getNameAndVersion, getPackageJson))); // eslint-disable-next-line\n\n dependencies.forEach(dep => {\n if (!dep.packageDependencies || (0, _isEmpty2().default)(dep.packageDependencies)) return null;\n (0, _forEachObjIndexed2().default)((packageDepVersion, packageDepName) => {\n const packageDep = {\n [packageDepName]: packageDepVersion\n };\n const compatibleWithPackgeJson = compatibleWith(packageDep, packageJsonDependencies);\n const compatibleWithNodeModules = compatibleWith(packageDep, nodeModules);\n\n if (!compatibleWithPackgeJson && !compatibleWithNodeModules && !(0, _contains2().default)(packageDep, warnings.notInBoth)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n warnings.notInBoth.push(packageDep);\n }\n\n if (!compatibleWithPackgeJson && compatibleWithNodeModules && !(0, _contains2().default)(packageDep, warnings.notInPackageJson)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n warnings.notInPackageJson.push(packageDep);\n }\n\n if (compatibleWithPackgeJson && !compatibleWithNodeModules && !(0, _contains2().default)(packageDep, warnings.notInNodeModules)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n warnings.notInNodeModules.push(packageDep);\n }\n }, dep.packageDependencies);\n }); // Remove duplicates warnings for missing packages\n\n warnings.notInBoth = (0, _uniq2().default)(warnings.notInBoth);\n return Promise.resolve(warnings);\n}",
"function isDependencySatisfied(dep) {\r\n let count = 0\r\n for (let key in dep) {\r\n if ($('#' + key).val() == dep[key]) {\r\n count++;\r\n }\r\n }\r\n if (count == Object.keys(dep).length) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n}",
"function compatibleWith(a, b) {\n const depName = key(a);\n if (!b[depName]) return false; // dependency does not exist - return false\n\n const bVersion = b[depName];\n const aVersion = a[depName];\n const aType = getSemverType(aVersion);\n const bType = getSemverType(bVersion);\n if (!aType || !bType) return false; // in case one of the versions is invalid - return false\n\n if (aType === 'V' && bType === 'V') {\n return _semver().default.eq(aVersion, bVersion);\n }\n\n if (aType === 'V' && bType === 'R') {\n return _semver().default.satisfies(aVersion, bVersion);\n }\n\n if (aType === 'R' && bType === 'V') {\n return _semver().default.satisfies(bVersion, aVersion);\n }\n\n if (aType === 'R' && bType === 'R') {\n if (aVersion.startsWith('^') && bVersion.startsWith('^')) {\n const aMajorVersion = parseInt(aVersion[1], 10);\n const bMajorVersion = parseInt(bVersion[1], 10);\n if (aMajorVersion === bMajorVersion) return true;\n }\n }\n\n return false;\n} // TODO: refactor to better use of semver",
"_verifyPackageVersions(version, packages) {\n return tslib.__awaiter(this, void 0, void 0, function* () {\n for (const pkg of packages) {\n const { version: packageJsonVersion } = JSON.parse(yield fs.promises.readFile(path.join(pkg.outputPath, 'package.json'), 'utf8'));\n if (version.compare(packageJsonVersion) !== 0) {\n error(red('The built package version does not match the version being released.'));\n error(` Release Version: ${version.version}`);\n error(` Generated Version: ${packageJsonVersion}`);\n throw new FatalReleaseActionError();\n }\n }\n });\n }",
"async function checkUpdate(){\r\n\r\n var fileContents = Fs.readFileSync(__dirname+'/package.json');\r\n var pkg = JSON.parse(fileContents);\r\n\tpkg['name'] = PACKAGE_TO_UPDATE;\r\n\tpkg['version'] = pkg['dependencies'][PACKAGE_TO_UPDATE];\r\n\tif(isNaN(pkg['version'].substr(0,1))){\r\n\t\t//exemple: ^0.3.1\r\n\t\tpkg['version'] = pkg['version'].substr(1);\r\n\t}\r\n\r\n\tconst update = new AutoUpdate(pkg);\r\n\tupdate.on('update', function(){\r\n\t\tconsole.log('started update')\r\n\t\tif(app){\r\n\t\t\tconsole.log('[lanSupervLauncher] stopApplication');\r\n\t\t\tapp.stopApplication();\r\n\t\t\tapp = null;\r\n\t\t}\r\n\t});\r\n\tupdate.on('ready', function(){\r\n\t\tconsole.log('[lanSupervLauncher] ready (updated or not !)');\r\n\t\t//3) (Re)launch application\r\n\t\tif(app===null){\r\n\t\t\tconsole.log('[lanSupervLauncher] startApplication');\r\n\t\t\tapp = new LanSuperv();\r\n\t\t\tvar ConfigFile = __dirname + '/config.js';\r\n\t\t\tapp.startApplication(ConfigFile);\r\n\t\t\t//(initial launch or relaunch after update)\r\n\t\t}\r\n\t});\r\n\r\n}",
"function areDependenciesAvailable() {}",
"function applyLinks(releases, packagesByName, linked) {\n let updated = false;\n if (!linked) return updated; // We do this for each set of linked packages\n\n for (let linkedPackages of linked) {\n // First we filter down to all the relevent releases for one set of linked packages\n let releasingLinkedPackages = [...releases.values()].filter(release => linkedPackages.includes(release.name) && release.type !== \"none\"); // If we proceed any further we do extra work with calculating highestVersion for things that might\n // not need one, as they only have workspace based packages\n\n if (releasingLinkedPackages.length < 1) continue;\n let highestReleaseType;\n let highestVersion;\n\n for (let pkg of releasingLinkedPackages) {\n // Note that patch is implictly set here, but never needs to override another value\n if (!highestReleaseType) {\n highestReleaseType = pkg.type;\n } else if (pkg.type === \"major\") {\n highestReleaseType = pkg.type;\n } else if (pkg.type === \"minor\" && highestReleaseType !== \"major\") {\n highestReleaseType = pkg.type;\n }\n } // Next we determine what the highest version among the linked packages will be\n\n\n for (let linkedPackage of linkedPackages) {\n let pkg = packagesByName.get(linkedPackage);\n\n if (pkg) {\n if (highestVersion === undefined || semver__default['default'].gt(pkg.packageJson.version, highestVersion)) {\n highestVersion = pkg.packageJson.version;\n }\n } else {\n console.error(`FATAL ERROR IN CHANGESETS! We were unable to version for linked package: ${linkedPackage} in linkedPackages: ${linkedPackages.toString()}`);\n throw new Error(`fatal: could not resolve linked packages`);\n }\n }\n\n if (!highestVersion || !highestReleaseType) throw new Error(`Large internal changesets error in calculating linked versions. Please contact the maintainers`); // Finally, we update the packages so all of them are on the highest version\n\n for (let linkedPackage of releasingLinkedPackages) {\n if (linkedPackage.type !== highestReleaseType) {\n updated = true;\n linkedPackage.type = highestReleaseType;\n }\n\n if (linkedPackage.oldVersion !== highestVersion) {\n updated = true;\n linkedPackage.oldVersion = highestVersion;\n }\n }\n }\n\n return updated;\n}",
"function traversePackages(pkg_json){\n if(typeof(pkg_json.packages) !== 'undefined' && pkg_json.packages.length > 0) {\n //find new index of the previous first package\n let keepSearching = true;\n let count = 0;\n let timeCompareCount = 0;//this variable to used for counting the packages that are added into\n while(keepSearching) {\n console.log('timeCompareCount-->' + timeCompareCount);\n let pkg = pkg_json.packages[count];\n console.log('current package is ' + pkg.name + ' latest version is ' + pkg.latest.version);\n let res = checkPackageUpdateState(pkg, timeCompareCount);\n timeCompareCount = res.timeCompareCount;\n\n let pkgName = pkg.name;\n if(res.needUpdate){\n console.log(currentTimestamp() + 'needUpdate is true, push package ' + pkgName + ' to refresh_list');\n // refreshTargetPackage(pkg, true);\n if(!refresh_dir_list.includes(pkgName)){\n refresh_dir_list.push(pkgName);\n }else{\n console.log(currentTimestamp() + 'found package ' + pkgName + ' in refresh_dir_list, this package might be ignored');\n }\n if(!refresh_list.includes(pkgName)){\n refresh_list.push(pkgName);\n }else{\n console.log(currentTimestamp() + 'found package ' + pkgName + ' in refresh_list, this package might be ignored');\n }\n\n }else{\n if(res.timeCompareCount < 16 && res.code == 3){\n console.log(currentTimestamp() + 'meet the condition -- res.timeCompareCount < 5 && res.code == 3, push package ' + pkgName + ' to refresh_list');\n extra_cache.push(pkg);\n // if(!refresh_dir_list.includes(pkgName)){\n // refresh_dir_list.push(pkgName);\n // }\n // if(!refresh_list.includes(pkgName)){\n // refresh_list.push(pkgName);\n // }\n }else{\n keepSearching = false;\n return true;\n }\n }\n // if(checkPKGMap(pkg)){\n // //no need to refresh package\n // keepSearching = false;\n // return true;\n // }else{\n // refreshTargetPackage(pkg);\n // }\n\n count++;\n if(count == pkg_json.packages.length){\n //target package not found in current list\n console.log('target package not found in current list');\n // lastCheckMSG = currentTimestamp() + 'target package not found in current list, count -->' + count + ' target package is ' + target;\n return false;\n }\n }//end of loop\n }else{\n return true;\n }\n}",
"async function findDepUpgrades(dep) {\n const npmDependency = await npmApi.getDependency(dep.depName);\n const upgrades =\n await versionsHelper.determineUpgrades(npmDependency, dep.currentVersion, config);\n if (upgrades.length > 0) {\n logger.verbose(`${dep.depName}: Upgrades = ${JSON.stringify(upgrades)}`);\n upgrades.forEach((upgrade) => {\n allUpgrades.push(Object.assign({}, dep, upgrade));\n });\n } else {\n logger.verbose(`${dep.depName}: No upgrades required`);\n }\n }",
"function getRequestedVersions(depName, lockfileJson) {\n const requestedVersions = [];\n const re = /^(.*)@([^@]*?)$/;\n\n Object.entries(lockfileJson).forEach(([name, _]) => {\n if (name.match(re)) {\n const [_, packageName, requestedVersion] = name.match(re);\n if (packageName === depName) {\n requestedVersions.push(requestedVersion);\n }\n }\n });\n\n return requestedVersions;\n}",
"static validate(newChangeFilePaths, changedPackages) {\n const changedSet = new Set();\n newChangeFilePaths.forEach((filePath) => {\n console.log(`Found change file: ${filePath}`);\n const changeRequest = node_core_library_1.JsonFile.load(filePath);\n if (changeRequest && changeRequest.changes) {\n changeRequest.changes.forEach(change => {\n changedSet.add(change.packageName);\n });\n }\n else {\n throw new Error(`Invalid change file: ${filePath}`);\n }\n });\n const requiredSet = new Set(changedPackages);\n changedSet.forEach((name) => {\n requiredSet.delete(name);\n });\n if (requiredSet.size > 0) {\n const missingProjects = [];\n requiredSet.forEach(name => {\n missingProjects.push(name);\n });\n throw new Error(`Change file does not contain ${missingProjects.join(',')}.`);\n }\n }",
"writePackageJson(mpath, cb) {\n const semver = require(\"semver\");\n return fs.stat(mpath, function(err, stat) {\n if (err) { return cb(err); }\n const f = stat.isDirectory() ? bna.dir.npmDependencies : bna.npmDependencies;\n return f(mpath, function(err, deps) {\n if (err) { return cb(err); }\n if (stat.isFile()) {\n ({ mpath } = bna.identify(mpath));\n }\n const pkgJsonFile = path.join(mpath, \"package.json\");\n let pkgJson = {};\n if (fs.existsSync(pkgJsonFile)) {\n pkgJson = JSON.parse(fs.readFileSync(pkgJsonFile, \"utf8\"));\n }\n const oldDep = pkgJson.dependencies || {};\n const newdep = {};\n const errList = [];\n // merge into oldDep\n _(deps).each(function(version, name) {\n if (version === null) {\n //errList.push(util.format(\"%s is not versioned!\",name));\n return;\n } else if (!(name in oldDep)) {\n return newdep[name] = version;\n } else { // use semver to check\n const oldVer = oldDep[name];\n if (/:\\/\\//.test(oldVer)) { // test for url pattern\n log(util.format(\"Package %s is ignored due to non-semver %s\", name, oldVer));\n delete oldDep[name];\n return newdep[name] = oldVer; // keep old value\n } else if (!semver.satisfies(version, oldVer)) {\n return errList.push(util.format(\"%s: actual version %s does not satisfy package.json's version %s\", name, version, oldVer));\n } else {\n delete oldDep[name];\n return newdep[name] = oldVer;\n }\n }\n });\n if (errList.length > 0) {\n return cb(new Error(errList.join(\"\\n\")));\n } else {\n pkgJson.dependencies = newdep;\n return fs.writeFile(pkgJsonFile, JSON.stringify(pkgJson, null, 2), \"utf8\", err => cb(err, _(oldDep).keys()));\n }\n });\n });\n }",
"function checkForUpdate() {\n superagent.get(packageJson).end((error, response) => {\n if (error) return;\n const actualVersion = JSON.parse(response.text).version; // TODO: case without internet connection\n console.log('Actual app version: ' + actualVersion + '. Current app version: ' + currentVersion);\n if (semver.gt(actualVersion, currentVersion)) {\n mb.window.webContents.send('update-available');\n console.log('New version is available!');\n }\n });\n}",
"function onOutdatedFn ( error_data, update_table ) {\n var\n solve_map = {},\n update_count = update_table.length,\n\n idx, row_list,\n package_name, current_str, target_str\n ;\n\n if ( error_data ) { return failFn( error_data ); }\n\n if ( update_count === 0 ) {\n stageStatusMap[ aliasStr ] = true;\n logFn( prefixStr + 'No package changes' );\n logFn( prefixStr + 'Success' );\n nextFn();\n }\n\n // Invalidate all these stages\n xhiObj.xhiUtilObj._clearMap_( stageStatusMap, [\n 'install', 'setup', 'dev_test', 'dev_lint',\n 'dev_cover', 'dev_commit', 'build'\n ]);\n\n // Load post-install methods\n xhiObj.loadLibsFn();\n postObj = xhiObj.makePostObj();\n\n // Begin aggregate changes and merge\n for ( idx = 0; idx < update_count; idx++ ) {\n row_list = update_table[ idx ];\n package_name = row_list[ 1 ];\n current_str = row_list[ 2 ];\n target_str = row_list[ 4 ];\n solve_map[ package_name ] = target_str;\n logFn(\n 'Update ' + package_name + ' from '\n + current_str + ' to ' + target_str\n );\n }\n Object.assign( packageMatrix.devDependencies, solve_map );\n // . End Aggregate changes an merge\n\n // Save to package file\n postObj.writePkgFileFn(\n function _onWriteFn ( error_data ) {\n if ( error_data ) { return failFn( error_data ); }\n\n // Mark install and setup as 'out of date'\n stageStatusMap.install = false;\n stageStatusMap.setup = false;\n\n // Store success and finish\n // A successful update invalidates all prior stages\n xhiObj.xhiUtilObj._clearMap_( stageStatusMap );\n stageStatusMap[ aliasStr ] = true;\n logFn( prefixStr + 'Success' );\n nextFn();\n }\n );\n }",
"function main () {\n if (process.platform === 'win32') {\n console.error('Sorry, check-deps only works on Mac and Linux')\n return\n }\n\n var usedDeps = findUsedDeps()\n var packageDeps = findPackageDeps()\n\n var missingDeps = usedDeps.filter(\n (dep) => !includes(packageDeps, dep) && !includes(BUILT_IN_DEPS, dep)\n )\n var unusedDeps = packageDeps.filter(\n (dep) => !includes(usedDeps, dep) && !includes(EXECUTABLE_DEPS, dep)\n )\n\n if (missingDeps.length > 0) {\n console.error('Missing package dependencies: ' + missingDeps)\n }\n if (unusedDeps.length > 0) {\n console.error('Unused package dependencies: ' + unusedDeps)\n }\n if (missingDeps.length + unusedDeps.length > 0) {\n process.exitCode = 1\n }\n}",
"_updatePackage() {\n let dest = this.destinationPath('package.json');\n let template = this.templatePath('dependencies.stub');\n let pkg = program.helpers.readJson(this, dest);\n\n let deps = JSON.parse(program.helpers.readTpl(this, template, {\n relationalDB: program.helpers.isRelationalDB(this.answers.database),\n answers: this.answers\n }));\n\n pkg.dependencies = Object.assign(pkg.dependencies, deps);\n this.fs.writeJSON(dest, pkg);\n }",
"function setUserRequestedPackageVersions(\n deps: Array<Dependency>,\n args: Array<string>,\n latest: boolean,\n packagePatterns,\n reporter: Reporter,\n) {\n args.forEach(requestedPattern => {\n let found = false;\n let normalized = normalizePattern(requestedPattern);\n\n // if the user specified a package name without a version range, then that implies \"latest\"\n // but if the latest flag is not passed then we need to use the version range from package.json\n if (!normalized.hasVersion && !latest) {\n packagePatterns.forEach(packagePattern => {\n const packageNormalized = normalizePattern(packagePattern.pattern);\n if (packageNormalized.name === normalized.name) {\n normalized = packageNormalized;\n }\n });\n }\n\n const newPattern = `${normalized.name}@${normalized.range}`;\n\n // if this dependency is already in the outdated list,\n // just update the upgradeTo to whatever version the user requested.\n deps.forEach(dep => {\n if (normalized.hasVersion && dep.name === normalized.name) {\n found = true;\n dep.upgradeTo = newPattern;\n reporter.verbose(reporter.lang('verboseUpgradeBecauseRequested', requestedPattern, newPattern));\n }\n });\n\n // if this dependency was not in the outdated list,\n // then add a new entry\n if (normalized.hasVersion && !found) {\n deps.push({\n name: normalized.name,\n wanted: '',\n latest: '',\n url: '',\n hint: '',\n range: '',\n current: '',\n upgradeTo: newPattern,\n workspaceName: '',\n workspaceLoc: '',\n });\n reporter.verbose(reporter.lang('verboseUpgradeBecauseRequested', requestedPattern, newPattern));\n }\n });\n}",
"dependencyChanged(srcDir, dep) {\n let file = path.isAbsolute(dep[0]) ? dep[0] : path.join(srcDir, dep[0]);\n let hexDigest = dep[1];\n\n let hash = this.hashForFile(file);\n let hd = hash.digest(\"hex\");\n return (hd !== hexDigest);\n }",
"addDevDeps(...deps) {\n for (const dep of deps) {\n this.project.deps.addDependency(dep, deps_1.DependencyType.BUILD);\n }\n }",
"function processDependencies(dependencies, components, exclude) {\n Object.keys(dependencies).forEach(function(key) {\n grunt.log.debug(\"Obtaining package version for \" + key);\n\n var dependency = dependencies[key];\n var pkgMeta = dependency.pkgMeta;\n\n if(exclude.indexOf(pkgMeta.name) > -1) {\n grunt.log.ok('Excluding component: ' + pkgMeta.name);\n return;\n }\n\n var componentData = {};\n componentData['version'] = pkgMeta.version;\n componentData['directory'] = dependency.canonicalDir;\n components[pkgMeta.name] = componentData;\n\n grunt.log.debug(key + \" - version: \" + componentData['version'] + \" directory: \" + componentData['directory']);\n\n processDependencies(dependency.dependencies, components, exclude);\n });\n }",
"function shadowCheckEntryVersion(entryVersion) {\r\n return Object.keys(entryVersion).every(\r\n k => entryVersion[k].version === packageDependency_1.getPKGVersion(k)\r\n );\r\n}"
] | [
"0.639414",
"0.6271797",
"0.6222505",
"0.6055485",
"0.6050687",
"0.5780931",
"0.57698435",
"0.5756768",
"0.5727764",
"0.5701409",
"0.5691746",
"0.56767374",
"0.5662534",
"0.56625015",
"0.5588799",
"0.55429953",
"0.5493228",
"0.5476981",
"0.5446969",
"0.5441043",
"0.5437413",
"0.54243207",
"0.5324899",
"0.5284328",
"0.52769846",
"0.5264189",
"0.52617514",
"0.5217363",
"0.5192698",
"0.5190213"
] | 0.79547036 | 0 |
Updates the package.json given the passed deps and/or devDeps. Only updates if the packages are not yet present | function addDepsToPackageJson(deps, devDeps, addInstall = true) {
return (host, context) => {
const currentPackageJson = readJsonInTree(host, 'package.json');
if (requiresAddingOfPackages(currentPackageJson, deps, devDeps)) {
return schematics_1.chain([
updateJsonInTree('package.json', (json, context) => {
json.dependencies = Object.assign(Object.assign(Object.assign({}, (json.dependencies || {})), deps), (json.dependencies || {}));
json.devDependencies = Object.assign(Object.assign(Object.assign({}, (json.devDependencies || {})), devDeps), (json.devDependencies || {}));
json.dependencies = sortObjectByKeys(json.dependencies);
json.devDependencies = sortObjectByKeys(json.devDependencies);
return json;
}),
add_install_task_1.addInstallTask({
skipInstall: !addInstall,
}),
]);
}
else {
return schematics_1.noop();
}
};
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function requiresAddingOfPackages(packageJsonFile, deps, devDeps) {\n let needsDepsUpdate = false;\n let needsDevDepsUpdate = false;\n packageJsonFile.dependencies = packageJsonFile.dependencies || {};\n packageJsonFile.devDependencies = packageJsonFile.devDependencies || {};\n if (Object.keys(deps).length > 0) {\n needsDepsUpdate = Object.keys(deps).some((entry) => !packageJsonFile.dependencies[entry]);\n }\n if (Object.keys(devDeps).length > 0) {\n needsDevDepsUpdate = Object.keys(devDeps).some((entry) => !packageJsonFile.devDependencies[entry]);\n }\n return needsDepsUpdate || needsDevDepsUpdate;\n}",
"function updatePackageJson() {\n const version = fs.readJSONSync('package.json').version;\n const packageJson = fs.readJSONSync(path.join('docker', 'package.json'));\n\n packageJson.version = version;\n packageJson.dependencies['ng-apimock'] = version;\n\n fs.writeJsonSync(path.join('docker', 'package.json'), packageJson);\n }",
"_updatePackage() {\n let dest = this.destinationPath('package.json');\n let template = this.templatePath('dependencies.stub');\n let pkg = program.helpers.readJson(this, dest);\n\n let deps = JSON.parse(program.helpers.readTpl(this, template, {\n relationalDB: program.helpers.isRelationalDB(this.answers.database),\n answers: this.answers\n }));\n\n pkg.dependencies = Object.assign(pkg.dependencies, deps);\n this.fs.writeJSON(dest, pkg);\n }",
"writePackageJson(mpath, cb) {\n const semver = require(\"semver\");\n return fs.stat(mpath, function(err, stat) {\n if (err) { return cb(err); }\n const f = stat.isDirectory() ? bna.dir.npmDependencies : bna.npmDependencies;\n return f(mpath, function(err, deps) {\n if (err) { return cb(err); }\n if (stat.isFile()) {\n ({ mpath } = bna.identify(mpath));\n }\n const pkgJsonFile = path.join(mpath, \"package.json\");\n let pkgJson = {};\n if (fs.existsSync(pkgJsonFile)) {\n pkgJson = JSON.parse(fs.readFileSync(pkgJsonFile, \"utf8\"));\n }\n const oldDep = pkgJson.dependencies || {};\n const newdep = {};\n const errList = [];\n // merge into oldDep\n _(deps).each(function(version, name) {\n if (version === null) {\n //errList.push(util.format(\"%s is not versioned!\",name));\n return;\n } else if (!(name in oldDep)) {\n return newdep[name] = version;\n } else { // use semver to check\n const oldVer = oldDep[name];\n if (/:\\/\\//.test(oldVer)) { // test for url pattern\n log(util.format(\"Package %s is ignored due to non-semver %s\", name, oldVer));\n delete oldDep[name];\n return newdep[name] = oldVer; // keep old value\n } else if (!semver.satisfies(version, oldVer)) {\n return errList.push(util.format(\"%s: actual version %s does not satisfy package.json's version %s\", name, version, oldVer));\n } else {\n delete oldDep[name];\n return newdep[name] = oldVer;\n }\n }\n });\n if (errList.length > 0) {\n return cb(new Error(errList.join(\"\\n\")));\n } else {\n pkgJson.dependencies = newdep;\n return fs.writeFile(pkgJsonFile, JSON.stringify(pkgJson, null, 2), \"utf8\", err => cb(err, _(oldDep).keys()));\n }\n });\n });\n }",
"function updateUnifiedDeps(pathToUnifiedDeps, pathToNewUnifiedDeps, outputPath) {\n const currentDeps = fs.readFileSync(pathToUnifiedDeps, 'utf8');\n const newDeps = fs.readFileSync(pathToNewUnifiedDeps, 'utf8');\n\n const currentDepsArr = currentDeps.split('\\n');\n const newDepsArr = newDeps.split('\\n');\n const newDepsDict = formatDeps(newDepsArr);\n\n const updatedDeps = [];\n // Tasks that was updated and should be presented in TfsServer.Servicing.core.xml\n const changedTasks = [];\n\n currentDepsArr.forEach(currentDep => {\n const depDetails = currentDep.split('\"');\n const name = depDetails[1];\n\n // find if there is a match in new (ignoring case)\n if (name) {\n const newDepsKey = Object.keys(newDepsDict).find(key => key.toLowerCase() === name.toLowerCase());\n if (newDepsKey && newDepsDict[newDepsKey]) {\n // update the version\n depDetails[3] = newDepsDict[newDepsKey];\n updatedDeps.push(depDetails.join('\"'));\n\n changedTasks.push(newDepsKey);\n delete newDepsDict[newDepsKey];\n } else {\n updatedDeps.push(currentDep);\n console.log(`\"${currentDep}\"`);\n }\n } else {\n updatedDeps.push(currentDep);\n }\n });\n\n // add the new deps from the start\n // working only for generated deps\n\n if (Object.keys(newDepsDict).length > 0) {\n for (let packageName in newDepsDict) {\n // new deps should include old packages completely\n // Example:\n // Mseng.MS.TF.DistributedTask.Tasks.AndroidSigningV2-Node16(packageName) should include \n // Mseng.MS.TF.DistributedTask.Tasks.AndroidSigningV2(basePackageName)\n const depToBeInserted = newDepsArr.find(dep => dep.includes(packageName));\n const pushingIndex = updatedDeps.findIndex(basePackage => {\n if (!basePackage) return false;\n\n const depDetails = basePackage.split('\"');\n const name = depDetails[1];\n return name && name.startsWith(msPrefix) && packageName.includes(name)\n });\n\n if (pushingIndex !== -1) {\n // We need to insert new package after the old one\n updatedDeps.splice(pushingIndex + 1, 0, depToBeInserted);\n changedTasks.push(packageName);\n }\n }\n }\n // write it as a new file where currentDeps is\n fs.writeFileSync(outputPath, updatedDeps.join('\\n'));\n console.log('Updating Unified Dependencies file done.');\n return changedTasks;\n}",
"async function mergePackageJsons() {\n // transform our package.json so we can replace variables\n const rawJson = await template.generate({\n directory: `${ignite.ignitePluginPath()}/boilerplate`,\n template: \"package.json.ejs\",\n props: { ...templateProps, kebabName: strings.kebabCase(templateProps.name) },\n })\n const newPackageJson = JSON.parse(rawJson)\n\n // read in the react-native created package.json\n const currentPackage = filesystem.read(\"package.json\", \"json\")\n\n // deep merge, lol\n const newPackage = pipe(\n assoc(\"dependencies\", merge(currentPackage.dependencies, newPackageJson.dependencies)),\n assoc(\n \"devDependencies\",\n merge(\n omit([\"@react-native-community/eslint-config\"], currentPackage.devDependencies),\n newPackageJson.devDependencies,\n ),\n ),\n assoc(\"scripts\", merge(currentPackage.scripts, newPackageJson.scripts)),\n merge(__, omit([\"dependencies\", \"devDependencies\", \"scripts\"], newPackageJson)),\n )(currentPackage)\n\n // write this out\n filesystem.write(\"package.json\", newPackage, { jsonIndent: 2 })\n }",
"function updatePackages() {\n\tvar dataDir = getDataDirectory();\n\n\tfs.readdir(dataDir, function(err, files) {\n\t\tfiles.forEach(function(file) {\n\t\t\tvar name = path.basename(file, '.json');\n\n\t\t\tvar infoFilePath = path.join(dataDir, file);\n\t\t\tfs.readFile(infoFilePath, 'utf8', function(err, data) {\n\t\t\t\tif (err) {\n\t\t\t\t\tlog('error', \"could not access data for %s -- skipping\", name);\n\t\t\t\t} else {\n\t\t\t\t\tvar info = JSON.parse(data);\n\t\t\t\t\tretrievePackage(name, info.repo, function(err, result) {\n\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\tlog('error', \"failed to update %s\", name);\n\t\t\t\t\t\t} else if (result.retrieved) {\n\t\t\t\t\t\t\tlog('info', \"%s updated successfully\", name);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t})\n\t});\n}",
"function syncNpmVersions() {\n return new Promise((resolve, reject) => {\n fs.readFile(`${paths.distNpmPath()}/package.json`, (err, data) => {\n if (err) {\n return reject(err);\n }\n const npmPackage = JSON.parse(data);\n const promises = [\n updatePackageVersion(`./package.json`, npmPackage),\n updatePackageVersion(`./src/package.json`, npmPackage)\n ];\n Promise.all(promises)\n .then(() => {\n resolve();\n })\n .catch(err => {\n reject(err);\n });\n });\n });\n}",
"function devDeps (argv, next) {\n const opts = { saveDev: true, cache: true }\n install(argv.devDeps, opts, function (err) {\n if (err) return next(err)\n next()\n })\n}",
"async function mergePackageJsons () {\n const rawJson = await template.generate({\n directory: `${PLUGIN_PATH}/boilerplate/src`,\n template: 'package.json.ejs',\n props: {}\n })\n\n\n const newPackageJson = JSON.parse(rawJson)\n const currentPackage = filesystem.read('package.json', 'json')\n\n // deep merge, lol\n const newPackage = pipe(\n assoc(\n 'dependencies',\n merge(currentPackage.dependencies, newPackageJson.dependencies)\n ),\n assoc(\n 'devDependencies',\n merge(currentPackage.devDependencies, newPackageJson.devDependencies)\n ),\n assoc('scripts', merge(currentPackage.scripts, newPackageJson.scripts)),\n merge(\n __,\n omit(['dependencies', 'devDependencies', 'scripts'], newPackageJson)\n )\n )(currentPackage)\n\n // write this out\n filesystem.write('package.json', newPackage, {jsonIndent: 2})\n }",
"function packageJSON(cb) {\n const json = Object.assign({}, packageJson);\n delete json['scripts'];\n if (!fs.existsSync(packageDistribution)) {\n fs.mkdirSync(packageDistribution);\n }\n fs.writeFileSync(`${packageDistribution}/package.json`,\n JSON.stringify(json, null, 2));\n cb();\n}",
"function patchResDeps() {\n [\"rescript\"].concat(bsconfig[\"bs-dependencies\"]).forEach((bsDep) => {\n fs.writeFileSync(`./node_modules/${bsDep}/index.js`, \"\");\n const json = require(`./node_modules/${bsDep}/package.json`);\n json.main = \"index.js\";\n fs.writeFileSync(\n `./node_modules/${bsDep}/package.json`,\n JSON.stringify(json, null, 2)\n );\n });\n}",
"function updateDepModuleVersions () {\n return request.post({\n url: `http://${HOST}/api/DepModuleVersions/add`,\n followAllRedirects: true,\n headers: {\n \"Authorization\": TOKEN\n },\n body: {\n obj: obj\n },\n json: true // Automatically stringifies the body to JSON\n }, (err, res, body) => {\n licenseObj(body);\n check(err, res, body);\n });\n}",
"addDevDeps(...deps) {\n for (const dep of deps) {\n this.project.deps.addDependency(dep, deps_1.DependencyType.BUILD);\n }\n }",
"function updateOwnDeps () {\n tools.updateOwnDependenciesFromLocalRepositories(args.depth);\n}",
"async function updatePackageJSON (version) {\n const filePath = path.resolve(ELECTRON_DIR, 'package.json')\n const file = require(filePath)\n file.version = version\n await writeFile(filePath, JSON.stringify(file, null, 2))\n}",
"function devpackages () {\n opts.devpackages = makeArray(argv.dev)\n opts.files.test = true\n opts.install = true\n }",
"function packages () {\n opts.packages = makeArray(argv.dep)\n opts.install = true\n }",
"function determineDependents({\n releases,\n packagesByName,\n dependencyGraph,\n preInfo,\n config\n}) {\n let updated = false; // NOTE this is intended to be called recursively\n\n let pkgsToSearch = [...releases.values()];\n\n while (pkgsToSearch.length > 0) {\n // nextRelease is our dependency, think of it as \"avatar\"\n const nextRelease = pkgsToSearch.shift();\n if (!nextRelease) continue; // pkgDependents will be a list of packages that depend on nextRelease ie. ['avatar-group', 'comment']\n\n const pkgDependents = dependencyGraph.get(nextRelease.name);\n\n if (!pkgDependents) {\n throw new Error(`Error in determining dependents - could not find package in repository: ${nextRelease.name}`);\n }\n\n pkgDependents.map(dependent => {\n let type;\n const dependentPackage = packagesByName.get(dependent);\n if (!dependentPackage) throw new Error(\"Dependency map is incorrect\");\n\n if (config.ignore.includes(dependent)) {\n type = \"none\";\n } else {\n const dependencyVersionRanges = getDependencyVersionRanges(dependentPackage.packageJson, nextRelease.name);\n\n for (const {\n depType,\n versionRange\n } of dependencyVersionRanges) {\n if (shouldBumpMajor({\n dependent,\n depType,\n versionRange,\n releases,\n nextRelease,\n preInfo,\n onlyUpdatePeerDependentsWhenOutOfRange: config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange\n })) {\n type = \"major\";\n } else {\n if ( // TODO validate this - I don't think it's right anymore\n (!releases.has(dependent) || releases.get(dependent).type === \"none\") && (config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.updateInternalDependents === \"always\" || !semver__default['default'].satisfies(incrementVersion(nextRelease, preInfo), // to deal with a * versionRange that comes from workspace:* dependencies as the wildcard will match anything\n versionRange === \"*\" ? nextRelease.oldVersion : versionRange))) {\n switch (depType) {\n case \"dependencies\":\n case \"optionalDependencies\":\n case \"peerDependencies\":\n if (type !== \"major\" && type !== \"minor\") {\n type = \"patch\";\n }\n\n break;\n\n case \"devDependencies\":\n {\n // We don't need a version bump if the package is only in the devDependencies of the dependent package\n if (type !== \"major\" && type !== \"minor\" && type !== \"patch\") {\n type = \"none\";\n }\n }\n }\n }\n }\n }\n }\n\n if (releases.has(dependent) && releases.get(dependent).type === type) {\n type = undefined;\n }\n\n return {\n name: dependent,\n type,\n pkgJSON: dependentPackage.packageJson\n };\n }).filter(({\n type\n }) => type).forEach( // @ts-ignore - I don't know how to make typescript understand that the filter above guarantees this and I got sick of trying\n ({\n name,\n type,\n pkgJSON\n }) => {\n // At this point, we know if we are making a change\n updated = true;\n const existing = releases.get(name); // For things that are being given a major bump, we check if we have already\n // added them here. If we have, we update the existing item instead of pushing it on to search.\n // It is safe to not add it to pkgsToSearch because it should have already been searched at the\n // largest possible bump type.\n\n if (existing && type === \"major\" && existing.type !== \"major\") {\n existing.type = \"major\";\n pkgsToSearch.push(existing);\n } else {\n let newDependent = {\n name,\n type,\n oldVersion: pkgJSON.version,\n changesets: []\n };\n pkgsToSearch.push(newDependent);\n releases.set(name, newDependent);\n }\n });\n }\n\n return updated;\n}",
"function checkDependencies() {\n console.log('Reading package.json'.green);\n fs.readFile('./package.json', (err, data) => {\n const pkgJson = JSON.parse(data);\n for (let dependency in pkgJson.dependencies) {\n // console.log(dependency);\n for (let package of packages) {\n if (dependency === package) {\n\n let index = packages.indexOf(package);\n console.log(index, dependency + ' already exist! '.yellow);\n packages.splice(index, 1);\n }\n }\n }\n // console.log(packages.length);\n if (packages.length == 0) {\n console.log('All dependencies are already exist skipping installation process!'.rainbow);\n updateAngularJson();\n } else {\n installDependencies();\n }\n });\n\n\n}",
"function updatePackageJson() {\n return (tree, context) => {\n logging_1.logInfoWithDescriptor('Aktualisiere LUX-Components Version auf 1.8.5.');\n return util_1.waitForTreeCallback(tree, () => {\n const newDependency = {\n type: dependencies_1.NodeDependencyType.Default,\n version: '1.8.5',\n name: '@ihk-gfi/lux-components'\n };\n dependencies_1.updatePackageJsonDependency(tree, context, newDependency);\n logging_1.logSuccess(`package.json erfolgreich aktualisiert.`);\n return tree;\n });\n };\n}",
"function addPackageToPackageJson(tree, type, pkg, version) {\n if (tree.exists('package.json')) {\n const sourceText = tree.read('package.json').toString('utf-8');\n const json = JSON.parse(sourceText);\n if (!json[type]) {\n json[type] = {};\n }\n if (!json[type][pkg]) {\n json[type][pkg] = version;\n }\n tree.overwrite('package.json', JSON.stringify(json, null, 2));\n }\n return tree;\n}",
"_mergeChangedPackageJsonProps(packageJson) {\n if (!this.component.packageJsonChangedProps) return;\n\n const valuesToMerge = this._replaceDistPathTemplateWithCalculatedDistPath(packageJson);\n\n packageJson.mergePackageJsonObject(valuesToMerge);\n }",
"function createDefaultPackageJsonIfRequired(dependencyName, version) {\n const packageJsonPath = path.join(scopedNodeModulesDirectory, dependencyName, packageJson);\n if (!fs.existsSync(packageJsonPath)) {\n const packageJsonContents = {\n name: \"@morgan-stanley/\" + dependencyName,\n version: version,\n description: \"Generated automatically by \" + path.basename(__filename)\n };\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonContents, null, 2));\n }\n}",
"function adjustPackageJSON(generator) {\n const packageJSONStorage = generator.createStorage('server/package.json');\n const dependenciesStorage = packageJSONStorage.createStorage('dependencies');\n const dependabotPackageJSON = utils.getDependabotPackageJSON(generator, true);\n\n dependenciesStorage.set('@nestjs/graphql', dependabotPackageJSON.dependencies['@nestjs/graphql']);\n dependenciesStorage.set('graphql', dependabotPackageJSON.dependencies.graphql);\n dependenciesStorage.set('graphql-tools', dependabotPackageJSON.dependencies['graphql-tools']);\n dependenciesStorage.set('graphql-subscriptions', dependabotPackageJSON.dependencies['graphql-subscriptions']);\n dependenciesStorage.set('apollo-server-express', dependabotPackageJSON.dependencies['apollo-server-express']);\n\n const scriptsStorage = packageJSONStorage.createStorage('scripts');\n scriptsStorage.set('start:dev', 'npm run copy-resources && nest start -w');\n scriptsStorage.set('start:nest', 'npm run copy-resources && nest start');\n scriptsStorage.set('build:schema-gql', 'ts-node scripts/build-schema.ts');\n packageJSONStorage.save();\n}",
"function patchBump() {\n return gulp.src([\n './package.json',\n './bower.json'\n ]).pipe(bump({type: 'patch'}))\n .pipe(gulp.dest('./'));\n}",
"function setPackageVersion(cb) {\n if (version !== release) {\n // bump version without committing and tagging\n // await execa('npm', ['version', release, '--no-git-tag-version'], {stdio})\n src('./package.json')\n .pipe(jeditor({ 'version': release } ) )\n .pipe(dest('.') )\n } else {\n console.log('setPackageVersion: Requested version is same as current version - nothing will change')\n }\n cb()\n}",
"async function reinstallDependencies() {\n if (!currentlyRunningCommand) {\n isLiveReloadPaused = true;\n messageBus.emit('INSTALLING');\n currentlyRunningCommand = command(installCommandOptions);\n await currentlyRunningCommand.then(async () => {\n dependencyImportMap = JSON.parse(await fs.promises.readFile(dependencyImportMapLoc, {\n encoding: 'utf-8'\n }).catch(() => `{\"imports\": {}}`));\n await updateLockfileHash(DEV_DEPENDENCIES_DIR);\n await cacache.rm.all(BUILD_CACHE);\n inMemoryBuildCache.clear();\n messageBus.emit('INSTALL_COMPLETE');\n isLiveReloadPaused = false;\n currentlyRunningCommand = null;\n });\n }\n }",
"function warnForPackageDependencies({\n dependencies,\n consumer,\n installNpmPackages\n}) {\n const warnings = {\n notInPackageJson: [],\n notInNodeModules: [],\n notInBoth: []\n };\n if (installNpmPackages) return Promise.resolve(warnings);\n const projectDir = consumer.getPath();\n\n const getPackageJson = dir => {\n try {\n return _fsExtra().default.readJSONSync(path().join(dir, 'package.json'));\n } catch (e) {\n return {};\n } // do we want to inform the use that he has no package.json\n\n };\n\n const packageJson = getPackageJson(projectDir);\n const packageJsonDependencies = (0, _merge2().default)(packageJson.dependencies || {}, packageJson.devDependencies || {});\n\n const getNameAndVersion = pj => ({\n [pj.name]: pj.version\n });\n\n const nodeModules = (0, _mergeAll2().default)(_glob().default.sync(path().join(projectDir, 'node_modules', '*')).map((0, _compose2().default)(getNameAndVersion, getPackageJson))); // eslint-disable-next-line\n\n dependencies.forEach(dep => {\n if (!dep.packageDependencies || (0, _isEmpty2().default)(dep.packageDependencies)) return null;\n (0, _forEachObjIndexed2().default)((packageDepVersion, packageDepName) => {\n const packageDep = {\n [packageDepName]: packageDepVersion\n };\n const compatibleWithPackgeJson = compatibleWith(packageDep, packageJsonDependencies);\n const compatibleWithNodeModules = compatibleWith(packageDep, nodeModules);\n\n if (!compatibleWithPackgeJson && !compatibleWithNodeModules && !(0, _contains2().default)(packageDep, warnings.notInBoth)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n warnings.notInBoth.push(packageDep);\n }\n\n if (!compatibleWithPackgeJson && compatibleWithNodeModules && !(0, _contains2().default)(packageDep, warnings.notInPackageJson)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n warnings.notInPackageJson.push(packageDep);\n }\n\n if (compatibleWithPackgeJson && !compatibleWithNodeModules && !(0, _contains2().default)(packageDep, warnings.notInNodeModules)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n warnings.notInNodeModules.push(packageDep);\n }\n }, dep.packageDependencies);\n }); // Remove duplicates warnings for missing packages\n\n warnings.notInBoth = (0, _uniq2().default)(warnings.notInBoth);\n return Promise.resolve(warnings);\n}",
"function verBump () {\n const { version: currentVersion, versions } = npmGetJson();\n const [version, tag] = currentVersion.split('-');\n const [,, patch] = version.split('.');\n const lastVersion = versions?.npm || currentVersion;\n\n if (argv['skip-beta'] || patch === '0') {\n // don't allow beta versions\n execSync('yarn polkadot-dev-version patch');\n withNpm = true;\n } else if (tag || currentVersion === lastVersion) {\n // if we don't want to publish, add an X before passing\n if (!withNpm) {\n npmAddVersionX();\n } else {\n npmDelVersionX();\n }\n\n // beta version, just continue the stream of betas\n execSync('yarn polkadot-dev-version pre');\n } else {\n // manually set, got for publish\n withNpm = true;\n }\n\n // always ensure we have made some changes, so we can commit\n npmSetVersionFields();\n rmFile('.123trigger');\n\n execSync('yarn polkadot-dev-contrib');\n execSync('git add --all .');\n}"
] | [
"0.73457325",
"0.6911505",
"0.65562487",
"0.619107",
"0.6153813",
"0.6046005",
"0.5957651",
"0.5914926",
"0.59013903",
"0.5895902",
"0.58865327",
"0.5879123",
"0.5726318",
"0.569718",
"0.56145304",
"0.5594718",
"0.55524945",
"0.5523478",
"0.5501209",
"0.548553",
"0.5478032",
"0.5472975",
"0.5438054",
"0.5436479",
"0.53988177",
"0.5359738",
"0.53366303",
"0.5321918",
"0.5300422",
"0.52959186"
] | 0.74712354 | 0 |
! SCOREBOARD ASSETS This is the function that runs to add scoreboard assets | function addScoreboardAssets(){
manifest.push({src:'assets/scoreboard/bg_scoreboard.png', id:'bgScoreboard'});
manifest.push({src:'assets/scoreboard/icon_replay.png', id:'iconReplay'});
manifest.push({src:'assets/scoreboard/icon_save.png', id:'iconSave'});
manifest.push({src:'assets/scoreboard/icon_scoreboard.png', id:'iconScoreboard'});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function AddAssets()\n{\n\t//Add static background sprites\n\tbackColor = gfx.CreateRectangle(1, 1, 0xfffdad )\n\tgfx.AddGraphic( backColor, 0 , 0 )\n\tgfx.AddSprite( face, 0, 0.886, 1 )\n\tgfx.AddSprite( pasta, 0.85, 0.08, 0.1 )\n\tgfx.AddSprite( pastaIcon, 0.85, 0.08, 0.1 )\n\tgfx.AddSprite( paperIcon, 0.86, 0.15, 0.08 )\n \n //Add counters.\n\tgfx.AddText( pastaTxt, 0.8, 0.09 );\n\tgfx.AddText( paperTxt, 0.8, 0.15 );\n \n //Add scores\n\tgfx.AddText( score, 0.012, 0.01 );\n\tgfx.AddText( immune, 0.68, 0.02 );\n\tgfx.AddSprite( heart, 0.86, 0.02, 0.08 )\n\t\n\t//Add game objects to screen.\n\tAddHandSan()\n \n //Create a batch containers for our virus and drop sprites.\n //(gives higher performance for lots of same sprite/particle)\n batchVirus = gfx.CreateBatch()\n gfx.AddBatch( batchVirus )\n batchDrops = gfx.CreateBatch()\n gfx.AddBatch( batchDrops )\n \n //Hack to provide missing funcs in GameView.\n batchVirus.RemoveSprite = function( sprite ) { batchVirus.removeChild( sprite.sprite ); sprite.added = false; }\n batchDrops.RemoveSprite = function( sprite ) { batchDrops.removeChild( sprite.sprite ); sprite.added = false; }\n \n\t//Show splash screen.\n gfx.AddSprite( screens, 0, 0, 1,1 )\n \n \n //Start game.\n gfx.Play()\n \n\n\tscreens.PlayRange(2,8,0.08*animationSpeed,false)\n\tsetTimeout(function(){screens.Goto(0); ready=true},2500)\n}",
"function drawAssets(loadImageDataArray) {\n const assetBoard = document.getElementById('assetBoard');\n const keys = Object.keys(assetData);\n loadImageDataArray = []\n for(i = 0; i < keys.length; i++) { \n assetBoard.appendChild(cloneAssetCategory(keys[i]));\n let d1 = assetData[keys[i]];\n let d1Keys = Object.keys(d1); \n for(ii=0; ii < d1Keys.length; ii++) {\n document.getElementById(`ac_${keys[i]}`).appendChild(cloneAssetGroup(d1Keys[ii]));\n d1[d1Keys[ii]].forEach( function(ele) {\n document.getElementById(`ag_${d1Keys[ii]}`).appendChild(cloneAsset(ele));\n loadImageDataArray.push(`asset_${ele.name.split('.')[0]}`)\n })\n }\n }\n return loadImageDataArray \n }",
"function loadAssets() {\n PIXI.loader\n .add([\n \"./assets/tileset10.png\",\n ])\n .load(gameCreate);\n}",
"function storeAssets(pRawAssets, pAssets) {\n var i;\n for (i = 0; i < pRawAssets.length; i++) {\n\n var item = pRawAssets[i];\n\n switch (item.type) {\n\n case \"json\":\n var ssdata = JSON.parse(item.result.toString());\n var key;\n for (key in ssdata) {\n if (ssdata.hasOwnProperty(key)) {\n var spData = ssdata[key];\n pAssets[key + \"SpriteSheet\"] = new createjs.SpriteSheet(spData);\n }\n }\n\n break;\n\n case \"image\":\n pAssets[item.id + \"Img\"] = item.result;\n break;\n }\n }\n }",
"function addAsset(assets, asset) {\n if (asset) {\n assets.push(asset);\n }\n}",
"set mainAsset(value) {}",
"function storeAssets(rawAssets, assets) {\n \n var i;\n for (i = 0; i < rawAssets.length; i++) {\n\n var item = rawAssets[i];\n\n switch (item.type) {\n \n case \"json\":\n // convert json text to js objects\n var ssdata = JSON.parse(item.result.toString());\n // create spritsheets (here we assume all json describe spritesheets)\n assets[item.id + \"SpriteSheet\"] = new createjs.SpriteSheet(ssdata);\n break;\n\n case \"image\":\n assets[item.id + \"Img\"] = item.result;\n break;\n }\n }\n }",
"function game_queueData() {\n\t\tvar data = [\n\t\t\t\"img/awesome.png\",\n\t\t\t\"img/awesome_rays.png\"\n\t\t];\n\t\tg_ASSETMANAGER.queueAssets(data);\n\t\tdata = [\n\t\t];\n\t\tg_SOUNDMANAGER.loadSounds(data);\n}",
"function Main() {\n\n MyGL.AssetsManager.getInstance().addGroup([\n //new MyGL.AssetData('standard_mat_bp_vshader', MyGL.AssetData.TEXT, './src/shaders/standard_material/phong-f/vert.glsl'),\n //new MyGL.AssetData('standard_mat_bp_fshader', MyGL.AssetData.TEXT, './src/shaders/standard_material/phong-f/frag.glsl'),\n //new MyGL.AssetData('standard_mat_bp_vshader_nt', MyGL.AssetData.TEXT, './src/shaders/standard_material/phong-f/vert_no_texture.glsl'),\n //new MyGL.AssetData('standard_mat_bp_fshader_nt', MyGL.AssetData.TEXT, './src/shaders/standard_material/phong-f/frag_no_texture.glsl'),\n new MyGL.AssetData('img_earth', MyGL.AssetData.IMAGE, './resource/earth.bmp'),\n new MyGL.AssetData('img_earth01', MyGL.AssetData.IMAGE, './resource/earth01.jpg'),\n new MyGL.AssetData('img_crate', MyGL.AssetData.IMAGE, './resource/crate.gif'),\n\n //new MyGL.AssetData('cube_mat_vshader', MyGL.AssetData.TEXT, './src/shaders/cube_material/base/vert.glsl'),\n //new MyGL.AssetData('cube_mat_fshader', MyGL.AssetData.TEXT, './src/shaders/cube_material/base/frag.glsl'),\n /*new AssetData('sky_n_x', AssetData.IMAGE, './resource/sky_n_x.jpg'),\n new AssetData('sky_n_y', AssetData.IMAGE, './resource/sky_n_y.jpg'),\n new AssetData('sky_n_z', AssetData.IMAGE, './resource/sky_n_z.jpg'),\n new AssetData('sky_p_x', AssetData.IMAGE, './resource/sky_p_x.jpg'),\n new AssetData('sky_p_y', AssetData.IMAGE, './resource/sky_p_y.jpg'),\n new AssetData('sky_p_z', AssetData.IMAGE, './resource/sky_p_z.jpg'),*/\n\n new MyGL.AssetData('cloudy_noon_nx', MyGL.AssetData.IMAGE, './resource/cloudy_noon_nx.jpg'),\n new MyGL.AssetData('cloudy_noon_ny', MyGL.AssetData.IMAGE, './resource/cloudy_noon_ny.jpg'),\n new MyGL.AssetData('cloudy_noon_nz', MyGL.AssetData.IMAGE, './resource/cloudy_noon_nz.jpg'),\n new MyGL.AssetData('cloudy_noon_px', MyGL.AssetData.IMAGE, './resource/cloudy_noon_px.jpg'),\n new MyGL.AssetData('cloudy_noon_py', MyGL.AssetData.IMAGE, './resource/cloudy_noon_py.jpg'),\n new MyGL.AssetData('cloudy_noon_pz', MyGL.AssetData.IMAGE, './resource/cloudy_noon_pz.jpg'),\n\n new MyGL.AssetData('land', MyGL.AssetData.IMAGE, './resource/land.png'),\n new MyGL.AssetData('grass', MyGL.AssetData.IMAGE, './resource/grass.png'),\n\n new MyGL.AssetData('drone', MyGL.AssetData.TEXT, './resource/drone.obj')\n //new AssetData('drone_diffuse', AssetData.IMAGE, './resource/drone_diffuse_01.png')\n ]);\n MyGL.AssetsManager.getInstance().addEventListener(MyGL.AssetsManager.GROUP_LOAD_COMPLETE, this.loadComplete, this);\n MyGL.AssetsManager.getInstance().load();\n}",
"addAssets(match) {\n\t\tlet files = findFiles(this.scriptdir, match);\n\t\tfor (let f of files) {\n\t\t\tlet file = path.parse(f);\n\t\t\tlet name = file.name;\n\t\t\tlet type = 'blob';\n\t\t\tif (file.ext === '.png' || file.ext === '.jpg' || file.ext === '.jpeg') {\n\t\t\t\ttype = 'image';\n\t\t\t}\n\t\t\telse if (file.ext === '.wav') {\n\t\t\t\ttype = 'sound';\n\t\t\t}\n\t\t\telse if (file.ext === '.ttf') {\n\t\t\t\ttype = 'font';\n\t\t\t}\n\t\t\telse if (file.ext === '.mp4' || file.ext === '.webm' || file.ext === '.wmv' || file.ext === '.avi') {\n\t\t\t\ttype = 'video';\n\t\t\t}\n\t\t\telse {\n\t\t\t\tname = file.base;\n\t\t\t}\n\n\t\t\tif (!file.name.startsWith('.') && file.name.length > 0) {\n\t\t\t\tthis.assets.push({\n\t\t\t\t\tname: name,\n\t\t\t\t\tfile: f,\n\t\t\t\t\ttype: type\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}",
"function preload() {\n game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;\n game.scale.pageAlignHorizontally = true;\n game.scale.pageAlignVertically = true;\n game.stage.backgroundColor = 'grey';\n \n ASSETS.foreach((asset, index) => {\n game.load.image(ASSET_NAME[index], asset);\n });\n // add button separately\n game.load.spritesheet('button', 'assets/button.png', 120, 40);\n}",
"addAsset(asset, position) {\n this.assets.push(asset);\n asset.setPosition(position);\n }",
"loadAssets() {\n AssetLoader.load(this.setupGame, this.onLoadProgress);\n }",
"function loadAssets () {\n OasisAssets = {};\n\n // terrain\n OasisAssets['grass'] = getImage('../../res/', 'grass.png');\n OasisAssets['sand'] = getImage('../../res/', 'sand.png');\n OasisAssets['shore'] = getImage('../../res/', 'shore.png');\n OasisAssets['ocean'] = getImage('../../res/', 'ocean.png');\n OasisAssets['stone'] = getImage('../../res/', 'stone.png');\n OasisAssets['tree'] = getImage('../../res/', 'tree.png');\n OasisAssets['leaves'] = getImage('../../res/', 'leaves.png');\n}",
"function preload() {\n costumeObjectArray[0] = new CostumeObject(780, 300, 100, 70, \"assets/lips.png\");\n costumeObjectArray[1] = new CostumeObject(780, 150, 150, 43, \"assets/moustache.png\");\n costumeObjectArray[2] = new CostumeObject(780, 400, 200, 139, \"assets/beard.png\");\n costumeObjectArray[3] = new CostumeObject(780, 10, 200, 100, \"assets/glasses.png\");\n costumeObjectArray[4] = new CostumeObject(5, 170, 325, 449, \"assets/hair.png\");\n costumeObjectArray[5] = new CostumeObject(25, 5, 210, 167, \"assets/hat.png\"); \n// loading the buttons \n imgReset = loadImage(\"assets/buttonReset.png\");\n imgSave = loadImage(\"assets/buttonSave.png\");\n imgFilters = loadImage(\"assets/buttonFilters.png\"); \n imgStage = loadImage(\"assets/backgroundStage.png\")\n}",
"LoadAllAssets() {}",
"function main() {\n //add field object to stage\n field = new objects.Field(assets.getResult(\"field\"));\n stage.addChild(field);\n //add ball object to stage\n ball = new objects.Ball(assets.getResult(\"ball\"));\n stage.addChild(ball);\n // add player object to stage\n player = new objects.Player(assets.getResult(\"player\"));\n stage.addChild(player);\n // add 3 opposition objects to stage\n for (var cloud = 0; cloud < 3; cloud++) {\n clouds[cloud] = new objects.Cloud(assets.getResult(\"cloud\"));\n stage.addChild(clouds[cloud]);\n }\n //add scoreboard\n scoreboard = new objects.ScoreBoard();\n //add collision manager\n collision = new managers.Collision();\n}",
"loadAssets() {\n this.load.image('room2_one_lesson_BG', 'assets/one_lesson_BG.png');\n this.load.image('room2_character_north', 'assets/character_north.png');\n this.load.image('room2_character_east', 'assets/character_east.png');\n this.load.image('room2_character_south', 'assets/character_south.png');\n this.load.image('room2_character_west', 'assets/character_west.png');\n this.load.image('room2_activity1A', 'assets/Panels/RoomTwo/PanelOneA.png');\n\t// this.load.image('room2_activity1B', 'assets/Panels/RoomTwo/PanelOneB.png');\n\t// this.load.image('room2_activity1C', 'assets/Panels/RoomTwo/PanelOneC.png');\n\t// this.load.image('room2_activity1D', 'assets/Panels/RoomTwo/PanelOneD.png');\n this.load.image('room2_activity2A', 'assets/Panels/RoomTwo/PanelTwoA.png');\n this.load.image('room2_activity2B', 'assets/Panels/RoomTwo/PanelTwoB.png');\n\t// this.load.image('room2_activity2C', 'assets/Panels/RoomTwo/PanelTwoC.png');\n\t// this.load.image('room2_activity2D', 'assets/Panels/RoomTwo/PanelTwoD.png');\n this.load.image('room2_activity3A', 'assets/Panels/RoomTwo/PanelThreeA.png');\n this.load.image('room2_activity3B', 'assets/Panels/RoomTwo/PanelThreeB.png');\n this.load.image('room2_activity4A', 'assets/Panels/RoomTwo/PanelFourA.png');\n this.load.image('room2_activity4B', 'assets/Panels/RoomTwo/PanelFourB.png');\n\t// this.load.image('room2_activity4C', 'assets/Panels/RoomTwo/PanelFourC.png');\n\t// this.load.image('room2_activity4D', 'assets/Panels/RoomTwo/PanelFourD.png');\n\t// this.load.image('room2_activity4E', 'assets/Panels/RoomTwo/PanelFourE.png');\n this.load.image('room2_activity5A', 'assets/Panels/RoomTwo/PanelFiveA.png');\n this.load.image('room2_activity5B', 'assets/Panels/RoomTwo/PanelFiveB.png');\n\t// this.load.image('room2_activity5C', 'assets/Panels/RoomTwo/PanelFiveC.png');\n\t// this.load.image('room2_activity5D', 'assets/Panels/RoomTwo/PanelFiveD.png');\n\t// this.load.image('room2_activity5E', 'assets/Panels/RoomTwo/PanelFiveE.png');\n\t// this.load.image('room2_activity5F', 'assets/Panels/RoomTwo/PanelFiveF.png');\n this.load.image('room2_activity6A', 'assets/Panels/RoomTwo/PanelSixA.png');\n this.load.image('room2_activity6B', 'assets/Panels/RoomTwo/PanelSixB.png');\n this.load.image('room2_activity6C', 'assets/Panels/RoomTwo/PanelSixC.png');\n this.load.image('room2_activity6D', 'assets/Panels/RoomTwo/PanelSixD.png');\n this.load.image('room2_activity6E', 'assets/Panels/RoomTwo/PanelSixE.png');\n this.load.image('room2_E_KeyImg', 'assets/E_Key.png');\n this.load.image('room2_wall_info_1', 'assets/wall_art.png');\n this.load.image('room2_wall_info_2', 'assets/wall_art.png');\n this.load.image('room2_wall_info_3', 'assets/wall_art.png');\n this.load.image('room2_wall_info_4', 'assets/wall_art.png');\n this.load.image('room2_wall_info_5', 'assets/wall_art.png');\n this.load.image('room2_wall_info_6', 'assets/wall_art.png');\n this.load.image('room2_floor', 'assets/Room2/floor_1.jpg');\n this.load.image('room2_hole_activity', 'assets/Room2/crackedHole.png');\n this.load.image('room2_hole_nextRoom', 'assets/hole.png');\n this.load.image('room2_map', 'assets/featNotAvail.png');\n this.load.image('room2_notebook', 'assets/featNotAvail.png');\n this.load.image('room2_activityLocked', 'assets/activityLocked.png');\n this.load.image('room2_help_menu', 'assets/help_menu.png');\n this.load.image('rightArrow' , 'assets/rightArrowTest.png');\n\tthis.load.image('returnDoor', 'assets/dooropen_100x100.png');\n this.load.image('singleCoin', 'assets/Coin/singleCoin.png');\n this.load.image('profile','assets/character_south.png');\n }",
"LoadAssetWithSubAssets() {}",
"function preload() {\n //spritesheets\n playerSS = loadImage('assets/collector.png');\n playerJSON = loadJSON('assets/collector.json');\n trashSS = loadImage('assets/bottle.png');\n trashJSON = loadJSON('assets/bottle.json');\n}",
"static preload() {\n\n\t\tlet _onAssetsLoaded = function(e, ressources) {\n\t\t\tShooter.assets = ressources;\n\n\t\t\tShooter.setup();\n\t\t}\n\n\t\tShooter.loader\n\t\t\t.add(Shooter.assetsDir + \"background.jpg\") //TODO : use json objects with index\n\t\t\t.add(Shooter.assetsDir + \"space_ship.png\")\n\t\t\t.add(Shooter.assetsDir + \"space_ship_hit.png\")\n\t\t\t.add(Shooter.assetsDir + \"enemy.png\")\n\t\t\t.add(Shooter.assetsDir + \"bullet.png\")\n\t\t\t.add(Shooter.assetsDir + \"explode.json\");\n\t\t\t\n\t\tShooter.loader.load(_onAssetsLoaded);\n\t}",
"function buildScoreBoardCanvas(){\n\tif(!displayScoreBoard){\n\t\treturn;\t\n\t}\n\t\n\t//buttons\n\tresultContainer.removeChild(replayButton);\n\t\n\tbuttonReplay = new createjs.Bitmap(loader.getResult('iconReplay'));\n\tcenterReg(buttonReplay);\n\tcreateHitarea(buttonReplay);\n\tsaveButton = new createjs.Bitmap(loader.getResult('iconSave'));\n\tcenterReg(saveButton);\n\tcreateHitarea(saveButton);\n\tscoreboardButton = new createjs.Bitmap(loader.getResult('iconScoreboard'));\n\tcenterReg(scoreboardButton);\n\tcreateHitarea(scoreboardButton);\n\t\n\tresultContainer.addChild(buttonReplay, saveButton, scoreboardButton);\n\t\n\t//scoreboard\n\tscoreBoardContainer = new createjs.Container();\n\tbgScoreboard = new createjs.Bitmap(loader.getResult('bgScoreboard'));\n\t\n\tscoreTitle = new createjs.Text();\n\tscoreTitle.font = \"80px bariol_regularregular\";\n\tscoreTitle.color = \"#ffffff\";\n\tscoreTitle.text = scoreBoardTitle;\n\tscoreTitle.textAlign = \"center\";\n\tscoreTitle.textBaseline='alphabetic';\n\tscoreTitle.x = canvasW/2;\n\tscoreTitle.y = canvasH/100*14;\n\t\n\tscoreBackTxt = new createjs.Text();\n\tscoreBackTxt.font = \"50px bariol_regularregular\";\n\tscoreBackTxt.color = \"#ffffff\";\n\tscoreBackTxt.text = scoreBackText;\n\tscoreBackTxt.textAlign = \"center\";\n\tscoreBackTxt.textBaseline='alphabetic';\n\tscoreBackTxt.x = canvasW/2;\n\tscoreBackTxt.y = canvasH/100*95;\n\tscoreBackTxt.hitArea = new createjs.Shape(new createjs.Graphics().beginFill(\"#000\").drawRect(-200, -30, 400, 40));\n\tscoreBoardContainer.addChild(bgScoreboard, scoreTitle, scoreBackTxt);\n\t\n\tvar scoreStartY = canvasH/100*23;\n\tvar scoreSpanceY = 49.5;\n\tfor(scoreNum=0;scoreNum<=10;scoreNum++){\n\t\tfor(scoreColNum=0;scoreColNum<score_arr.length;scoreColNum++){\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum] = new createjs.Text();\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].font = \"35px bariol_regularregular\";\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].color = \"#ffffff\";\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].textAlign = score_arr[scoreColNum].align;\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].textBaseline='alphabetic';\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].x = canvasW/100 * score_arr[scoreColNum].percentX;\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].y = scoreStartY;\n\t\t\t\n\t\t\tif(scoreColNum == 0){\n\t\t\t\t//position\n\t\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].text = scoreRank_arr[scoreNum-1];\t\n\t\t\t}\n\t\t\t\n\t\t\tif(scoreNum == 0){\n\t\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].text = score_arr[scoreColNum].col;\t\n\t\t\t}\n\t\t\t\n\t\t\tscoreBoardContainer.addChild($.scoreList[scoreNum+'_'+scoreColNum]);\n\t\t}\n\t\tscoreStartY += scoreSpanceY;\n\t}\n\t\n\tscoreBoardContainer.visible = false;\n\tcanvasContainer.addChild(scoreBoardContainer);\n\t\n\t$.get('submit.html', function(data){\n\t\t$('#canvasHolder').append(data);\n\t\tbuildScoreboardButtons();\n\t\ttoggleSaveButton(true);\n\t\tresizeScore();\n\n\t});\n}",
"preload() {\n //images for intro scene\n this.load.image(\"play\", \"src/assets/images/play.png\");\n this.load.image(\n \"lighthouseIntro\",\n \"src/assets/images/lighthouse-intro.png\"\n );\n this.load.image(\"lighthouseColor\", \"src/assets/images/lighthouseColor.png\");\n\n //load sprite sheets for level characters\n this.load.atlas(\n \"player\",\n \"src/assets/spritesheets/Tommy.png\",\n \"src/assets/spritesheets/Tommy.json\"\n );\n this.load.atlas(\n \"robot\",\n \"src/assets/spritesheets/Robot.png\",\n \"src/assets/spritesheets/Robot.json\"\n );\n this.load.atlas(\n \"python\",\n \"src/assets/spritesheets/Python.png\",\n \"src/assets/spritesheets/Python.json\"\n );\n this.load.atlas(\n \"bat\",\n \"src/assets/spritesheets/Bat.png\",\n \"src/assets/spritesheets/Bat.json\"\n );\n this.load.atlas(\n \"monitor\",\n \"src/assets/spritesheets/Monitor.png\",\n \"src/assets/spritesheets/Monitor.json\"\n );\n this.load.atlas(\n \"roach\",\n \"src/assets/spritesheets/Roach.png\",\n \"src/assets/spritesheets/Roach.json\"\n );\n this.load.atlas(\n \"tweeter\",\n \"src/assets/spritesheets/Tweeter.png\",\n \"src/assets/spritesheets/Tweeter.json\"\n );\n //score increasing items\n this.load.image(\"gem\", \"src/assets/images/gem.png\");\n this.load.image(\"ruby\", \"src/assets/images/ruby.png\");\n\n //images for level one scene\n //images for level one Parallax backgrounds\n this.load.image(\n \"Level1CloseSky\",\n \"src/assets/images/Level1/Level1CloseSky.png\"\n );\n this.load.image(\n \"Level1MidSky\",\n \"src/assets/images/Level1/Level1MidSky.png\"\n );\n this.load.image(\n \"Level1FarSky\",\n \"src/assets/images/Level1/Level1FarSky.png\"\n );\n this.load.image(\n \"Level1Clouds\",\n \"src/assets/images/Level1/Level1Clouds.png\"\n );\n\n //load tileset images for layers\n this.load.image(\"labTiles\", \"src/assets/tilesets/prop pack.png\");\n this.load.image(\n \"exitDoorTiles\",\n \"src/assets/tilesets/House (Outside And Inside) Tileset.png\"\n );\n this.load.image(\"windowTiles\", \"src/assets/tilesets/background-tiles.png\");\n this.load.image(\n \"darkIndustrialTiles\",\n \"src/assets/tilesets/0x72-industrial-tileset-32px-extruded.png\"\n );\n this.load.image(\n \"invisibleWalls\",\n \"src/assets/tilesets/Blocks (16 x 16).png\"\n );\n this.load.image(\"closeDaySky\", \"src/assets/tilesets/Day Close.png\");\n this.load.image(\"midDaySky\", \"src/assets/tilesets/Day Mid.png\");\n this.load.image(\"farDaySky\", \"src/assets/tilesets/Day Far.png\");\n this.load.image(\"cloudyDaySky\", \"src/assets/tilesets/Day Far.png\");\n //load map from Json file\n this.load.tilemapTiledJSON(\"level1map\", \"src/assets/tilemaps/Level1.json\");\n\n //images for level two scene\n //images for level two Parallax backgrounds\n this.load.image(\n \"Level2Background\",\n \"src/assets/images/Level2/Level2Background.png\"\n );\n //load tileset images for layers\n this.load.image(\n \"greyTiles\",\n \"src/assets/tilesets/Gray_Tile_Terrain (16 x 16).png\"\n );\n this.load.image(\n \"scaffoldingTiles\",\n \"src/assets/tilesets/Scaffolding_and_BG_Parts (16 x 16).png\"\n );\n //load map from Json file\n this.load.tilemapTiledJSON(\"level2map\", \"src/assets/tilemaps/Level2.json\");\n\n //images for level three scene\n //images for level three Parallax backgrounds\n this.load.image(\"Level3Close\", \"src/assets/images/Level3/Level3Close.png\");\n this.load.image(\"Level3Far\", \"src/assets/images/Level3/Level3Far.png\");\n this.load.image(\"Level3Mid\", \"src/assets/images/Level3/Level3Mid.png\");\n this.load.image(\"Level3Moon\", \"src/assets/images/Level3/Level3Moon.png\");\n this.load.image(\"Level3Sky\", \"src/assets/images/Level3/Level3Sky.png\");\n this.load.image(\"darkLabTiles\", \"src/assets/tilesets/DarkLab.png\");\n this.load.image(\"closeNightSky\", \"src/assets/tilesets/Night Close.png\");\n this.load.image(\"farNightSky\", \"src/assets/tilesets/Night Far.png\");\n this.load.image(\"moonNightSky\", \"src/assets/tilesets/NightSky.png\");\n //load map from Json file\n this.load.tilemapTiledJSON(\"level3map\", \"src/assets/tilemaps/Level3.json\");\n\n //images for level four scene\n //images for level four Parallax backgrounds\n this.load.image(\n \"Level4Cloudcover\",\n \"src/assets/images/Level4/Level4Cloudcover.png\"\n );\n this.load.image(\n \"Level4Clouds\",\n \"src/assets/images/Level4/Level4Clouds.png\"\n );\n this.load.image(\n \"Level4Foreground\",\n \"src/assets/images/Level4/Level4Foreground.png\"\n );\n this.load.image(\"Level4Hills\", \"src/assets/images/Level4/Level4Hills.png\");\n this.load.image(\n \"Level4Preforeground\",\n \"src/assets/images/Level4/Level4Preforeground.png\"\n );\n this.load.image(\"Level4Sky\", \"src/assets/images/Level4/Level4Sky.png\");\n this.load.image(\n \"lightBrownTiles\",\n \"src/assets/tilesets/Terrain (16 x 16).png\"\n );\n this.load.image(\n \"fenceTiles\",\n \"src/assets/tilesets/Grassland_entities (16 x 16).png\"\n );\n this.load.image(\n \"foregroundTreeTiles\",\n \"src/assets/tilesets/1 - Foreground_scenery.png\"\n );\n this.load.image(\"greenHillTiles\", \"src/assets/tilesets/2 - Hills.png\");\n this.load.image(\n \"largeCloudTiles\",\n \"src/assets/tilesets/4 - Cloud_cover_2.png\"\n );\n this.load.image(\n \"smallCloudTiles\",\n \"src/assets/tilesets/3 - Cloud_cover_1.png\"\n );\n this.load.image(\"blueSkyTiles\", \"src/assets/tilesets/5 - Sky_color.png\");\n this.load.tilemapTiledJSON(\"level4map\", \"src/assets/tilemaps/Level4.json\");\n\n //Sound for Sprites\n this.load.audio(\"jump\", \"src/assets/audio/Jump.mp3\");\n this.load.audio(\"playerDeath\", \"src/assets/audio/Player Death.mp3\");\n this.load.audio(\"enemyDeath\", \"src/assets/audio/Enemy Death.mp3\");\n this.load.audio(\"fanfare\", \"src/assets/audio/Fanfare.mp3\");\n\n //Sound for Gems\n this.load.audio(\"gem\", \"src/assets/audio/Gem.mp3\");\n\n //Sound for title screen\n this.load.audio(\"start-menu\", \"src/assets/audio/Start Menu.mp3\");\n //Sound for Story screen\n this.load.audio(\"story\", \"src/assets/audio/Story.mp3\");\n //Sound for Transition screens\n this.load.audio(\"transition\", \"src/assets/audio/Transition.mp3\");\n //Sound for Game Over screen\n this.load.audio(\"gameOver\", \"src/assets/audio/Game Over.mp3\");\n //Sound for Game Win screen\n this.load.audio(\"gameWin\", \"src/assets/audio/Game Win.mp3\");\n //Sound for level 1\n this.load.audio(\"level1\", \"src/assets/audio/Level1.mp3\");\n //Sound for level 2\n this.load.audio(\"level2\", \"src/assets/audio/Level2.mp3\");\n //Sound for level 3\n this.load.audio(\"level3\", \"src/assets/audio/Level3.mp3\");\n //Sound for level 4\n this.load.audio(\"level4\", \"src/assets/audio/Level4.mp3\");\n }",
"function loadAssetsAndCreateScenes() {\r\n\r\n function loadLensflaresSceneAssets() {\r\n var get1 = $.get( \"./glsl/simple.vert\", function( vert ) { LensflareVert = vert; });\r\n var get2 = $.get( \"./glsl/swimmingColors.frag\", function( frag ) { LensflareFrag = frag; });\r\n\r\n $.when( get1, get2).done( function() {\r\n createLensflaresScene();\r\n startInitialScene();\r\n var button = $(\"#me\");\r\n button.click(function(){\r\n ENGINE.currentUpdateFunction = scenes.Lensflares;\r\n ContentDiv.html( MeHTML);\r\n });\r\n button.removeClass(\"blocked_link\").addClass(\"active_link\");\r\n\r\n button = $(\"#bsc\");\r\n button.click(function(){\r\n ENGINE.currentUpdateFunction = scenes.Lensflares;\r\n ContentDiv.html( BscHTML);\r\n });\r\n button.removeClass(\"blocked_link\").addClass(\"active_link\");\r\n\r\n button = $(\"#msc\");\r\n button.click(function(){\r\n ENGINE.currentUpdateFunction = scenes.Lensflares;\r\n ContentDiv.html( MscHTML);\r\n });\r\n button.removeClass(\"blocked_link\").addClass(\"active_link\");\r\n });\r\n }\r\n\r\n function loadLavalampSceneAssets() {\r\n var get1 = $.get( \"./glsl/perlinWobbly.vert\", function( vert ) { LavalampVert = vert; });\r\n var get2 = $.get( \"./glsl/perlinWobbly.frag\", function( frag ) { LavalampFrag = frag; });\r\n\r\n $.when( get1, get2).done( function() {\r\n createLavaLampScene();\r\n\r\n var button = $(\"#can\");\r\n button.click(function(){\r\n ENGINE.currentUpdateFunction = scenes.Lavalamp;\r\n ContentDiv.html(DoHTML);\r\n\r\n });\r\n button.removeClass(\"blocked_link\").addClass(\"active_link\");\r\n });\r\n }\r\n\r\n function loadBuckminsterSceneAssets() {\r\n var cubeTextures = [\r\n './res/Vindelalven/posx.jpg',\r\n './res/Vindelalven/negx.jpg',\r\n './res/Vindelalven/posy.jpg',\r\n './res/Vindelalven/negy.jpg',\r\n './res/Vindelalven/posz.jpg',\r\n './res/Vindelalven/negz.jpg'\r\n ];\r\n\r\n BuckminsterCubemap = THREE.ImageUtils.loadTextureCube(cubeTextures);\r\n createBuckminsterScene();\r\n\r\n var button = $(\"#want\");\r\n button.click(function(){\r\n ENGINE.currentUpdateFunction = scenes.Buckminster;\r\n ContentDiv.html( WantHTML);\r\n });\r\n button.removeClass(\"blocked_link\").addClass(\"active_link\");\r\n\r\n }\r\n\r\n function loadVogelkindSceneAssets() {\r\n var loader = new THREE.OBJLoader();\r\n loader.load(\r\n // resource URL\r\n \"./res/Vogelkind.obj\",\r\n // Function when resource is loaded\r\n function ( object ) {\r\n VogelkindVogel = object;\r\n createVogelkindScene();\r\n var button = $(\"#vita\");\r\n button.click(function(){\r\n ENGINE.currentUpdateFunction = scenes.Vogelkind;\r\n ContentDiv.html( VitaHTML);\r\n });\r\n button.removeClass(\"blocked_link\").addClass(\"active_link\");\r\n }\r\n );\r\n }\r\n\r\n function loadSoapBubblesSceneAssets() {\r\n // TODO BUTTON FREISCHALTEN\r\n\r\n var cubeTextures = [\r\n './res/Vindelalven/posx.jpg',\r\n './res/Vindelalven/negx.jpg',\r\n './res/Vindelalven/posy.jpg',\r\n './res/Vindelalven/negy.jpg',\r\n './res/Vindelalven/posz.jpg',\r\n './res/Vindelalven/negz.jpg'\r\n ];\r\n\r\n SoapBubblesCubemap = THREE.ImageUtils.loadTextureCube(cubeTextures);\r\n createSoapBubblesScene();\r\n\r\n var button = $(\"#about\");\r\n button.click(function(){\r\n ENGINE.currentUpdateFunction = scenes.SoapBubbles;\r\n ContentDiv.html( AboutHTML);\r\n });\r\n button.removeClass(\"blocked_link\").addClass(\"active_link\");\r\n }\r\n\r\n loadLensflaresSceneAssets();\r\n loadLavalampSceneAssets();\r\n loadBuckminsterSceneAssets();\r\n loadVogelkindSceneAssets();\r\n loadSoapBubblesSceneAssets();\r\n}",
"function assetsLoadedHandler ()\n{\n\tvar data = {\n\t\timages: [\"./assets/dot.png\"],\n\t\tframes: [\n\t\t\t// x, y, width, height, imageIndex*, regX*, regY*\n\t\t\t[0, 0, 128, 128, 0, 64, 64]\n\t\t],\n\t\tanimations: {\n\t\t\tdot: 0\n\t\t}\n\t};\n\n\tspriteSheet = new createjs.SpriteSheet (data);\n\n\tcreateBeams ();\n}",
"function loadComplete(event) {\n console.log(\"Finished Loading Assets\");\n\n stage.addChild(background);\n stage.update();\n initGraphics();\n}",
"function loadAssets(callback){\n\n // This function will load the sprite images\n function loadSprite(filename){\n asseetsStillLoading ++; \n\n let spriteImage = new Image();\n spriteImage.src = \"assets/sprites/\" + filename;\n\n // This is event handler and once the image has fully loaded, the function inside it will execute\n spriteImage.onload = function(){\n asseetsStillLoading --;\n }\n\n return spriteImage;\n }\n\n function loadSound(sound, loop){\n return new Sound(\"assets/sounds/\" + sound, loop);\n }\n\n sprites.background = loadSprite(\"board.png\");\n sprites.hand = loadSprite(\"hand2.png\"); \n sprites.blueBall = loadSprite(\"pointer.png\");\n sprites.queen = loadSprite(\"queen.png\");\n sprites.yellowBall = loadSprite(\"yellow.png\");\n sprites.blackBall = loadSprite(\"black.png\");\n sprites.gameOver = loadSprite(\"gameOver.png\");\n sprites.continue = loadSprite(\"continue.png\");\n sprites.winner = loadSprite(\"finalScore.png\");\n \n sounds.collide = loadSound(\"BallsCollide\");\n sounds.pocket = loadSound(\"pocket\");\n sounds.side = loadSound(\"Side\");\n\n assetsLoadingLoop(callback);\n}",
"incrementLoadedAssets () {\n this._loadedAssets += 1;\n }",
"static initialize() {\n // HTML からステージの元となる要素を取得し、大きさを設定する\n const stageElement = document.getElementById(\"stage\");\n stageElement.style.width = Config.puyoImgWidth * Config.stageCols + 'px';\n stageElement.style.height = Config.puyoImgHeight * Config.stageRows + 'px';\n stageElement.style.backgroundColor = Config.stageBackgroundColor;\n this.stageElement = stageElement;\n\n const zenkeshiImage = document.getElementById(\"zenkeshi\");\n zenkeshiImage.width = Config.puyoImgWidth * 6;\n zenkeshiImage.style.position = 'absolute';\n zenkeshiImage.style.display = 'none';\n this.zenkeshiImage = zenkeshiImage;\n stageElement.appendChild(zenkeshiImage);\n const scoreElement = document.getElementById(\"score\");\n scoreElement.style.backgroundColor = Config.scoreBackgroundColor;\n scoreElement.style.top = Config.puyoImgHeight * Config.stageRows + 'px';\n scoreElement.style.width = Config.puyoImgWidth * Config.stageCols + 'px';\n scoreElement.style.height = Config.fontHeight + \"px\";\n this.scoreElement = scoreElement;\n // メモリを準備する\n this.board = [\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n ];\n let puyoCount = 0;\n for(let y = 0; y < Config.stageRows; y++) {\n const line = this.board[y] || (this.board[y] = []);\n\n for(let x = 0; x < Config.stageCols; x++) {\n const puyo = line[x];\n if(puyo >= 1 && puyo <= 5) {\n // line[x] = {puyo: puyo, element: this.setPuyo(x, y, puyo)};\n this.setPuyo(x, y, puyo);\n puyoCount++;\n } else {\n line[x] = null;\n }\n }\n }\n this.puyoCount = puyoCount;\n }",
"addAsset(assetConfig) {\n const asset = new resources_1.Asset({\n input: slash_1.default(assetConfig.input),\n output: slash_1.default(assetConfig.output)\n });\n this.assets.push(asset);\n return asset;\n }"
] | [
"0.665967",
"0.618519",
"0.6041548",
"0.5946782",
"0.590872",
"0.58981675",
"0.5803563",
"0.57757103",
"0.5715938",
"0.56942326",
"0.5668764",
"0.5655068",
"0.5628573",
"0.5514279",
"0.5502467",
"0.5500538",
"0.54809815",
"0.5478778",
"0.546091",
"0.54503673",
"0.53984475",
"0.5372879",
"0.5369335",
"0.5342394",
"0.53336686",
"0.53204495",
"0.53072447",
"0.5300039",
"0.5292319",
"0.52847314"
] | 0.7803341 | 0 |
! SCOREBOARD CANVAS This is the function that runs to build scoreboard canvas | function buildScoreBoardCanvas(){
if(!displayScoreBoard){
return;
}
//buttons
resultContainer.removeChild(replayButton);
buttonReplay = new createjs.Bitmap(loader.getResult('iconReplay'));
centerReg(buttonReplay);
createHitarea(buttonReplay);
saveButton = new createjs.Bitmap(loader.getResult('iconSave'));
centerReg(saveButton);
createHitarea(saveButton);
scoreboardButton = new createjs.Bitmap(loader.getResult('iconScoreboard'));
centerReg(scoreboardButton);
createHitarea(scoreboardButton);
resultContainer.addChild(buttonReplay, saveButton, scoreboardButton);
//scoreboard
scoreBoardContainer = new createjs.Container();
bgScoreboard = new createjs.Bitmap(loader.getResult('bgScoreboard'));
scoreTitle = new createjs.Text();
scoreTitle.font = "80px bariol_regularregular";
scoreTitle.color = "#ffffff";
scoreTitle.text = scoreBoardTitle;
scoreTitle.textAlign = "center";
scoreTitle.textBaseline='alphabetic';
scoreTitle.x = canvasW/2;
scoreTitle.y = canvasH/100*14;
scoreBackTxt = new createjs.Text();
scoreBackTxt.font = "50px bariol_regularregular";
scoreBackTxt.color = "#ffffff";
scoreBackTxt.text = scoreBackText;
scoreBackTxt.textAlign = "center";
scoreBackTxt.textBaseline='alphabetic';
scoreBackTxt.x = canvasW/2;
scoreBackTxt.y = canvasH/100*95;
scoreBackTxt.hitArea = new createjs.Shape(new createjs.Graphics().beginFill("#000").drawRect(-200, -30, 400, 40));
scoreBoardContainer.addChild(bgScoreboard, scoreTitle, scoreBackTxt);
var scoreStartY = canvasH/100*23;
var scoreSpanceY = 49.5;
for(scoreNum=0;scoreNum<=10;scoreNum++){
for(scoreColNum=0;scoreColNum<score_arr.length;scoreColNum++){
$.scoreList[scoreNum+'_'+scoreColNum] = new createjs.Text();
$.scoreList[scoreNum+'_'+scoreColNum].font = "35px bariol_regularregular";
$.scoreList[scoreNum+'_'+scoreColNum].color = "#ffffff";
$.scoreList[scoreNum+'_'+scoreColNum].textAlign = score_arr[scoreColNum].align;
$.scoreList[scoreNum+'_'+scoreColNum].textBaseline='alphabetic';
$.scoreList[scoreNum+'_'+scoreColNum].x = canvasW/100 * score_arr[scoreColNum].percentX;
$.scoreList[scoreNum+'_'+scoreColNum].y = scoreStartY;
if(scoreColNum == 0){
//position
$.scoreList[scoreNum+'_'+scoreColNum].text = scoreRank_arr[scoreNum-1];
}
if(scoreNum == 0){
$.scoreList[scoreNum+'_'+scoreColNum].text = score_arr[scoreColNum].col;
}
scoreBoardContainer.addChild($.scoreList[scoreNum+'_'+scoreColNum]);
}
scoreStartY += scoreSpanceY;
}
scoreBoardContainer.visible = false;
canvasContainer.addChild(scoreBoardContainer);
$.get('submit.html', function(data){
$('#canvasHolder').append(data);
buildScoreboardButtons();
toggleSaveButton(true);
resizeScore();
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function showScoreBoard() {\n let title = level >= 15 ? 'Congrats, you won!' : 'Ah, you lost!',\n titleX = level >= 15 ? 152 : 220,\n titleY = 280,\n totalScore = level * 60 + GemsCollected.blue * 30 + GemsCollected.green * 40 + GemsCollected.orange * 50,\n scoreBoard = Resources.get('images/score-board.jpg'),\n starResource = Resources.get('images/Star.png'),\n gemBlueResource = Resources.get('images/Gem-Blue.png'),\n gemGreenResource = Resources.get('images/Gem-Green.png'),\n gemOrangeResource = Resources.get('images/Gem-Orange.png'),\n offset = 70;\n // Draw image assets\n ctx.drawImage(scoreBoard, (canvas.width - scoreBoard.width) / 2, (canvas.height - scoreBoard.height - offset) / 2);\n ctx.drawImage(starResource, 175, 260 - offset, starResource.width / 1.5, starResource.height / 1.5);\n ctx.drawImage(gemBlueResource, 180, 345 - offset, gemBlueResource.width / 1.8, gemBlueResource.height / 1.8);\n ctx.drawImage(gemGreenResource, 180, 425 - offset, gemGreenResource.width / 1.8, gemGreenResource.height / 1.8);\n ctx.drawImage(gemOrangeResource, 180, 505 - offset, gemOrangeResource.width / 1.8, gemOrangeResource.height / 1.8);\n // Draw text\n ctx.font = \"50px Gaegu\";\n ctx.fillStyle = \"#fff\";\n ctx.strokeStyle = \"#000\";\n ctx.lineWidth = 3;\n ctx.strokeText(title, titleX, titleY - offset);\n ctx.fillText(title, titleX, titleY - offset);\n ctx.font = \"45px Gaegu\";\n ctx.strokeText(level + ' x 60 = ' + level * 60, 270, 340 - offset);\n ctx.fillText(level + ' x 60 = ' + level * 60, 270, 340 - offset);\n ctx.strokeText(GemsCollected.blue + ' x 30 = ' + GemsCollected.blue * 30, 270, 420 - offset);\n ctx.fillText(GemsCollected.blue + ' x 30 = ' + GemsCollected.blue * 30, 270, 420 - offset);\n ctx.strokeText(GemsCollected.green + ' x 40 = ' + GemsCollected.green * 40, 270, 500 - offset);\n ctx.fillText(GemsCollected.green + ' x 40 = ' + GemsCollected.green * 40, 270, 500 - offset);\n ctx.strokeText(GemsCollected.orange + ' x 50 = ' + GemsCollected.orange * 50, 270, 580 - offset);\n ctx.fillText(GemsCollected.orange + ' x 50 = ' + GemsCollected.orange * 50, 270, 580 - offset);\n ctx.strokeText('_______', 270, 640 - offset);\n ctx.fillText('_______', 270, 640 - offset);\n ctx.strokeText('Total: ' + totalScore.toString(), 270, 640 - offset);\n ctx.fillText('Total: ' + totalScore.toString(), 270, 640 - offset);\n ctx.strokeText('Spacebar to restart', 170, 680);\n ctx.fillText('Spacebar to restart', 170, 680);\n }",
"function drawCanvas() {\n\t\tdrawer.drawWallGrid(context, solver.gridWall, solver.xLength, solver.yLength, selectedSpacesGrid); \n\t\tdrawInsideSpaces(context, drawer, colourSet, solver, purificator, selectedSpacesGrid);\n\t\tdrawer.drawSudokuFrames(context, solver, mouseCoorsItem); \n\t\tsolver.callStateForItem(spanState);\n\t}",
"static initialize() {\n // HTML からステージの元となる要素を取得し、大きさを設定する\n const stageElement = document.getElementById(\"stage\");\n stageElement.style.width = Config.puyoImgWidth * Config.stageCols + 'px';\n stageElement.style.height = Config.puyoImgHeight * Config.stageRows + 'px';\n stageElement.style.backgroundColor = Config.stageBackgroundColor;\n this.stageElement = stageElement;\n\n const zenkeshiImage = document.getElementById(\"zenkeshi\");\n zenkeshiImage.width = Config.puyoImgWidth * 6;\n zenkeshiImage.style.position = 'absolute';\n zenkeshiImage.style.display = 'none';\n this.zenkeshiImage = zenkeshiImage;\n stageElement.appendChild(zenkeshiImage);\n const scoreElement = document.getElementById(\"score\");\n scoreElement.style.backgroundColor = Config.scoreBackgroundColor;\n scoreElement.style.top = Config.puyoImgHeight * Config.stageRows + 'px';\n scoreElement.style.width = Config.puyoImgWidth * Config.stageCols + 'px';\n scoreElement.style.height = Config.fontHeight + \"px\";\n this.scoreElement = scoreElement;\n // メモリを準備する\n this.board = [\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n ];\n let puyoCount = 0;\n for(let y = 0; y < Config.stageRows; y++) {\n const line = this.board[y] || (this.board[y] = []);\n\n for(let x = 0; x < Config.stageCols; x++) {\n const puyo = line[x];\n if(puyo >= 1 && puyo <= 5) {\n // line[x] = {puyo: puyo, element: this.setPuyo(x, y, puyo)};\n this.setPuyo(x, y, puyo);\n puyoCount++;\n } else {\n line[x] = null;\n }\n }\n }\n this.puyoCount = puyoCount;\n }",
"function paintCanvas() {\n /*\n * This function paints all the game components on the canvas. This includes the background, the snake, the food, and the score\n */\n\n // Paint canvas background\n ctx.fillStyle = \"black\";\n ctx.fillRect(0, 0, boardwidth, boardheight);\n ctx.strokeStyle = \"black\";\n ctx.strokeRect(0, 0, boardwidth, boardheight);\n\n // Paint Snake\n /*\n * TODO 4: Paint the snake by iterating through the snake_array and painting each cell of the snake by calling paintCell.\n * Hint: See initSnake() for how snake_array is constructed.\n */\n for (var i = 0; i < snake_array.length; i++) {\n paintCell(snake_array[i].x, snake_array[i].y);\n }\n\n // Paint Food\n // TODO 5: uncomment the following when you finish implementing paintCell\n // Checkpoint: At the end of this step, you should be able to see the snake array in the upper and a food cell appear randomly on the canvas when you refresh.\n paintCell(food.x, food.y);\n\n // Paint score\n var score_text = \"Score: \" + score;\n ctx.fillText(score_text, 5, boardheight-5);\n\n }",
"initBoard() {\n this.canvas = document.createElement('canvas');\n this.ctx = this.canvas.getContext('2d');\n this.width = this.canvas.width = this.tileWidth * this.columns;\n this.height = this.canvas.height = this.tileHeight * this.rows;\n this.canvas.style.border = \"none\";\n this.initStage();\n }",
"function drawCanvas() {\n\t\tdrawing(context, drawer, colours, solver, selectedSpacesGrid);\n\t\tsolver.callStateForItem(spanState);\n\t}",
"function Leaderboard() {\n ctx.fillStyle = \"white\";\n ctx.fillRect(0 + 30, 0 + 30, canvas.width - 60, canvas.height - 150);\n\n ctx.fillStyle = brandColor;\n ctx.fillRect(0 + 35, 0 + 35, canvas.width - 70, canvas.height - 160);\n\n ctx.fillStyle = questionBarColor;\n ctx.fillRect(0 + 35, 0 + 35, canvas.width - 70, canvas.height - 625);\n\n ctx.fillStyle = questionBarColor;\n ctx.fillRect(0 + 110, 0 + 180, 790, 65);\n\n var startPos = 295;\n for (i = 0; i < 3; i++) {\n ctx.fillStyle = topBarColor;\n ctx.fillRect(35, startPos, canvas.width - 70, 60);\n startPos = startPos + 120;\n }\n\n ctx.fillStyle = questionBarColor;\n ctx.fillRect(canvas.width / 2, 295, 2.5, 300);\n\n ctx.font = \"96px cymraeg\";\n ctx.fillStyle = \"white\";\n ctx.fillText(\"Leaderboard\", 240, 30);\n\n var leaderboardNum = 1;\n var startPosX = 50;\n var startPosY = 315;\n for (i = 0; i < 2; i++) {\n for (j = 0; j < 5; j++) {\n ctx.font = \"36px cymraeg\";\n ctx.fillStyle = \"white\";\n ctx.fillText(leaderboardNum, startPosX, startPosY);\n leaderboardNum = leaderboardNum + 1;\n startPosY = startPosY + 60;\n }\n startPosY = 315;\n startPosX = startPosX + 480;\n }\n}",
"function initializeCanvas()\r\n{\r\n\tcanvas = document.querySelector('canvas');\r\n\tcanvas.style.display = 'block';\r\n\twidth = 800;\r\n\theight = 400;\r\n\tcanvas.width = width;\r\n\tcanvas.height = height + 100; // add an extra 100 displaying score and lives\r\n\tctx = canvas.getContext(\"2d\");\r\n}",
"_draw_scores () {\n\n\t\tvar cw = this._deck_blue ['musician'].w\n\t\tvar ch = this._deck_blue ['musician'].h\n\t\tvar colors = [\"rgba(200, 0, 0, 0.6)\", \"rgba(0, 0, 200, 0.6)\"]\n\n\t\tvar font_height = ch/3\n\t\tcanvas.style.font = this.context.font;\n\t\tcanvas.style.fontSize = `${font_height}px`;\n\t\tthis.context.font = canvas.style.font;\n\t\tthis.context.textAlign = \"center\";\n\t\tthis.context.textBaseline = \"middle\"; \n\n\t\tfor (let i = 0; i < this._scores.length; i +=1) {\n\n\t\t\tvar [x0, y0] = this.get_slot_coo (i, 0)\n\t\t\tvar [x1, y1] = this.get_slot_coo (i, 1)\n\t\t\tif (this._scores [i] > 0) {\n\t\t\t\t\n\t\t\t\tthis.context.fillStyle = colors [this._swap_color]\n\t\t\t\tthis.context.fillRect (x0 - cw/2, y0-cw/4, cw, cw/2);\n\t\t\t\tthis.context.fillStyle = \"white\";\n\t\t\t\tthis.context.fillText (`+${this._scores [i]}`, x0, y0); \t\n\n\t\t\t\tthis.context.fillStyle = \"rgba(0, 0, 0, 0.4)\"\n\t\t\t\tthis.context.fillRect (x1 - cw/2, y1-ch/2, cw, ch);\n\t\t\t}\n\t\t\tif (this._scores [i] < 0) {\n\t\t\t\t\n\t\t\t\tthis.context.fillStyle = colors [1 - this._swap_color]\n\t\t\t\tthis.context.fillRect (x1 - cw/2, y1-cw/4, cw, cw/2);\n\t\t\t\tthis.context.fillStyle = \"white\";\n\t\t\t\tthis.context.fillText (`+${-this._scores [i]}`, x1, y1); \t\n\n\t\t\t\tthis.context.fillStyle = \"rgba(0, 0, 0, 0.4)\"\n\t\t\t\tthis.context.fillRect (x0 - cw/2, y0-ch/2, cw, ch);\n\t\t\t}\n\t\t}\n\t}",
"function printBoard() {\n if ($(\".mdl-spinner\").hasClass(\"is-active\")) $(\".mdl-spinner\").removeClass(\"is-active\");\n $(\"#chessBoard\").show();\n size(pixelSize*1000,pixelSize*1000);\n scale(pixelSize,pixelSize); \n stroke(0);\n fill(#0000FF);\n textFont(loadFont(\"Meta-Bold.ttf\"));\n for(var y = 0, ypos=100; y < 8; y++, ypos+=100) {\n for(var x = 0, xpos=100; x < 8; x++, xpos+=100) {\n if((x+y)%2) fill(100); else fill(255); // select white or black squares\n rect(xpos,ypos,100,100); // print an empty square\n if (reverse) {\n if (gData.board[7-y][7-x]> -1)\n image(images[gData.board[7-y][7-x]], xpos, ypos ,100,100); // print the image of the piece based on the value\n } else {\n if (gData.board[y][x]> -1)\n image(images[gData.board[y][x]], xpos, ypos ,100,100); // print the image of the piece based on the value\n }\n }\n }\n $(\"#chessCanvas\").show();\n}",
"function draw() {\n CANVAS_CTX.clearRect(0, 0, BOARDER_WIDTH, BOARDER_HEIGHT);\n drawBoard();\n drawPoints();\n drawPacman();\n drawGhosts();\n drawApple();\n drawTimeBonus();\n\n $('#lblScore').val(score.toString());\n}",
"function scoreBoard() \n {\n ctx.font = \"60px Ariel\"\n ctx.fillStyle = \"White\"\n ctx.fillText(score1, 355,170);\n ctx.fillText(score2, 415,170);\n }",
"function drawCanvas() {\n\t\tdraw(context, drawer, colours, solver);\n\t\tsolver.callStateForItem(spanState);\n\t}",
"function setLeaderboard() {\n ctx.fillStyle = questionBarColor;\n ctx.fillRect(0 + 110, 0 + 180, 790, 65);\n ctx.font = \"36px cymraeg\";\n ctx.fillStyle = \"white\";\n setImages();\n ctx.fillText(\"You\", 0 + 160, 0 + 195);\n ctx.fillText(name, 0 + 550, 0 + 195);\n ctx.fillText(score, 0 + 825, 0 + 195);\n ctx.font = \"18px cymraeg\";\n for (i = 0; i < 10; i++) {\n if (i < 5) {\n ctx.fillText(names[i], 0 + 200, 0 + 315 + (60 * i));\n ctx.fillText(scores[i], 0 + 350, 0 + 315 + (60 * i));\n }\n else {\n imgPos = 300;\n ctx.fillText(names[i], 0 + 700, 0 + 315 + (60 * (i - 5)));\n ctx.fillText(scores[i], 0 + 850, 0 + 315 + (60 * (i - 5)));\n }\n }\n}",
"function drawFrame() {\n // Draw background and a border\n context.strokeStyle = \"#000000\";\n context.fillStyle = \"#d0d0d0\";\n context.fillRect(0, 0, canvas.width, canvas.height);\n context.fillStyle = \"#e8eaec\";\n context.fillRect(1, 1, canvas.width-2, canvas.height-2);\n \n // Character container\n context.fillStyle = \"#ffffff\";\n context.fillRect(400, 75, 300, 370);\n if (score < (requiredscore/2)) {\n context.drawImage(status1, 400, 75, 300, 370);\n } else {\n context.drawImage(status2, 400, 75, 300, 370);\n }\n \n // Score bar\n context.lineWidth = 3;\n context.fillStyle = \"#ffffff\";\n roundRect(context, 80, 75, 270, 35, 15, true, true);\n \n // Moves left container\n circle(context, 50, 93, 17);\n \n // Draw moves remaining\n context.fillStyle = \"#003300\";\n context.font = \"20px Verdana\";\n context.fillText(movecount, 37, 100);\n \n if (scorechange > 0) {\n // Draw a speech bubble\n drawBubble(context, 500, 125, 90, 30, 5);\n context.fillStyle = \"#003300\";\n context.font = \"10px Verdana\";\n if (!successquote) {\n if (scorechange > 1) {\n successquote = getRandomFromArray(greatquotes);\n } else {\n successquote = getRandomFromArray(goodquotes);\n }\n }\n context.fillText(successquote, 510, 140);\n }\n \n context.lineWidth = 1;\n context.fillStyle = \"#00b300\";\n context.strokeStyle = \"#00b300\";\n // Draw score\n if (score >= requiredscore) {\n roundRect(context, 83, 78, 264, 29, 11, true, true);\n } else if (score > 0) {\n var scorewidth = (score/requiredscore)*(270-6);\n roundOnLeftRect(context, 83, 78, scorewidth, 29, 11, true, true);\n }\n }",
"function draw() {\r\n\t$('#board').empty();\r\n\tfor (var i = 0; i < 4; i++) {\r\n\t\tfor (var j = 0; j < 4; j++) {\r\n\t\t\tif (grid[i][j] != 0) {\r\n\t\t\t\tvar divToAppend = \"<div class='cell'>\"+grid[i][j]+\"</div>\";\r\n\t\t\t\t$(\"#board\").append(divToAppend).show('slow');\r\n\t\t\t\tapplyBackground($('#board div:last-child'));\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\t$(\"#board\").append(\"<div class='cell'></div>\");\r\n\t\t}\r\n\t}\r\n\t$(\"#score\").empty().append(score);\r\n}",
"function updateScoreboard() {\n scoreboardGroup.clear(true, true);\n\n const scoreAsString = score.toString();\n if (scoreAsString.length === 1) {\n scoreboardGroup.create(assets.scene.width, 30, assets.scoreboard.base + score).setDepth(10);\n } else {\n let initialPosition = assets.scene.width - ((score.toString().length * assets.scoreboard.width) / 2);\n\n for (let i = 0; i < scoreAsString.length; i++) {\n scoreboardGroup.create(initialPosition, 30, assets.scoreboard.base + scoreAsString[i]).setDepth(10);\n initialPosition += assets.scoreboard.width;\n }\n }\n}",
"function render() {\n ctx.clearRect(0, 0, W, H);\n\n ctx.textAlign = \"center\";\n ctx.font = \"25px Arial\";\n ctx.strokeText(\"Your score is: \" + myScore, 150, 100); // show the score inside of the canvas \n\n ctx.strokeStyle = 'lime';\n for (let x = 0; x < COLS; ++x) {\n for (let y = 0; y < ROWS; ++y) {\n if (board[y][x]) {\n ctx.fillStyle = colors[board[y][x] - 1];\n drawBlock(x, y);\n }\n }\n }\n\n ctx.fillStyle = 'red';\n ctx.strokeStyle = 'lime';\n for (let y = 0; y < 4; ++y) {\n for (let x = 0; x < 4; ++x) {\n if (current[y][x]) {\n ctx.fillStyle = colors[current[y][x] - 1];\n drawBlock(currentX + x, currentY + y);\n }\n }\n }\n}",
"function drawBoard() {\n board = $(\"#board\");\n board.attr(\"width\", nCols * 30);\n board.attr(\"height\", nRows * 30);\n cnv = $(\"#board\").get(0);\n ctx = cnv.getContext(\"2d\");\n ctx.strokeRect(0, 0, nCols * 30, nRows * 30);\n for (var i = 1; i < nCols; i++) {\n ctx.beginPath();\n ctx.moveTo(i * 30, 0);\n ctx.lineTo(i * 30, nRows * 30);\n ctx.stroke();\n }\n for (var j = 1; j < nRows; j++) {\n ctx.beginPath();\n ctx.moveTo(0, j * 30);\n ctx.lineTo(nCols * 30, j * 30);\n ctx.stroke();\n }\n}",
"startWebcamGameWithScoreBoard(){\r\n this.session.put('game-event-type','webcam')\r\n $('#window').empty();\r\n $('#window').append(dom.getWebcamWindow());\r\n $('#human_score').append(`<label>`+this.localeModel.getCurrentLanguage('human')+`</label><label>`+this.gameModel.getHumanScore()+`</label>`);\r\n $('#computer_score').append(`<label>`+this.localeModel.getCurrentLanguage('computer')+`</label><label>`+this.gameModel.getComputerScore()+`</label>`);\r\n this.webcam.setupCAM();\r\n }",
"function drawCanvasGD(nnStatus) {\n\t//The grid is the tetris board\n\tlet grid = nnStatus.grid;\n\tlet colors = pieceColorsGD;\n\tlet upcomingShape = nnStatus.Upcoming_shape;\n\tlet score = nnStatus.Score;\n\t\n\t//Puts the general status in the top bar\n\tlet genStatus = document.getElementById(\"generalStats\");\n\tgenStatus.innerHTML = \"\";\n\tgenStatus.style.display = \"flex\";\n\tgenStatus.style.alignItems = \"center\";\n\tgenStatus.style.justifyContent = \"center\";\n\tlet temp = document.createElement(\"div\");\n\tlet aveOver = (roundCounter-1)%trainingWindow;\n\tif (aveOver === 0) {aveOver = trainingWindow;}\n\tif (roundCounter <= 1 && nnStatus[\"gameDone\"]) {aveOver = 1;}\n\ttemp.textContent = \"Score Average: \"+Math.floor(nnStatus.scoreTotal/(aveOver));\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.padding = \"0 0.5em 0 0.5em\";\n\ttemp.style.minWidth = \"10em\";\n\tgenStatus.appendChild(temp);\n\ttemp = document.createElement(\"div\");\n\ttemp.textContent = \"Loss: \"+\"N/A\";\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.padding = \"0 0.5em 0 0.5em\";\n\ttemp.style.borderLeft = \"1px solid white\";\n\ttemp.style.minWidth = \"10em\";\n\ttemp.id = \"Loss\";\n\tgenStatus.appendChild(temp);\n\ttemp = document.createElement(\"div\");\n\ttemp.textContent = \"Acc: \"+\"N/A\";\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.padding = \"0 0.5em 0 0.5em\";\n\ttemp.style.borderLeft = \"1px solid white\";\n\ttemp.style.minWidth = \"10em\";\n\ttemp.id = \"Acc\";\n\tgenStatus.appendChild(temp);\n\t\n\t//Draw the grid\n\tlet output = document.getElementById(\"output\");\n\toutput.innerHTML = \"\";\n\tfor (let i = 0; i < grid.length; i++) {\n\t\tlet lineDiv = document.createElement(\"div\");\n\t\tfor (let j = 0; j < grid[0].length; j++){\n\t\t\tlet para = document.createElement(\"div\");\n\t\t\tpara.textContent = grid[i][j];\n\t\t\tpara.style.textAlign = \"center\";\n\t\t\tpara.style.verticalAlign = \"middle\";\n\t\t\t\n\t\t\tpara.style.color = \"white\";\n\t\t\tpara.style.backgroundColor = colors[grid[i][j]];\n\t\t\t\n\t\t\tpara.style.display = \"inline-block\";\n\t\t\tpara.style.padding = \"0.65em 0.65em 0.65em 0.65em\";\n\t\t\tpara.style.boxSizing = \"border-box\";\n\t\t\tpara.style.border = \"1px solid white\";\n\t\t\tpara.style.width = \"1em\";\n\t\t\tpara.style.height = \"1em\";\n\t\t\tlineDiv.appendChild(para);\n\t\t}\n\t\tlineDiv.style.lineHeight = \"0px\";\n\t\toutput.appendChild(lineDiv);\n\t}\n\t\n\t//Draw the left side bar, the score side bar\n\tlet scoreDetails = document.getElementById(\"score\");\n\tscoreDetails.innerHTML = \"\";\n\tlet disScore = document.createElement(\"h2\");\n\tdisScore.textContent = \"Score: \" + Math.floor(score);\n\tdisScore.style.textAlign = \"center\";\n\tdisScore.style.marginTop = \"0\";\n\tscoreDetails.appendChild(disScore);\n\t\n\tlet disCurrent = document.createElement(\"h2\");\n\tdisCurrent.textContent = \"__Current__\";\n\tdisCurrent.style.marginBottom = \"0px\";\n\tdisCurrent.style.textAlign = \"center\";\n\tscoreDetails.appendChild(disCurrent);\n\tscoreDetails.appendChild(document.createElement(\"br\"));\n\t\n\tlet disCurShape = document.createElement(\"h2\");\n\tdisCurShape.textContent = piecesNamesGD[nnStatus.played_shape.piece];\n\tdisCurShape.style.textAlign = \"center\";\n\tdisCurShape.style.marginTop = \"0px\";\n\tdisCurShape.style.marginBottom = \"7px\";\n\tdisCurShape.style.marginLeft = \"auto\";\n\tdisCurShape.style.marginRight = \"auto\";\n\tdisCurShape.style.width = \"5em\";\n\tdisCurShape.style.color = \"white\";\n\tdisCurShape.style.backgroundColor = colors[nnStatus.played_shape.piece];\n\tdisCurShape.style.fontFamily = \"serif\";\n\tscoreDetails.appendChild(disCurShape);\n\t\n\tlet disUpcoming = document.createElement(\"h3\");\n\tdisUpcoming.textContent = \"__Upcoming__\";\n\tdisUpcoming.style.marginTop = \"0px\";\n\tdisUpcoming.style.marginBottom = \"0px\";\n\tdisUpcoming.style.textAlign = \"center\";\n\tscoreDetails.appendChild(disUpcoming);\n\tscoreDetails.appendChild(document.createElement(\"br\"));\n\tlet disUpShape = document.createElement(\"h3\");\n\tdisUpShape.textContent = piecesNamesGD[upcomingShape.piece];\n\tdisUpShape.style.textAlign = \"center\";\n\tdisUpShape.style.marginTop = \"0px\";\n\tdisUpShape.style.marginLeft = \"auto\";\n\tdisUpShape.style.marginRight = \"auto\";\n\tdisUpShape.style.width = \"5em\";\n\tdisUpShape.style.color = \"white\";\n\tdisUpShape.style.backgroundColor = colors[upcomingShape.piece];\n\tdisUpShape.style.fontFamily = \"serif\";\n\tscoreDetails.appendChild(disUpShape);\n\t\n\ttemp = document.createElement(\"div\");\n\ttemp.textContent = \"Number of Blocks Played: \"+nnStatus.movesTaken;\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.padding = \"0.5em 0 0.5em 0\";\n\ttemp.style.borderTop = \"1px solid white\";\n\tscoreDetails.appendChild(temp);\n\ttemp = document.createElement(\"div\");\n\ttemp.textContent = \"Number of Games Played: \"+(roundCounter);\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.padding = \"0.5em 0 0.5em 0\";\n\ttemp.style.borderTop = \"1px solid white\";\n\tscoreDetails.appendChild(temp);\n\ttemp = document.createElement(\"div\");\n\ttemp.textContent = \"Training: \"+(nnStatus.training || roundCounter%dreamTiming === 0 || roundCounter % 10 === 0 ? \"True\" : \"False\");\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.padding = \"0.5em 0 0.5em 0\";\n\ttemp.style.borderTop = \"1px solid white\";\n\ttemp.id = \"training\";\n\tscoreDetails.appendChild(temp);\n\t\n\t//Puts up the number of each move taken by the AI\n\tlet moveTotalsMiddle = nnStatus.moves.reduce(function(a,b){return a+b;});\n\tmoveTotalsMiddle = moveTotalsMiddle/nnStatus.moves.length;\n\ttemp = document.createElement(\"div\");\n\ttemp.textContent = \"Number of \\\"Key\\\" Presses: \";\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.padding = \"0.5em 0 0 0\";\n\ttemp.style.borderTop = \"1px solid white\";\n\tscoreDetails.appendChild(temp);\n\t\n\ttemp = document.createElement(\"div\");\n\tlet arrow = document.createElement(\"div\");\n\tarrow.textContent = nnStatus.moves[0];\n\tarrow.style.textAlign = \"center\";\n\tarrow.style.verticalAlign = \"middle\";\n\tarrow.style.color = \"indianred\";\n\tif (nnStatus.moves[0] >= moveTotalsMiddle) {arrow.style.backgroundColor = \"cornsilk\";} else{arrow.style.backgroundColor = \"black\";}\n\tarrow.style.display = \"inline-block\";\n\tarrow.style.marginLeft = \"auto\";\n\tarrow.style.marginRight = \"auto\";\n\tarrow.style.padding = \"0.65em 0.65em 0.65em 0.65em\";\n\tarrow.style.margin = \"0.4em 0.4em 0.4em 0.4em\";\n\tarrow.style.boxSizing = \"border-box\";\n\tarrow.style.border = \"1px solid white\";\n\tarrow.style.width = \"1em\";\n\tarrow.style.height = \"1em\";\n\ttemp.appendChild(arrow);\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.lineHeight = \"0px\";\n\tscoreDetails.appendChild(temp);\n\t\n\ttemp = document.createElement(\"div\");\n\tarrow = document.createElement(\"div\");\n\tarrow.textContent = nnStatus.moves[1];\n\tarrow.style.textAlign = \"center\";\n\tarrow.style.verticalAlign = \"middle\";\n\tarrow.style.color = \"indianred\";\n\tif (nnStatus.moves[1] >= moveTotalsMiddle) {arrow.style.backgroundColor = \"cornsilk\";} else{arrow.style.backgroundColor = \"black\";}\n\tarrow.style.display = \"inline-block\";\n\tarrow.style.padding = \"0.65em 0.65em 0.65em 0.65em\";\n\tarrow.style.margin = \"0.4em 0.6em 0.4em 0.6em\";\n\tarrow.style.boxSizing = \"border-box\";\n\tarrow.style.border = \"1px solid white\";\n\tarrow.style.width = \"1em\";\n\tarrow.style.height = \"1em\";\n\ttemp.appendChild(arrow);\n\t\n\tarrow = document.createElement(\"div\");\n\tarrow.textContent = nnStatus.moves[3];\n\tarrow.style.textAlign = \"center\";\n\tarrow.style.verticalAlign = \"middle\";\n\tarrow.style.color = \"indianred\";\n\tif (nnStatus.moves[3] >= moveTotalsMiddle) {arrow.style.backgroundColor = \"cornsilk\";} else{arrow.style.backgroundColor = \"black\";}\n\tarrow.style.backgroundColor = \"black\";\n\tarrow.style.display = \"inline-block\";\n\tarrow.style.padding = \"0.65em 0.65em 0.65em 0.65em\";\n\tarrow.style.margin = \"0.4em 0.6em 0.4em 0.6em\";\n\tarrow.style.boxSizing = \"border-box\";\n\tarrow.style.border = \"1px solid white\";\n\tarrow.style.width = \"1em\";\n\tarrow.style.height = \"1em\";\n\ttemp.appendChild(arrow);\n\t\n\tarrow = document.createElement(\"div\");\n\tarrow.textContent = nnStatus.moves[2];\n\tarrow.style.textAlign = \"center\";\n\tarrow.style.verticalAlign = \"middle\";\n\tarrow.style.color = \"indianred\";\n\tif (nnStatus.moves[2] >= moveTotalsMiddle) {arrow.style.backgroundColor = \"cornsilk\";} else{arrow.style.backgroundColor = \"black\";}\n\tarrow.style.display = \"inline-block\";\n\tarrow.style.padding = \"0.65em 0.65em 0.65em 0.65em\";\n\tarrow.style.margin = \"0.4em 0.6em 0.4em 0.6em\";\n\tarrow.style.boxSizing = \"border-box\";\n\tarrow.style.border = \"1px solid white\";\n\tarrow.style.width = \"1em\";\n\tarrow.style.height = \"1em\";\n\ttemp.appendChild(arrow);\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.lineHeight = \"0px\";\n\tscoreDetails.appendChild(temp);\n}",
"scoreboardDraw(scoreboardList) {\n let leaderboardRowsDiv = document.getElementById(\"leaderboard-rows\");\n const MAX_ROW_COUNT = 10;\n let rowNum = 0;\n\n // Update leaderboard\n for(var score of scoreboardList) {\n if(rowNum === MAX_ROW_COUNT) {\n break;\n }\n\n leaderboardRowsDiv.children[rowNum].children[0].innerHTML = (rowNum + 1) + \")\";\n leaderboardRowsDiv.children[rowNum].children[1].innerHTML = score.screenName;\n leaderboardRowsDiv.children[rowNum].children[2].innerHTML = score.kills;\n\n rowNum++;\n }\n\n // Clear old leaderboard rows\n for(; rowNum < MAX_ROW_COUNT; rowNum++) {\n leaderboardRowsDiv.children[rowNum].children[0].innerHTML = \"\";\n leaderboardRowsDiv.children[rowNum].children[1].innerHTML = \"\";\n leaderboardRowsDiv.children[rowNum].children[2].innerHTML = \"\";\n }\n }",
"function scoreboard() {\n\n var scoreboard = document.getElementById('scoreboard');\n scoreboard.innerHTML = `${score}pts.`\n if (score >= 150) {\n bugSpray();\n }\n }",
"function displayScore() {\n\ttheBoard.context.fillStyle = \"green\";\n\ttheBoard.context.font = \"bold 24px Times\";\n\ttheBoard.context.fillText(\"Score: \" + theBoard.score, 7, 22);\n\ttheBoard.context.fillText(\"Level: \" + theBoard.level, 700, 22);\n}",
"function showScore(){\n\tctx.fillStyle=\"black\";\n\tctx.fillRect(CANVAS_WIDTH-250, 10, 190, 40);\n\tctx.fillStyle = \"white\";\n\tctx.font = \"24px monospace\";\n\tctx.textAlign = \"left\";\n\tctx.fillText(\"score: \" + parseInt(score), CANVAS_WIDTH-250, 37);\n}",
"function initializeGameBoard() {\n\n var gameBody = document.getElementById(\"canvas\");\n\n gameBody.width = game.width;\n gameBody.height = game.height;\n gameBody.className = \"canvas\";\n\n ctx = gameBody.getContext(\"2d\");\n }",
"makeBoardOnScreen(){\n // Here we'll create a new Group\n for (var i=0; i < game.n; i++) {\n for (var j=0; j < game.n; j ++) {\n //initialize 2D array board to be empty strings\n for (var k=0; k < game.n; k++) {\n for (var l=0; l < game.n; l++) {\n //create square\n var square = game.addSprite(game.startingX + i*game.squareSize*3 + k*game.squareSize, game.startingY + j * game.squareSize*3 + l*game.squareSize, 'square');\n //allow square to respond to input\n square.inputEnabled = true\n //indices used for the 4D array\n square.bigXindex = i\n square.bigYindex = j\n square.littleXindex = k\n square.littleYindex = l\n //make have placePiece be called when a square is clicked\n square.events.onInputDown.add(game.placePiece, game)\n }\n }\n }\n }\n game.drawLines()\n }",
"function drawScoreBoard(){\r\n context.font = \"Bold 25px Courier New\";\r\n context.fillStyle = \"#000000\";\r\n scoreBoard = cars.slice();\r\n scoreBoard.sort(function(a, b){\r\n return b.score - a.score;\r\n });\r\n for (var i = 0; i < 5; i++) {\r\n if (i > scoreBoard.length -1 ){break;}\r\n if (scoreBoard[i] == null){break;}\r\n var j = i+1\r\n context.fillText(j + \":\" + scoreBoard[i].name+ \": \"+scoreBoard[i].score, 0, 25 + (i*25));\r\n }\r\n}",
"display(){\n if(this.lives != 0){\n var newcolor = \"#\";\n var x;\n for(var i=1;i<7;i++){\n x = parseInt(this.color[i],16)\n x += 2;\n if(x>15)\n x = 15;\n newcolor += x.toString(16);\n }\n var ctx = this.gameboard.disp.getContext(\"2d\");\n ctx.beginPath();\n ctx.fillStyle = newcolor;\n ctx.fillRect(this.posx, this.posy, this.sizex, this.sizey);\n ctx.stroke();\n ctx.closePath();\n ctx = this.gameboard.disp.getContext(\"2d\");\n ctx.beginPath();\n ctx.fillStyle = this.color;\n ctx.fillRect(this.posx + this.sizex/10, this.posy + this.sizey/10,this.sizex/10*8,this.sizey/10*8);\n ctx.stroke();\n ctx.closePath();\n }\n }",
"displayBoard(tileSize) {\n ctx.strokeStyle = this.boardColor;\n ctx.lineWidth = 10;\n ctx.strokeRect(this.boardBorderLeft, this.boardBorderTop, this.boardBorderSize, this.boardBorderSize);\n\n ctx.lineWidth = 4;\n }"
] | [
"0.73607624",
"0.70869297",
"0.70739704",
"0.70584774",
"0.6974996",
"0.6938553",
"0.6934178",
"0.6922656",
"0.6910067",
"0.6897704",
"0.6890096",
"0.68763286",
"0.68348974",
"0.67919546",
"0.6740421",
"0.6738843",
"0.6728717",
"0.6710097",
"0.66862345",
"0.66760695",
"0.66330504",
"0.66289467",
"0.66129965",
"0.660527",
"0.6601143",
"0.6600232",
"0.6594036",
"0.6590119",
"0.65895677",
"0.65792286"
] | 0.82207555 | 0 |
! SCOREBOARD BUTTONS This is the function that runs to build scoreboard buttons | function buildScoreboardButtons(){
$('#buttonCancel').click(function(){
playSound('soundSelect');
goScorePage('');
});
$('#buttonSubmit').click(function(){
playSound('soundSelect');
var typeString = 'quizgame'
if(categoryPage){
typeString = category_arr[categoryNum];
}
submitUserScore(typeString, playerData.score);
});
scoreBackTxt.cursor = "pointer";
scoreBackTxt.addEventListener("click", function(evt) {
playSound('soundSelect');
goScorePage('');
});
buttonReplay.cursor = "pointer";
buttonReplay.addEventListener("click", function(evt) {
playSound('soundSelect');
if(categoryPage){
goPage('category');
}else{
goPage('game');
}
});
saveButton.cursor = "pointer";
saveButton.addEventListener("click", function(evt) {
playSound('soundSelect');
goScorePage('submit');
});
scoreboardButton.cursor = "pointer";
scoreboardButton.addEventListener("click", function(evt) {
playSound('soundSelect');
goScorePage('scoreboard');
var typeString = 'quizgame'
if(categoryPage){
typeString = category_arr[categoryNum];
}
loadScoreboard(typeString);
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createButtons() {\n // When the A button is pressed, add the current frame\n // from the video with a label of \"rock\" to the classifier\n buttonA = select('#addClassRock');\n buttonA.mousePressed(function() {\n addExample('Rock');\n });\n\n // When the B button is pressed, add the current frame\n // from the video with a label of \"paper\" to the classifier\n buttonB = select('#addClassPaper');\n buttonB.mousePressed(function() {\n addExample('Paper');\n });\n\n // When the C button is pressed, add the current frame\n // from the video with a label of \"scissor\" to the classifier\n buttonC = select('#addClassScissor');\n buttonC.mousePressed(function() {\n addExample('Scissor');\n });\n\n // Reset buttons\n resetBtnA = select('#resetRock');\n resetBtnA.mousePressed(function() {\n clearLabel('Rock');\n });\n\t\n resetBtnB = select('#resetPaper');\n resetBtnB.mousePressed(function() {\n clearLabel('Paper');\n });\n\t\n resetBtnC = select('#resetScissor');\n resetBtnC.mousePressed(function() {\n clearLabel('Scissor');\n });\n\n // Predict button\n buttonPredict = select('#buttonPredict');\n buttonPredict.mousePressed(classify);\n\n // Clear all classes button\n buttonClearAll = select('#clearAll');\n buttonClearAll.mousePressed(clearAllLabels);\n}",
"function buildScoreBoardCanvas(){\n\tif(!displayScoreBoard){\n\t\treturn;\t\n\t}\n\t\n\t//buttons\n\tresultContainer.removeChild(replayButton);\n\t\n\tbuttonReplay = new createjs.Bitmap(loader.getResult('iconReplay'));\n\tcenterReg(buttonReplay);\n\tcreateHitarea(buttonReplay);\n\tsaveButton = new createjs.Bitmap(loader.getResult('iconSave'));\n\tcenterReg(saveButton);\n\tcreateHitarea(saveButton);\n\tscoreboardButton = new createjs.Bitmap(loader.getResult('iconScoreboard'));\n\tcenterReg(scoreboardButton);\n\tcreateHitarea(scoreboardButton);\n\t\n\tresultContainer.addChild(buttonReplay, saveButton, scoreboardButton);\n\t\n\t//scoreboard\n\tscoreBoardContainer = new createjs.Container();\n\tbgScoreboard = new createjs.Bitmap(loader.getResult('bgScoreboard'));\n\t\n\tscoreTitle = new createjs.Text();\n\tscoreTitle.font = \"80px bariol_regularregular\";\n\tscoreTitle.color = \"#ffffff\";\n\tscoreTitle.text = scoreBoardTitle;\n\tscoreTitle.textAlign = \"center\";\n\tscoreTitle.textBaseline='alphabetic';\n\tscoreTitle.x = canvasW/2;\n\tscoreTitle.y = canvasH/100*14;\n\t\n\tscoreBackTxt = new createjs.Text();\n\tscoreBackTxt.font = \"50px bariol_regularregular\";\n\tscoreBackTxt.color = \"#ffffff\";\n\tscoreBackTxt.text = scoreBackText;\n\tscoreBackTxt.textAlign = \"center\";\n\tscoreBackTxt.textBaseline='alphabetic';\n\tscoreBackTxt.x = canvasW/2;\n\tscoreBackTxt.y = canvasH/100*95;\n\tscoreBackTxt.hitArea = new createjs.Shape(new createjs.Graphics().beginFill(\"#000\").drawRect(-200, -30, 400, 40));\n\tscoreBoardContainer.addChild(bgScoreboard, scoreTitle, scoreBackTxt);\n\t\n\tvar scoreStartY = canvasH/100*23;\n\tvar scoreSpanceY = 49.5;\n\tfor(scoreNum=0;scoreNum<=10;scoreNum++){\n\t\tfor(scoreColNum=0;scoreColNum<score_arr.length;scoreColNum++){\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum] = new createjs.Text();\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].font = \"35px bariol_regularregular\";\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].color = \"#ffffff\";\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].textAlign = score_arr[scoreColNum].align;\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].textBaseline='alphabetic';\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].x = canvasW/100 * score_arr[scoreColNum].percentX;\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].y = scoreStartY;\n\t\t\t\n\t\t\tif(scoreColNum == 0){\n\t\t\t\t//position\n\t\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].text = scoreRank_arr[scoreNum-1];\t\n\t\t\t}\n\t\t\t\n\t\t\tif(scoreNum == 0){\n\t\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].text = score_arr[scoreColNum].col;\t\n\t\t\t}\n\t\t\t\n\t\t\tscoreBoardContainer.addChild($.scoreList[scoreNum+'_'+scoreColNum]);\n\t\t}\n\t\tscoreStartY += scoreSpanceY;\n\t}\n\t\n\tscoreBoardContainer.visible = false;\n\tcanvasContainer.addChild(scoreBoardContainer);\n\t\n\t$.get('submit.html', function(data){\n\t\t$('#canvasHolder').append(data);\n\t\tbuildScoreboardButtons();\n\t\ttoggleSaveButton(true);\n\t\tresizeScore();\n\n\t});\n}",
"function newButtonFunction () {\n score = [0,0];\n activePlayer = 0;\n roundScore = 0;\n document.getElementById (\"score-0\").textContent = 0; \n document.getElementById (\"score-1\").textContent = 0;\n document.getElementById (\"current-0\").textContent = 0;\n document.getElementById (\"current-1\").textContent = 0;\n document.getElementById (\"name-0\").textContent = \"Player 1\";\n document.getElementById (\"name-1\").textContent = \"Player 2\";\n document.querySelector(\".player-0-panel\").classList.remove(\"active\");\n document.querySelector(\".player-1-panel\").classList.remove(\"active\");\n document.querySelector(\".player-0-panel\").classList.remove(\"winner\");\n document.querySelector(\".player-1-panel\").classList.remove(\"winner\");\n document.querySelector(\".player-0-panel\").classList.add(\"active\");\n hide ();\n document.querySelector(\".btn-roll\").style.display = \"block\";\n document.querySelector(\".btn-hold\").style.display = \"block\";\n gamePlaying = true;\n previousThrow = 0;\n // winningScore = prompt (\"Enter the score limit !\");\n }",
"function gameButtonsLogic() {\n $(\"#bluegem\").click(function () {\n totalScore += bluegem;\n $(\"#butt1\").text(totalScore);\n gameLogic();\n \n });\n\n $(\"#glovegem\").on(\"click\", function () {\n totalScore += glovegem;\n $(\"#butt1\").text(totalScore);\n gameLogic();\n \n });\n\n $(\"#orangegem\").on(\"click\", function () {\n totalScore += orangegem;\n $(\"#butt1\").text(totalScore);\n gameLogic();\n \n });\n\n $(\"#guitargem\").on(\"click\", function () {\n totalScore += guitargem;\n $(\"#butt1\").text(totalScore);\n gameLogic();\n \n })}",
"function loadGame(){\r\n\t\t\t\t\tcountClick=0;\r\n\t\t\t \tdocument.getElementById(\"sr\").innerHTML = \"Game On !!\";\r\n\t\t\t \tdocument.getElementById(\"winner\").innerHTML = \"A Beautiful Mind\";\r\n\t\t \t\tvar buttonHtml = \"\";\r\n\t\t \t\tfor (i = 0; i <9; i++) { \r\n\t\t \t\t\tarr.length=0;// clear data of previous game\r\n\t\t\t\t\t\tif(i==2 || i==5)\r\n\t\t\t\t\t\t\tbuttonHtml=buttonHtml + \"<button class=\\\"button\\\" \"+\"id=\\\"\" +i+\"\\\" onclick=\\\"calcWinner(this.id)\\\" value=\\\"\\\"></button><br> \" ;\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tbuttonHtml=buttonHtml + \"<button class=\\\"button\\\" \"+\"id=\\\"\" +i+\"\\\" onclick=\\\"calcWinner(this.id)\\\" value=\\\"\\\"></button> \" ;\r\n\t\t\t\t \t}//for;\r\n\t\t\t \tdocument.getElementById(\"b\").innerHTML = buttonHtml ;\r\n\t\t\t\t\tdocument.getElementById(\"b\").style.background = \"grey\";\r\n\r\n}// function loadGame",
"function renderButtons() {\n\n $(\"#game-input\").val(\"\");\n\n $(\"#games-viewer\").empty();\n\n for (let i = 0; i < topics.length; i++) {\n var newBtn = $(\"<button>\");\n newBtn.text(topics[i]);\n newBtn.attr(\"data-name\", topics[i]);\n newBtn.addClass(\"gameBtn\");\n $(\"#games-viewer\").append(newBtn);\n }\n\n } /// renderButtons();",
"function initBtns(){\n okbtn = {\n x: (width - s_buttons.Ok.width)/2,\n y : height/1.8,\n width : s_buttons.Ok.width,\n height :s_buttons.Ok.height\n };\n \n startbtn = {\n x: (width - s_buttons.Score.width)/2,\n y : height/2.5,\n width : s_buttons.Score.width,\n height :s_buttons.Score.height\n };\n \n scorebtn = {\n x: (width - s_buttons.Score.width)/2,\n y : height/2,\n width : s_buttons.Score.width,\n height :s_buttons.Score.height\n };\n \n menubtn = {\n x:(width - 2*s_buttons.Menu.width),\n y : height/1.8,\n width : s_buttons.Menu.width,\n height :s_buttons.Menu.height\n };\n \n resetbtn = {\n x: (s_buttons.Reset.width),\n y : height/1.8,\n width : s_buttons.Reset.width,\n height :s_buttons.Reset.height\n };\n}",
"function renderLeaderboardButtons() {\n ctx.globalAlpha = 1;\n button.forEach(function (question) {\n ctx.fillStyle = question.colour;\n ctx.fillRect(question.left, question.top, question.width, question.height);\n ctx.font = \"36px cymraeg\";\n ctx.fillStyle = question.text_color;\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"top\";\n ctx.fillText(question.text, question.left + question.width / 2, question.top + (question.height / 4));\n });\n ctx.font = \"18px cymraeg\";\n ctx.fillText(\"For help or questions, contact [email protected]\", canvas.width / 2, canvas.height - 35);\n}",
"function addButtonActions() {\r\n var startButton = document.getElementById('button-start');\r\n startButton.addEventListener(\"click\", function () {\r\n startButton.disabled = true;\r\n showQuestionsPage();\r\n });\r\n document.getElementById('button-information').addEventListener(\"click\", function () {\r\n document.getElementById(\"information\").classList.toggle(\"active\");\r\n });\r\n document.getElementById(\"next\").addEventListener(\"click\", function () {\r\n nextQuestion();\r\n });\r\n document.getElementById(\"prev\").addEventListener(\"click\", function () {\r\n prevQuestion();\r\n });\r\n document.getElementById(\"inlogcheck\").addEventListener(\"click\", function () {\r\n checkStudent();\r\n });\r\n document.getElementById(\"particles\").addEventListener(\"click\", function () {\r\n particles();\r\n });\r\n document.getElementById(\"twitter\").addEventListener(\"click\", function () {\r\n var strtwt = \"Wow, ik heb zojuist \" + correctAnswered + \" punten van de 10 gescoord in \" + minutes + \":\" + seconds + \" op een quiz die over HTML, CSS en JavaScript gaat!\";\r\n window.open(\"https://twitter.com/intent/tweet?text=\" + encodeURI(strtwt));\r\n });\r\n document.getElementById(\"scoreboard\").addEventListener(\"click\", function () {\r\n document.getElementById(\"latestScore\").classList.toggle(\"active\");\r\n document.getElementById(\"topScore\").classList.toggle(\"active\");\r\n if (document.getElementById(\"latestScore\").classList.contains(\"active\")) {\r\n document.getElementById(\"scoreboard\").textContent = \"Bekijk top score\";\r\n } else {\r\n document.getElementById(\"scoreboard\").textContent = \"Bekijk recente score\";\r\n }\r\n });\r\n document.body.addEventListener('keydown', function (event) {\r\n keyboardFunctionality(this, event);\r\n });\r\n for (let i = 0; i < 10; i++) {\r\n var div = document.createElement(\"div\");\r\n div.className = \"block\";\r\n document.getElementById(\"shownAnswers\").appendChild(div);\r\n }\r\n}",
"function topicButtons() {\n $(\"#buttons\").empty();\n $(\"#topicsCard\").hide();\n for (var i = 0; i < topics.length; i++) {\n var b = $(\"<button class='btn'>\");\n b.addClass(\"eightiesButton\");\n b.attr(\"data-name\", topics[i]);\n b.text(topics[i]);\n if (b.attr(\"data-click\"))\n b.attr(\"data-click\")\n $(\"#buttons\").append(b);\n $(\"#topic_input\").val(\"80's\");\n }\n }",
"function game_board(){\r\n var i;\r\n var j;\r\n var row = 11;\r\n var col = 11;\r\n var board1 = [];\r\n var board3 = [];\r\n var leftCounter = 0;\r\n var rightCounter = 0;\r\n var middleCounter = 0;\r\n //var btns1 = document.createElement(\"button\");\r\n //var btns2 = document.createElement(\"button\");\r\n\r\n\r\n for(i = 0; i <= row; i++){\r\n //board[i] = [];\r\n for(j = 0; j <= col; j++){\r\n // board[i][j] = btns;\r\n var btns1 = document.createElement(\"button\");\r\n var btns3 = document.createElement(\"button\");\r\n btns1.setAttribute(\"class\", \"btns\");\r\n btns1.setAttribute(\"id\", \"btnLeft_\" + leftCounter);\r\n //btns1.setAttribute(\"onclick\", \"board_index()\")\r\n leftCounter++;\r\n btns3.setAttribute(\"class\", \"btns\");\r\n btns3.setAttribute(\"id\", \"btnRight_\" + rightCounter);\r\n // btns3.setAttribute(\"onclick\", \"board_index()\");\r\n rightCounter++;\r\n board1.push(btns1);\r\n board3.push(btns3);\r\n document.getElementById(\"div3\").append(btns1);\r\n document.getElementById(\"div4\").append(btns3);\r\n //document.getElementById(\"div3\").append(board1);\r\n }//End of for\r\n }//End of for\r\n\r\n for(i = 0; i < 3; i++){\r\n for(j = 0; j < 2; j++){\r\n var btns2 = document.createElement(\"button\");\r\n btns2.setAttribute(\"class\", \"btns2\");\r\n //btns2.setAttribute(\"name\", \"btns2\");\r\n btns2.setAttribute(\"id\", \"btnMiddle_\" + middleCounter);\r\n middleCounter++;\r\n // btns2.setAttribute(\"onclick\", \"board_index(button_clicked)\");\r\n document.getElementById(\"div5\").append(btns2);\r\n }//End of for\r\n }//End of for\r\n\r\n var eles = document.getElementsByClassName(\"btns\");\r\n var eles2 = document.getElementsByClassName(\"btns2\");\r\n Array.prototype.forEach.call(eles,function(ele){\r\n //ele.onclick = runMe(ele);\r\n });\r\n Array.prototype.forEach.call(eles2,function(ele){\r\n // ele.onclick = runMe(ele);\r\n }); \r\n\r\n var event_counter = 13; //Camn only go up to 13\r\n var leftEvents = 0;\r\n var rightEvents = 0; \r\n var a = 0;\r\n\r\n //Test Code \r\n //document.getElementById(\"btnLeft_1\").setAttribute(\"onclick\", \"baptismEvent()\"); \r\n //document.getElementById(\"btnLeft_1\").style.backgroundColor = \"green\"; \r\n\r\n\r\n for(i = 0; i < event_counter; i++){\r\n var num = Math.floor(Math.random() * 143) + 0;\r\n\r\n\r\n if(leftEvents < 7){\r\n document.getElementById(\"btnLeft_\" + num).setAttribute(\"name\", events[a]);\r\n //alert(events[a]);\r\n document.getElementById(\"btnLeft_\" + num).style.backgroundColor = \"green\";\r\n leftEvents++;\r\n a++;\r\n }else{\r\n document.getElementById(\"btnRight_\" + num).setAttribute(\"name\", events[a]);\r\n document.getElementById(\"btnRight_\" + num).style.backgroundColor = \"green\";\r\n a++;\r\n //}\r\n }//End of for\r\n\r\n //document.getElementById(\"btnLeft_121\").setAttribute(\"name\", \"baptismEvent\"); \r\n //document.getElementById(\"btnLeft_121\").style.backgroundColor = \"green\";\r\n }//End of for \r\n\r\n playerSpawn();\r\n\r\n var eles = document.getElementsByClassName(\"btns\");\r\n var eles2 = document.getElementsByClassName(\"btns2\");\r\n Array.prototype.forEach.call(eles,function(ele){\r\n ele.onclick = playerMove(ele);\r\n });\r\n\r\n}",
"function updateScore (input) {\n scoreText.innerText = score;\n pointsRemainingText.innerText = updateRemaining();\n let buttons = document.getElementById(\"buttonGroup\").children;\n for (let i=0; i<buttons.length; i++){\n buttons[i].innerText=balls[i].quantity;\n }\n updateBar();\n}",
"function buttonCreate() {\n // Delete previous buttons to avoid duplicates\n $(\"#buttons-view\").empty();\n $(\"#game-input\").val(\"\");\n\n // Looping through the array of games\n for (var i = 0; i < topics.length; i++) {\n\n // Create a button for each item in the array\n var a = $(\"<button>\");\n // Adding the class 'game' to the button\n a.addClass(\"game\");\n // Adding a data-attribute (this is how the data is passed from the button to the queryURL)\n a.attr(\"data-name\", topics[i]);\n // Providing the button text\n a.text(topics[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n\n }\n }",
"function generateScoreboard() {\n let winnerText = document.getElementById(\"winner\");\n winnerText.innerText = `The winning opinion is ${marker.count[MessageType.CLICK_LEFT] > marker.count[MessageType.CLICK_RIGHT] ? firstOpt : secondOpt}!`\n\n let table = document.getElementById(\"scoreboard\");\n let thead = table.createTHead();\n let row = thead.insertRow();\n for (let title of ['Name', firstOpt, secondOpt]) {\n let th = document.createElement(\"th\");\n let text = document.createTextNode(title);\n th.appendChild(text);\n row.appendChild(th);\n }\n\n let players = Object.values(clicker_counts).sort((first, second) => (\n (second[MessageType.CLICK_LEFT] + second[MessageType.CLICK_RIGHT]) -\n (first[MessageType.CLICK_LEFT] + first[MessageType.CLICK_RIGHT])\n ))\n for (let player of players) {\n row = table.insertRow();\n if (player[MessageType.CLICK_LEFT] > player[MessageType.CLICK_RIGHT]) {\n row.className = 'table-info'\n } else if (player[MessageType.CLICK_LEFT] < player[MessageType.CLICK_RIGHT]) {\n row.className = 'table-warning'\n }\n\n\n for (let key of ['name', MessageType.CLICK_LEFT, MessageType.CLICK_RIGHT]) {\n let cell = row.insertCell();\n let text = document.createTextNode(player[key]);\n cell.appendChild(text);\n }\n }\n}",
"function randNum() {\n\n scoreTarget = Math.floor((Math.random() * (120 - 19)) + 19);\n\n buttonTally = 0;\n\n// Need to link C1, C2, C3, C4 to generate buttonValues\n\n button1 = Math.floor((Math.random() * (12 - 1)) + 1);\n button2 = Math.floor((Math.random() * (12 - 1)) + 1);\n button3 = Math.floor((Math.random() * (12 - 1)) + 1);\n button4 = Math.floor((Math.random() * (12 - 1)) + 1);\n\n $(\"#scoreTarget\").html(\"Critical Star Heading: \"+scoreTarget);\n $(\"#buttonTally\").html(buttonTally);\t\n $(\"#wins\").html(\"Wins: \"+wins);\n $(\"#losses\").html(\"Losses: \"+losses);\n}",
"function updateButtons() {\n let moveList = [\n \"ones\",\n \"twos\",\n \"threes\",\n \"fours\",\n \"fives\",\n \"sixes\",\n \"three_of_a_kind\",\n \"four_of_a_kind\",\n \"full_house\",\n \"small_straight\",\n \"large_straight\",\n \"chance\",\n \"yacht_z\",\n ];\n\n moveList.forEach((move) => {\n let scoreval = score(move);\n let button = document.querySelector(`#${move} button`);\n if (button) {\n if (validateMove(move)) {\n button.innerHTML = scoreval;\n } else {\n button.innerHTML = 0;\n }\n }\n });\n}",
"function set_buttons() {\r\n\t\r\n\t/* All the buttons needed */\r\n\tvar actions = $(\"#actions\");\r\n\tvar levels = $(\"#levels\");\r\n\tvar playButton = $(\"<button id='play'> Play </button>\");\r\n\tvar pauseButton = $(\"<button id='pause'> Pause </button>\");\r\n\tvar saveButton = $(\"<button id='save'> Save </button>\");\r\n\tvar loadButton = $(\"<button id='load'> Load </button>\");\r\n\tvar menuButton = $(\"<button id='menu'> Menu </button>\");\r\n\tvar rockButton = $(\"<button id='rock'> Rock </button>\");\r\n\tvar normalButton = $(\"<button id='normal'> Normal </button>\");\r\n\tvar skinsButton = $(\"<button id='skins'> Skins </button>\");\r\n\tvar standardSkinButton = $(\"<button id='standardSkin'> standard </button>\");\r\n\tvar cancelButton = $(\"<button id='cancel'> Cancel </button>\");\r\n\tvar restartButton = $(\"<button id='restart'> Restart </button>\");\r\n\tvar level1Button = $(\"<button id='level1'> Level 1 </button>\");\r\n\tvar level2Button = $(\"<button id='level2'> Level 2 </button>\");\r\n\t\r\n\t/* Appending them all */\r\n\tactions.append(playButton);\r\n\tactions.append(pauseButton);\r\n\tactions.append(saveButton);\r\n\tactions.append(loadButton);\r\n\tactions.append(menuButton);\r\n\tactions.append(rockButton);\r\n\tactions.append(normalButton);\r\n\tactions.append(skinsButton);\r\n\tactions.append(standardSkinButton);\r\n\tactions.append(cancelButton);\r\n\tactions.append(restartButton);\r\n\tlevels.append(level1Button);\r\n\tlevels.append(level2Button);\r\n\t\r\n\t/* can't be seen yet */\r\n\tpauseButton.hide();\r\n\tsaveButton.hide();\r\n\tmenuButton.hide();\r\n\tnormalButton.hide();\r\n\trestartButton.hide();\r\n\tcancelButton.hide();\r\n\tstandardSkinButton.hide();\r\n\tlevel1Button.hide();\r\n\tlevel2Button.hide();\r\n\t\r\n\t/* Function launched when the play button is clicked on */\r\n\tplayButton.click(function(event){\r\n\t\tplayButton.hide();\r\n\t\tloadButton.hide();\r\n\t\t$(\"#formulary\").hide();\r\n\t\t$(\"#enter\").hide();\r\n\t\t$(\"#score\").hide();\r\n\t\tmenuButton.show();\r\n\t\tlevel1Button.show();\r\n\t\tlevel2Button.show();\r\n\t\tskinsButton.hide();\r\n\t\trockButton.hide();\r\n\t\tnormalButton.hide();\r\n\t\t$(\".deleteSav\").hide();\r\n\t});\r\n\t\r\n\t/* Function launched when the pause button is clicked on */\r\n\tpauseButton.click(function(event) {\r\n\t\tGame.pause();\r\n\t\tif(Game.isPlaying == false)\r\n\t\t\tpauseButton.text(\"Play\");\r\n\t\telse\r\n\t\t\tpauseButton.text(\"Pause\");\r\n\t});\r\n\t\r\n\t/* Function launched when the save button is clicked on */\r\n\tsaveButton.click(function(event) {\r\n\t\t/* simulating a click on the pause button */\r\n\t\tif(Game.isPlaying == true)\r\n\t\t\t$(\"#pause\").trigger(\"click\"); \r\n\t\t\r\n\t\task_user_name();\r\n\t});\r\n\t\r\n\t/* function launched when the load button is clicked on */\r\n\tloadButton.click(function(event) {\r\n\t\task_load_name();\r\n\t});\r\n\t\r\n\t/* function launched when the menu button is clicked on */\r\n\tmenuButton.click(function(event){\r\n\t\r\n\t\twindow.cancelAnimationFrame(Game.id); /* need to stop the animation cuz it will start twice otherwise */\r\n\t\treset_MainSquare_pos();\r\n\t\tstop_keydown(); /* don't want the players to jump in the menu animation */\r\n\t\tGame.mobile.isDead = false; /* if the Mainsquare died in a level */\r\n\t\tGame.score = 0;\r\n\t\tGame.levelArrayCursor = 0;\r\n\t\t$(\"#score\").hide();\r\n\t\t$(\"#youWon\").remove(); /* remove win message */\r\n\t\t\r\n\t\t/* stopping music if any is playing */\r\n\t\tif($(\"#\"+Musics[Game.level].id).length != 0)\r\n\t\t\t$(\"#\"+Musics[Game.level].id).trigger(\"pause\");\r\n\t\t\r\n\t\t/* updating display */\r\n\t\t$(\"h1[id='large']\").show();\r\n\t\tsaveButton.hide();\r\n\t\tmenuButton.hide();\r\n\t\trestartButton.hide();\r\n\t\tlevel1Button.hide();\r\n\t\tlevel2Button.hide();\r\n\t\tplayButton.show();\r\n\t\tpauseButton.hide();\r\n\t\tloadButton.show();\r\n\t\tskinsButton.show();\r\n\t\t$(\".deleteSav\").hide();\r\n\t\t\r\n\t\tif(Game.mode == NORMAL)\r\n\t\t\trockButton.show();\r\n\t\telse\r\n\t\t\tnormalButton.show();\r\n\t\t\t\r\n\t\tskinsButton.show();\r\n\t\t\r\n\t\tdraw_menu_background();\r\n\t});\r\n\t\r\n\t/* function launched when the RockPossible button is clicked on */\r\n\trockButton.click(function(event){\r\n\t\r\n\t\tGame.mode = ROCK;\r\n\t\tCurrentSkin = SkinsR[0];\r\n\t\tGame.background = new Framework(\"#000000\", \"#ff0000\", \"white\");\r\n\t\trockButton.hide();\r\n\t\tnormalButton.show();\r\n\t\t$(\"#large\").text(\"Rockpossible Game\");\r\n\t});\r\n\t\r\n\t/* function launched when the normal button is clicked on */\r\n\tnormalButton.click(function(event){\r\n\t\r\n\t\tGame.mode = NORMAL;\r\n\t\tCurrentSkin = \"original\";\r\n\t\tGame.background = new Framework(\"#003333\", \"#00CCCC\", \"white\");\r\n\t\tnormalButton.hide();\r\n\t\trockButton.show();\r\n\t\t$(\"#large\").text(\"Rockpossible Game\");\r\n\t});\r\n\t\r\n\t/* function launched when the skins button is clicked on */\r\n\tskinsButton.click(function(event){\r\n\t\r\n\t\twindow.cancelAnimationFrame(Game.id);\r\n\t\tCtx.clearRect ( 0 , 0 ,Canvas.width, Canvas.height);\r\n\t\tcancelButton.show();\r\n\t\tplayButton.hide();\r\n\t\tloadButton.hide();\r\n\t\tskinsButton.hide();\r\n\t\t\r\n\t\tif(Game.mode == NORMAL) {\r\n\t\t\tfor(var i=0;i<SkinsN.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"N\").show();\r\n\t\t\t}\r\n\t\t\tGame.background = new Framework(\"#003333\", \"#00CCCC\", \"white\");\r\n\t\t\tGame.background.draw();\r\n\t\t\trockButton.hide();\r\n\t\t\tstandardSkinButton.show();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tfor(var i=0;i<SkinsR.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"R\").show();\r\n\t\t\t}\r\n\t\t\tGame.background = new Framework(\"#000000\", \"#ff0000\", \"white\");\r\n\t\t\tGame.background.draw();\r\n\t\t\tnormalButton.hide();\r\n\t\t}\r\n\t});\t\r\n\t\r\n\tstandardSkinButton.click(function(event){\r\n\t\r\n\t\treset_MainSquare_pos();\r\n\t\tstop_keydown(); \r\n\t\tGame.mobile.isDead = false; \r\n\t\t\r\n\t\tCurrentSkin = \"original\";\r\n\t\t\r\n\t\tcancelButton.hide();\r\n\t\tplayButton.show();\r\n\t\tloadButton.show();\r\n\t\tskinsButton.show();\r\n\t\tstandardSkinButton.hide();\r\n\t\t\r\n\t\tif(Game.mode == NORMAL) {\r\n\t\t\tfor(var i=0;i<SkinsN.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"N\").hide();\r\n\t\t\t}\r\n\t\t\trockButton.show();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tfor(var i=0;i<SkinsR.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"R\").hide();\r\n\t\t\t}\r\n\t\t\tnormalButton.show();\r\n\t\t}\r\n\t\tdraw_menu_background();\r\n\t});\r\n\t\r\n\t/* function launched when the cancel button is clicked on */\r\n\tcancelButton.click(function(event){\r\n\t\r\n\t\treset_MainSquare_pos();\r\n\t\tstop_keydown(); /* don't want the players to jump in the menu animation */\r\n\t\tGame.mobile.isDead = false; /* if the Mainsquare died in a level */\r\n\t\t\r\n\t\tcancelButton.hide();\r\n\t\tplayButton.show();\r\n\t\tloadButton.show();\r\n\t\tskinsButton.show();\r\n\t\t$(\".deleteSav\").hide();\r\n\t\t$(\".loading\").hide();\r\n\t\t$(\"#enter\").hide();\r\n\t\tstandardSkinButton.hide();\r\n\t\t\r\n\t\tif(Game.mode == NORMAL) {\r\n\t\t\tfor(var i=0;i<SkinsN.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"N\").hide();\r\n\t\t\t}\r\n\t\t\trockButton.show();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tfor(var i=0;i<SkinsR.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"R\").hide();\r\n\t\t\t}\r\n\t\t\tnormalButton.show();\r\n\t\t}\r\n\t\tdraw_menu_background();\r\n\t});\t\r\n\t\r\n\t/* function launched when the restart button is clicked on */\r\n\trestartButton.click(function(event){\r\n\t\r\n\t\twindow.cancelAnimationFrame(Game.id); \r\n\t\treset_MainSquare_pos();\r\n\t\tGame.mobile.isDead = false; \r\n\t\tGame.levelArrayCursor = 0;\r\n\t\t$(\"#youWon\").remove();\r\n\t\tif($(\"#\"+Musics[Game.level].id).length != 0)\r\n\t\t\t$(\"#\"+Musics[Game.level].id).trigger(\"pause\");\r\n\t\tGame.score = 0;\r\n\t\tplay(Game.level, 0);\r\n\t\tinit_keydown();\r\n\t\t\r\n\t});\r\n\t\r\n\t/* function launched when the levels button are clicked on */\t\r\n\tlevel1Button.click(function(event){\r\n\t\twindow.cancelAnimationFrame(Game.id);\r\n\t\treset_MainSquare_pos();\r\n\t\t$(\"h1[id='large']\").hide();\r\n\t\tlevel1Button.hide();\r\n\t\tlevel2Button.hide();\r\n\t\trockButton.hide();\r\n\t\tnormalButton.hide();\r\n\t\tskinsButton.hide();\r\n\t\tsaveButton.show();\r\n\t\tpauseButton.show();\r\n\t\trestartButton.show();\r\n\t\t\r\n\t\tif($(\"#\"+Musics[Game.level].id).length != 0)\r\n\t\t\t$(\"#\"+Musics[Game.level].id).trigger(\"pause\");\r\n\t\t\r\n\t\tplay(1, 0);\r\n\t});\r\n\t\r\n\tlevel2Button.click(function(event){\r\n\t\twindow.cancelAnimationFrame(Game.id);\r\n\t\treset_MainSquare_pos();\r\n\t\t$(\"h1[id='large']\").hide();\r\n\t\tlevel1Button.hide();\r\n\t\tlevel2Button.hide();\r\n\t\trockButton.hide();\r\n\t\tnormalButton.hide();\r\n\t\tskinsButton.hide();\r\n\t\tsaveButton.show();\r\n\t\tpauseButton.show();\r\n\t\trestartButton.show();\r\n\t\t\r\n\t\tif($(\"#\"+Musics[Game.level].id).length != 0)\r\n\t\t\t$(\"#\"+Musics[0].id).trigger(\"pause\");\r\n\t\t\r\n\t\tplay(2, 0);\r\n\t});\r\n}",
"function buildGameButton(){\n\tbuttonStart.cursor = \"pointer\";\n\tbuttonStart.addEventListener(\"click\", function(evt) {\n\t\tplaySound('soundClick');\n\t\tgoPage('select');\n\t});\n\t\n\tbuttonContinue.cursor = \"pointer\";\n\tbuttonContinue.addEventListener(\"click\", function(evt) {\n\t\tplaySound('soundClick');\n\t\tgoPage('select');\n\t});\n\t\n\tbuttonFacebook.cursor = \"pointer\";\n\tbuttonFacebook.addEventListener(\"click\", function(evt) {\n\t\tshare('facebook');\n\t});\n\tbuttonTwitter.cursor = \"pointer\";\n\tbuttonTwitter.addEventListener(\"click\", function(evt) {\n\t\tshare('twitter');\n\t});\n\tbuttonWhatsapp.cursor = \"pointer\";\n\tbuttonWhatsapp.addEventListener(\"click\", function(evt) {\n\t\tshare('whatsapp');\n\t});\n\t\n\tbuttonSoundOff.cursor = \"pointer\";\n\tbuttonSoundOff.addEventListener(\"click\", function(evt) {\n\t\ttoggleGameMute(true);\n\t});\n\t\n\tbuttonSoundOn.cursor = \"pointer\";\n\tbuttonSoundOn.addEventListener(\"click\", function(evt) {\n\t\ttoggleGameMute(false);\n\t});\n\t\n\tbuttonFullscreen.cursor = \"pointer\";\n\tbuttonFullscreen.addEventListener(\"click\", function(evt) {\n\t\ttoggleFullScreen();\n\t});\n\t\n\tbuttonExit.cursor = \"pointer\";\n\tbuttonExit.addEventListener(\"click\", function(evt) {\n\t\tif(!$.editor.enable){\n\t\t\ttoggleConfirm(true);\n\t\t}\n\t});\n\t\n\tbuttonSettings.cursor = \"pointer\";\n\tbuttonSettings.addEventListener(\"click\", function(evt) {\n\t\ttoggleOption();\n\t});\n\t\n\tbuttonConfirm.cursor = \"pointer\";\n\tbuttonConfirm.addEventListener(\"click\", function(evt) {\n\t\ttoggleConfirm(false);\n\t\tstopGame(true);\n\t\tgoPage('main');\n\t\ttoggleOption();\n\t});\n\t\n\tbuttonCancel.cursor = \"pointer\";\n\tbuttonCancel.addEventListener(\"click\", function(evt) {\n\t\ttoggleConfirm(false);\n\t});\n\t\n\tbuttonTutContinue.cursor = \"pointer\";\n\tbuttonTutContinue.addEventListener(\"click\", function(evt) {\n\t\ttoggleTutorial(false);\n\t});\n}",
"function setupButton() {\n for(var i = 0; i < diffButton.length; i++) {\n diffButton[i].classList.remove(\"selected\");\n }\n this.classList.add(\"selected\");\n this.textContent === \"Easy\" ? numberOfSquares = 3 : numberOfSquares = 6;\n gameReset();\n}",
"function createButtons() {\n buttonA = select('#addClassRock');\n buttonA.mousePressed(function() {\n addExample('Thor');\n });\n\n buttonB = select('#addClassPaper');\n buttonB.mousePressed(function() {\n addExample('Loki');\n });\n\n buttonC = select('#addClassScissor');\n buttonC.mousePressed(function() {\n addExample('Odin');\n });\n\n // Reset buttons\n resetBtnA = select('#resetRock');\n resetBtnA.mousePressed(function() {\n clearLabel('Thor');\n });\n\n resetBtnB = select('#resetPaper');\n resetBtnB.mousePressed(function() {\n clearLabel('Loki');\n });\n\n resetBtnC = select('#resetScissor');\n resetBtnC.mousePressed(function() {\n clearLabel('Odin');\n });\n\n // Predict button\n buttonPredict = select('#buttonPredict');\n buttonPredict.mousePressed(classify);\n\n // Clear all classes button\n buttonClearAll = select('#clearAll');\n buttonClearAll.mousePressed(clearAllLabels);\n\n // Load saved classifier dataset\n buttonSetData = select('#load');\n buttonSetData.mousePressed(loadMyKNN);\n\n // Get classifier dataset\n buttonGetData = select('#save');\n buttonGetData.mousePressed(saveMyKNN);\n}",
"startGame() {\r\n // Add value attr to qwerty button elements\r\n const keyButtons = document.querySelectorAll(`button.key`);\r\n for (let i = 0; i < keyButtons.length; i++) {\r\n keyButtons[i].value = keyButtons[i].textContent;\r\n }\r\n // hide screen overlay\r\n const overlay = document.querySelector('#overlay');\r\n overlay.style.display = 'none';\r\n // call getRandomPhrase() to get phrase from array, store in activePhrase\r\n this.activePhrase = this.getRandomPhrase();\r\n // add the phrase to gameboard w/ addPhraseToDisplay()\r\n this.activePhrase.addPhraseToDisplay();\r\n\r\n }",
"function setupButtons(){\n\tfor (let i = 0; i<modeButtons.length; i++){\n\t\tmodeButtons[i].addEventListener(\"click\",function(){\n\t\t\tfor(let j = 0; j<modeButtons.length; j++){\n\t\t\t\tmodeButtons[j].classList.remove(\"selected\");\n\t\t\t}\n\t\t\tthis.classList.add(\"selected\");\n\t\t\tthis.textContent === \"Easy\" ? numSquares = 3 : numSquares = 6;\n\t\t\treset();\n\t\t});\n\t}\n\t//add listener to the reset button\n\tresetButton.addEventListener(\"click\", function(){\n\t\treset();\n\t});\n}",
"function renderButtons() {\n\n $(\"#game-view\").empty();\n\n // create for loop for array topic games button which will append\n for (var i = 0; i < games.length; i++) {\n\n var a = $(\"<button>\");\n a.addClass(\"game\");\n a.attr(\"data-name\", games[i]);\n a.text(games[i]);\n $(\"#game-view\").append(a);\n }\n}",
"function displayScore(){\n \n removeQuestion();\n\n // create jQuery html objects\n var startTrivia = $('<button class=\"btn btn-primary\" id=\"start_game\">Start</button>');\n var allDone = $(\"<div>\");\n var correctAns = $(\"<div>\");\n var incorrectAns = $(\"<div>\");\n var unAns = $(\"<div>\");\n var wrongAns = (questionCount - unanswered - correctAnswers);\n var message = $(\"<div>\");\n var lineBreak = $(\"<br>\");\n // wrongAnswer\n\n // Create score card\n $(allDone).text(\"All Done, here's how you did!\")\n $(correctAns).text(\"Correct Answers: \" + correctAnswers);\n $(incorrectAns).text(\"Incorrect Answers: \" + wrongAns);\n $(unAns).text(\"Unanswered: \" + unanswered);\n\n $(message).text('\"Select Start if you want to restart Trivia game\"');\n\n // load score card\n $(loadContent).append(allDone);\n $(loadContent).append(correctAns);\n $(loadContent).append(incorrectAns);\n $(loadContent).append(unAns);\n \n // create line break\n $(loadContent).append(lineBreak);\n $(loadContent).append(lineBreak);\n\n // load Restart game message\n $(loadContent).append(message);\n $(loadContent).append(startTrivia);\n\n }",
"function scoreYes() {\n\n if (idFirstButton == 0) {\n score = score - 100;\n } else if (idFirstButton == 2) {\n score = score - 200;\n } else if (idFirstButton == 4) {\n score = score - 250;\n } else if (idFirstButton == 6) {\n score = score - 300;\n } else if (idFirstButton == 8) {\n score = score - 100;\n } else if (idFirstButton == 10) {\n score = score - 400;\n } else if (idFirstButton == 12) {\n score = score - 200;\n } else if (idFirstButton == 14) {\n score = score - 500;\n } else if (idFirstButton == 16) {\n score = score - 1000;\n } else if (idFirstButton == 18) {\n score = score - 0;\n } else if (idFirstButton == 20) {\n score = score - 0;\n } else if (idFirstButton == 22) {\n score = score - 1500;\n } else if (idFirstButton == 24) {\n score = score - 500;\n } else if (idFirstButton == 26) {\n score = score - 100;\n } else if (idFirstButton == 28) {\n score = score - 100;\n } else if (idFirstButton == 30) {\n score = score - 1500;\n } else if (idFirstButton == 32) {\n score = score - 500;\n alert(\"Quelle indignité ...\");\n } else if (idFirstButton == 34) {\n score = score - 500;\n } else if (idFirstButton == 36) {\n score = score - 3000;\n alert(\"C'EST GAME !\");\n } else if (idFirstButton == 38) {\n score = score - 5000;\n \n }\n\n console.log(score);\n\n }",
"function handleNFLscoreboardClicks() {\n\t\t\t\t$('#js-nfl-scorecard-button').on('click', function (e) {\n\t\t\t\t\tconst queryTarget = $('#js-nfl-scorecard').find('js-nfl-scorecard');;\n\t\t\t\t\tconst query = queryTarget.val();\n\t\t\t\t\tgetNFLscoreboardDataFromApi();\n\t\t\t\t\t$('#js-nfl-scorecard').removeClass('hidden');\n\t\t\t\t\t$('#js-render-nfl-scorecard').removeClass('hidden');\n\t\t\t\t\t//All the elements listed below need to be hidden to render above.\n\t\t\t\t\t$('#js-home-page').addClass('hidden');\n\t\t\t\t\t$('#js-nfl-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-render-nfl-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-nfl-standing').addClass('hidden');\n\t\t\t\t\t$('#js-render-nfl-standing').addClass('hidden');\n\t\t\t\t\t$('#js-mlb-scorecard').addClass('hidden');\n\t\t\t\t\t$('#js-render-mlb-scorecard').addClass('hidden');\n\t\t\t\t\t$('#js-mlb-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-render-mlb-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-mlb-standing').addClass('hidden');\n\t\t\t\t\t$('#js-render-mlb-standing').addClass('hidden');\n\t\t\t\t\t$('#js-nba-scorecard').addClass('hidden');\n\t\t\t\t\t$('#js-render-nba-scorecard').addClass('hidden');\n\t\t\t\t\t$('#js-nba-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-render-nba-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-nba-standing').addClass('hidden');\n\t\t\t\t\t$('#js-render-nba-standing').addClass('hidden');\n\t\t\t\t\t$('#js-nhl-scorecard').addClass('hidden');\n\t\t\t\t\t$('#js-render-nhl-scorecard').addClass('hidden');\n\t\t\t\t\t$('#js-nhl-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-render-nhl-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-nhl-standing').addClass('hidden');\n\t\t\t\t\t$('#js-render-nhl-standing').addClass('hidden');\n\t\t\t\t\tconsole.log(\"handleNFLscorecardClicks() ran\");\n\t\t\t\t});\n\t\t\t}",
"function updateScoreboard() {\n scoreboardGroup.clear(true, true);\n\n const scoreAsString = score.toString();\n if (scoreAsString.length === 1) {\n scoreboardGroup.create(assets.scene.width, 30, assets.scoreboard.base + score).setDepth(10);\n } else {\n let initialPosition = assets.scene.width - ((score.toString().length * assets.scoreboard.width) / 2);\n\n for (let i = 0; i < scoreAsString.length; i++) {\n scoreboardGroup.create(initialPosition, 30, assets.scoreboard.base + scoreAsString[i]).setDepth(10);\n initialPosition += assets.scoreboard.width;\n }\n }\n}",
"function scoreboard(){\n $('#timeLeft').empty();\n $('#message').empty();\n $('#correctedAnswer').empty();\n $('#gif').hide();\n $(\"#gifCaption\").hide();\n \n $('#finalMessage').html(messages.finished);\n $('#correctAnswers').html(\"Correct Answers: \" + correctAnswer);\n $('#incorrectAnswers').html(\"Incorrect Answers: \" + incorrectAnswer);\n $('#unanswered').html(\"Unanswered: \" + unanswered);\n $('#startOverBtn').addClass('reset');\n $('#startOverBtn').show();\n $('#startOverBtn').html(\"PLAY AGAIN\");\n }",
"function startGame() {\n \n // randomizing the variables upon game start //\n \n blueButton = Math.floor(Math.random() * 8) + 1;\n\n redButton = Math.floor(Math.random() * 13) + 1;\n \n yellowButton = Math.floor(Math.random() * 15) + 1;\n \n greenButton = Math.floor(Math.random() * 20) + 1;\n \n computerPick = Math.floor(Math.random() * 101) + 19;\n \n $(\"#random-area\").text(computerPick);\n \n $(\"#score-area\").text(userScore);\n \n }",
"function startGame(){\n\n\t\twins = 0;\n\t\tlosses = 0;\n\t\ttotalScore = 0;\n\t\tbuttonValues = [];\n\t\trandNum = 0;\n\n\n\t\tfunction reset(){\n\n\t\t\trandNum = Math.floor(Math.random()*101) + 19;\n\n\t\t\ttotalScore = 0;\n\n\t\t\tfor (var i = 0; i < 4; i++){\n\n\t\t\t\tvar randomVal = Math.floor(Math.random()*12)+1;\n\t\t\t\tbuttonValues[i] = randomVal;\n\n\t\t\t}\n\n\t\t}; //reset function ends here\n\n\t\tfunction display(){\n\n\t\t\t$(\"#number\").html(randNum);\n\t\t\t$(\"#winsLosses\").html(\"<p>Wins: \" + wins + \"</p><br>\"\n\t\t\t\t+ \"<p>Losses: \" + losses + \"</p>\");\n\t\t\t$(\"#totalScore\").html(totalScore);\n\n\t\t}; //display function ends here\n\n\t\tfunction checkScore(){\n\t\t\tif (totalScore === randNum){\n\t\t\twins++;\n\t\t\treset();\n\t\t\t}\n\t\t\telse if (totalScore > randNum){\n\t\t\tlosses++;\n\t\t\treset();\n\t\t\t}\n\t\t\t\n\t\t}\n\n\n\n\t//===================================\n\t\t\n\t//Code game play below\n\t\treset();\n\n\t\tdisplay();\n\t\t\n\t\t$(\"#diamond\").on(\"click\", function(){\n\t\t\tvar diamondValue = buttonValues[0];\n\t\t\ttotalScore += diamondValue;\n\t\t\tcheckScore();\n\t\t\tdisplay();\n\t\t\tconsole.log(buttonValues);\n\t\t\t}); //diamond button coding ends here\n\n\t\t$(\"#diaspore\").on(\"click\", function(){\n\t\t\tvar diasporeValue = buttonValues[1];\n\t\t\ttotalScore += diasporeValue;\n\t\t\tcheckScore();\n\t\t\tdisplay();\n\t\t\tconsole.log(buttonValues);\n\t\t}); //diamond button coding ends here\n\n\t\t$(\"#sapphire\").on(\"click\", function(){\n\t\t\tvar sapphireValue = buttonValues[2];\n\t\t\ttotalScore += sapphireValue;\n\t\t\tcheckScore();\n\t\t\tdisplay();\n\t\t\tconsole.log(buttonValues);\n\t\t}); //diamond button coding ends here\n\n\t\t$(\"#gem\").on(\"click\", function(){\n\t\t\tvar gemValue = buttonValues[3];\n\t\t\ttotalScore += gemValue;\n\t\t\tcheckScore();\n\t\t\tdisplay();\n\t\t\tconsole.log(buttonValues);\n\t\t}); //diamond button coding ends here\n\n\n\t}"
] | [
"0.69475615",
"0.6863367",
"0.6840834",
"0.6805191",
"0.68026936",
"0.67381406",
"0.672422",
"0.6720168",
"0.6617027",
"0.6563274",
"0.65039325",
"0.64585024",
"0.64482474",
"0.64416",
"0.64400285",
"0.64362717",
"0.64337057",
"0.6413039",
"0.6410319",
"0.63975495",
"0.63880676",
"0.6362265",
"0.6359806",
"0.6359594",
"0.6348714",
"0.6342044",
"0.63362825",
"0.6330548",
"0.6328432",
"0.63260764"
] | 0.80036443 | 0 |
! RESIZE SCORE This is the function that runs to resize score | function resizeScore(){
$('.fontLink').each(function(index, element) {
$(this).css('font-size', Math.round(Number($(this).attr('data-fontsize'))*scalePercent));
});
$('#scoreHolder').css('width',stageW*scalePercent);
$('#scoreHolder').css('height',stageH*scalePercent);
$('#scoreHolder').css('left', (offset.left/2));
$('#scoreHolder').css('top', (offset.top/2));
$('#scoreHolder .scoreInnerContent').css('width',contentW*scalePercent);
$('#scoreHolder .scoreInnerContent').css('height',contentH*scalePercent);
var spaceTop = (stageH - contentH)/2;
var spaceLeft = (stageW - contentW)/2;
$('#scoreHolder .scoreInnerContent').css('left', spaceLeft*scalePercent);
$('#scoreHolder .scoreInnerContent').css('top', spaceTop*scalePercent);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateScoreboard() {\n scoreboardGroup.clear(true, true);\n\n const scoreAsString = score.toString();\n if (scoreAsString.length === 1) {\n scoreboardGroup.create(assets.scene.width, 30, assets.scoreboard.base + score).setDepth(10);\n } else {\n let initialPosition = assets.scene.width - ((score.toString().length * assets.scoreboard.width) / 2);\n\n for (let i = 0; i < scoreAsString.length; i++) {\n scoreboardGroup.create(initialPosition, 30, assets.scoreboard.base + scoreAsString[i]).setDepth(10);\n initialPosition += assets.scoreboard.width;\n }\n }\n}",
"function enlargeSnake(){\n\tif(snakeBody.length < 100){\t// temporary restriction for development reasons\n\t\t//var newBodyPart = Object.assign({}, snakeBody[snakeBody.length-1]);\n\t\tvar newBodyPart = Object.assign({}, snake);\n\t\tsnakeBody.push(newBodyPart);\n\t}\n\t\n\tscore += 100;\n\tvar scoreCounter = document.getElementById(\"score-keeper\").innerHTML = \"Score = \" + score;\n}",
"function resetScores()\n{\n // Hier coderen we de code om de scores te resetten\n // @TODO: Scores resetten\n}",
"resetScore() {\n this.score = INITIAL_SCORE;\n }",
"function updateScores(){\n currentScore = currentGame.length;\n if (bestScore <= 0){\n //update best score from storage.\n var prevScore = scorestorage.getRecord(KEY_BEST_SCORE); \n if (prevScore){\n bestScore = prevScore;\n }\n scoreboard.updateBestScore(bestScore );\n }\n if (bestScore < currentScore ){\n scoreboard.updateBestScore(bestScore = currentScore );\n scorestorage.setRecord(KEY_BEST_SCORE, bestScore);\n }\n scoreboard.updateCurrentScore(currentScore);\n }",
"updateScore() {\n if(Dashboard.candyMachted.length) {\n this.score += 1;\n this.levelUp();\n this.scoreUpdateView();\n Dashboard.candyMachted.pop();\n }\n }",
"resetGhostEatenScoring() {\n this.ghostEatenScore = 100;\n }",
"function resize () {\n console.log(\"acc resize\");\n }",
"function resetScores() {\n for (var i = 0; i < self.gameBoard.boxes.length; i++) {\n self.gameBoard.boxes[i].isX = false;\n self.gameBoard.boxes[i].isO = false;\n self.gameBoard.$save(self.gameBoard.boxes[i]);\n }\n\n //resets the game status for the new game\n self.gameBoard.gameStatus = \"Waiting for players\";\n self.gameBoard.p1 = 0;\n self.gameBoard.p2 = 0;\n self.gameBoard.tie = 0;\n self.gameBoard.turn = 0;\n self.gameBoard.player1.isHere = false;\n self.gameBoard.player1.myName = \"Fire\";\n self.gameBoard.player2.isHere = false;\n self.gameBoard.player2.myName = \"Ice\";\n self.gameBoard.displayBoard = false;\n self.gameBoard.$save(self.gameBoard)\n self.waiting = false;\n \n }",
"function resetScores(){\n scores.redPieceCount = 12;\n scores.blackPieceCount = 12\n scores.blackPiecesTaken = 0;\n scores.redPiecesTaken = 0;\n scores.winner = null;\n}",
"function resetScore() {\n DATA['score'] = 0;\n}",
"function resetScores () {\n STORE.questionNumber = 0;\n STORE.score = 0;\n}",
"function clearScore() {\n\tscoreCorrect = 0;\n\tscoreSkipped = 0;\n\tupdateScore();\n}",
"rescale(scale) {\n this.scale = scale;\n }",
"function refreshScoreBoxes() {\n\td3.select(\"#scoreboard\").selectAll(\"*\").remove();\n\tscore_grid = d3.select(\"#scoreboard\")\n\t.append(\"svg\")\n\t.attr(\"width\",sGridSize.w+\"px\")\n\t.attr(\"height\",sGridSize.h+\"px\")\n\t;\n\tdrawScorebox3(score_grid, getGameData(), score_tile_size);\n}",
"resetScoreArray(score){\n\t\tthis.setState({\n\t\t\tscoreArr: score\n\t\t},()=>{\n\t\t\tthis.forceUpdate();\n\t\t});\n\t}",
"updateScore() {\n\t\tthis.score++;\n\t\tthis.drawScore();\n\t\tif (this.score >= this.highestScore) {\n\t\t\tthis.highestScore = this.score;\n\t\t\tlocalStorage.setItem(STORAGE_KEY, this.highestScore);\n\t\t}\n\t}",
"function resize() {\n getNewSize();\n rmPaint();\n}",
"_updateScore() {\n\t\tthis._$scoreBoard.textContent= this._score+'';\n\t}",
"reset(){\n if(this.score>localStorage.getItem('bestScore')){\n localStorage.setItem('bestScore',this.score);\n BEST_SCORE.innerHTML = `Best: ${this.score}`;\n }\n this.initialize();\n for(let i = this.snake.length - 1; i > 0; i--){\n if(i >= this.startingCellsNumber){\n this.snake[i].parentNode.removeChild(this.snake[i]);\n this.snake.pop();\n }\n else{\n this.snake[i].style.top = `0px`;\n this.snake[i].style.left = `${this.snakeHead.offsetLeft - (this.cellWidth*i)}px`;\n }\n }\n\n }",
"function ResizeTop50() {\n AlterRatingHeights(top50ArcadeRatings, \"\", \"rating\");\n AlterRatingHeights(top50PinballRatings, \"\", \"rating\");\n}",
"function updateScore(newScoreArray) {\n for (let i = 0; i < 13; i++) {\n if (!currentPlayer.selectedScores[i]) {\n currentPlayer.eachScore[i] = newScoreArray[i];\n currentPlayer.scoreDisplay[i].textContent = currentPlayer.eachScore[i];\n }\n }\n}",
"resetScore() {\n this.gameNotes.resetScores()\n }",
"function scoreReset() {\n guessesRemaining = 9;\n guesses = [];\n}",
"function updateScore(){\r\n if(ffScoreBugFix>10 && currentTube.topRect.getRight() < characters[0].x){\r\n if(!isHit){\r\n score++;\r\n }\r\n isHit = false;\r\n var index = tubes.indexOf(currentTube) + 1;\r\n index %= tubes.length;\r\n currentTube = tubes[index];\r\n ffScoreBugFix = 0;\r\n }\r\n ffScoreBugFix++;\r\n }",
"function updatescore() {\n if (player.y< 50) {\n score ++;\n scoreDiv.innerText = `Your score = ${score}`;\n //reset player position\n player.x =200;\n player.y=400;\n //remove enimies and create new ones\n allEnemies=[];\n generateEnemies(++n);\n }\n}",
"function resetScores() {\n guessLeft = 10;\n guessSoFar = [];\n}",
"function toggleSize(){\n var elem = document.getElementsByClassName('board')[0];\n while (elem.firstChild) {\n elem.removeChild(elem.firstChild);\n }\n if(board_size === 3){\n board_size = 4;\n } else if(board_size === 4){\n board_size = 6;\n } else if(board_size === 6){\n board_size = 3;\n }\n resetBoard();\n}",
"resetScore() {\n // prevent a pass by reference\n this.gameStats = JSON.parse(JSON.stringify( baseScore ));\n }",
"function resize() {}"
] | [
"0.6918159",
"0.66235214",
"0.6431632",
"0.6410671",
"0.63819176",
"0.6295828",
"0.6294661",
"0.62264955",
"0.6119847",
"0.6098467",
"0.60890585",
"0.6087336",
"0.60847205",
"0.6015591",
"0.600963",
"0.59730434",
"0.59582454",
"0.595048",
"0.5935952",
"0.5930025",
"0.59141195",
"0.590596",
"0.586477",
"0.5863606",
"0.58515877",
"0.5846111",
"0.58445907",
"0.5841645",
"0.5821411",
"0.58166766"
] | 0.75561607 | 0 |
sensei: pjfranzini Write a function that accepts a square matrix (N x N 2D array) and returns the determinant of the matrix. How to take the determinant of a matrix it is simplest to start with the smallest cases: A 1x1 matrix |a| has determinant a. A 2x2 matrix [ [a, b], [c, d] ] or |a b| |c d| has determinant: ad bc. The determinant of an n x n sized matrix is calculated by reducing the problem to the calculation of the determinants of n matrices ofn1 x n1 size. For the 3x3 case, [ [a, b, c], [d, e, f], [g, h, i] ] or |a b c| |d e f| |g h i| the determinant is: a det(a_minor) b det(b_minor) + c det(c_minor) where det(a_minor) refers to taking the determinant of the 2x2 matrix created by crossing out the row and column in which the element a occurs: | | | e f| | h i| Note the alternation of signs. The determinant of larger matrices are calculated analogously, e.g. if M is a 4x4 matrix with first row [a, b, c, d], then: det(M) = a det(a_minor) b det(b_minor) + c det(c_minor) d det(d_minor) | function determinant(m) {
switch (m.length) {
//handles empty matrix
case 0: return 1;
//exit condition && handles singleton matrix
case 1: return m[0][0];
default:
//detrmnnt will build array of terms to be combined into determinant
//ex. a*det(a_minor) - b*det(b_minor)...
let detrmnnt = []
//pos controls alternation of terms ('+' or '-')
for (let i = 0, pos = 1; i < m.length; i++, pos *= -1) {
//adds term, ex. +/- a * det(a_minor)
detrmnnt.push(pos * (m[0][i] * determinant(nMinor(m, i))))
}
return detrmnnt.reduce((accu, elem) => accu + elem)
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function determinant(m) {\n if (m.length == 1)\n return m[0][0];\n function calc(matrix) {\n if (matrix.length == 2)\n return matrix[0][0] * matrix[1][1] - matrix[1][0] * matrix[0][1];\n let res = 0, sign = 1;\n for (let i = 0; i < matrix[0].length; i++) {\n let temp = [];\n for (let j = 1; j < matrix.length; j++) {\n temp.push([]);\n for (let k = 0; k < matrix[0].length; k++) {\n if (k != i) temp[j-1].push(matrix[j][k]);\n }\n }\n res += matrix[0][i] * sign * calc(temp.slice());\n sign *= -1;\n }\n return res;\n }\n return calc(m);\n }",
"function det(matrix) {\n\n //Matrix is 2x2, Calculate determinant\n if (matrix.length == 2) {\n let a = matrix[0][0];\n let b = matrix[0][1];\n let c = matrix[1][0];\n let d = matrix[1][1];\n return a*d - c*b;\n }\n\n const row = 0;\n\n //Matrix is 3x3 or greater; recursively reduce to 2x2\n let totalDet = 0;\n for (let column = 0; column < matrix.length; column += 1) {\n //Generate cofactor\n let cofactor = getCofactorFrom(matrix, row, column);\n //Calculate determinant for that cofactor\n let subDet = det(cofactor);\n let sum = matrix[row][column] * subDet;\n //Alternating, add and subtract the sum\n let negative = (column+1) % 2 == 0;\n if (negative) { sum *= -1; }\n totalDet += sum;\n }\n\n return totalDet;\n}",
"function determinant(matrix) {\r\n\t\t// Check if the matrix is a 2x2\r\n\t\tif (matrix.rows === 2 && matrix.cols === 2) {\r\n\t\t\treturn (matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0]);\r\n\t\t}\r\n\t\t// Otherwise, reduce the size by 1 and recurse\r\n\t\telse {\r\n\t\t\tvar det = 0;\r\n\t\t\tfor (var i = 0; i < matrix.cols; i++) {\r\n\t\t\t\tdet += matrix[0][i] * (i % 2 === 0 ? 1 : -1) * determinant(matrix._submatrix(0, i));\r\n\t\t\t}\r\n\r\n\t\t\treturn det;\r\n\t\t}\r\n\t}",
"function determinantOfMatrix(matrix1, n) {\r\n var det = 0; // Initialize result\r\n // Only one element in matrix\r\n if (n == 1) {\r\n return matrix1[0][0];\r\n }\r\n //Temp array to store cofactors\r\n var temp = new Array(n);\r\n for (var i = 0; i < n; i++) {\r\n temp[i] = new Array(n);\r\n }\r\n var sign = 1;\r\n for (var f = 0; f < n; f++) {\r\n // Getting Cofactor of mat[0][f]\r\n getCofactor(matrix1, temp, 0, f, n);\r\n det += sign * matrix1[0][f] * determinantOfMatrix(temp, n - 1);\r\n // terms are to be added with alternate sign\r\n sign = -sign;\r\n }\r\n return det;\r\n}",
"static calculate_determinant(Matrix, n) {\n\t\tvar s;\n\t\tvar det = 0;\n\t\tif (Matrix.length == 1) { //bottom case of the recursive function\n\t\t\treturn Matrix[0][0];\n\t\t}\n\t\tif (Matrix.length == 2) {\n\t\t\tdet = Matrix[0][0] * Matrix[1][1] - Matrix[1][0] * Matrix[0][1];\n\t\t\treturn det;\n\t\t}\n\t\tfor (var i = 0; i < n; i++) {\n\t\t\t//creates smaller matrix- values not in same row, column\n\t\t\tvar smaller = new Array(Matrix.length - 1);\n\t\t\tfor (var h = 0; h < smaller.length; h++) {\n\t\t\t\tsmaller[h] = new Array(Matrix.length - 1);\n\t\t\t}\n\t\t\tfor (var a = 1; a < Matrix.length; a++) {\n\t\t\t\tfor (var b = 0; b < Matrix.length; b++) {\n\t\t\t\t\tif (b < i) {\n\t\t\t\t\t\tsmaller[a - 1][b] = Matrix[a][b];\n\t\t\t\t\t} else if (b > i) {\n\t\t\t\t\t\tsmaller[a - 1][b - 1] = Matrix[a][b];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (i % 2 == 0) {\n\t\t\t\ts = 1;\n\t\t\t} else {\n\t\t\t\ts = -1;\n\t\t\t}\n\t\t\tdet += s * Matrix[0][i] * (this.calculate_determinant(smaller));\n\t\t}\n\t\treturn (det);\n\t}",
"function calcDeterminant(matrix) {\r\n let a = matrix[0][0];\r\n let b = matrix[0][1];\r\n let c = matrix[1][0];\r\n let d = matrix[1][1];\r\n return a * d - b * c;\r\n}",
"det()\r\n {\r\n if (this.m == 1)\r\n return this.matrix[0][0];\r\n\r\n if (this.m == 2)\r\n {\r\n return math.subtract(\r\n math.multiply(this.matrix[0][0], this.matrix[1][1]),\r\n math.multiply(this.matrix[0][1], this.matrix[1][0])\r\n );\r\n }\r\n\r\n var total = 0;\r\n var sign = 1;\r\n\r\n // loop through elements of first column\r\n for (var r = 0; r < this.m; r++)\r\n {\r\n // calculate cofactor of each element: (alternating sign) * subset(r, 0).det()\r\n var cofactor = math.multiply(sign, this.subset(r, 0).det());\r\n\r\n // multiply each element in this column by the cofactor for that element\r\n var ac = math.multiply(this.matrix[r][0], cofactor);\r\n\r\n // add this to a total\r\n total = math.add(total, ac);\r\n\r\n sign *= -1;\r\n }\r\n return total;\r\n }",
"function det(M){\n\tif (M.length == 2){\n\t\treturn M[0][0]*M[1][1] - M[0][1]*M[1][0];\n\t}\n\telse {\n\t\treturn M[0][0]*det(submatrix(M,0,0)) - M[0][1]*det(submatrix(M,0,1)) + M[0][2]*det(submatrix(M,0,2)); \n\t}\n}",
"function det(A){\r\n\tvar D = A;\r\n\tD[3]=A[0];\r\n\tD[4]=A[1];\r\n\treturn (D[0][0]*D[1][1]*D[2][2]+D[1][0]*D[2][1]*D[3][2]\r\n\t+A[2][0]*A[3][1]*A[4][2])\r\n\t-(D[0][2]*D[1][1]*D[2][0]+D[1][2]*D[2][1]*D[3][0]\r\n\t+D[2][2]*D[3][1]*D[4][0]);\r\n}",
"determinant() {\n if (this.row !== this._col) {\n throw new Error('The matrix is not a square');\n }\n else {\n if (this.row == 2) {\n return this.data[0][0] * this.data[1][1] - this.data[0][1] * this.data[1][0];\n }\n else {\n let iCof = 1;\n let sum = 0;\n for (let j = 0; j < this._col; j++) {\n sum = sum + this.data[iCof - 1][j] * Math.pow((-1), (iCof + j + 1)) * this.sub_matrix(iCof, j + 1).determinant();\n }\n return sum;\n }\n }\n }",
"function FindDeterminant(array) {\n if (array.length == 2) {\n res += '(' + array[0][0] + ')*(' + array[1][1] + ')-(' + array[0][1] + ')*(' + array[1][0] + ')'; //ad-bc\n return;\n }\n\n var len = array[0].length;\n for (var i = 0; i < len; i++) {\n var ele = array[0][i];\n var subDetArray = [];\n for (var rowIndex = 1; rowIndex < array.length; rowIndex++) {\n var row = array[rowIndex];\n var temp = [];\n for (var col = 0; col < len; col++) {\n if (col != i)\n temp.push(row[col]);\n }\n subDetArray.push(temp);\n }\n var even = ((i + 1) % 2 == 0);\n res += (even ? '-(' : '+(') + ele + ')*(';\n FindDeterminant(subDetArray);\n res += ')';\n }\n }",
"function determinant2D(a, b, c, d) {\n return a * d - b * c;\n }",
"function determinantPro(m) {\n if (m.length == 0) return 0;\n if (m.length == 1) return m[0][0];\n if (m.length == 2) return m[0][0] * m[1][1] - m[0][1] * m[1][0];\n if (m.length > 2) {\n return m.reduce((acc, curr, i, arr) => {\n let miniArr = arr.slice(0, i).concat(arr.slice(i + 1)).map(item => item.slice(1));\n console.log(i, curr, acc, '||', miniArr);\n return acc + (i % 2 == 0 ? 1 : -1) * curr[0] * determinantPro(miniArr);\n }, 0);\n }\n}",
"_det(r) {\n if (r == 2)\n return this.m[0][0] * this.m[1][1] - this.m[0][1] * this.m[1][0];\n \n var d = 0;\n for (var i = 0; i < r; i++) {\n if (i % 2 == 0) d += this.m[r - 1][i] * det(r - 1);\n else d -= this.m[r - 1][i] * det(r - 1);\n }\n return d;\n }",
"function solveEq(eq){\n // seperate eq matrix to matrix a and b\n const a = []\n const b = []\n for (let i = 0; i < 3; i += 1) {\n const row = [];\n for (let j = 0; j < 3; j += 1) {\n row.push(eq[i][j]);\n }\n a.push(row);\n b.push(eq[i][3]);\n }\n // calculate matrix of minors\n const mom = [];\n for (let i = 0; i < 3; i += 1) {\n const row = [];\n for (let j = 0; j < 3; j += 1) {\n const sq = [];\n for (let x = 0; x < 3; x += 1) {\n for (let y = 0; y < 3; y += 1) {\n if (x !== i && y !== j) sq.push(a[x][y]);\n }\n }\n const det = determinant(sq);\n row.push(det);\n }\n mom.push(row);\n }\n // calculate matrix of cofactors\n const moc = [[mom[0][0], -mom[0][1], mom[0][2]],\n [-mom[1][0], mom[1][1], -mom[1][2]],\n [mom[2][0], -mom[2][1], mom[2][2]]];\n // adjugate matrix of cofactors \n const amoc = [[moc[0][0], moc[1][0], moc[2][0]],\n [moc[0][1], moc[1][1], moc[2][1]],\n [moc[0][2], moc[1][2], moc[2][2]]]; \n // find determinant of a\n const a1 = determinant([a[1][1], a[1][2], a[2][1], a[2][2]]);\n const a2 = determinant([a[1][0], a[1][2], a[2][0], a[2][2]]);\n const a3 = determinant([a[1][0], a[1][1], a[2][0], a[2][1]]);\n const aDet = a[0][0] * a1 - a[0][1] * a2 + a[0][2] * a3;\n const aInv = [];\n for (let i = 0; i < 3; i += 1) {\n const row = [];\n for (let j = 0; j < 3; j += 1) {\n row.push(1/aDet * amoc[i][j]);\n }\n aInv.push(row);\n }\n // multiply inverse of matrix a by matrix b\n return [Math.round(aInv[0][0] * b[0] + aInv[0][1] * b[1] + aInv[0][2] * b[2]),\n Math.round(aInv[1][0] * b[0] + aInv[1][1] * b[1] + aInv[1][2] * b[2]),\n Math.round(aInv[2][0] * b[0] + aInv[2][1] * b[1] + aInv[2][2] * b[2])];\n}",
"function det3d(A) {\n var col1 = A[0] * (A[4] * A[8] - A[5] * A[7]);\n var col2 = A[1] * (A[3] * A[8] - A[5] * A[6]);\n var col3 = A[2] * (A[3] * A[7] - A[4] * A[6]);\n return col1 - col2 + col3;\n}",
"function calculateDifficult(matrix, equalities){\n var determinant,\n answer = [],\n inverse = [];\n\n determinant = determinantForThree(matrix);\n inverse = findAdjugate(matrix);\n\n\n inverse = inverse.map(function(row){\n row = row.map(function(col){\n return col / determinant;\n });\n return row;\n });\n\n answer = multiply(inverse, equalities);\n\n return answer;\n}",
"function inverse(a)\n{\n var inv = [];\n var temp2 = [];\n var determinant = detRec(a);\n\n //Check if the matrix even has an inverse (determinant != 0)\n if(determinant == 0)\n {\n return 0;\n }\n\n //Get the cofactor matrix\n for (var i =0; i < a.length; i++)\n {\n for (var j =0; j < a[0].length; j++)\n {\n //Find the determinant at each index\n var temp = detRemove(a, i, j);\n var det = detRec(temp) * Math.pow(-1, (j+i));\n temp2.push(det);\n }\n //Push row to inverse matrix\n inv.push(temp2);\n temp2 = [];\n }\n\n //Transpose the cofactor matrix\n inv = transpose(inv);\n\n //Multiply by the 1/determinant\n for (var i = 0; i < inv.length; i++)\n {\n for (var j = 0; j < inv[0].length; j++)\n {\n var num = inv[i][j];\n var multiple = 1;\n var det = determinant;\n\n //Convert float to a fraction\n if(isFloat(num))\n {\n num *= 1;\n num = num.toFixed(3)\n multiple = toInt(num);\n }\n\n if(isFloat(det))\n {\n det = det.toFixed(3);\n multiple *= toInt(det);\n }\n\n num *= multiple;\n det *= multiple;\n\n //Reduce the fraction num/det\n inv[i][j] = reduceFraction(num, det);\n }\n }\n\n return inv;\n}",
"function calculateEasy(matrix, equalities){\n\n var determinant,\n answer = [],\n inverse = [];\n\n // Find Determinant Of 2X2 Matrix\n determinant = determinantForTwo(matrix);\n\n // Find the inverse matrix by multiplying given matrix by 1/determinant\n inverse.push([ matrix[1][1]/determinant, -matrix[0][1]/determinant ]);\n inverse.push([ -matrix[1][0]/determinant, matrix[0][0]/determinant ]);\n\n // Find solution of system by multiplying inverse matrix on equalities' matrix(numbers without variable),\n // This contains plain math - 2X2 matrix multiplication on 2X1 one\n // Result will be a matrix of solutions for the system\n answer.push(inverse[0][0] * equalities[0] + inverse[0][1] * equalities[1]);\n answer.push(inverse[1][0] * equalities[0] + inverse[1][1] * equalities[1]);\n\n // Round answers to nearest hundredth\n answer[0] = answer[0].toFixed(3); //Math.round(answer[0]*100)/100;\n answer[1] = answer[1].toFixed(3);\n\n\n return answer;\n}",
"determinantMat4(mat) {\n // Cache the matrix values (makes for huge speed increases!)\n const a00 = mat[0];\n\n const a01 = mat[1];\n const a02 = mat[2];\n const a03 = mat[3];\n const a10 = mat[4];\n const a11 = mat[5];\n const a12 = mat[6];\n const a13 = mat[7];\n const a20 = mat[8];\n const a21 = mat[9];\n const a22 = mat[10];\n const a23 = mat[11];\n const a30 = mat[12];\n const a31 = mat[13];\n const a32 = mat[14];\n const a33 = mat[15];\n return a30 * a21 * a12 * a03 - a20 * a31 * a12 * a03 - a30 * a11 * a22 * a03 + a10 * a31 * a22 * a03 +\n a20 * a11 * a32 * a03 - a10 * a21 * a32 * a03 - a30 * a21 * a02 * a13 + a20 * a31 * a02 * a13 +\n a30 * a01 * a22 * a13 - a00 * a31 * a22 * a13 - a20 * a01 * a32 * a13 + a00 * a21 * a32 * a13 +\n a30 * a11 * a02 * a23 - a10 * a31 * a02 * a23 - a30 * a01 * a12 * a23 + a00 * a31 * a12 * a23 +\n a10 * a01 * a32 * a23 - a00 * a11 * a32 * a23 - a20 * a11 * a02 * a33 + a10 * a21 * a02 * a33 +\n a20 * a01 * a12 * a33 - a00 * a21 * a12 * a33 - a10 * a01 * a22 * a33 + a00 * a11 * a22 * a33;\n }",
"function inverse(inmat) { \n\t\n\tvar mat = flatten(inmat);\n\n\t// Cache the matrix values (makes for huge speed increases!)\n\tvar a00 = mat[0], a01 = mat[1], a02 = mat[2], a03 = mat[3];\n\tvar a10 = mat[4], a11 = mat[5], a12 = mat[6], a13 = mat[7];\n\tvar a20 = mat[8], a21 = mat[9], a22 = mat[10], a23 = mat[11];\n\tvar a30 = mat[12], a31 = mat[13], a32 = mat[14], a33 = mat[15];\n\t\n\tvar b00 = a00*a11 - a01*a10;\n\tvar b01 = a00*a12 - a02*a10;\n\tvar b02 = a00*a13 - a03*a10;\n\tvar b03 = a01*a12 - a02*a11;\n\tvar b04 = a01*a13 - a03*a11;\n\tvar b05 = a02*a13 - a03*a12;\n\tvar b06 = a20*a31 - a21*a30;\n\tvar b07 = a20*a32 - a22*a30;\n\tvar b08 = a20*a33 - a23*a30;\n\tvar b09 = a21*a32 - a22*a31;\n\tvar b10 = a21*a33 - a23*a31;\n\tvar b11 = a22*a33 - a23*a32;\n\t\n\t// Calculate the determinant (inlined to avoid double-caching)\n\tvar invDet = 1/(b00*b11 - b01*b10 + b02*b09 + b03*b08 - b04*b07 + b05*b06);\n\tvar dest = [];\n\t\n\tdest[0] = (a11*b11 - a12*b10 + a13*b09)*invDet;\n\tdest[1] = (-a01*b11 + a02*b10 - a03*b09)*invDet;\n\tdest[2] = (a31*b05 - a32*b04 + a33*b03)*invDet;\n\tdest[3] = (-a21*b05 + a22*b04 - a23*b03)*invDet;\n\tdest[4] = (-a10*b11 + a12*b08 - a13*b07)*invDet;\n\tdest[5] = (a00*b11 - a02*b08 + a03*b07)*invDet;\n\tdest[6] = (-a30*b05 + a32*b02 - a33*b01)*invDet;\n\tdest[7] = (a20*b05 - a22*b02 + a23*b01)*invDet;\n\tdest[8] = (a10*b10 - a11*b08 + a13*b06)*invDet;\n\tdest[9] = (-a00*b10 + a01*b08 - a03*b06)*invDet;\n\tdest[10] = (a30*b04 - a31*b02 + a33*b00)*invDet;\n\tdest[11] = (-a20*b04 + a21*b02 - a23*b00)*invDet;\n\tdest[12] = (-a10*b09 + a11*b07 - a12*b06)*invDet;\n\tdest[13] = (a00*b09 - a01*b07 + a02*b06)*invDet;\n\tdest[14] = (-a30*b03 + a31*b01 - a32*b00)*invDet;\n\tdest[15] = (a20*b03 - a21*b01 + a22*b00)*invDet;\n\t\n\treturn transpose(mat4(dest));\n}",
"function solve3(\n a = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]], //!< [in] Matix\n b = [0.0, 0.0, 0.0] //!< [in,out] Right hand side vector\n)\n{\n let i = 0;\n let det = 0.0, c = [0.0, 0.0, 0.0];\n /**/\n det = a[0][0] * (a[1][1] * a[2][2] - a[1][2] * a[2][1])\n + a[0][1] * (a[1][2] * a[2][0] - a[1][0] * a[2][2])\n + a[0][2] * (a[1][0] * a[2][1] - a[1][1] * a[2][0]);\n /**/\n c[0] = b[0] * (a[1][1] * a[2][2] - a[1][2] * a[2][1])\n + b[1] * (a[0][2] * a[2][1] - a[0][1] * a[2][2])\n + b[2] * (a[0][1] * a[1][2] - a[0][2] * a[1][1]);\n /**/\n c[1] = b[0] * (a[1][2] * a[2][0] - a[1][0] * a[2][2])\n + b[1] * (a[0][0] * a[2][2] - a[0][2] * a[2][0])\n + b[2] * (a[0][2] * a[1][0] - a[0][0] * a[1][2]);\n /**/\n c[2] = b[0] * (a[1][0] * a[2][1] - a[1][1] * a[2][0])\n + b[1] * (a[0][1] * a[2][0] - a[0][0] * a[2][1])\n + b[2] * (a[0][0] * a[1][1] - a[0][1] * a[1][0]);\n /**/\n for (i = 0; i<3; ++i) b[i] = c[i] / det;\n return det;\n}",
"function matrixDiagonalsDiff_alt(matrix) {\n let diagonal1 = 0, diagonal2 = 0;\n\n for (var i = 0; i < matrix.length; i++) {\n for (var j = 0; j < matrix.length; j++) {\n // Get elements for the main diagonal (diagonal-1). So I need to increment the i and j equally\n if ( i === j ) {\n diagonal1 += matrix[i][j];\n }\n // Get elements for the secondary diagonal (diagonal-2). So I need to decrement j. Taking the value of the inner array from reverse (i.e. last element comes first)\n if ( j = (matrix.length) - i - 1) {\n diagonal2 += matrix[i][j];\n }\n }\n }\n return Math.abs(diagonal1 - diagonal2);\n}",
"function createDetMatrix() {\r\n var answerString = \"\";\r\n var output = document.getElementById(\"DetMatrix\");\r\n var table = document.getElementById(\"matrixForDeterminant\");\r\n for (var r = 0, n = table.rows.length; r < n; r++) {\r\n if (r >= 1) {\r\n var strLength = answerString.length;\r\n answerString = (answerString.slice(0, strLength - 1));\r\n answerString += \"\\\\\\\\\";\r\n }\r\n for (var c = 0, n = table.rows.length; c < n; c++) {\r\n var rowId = r + 1;\r\n var colId = c + 1;\r\n var Cell = document.getElementById(\"a\" + rowId + colId).value;\r\n var str = Cell;\r\n var pos = str.indexOf(\"/\");\r\n var minuspos = Cell.indexOf(\"-\")\r\n if (Cell.charAt(minuspos) === \"-\" && Cell.charAt(pos) === \"/\") {\r\n var str2 = str.replace(\"-\", \"\");\r\n var start = str2.slice(0, pos - 1);\r\n start = \"\\\\frac {\" + start + \"}\";\r\n var end = Cell;\r\n var afterSlash = str.substr(str.indexOf(\"/\") + 1);\r\n end = \"{\" + afterSlash + \"}\";\r\n var fractionbracketstart = \"(-\";\r\n var fractionbracketend = \")\" + \"&\";\r\n var fractionbracket = fractionbracketstart + start + end + fractionbracketend;\r\n answerString += fractionbracket;\r\n } else if (Cell.charAt(pos) === \"/\") {\r\n var stringLength = Cell.length;\r\n var String1 = Cell;\r\n var start = str.slice(0, pos);\r\n start = \"\\\\frac {\" + start + \"}\";\r\n var end = Cell;\r\n var afterSlash = str.substr(str.indexOf(\"/\") + 1);\r\n end = \"{\" + afterSlash + \"}&\";\r\n Cell = start + end;\r\n answerString += Cell;\r\n } else if (Cell.charAt(0) === \"-\") {\r\n Cell = \"(\" + Cell + \")\" + \"&\";\r\n answerString += Cell;\r\n } else {\r\n var Cell = document.getElementById(\"a\" + rowId + colId).value + \"&\";\r\n answerString += Cell;\r\n }\r\n }\r\n }\r\n var strLength = answerString.length;\r\n answerString = (answerString.slice(0, strLength - 1));\r\n return answerString;\r\n}",
"function det2d(u, v)\r\n{\r\n return u[0]*v[1] - u[1]*v[0];\r\n}",
"determinant() {\n return (\n this.a00*this.adj(0, 0)\n +this.a01*this.adj(0, 1)\n +this.a02*this.adj(0, 2)\n +this.a03*this.adj(0, 3)\n );\n }",
"function maximumProductOfDiagonals(matrix){\n let maximum = Number.MIN_VALUE; //setting maximum to lowest possible value\n let i, j, product1, product2;\n let rows = matrix.length,\n cols = matrix[0].length;\n for( i=0 ; i<rows ; i++ ){\n for( j=0 ; j< cols ; j++ ){//iterating through matrix\n if((j+3)<cols && (i+3)<rows){//if element have 4 adjacent values along positive diagonal, find product\n product1 = matrix[i][j] * matrix[i][j+1] * matrix[i][j+2] * matrix[i][j+3] ;\n //debugging console.log(`${matrix[i][j]}*${matrix[i][j+1]}*${matrix[i][j+2]}*${matrix[i][j+3]} = ${product1}\\n`);\n }\n if((i-3) > -1 && (j-3) > -1){//if element has 4 adjacent values along negative diagonal ,find product\n product2 = matrix[i][j] * matrix[i+1][j] * matrix[i+2][j] * matrix[i+3][j] ;\n //debugging console.log(`${matrix[i][j]}*${matrix[i+1][j]}*${matrix[i+2][j]}*${matrix[i+3][j]} = ${product2}\\n`);\n }\n //set maximum to max of product1,product2 and itself\n if(product1>product2){\n if(product1 > maximum){\n maximum = product1;\n }\n }\n else{\n if(product2 > maximum){\n maximum = product2;\n }\n }\n // debugging console.log(maximum);\n }\n }\n return maximum;//finally returning maximum\n}",
"function inverseOfMatrix(matrix1, n, adj) {\r\n var sign = 1;\r\n var temp = new Array(n); // temp is used to store cofactors\r\n var det = determinantOfMatrix(matrix1, n);\r\n for (var i = 0; i < n; i++) {\r\n temp[i] = new Array(n);\r\n }\r\n if (n == 1) {\r\n adj[0][0] = 1;\r\n return;\r\n }\r\n for (var i = 0; i < n; i++) {\r\n for (var j = 0; j < n; j++) {\r\n getCofactor(matrix1, temp, i, j, n);\r\n // sign is negative if sum of row\r\n // and column indexes is odd.\r\n if ((i + j) % 2 != 0) {\r\n sign = -1;\r\n } else {\r\n sign = 1;\r\n }\r\n // Interchanging rows and columns to get the\r\n // transpose of the cofactor matrix\r\n adj[j][i] = (sign) * (determinantOfMatrix(temp, n - 1));\r\n }\r\n }\r\n for (var i = 0; i < n; i++) {\r\n for (var j = 0; j < n; j++) {\r\n temp[i][j] = adj[i][j] / (det);\r\n }\r\n }\r\n return temp;\r\n}",
"function LU_decomposition(m1) {\n var n = m1.length;\n var i,j,k;\n var l_matrix = [];\n var u_matrix = [];\n for (i = 0; i < n; i++){\n l_matrix[i] = [];\n u_matrix[i] = [];\n }\n for (i = 0; i < n; i++){\n for (j = 0; j < n; j++){\n if (j < i){\n l_matrix[j][i] = 0;\n }\n else{\n l_matrix[j][i] = m1[j][i];\n for (k = 0; k < i; k++){\n l_matrix[j][i] = l_matrix[j][i] - l_matrix[j][k] * u_matrix[k][i];\n }\n }\n }\n for (j = 0; j < n; j++){\n if (j == i){\n u_matrix[i][j] = 1;\n }\n else if (j < i){\n u_matrix[i][j] = 0;\n }\n else{\n u_matrix[i][j] = m1[i][j] / l_matrix[i][i];\n for (k = 0; k < i; k++){\n u_matrix[i][j] = u_matrix[i][j] - l_matrix[i][k] * u_matrix[k][j] / l_matrix[i][i];\n }\n }\n }\n }\n return {\n l_matrix: l_matrix,\n u_matrix: u_matrix\n };\n}",
"function diagonalDifference(matrix) {\n\tlet total = 0;\n\tlet total2 = 0;\n\tlet num = 0;\n\tif (matrix.length % 2 !== 0) {\n\t\t//console.log(matrix.length);\n\t\tfor (let i = 3; i < 50; i++) {\n\t\t\tif (matrix.length % i === 0) {\n\t\t\t\tfor (let j = 0; j < matrix.length; j=j+(i+1)) {\n\t\t\t\t\ttotal += matrix[j];\n\t\t\t\t}\n\t\t\t\tfor (let j = i-1; j < matrix.length-(i-(i-1)); j=j+(i-1)) {\n\t\t\t\t\ttotal2 += matrix[j];\t\t\n\t\t\t\t}\n\t\t\t\treturn Math.abs(total-total2);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconsole.log(\"The sum of diagonals can not be done\");\n\t}\n}"
] | [
"0.74909025",
"0.73743075",
"0.7320607",
"0.7210089",
"0.7180129",
"0.7121054",
"0.7027388",
"0.6933576",
"0.67923373",
"0.67677796",
"0.6689784",
"0.61586154",
"0.60582674",
"0.59964216",
"0.597575",
"0.59676594",
"0.5915091",
"0.5856863",
"0.581085",
"0.58018345",
"0.57144785",
"0.5680518",
"0.560066",
"0.5579856",
"0.5435587",
"0.54295754",
"0.542865",
"0.5411998",
"0.5310299",
"0.5306796"
] | 0.75930524 | 0 |
functions creates n_minor from m | function nMinor (m, n) {
let minor = []
//h = 1 to skip first row of matrix
for (let h = 1; h < m.length; h++) {
minor.push(m[h].filter((el, it) => it !== n))
}
return minor
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function minor2x2() {\r\n if (selection_text_misc_2x2.textContent == \"Inverse\" || selection_text_misc_2x2.textContent == \"Co-factor\" || selection_text_misc_2x2.textContent == \"Adjoint\") {\r\n minor_array.push(Number(misc_array_1[3]));\r\n minor_array.push(Number(misc_array_1[2]));\r\n minor_array.push(Number(misc_array_1[1]));\r\n minor_array.push(Number(misc_array_1[0]));\r\n }\r\n else {\r\n minor_array.push(Number(misc_array_1[3]));\r\n minor_array.push(Number(misc_array_1[2]));\r\n minor_array.push(Number(misc_array_1[1]));\r\n minor_array.push(Number(misc_array_1[0]));\r\n\r\n for (let k = 0; k < matrix2_misc.length; k++) {\r\n matrix2_misc[k].innerHTML = minor_array[k];\r\n }\r\n while (misc_array_1.length > 0) {\r\n misc_array_1.pop();\r\n }\r\n while (minor_array.length > 0) {\r\n minor_array.pop();\r\n }\r\n }\r\n }",
"function minor3x3() {\r\n if (selection_text_misc_3x3.textContent == \"Inverse\" || selection_text_misc_3x3.textContent == \"Co-factor\" || selection_text_misc_3x3.textContent == \"Adjoint\") {\r\n minor_array.push(Number((misc_array_3[4] * misc_array_3[8]) - (misc_array_3[5] * misc_array_3[7])));\r\n minor_array.push(Number((misc_array_3[3] * misc_array_3[8]) - (misc_array_3[6] * misc_array_3[5])));\r\n minor_array.push(Number((misc_array_3[3] * misc_array_3[7]) - (misc_array_3[6] * misc_array_3[4])));\r\n minor_array.push(Number((misc_array_3[1] * misc_array_3[8]) - (misc_array_3[7] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[8]) - (misc_array_3[6] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[7]) - (misc_array_3[6] * misc_array_3[1])));\r\n minor_array.push(Number((misc_array_3[1] * misc_array_3[5]) - (misc_array_3[4] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[5]) - (misc_array_3[3] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[4]) - (misc_array_3[3] * misc_array_3[1])));\r\n }\r\n else {\r\n minor_array.push(Number((misc_array_3[4] * misc_array_3[8]) - (misc_array_3[5] * misc_array_3[7])));\r\n minor_array.push(Number((misc_array_3[3] * misc_array_3[8]) - (misc_array_3[6] * misc_array_3[5])));\r\n minor_array.push(Number((misc_array_3[3] * misc_array_3[7]) - (misc_array_3[6] * misc_array_3[4])));\r\n minor_array.push(Number((misc_array_3[1] * misc_array_3[8]) - (misc_array_3[7] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[8]) - (misc_array_3[6] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[7]) - (misc_array_3[6] * misc_array_3[1])));\r\n minor_array.push(Number((misc_array_3[1] * misc_array_3[5]) - (misc_array_3[4] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[5]) - (misc_array_3[3] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[4]) - (misc_array_3[3] * misc_array_3[1])));\r\n\r\n for (let k = 0; k < matrix4_misc.length; k++) {\r\n matrix4_misc[k].innerHTML = minor_array[k];\r\n }\r\n\r\n while (misc_array_3.length > 0) {\r\n misc_array_3.pop();\r\n }\r\n while (minor_array.length > 0) {\r\n minor_array.pop();\r\n }\r\n }\r\n }",
"function minorKey(tnc) {\n const pc = (0, _core.note)(tnc).pc;\n if (!pc) return NoMinorKey;\n const alteration = distInFifths(\"C\", pc) - 3;\n return {\n type: \"minor\",\n tonic: pc,\n relativeMajor: (0, _core.transpose)(pc, \"3m\"),\n alteration,\n keySignature: (0, _core.altToAcc)(alteration),\n natural: NaturalScale(pc),\n harmonic: HarmonicScale(pc),\n melodic: MelodicScale(pc)\n };\n}",
"function minorKey(tonic) {\n const alteration = distInFifths(\"C\", tonic) - 3;\n return {\n type: \"minor\",\n tonic,\n relativeMajor: transpose(tonic, \"3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n natural: NaturalScale(tonic),\n harmonic: HarmonicScale(tonic),\n melodic: MelodicScale(tonic),\n };\n}",
"function setMajorMinor(tempMajor){\n majorMinor = tempMajor;\n GetNumProg();\n}",
"function identSize(M, m, n, k) {\n var e = M.elements;\n var i = k - 1;\n\n while(i--) {\n\tvar row = [];\n\t\n\tfor(var j = 0; j < n; j++)\n\t row.push(j == i ? 1 : 0);\n\t\n e.unshift(row);\n }\n \n for(var i = k - 1; i < m; i++) {\n while(e[i].length < n)\n e[i].unshift(0);\n }\n\n return $M(e);\n}",
"function identSize(M, m, n, k) {\n var e = M.elements;\n var i = k - 1;\n\n while(i--) {\n\tvar row = [];\n\t\n\tfor(var j = 0; j < n; j++)\n\t row.push(j == i ? 1 : 0);\n\t\n e.unshift(row);\n }\n \n for(var i = k - 1; i < m; i++) {\n while(e[i].length < n)\n e[i].unshift(0);\n }\n\n return $M(e);\n}",
"function identSize(M, m, n, k) {\n var e = M.elements;\n var i = k - 1;\n\n while(i--) {\n\tvar row = [];\n\t\n\tfor(var j = 0; j < n; j++)\n\t row.push(j == i ? 1 : 0);\n\t\n e.unshift(row);\n }\n \n for(var i = k - 1; i < m; i++) {\n while(e[i].length < n)\n e[i].unshift(0);\n }\n\n return $M(e);\n}",
"function identSize(M, m, n, k) {\n\t\t\tvar e = M.elements;\n\t\t\tvar i = k - 1;\n\n\t\t\twhile (i--) {\n\t\t\t\t\t\tvar row = [];\n\n\t\t\t\t\t\tfor (var j = 0; j < n; j++) row.push(j == i ? 1 : 0);\n\n\t\t\t\t\t\te.unshift(row);\n\t\t\t}\n\n\t\t\tfor (var i = k - 1; i < m; i++) {\n\t\t\t\t\t\twhile (e[i].length < n) e[i].unshift(0);\n\t\t\t}\n\n\t\t\treturn $M(e);\n}",
"function identSize(M, m, n, k) {\n\t\t\tvar e = M.elements;\n\t\t\tvar i = k - 1;\n\n\t\t\twhile (i--) {\n\t\t\t\t\t\tvar row = [];\n\n\t\t\t\t\t\tfor (var j = 0; j < n; j++) row.push(j == i ? 1 : 0);\n\n\t\t\t\t\t\te.unshift(row);\n\t\t\t}\n\n\t\t\tfor (var i = k - 1; i < m; i++) {\n\t\t\t\t\t\twhile (e[i].length < n) e[i].unshift(0);\n\t\t\t}\n\n\t\t\treturn $M(e);\n}",
"function minorClick(minor){\r\n\t/*get minor name from clicked attribute (this)*/\r\n\tvar minorname = minor.getAttribute(\"data-dash-minorName\");\r\n\tconsole.log(minorname);\r\n\t/*get more info about minor*/\r\n\tmyXHR('get',{'path':'/minors/UgMinors/name='+minorname},'none').done(function(json){\r\n\t\tconsole.log(json);\r\n\t\tvar minors = \"<div class='minorsPopup'><div><p class='closeP'>\";\r\n\t\tminors += \"<i class='popupContent_close fa fa-times fa-2x'></i></p></div>\";\r\n\t\tminors += \"<div><h1>\"+json.title+\"</h1><hr style='width:25%'>\";\r\n\t\t/*if-else is for description manipulation to get minor liasion and minor advisor info\r\n\t\tas format for GIS_MN and MEDINFO-MN is different*/\r\n\t\tvar temp = json.description.split(\":\");\r\n\t\tif(json.name == \"GIS-MN\" || json.name == \"MEDINFO-MN\"){\r\n\t\t\ttemp[1] = temp[1].replace(\"Faculty Minor Liaison\",\"\");\r\n\t\t\tminors += \"<p>\"+temp[0]+temp[1]+\"</p>\";\r\n\t\t\tminors += \"<p class='secondP'>Faculty Minor Liaison: \";\r\n\t\t\tminors += \"<span class='pValue'>\"+temp[2].replace(\". Minor Advisor\",\"\")+\"</span></p>\";\r\n\t\t\tminors += \"<p class='secondP'>Minor Advisor: <span class='pValue'>\"+temp[3];\r\n\t\t\tminors += \"</span></p>\";\r\n\t\t}else{\r\n\t\t\tminors += \"<p>\"+temp[0].replace(\"Faculty Minor Liaison\",\"\")+\"</p>\";\r\n\t\t\tminors += \"<p class='secondP'>Faculty Minor Liaison: <span class='pValue'>\";\r\n\t\t\tminors += temp[1].replace(\". Minor Advisor\",\"\")+\"</span></p>\";\r\n\t\t\tminors += \"<p class='secondP'>Minor Advisor: <span class='pValue'>\"+temp[2];\r\n\t\t\tminors += \"</span></p>\";\r\n\t\t}\r\n\r\n\t\t/*minor related courses*/\r\n\t\tminors += \"<p class='courseTitle'>COURSES</p>\";\r\n\t\tminors += \"<ul>\";\r\n\t\tfor(var j=0; j<json.courses.length;j++){\r\n\t\t\tminors += \"<li data-dash-coursename='\"+json.courses[j]+\"' \";\r\n\t\t\tminors += \"onclick='minorCourseClick(this)'>\"+json.courses[j]+\"</li>\";\r\n\t\t}\r\n\t\tminors += \"</ul>\";\r\n\r\n\t\t/*if any content available in note*/\r\n\t\tif(json.note != \"\"){\r\n\t\t\tminors += \"<p class='note'>NOTE: <span class='notetext'>\"+json.note+\"</span></p>\";\r\n\t\t}\r\n\t\tminors += \"</div></div>\";\r\n\r\n\t\t$(\"#popupContent\").html(minors);\r\n\t});\r\n}",
"function minorSeventh(rootNote) {\n var startIndex = notes.indexOf(rootNote);\n return notes[startIndex] + \", \" +\n notes[startIndex + 3] + \", \" +\n notes[startIndex + 7] + \", \" +\n notes[startIndex + 10];\n}",
"function getmv(comb, m) {\n var arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n var r = 4;\n\n for (var i = 0; i < 12; i++) {\n if (comb >= Cnk[11 - i][r]) {\n comb -= Cnk[11 - i][r--];\n arr[i] = r << 1;\n } else {\n arr[i] = -1;\n }\n }\n\n edgeMove(arr, m);\n comb = 0, r = 4;\n var t = 0;\n var pm = [];\n\n for (var i = 0; i < 12; i++) {\n if (arr[i] >= 0) {\n comb += Cnk[11 - i][r--];\n pm[r] = arr[i] >> 1;\n t |= (arr[i] & 1) << 3 - r;\n }\n }\n\n return comb * 24 + getNPerm(pm, 4) << 4 | t;\n }",
"get _minorAvailable() {\n let incl = this._incl;\n return incl.cups || incl.swords || incl.wands || incl.pentacles;\n }",
"function SharpMinorScale(halfStepsFromC_of_rel_maj) {\n this.relativeMajor = new SharpMajorScale(halfStepsFromC_of_rel_maj);\n this.steps = {};\n // move all of the relative major's properties down two steps\n for (var prop in this.relativeMajor.steps) {\n if (this.relativeMajor.steps.hasOwnProperty(prop) && Number(prop)) { //no sharps or flats\n this.steps[(Number(prop) + 2) % 7] = this.relativeMajor.steps[prop];\n }\n else if (this.relativeMajor.steps.hasOwnProperty(prop) && prop.length === 2) { //accidental\n this.steps[((Number(prop.slice(0,1)) + 2) % 7) + prop.slice(1)] = this.relativeMajor.steps[prop];\n }\n }\n this.steps[2] = this.relativeMajor.steps[0]; //not sure why the above didn't do this....okay for now\n //create the reverse mapping\n this.steps_reverse = {};\n for (var prop in this.steps) {\n if (this.steps.hasOwnProperty(prop)) {\n this.steps_reverse[this.steps[prop]] = prop;\n }\n }\n this.scaleStepsToHalfSteps = {0:0, 1:2, 2:3, 3:5, 4:7, 5:6, 6:10};\n this.halfStepsFromC = (halfStepsFromC_of_rel_maj - 3 + 12) % 12;\n this.tonic = this.steps[0];\n //add harmonic and melodic\n //exceptions?\n //create new objects\n ///deal with this later\n this.naturalScale = this.steps;\n this.harmonicScale = this.steps;\n // this.harmonicScale[6] = this.relativeMajor.flatorsharp === 'sharp';\n\n}",
"addMiddleMajorTicks(tickscount, ticksDistance, distanceFromFirstToSecond, distanceModifier, normalLayout, ticksFrequency) {\n const that = this.context;\n\n let majorTicks = '', majorLabels = '', valuePlusExponent;\n\n for (let i = 1; i < tickscount; i++) {\n let number = distanceFromFirstToSecond.add(i * ticksDistance), value;\n\n if (normalLayout) {\n value = ticksFrequency.multiply(i).add(distanceModifier.add(new JQX.Utilities.BigNumber(that._drawMin)));\n }\n else {\n value = new JQX.Utilities.BigNumber(that._drawMax).subtract(distanceModifier).subtract(ticksFrequency.multiply(i));\n\n // if the value of the penultimate is 0 we add the exponent to accurately calculate its size\n if (i === tickscount - 1 && value.compare(0) === 0) {\n that._numberRenderer.numericValue = that._tickIntervalHandler.nearestPowerOfTen;\n valuePlusExponent = that._numberRenderer.bigNumberToExponent(1);\n }\n }\n if (value.compare(that._drawMax) !== 0) {\n let htmlValue = that._formatLabel(value.toString()),\n plot = true;\n\n that._labelDummy.innerHTML = valuePlusExponent ? valuePlusExponent : htmlValue;\n let dimensionValue = that._labelDummy[that._settings.size];\n\n if (number.add(dimensionValue).compare(tickscount * ticksDistance) >= 0) { // + 5 is an experimental value\n plot = false; // does not plot the second to last label if it intersects with the last one\n }\n\n const currentTickAndLabel = this._addMajorTickAndLabel(htmlValue, undefined, plot, value, true);\n\n majorTicks += currentTickAndLabel.tick;\n majorLabels += currentTickAndLabel.label;\n }\n }\n return { tick: majorTicks, label: majorLabels };\n }",
"constructor(n, m) {\n\t\tthis.n = n;\n\t\tthis.m = m;\n\t\tthis.numerator = new Array(this.n);\n\t\tthis.denominator = new Array(this.n);\n\t\tthis.b_numerator = new Array(this.n);\n\t\tthis.b_denominator = new Array(this.n);\n\t\tthis.f_numerator = new Array(this.m);\n\t\tthis.f_denominator = new Array(this.m);\n\t\tthis.free = new Array(this.m);\n\t\tthis.basis = new Array(this.n);\n\n\t\t// blanc matrix\n\t\tfor (let i=0; i<this.n; i++) {\n\t\t\tthis.numerator[i] = new Array(this.m);\n\t\t\tthis.denominator[i] = new Array(this.m);\n\t\t\tfor (let j=0; j<this.m; j++) {\n\t\t\t\tthis.numerator[i][j] = 0;\n\t\t\t\tthis.denominator[i][j] = 1;\n\t\t\t}\n\t\t}\n\t}",
"set_identity(m, n) {\r\n this.length = 0;\r\n for (let i = 0; i < m; i++) {\r\n this.push(new Array(n).fill(0));\r\n if (i < n) this[i][i] = 1;\r\n }\r\n }",
"function getPossibleLatticePaths(m, n) {\n var i, j, storedCounts = [];\n m++; n++; // increment m and n by 1, ex: a 2x2 grid has 9 vertices, see below\n\n /*\n 1--2--3\n | | |\n 4--5--6\n | | |\n 7--8--9\n */\n\n // create 2D array to store previously found counts for direct lookup time with dynamic programming\n for(storedCounts; storedCounts.length < m; storedCounts.push([]));\n\n // set top row and first col to 1's\n for(i = 0; i < m; i++){ storedCounts[i][0] = 1; }\n for(j = 0; j < n; j++){ storedCounts[0][j] = 1; }\n\n for(i = 1; i < m; i++) {\n for(j = 1; j < n; j++) {\n storedCounts[i][j] = storedCounts[i-1][j] + storedCounts[i][j-1]\n }\n }\n\n return storedCounts[m-1][n-1];\n}",
"function makeScale(halfStepsFromC_of_rel_maj, major_or_minor) {\n //major or minor is 'M' for major, 'm' for minor\n if (major_or_minor == 'm'){\n return new SharpMinorScale(halfStepsFromC_of_rel_maj);\n }\n else {\n return new SharpMajorScale(halfStepsFromC_of_rel_maj);\n }\n}",
"function testGMC()\n{\n var numbSet = []\n for (var cD=0;cD<11;cD++)\n {\n numbSet.push([cD])\n }\n\n var ans = generateMultipleCombins(numbSet.length,[1,3,2,1,4],numbSet)\n// var map =[]\n// dimensionRecurse(ans,map);\n\n var int = 5;\n}",
"function _prevNamespace(major, minor) {\n\t\t// Standard skipped some of the versions...\n\t\tvar ret = { min: 0, maj: 0 };\n\t\tret.min = minor - 1;\n\t\tif (ret.min < 0) {\n\t\t\tret.maj = major - 1;\n\t\t\tret.min = 5;\n\t\t} else {\n\t\t\tret.maj = major;\n\t\t}\n\t\t\n\t\tif (ret.maj == 2 && ret.min > 1) ret.min = 1;\n\t\tif (ret.maj == 3 && ret.min > 3) ret.min = 3;\n\t\t\n\t\treturn ret;\n\t}",
"function add_more(m,n){\n\t//console.log('make '+m+'by'+m+'matrix and add '+n+'objects');\n\tvar headID = document.getElementsByTagName(\"head\")[0];\n\tvar cssNode = document.createElement('link');\n\tcssNode.type = 'text/css';\n\tcssNode.rel = 'stylesheet';\n\tcssNode.href = '/views/main'+m+'.css';\n\theadID.appendChild(cssNode);\n\tnum_objects = m;\n\tadd_object(n);\n}",
"function renderMinesCountOnLevel(initNum) {\n var minesCount;\n if (initNum === 4) minesCount = 2;\n else if (initNum === 8) minesCount = 12;\n else minesCount = 30;\n var elMines = document.querySelector('.mines');\n elMines.innerHTML = `${minesCount}${MINE}`\n}",
"function determinant(m) {\n switch (m.length) {\n //handles empty matrix\n case 0: return 1;\n //exit condition && handles singleton matrix\n case 1: return m[0][0];\n default:\n //detrmnnt will build array of terms to be combined into determinant\n //ex. a*det(a_minor) - b*det(b_minor)...\n let detrmnnt = []\n //pos controls alternation of terms ('+' or '-')\n for (let i = 0, pos = 1; i < m.length; i++, pos *= -1) {\n //adds term, ex. +/- a * det(a_minor)\n detrmnnt.push(pos * (m[0][i] * determinant(nMinor(m, i))))\n }\n return detrmnnt.reduce((accu, elem) => accu + elem)\n }\n }",
"function paperwork(n, m) {\n if (n <= 0 || m <= 0) { return 0; }\n return m * n;\n}",
"function m(a){for(var b,c=M(),d=N(),e=[],f=n(a),g=0;g<c;g++){var h=f[g],i=[];for(b=0;b<d;b++)i.push(0);\n// loop through every segment\nfor(var j=0;j<h.length;j++){var k=h[j];\n// adjust the columns to account for the segment's height\nfor(\n// find the segment's top coordinate by looking at the max height\n// of all the columns the segment will be in.\nk.top=D(i.slice(k.leftCol,k.rightCol+1)),b=k.leftCol;b<=k.rightCol;b++)i[b]=k.top+k.outerHeight}\n// the tallest column in the row should be the \"content height\"\ne.push(D(i))}return e}",
"addMiddleMajorTicks(tickscount, ticksDistance, distanceFromFirstToSecond, distanceModifier, normalLayout, ticksFrequency) {\n const that = this.context;\n\n let majorTicks = '', majorLabels = '';\n\n for (let i = 1; i < tickscount; i++) {\n let number = i * ticksDistance + distanceFromFirstToSecond,\n value;\n\n if (normalLayout) {\n value = parseFloat(that._drawMin) + ticksFrequency * i + distanceModifier;\n }\n else {\n value = parseFloat(that._drawMax) - ticksFrequency * i - distanceModifier;\n }\n if (value.toString() !== that._drawMax.toString()) {\n let htmlValue = that._formatLabel(value.toString()),\n plot = true;\n\n that._labelDummy.innerHTML = htmlValue;\n let dimensionValue = that._labelDummy[that._settings.size];\n\n if (number + dimensionValue >= tickscount * ticksDistance) { // + 32 is an Experimental value\n plot = false;\n }\n const currentTickAndLabel = this._addMajorTickAndLabel(htmlValue, undefined, plot, value, true);\n\n majorTicks += currentTickAndLabel.tick;\n majorLabels += currentTickAndLabel.label;\n }\n }\n return { tick: majorTicks, label: majorLabels };\n }",
"function createMajorityList(data) {\n\t\n majParty = [];\n\tvar k = 0;\n\tvar listIndex = 0;\n\t\n\twhile (k < data.length) {\n\t\n\t\tvar majority = data[k].parti;\n\t\tvar votePerc = parseFloat(data[k].procent);\n\t\tvar region = formatString(data[k].region, true);\n\t\n\t\tfor (var i = k; i < k+11; i++) {\n\t\t\t\n\t\t\tif(parseFloat(data[i].procent) > votePerc) {\t\n\t\t\t\tmajority = data[i].parti;\n\t\t\t\tvotePerc = data[i].procent;\n\t\t\t}\n\t\t}\n\t\t\n\t\tmajParty[listIndex] = {region, majority, votePerc};\n\t\t\n\t\tk += 11;\n\t\tlistIndex++;\n\t}\n}",
"function paperwork(n, m) {\n return (n<0)||(m<0)?0:n*m;\n}"
] | [
"0.6104964",
"0.6036262",
"0.5782669",
"0.57583183",
"0.5351479",
"0.53313696",
"0.53313696",
"0.53313696",
"0.5235025",
"0.5235025",
"0.50572795",
"0.5027724",
"0.50156075",
"0.4935707",
"0.48972484",
"0.488601",
"0.48772857",
"0.47691962",
"0.4761753",
"0.47323486",
"0.4722992",
"0.47181568",
"0.47162426",
"0.46971053",
"0.46885148",
"0.46869412",
"0.46656606",
"0.46650037",
"0.46612605",
"0.4655889"
] | 0.69566524 | 0 |
function prevents the localstorage being reset from var highScores = []; that was declared in the beginning | function getHighScores () {
var getPastScores = localStorage.getItem("highscore");
if (getPastScores === null) {
highScores = [];
} else {
highScores = JSON.parse(localStorage.getItem("highscore"));
};
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function storedHighs() {\n localStorage.setItem(\"Scores\", JSON.stringify(highs));\n }",
"function clearScore() {\n localStorage.setItem(\"highscore\", \"\");\n localStorage.setItem(\"highscoreName\", \"\");\n var allScores = localStorage.getItem(\"allScores\");\nallScores = JSON.parse(allScores);\n}",
"function clearHighScore() {\n playerScores = [];\n playerInitals = [];\n lsPlayerScores = \"\";\n lsPlayerInitals = \"\";\n localStorage.setItem(\"playerInital\", \"\");\n localStorage.setItem(\"playerScore\", \"\");\n viewHS();\n }",
"function clearLocalStorage() {\n highScoreList = [];\n var highScoreListStr = JSON.stringify(highScoreList);\n localStorage.removeItem(\"movieFighterHighScoreList\");\n}",
"function highScores() {\r\n scoreDiv.style.display = \"none\";\r\n document.getElementById(\"highScores\").style.display = \"block\";\r\n console.log(document.getElementById(\"highScores\"))\r\n var currentHighScores = JSON.parse(localStorage.getItem(\"highScore\"));\r\n // var highScoreArray = []\r\n var highScore = {\r\n name: document.getElementById(\"initials\").value,\r\n score: score\r\n }\r\n currentHighScores.push(highScore)\r\n var strHighScore = JSON.stringify(currentHighScores);\r\n localStorage.setItem(\"highScore\", strHighScore);\r\n console.log(highScore)\r\n displayHallOfFame()\r\n}",
"function checkButton() {\n if (secondsLeft <= 0) {\n location.reload()\n } else if (win = !win && initials.value == \"\") {\n alert(\"Initials field cannot be blank.\\n Please enter your initials\")\n } else {\n var storeScore = {\n initials: initials.value.trim(),\n score: secondsLeft,\n }\n }\n highScoresArray = JSON.parse(localStorage.getItem(\"saveHighScores\"))\n console.log(highScoresArray)\n if (highScoresArray == null) {\n highScoresArray = storeScore\n localStorage.setItem(\"saveHighScores\", JSON.stringify([highScoresArray])) \n } else \n if (highScoresArray !== null) {\n highScoresArray.push(storeScore)\n localStorage.setItem(\"saveHighScores\", JSON.stringify(highScoresArray))\n }\n processScore()\n}",
"function storeHighScores(event) {\n event.preventDefault();\n\n // stop function is initial is blank\n if (initialInput.value === \"\") {\n alert(\"Please enter your initials!\");\n return;\n } \n\n startDiv.style.display = \"none\";\n timer.style.display = \"none\";\n timesUp.style.display = \"none\";\n summary.style.display = \"none\";\n highScoreSection.style.display = \"block\"; \n\n // store scores into local storage\n var savedHighScores = localStorage.getItem(\"high scores\");\n var scoresArray;\n\n if (savedHighScores === null) {\n scoresArray = [];\n } else {\n scoresArray = JSON.parse(savedHighScores)\n }\n\n var userScore = {\n initials: initialInput.value,\n score: finalScore.textContent\n };\n\n console.log(userScore);\n scoresArray.push(userScore);\n\n // stringify array in order to store in local\n var scoresArrayString = JSON.stringify(scoresArray);\n window.localStorage.setItem(\"high scores\", scoresArrayString);\n \n // show current highscores\n showHighScores();\n}",
"function saveHighscore () {\n // get value of input box\n var initials = initialsEl.value\n\n //make sure value wasn't empty \n if (initials !== \"\") {\n // get saved scores from localStorage, or if not any set to empty array\n var highscores = JSON.parse(window.localStorage.getItem(\"highscores\")) || [];\n\n // format new score object for current user \n var newScore = {\n score:time, \n initials: initials\n };\n\n // save to localStorage \n highscores.push(newScore);\n window.localStorage.setItem(\"highscores\", JSON.stringify(highscores));\n\n \n }\n printHighscores();\n}",
"function storeHighScore() {\n allHighScores.sort(compare);\n localStorage.setItem(\"allHighScores\", JSON.stringify(allHighScores)); \n}",
"function saveScore() {\n var userInitials = document.querySelector(\"#initial-input\").value;\n var finalScore = countDown;\n\n //Object stores intitials and high scores\n var scoreObject = { initials: userInitials, score: finalScore };\n\n var highScores = localStorage.getItem(\"highScoreList\");\n\n if (highScores == null) {\n localStorage.setItem(\"highScoreList\", JSON.stringify([scoreObject]));\n console.log(highScores);\n } else {\n highScoreList = JSON.parse(highScores);\n console.log(typeof highScoreList);\n highScoreList.push(scoreObject);\n localStorage.setItem(\"highScoreList\", JSON.stringify(highScoreList));\n }\n}",
"function saveHighScore() {\r\n var initials = $(\"#initials-entry\");\r\n var newHighScore = {\r\n initials: initialsEl.value,\r\n highScore: score\r\n };\r\n\r\n console.log(\"newHighScore\");\r\n highScores.push(newHighScore);\r\n console.log(\"highScores\");\r\n localStorage.setItem(\"scores\", JSON.stringify(highScores));\r\n }",
"function displaystats(){\n\n console.log(\"Display Stats\");\n\n // Hides the quiz //\n quizcontainerEl.classList.add(\"hide\");\n\n // Displays current score and asks for initials //\n if(timeLeft > 1) {\n var username = prompt(\"Game Over. Your score is: \" + timeLeft + \". Please enter your initials: \");\n\n } else {\n outoftime();\n }\n\n // Temporarily stores player's initials (username) and score (timeLeft) //\n var currentScore = {\n score: timeLeft,\n name:username\n };\n\n // Adds new data to highScores array--which was pulled from local storage when declaring the variable highScores in line 5 above //\n highScores.push(currentScore);\n\n // Sorts the high scores from highest to lowest //\n highScores.sort((a, b) => b.score - a.score);\n\n // Removes any score other than the top 5 in the highScore array //\n highScores.splice(5);\n\n // Displays high scores //\n highscorecontainerEl.classList.remove(\"hide\");\n playagainbuttonEl.classList.remove(\"hide\");\n h3subtitleEl.classList.remove(\"hide\");\n \n // If there are less than 5 high scores in local storage, this conditional displays only the number of existing scores //\n if (highScores.length > 4) {\n // displays the unorderd list of names //\n name0El.innerHTML = highScores[0].name;\n name1El.innerHTML = highScores[1].name;\n name2El.innerHTML = highScores[2].name;\n name3El.innerHTML = highScores[3].name;\n name4El.innerHTML = highScores[4].name;\n\n // displays the ordered list of scores //\n score0El.innerHTML = highScores[0].score;\n score1El.innerHTML = highScores[1].score;\n score2El.innerHTML = highScores[2].score;\n score3El.innerHTML = highScores[3].score;\n score4El.innerHTML = highScores[4].score;\n\n } else {\n \n if (highScores.length > 3) {\n name0El.innerHTML = highScores[0].name;\n name1El.innerHTML = highScores[1].name;\n name2El.innerHTML = highScores[2].name;\n name3El.innerHTML = highScores[3].name;\n score0El.innerHTML = highScores[0].score;\n score1El.innerHTML = highScores[1].score;\n score2El.innerHTML = highScores[2].score;\n score3El.innerHTML = highScores[3].score;\n\n } else {\n\n if (highScores.length > 2 ) {\n name0El.innerHTML = highScores[0].name;\n name1El.innerHTML = highScores[1].name;\n name2El.innerHTML = highScores[2].name;\n score0El.innerHTML = highScores[0].score;\n score1El.innerHTML = highScores[1].score;\n score2El.innerHTML = highScores[2].score;\n\n } else {\n\n if (highScores.length > 1) {\n name0El.innerHTML = highScores[0].name;\n name1El.innerHTML = highScores[1].name;\n score0El.innerHTML = highScores[0].score;\n score1El.innerHTML = highScores[1].score;\n\n } else {\n name0El.innerHTML = highScores[0].name;\n score0El.innerHTML = highScores[0].score;\n }\n }\n } \n }\n\n // Resets the high scores in local storage //\n localStorage.setItem(\"highScores\", JSON.stringify(highScores));\n\n // Listens for a click on the play again button. If so execute playagain() //\n playagainbuttonEl.addEventListener(\"click\", playagain);\n\n }",
"function Resetter() {\n localStorage.removeItem('highScore')\n print(localStorage.getItem('highScore'))\n}",
"function saveHighscore() {\n var initials = initialsBox.value.trim(); // input value from user\n if (initials !== \"\") {\n\n // creating an array of highscores\n var highscores = JSON.parse(window.localStorage.getItem(\"highscore\")) || [];\n \n // storing user input and score as an object into the array \n var newScore = {\n initials: initials,\n score: seconds\n };\n highscores.push(newScore);\n\n // saving object to localStorage\n window.localStorage.setItem(\"highscore\", JSON.stringify(highscores));\n loadHighScores();\n\n }\n }",
"function clearHighScores() {\n highScores = [];\n setScores(questions);\n writeScores();\n }",
"function gameOver(){\n const highScoresList = document.getElementById(\"highScoresList\");\n var playerScore = secondsLeft;\n var toggleEL = document.getElementById('toggle');\n questionEl.innerText='Game Over';\n resetQuestionCard();\n var person = prompt(\"Please enter your initials!\", \"XX\");\n if (person == null || person == \"\") {\n txt = \"Player not recorded.\";\n };\n toggleEL.innerText=\"Score:\"; \n var scoreButton = document.getElementById('score-btn');\n scoreButton.classList.remove('hide');\n\n //local storage function for scores\n var thisScore ={score: playerScore, initials: person};\n var highScore = JSON.parse(localStorage.getItem('highScore')) || [];\n \n highScore.push(thisScore);\n localStorage.setItem('highScore', JSON.stringify(highScore));\n \n \n }",
"function gatherHighScore() {\n \n var yourInitials = document.querySelector(\".text-input\").value;\n location.href = \"./highscores.html\"\n\n \n var userScore = [\n yourInitials + \" - \" +\n finalSocre\n ]\n // Sets the above array to local storage. There is a way to make this not overwirite the value each time but I have been unable to find it\n localStorage.setItem('Scores', JSON.stringify(userScore));\n\n \n }",
"function clearHighscores(){\n highscoreList.innerHTML = \"\";\n localStorage.removeItem(\"highscores\");\n}",
"function clearScore() {\n localStorage.setItem(\"highscore\", \"\");\n localStorage.setItem(\"highscoreName\", \"\");\n \n resetGame()\n }",
"function getScores() {\n var storedHighscoresData = localStorage.getItem(\"highscores\");\n\n if (storedHighscoresData !== null) {\n storedHighscoresData = JSON.parse(storedHighscoresData);\n highscores.initials = storedHighscoresData.initials;\n\n highscores.scores = storedHighscoresData.scores;\n // highscores.scores.sort((a,b)=>b - a);\n // Intention is to sort name with score but logic is incorrect\n }\n else {\n highscores.initials = [];\n highscores.scores = [];\n }\n}",
"function clearScore() {\n localStorage.setItem(\"highscore\", \"\");\n\n localStorage.setItem(\"highscoreName\", \"\");\n\n resetGame();\n}",
"function reset(){\r\n\r\n gameState=PLAY;\r\n \r\nif(localStorage[\"HighScore\"]<score){\r\n\r\n localStorage[\"HighScore\"]=score;\r\n\r\n}\r\n\r\n score=0;\r\n}",
"function clearHighScores() {\n localStorage.clear();\n location.reload();\n}",
"function clearHighScores() {\n\n // Clears the localStorage of all values (including the high scores list)\n localStorage.clear();\n\n // initializing a variable named highScoreIndex\n // corresponding to the underordered list (with the id=\"highScoreIndex\")\n var highScoreIndex = document.getElementById(\"highScoreIndex\");\n\n // if else statement to prevent an error...\n // This checks if the list exists (i.e. it is empty or has content)\n // OR if the list is null (i.e. it no longer exists because it has been cleared/deleted)\n // The removeChild function doesn't work if the parentNode is null, so it just returns.\n if (highScoreIndex === null) {\n return;\n }\n // this removes the entire unordered list (with the id=\"highScoreIndex\")\n // from the html of the document...\n // (In this application, this is okay, because re-loading the page\n // puts back the html for the unordered list.)\n else {\n highScoreIndex.parentNode.removeChild(highScoreIndex);\n }\n\n // render the high scores again\n // (Acknowledging that the high scores will not display because we cleared them!)\n renderHighScores();\n}",
"function clearScores() {\n localStorage.removeItem('scores');\n checkWin();\n drawScores();\n}",
"function clearScore() {\n localStorage.setItem(\"highscore\", \"\");\n localStorage.setItem(\"highscoreName\", \"\");\n resetGame();\n}",
"function makeHighscorelist() {\n// localStorage.clear()\n // Runs through the localStorage to find the highest score\n if (typeof(Storage) !== undefined) {\n var highest = 0;\n var highest_key = undefined;\n for (var i = 0; i < localStorage.length; i++) {\n var key = localStorage.key(i);\n if (key !== 'auditLog') {\n var nbr = localStorage.getItem(key);\n if (nbr > highest) {\n highest = nbr;\n highest_key = key;\n }\n }\n }\n // Prints the highscore, or if there's no highscore, a message that says there's no highscore\n if (highest_key !== undefined) {\n document.getElementById(\"highscores\").innerHTML = highest_key + \"\\t - \\t\" + localStorage.getItem(highest_key) + \" wins\";\n } else {\n document.getElementById(\"highscores\").innerHTML = \"No highscore exists yet\";\n }\n }\n\n //Writes all the players and the amount of wins in the console.\n console.log(\"Scores:\");\n for (var i = 0; i < localStorage.length; i++) {\n if (localStorage.key(i) !== 'auditLog') {\n console.log(localStorage.key(i) + \", \" + localStorage.getItem(localStorage.key(i)));\n }\n }\n}",
"function clearScore() {\n localStorage.setItem(\"highscore\", \"\");\n localStorage.setItem(\"highscoreName\", \"\");\n\n resetGame();\n}",
"function highScore (){\n // get value of input box\n var initials = initialsEl.value.trim()\n\n // check to make sure value is empty\n if(initials !== \"\"){\n // get saved score from localstorage,\n // if there is not anything saved to localstorage, set as an empty array\n var highScore = JSON.parse(window.localStorage.getItem(\"highscores\")) || [];\n\n //format new scores object for current user\n var newScore = {\n score: time,\n initials: initials\n };\n highScore.push(newScore);\n window.localStorage.setItem(\"highscores\", JSON.stringify(highscores));\n\n// redirect to next page\nwindow.location.href =\"highscores.html\";\n }\n}",
"function loadDefaultHighScores() {\n 'use strict';\n var data = \"\";\n var localReq = new XMLHttpRequest();\n \n if (supports_html5_storage()) {\n localReq.open(\"POST\", \"data/defaultScores.json\", false);\n localReq.send(data);\n var i;\n var responseJSON = JSON.parse(localReq.responseText);\n var scores = responseJSON[\"scores\"];\n var scoresCnt = scores.length;\n \n for (i = 0; i < scoresCnt && i < maxHighScores; i++) {\n localStorage[\"othello.highscore.\" + i + \".position\"] = scores[i][\"position\"];\n localStorage[\"othello.highscore.\" + i + \".name\"] = scores[i][\"name\"];\n localStorage[\"othello.highscore.\" + i + \".points\"] = scores[i][\"points\"];\n }\n \n }\n}"
] | [
"0.8045468",
"0.8006161",
"0.797451",
"0.7972429",
"0.79716206",
"0.7776171",
"0.7736761",
"0.7723185",
"0.7712638",
"0.77111447",
"0.7690294",
"0.7683815",
"0.76812947",
"0.767065",
"0.7668651",
"0.762816",
"0.7620422",
"0.7620355",
"0.76109535",
"0.76096016",
"0.7598561",
"0.7592169",
"0.7582449",
"0.75662017",
"0.7556829",
"0.7556768",
"0.75507164",
"0.7545005",
"0.75439",
"0.75371724"
] | 0.8064676 | 0 |
Given a node it returns the Microsoft Word list level, returning undefined for an item that isn't a MS Word list node | function getMsWordListLevel (node) {
if (node.nodeName.toLowerCase() !== 'p') {
return
}
const style = node.getAttribute('style')
const levelMatch = style && style.match(/mso-list/i) ? style.match(/level(\d+)/) : null
return levelMatch ? parseInt(levelMatch[1], 10) : undefined
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getLevel(node){\n\tif(node.properties.hasOwnProperty(\"Level\")){\n\t\treturn node.properties.Level;\n\t}else{\n\t\treturn -1;\n\t}\n}",
"function getFakeBulletText(node, levels) {\n // Word uses the following format for their bullets:\n // <p style=\"mso-list:l1 level1 lfo2\">\n // <span style=\"...\">\n // <span style=\"mso-list:Ignore\">1.<span style=\"...\"> </span></span>\n // </span>\n // Content here...\n // </p>\n //\n // Basically, we need to locate the mso-list:Ignore SPAN, which holds either one text or image node. That\n // text or image node will be the fake bullet we are looking for\n var result = null;\n var child = node.firstChild;\n while (!result && child) {\n // First, check if we need to convert the Word list comments into real elements\n child = fixWordListComments(child, true /*removeComments*/);\n // Check if this is the node that holds the fake bullets (mso-list: Ignore)\n if (isIgnoreNode(child)) {\n // Yes... this is the node that holds either the text or image data\n result = child.textContent.trim();\n // This is the case for image case\n if (result.length == 0) {\n result = 'o';\n }\n }\n else if (child.nodeType == 1 /* Element */ && levels > 1) {\n // If this is an element and we are not in the last level, try to get the fake bullet\n // out of the child\n result = getFakeBulletText(child, levels - 1);\n }\n child = child.nextSibling;\n }\n return result;\n}",
"function getLevel(el) {\n\t\treturn parseInt(el.parentNode.getAttribute('data-o-hierarchical-nav-level'), 10);\n\t}",
"function msWordListMarker (node, bulletListMarker) {\n const markerElement = node.querySelector('span[style=\"mso-list:Ignore\"]')\n\n // assume the presence of a period in a marker is an indicator of an\n // ordered list\n if (!markerElement || !markerElement.textContent.match(/\\./)) {\n return bulletListMarker\n }\n\n const nodeLevel = getMsWordListLevel(node)\n\n let item = 1\n let potentialListItem = node.previousElementSibling\n\n // loop through previous siblings to count list items\n while (potentialListItem) {\n const itemLevel = getMsWordListLevel(potentialListItem)\n\n // if there are no more list items or we encounter the lists parent\n // we don't need to count further\n if (!itemLevel || itemLevel < nodeLevel) {\n break\n }\n\n // if on same level increment the list items\n if (nodeLevel === itemLevel) {\n item += 1\n }\n\n potentialListItem = potentialListItem.previousElementSibling\n }\n\n return `${item}.`\n}",
"function getListItemMetadata(node) {\n if (node.nodeType == 1 /* Element */) {\n var listatt = getStyleValue(node, MSO_LIST_STYLE_NAME);\n if (listatt && listatt.length > 0) {\n try {\n // Word mso-list property holds 3 space separated values in the following format: lst1 level1 lfo0\n // Where:\n // (0) List identified for the metadata in the <head> of the document. We cannot read the <head> metada\n // (1) Level of the list. This also maps to the <head> metadata that we cannot read, but\n // for almost all cases, it maps to the list identation (or level). We'll use it as the\n // list indentation value\n // (2) Contains a specific list identifier.\n // Example value: \"l0 level1 lfo1\"\n var listprops = listatt.split(' ');\n if (listprops.length == 3) {\n return {\n level: parseInt(listprops[1].substr('level'.length)),\n wordListId: listatt,\n originalNode: node,\n uniqueListId: 0,\n };\n }\n }\n catch (e) { }\n }\n }\n return null;\n}",
"getListLevel(list, listLevelNumber) {\n if (!isNullOrUndefined(list)) {\n let abstractList = this.viewer.getAbstractListById(list.abstractListId);\n if (!isNullOrUndefined(list) && abstractList.levels.length <= listLevelNumber\n && listLevelNumber >= 0 && listLevelNumber < 9) {\n this.addListLevels(abstractList);\n }\n let levelOverrideAdv = undefined;\n let level = false;\n level = (!isNullOrUndefined(list.levelOverrides))\n && !isNullOrUndefined(((levelOverrideAdv = list.levelOverrides[listLevelNumber])))\n && (!isNullOrUndefined(levelOverrideAdv.overrideListLevel));\n if (level) {\n return levelOverrideAdv.overrideListLevel;\n }\n else if (!isNullOrUndefined(abstractList) && listLevelNumber >= 0 && listLevelNumber < abstractList.levels.length) {\n return abstractList.levels[listLevelNumber];\n }\n }\n return undefined;\n }",
"function recurringGetOrCreateListAtNode(node, level, listMetadata) {\n var parent = null;\n var possibleList;\n if (level == 1) {\n // Root case, we'll check if the list is the previous sibling of the node\n possibleList = getRealPreviousSibling(node);\n }\n else {\n // If we get here, we are looking for level 2 or deeper... get the upper list\n // and check if the last element is a list\n parent = recurringGetOrCreateListAtNode(node, level - 1, null);\n possibleList = parent.lastChild;\n }\n // Check the element that we got and verify that it is a list\n if (possibleList && possibleList.nodeType == 1 /* Element */) {\n var tag = roosterjs_editor_dom_1.getTagOfNode(possibleList);\n if (tag == 'UL' || tag == 'OL') {\n // We have a list.. use it\n return possibleList;\n }\n }\n // If we get here, it means we don't have a list and we need to create one\n // this code path will always create new lists as UL lists\n var newList = node.ownerDocument.createElement(listMetadata ? listMetadata.tagName : 'UL');\n if (level == 1) {\n // For level 1, we'll insert the list beofre the node\n node.parentNode.insertBefore(newList, node);\n }\n else {\n // Any level 2 or above, we insert the list as the last\n // child of the upper level list\n parent.appendChild(newList);\n }\n return newList;\n}",
"function listItem( node ) {\n\t\treturn node.type == CKEDITOR.NODE_ELEMENT && node.is( 'li' );\n\t}",
"get listLevelNumber() {\n return this.listLevelNumberIn;\n }",
"function getOrCreateListForNode(wordConverter, node, metadata, listMetadata) {\n // First get the last list next to this node under the specified level. This code\n // path will return the list or will create lists if needed\n var list = recurringGetOrCreateListAtNode(node, metadata.level, listMetadata);\n // Here use the unique list ID to detect if we have the right list...\n // it is possible to have 2 different lists next to each other with different formats, so\n // we want to detect this an create separate lists for those cases\n var listId = CustomData_1.getObject(wordConverter.customData, list, UNIQUE_LIST_ID_CUSTOM_DATA);\n // If we have a list with and ID, but the ID is different than the ID for this list item, this\n // is a completely new list, so we'll append a new list for that\n if ((listId && listId != metadata.uniqueListId) || (!listId && list.firstChild)) {\n var newList = node.ownerDocument.createElement(listMetadata.tagName);\n list.parentNode.insertBefore(newList, list.nextSibling);\n list = newList;\n }\n // Set the list id into the custom data\n CustomData_1.setObject(wordConverter.customData, list, UNIQUE_LIST_ID_CUSTOM_DATA, metadata.uniqueListId);\n // This call will convert the list if needed to the right type of list required. This can happen\n // on the cases where the first list item for this list is located after a deeper list. for that\n // case, we will have created a UL for it, and we may need to convert it\n return convertListIfNeeded(wordConverter, list, listMetadata);\n}",
"function listItemType(el) {\n const content = el.textContent.trim();\n\n if (/^[\\*\\-]\\s/.test(content)) {\n return 'ul';\n } else if (/^\\d+\\.\\s/.test(content)) {\n return 'ol';\n }\n\n return false;\n}",
"function insertListItem(listRootElement, itemToInsert, listType, doc) {\n if (!listType) {\n return;\n }\n // Get item level from 'data-aria-level' attribute\n var itemLevel = parseInt(itemToInsert.getAttribute('data-aria-level'));\n var curListLevel = listRootElement; // Level iterator to find the correct place for the current element.\n // if the itemLevel is 1 it means the level iterator is at the correct place.\n while (itemLevel > 1) {\n if (!curListLevel.firstChild) {\n // If the current level is empty, create empty list within the current level\n // then move the level iterator into the next level.\n curListLevel.append(doc.createElement(listType));\n curListLevel = curListLevel.firstElementChild;\n }\n else {\n // If the current level is not empty, the last item in the needs to be a UL or OL\n // and the level iterator should move to the UL/OL at the last position.\n var lastChild = curListLevel.lastElementChild;\n var lastChildTag = roosterjs_editor_dom_1.getTagOfNode(lastChild);\n if (lastChildTag == constants_1.UNORDERED_LIST_TAG_NAME || lastChildTag == constants_1.ORDERED_LIST_TAG_NAME) {\n // If the last child is a list(UL/OL), then move the level iterator to last child.\n curListLevel = lastChild;\n }\n else {\n // If the last child is not a list, then append a new list to the level\n // and move the level iterator to the new level.\n curListLevel.append(doc.createElement(listType));\n curListLevel = curListLevel.lastElementChild;\n }\n }\n itemLevel--;\n }\n // Once the level iterator is at the right place, then append the list item in the level.\n curListLevel.appendChild(itemToInsert);\n}",
"function getLevel(elem) {\n const pattern = /level-(\\d+)/\n for (const cls of elem.classList) {\n const match = cls.match(pattern);\n if (match) {\n return Number(match[1]);\n }\n }\n return undefined;\n}",
"getRootFromSelection(node) {\n let current_node = node;\n while (current_node !== null && current_node.tagName !== \"LI\") {\n current_node = current_node.parentNode;\n }\n return current_node;\n }",
"function getLevel (d) {\n if (_.isArray(d)) {\n return d[0].level\n } else {\n return d.level\n }\n }",
"function getHeadingLevel(heading) {\n return parseInt(heading.nodeName.slice(-1), 10);\n}",
"function calculateWidestLevel(root) {}",
"function getUl(el, level) {\n var $row = $(el).closest('.row')\n , nest_level = arguments[1] || $row.data('ul-level');\n if (nest_level == 2) return $row.find('> ul ul');\n return $row.find('> ul');\n}",
"function getLevel(l) {\n return LEVELS[l] || 7; // Default to debug\n}",
"function processNodesDiscovery(wordConverter) {\n var args = wordConverter.wordConverterArgs;\n while (args.currentIndex < args.nodes.length) {\n var node = args.nodes.item(args.currentIndex);\n // Try to get the list metadata for the specified node\n var itemMetadata = getListItemMetadata(node);\n if (itemMetadata) {\n var levelInfo = args.currentListIdsByLevels[itemMetadata.level - 1] || LevelLists_1.createLevelLists();\n args.currentListIdsByLevels[itemMetadata.level - 1] = levelInfo;\n // We need to drop some list information if this is not an item next to another\n if (args.lastProcessedItem && getRealPreviousSibling(node) != args.lastProcessedItem) {\n // This list item is not next to the previous one. This means that there is some content in between them\n // so we need to reset our list of list ids per level\n resetCurrentLists(args);\n }\n // Get the list metadata for the list that will hold this item\n var listMetadata = levelInfo.listsMetadata[itemMetadata.wordListId];\n if (!listMetadata) {\n // Get the first item fake bullet.. This will be used later to check what is the right type of list\n var firstFakeBullet = getFakeBulletText(node, LOOKUP_DEPTH);\n // This is a the first item of a list.. We'll create the list metadata using the information\n // we already have from this first item\n listMetadata = {\n numberOfItems: 0,\n uniqueListId: wordConverter.nextUniqueId++,\n firstFakeBullet: firstFakeBullet,\n // If the bullet we got is emtpy or not found, we ignore the list out.. this means\n // that this is not an item we need to convert of that the format doesn't match what\n // we are expecting\n ignore: !firstFakeBullet || firstFakeBullet.length == 0,\n // We'll use the first fake bullet to try to figure out which type of list we create. If this list has a second\n // item, we'll perform a better comparasion, but for one item lists, this will be check that will determine the list type\n tagName: getFakeBulletTagName(firstFakeBullet),\n };\n levelInfo.listsMetadata[itemMetadata.wordListId] = listMetadata;\n args.lists[listMetadata.uniqueListId.toString()] = listMetadata;\n }\n else if (!listMetadata.ignore && listMetadata.numberOfItems == 1) {\n // This is the second item we've seen for this list.. we'll compare the 2 fake bullet\n // items we have an decide if we create ordered or unordered lists based on this.\n // This is the best way we can do this since we cannot read the metadata that Word\n // puts in the head of the HTML...\n var secondFakeBullet = getFakeBulletText(node, LOOKUP_DEPTH);\n listMetadata.tagName =\n listMetadata.firstFakeBullet == secondFakeBullet ? 'UL' : 'OL';\n }\n // Set the unique id to the list\n itemMetadata.uniqueListId = listMetadata.uniqueListId;\n // Check if we need to ignore this list... we'll either know already that we need to ignore\n // it, or we'll know it because the previous list items are not next to this one\n if (listMetadata.ignore ||\n (listMetadata.tagName == 'OL' &&\n listMetadata.numberOfItems > 0 &&\n levelInfo.currentUniqueListId != itemMetadata.uniqueListId)) {\n // We need to ignore this item... and we also need to forget about the lists that\n // are not at the root level\n listMetadata.ignore = true;\n args.currentListIdsByLevels[0].currentUniqueListId = -1;\n args.currentListIdsByLevels = args.currentListIdsByLevels.slice(0, 1);\n }\n else {\n // This is an item we don't need to ignore... If added lists deep under this one before\n // we'll drop their ids from the list of ids per level.. this is because this list item\n // breaks the deeper lists.\n if (args.currentListIdsByLevels.length > itemMetadata.level) {\n args.currentListIdsByLevels = args.currentListIdsByLevels.slice(0, itemMetadata.level);\n }\n levelInfo.currentUniqueListId = itemMetadata.uniqueListId;\n // Add the list item into the list of items to be processed\n args.listItems.push(itemMetadata);\n listMetadata.numberOfItems++;\n }\n args.lastProcessedItem = node;\n }\n else {\n // Here, we know that this is not a list item, but we'll want to check if it is one \"no bullet\" list items...\n // these can be created by creating a bullet and hitting delete on it it... The content will continue to be indented, but there will\n // be no bullet and the list will continue correctly after that. Visually, it looks like the previous item has multiple lines, but\n // the HTML generated has multiple paragraphs with the same class. We'll merge these when we find them, so the logic doesn't skips\n // the list conversion thinking that the list items are not together...\n var last = args.lastProcessedItem;\n if (last &&\n getRealPreviousSibling(node) == last &&\n node.tagName == last.tagName &&\n node.className == last.className) {\n // Add 2 line breaks and move all the nodes to the last item\n last.appendChild(last.ownerDocument.createElement('br'));\n last.appendChild(last.ownerDocument.createElement('br'));\n while (node.firstChild != null) {\n last.appendChild(node.firstChild);\n }\n // Remove the item that we don't need anymore\n node.parentNode.removeChild(node);\n }\n }\n // Move to the next element are return true if more elements need to be processed\n args.currentIndex++;\n }\n return args.listItems.length > 0;\n}",
"levels(root){\n if (root == null){\n return 0\n }else{\n return 1 + Math.max(this.levels(root.nodeL),this.levels(root.nodeL))\n }\n }",
"get listText() {\n let listFormat = undefined;\n let list = this.viewer.getListById(this.listId);\n if (list instanceof WList && this.listLevelNumberIn > -1 && this.listLevelNumberIn < 9) {\n let listLevel = list.getListLevel(this.listLevelNumber);\n if (listLevel instanceof WListLevel) {\n if (listLevel.listLevelPattern === 'Bullet') {\n listFormat = listLevel.numberFormat;\n }\n else {\n listFormat = listLevel.numberFormat;\n for (let i = 0; i < 9; i++) {\n let levelPattern = '%' + (i + 1);\n if (listFormat.indexOf(levelPattern) > -1) {\n let level = i === this.listLevelNumberIn ? listLevel : list.getListLevel(i);\n let listTextElement = this.selection.getListTextElementBox(this.selection.start.paragraph);\n let listText = listTextElement ? listTextElement.text : '';\n listFormat = listText;\n }\n }\n }\n }\n }\n return listFormat;\n }",
"function processList(ul) {\n if (!ul.childNodes || ul.childNodes.length == 0) { return; }\n // Iterate LIs\n var childNodesLength = ul.childNodes.length;\n for (var itemi = 0; itemi < childNodesLength; itemi++) {\n var item = ul.childNodes[itemi];\n if (item.nodeName == \"LI\") {\n // Iterate things in this LI\n var subLists = false;\n var itemChildNodesLength = item.childNodes.length;\n for (var sitemi = 0; sitemi < itemChildNodesLength; sitemi++) {\n var sitem = item.childNodes[sitemi];\n if (sitem.nodeName == \"UL\") {\n subLists = true;\n processList(sitem);\n }\n }\n var s = document.createElement(\"SPAN\");\n var t = '\\u00A0'; // \n s.className = nodeLinkClass;\n if (subLists) {\n // This LI has UL's in it, so it's a +/- node\n if (item.className == null || item.className == \"\") {\n item.className = nodeClosedClass;\n }\n // If it's just text, make the text work as the link also\n if (item.firstChild.nodeName == \"#text\") {\n t = t + item.firstChild.nodeValue;\n item.removeChild(item.firstChild);\n }\n s.onclick = treeNodeOnclick;\n }\n else {\n // No sublists, so it's just a bullet node\n item.className = nodeBulletClass;\n s.onclick = retFalse;\n }\n s.appendChild(document.createTextNode(t));\n item.insertBefore(s, item.firstChild);\n }\n }\n }",
"function xWalkUL(oUL,data,fn)\r\n{\r\n var r, ul, li = xFirstChild(oUL);\r\n while (li) {\r\n ul = xFirstChild(li,'ul');\r\n r = fn(oUL,li,ul,data);\r\n if (ul) {\r\n if (!r || !xWalkUL(ul,data,fn)) {return 0;};\r\n }\r\n li = xNextSib(li);\r\n }\r\n return 1;\r\n}",
"function processList(ul) {\n if (!ul.childNodes || ul.childNodes.length==0) { return; }\n // Iterate LIs\n var childNodesLength = ul.childNodes.length;\n for (var itemi=0;itemi<childNodesLength;itemi++) {\n var item = ul.childNodes[itemi];\n item = $(item);\n if (item.nodeName == \"LI\") {\n // Iterate things in this LI\n var subLists = false;\n var itemChildNodesLength = item.childNodes.length;\n for (var sitemi=0;sitemi<itemChildNodesLength;sitemi++) {\n var sitem = item.childNodes[sitemi];\n if (sitem.nodeName==\"UL\") {\n subLists = true;\n processList(sitem);\n }\n }\n var s= document.createElement(\"SPAN\");\n var t= '\\u00A0'; // \n s.className = nodeLinkClass;\n if (subLists) {\n // This LI has UL's in it, so it's a +/- node\n //if (item.className==null || item.className==\"\") {\n if (!item.hasClass(nodeClosedClass)) {\n item.addClass(nodeClosedClass);\n }\n // If it's just text, make the text work as the link also\n if (item.firstChild.nodeName==\"#text\") {\n t = t+item.firstChild.nodeValue;\n item.removeChild(item.firstChild);\n }\n s.onclick = treeNodeOnclick;\n }\n else {\n // No sublists, so it's just a bullet node\n item.addClass(nodeBulletClass);\n s.onclick = retFalse;\n }\n s.appendChild(document.createTextNode(t));\n item.insertBefore(s,item.firstChild);\n }\n }\n}",
"function scanLevel(element){if(element){for(var i=0,len=element.length;i<len;i++){if(element[i].nodeName.toLowerCase()===nodeName){return element[i];}}}return null;}",
"function mt(e){var t=null,i=e;if(i.liDom.previousSibling){var n=gt(i.liDom.previousSibling);t=n||i.liDom.previousSibling.node}else t=i.parent;return t}",
"get levels() {\n return this.getNodeByVariableCollectionId('levels').variableCollection;\n }",
"function getLevel(){\n return level\n}",
"function isListContent(node) {\n return ListItem_1.isListItem(node);\n}"
] | [
"0.6671859",
"0.6670137",
"0.63771504",
"0.621316",
"0.61555356",
"0.57949203",
"0.57655865",
"0.57128376",
"0.5696541",
"0.5672241",
"0.5568159",
"0.5547469",
"0.55358106",
"0.55073684",
"0.5431245",
"0.5384732",
"0.5379493",
"0.53498167",
"0.5301591",
"0.5284614",
"0.5268219",
"0.52372193",
"0.5213167",
"0.5209525",
"0.5202185",
"0.5187021",
"0.51364917",
"0.5129644",
"0.51270175",
"0.50742346"
] | 0.84267855 | 0 |
Based on a node that is a list item in a MS Word document, this returns the marker for the list. | function msWordListMarker (node, bulletListMarker) {
const markerElement = node.querySelector('span[style="mso-list:Ignore"]')
// assume the presence of a period in a marker is an indicator of an
// ordered list
if (!markerElement || !markerElement.textContent.match(/\./)) {
return bulletListMarker
}
const nodeLevel = getMsWordListLevel(node)
let item = 1
let potentialListItem = node.previousElementSibling
// loop through previous siblings to count list items
while (potentialListItem) {
const itemLevel = getMsWordListLevel(potentialListItem)
// if there are no more list items or we encounter the lists parent
// we don't need to count further
if (!itemLevel || itemLevel < nodeLevel) {
break
}
// if on same level increment the list items
if (nodeLevel === itemLevel) {
item += 1
}
potentialListItem = potentialListItem.previousElementSibling
}
return `${item}.`
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getListItemMetadata(node) {\n if (node.nodeType == 1 /* Element */) {\n var listatt = getStyleValue(node, MSO_LIST_STYLE_NAME);\n if (listatt && listatt.length > 0) {\n try {\n // Word mso-list property holds 3 space separated values in the following format: lst1 level1 lfo0\n // Where:\n // (0) List identified for the metadata in the <head> of the document. We cannot read the <head> metada\n // (1) Level of the list. This also maps to the <head> metadata that we cannot read, but\n // for almost all cases, it maps to the list identation (or level). We'll use it as the\n // list indentation value\n // (2) Contains a specific list identifier.\n // Example value: \"l0 level1 lfo1\"\n var listprops = listatt.split(' ');\n if (listprops.length == 3) {\n return {\n level: parseInt(listprops[1].substr('level'.length)),\n wordListId: listatt,\n originalNode: node,\n uniqueListId: 0,\n };\n }\n }\n catch (e) { }\n }\n }\n return null;\n}",
"function listItem( node ) {\n\t\treturn node.type == CKEDITOR.NODE_ELEMENT && node.is( 'li' );\n\t}",
"function markerPoint(current) {\r\n\t\tvar $this = $(current);\r\n\t\tvar li = $($this.parents()[0]);\r\n\t\treturn new Point(parseInt(li.css('left')),parseInt(li.css('top')));\r\n\t}",
"function getMsWordListLevel (node) {\n if (node.nodeName.toLowerCase() !== 'p') {\n return\n }\n\n const style = node.getAttribute('style')\n const levelMatch = style && style.match(/mso-list/i) ? style.match(/level(\\d+)/) : null\n return levelMatch ? parseInt(levelMatch[1], 10) : undefined\n}",
"function listItem(node, parent, position, bullet, ordered) {\n var self = this\n var style = self.options.listItemIndent\n var marker = `\\\\item` || self.options.bullet // bullet\n var spread = node.spread == null ? true : node.spread\n var checked = node.checked\n var children = node.children\n var length = children.length\n var values = []\n var index = -1\n var value\n var indent\n var spacing = space\n\n while (++index < length) {\n values[index] = self.visit(children[index], node)\n }\n\n value = values.join(lineFeed)\n\n if (typeof checked === 'boolean') {\n // Note: I’d like to be able to only add the space between the check and\n // the value, but unfortunately github does not support empty list-items\n // with a checkbox :(\n value =\n (checked ? `[\\\\done] ` : ' ') +\n value\n } else {\n marker += ' '\n }\n\n indent = marker.length + 1\n\n return marker + value\n}",
"function addListElementPosition(pinIcon, type) {\n var contains = $.inArray(type, listleftMarkerArray);\n if (contains == -1) {\n listleftMarkerArray.push(type);\n $('<li><a><img src=' + pinIcon + ' class=\"ui-li-icon ui-corner-none\">' + type + '<span class=\"ui-li-count\" data-bind=\"text: '+type+'\"</a></a><a id='+type+' class=\"position\"></a></li>').appendTo('#listleftMarker');\n //refresh list\n ko.applyBindings(mapMarkerNumberNeeds);\n $('#listleftMarker').listview(\"refresh\");\n }\n }",
"function parseListMarker(parser, container) {\n var rest = parser.currentLine.slice(parser.nextNonspace);\n var match;\n var nextc;\n var data = {\n type: 'bullet',\n tight: true,\n bulletChar: '',\n start: 0,\n delimiter: '',\n padding: 0,\n markerOffset: parser.indent,\n // GFM: Task List Item\n task: false,\n checked: false,\n };\n if (parser.indent >= 4) {\n return null;\n }\n if ((match = rest.match(reBulletListMarker))) {\n data.type = 'bullet';\n data.bulletChar = match[0][0];\n }\n else if ((match = rest.match(reOrderedListMarker)) &&\n (container.type !== 'paragraph' || match[1] === '1')) {\n data.type = 'ordered';\n data.start = parseInt(match[1], 10);\n data.delimiter = match[2];\n }\n else {\n return null;\n }\n // make sure we have spaces after\n nextc = peek(parser.currentLine, parser.nextNonspace + match[0].length);\n if (!(nextc === -1 || nextc === C_TAB || nextc === C_SPACE)) {\n return null;\n }\n // if it interrupts paragraph, make sure first line isn't blank\n if (container.type === 'paragraph' &&\n !parser.currentLine.slice(parser.nextNonspace + match[0].length).match(reNonSpace)) {\n return null;\n }\n // we've got a match! advance offset and calculate padding\n parser.advanceNextNonspace(); // to start of marker\n parser.advanceOffset(match[0].length, true); // to end of marker\n var spacesStartCol = parser.column;\n var spacesStartOffset = parser.offset;\n do {\n parser.advanceOffset(1, true);\n nextc = peek(parser.currentLine, parser.offset);\n } while (parser.column - spacesStartCol < 5 && isSpaceOrTab(nextc));\n var blankItem = peek(parser.currentLine, parser.offset) === -1;\n var spacesAfterMarker = parser.column - spacesStartCol;\n if (spacesAfterMarker >= 5 || spacesAfterMarker < 1 || blankItem) {\n data.padding = match[0].length + 1;\n parser.column = spacesStartCol;\n parser.offset = spacesStartOffset;\n if (isSpaceOrTab(peek(parser.currentLine, parser.offset))) {\n parser.advanceOffset(1, true);\n }\n }\n else {\n data.padding = match[0].length + spacesAfterMarker;\n }\n return data;\n}",
"isMarker(node) {\n return node && node.nodeType === 8 && node.data.startsWith(marker);\n }",
"function skipOrderedListMarker(state, startLine) {\n var ch, start = state.bMarks[startLine] + state.tShift[startLine], pos = start, max = state.eMarks[startLine];\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) {\n return -1;\n }\n ch = state.src.charCodeAt(pos++);\n if (ch < 48 /* 0 */ || ch > 57 /* 9 */) {\n return -1;\n }\n for (;;) {\n // EOL -> fail\n if (pos >= max) {\n return -1;\n }\n ch = state.src.charCodeAt(pos++);\n if (ch >= 48 /* 0 */ && ch <= 57 /* 9 */) {\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) {\n return -1;\n }\n continue;\n }\n // found valid marker\n if (ch === 41 /* ) */ || ch === 46 /* . */) {\n break;\n }\n return -1;\n }\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n if (!isSpace$7(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n }",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace$3(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n /* istanbul ignore if */\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace$7(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}",
"function getListForItem(\n opts: Options,\n editor: Editor,\n value: Value,\n item: Block\n): ?Block {\n const { document } = value;\n const parent = document.getParent(item.key);\n return parent && isList(opts, parent) ? parent : null;\n}",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine]; // List marker should have at least 2 chars (digit + dot)\n\n if (pos + 1 >= max) {\n return -1;\n }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30\n /* 0 */\n || ch > 0x39\n /* 9 */\n ) {\n return -1;\n }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) {\n return -1;\n }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30\n /* 0 */\n && ch <= 0x39\n /* 9 */\n ) {\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) {\n return -1;\n }\n\n continue;\n } // found valid marker\n\n\n if (ch === 0x29\n /* ) */\n || ch === 0x2e\n /* . */\n ) {\n break;\n }\n\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}",
"function getMarkerId(l, inverse) {\n return (l.type ? l.type : 'normal') + l.id + (inverse ? 'inverse' : '');\n }",
"handleListItemClick(position) {\n const markers = this.state.refs.markers;\n const marker = markers.filter(marker => {\n const location = marker.props.location;\n const _position = [location.latitude, location.longitude];\n return ''+_position === ''+position\n })\n .shift();\n\n if (marker) {\n const map = this.state.refs.map;\n const listItems = this.state.refs.listItems;\n\n map.leafletElement.flyTo(position);\n\n listItems.map(listItem => this.constructor.handleListItemSelection(listItem, position));\n }\n }",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n return pos;\n }",
"function skipOrderedListMarker(state, startLine) {\n\t var ch,\n\t pos = state.bMarks[startLine] + state.tShift[startLine],\n\t max = state.eMarks[startLine];\n\n\t if (pos + 1 >= max) { return -1; }\n\n\t ch = state.src.charCodeAt(pos++);\n\n\t if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n\t for (;;) {\n\t // EOL -> fail\n\t if (pos >= max) { return -1; }\n\n\t ch = state.src.charCodeAt(pos++);\n\n\t if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\t continue;\n\t }\n\n\t // found valid marker\n\t if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n\t break;\n\t }\n\n\t return -1;\n\t }\n\n\n\t if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {\n\t // \" 1.test \" - is not a list item\n\t return -1;\n\t }\n\t return pos;\n\t}",
"function skipOrderedListMarker(state, startLine) {\n\t var ch,\n\t pos = state.bMarks[startLine] + state.tShift[startLine],\n\t max = state.eMarks[startLine];\n\n\t if (pos + 1 >= max) { return -1; }\n\n\t ch = state.src.charCodeAt(pos++);\n\n\t if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n\t for (;;) {\n\t // EOL -> fail\n\t if (pos >= max) { return -1; }\n\n\t ch = state.src.charCodeAt(pos++);\n\n\t if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\t continue;\n\t }\n\n\t // found valid marker\n\t if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n\t break;\n\t }\n\n\t return -1;\n\t }\n\n\n\t if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {\n\t // \" 1.test \" - is not a list item\n\t return -1;\n\t }\n\t return pos;\n\t}",
"function skipOrderedListMarker(state, startLine) {\n\t var ch,\n\t pos = state.bMarks[startLine] + state.tShift[startLine],\n\t max = state.eMarks[startLine];\n\n\t if (pos + 1 >= max) { return -1; }\n\n\t ch = state.src.charCodeAt(pos++);\n\n\t if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n\t for (;;) {\n\t // EOL -> fail\n\t if (pos >= max) { return -1; }\n\n\t ch = state.src.charCodeAt(pos++);\n\n\t if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\t continue;\n\t }\n\n\t // found valid marker\n\t if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n\t break;\n\t }\n\n\t return -1;\n\t }\n\n\n\t if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {\n\t // \" 1.test \" - is not a list item\n\t return -1;\n\t }\n\t return pos;\n\t}",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n return pos;\n}",
"function skipOrderedListMarker(state, startLine) {\n var ch,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n return pos;\n}"
] | [
"0.6383941",
"0.5983728",
"0.5825579",
"0.57465446",
"0.56685364",
"0.5611878",
"0.55966437",
"0.54887724",
"0.5485846",
"0.5417776",
"0.54173636",
"0.541471",
"0.54123527",
"0.54061615",
"0.54061615",
"0.54061615",
"0.54061615",
"0.54061615",
"0.54061615",
"0.54061615",
"0.54061615",
"0.5354709",
"0.5331688",
"0.5307137",
"0.5268838",
"0.52417576",
"0.52417576",
"0.52417576",
"0.52386355",
"0.52386355"
] | 0.7593762 | 0 |
Scroll to Our STORY | function scrollToStory()
{
storyText.scrollIntoView();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function work() {\n var scrollPos = $(\".case-studies\").offset().top - 80;\n TweenLite.to(window, 2, {scrollTo: {y: scrollPos}, ease: Power2.easeOut});\n }",
"function goToWidget(id) {\n document.getElementById(id).scrollIntoView({\n behavior: 'smooth'\n });\n }",
"function goToSection(_sectionName,offest){\n var section = document.getElementById(_sectionName) ;\n gsap.to(window, {duration: 1 , scrollTo: {y: section.offsetTop-offest}});\n\n}",
"function navigate_to(id){\n\t\t\t$('html, body').animate({scrollTop: $(\".section\"+id).offset().top}, 500);\n\t}",
"function goToByScroll(where){\n\t$('html,body').animate({scrollTop: where.offset().top},'slow');\n}",
"function projectSection() {\n window.scrollTo({ top: 2250, behavior: 'smooth' })\n}",
"function scrollTO(section) {\n section.scrollIntoView();\n}",
"function goToByScroll(id) {\n $('html,body').animate({scrollTop: $(id).offset().top - 70}, 'slow');\n }",
"function goToByScroll(id) {\n $('html,body').animate({scrollTop: $(id).offset().top - 70}, 'slow');\n }",
"scrollToTitle() {\n let $self = $(`#${this.idDOM}`);\n\n $('html, body').animate({\n scrollTop: $self.find('.article-big-category').offset().top\n }, 1000);\n }",
"function goToLondon(){\n\tvar position = findPos(document.getElementById(\"London\"));\n\teasingScrollAction(position,2000);\n}",
"function goToByScroll(dataslide) {\n htmlbody.animate({\n scrollTop:$('.slide[data-slide=\"' + dataslide + '\"]').offset().top\n }, 2000, 'easeInOutQuint');\n }",
"function goToByScroll(dataslide) {\n htmlbody.animate({\n scrollTop: $('.slide[data-slide=\"' + dataslide + '\"]').offset().top\n }, 2000, 'easeInOutQuint');\n }",
"function goToByScroll(dataslide) {\n htmlbody.animate({\n scrollTop: $('.slide[data-slide=\"' + dataslide + '\"]').offset().top\n }, 2000, 'easeInOutQuint');\n }",
"function goToByScroll(dataslide) {\n htmlbody.animate({\n scrollTop: $('.slide[data-slide=\"' + dataslide + '\"]').offset().top\n }, 2000, 'easeInOutQuint');\n }",
"function scroll() {\n\t\telement.scrollIntoView({behavior: \"smooth\"});\n\t\t\n\t}",
"function scrollTo( id ) {\n scroller.scrollTo( id );\n}",
"function goToByScroll(dataslide) {\n htmlbody.animate({\n scrollTop: $('.slide[data-slide=\"' + dataslide + '\"]').offset().top\n }, 2000, 'easeInOutQuint');\n }",
"function topFunction() {\r\n const topsy = document.querySelector(\"#section1\");\r\n topsy.scrollIntoView({ behavior: \"smooth\" });\r\n}",
"function scrollToTopBookNow() {\n\t\t\t//$(window).scrollTop($('.scrolltobooknow').offset().top);\n\t\t\tdocument.getElementById('scrolltobooknow').scrollIntoView(true);\n\t\t}",
"pageScrollTo(){\n let element = document.getElementById( App.current_page );\n \n //scroll to the particular section of the page.\n if( element ){\n element.scrollIntoView({behavior: 'smooth'});\n }\n }",
"function scrollToGame() {\n var element_to_scroll_to = $('.example-gameplay')[0];\n element_to_scroll_to.scrollIntoView();\n }",
"function scrollToShowMe(oid) {\n obj = document.getElementById(oid);\n if (obj != null) {\n obj.scrollIntoView(true);\n obj.focus();\n }\n}",
"function scrollToBio() {\n TweenLite.to(window, 0.5, {\n scrollTo: { y: `.bio-wrapper`, offsetY: 20 }\n });\n }",
"function goToTokyo (){\n\tvar position = findPos(document.getElementById(\"Tokyo\"));\n\teasingScrollAction(position,2000);\n}",
"function scrollTo( dest ) {\n $('html, body').animate({\n \tscrollTop: $( dest ).offset().top\n },750);\n}",
"function scrollTo() {\n $('a.scroll').on(action, function() {\n if (location.pathname.replace(/^\\//, '') === this.pathname.replace(/^\\//, '') && location.hostname === this.hostname) {\n var target = $(this.hash);\n target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');\n if (target.length) {\n $('html,body').animate({\n scrollTop: target.offset().top\n }, 500);\n return false;\n }\n }\n });\n }",
"function scrollTo() {\n $('a.scroll').on(action, function() {\n if (location.pathname.replace(/^\\//, '') === this.pathname.replace(/^\\//, '') && location.hostname === this.hostname) {\n var target = $(this.hash);\n target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');\n if (target.length) {\n $('html,body').animate({\n scrollTop: target.offset().top\n }, 500);\n return false;\n }\n }\n });\n }",
"function gotoTop() {\n $anchorScroll('add-new-student-button');\n }",
"function swoopTo(position){\n\t\t$('html, body').stop().animate({\n scrollTop: position\n }, 1000);\n\t}"
] | [
"0.6868092",
"0.66545063",
"0.6495838",
"0.64606917",
"0.64475346",
"0.64205945",
"0.64086664",
"0.63724476",
"0.63724476",
"0.6349916",
"0.63439167",
"0.63286847",
"0.63221884",
"0.63221884",
"0.63221884",
"0.63145316",
"0.63108826",
"0.6302561",
"0.63000506",
"0.6259576",
"0.62502044",
"0.6229988",
"0.6201478",
"0.6187519",
"0.6152115",
"0.614828",
"0.6144399",
"0.6144399",
"0.61321884",
"0.61238784"
] | 0.76658046 | 0 |
aborts the execution with the specified error message | function abort(message) {
util.error(message);
process.exit(1);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"abort() {\n }",
"abort () {\n // ...\n }",
"function abort(what) {\n if (Module['onAbort']) {\n Module['onAbort'](what);\n }\n\n what += '';\n out(what);\n err(what);\n\n ABORT = true;\n EXITSTATUS = 1;\n\n var output = 'abort(' + what + ') at ' + stackTrace();\n what = output;\n\n // Throw a wasm runtime error, because a JS error might be seen as a foreign\n // exception, which means we'd run destructors on it. We need the error to\n // simply make the program stop.\n throw new WebAssembly.RuntimeError(what);\n}",
"abort() {\n this.aborted = true;\n requestErrorSteps(this);\n updateReadyState(this, FakeXMLHttpRequest.UNSENT);\n }",
"function error(message) {\n\talert('Error occured, unable to proceed.');\n\tthrow Error(message);\n}",
"function setFailed(message) {\r\n process.exitCode = ExitCode.Failure;\r\n error(message);\r\n}",
"function setFailed(message) {\r\n process.exitCode = ExitCode.Failure;\r\n error(message);\r\n}",
"onabort() {}",
"async abort() {\n return;\n }",
"function abort() {\r\n console.log.apply(null, arguments);\r\n program.help();\r\n process.exit(1);\r\n}",
"abort() {\n abortSignal(getSignal(this));\n }",
"abort() {\n abortSignal(getSignal(this));\n }",
"function exitWithArgError(message)\n{\n\tprint(\"ERROR: \" + message);\n\tprint();\n\n\tprintHelp();\n\n\tdelete testEnv;\n\tjava.lang.System.exit(1);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}",
"function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}"
] | [
"0.73568654",
"0.7273281",
"0.66536456",
"0.6487658",
"0.64087343",
"0.64084333",
"0.64084333",
"0.6369309",
"0.6358718",
"0.63555205",
"0.6352029",
"0.6352029",
"0.6335197",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655"
] | 0.7767521 | 0 |
align modifiers like time signature for vertical staves with different key signatures / time signature xs This method should be static, but that makes using it with `any` usage more difficult. | formatBegModifiers(staves) {
let maxX = 0;
// align note start
staves.forEach((stave) => {
if (stave.getNoteStartX() > maxX) maxX = stave.getNoteStartX();
});
staves.forEach((stave) => {
stave.setNoteStartX(maxX);
});
maxX = 0;
// align REPEAT_BEGIN
staves.forEach((stave) => {
const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, Barline.CATEGORY);
modifiers.forEach((modifier) => {
if (modifier.getType() == Barline.type.REPEAT_BEGIN)
if (modifier.getX() > maxX) maxX = modifier.getX();
});
});
staves.forEach((stave) => {
const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, Barline.CATEGORY);
modifiers.forEach((modifier) => {
if (modifier.getType() == Barline.type.REPEAT_BEGIN) modifier.setX(maxX);
});
});
maxX = 0;
// Align time signatures
staves.forEach((stave) => {
const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, TimeSignature.CATEGORY);
modifiers.forEach((modifier) => {
if (modifier.getX() > maxX) maxX = modifier.getX();
});
});
staves.forEach((stave) => {
const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, TimeSignature.CATEGORY);
modifiers.forEach((modifier) => {
modifier.setX(maxX);
});
});
// Align key signatures
// staves.forEach((stave) => {
// const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, KeySignature.CATEGORY);
// modifiers.forEach((modifier) => {
// if (modifier.getX() > maxX) maxX = modifier.getX();
// });
// });
// staves.forEach((stave) => {
// const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, KeySignature.CATEGORY);
// modifiers.forEach((modifier) => {
// modifier.setX(maxX);
// });
// });
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"set alignment(value) {}",
"get alignment() {}",
"function parseAlign(alignSpec) {\n const parts = alignSpecRe.exec(alignSpec),\n myOffset = parseInt(parts[2] || 50),\n targetOffset = parseInt(parts[4] || 50); // Comments assume the Menu's alignSpec of l0-r0 is used.\n\n return {\n myAlignmentPoint: parts[1] + myOffset,\n // l0\n myEdge: parts[1],\n // l\n myOffset,\n // 0\n targetAlignmentPoint: parts[3] + targetOffset,\n // r0\n targetEdge: parts[3],\n // r\n targetOffset,\n // 0\n startZone: edgeIndices[parts[3]] // 1 - start trying zone 1 in TRBL order\n\n };\n} // Takes a result from the above function and flips edges for the axisLock config",
"_getExpectedAlign() {\n const align = this.isRtl ? this._replaceAlignDir(this.align, /l|r/g, { l: 'r', r: 'l' }) : this.align;\n const expectedAlign = [align];\n if (this.needAdjust) {\n if (/t|b/g.test(align)) {\n expectedAlign.push(this._replaceAlignDir(align, /t|b/g, { t: 'b', b: 't' }));\n }\n if (/l|r/g.test(align)) {\n expectedAlign.push(this._replaceAlignDir(align, /l|r/g, { l: 'r', r: 'l' }));\n }\n if (/c/g.test(align)) {\n expectedAlign.push(this._replaceAlignDir(align, /c(?= |$)/g, { c: 'l' }));\n expectedAlign.push(this._replaceAlignDir(align, /c(?= |$)/g, { c: 'r' }));\n }\n expectedAlign.push(\n this._replaceAlignDir(align, /l|r|t|b/g, {\n l: 'r',\n r: 'l',\n t: 'b',\n b: 't',\n })\n );\n }\n return expectedAlign;\n }",
"function posAlign(thisNumArms) {\n switch (thisNumArms) { // position numbers setting\n case 2:\n // | screen | Stage(left) - a - | Door1 - b - | background - x - | ...\n leftMar = (document.body.clientWidth - thisWidth) / 2;\n a = thisWidth / 4;\n b = thisWidth / 9;\n hm = b * 1.25;\n x = (thisWidth - 2 * a - 2 * b);\n h = [thisHeight * 0.5];\n\n posLeft = [leftMar + a, leftMar + a + b + x];\n posTop = [h[0], h[0]];\n break;\n\n case 4:\n // | screen | Stage(left) - a - | Door1 - b - | background - x - | ...\n leftMar = (document.body.clientWidth - thisWidth) / 2;\n a = thisWidth / 6;\n b = thisWidth / 9;\n hm = b * 1.25;\n x = (thisWidth - 2 * a - 4 * b) / 3;\n h = [thisHeight * 0.5];\n\n posLeft = [leftMar + a, leftMar + a + b + x, leftMar + a + 2 * (b + x), leftMar + a + 3 * (b + x)];\n posTop = [h[0], h[0], h[0], h[0]];\n break;\n\n case 8:\n // | screen | Stage(left) - a - | Door1 - b - | background - x - | ...\n leftMar = (document.body.clientWidth - thisWidth) / 2;\n a = thisWidth / 6;\n b = thisWidth / 9;\n hm = b * 1.25;\n x = (thisWidth - 2 * a - 4 * b) / 3;\n h = [thisHeight * 0.35, thisHeight * 0.7];\n\n posLeft = [leftMar + a, leftMar + a + b + x, leftMar + a + 2 * (b + x), leftMar + a + 3 * (b + x),\n leftMar + a, leftMar + a + b + x, leftMar + a + 2 * (b + x), leftMar + a + 3 * (b + x)];\n posTop = [h[0], h[0], h[0], h[0], h[1], h[1], h[1], h[1]];\n break;\n };\n }",
"function alignStream(lastFrag,lastLevel,details){alignDiscontinuities(lastFrag,details,lastLevel);if(!details.PTSKnown&&lastLevel){// If the PTS wasn't figured out via discontinuity sequence that means there was no CC increase within the level.\n// Aligning via Program Date Time should therefore be reliable, since PDT should be the same within the same\n// discontinuity sequence.\nalignPDT(details,lastLevel.details);}}",
"function fixAlignment(value) {\n return (2 * value) - 1;\n}",
"addAlign(tag) {\n return this.onChange(RichUtils.toggleBlockType(this.state.editorState, tag))\n }",
"_justify() {\n let hIx = 0;\n let left = 0;\n let minx = 0;\n let maxx = 0;\n let lvl = 0;\n let maxwidth = 0;\n let runningWidth = 0;\n let runningHeight = 0;\n if (!this.inlineBlocks.length) {\n return;\n }\n minx = this.inlineBlocks[0].text.startX;\n // We justify relative to first block x/y.\n const initialX = this.inlineBlocks[0].text.startX;\n const initialY = this.inlineBlocks[0].text.startY;\n const vert = {};\n this.inlineBlocks.forEach((inlineBlock) => {\n const block = inlineBlock.text;\n const blockBox = block.getLogicalBox();\n // If this is a horizontal positioning, reset to first blokc position\n //\n if (hIx > 0) {\n block.startX = initialX;\n block.startY = initialY;\n }\n minx = block.startX < minx ? block.startX : minx;\n maxx = (block.startX + blockBox.width) > maxx ? block.startX + blockBox.width : maxx;\n\n lvl = inlineBlock.position === SmoTextGroup.relativePositions.ABOVE ? lvl + 1 : lvl;\n lvl = inlineBlock.position === SmoTextGroup.relativePositions.BELOW ? lvl - 1 : lvl;\n if (inlineBlock.position === SmoTextGroup.relativePositions.RIGHT) {\n block.startX += runningWidth;\n if (hIx > 0) {\n block.startX += this.spacing;\n }\n }\n if (inlineBlock.position === SmoTextGroup.relativePositions.LEFT) {\n if (hIx > 0) {\n block.startX = minx - blockBox.width;\n minx = block.startX;\n block.startX -= this.spacing;\n }\n }\n if (inlineBlock.position === SmoTextGroup.relativePositions.BELOW) {\n block.startY += runningHeight;\n if (hIx > 0) {\n block.startY += this.spacing;\n }\n }\n if (inlineBlock.position === SmoTextGroup.relativePositions.ABOVE) {\n block.startY -= runningHeight;\n if (hIx > 0) {\n block.startY -= this.spacing;\n }\n }\n if (!vert[lvl]) {\n vert[lvl] = {};\n vert[lvl].blocks = [block];\n vert[lvl].minx = block.startX;\n vert[lvl].maxx = block.startX + blockBox.width;\n maxwidth = vert[lvl].width = blockBox.width;\n } else {\n vert[lvl].blocks.push(block);\n vert[lvl].minx = vert[lvl].minx < block.startX ? vert[lvl].minx : block.startX;\n vert[lvl].maxx = vert[lvl].maxx > (block.startX + blockBox.width) ?\n vert[lvl].maxx : (block.startX + blockBox.width);\n vert[lvl].width += blockBox.width;\n maxwidth = maxwidth > vert[lvl].width ? maxwidth : vert[lvl].width;\n }\n runningWidth += blockBox.width;\n runningHeight += blockBox.height;\n hIx += 1;\n block.updatedMetrics = false;\n });\n\n const levels = Object.keys(vert);\n\n // Horizontal justify the vertical blocks\n levels.forEach((level) => {\n const vobj = vert[level];\n if (this.justification === SmoTextGroup.justifications.LEFT) {\n left = minx - vobj.minx;\n } else if (this.justification === SmoTextGroup.justifications.RIGHT) {\n left = maxx - vobj.maxx;\n } else {\n left = (maxwidth / 2) - (vobj.width / 2);\n left += minx - vobj.minx;\n }\n vobj.blocks.forEach((block) => {\n block.offsetStartX(left);\n });\n });\n }",
"function alignStream(lastFrag, lastLevel, details) {\n alignDiscontinuities(lastFrag, details, lastLevel);\n if (!details.PTSKnown && lastLevel) {\n // If the PTS wasn't figured out via discontinuity sequence that means there was no CC increase within the level.\n // Aligning via Program Date Time should therefore be reliable, since PDT should be the same within the same\n // discontinuity sequence.\n alignPDT(details, lastLevel.details);\n }\n}",
"function updateAlignment(v) {\n xss[alignment][v] += shift[alignment];\n }",
"function $AvaN$var$_tr_align(s) {\n $AvaN$var$send_bits(s, $AvaN$var$STATIC_TREES << 1, 3);\n $AvaN$var$send_code(s, $AvaN$var$END_BLOCK, $AvaN$var$static_ltree);\n $AvaN$var$bi_flush(s);\n}",
"alignText(alignment) {\n this.context.textAlign = alignment;\n }",
"emitModifiers(modifiers, implicitModifiers = []) {\n if (modifiers.length === 0) {\n return;\n }\n Modifier_1.ModifierOrder.forEach(m => {\n if (modifiers.includes(m) && !implicitModifiers.includes(m)) {\n this.emit(m).emit(' ');\n }\n });\n }",
"function alignCoordinates(xss,alignTo){var alignToVals=_.values(alignTo),alignToMin=_.min(alignToVals),alignToMax=_.max(alignToVals);_.forEach([\"u\",\"d\"],function(vert){_.forEach([\"l\",\"r\"],function(horiz){var alignment=vert+horiz,xs=xss[alignment],delta;if(xs===alignTo)return;var xsVals=_.values(xs);delta=horiz===\"l\"?alignToMin-_.min(xsVals):alignToMax-_.max(xsVals);if(delta){xss[alignment]=_.mapValues(xs,function(x){return x+delta})}})})}",
"function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}",
"function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}",
"function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}",
"function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}",
"function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}",
"function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}",
"function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}",
"function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t }",
"function alignmentFromString(custom, align) {\n align.split(separator).forEach(function (str) {\n var value = str.trim();\n switch (value) {\n case 'left':\n case 'center':\n case 'right':\n custom.hAlign = value;\n break;\n case 'top':\n case 'middle':\n case 'bottom':\n custom.vAlign = value;\n break;\n case 'slice':\n case 'crop':\n custom.slice = true;\n break;\n case 'meet':\n custom.slice = false;\n }\n });\n}",
"function calculateModifiers() {\n\tfor(let i = 0; i < 6; i++){\n\t\tlet mod = Math.floor((abilityScore[i]-10)/2);\n\t\tmodArray.splice(i, 1, mod);\n\t\tif (mod > 0) {\n\t\t\tmodVArray.splice(i, 1, \"+\");\n\t\t\tmodVArray2.splice(i, 1, \"+\");\n\t\t}\n\t\telse if (mod < 0) {\n\t\t\tmodVArray.splice(i, 1, \" \");\n\t\t\tmodVArray2.splice(i, 1, \"\");\n\t\t}\n\t\telse {\n\t\t\tmodVArray.splice(i, 1, \" \");\n\t\t\tmodVArray2.splice(i, 1, \" \");\n\t\t}\t\n\t}\n}",
"function alignmentFromString(custom, align) {\n align.split(separator).forEach((str) => {\n const value = str.trim();\n switch (value) {\n case 'left':\n case 'center':\n case 'right':\n custom.hAlign = value;\n break;\n case 'top':\n case 'middle':\n case 'bottom':\n custom.vAlign = value;\n break;\n case 'slice':\n case 'crop':\n custom.slice = true;\n break;\n case 'meet':\n custom.slice = false;\n }\n });\n}",
"function switchAlignment()\n{\n\t//Get array of all elements\n\tvar allElements = document.getElementsByTagName(\"P\");\n\tvar arrayOfElements = Array.prototype.slice.call(allElements);\n\t//Go through all elements, altering alignments\n\tfor(var i = 0; i < arrayOfElements.length; i++)\n\t{\n\t\t//If no textAlign property exists, set it to be explicitly left justified\n\t\tif(!arrayOfElements[i].style.textAlign)\n\t\t\tarrayOfElements[i].style.textAlign = 'left';\n\n\t\t//Make everything right justified, except for things already right justified,\n\t\t//which we will make left justified.\n\t\tswitch(arrayOfElements[i].style.textAlign)\n\t\t{\n\t\t\tcase 'left':\n\t\t\t\tarrayOfElements[i].style.textAlign = 'right';\n\t\t\t\tbreak;\n\t\t\tcase 'center':\n\t\t\t\tarrayOfElements[i].style.textAlign = 'right';\n\t\t\t\tbreak;\n\t\t\tcase 'right':\n\t\t\t\tarrayOfElements[i].style.textAlign = 'left';\n\t\t\t\tbreak;\n\t\t\tcase 'justify':\n\t\t\t\tarrayOfElements[i].style.textAlign = 'right';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tarrayOfElements[i].style.textAlign = 'right';\n\t\t\t\tbreak;\n\t\t}\n\n\n\t}\n}",
"function _tr_align(s) {\n\t send_bits(s, STATIC_TREES<<1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}",
"function _tr_align(s) {\n\t send_bits(s, STATIC_TREES<<1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}",
"function _tr_align(s){send_bits(s,STATIC_TREES<<1,3);send_code(s,END_BLOCK,static_ltree);bi_flush(s);}"
] | [
"0.58732045",
"0.53072876",
"0.51479733",
"0.5048906",
"0.5013621",
"0.49928164",
"0.49863285",
"0.4961542",
"0.49455246",
"0.49009168",
"0.48984364",
"0.48505536",
"0.4820889",
"0.48134044",
"0.47912028",
"0.47906253",
"0.47906253",
"0.47906253",
"0.47906253",
"0.47906253",
"0.47906253",
"0.47906253",
"0.47883165",
"0.47711566",
"0.47682273",
"0.47628015",
"0.4754695",
"0.4754521",
"0.4754521",
"0.47492284"
] | 0.68977565 | 0 |
This returns the y for the center of a staff line | getYForLine(line) {
const options = this.options;
const spacing = options.spacing_between_lines_px;
const headroom = options.space_above_staff_ln;
const y = this.y + (line * spacing) + (headroom * spacing);
return y;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get_line_y(c) {\n\treturn 94 + c * 75;\n}",
"function getCenterY()/*:Number*/ {\n return this.getUpperY() + this.getMyHeight() / 2;\n }",
"function get_point_y(c) {\n\treturn 94 + c * 75;\n}",
"function getOriginY() {\n\t\treturn Math.min(this.originY, this.finalY);\n\t}",
"function d4_svg_lineY(d) {\n return d[1];\n}",
"function findTrueYCoord(y){\n var yCoord = firstDotYPos + (y * yDistBetweenDots);\n return yCoord;\n}",
"function obtenerPosInicialY(){\n return (parseFloat(ball.style.top)*tablero.clientHeight/100);\n}",
"function d3_svg_lineY(d) {\n return d[1];\n}",
"function d3_svg_lineY(d) {\n return d[1];\n}",
"function d3_svg_lineY(d) {\n return d[1];\n}",
"function d3_v3_svg_lineY(d) {\n return d[1];\n}",
"function lastY() { return (segments.length == 0) ? 0 : segments[segments.length-1].p2.w.y; }",
"yFromScreenBasis(y) {\n return y / this.params.sy * this.smallestScreenEdge() - this.canvas.centre[1]\n }",
"function findYCoord(y){\n var yCoord;\n var yAdjustment = y - firstDotYPos;\n \n //if y touch coord is equal to or less than firstDotYPos y coord is 0\n if(yAdjustment <= 0){\n yCoord = 0;\n }\n //else if y coord is equal to or greater than last row y coord is the last row\n else if(yAdjustment / yDistBetweenDots >= (numOfRows - 1) ){\n yCoord = numOfRows -1;\n }\n //else work out the value for the y coord based on the touch coord given\n else {\n yCoord = yAdjustment / yDistBetweenDots;\n }\n \n //return the xCoord value\n return yCoord;\n}",
"function labelY() {\n const l = d3.select(this.parentNode).select('line');\n return parseInt(l.attr('y1')) - 20;\n}",
"getSliderCentreY() {\n return this.sliderBoundingRect.current.getBoundingClientRect().top + (this.sliderBoundingRect.current.getBoundingClientRect().height / 2);\n }",
"function lineMidpoint(line){\n return [(line[0][0] + line[1][0]) / 2, (line[0][1] + line[1][1]) / 2];\n }",
"getY() {\n\t\treturn ( 800 - this.ty ) * 32 + terrain.getYOffset( game.tyoff );\n\t}",
"function lastY() { return (segments.length == 0) ? 0 : segments[segments.length-1].p2.world.y; }",
"function get_text_y(c) {\n\treturn 119 + 75 * c;\n}",
"getLineLengthBetweenPoints (x, y, x0, y0){\n return Math.sqrt((x -= x0) * x + (y -= y0) * y);\n }",
"function computeY (y) {\n const mag = me.magnification / 100\n return decimalRound((-y + me.element.el.offsetTop + (me.height / 2)) / mag, 2)\n }",
"get Center() { return [this.x1 + (0.5 * this.x2 - this.x1), this.y1 + (0.5 * this.y2 - this.y1)]; }",
"get Center() { return [this.x1 + (0.5 * this.x2 - this.x1), this.y1 + (0.5 * this.y2 - this.y1)]; }",
"get startY() {\n if(!this._startY) {\n if(this.isVertical)\n this._startY = UNIT_PIXELS_V_START_Y;\n else\n this._startY = UNIT_PIXELS_H_START_Y;\n this._startY *= this.scale;\n }\n return this._startY;\n }",
"function yOnCanvas(y){\r\n\treturn sciMonk.CanvasHeight - (sciMonk.CanvasHeight/sciMonk.Height)*y;\r\n}",
"function lineLength(x, y, x0, y0){\n return Math.sqrt((x -= x0) * x + (y -= y0) * y);\n}",
"horzLineAt (y) { return this._horz[this.horzIdxAt(y)] }",
"private_getChipYStart()\n\t{\n\t\tlet y = this.coords.y - this.radius;\n\t\treturn y;\n\t}",
"y() {\n\t\t\treturn this.data.y;\n\t\t}"
] | [
"0.73848116",
"0.72168785",
"0.700793",
"0.6577882",
"0.6486009",
"0.6479815",
"0.6423857",
"0.6405464",
"0.6405464",
"0.6405464",
"0.63861865",
"0.63235414",
"0.63163394",
"0.6313648",
"0.62426716",
"0.6235886",
"0.62303513",
"0.62129",
"0.6207007",
"0.6193924",
"0.61735964",
"0.61698407",
"0.61534274",
"0.61534274",
"0.6135418",
"0.6131234",
"0.61274546",
"0.61212486",
"0.6107168",
"0.6092947"
] | 0.7668172 | 0 |
delete transaction by id | function deleteTransactionById(_id) {
return TransactionModel.deleteOne({ _id }).exec();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteTransaction(id) {\n transaction.deleteTransaction(id)\n .then(res => loadTransactions())\n .catch(err => console.log(err));\n }",
"function deleteTransaction(id) {\n transactions = transactions.filter( transaction => transaction.id != id );\n init();\n}",
"function deleteTransaction (id){\n dispatch({\n type:'DELETE_TRANSACTION',\n payload: id\n });\n }",
"function deleteTransaction(id) {\n dispatch({\n type: \"DELETE_TRANSACTION\",\n payload: id\n });\n }",
"function DeleteTransaction(id) {\n dispatch({\n type: 'DELETE_TRANSACTION',\n payload: id\n });\n }",
"function delTrans(id) {\n dispatch({\n type: \"DELETE_TRANSACTION\",\n payload: id\n });\n }",
"removeTransaction(id)\n {\n if (typeof(id) == \"object\")\n id = id.id\n\n let index = this.transactions.findIndex(x => x.id == id)\n\n if (index == -1)\n return\n\n this.transactions.splice(index, 1)\n }",
"function deleteTransaction(id) {\n // Filter out the transaction with the provided id\n transactions = transactions.filter( transaction => transaction.id !== id );\n // Initialize the app again to update the DOM\n init();\n}",
"deleteTransaction(transactionID) {\r\n console.log('deleteing ID: '+ transactionID);\r\n this._transactionList.splice(this.findTransactionIndex(transactionID), 1);\r\n }",
"function removeTransaction(id) {\r\n // Filtrando todas las transacciones a quitar\r\n transactions = transactions.filter(transaction => transaction.id !== id);\r\n \r\n updateLocalStorage();\r\n init();\r\n}",
"deleteById(id) {\n let sqlRequest = \"DELETE FROM taskItem WHERE id=$id\";\n let sqlParams = {$id: id};\n return this.common.run(sqlRequest, sqlParams);\n }",
"function removeTransaction(id) {\n\ttransactions = transactions.filter((transaction) => transaction.id !== id);\n\n\tupdateLocalStorage();\n\n\tinit();\n}",
"function removeTransactions(id){\n console.log(id)\n transactions=transactions.filter(transaction=>\n \n transaction.id!==id)\n \n updateLocalStorage();\n\n init();\n}",
"function fnDeleteTransaction(id) {\n jQuery.ajax({\n type: 'POST',\n url: bittionUrlProjectAndController + 'fnDeleteTransaction',\n dataType: 'json',\n data: {\n id: id\n },\n success: function(response) {\n if (response['status'] === 'SUCCESS') {\n bittionShowGrowlMessage(response['status'],response['title'],response['content']);\n fnRead(jQuery('#selectController').val());\n } else {\n bittionShowGrowlMessage(response['status'],response['title'],response['content']);\n }\n },\n error: function(response, status, error) {\n bittionAjaxErrorHandler(response, status, error);\n }\n });\n }",
"async function removeTransaction(transId) {\n try {\n const res = await axios.delete(`/api/transactions/${transId}`);\n if (res.status === 200) {\n dispatch({\n type: \"REMOVE_TRANSACTION\",\n payload: transId,\n });\n }\n } catch (err) {\n dispatch({\n type: \"TRANSACTION_ERROR\",\n payload: err.response.data.error,\n });\n }\n }",
"function deleteTransaction(id) {\n $.ajax({\n url: `/edit_transaction/${id}`\n }).done(function(response) {\n\n // transaction record ID link \n let updateURL = `/delete_transaction/${id}`;\n $('#deleteForm').attr('action', updateURL);\n $('#deleteTransactionModal').modal('show');\n });\n}",
"deleteById(id) {\n let sqlRequest = \"DELETE FROM event WHERE id=$id\";\n let sqlParams = {$id: id};\n return this.common.run(sqlRequest, sqlParams);\n }",
"delete(id) {\n if (!id) {\n return Promise.reject(new Error('invalid_id'));\n }\n return this.iugu.makeRequest('DELETE', `/customers/${id}`).begin();\n }",
"function deleteTransactions(id){ // id received as a parameter when the user deletes the transaction\n dispatch({\n type: 'DELETE_TRANSACTIONS', //action type to pass on AppReducer.js\n payload: id // passing data (payload) i.e id to AppReducer.js\n })\n}",
"deleteById(req, res) {\n let id = req.params.id;\n\n this.tradeDao.deleteById(id)\n .then(this.common.editSuccess(res))\n .catch(this.common.serverError(res));\n }",
"async delete(id) {\n const res = window.confirm('Are you sure you want to remove this tenant?')\n if (!res) {\n return\n }\n try {\n await api.delete('api/tenants/' + id)\n this.getById(id)\n } catch (error) {\n logger.error(error)\n }\n }",
"async deleteById(id) {\n try {\n if (!id) { throw new Error('id must be given'); }\n\n // create prepared statement\n this.delete({ id });\n\n // execute the query\n return await this.exec();\n } catch ({ stack, message }) {\n console.log(stack, message);\n return `Unable to fetch object: ${message}`;\n }\n }",
"deleteById(id) {\n let sqlRequest = \"DELETE FROM restaurants WHERE id=$id\";\n let sqlParams = {\n $id: id\n };\n return this.common.run(sqlRequest, sqlParams);\n }",
"static deleteTask(taskId = 0){\n var table_Name = Task.tableName\n const sql = `delete from ${table_Name} WHERE id = ?`\n const params = [taskId]\n console.log(\"Task id \"+taskId)\n return this.repository.databaseLayer.executeSql(sql, params)\n }",
"deleteById(id) {\n let sqlRequest = \"DELETE FROM repo WHERE id=$id\";\n let sqlParams = {$id: id};\n return this.common.run(sqlRequest, sqlParams);\n }",
"async deleteById(id) {\r\n const item = await this.findById(id);\r\n const result = await item.destroy();\r\n if (result === false) {\r\n throw new Exception('can not delete resource', 1002);\r\n }\r\n return result;\r\n }",
"function deleteInt(id) {\n transition(DELETE);\n //Located in the hooks/useApplicationData.js\n cancelInterview(id)\n .then(() => transition(EMPTY))\n .catch(error => transition(ERR_DELETE, true));\n }",
"function deleteRecord(id) {\n\n var iddelete = id.toString();\n\n db.transaction(function (tx) { tx.executeSql(deleteStatement, [id], showRecords, onError); alert(\"Sucessfully Deleted\"); });\n\n resetForm();\n \n}",
"remove(table, id) {\n var queryString = `DELETE FROM ?? WHERE id = ?` \n\n return this.connection.query(queryString, [table, id]);\n }",
"deleteUser({ commit }, id) {\n commit(\"deleteUser\", id)\n }"
] | [
"0.87048256",
"0.83477056",
"0.8138373",
"0.8123875",
"0.8030812",
"0.79025096",
"0.789536",
"0.77007",
"0.7653753",
"0.73849493",
"0.7232468",
"0.722017",
"0.70500445",
"0.704107",
"0.6940432",
"0.6928991",
"0.6897247",
"0.67960155",
"0.67626005",
"0.6711767",
"0.6695826",
"0.66136837",
"0.66011596",
"0.65937",
"0.6591152",
"0.6546276",
"0.653762",
"0.6503491",
"0.6490362",
"0.64846796"
] | 0.8468602 | 1 |
delete all transaction that relate to customer by customer id | function deleteAllTransactionsByCustomerId(customer_id) {
return TransactionModel.deleteMany({ customer_id }).exec();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteTransaction(id) {\n transactions = transactions.filter( transaction => transaction.id != id );\n init();\n}",
"async function clearCustomers() {\n try {\n const { result : { customers } } = await customersApi.listCustomers();\n if (customers) {\n for (const key in customers) {\n const customer = customers[key];\n await customersApi.deleteCustomer(customer.id);\n }\n console.log(\"Successfully deleted customers\");\n } else {\n console.log(\"No customers to delete\");\n }\n } catch (error) {\n console.error(\"Error in deleting customers:\", error);\n }\n}",
"deleteCustomer(empid) { \n this.customerService.deleteCustomer(empid);\n this.getCustomerList();\n }",
"async deleteCustomerById(id) {\n if (!id) {\n return {msg: 'No id was specified..', payload: 1}\n }\n\n try {\n return !!await customers.destroy({\n where: {\n id: id\n }\n })\n } catch (e) {\n return false;\n }\n\n }",
"function deleteTransaction(id) {\n transaction.deleteTransaction(id)\n .then(res => loadTransactions())\n .catch(err => console.log(err));\n }",
"function deleteTransactionById(_id) {\r\n return TransactionModel.deleteOne({ _id }).exec();\r\n}",
"function del(){\r\nCustomer.deleteMany({dni:\"32111111-A\",dni:\"32111112-B\",dni:\"32111113-C\",dni:\"32111114-D\"}, (err, ret) =>{\r\n\t\r\n\tif(err) {\r\n\t\tconsole.error(err);\r\n\t\t\r\n\t} else {\r\n\t\tconsole.log(\"Los dueños que coinciden con el criterio de busqueda han sido borrados: \", ret);\r\n\t\tconsole.log(\"Todo correcto!!\");\r\n\t\t\r\n\t}\r\n\t\r\n\t\r\n});\r\n\r\n}",
"deleteCustomer(params) {\r\n return Api().delete('/customers/' + params)\r\n }",
"function deleteCustomer(customerID) {\n // console.log(\"id \" + carID);\n API.deleteCustomer(customerID).then(function () {\n refreshCars();\n });\n}",
"function deleteCustomer(customerObj, options) {\n return datacontext.post('Customer/DeleteCustomer/', customerObj, options);\n }",
"delete(id) {\n if (!id) {\n return Promise.reject(new Error('invalid_id'));\n }\n return this.iugu.makeRequest('DELETE', `/customers/${id}`).begin();\n }",
"function deleteTransaction(id) {\n // Filter out the transaction with the provided id\n transactions = transactions.filter( transaction => transaction.id !== id );\n // Initialize the app again to update the DOM\n init();\n}",
"function removeTransactions(id){\n console.log(id)\n transactions=transactions.filter(transaction=>\n \n transaction.id!==id)\n \n updateLocalStorage();\n\n init();\n}",
"function deleteCustomer(deleteParameters) {\r\n // deleteParameters is an array. EG: ['Email','[email protected]','Mobile','086 123 4567','FirstNames','Bob']\r\n\r\n console.log('Delete - Customer:');\r\n deleteParameters.unshift('customers');\r\n deleteFromCollection(deleteParameters);\r\n\r\n} // END: function deleteCustomer()",
"removeTransaction(id)\n {\n if (typeof(id) == \"object\")\n id = id.id\n\n let index = this.transactions.findIndex(x => x.id == id)\n\n if (index == -1)\n return\n\n this.transactions.splice(index, 1)\n }",
"deleteTransaction(transactionID) {\r\n console.log('deleteing ID: '+ transactionID);\r\n this._transactionList.splice(this.findTransactionIndex(transactionID), 1);\r\n }",
"function deleteTransaction (id){\n dispatch({\n type:'DELETE_TRANSACTION',\n payload: id\n });\n }",
"function deleteTransaction(id) {\n dispatch({\n type: \"DELETE_TRANSACTION\",\n payload: id\n });\n }",
"function deletecustomer() {\n data = \"name=\" + String($(\".customer_name.act\").html()) + \"^class=Customer\";\n dbOperations(\"cus\", \"delete_operation\", data);\n $(\"li.actparent\").remove();\n $(\"#customerhistorypane\").css(\"opacity\", \"0\");\n check_for_active_row(\"customer_name\", \"inventory\");\n $(\"#customerhistorypane\").animate({\n opacity: 1\n });\n}",
"function DeleteTransaction(id) {\n dispatch({\n type: 'DELETE_TRANSACTION',\n payload: id\n });\n }",
"function deleteCustomer(CustomerID) {\n\n let data = {\n CustomerID: CustomerID\n }\n\n $.ajax({\n url: '/api/Customers/deleteCustomer',\n type: 'DELETE',\n contentType:\n \"application/json;charset=utf-8\",\n data: JSON.stringify(data),\n success: function () {\n //removes row from customertable via id\n $(\"#row\" + CustomerID).remove();\n },\n error: function (request, message, error) {\n handleException(request, message, error);\n }\n });\n}",
"function DeleteCustomerMaster(this_obj) {\n debugger;\n customerVM = DataTables.customerList.row($(this_obj).parents('tr')).data();\n notyConfirm('Are you sure to delete?', 'DeleteCustomer(\"' + customerVM.ID + '\")');\n}",
"removeFromCustomers() {\n KebapHouse.customers.splice(0, 1);\n }",
"@acceptsTransaction\n @acceptsRecords\n async delete(records: Record[]) {\n const source = new Var()\n const target = new Var()\n const relation = new Var()\n // noinspection JSUnresolvedVariable\n await this.connection.query(C.tag`\n ${this.__namedSelfQuery(source, relation, target)}\n WHERE ${target}.uuid IN ${records.map(record => record.uuid)}\n\n DELETE ${relation}`)\n }",
"function deletecustomerlist(id) {\n //check to ensure the db object has been created\n if (db) {\n //Get all the cars from the database with a select statement, set outputCarList as the callback function for the executeSql command\n db.transaction(function (tx) {\n tx.executeSql(\"DELETE FROM user WHERE id=?\", [id], outputcustomerlist);\n });\n } else {\n alert(\"db not found, your browser does not support web sql!\");\n }\n}",
"function delTrans(id) {\n dispatch({\n type: \"DELETE_TRANSACTION\",\n payload: id\n });\n }",
"function removeTransaction(id) {\r\n // Filtrando todas las transacciones a quitar\r\n transactions = transactions.filter(transaction => transaction.id !== id);\r\n \r\n updateLocalStorage();\r\n init();\r\n}",
"function onDeleteCustomerClick() {\n $('#modal-confirm-delete').modal('show');\n let vSelectedRow = $(this).parents('tr');\n let vSelectedData = gCustomerTable.row(vSelectedRow).data();\n gCustomerId = vSelectedData.id;\n }",
"function deleteAllItinBus(req, res, next) {\n var query = `\n DELETE FROM itinerarybusiness\n WHERE itinerary_id = :id\n `;\n let id = req.params.id;\n const binds = [id];\n\n oracledb.getConnection({\n user : credentials.user,\n password : credentials.password,\n connectString : credentials.connectString\n }, function(err, connection) {\n if (err) {\n console.log(err);\n } else {\n connection.execute(query, binds, function(err, result) {\n if (err) {console.log(err);}\n else {\n next()\n }\n });\n }\n });\n}",
"function deleteTransactions(id){ // id received as a parameter when the user deletes the transaction\n dispatch({\n type: 'DELETE_TRANSACTIONS', //action type to pass on AppReducer.js\n payload: id // passing data (payload) i.e id to AppReducer.js\n })\n}"
] | [
"0.6873459",
"0.66026664",
"0.65450925",
"0.6539166",
"0.64093316",
"0.63606864",
"0.6349919",
"0.62439823",
"0.6242813",
"0.6217943",
"0.62073547",
"0.6166351",
"0.6119943",
"0.60789025",
"0.602603",
"0.6015245",
"0.5917384",
"0.58527005",
"0.5841049",
"0.5835707",
"0.58148956",
"0.5792845",
"0.57870054",
"0.5756596",
"0.5720614",
"0.5709108",
"0.56687915",
"0.5640411",
"0.56242406",
"0.5606822"
] | 0.8589326 | 0 |
Creates a Constructor for an Immutable object from a schema. | function Immutable (originalSchema) {
var schema = {}, blueprint, prop, propCtor;
if (!originalSchema) {
return new InvalidArgumentException(new Error('A schema object, and values are required'));
}
// Convert any objects that aren't validatable by Blueprint into Immutables
for (prop in originalSchema) {
if (!originalSchema.hasOwnProperty(prop)) {
continue;
} else if (prop === '__skipValidation') {
continue;
} else if (prop === '__skipValdation') {
schema.__skipValidation = originalSchema.skipValdation;
}
if (
is.object(originalSchema[prop]) &&
!Blueprint.isValidatableProperty(originalSchema[prop]) &&
!originalSchema[prop].__immutableCtor
) {
schema[prop] = new Immutable(originalSchema[prop]);
} else {
schema[prop] = originalSchema[prop];
}
if (schema[prop].__immutableCtor) {
// Add access to the Immutable on the Parent Immutable
propCtor = prop.substring(0,1).toUpperCase() + prop.substring(1);
Constructor[propCtor] = schema[prop];
}
}
// This is the blueprint that the Immutable will be validated against
blueprint = new Blueprint(schema);
/*
// The Constructor is returned by this Immutable function. Callers can
// then use it to create new instances of objects that they expect to
// meet the schema, set forth by this Immutable.
*/
function Constructor (values) {
var propName,
// we return self - it will provide access to the getters and setters
self = {};
values = values || {};
if (
// you can override initial validation by setting
// `schema.__skipValidation: true`
originalSchema.__skipValidation !== true &&
!Blueprint.validate(blueprint, values).result
) {
var err = new InvalidArgumentException(
new Error(locale.errors.initialValidationFailed),
Blueprint.validate(blueprint, values).errors
);
config.onError(err);
return err;
}
try {
// Enumerate the schema, and create immutable properties
for (propName in schema) {
if (!schema.hasOwnProperty(propName)) {
continue;
} else if (propName === '__blueprintId') {
continue;
}
if (is.nullOrUndefined(values[propName])) {
makeReadOnlyNullProperty(self, propName);
continue;
}
makeImmutableProperty(self, schema, values, propName);
}
Object.freeze(self);
} catch (e) {
return new InvalidArgumentException(e);
}
return self;
} // /Constructor
/*
// Makes a new Immutable from an existing Immutable, replacing
// values with the properties in the mergeVals argument
// @param from: The Immutable to copy
// @param mergeVals: The new values to overwrite as we copy
*/
setReadOnlyProp(Constructor, 'merge', function (from, mergeVals, callback) {
if (typeof callback === 'function') {
async.runAsync(function () {
merge(Constructor, from, mergeVals, callback);
});
} else {
var output;
merge(Constructor, from, mergeVals, function (err, merged) {
output = err || merged;
});
return output;
}
});
/*
// Copies the values of an Immutable to a plain JS Object
// @param from: The Immutable to copy
*/
setReadOnlyProp(Constructor, 'toObject', function (from, callback) {
return objectHelper.cloneObject(from, true, callback);
});
/*
// Validates an instance of an Immutable against it's schema
// @param instance: The instance that is being validated
*/
setReadOnlyProp(Constructor, 'validate', function (instance, callback) {
return Blueprint.validate(blueprint, instance, callback);
});
/*
// Validates an instance of an Immutable against it's schema
// @param instance: The instance that is being validated
*/
setReadOnlyProp(Constructor, 'validateProperty', function (instance, propertyName, callback) {
if (!instance && is.function(callback)) {
callback([locale.errors.validatePropertyInvalidArgs], false);
} else if (!instance) {
return {
errors: [locale.errors.validatePropertyInvalidArgs],
result: false
};
}
return Blueprint.validateProperty(blueprint, propertyName, instance[propertyName], callback);
});
/*
// Prints an immutable to the console, in a more readable way
// @param instance: The Immutable to print
*/
setReadOnlyProp(Constructor, 'log', function (instance) {
if (!instance) {
console.log(null);
} else {
console.log(Constructor.toObject(instance));
}
});
/*
// Returns a copy of the original schema
*/
setReadOnlyProp(Constructor, 'getSchema', function (callback) {
return objectHelper.cloneObject(originalSchema, true, callback);
});
/*
// Returns a this Immutable's blueprint
*/
setReadOnlyProp(Constructor, 'blueprint', blueprint);
setReadOnlyProp(Constructor, '__immutableCtor', true);
return Constructor;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Constructor (values) {\n var propName,\n // we return self - it will provide access to the getters and setters\n self = {};\n\n values = values || {};\n\n if (\n // you can override initial validation by setting\n // `schema.__skipValidation: true`\n originalSchema.__skipValidation !== true &&\n !Blueprint.validate(blueprint, values).result\n ) {\n var err = new InvalidArgumentException(\n new Error(locale.errors.initialValidationFailed),\n Blueprint.validate(blueprint, values).errors\n );\n\n config.onError(err);\n\n return err;\n }\n\n try {\n // Enumerate the schema, and create immutable properties\n for (propName in schema) {\n if (!schema.hasOwnProperty(propName)) {\n continue;\n } else if (propName === '__blueprintId') {\n continue;\n }\n\n if (is.nullOrUndefined(values[propName])) {\n makeReadOnlyNullProperty(self, propName);\n continue;\n }\n\n makeImmutableProperty(self, schema, values, propName);\n }\n\n Object.freeze(self);\n } catch (e) {\n return new InvalidArgumentException(e);\n }\n\n return self;\n }",
"function buildModel(name, schema) {\n class Model extends BaseModel {\n constructor(data) {\n if (data !== undefined) {\n Object.entries(data).forEach(([key, value]) => {\n if (schema[key]) {\n Joi.attempt(value, schema[key]);\n }\n });\n }\n super(data);\n }\n\n _set(key, value) {\n if (schema[key]) {\n Joi.attempt(value, schema[key]);\n }\n return super._set(key, value);\n }\n }\n Object.defineProperty(Model, 'name', { value: name });\n Object.keys(schema).forEach(key =>\n Object.defineProperty(Model.prototype, key, {\n // `function` is used rather than `=>` to work around context problem with `this`\n /* eslint-disable func-names, object-shorthand */\n get: function () {\n return this._get(key);\n },\n set: function (value) {\n this._set(key, value);\n },\n /* eslint-enable func-names, object-shorthand */\n }));\n return Model;\n}",
"static fromSchema(schema) {\n if (typeof schema === \"string\") {\n return AvroType.fromStringSchema(schema);\n }\n else if (Array.isArray(schema)) {\n return AvroType.fromArraySchema(schema);\n }\n else {\n return AvroType.fromObjectSchema(schema);\n }\n }",
"static fromSchema(schema) {\n if (typeof schema === \"string\") {\n return AvroType.fromStringSchema(schema);\n }\n else if (Array.isArray(schema)) {\n return AvroType.fromArraySchema(schema);\n }\n else {\n return AvroType.fromObjectSchema(schema);\n }\n }",
"function makeImmutableProperty (self, schema, values, propName) {\n var Model, dateCopy;\n\n if (schema[propName].__immutableCtor && is.function(schema[propName])) {\n // this is a nested immutable\n Model = schema[propName];\n self[propName] = new Model(values[propName]);\n } else if (isDate(values[propName])) {\n dateCopy = new Date(values[propName]);\n\n Object.defineProperty(self, propName, {\n get: function () {\n return new Date(dateCopy);\n },\n enumerable: true,\n configurable: false\n });\n\n Object.freeze(self[propName]);\n } else {\n objectHelper.setReadOnlyProperty(\n self,\n propName,\n // TODO: is it really necessary to clone the value if it isn't an object?\n objectHelper.copyValue(values[propName]),\n // typeof values[propName] === 'object' ? objectHelper.copyValue(values[propName]) : values[propName],\n makeSetHandler(propName)\n );\n\n if (Array.isArray(values[propName])) {\n Object.freeze(self[propName]);\n }\n }\n }",
"newInstance(schema) {\n const instance = {};\n for (const field of schema) {\n if (field.def !== undefined) {\n instance[field.name] = klona(field.def);\n } else {\n // All fields should have an initial value in the database\n instance[field.name] = null;\n }\n }\n return instance;\n }",
"static create (input) {\n // SCHEMA: this is the ideal place to throw on schema failure\n // const input = this.validate(input, Message.create)\n\n const instance = new this()\n Object.assign(instance, input)\n return instance\n }",
"_createSchemaValidators(schema) {\n if (typeof schema === 'string') {\n schema = { type: schema };\n }\n\n if (schema.type && typeof schema.type === 'string') {\n // is item schema\n return new this.constructor(\n Object.assign({}, schema, {\n name: this.name,\n path: this.path,\n model: this.model\n })\n );\n }\n\n return Object.keys(schema).reduce((validators, key) => {\n let name;\n let path;\n let config = schema[key];\n\n if (typeof config === 'string') {\n config = { type: config };\n }\n\n if (typeof config === 'object') {\n name = key;\n path = `${this.path}.${name}`;\n } else {\n // if config is not an object, then it's invalid. the Field constructor\n // will therefore throw an error; with the next line, we just ensure it\n // throws the right error\n name = this.name;\n }\n\n validators[name] = new this.constructor(\n Object.assign({}, config, {\n name,\n path,\n model: this.model\n })\n );\n return validators;\n }, {});\n }",
"function Schema(id, firstName, lastName, title){\n this.id = id;\n this.firstName = firstName;\n this.lastName = lastName;\n this.title = title;\n}",
"function getModelFromSchema(schema) {\n var data = {\n name: schema.id,\n schema: {}\n }\n\n var newSchema = {}\n var tmp = null\n _.each(schema.properties, function (v, propName) {\n if (v['$ref'] != null) {\n tmp = {\n type: Schema.ObjectId,\n ref: v['$ref']\n }\n } else {\n tmp = translateComplexType(v) //{}\n }\n newSchema[propName] = tmp\n })\n data.schema = new Schema(newSchema)\n return data\n}",
"function makeValidator(schema) {\n return ajv.compile(schema);\n}",
"function constructFromDb(model, row) {\n\t var o = new model();\n\t console.assert(o instanceof Instance);\n\t for (var col in row) {\n\t var val = row[col];\n\t var _col = '_' + col;\n\t // TODO: refactor this into column class\n\t switch (model.columns[col].type) {\n\t case Updraft.ColumnType.json:\n\t o[_col] = JSON.parse(val);\n\t break;\n\t case Updraft.ColumnType.date:\n\t case Updraft.ColumnType.datetime:\n\t o[_col] = new Date(val * 1000);\n\t break;\n\t case Updraft.ColumnType.enum:\n\t var enumClass = o._model.columns[col].enum;\n\t console.assert(enumClass != null);\n\t if (typeof enumClass === 'object' && typeof enumClass.get == 'function') {\n\t o[_col] = enumClass.get(val);\n\t }\n\t else {\n\t console.assert(val in enumClass);\n\t o[_col] = enumClass[val];\n\t }\n\t break;\n\t case Updraft.ColumnType.set:\n\t o[_col].push(val);\n\t break;\n\t default:\n\t o[_col] = val;\n\t break;\n\t }\n\t }\n\t o._isInDb = true;\n\t console.assert(o._changeMask === 0);\n\t return o;\n\t }",
"schema() { }",
"create (props) {\n const { clone, dynamic } = props || {}\n Schema.prototype.create.call(this, props)\n setKeyAndName(this, clone, dynamic)\n }",
"clone(schema) {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (schema)\n copy.schema = schema;\n copy.items = copy.items.map(it => identity.isNode(it) || identity.isPair(it) ? it.clone(schema) : it);\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }",
"function makeImmutableObject(obj) {\n\t if (!globalConfig.use_static) {\n\t addPropertyTo(obj, \"merge\", merge);\n\t addPropertyTo(obj, \"replace\", objectReplace);\n\t addPropertyTo(obj, \"without\", without);\n\t addPropertyTo(obj, \"asMutable\", asMutableObject);\n\t addPropertyTo(obj, \"set\", objectSet);\n\t addPropertyTo(obj, \"setIn\", objectSetIn);\n\t addPropertyTo(obj, \"update\", update);\n\t addPropertyTo(obj, \"updateIn\", updateIn);\n\t addPropertyTo(obj, \"getIn\", getIn);\n\t }\n\n\t return makeImmutable(obj, mutatingObjectMethods);\n\t }",
"function makeImmutableObject(obj) {\n\t if (!globalConfig.use_static) {\n\t addPropertyTo(obj, \"merge\", merge);\n\t addPropertyTo(obj, \"replace\", objectReplace);\n\t addPropertyTo(obj, \"without\", without);\n\t addPropertyTo(obj, \"asMutable\", asMutableObject);\n\t addPropertyTo(obj, \"set\", objectSet);\n\t addPropertyTo(obj, \"setIn\", objectSetIn);\n\t addPropertyTo(obj, \"update\", update);\n\t addPropertyTo(obj, \"updateIn\", updateIn);\n\t addPropertyTo(obj, \"getIn\", getIn);\n\t }\n\n\t return makeImmutable(obj, mutatingObjectMethods);\n\t }",
"function makeImmutableObject(obj) {\n\t if (!globalConfig.use_static) {\n\t addPropertyTo(obj, \"merge\", merge);\n\t addPropertyTo(obj, \"replace\", objectReplace);\n\t addPropertyTo(obj, \"without\", without);\n\t addPropertyTo(obj, \"asMutable\", asMutableObject);\n\t addPropertyTo(obj, \"set\", objectSet);\n\t addPropertyTo(obj, \"setIn\", objectSetIn);\n\t addPropertyTo(obj, \"update\", update);\n\t addPropertyTo(obj, \"updateIn\", updateIn);\n\t addPropertyTo(obj, \"getIn\", getIn);\n\t }\n\t\n\t return makeImmutable(obj, mutatingObjectMethods);\n\t }",
"function Model(schema) {\n this.schema = schema;\n this.id = null;\n\n for(var key in schema) {\n this[key] = null;\n }\n if (!DataStore.store.hasOwnProperty(this.constructor.name)) {\n DataStore.store[this.constructor.name] = [];\n }\n}",
"function objectCreate(proto) {\n // create a new object\n const obj = {};\n // set the prototype\n Object.setPrototypeOf(obj, proto);\n // return a object\n return obj;\n}",
"constructor({ fieldpath, schema, deserializedDefault = [], serializedDefault = [] }) {\n super({ fieldpath, deserializedDefault, serializedDefault });\n this.schema = schema;\n this.schemaKeys = Object.keys(this.schema);\n }",
"function makeImmutableObject(obj) {\n if (!globalConfig.use_static) {\n addPropertyTo(obj, \"merge\", merge);\n addPropertyTo(obj, \"replace\", objectReplace);\n addPropertyTo(obj, \"without\", without);\n addPropertyTo(obj, \"asMutable\", asMutableObject);\n addPropertyTo(obj, \"set\", objectSet);\n addPropertyTo(obj, \"setIn\", objectSetIn);\n addPropertyTo(obj, \"update\", update);\n addPropertyTo(obj, \"updateIn\", updateIn);\n addPropertyTo(obj, \"getIn\", getIn);\n }\n\n return makeImmutable(obj, mutatingObjectMethods);\n }",
"function compileSchema (schema) {\n return (payload) => {\n return Joi.validate(payload, schema)\n }\n}",
"function asCtor(constr) {\n return primFreeze(asCtorOnly(constr));\n }",
"clone(schema) {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (schema)\n copy.schema = schema;\n copy.items = copy.items.map(it => isNode(it) || isPair(it) ? it.clone(schema) : it);\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }",
"withSchema(schema) {\n return new QueryCreator({\n ...this.#props,\n executor: this.#props.executor.withPluginAtFront(new with_schema_plugin_js_1.WithSchemaPlugin(schema)),\n });\n }",
"static fromSchema(schema) {\n return schema.cached.domParser || (schema.cached.domParser = new DOMParser(schema, DOMParser.schemaRules(schema)));\n }",
"static from(schema, obj, ctx) {\n const { keepUndefined, replacer } = ctx;\n const map = new this(schema);\n const add = (key, value) => {\n if (typeof replacer === 'function')\n value = replacer.call(obj, key, value);\n else if (Array.isArray(replacer) && !replacer.includes(key))\n return;\n if (value !== undefined || keepUndefined)\n map.items.push(Pair.createPair(key, value, ctx));\n };\n if (obj instanceof Map) {\n for (const [key, value] of obj)\n add(key, value);\n }\n else if (obj && typeof obj === 'object') {\n for (const key of Object.keys(obj))\n add(key, obj[key]);\n }\n if (typeof schema.sortMapEntries === 'function') {\n map.items.sort(schema.sortMapEntries);\n }\n return map;\n }",
"get convertedSchema() {\n let schema = {\n $schema: \"http://json-schema.org/schema#\",\n title: this.label,\n type: \"object\",\n required: [],\n properties: this.fieldsToSchema(this.fields),\n };\n return schema;\n }",
"clone() {\n return schema(this);\n }"
] | [
"0.64946556",
"0.6098677",
"0.6028341",
"0.6028341",
"0.5984513",
"0.5890175",
"0.5673409",
"0.5543228",
"0.5372351",
"0.5367328",
"0.5352167",
"0.5319163",
"0.52733094",
"0.5245628",
"0.5244429",
"0.52235764",
"0.52235764",
"0.519638",
"0.5193204",
"0.51500684",
"0.51453054",
"0.5145128",
"0.5144299",
"0.51356655",
"0.5133827",
"0.5083103",
"0.5064168",
"0.50540876",
"0.50474197",
"0.50386643"
] | 0.67670506 | 0 |
Subsets and Splits