query
stringlengths 9
34k
| document
stringlengths 8
5.39M
| negatives
sequencelengths 19
20
| metadata
dict |
---|---|---|---|
Is the bundle valid. | static isValid(bundle) {
let isValid = false;
if (objectHelper_1.ObjectHelper.isType(bundle, bundle_1.Bundle) && arrayHelper_1.ArrayHelper.isTyped(bundle.transactions, transaction_1.Transaction)) {
let totalSum = 0;
const kerl = spongeFactory_1.SpongeFactory.instance().create("kerl");
kerl.initialize();
// Prepare for signature validation
const signaturesToValidate = [];
isValid = true;
for (let t = 0; t < bundle.transactions.length && isValid; t++) {
const bundleTx = bundle.transactions[t];
totalSum += bundleTx.value.toNumber();
// currentIndex has to be equal to the index in the array
if (bundleTx.currentIndex.toNumber() !== t) {
isValid = false;
}
else {
// Get the transaction trytes
const thisTxTrytes = bundleTx.toTrytes();
// Absorb bundle hash + value + timestamp + lastIndex + currentIndex trytes.
const thisTxTrits = trits_1.Trits.fromTrytes(thisTxTrytes.sub(signatureMessageFragment_1.SignatureMessageFragment.LENGTH, 162)).toArray();
kerl.absorb(thisTxTrits, 0, thisTxTrits.length);
// Check if input transaction
if (bundleTx.value.toNumber() < 0) {
const newSignatureToValidate = {
address: bundleTx.address,
signatureMessageFragments: [bundleTx.signatureMessageFragment]
};
// Find the subsequent txs with the remaining signature fragment
for (let i = t; i < bundle.transactions.length - 1; i++) {
const newBundleTx = bundle.transactions[i + 1];
// Check if new tx is part of the signature fragment
if (newBundleTx.address.toTrytes().toString() === bundleTx.address.toTrytes().toString()
&& newBundleTx.value.toNumber() === 0) {
newSignatureToValidate.signatureMessageFragments.push(newBundleTx.signatureMessageFragment);
}
}
signaturesToValidate.push(newSignatureToValidate);
}
}
}
// Check for total sum, if not equal 0 return error
if (totalSum !== 0) {
isValid = false;
}
else {
// get the bundle hash from the bundle transactions
const bundleFromTxs = new Int8Array(kerl.getConstant("HASH_LENGTH"));
kerl.squeeze(bundleFromTxs, 0, bundleFromTxs.length);
const bundleFromTxsTrytes = trits_1.Trits.fromArray(bundleFromTxs).toTrytes().toString();
// Check if bundle hash is the same as returned by tx object
const bundleHash = bundle.transactions[0].bundle;
if (bundleFromTxsTrytes !== bundleHash.toTrytes().toString()) {
isValid = false;
}
else {
// Last tx in the bundle should have currentIndex === lastIndex
if (bundle.transactions[bundle.transactions.length - 1].currentIndex.toNumber() !==
bundle.transactions[bundle.transactions.length - 1].lastIndex.toNumber()) {
isValid = false;
}
else {
// Validate the signatures
for (let i = 0; i < signaturesToValidate.length && isValid; i++) {
const isValidSignature = iss_1.ISS.validateSignatures(signaturesToValidate[i].address, signaturesToValidate[i].signatureMessageFragments, bundleHash);
if (!isValidSignature) {
isValid = false;
}
}
}
}
}
}
return isValid;
} | [
"isGameFieldValid() {\n\t\tlet self = this;\n\t\tlet isValid = true;\n\t\tthis.birds.forEach(function(bird) {\n\t\t\tlet h = bird.getHeight();\n\t\t\tlet location = bird.getLocation();\n\t\t\tlet x = location.x;\n\t\t\tlet y = location.y;\n\t\t\tisValid = self.fieldSize.isWithinField(h, x, y);\n\t\t\tif (!isValid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t});\n\t\treturn isValid;\n\t}",
"isLifecycleValid (pack, packs) {\n return lifecycleStages.every(stageName => {\n return Pathfinder.isLifecycleStageValid (pack, stageName, packs)\n })\n }",
"function isValidJsonXml() {\n return angular.element('[name=\"jsonXmlForm\"]').scope().jsonXmlForm.$valid;\n }",
"validate () {\n if (typeof this.intent !== 'string') {\n return false\n }\n\n if (!Array.isArray(this.dependencies) || !Array.isArray(this.notions)) {\n return false\n }\n\n const dependenciesValidity = this.dependencies.every(dep => {\n if (typeof dep.isMissing !== 'object') {\n return false\n }\n\n if (!Array.isArray(dep.actions)) {\n return false\n }\n\n return dep.actions.every(a => typeof a === 'string')\n })\n\n if (!dependenciesValidity) {\n return false\n }\n\n const notionsValidity = this.notions.every(n => {\n if (typeof n.isMissing !== 'object') {\n return false\n }\n\n if (!Array.isArray(n.entities)) {\n return false\n }\n\n return n.entities.every(e => typeof e === 'object' && typeof e.entity === 'string' && typeof e.alias === 'string')\n })\n\n if (!notionsValidity) {\n return false\n }\n\n const requiresItself = this.dependencies.some(dependency => dependency.actions.some(a => a === this.name()))\n\n if (this.dependencies.length > 0 && requiresItself) {\n return false\n }\n\n return true\n }",
"static isValid (config) {\n if (config == null) {\n return false;\n }\n\n if (config.emission == null &&\n config.ambient == null &&\n config.diffuse == null &&\n config.specular == null) {\n return false;\n }\n\n return true;\n }",
"hasValidTransactions() {\n for (const tx of this.transactions) {\n if (!tx.isValid()) {\n return false;\n }\n }\n return true;\n }",
"checkIfFormIsValid() {\t\t\t\n\t\t\tif(this.state.requiredInputs.every((input) => {return input.valid})) {\n\t\t\t\tthis.setState({formIsValid: true});\n\t\t\t} else {\n\t\t\t\tthis.setState({formIsValid: false});\n\t\t\t}\n\t\t}",
"function verifyLicense() {\n var OSFLicenseManager = require('*/cartridge/scripts/OSFLicenseManager');\n try {\n return OSFLicenseManager.getLicenseStatus('DWORC').isValid;\n } catch (error) {\n return false;\n }\n}",
"isComplete (packs) {\n return packs.every(pack => {\n return Pathfinder.isLifecycleValid (pack, packs)\n })\n }",
"validate() {\n this.verifTitle();\n this.verifDescription();\n this.verifNote();\n this.verifImg();\n console.log(this.errors);\n console.log(this.test);\n if (this.test !== 0) {\n return false;\n }\n return true;\n }",
"isValid() {\n try {\n fs.accessSync(CONFIG_FILE_PATH, fs.constants.R_OK | fs.constants.W_OK);\n return true;\n } catch (err) {\n return false;\n }\n }",
"function isPropValid()\n{\n\n}",
"isValidBin(binName) {\n\t\n\t\tif ('undefined' === typeof binName || null === binName || '' === binName) {\n\t\t\n\t\t\treturn Object.keys(global.Uwot.Bin);\n\t\t\n\t\t}\n\t\telse if ('string' !== typeof binName) {\n\t\t\n\t\t\treturn false;\n\t\t\n\t\t}\n\t\telse {\n\t\t\n\t\t\tvar loadedBins = Object.keys(global.Uwot.Bin);\n\t\t\treturn loadedBins.indexOf(binName.trim()) !== -1;\n\t\t\n\t\t}\n\t\n\t}",
"idAlreadyExistsInBundle(id) {\n for (let e of this.entry) {\n let resource = e.resource;\n if (resource['id'] === id)\n return true;\n }\n return false;\n }",
"function isMessageValid() {\n return $message.val().length > 0;\n }",
"function hasValidVersionField(manifest) {\n return semver_utils_1.isValidSemver(manifest[ManifestFieldNames.Version]);\n}",
"function validateFramebuffer(context) {\n \n }",
"async _AssetExists(ctx, id) {\n const assetJSON = await ctx.stub.getState(id);\n return assetJSON && assetJSON.length > 0;\n }",
"function stateAndPayloadAreValid(config, state, payload) {\n\n // ensure that the instances array exists\n if (!Array.isArray(state[config.stateKey])) {\n console.error('State does not contain an \"' + config.stateKey + '\" array.');\n return false;\n }\n\n // ensure that the payload contains an id\n if ((typeof payload === 'undefined' ? 'undefined' : _typeof(payload)) !== 'object' || typeof payload[config.instanceKey] === 'undefined') {\n console.error('Mutation payloads must be an object with an \"' + config.instanceKey + '\" property.');\n return false;\n }\n\n return true;\n}",
"function isMetadataValid(item) {\n if ($scope.isList) {\n return true;\n }\n if (!item.metadata) {\n $scope.error = {\n message: \"Resource is missing metadata field.\"\n };\n return false;\n }\n if (!item.metadata.name) {\n $scope.error = {\n message: \"Resource name is missing in metadata field.\"\n };\n return false;\n }\n if (item.metadata.namespace && item.metadata.namespace !== $scope.input.selectedProject.metadata.name) {\n $scope.error = {\n message: item.kind + \" \" + item.metadata.name + \" can't be created in project \" + item.metadata.namespace + \". Can't create resource in different projects.\"\n };\n return false;\n }\n return true;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move the selection downwards, expanding or contracting depending on whether `isReversed`. | selectDown() {
const blocks = this.getNavigableBlocks();
const selectedBlocks = blocks.filterBy('isSelected');
if (this.get('isReversed')) {
if (selectedBlocks.get('length') === 1) {
const idx = blocks.indexOf(selectedBlocks.get('firstObject'));
const nextBlock = blocks.objectAt(idx + 1);
if (!nextBlock) return;
nextBlock.set('isSelected', true);
this.set('isReversed', false);
} else {
selectedBlocks.get('firstObject').set('isSelected', false);
}
} else {
const idx = blocks.indexOf(selectedBlocks.get('lastObject'));
const nextBlock = blocks.objectAt(idx + 1);
if (!nextBlock) return;
nextBlock.set('isSelected', true);
}
} | [
"selectUp() {\n const blocks = this.getNavigableBlocks();\n const selectedBlocks = blocks.filterBy('isSelected');\n\n if (this.get('isReversed')) {\n const idx = blocks.indexOf(selectedBlocks.get('firstObject'));\n if (idx === 0) return;\n blocks.objectAt(idx - 1).set('isSelected', true);\n } else if (selectedBlocks.get('length') === 1) {\n const idx = blocks.indexOf(selectedBlocks.get('firstObject'));\n const prevBlock = blocks.objectAt(idx - 1);\n if (!prevBlock) return;\n prevBlock.set('isSelected', true);\n this.set('isReversed', true);\n } else {\n selectedBlocks.get('lastObject').set('isSelected', false);\n }\n }",
"function moveOptionDown(obj) {\n\tfor (i=obj.options.length-1; i>=0; i--) {\n\t\tif (obj.options[i].selected) {\n\t\t\tif (i != (obj.options.length-1) && ! obj.options[i+1].selected) {\n\t\t\t\tswapOptions(obj,i,i+1);\n\t\t\t\tobj.options[i+1].selected = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"function moveSelectedItemsDown(src) {\r\n var i;\r\n for (i = src.options.length - 1; i >= 0; --i) {\r\n var thisitem = src.options[i];\r\n if (thisitem.selected == true) {\r\n // already at the end\r\n if (i == src.options.length - 1) {\r\n return;\r\n } else {\r\n // move the item down\r\n var nextItem = src.options[i + 1];\r\n\r\n thisoption = new Option(thisitem.text, thisitem.value, false, false);\r\n swapoption = new Option(nextItem.text, nextItem.value, false, false);\r\n src.options[i] = swapoption;\r\n src.options[i + 1] = thisoption;\r\n thisoption.selected = true;\r\n }\r\n }\r\n }\r\n}",
"shiftUp() {\n const blocks = this.getNavigableBlocks();\n const selectedBlocks = blocks.filterBy('isSelected');\n const idx = blocks.indexOf(selectedBlocks.get('firstObject'));\n const prevBlock = blocks.objectAt(idx - 1);\n\n if (!prevBlock) return;\n\n selectedBlocks.get('lastObject').set('isSelected', false);\n prevBlock.set('isSelected', true);\n }",
"slideBack() {\n this.slideBy(-this.getSingleStep());\n }",
"function moveOptionUp(obj) {\n\tfor (i=0; i<obj.options.length; i++) {\n\t\tif (obj.options[i].selected) {\n\t\t\tif (i != 0 && !obj.options[i-1].selected) {\n\t\t\t\tswapOptions(obj,i,i-1);\n\t\t\t\tobj.options[i-1].selected = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"function moveDown() {\n\tmoveWrapper(this.ancestor(fieldWrapperSelector), 'down');\n}",
"function moveDown(notebook) {\n if (!notebook.model || !notebook.activeCell) {\n return;\n }\n const state = Private.getState(notebook);\n const cells = notebook.model.cells;\n const widgets = notebook.widgets;\n cells.beginCompoundOperation();\n for (let i = cells.length - 2; i > -1; i--) {\n if (notebook.isSelectedOrActive(widgets[i])) {\n if (!notebook.isSelectedOrActive(widgets[i + 1])) {\n cells.move(i, i + 1);\n if (notebook.activeCellIndex === i) {\n notebook.activeCellIndex++;\n }\n notebook.select(widgets[i + 1]);\n notebook.deselect(widgets[i]);\n }\n }\n }\n cells.endCompoundOperation();\n Private.handleState(notebook, state, true);\n }",
"function scrollDown(amount) {\n moveTo(current - amount);\n scope.selected = item();\n }",
"function nextReverseORF() {\n if (needToResetORFList) {\n reverseArrayAndIndex = getReverseORFS();\n reverseCurrentORF = reverseArrayAndIndex[0];\n reverseNumORF = reverseArrayAndIndex[1];\n reverseIndex = reverseArrayAndIndex[2];\n if (reverseLoopCountORF >= reverseNumORF) {\n reverseLoopCountORF = 0;\n }\n needToResetORFList = 0;\n }\n\n if (reverseNumORF !== 0) {\n if (reverseNextOrPrevious === 2 || reverseNextOrPrevious === 1) {\n $('#seqTextArea').setSelection(reverseIndex[reverseLoopCountORF] - ((reverseCurrentORF[reverseLoopCountORF]).length), reverseIndex[reverseLoopCountORF]);\n reverseLoopCountORF++;\n if (reverseLoopCountORF >= reverseNumORF) {\n reverseLoopCountORF = 0;\n } else {\n // Do nothing\n }\n }\n else if (reverseNextOrPrevious === 0) {\n reverseLoopCountORF += 2;\n if (reverseLoopCountORF >= reverseNumORF) {\n reverseLoopCountORF = (reverseLoopCountORF - (reverseNumORF - 1)) - 1;\n } else {\n // Do nothing\n }\n $('#seqTextArea').setSelection(reverseIndex[reverseLoopCountORF] - ((reverseCurrentORF[reverseLoopCountORF]).length), reverseIndex[reverseLoopCountORF]);\n reverseLoopCountORF++;\n if (reverseLoopCountORF >= reverseNumORF) {\n reverseLoopCountORF = 0;\n } else {\n // Do nothing\n }\n }\n }\n reverseNextOrPrevious = 1;\n }",
"function OnClickMoveDown()\r\n{\r\n var rows = iDoc.getElementById(\"dataTable\").rows;\r\n\r\n\r\n for (var i = rows.length - 2; i > 0; i--)\r\n {\r\n row1 = rows[i].getAttribute(\"selected\");\r\n row2 = rows[i + 1].getAttribute(\"selected\");\r\n\r\n\r\n if (row1 == 1 && row2 == 0)\r\n {\r\n rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);\r\n changesMade = true;\r\n }\r\n }\r\n SetAllRowColors();\r\n}",
"function moveDown (){\n\t\tunDraw();\n\t\tcurrentPosition += width;\n\t\tdraw();\n\t\tfreeze();\n\t}",
"function revertMove () {\n if ((turnHistory.length > 0 && difficultyLevel === 0) || (turnHistory.length > 1 && difficultyLevel > 0)) {\n let iteration = 1;\n if (difficultyLevel > 0) {\n iteration = 2;\n\n if (!isStarted && currentTurn === -1) {\n iteration = 1;\n changeTurn();\n }\n } else {\n changeTurn();\n }\n if (!isStarted) isStarted = true;\n\n for (let i = 0; i < iteration; i++) {\n const lastPosition = turnHistory.pop();\n unmarkField(lastPosition);\n selectedArray[lastPosition] = 0;\n }\n turnCounter -= iteration;\n } else {\n toggleErrorMessage('Derzeit sind nicht genug Felder belegt um etwas Rückgängig zu machen.');\n }\n }",
"function handleDecrease() {\n if (selectedAmount > 1) setSelectedAmount(selectedAmount - 1);\n }",
"changePage(selection, e) {\n\n let shift = null;\n\n // Figure out which direction we should shift the array and shift it before we change the state\n if(this.headerOrder.indexOf(selection) === 0) {\n this.headerOrder.unshift(this.headerOrder.pop())\n shift = 'right';\n }\n else if(this.headerOrder.indexOf(selection) === 2) {\n this.headerOrder.push(this.headerOrder.shift())\n shift = 'left'\n } else {\n shift = '';\n }\n\n this.setState({\n 'selected': selection,\n 'shift': shift\n }, function() {\n console.log(\"In changePage; changed state to\", this.state.selected, \"and shifting\", this.state.shift)\n })\n }",
"function goUp() {\n if (currentSectionIndex > 0) {\n goToSection(currentSectionIndex - 1);\n }\n }",
"sendBackward(element) {\n return this.changeIndexTo(element, -1, true);\n\n if (index > 0) {\n var temp = this._children[index];\n this._children[index] = this._children[index - 1];\n this._children[index - 1] = temp;\n }\n }",
"function moveSelectionForward(\n editorState: EditorState,\n maxDistance: number,\n): SelectionState {\n const selection = editorState.getSelection();\n // Should eventually make this an invariant\n warning(\n selection.isCollapsed(),\n 'moveSelectionForward should only be called with a collapsed SelectionState',\n );\n const key = selection.getStartKey();\n const offset = selection.getStartOffset();\n const content = editorState.getCurrentContent();\n\n let focusKey = key;\n let focusOffset;\n\n const block = content.getBlockForKey(key);\n\n if (maxDistance > block.getText().length - offset) {\n focusKey = content.getKeyAfter(key);\n focusOffset = 0;\n } else {\n focusOffset = offset + maxDistance;\n }\n\n return selection.merge({focusKey, focusOffset});\n}",
"onMoveDownTap_() {\n /** @type {!CrActionMenuElement} */ (this.$.menu.get()).close();\n this.languageHelper.moveLanguage(\n this.detailLanguage_.language.code, false /* upDirection */);\n settings.recordSettingChange();\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter for API client, which allows making requests. | setApiClient(apiClient) {
this.apiClient = apiClient;
} | [
"_initSwaggerClient() {\n LOG.debug('Initializing Client with Swagger URL: ', this._swaggerUrl);\n\n const CLIENT = new SwaggerClient({\n url: this._swaggerUrl,\n usePromise: true,\n });\n\n CLIENT.then((client) => {\n this.client = client;\n this._clientReady();\n LOG.debug('SwaggerClient successfully initialized.');\n });\n\n CLIENT.catch((error) => {\n LOG.error('Error initializing SwaggerClient: ', error);\n });\n }",
"function MockCuriousClient() { }",
"getClient() {\n return this.tadoClient;\n }",
"function apiClient_() {\n this.get = function(url) {\n var options = {\n 'method': 'get',\n 'muteHttpExceptions': true,\n 'headers': {\n 'Authorization': 'Bearer ' + getOAuthToken_()\n }\n };\n try {\n var response = UrlFetchApp.fetch(url, options);\n } catch (err) {\n Utilities.sleep(3000);\n var response = UrlFetchApp.fetch(url, options);\n // Try again after 3 seconds. If sleeping doesn't help, don't catch the error\n }\n var responseCode = response.getResponseCode();\n var responseText = response.getContentText();\n if (responseCode !== 200) {\n throw 'Robinhood API request failed. ' + responseCode + ': ' + responseText;\n }\n var responseJson = JSON.parse(responseText);\n return responseJson;\n };\n\n this.pagedGet = function(url) {\n var responseJson = this.get(url);\n var results = responseJson.results;\n var nextUrl = responseJson.next;\n while (nextUrl) {\n responseJson = this.get(nextUrl);\n results.push.apply(results, responseJson.results);\n nextUrl = responseJson.next;\n }\n return results;\n };\n}",
"function initClient() {\n \n const keys = {\n // fill\n };\n\n return new Gdax.AuthenticatedClient(\n keys[\"API-key\"],\n keys[\"API-secret\"],\n keys[\"Passphrase\"],\n keys[\"Exchange-url\"]\n );\n}",
"function buildClient(){\n if(!client){\n\n const {acmEndpoint, kasEndpoint, easEndpoint} = getEndpointsByEnvironment();\n const authType = getAuthType();\n const provider = chooseAuthProviderByType({type: authType, redirectUrl: ''});\n\n client = new Virtru.Client.VirtruClient({\n acmEndpoint, kasEndpoint, easEndpoint,\n authProvider: provider\n });\n }\n\n return client;\n}",
"getRPCClient () {\n return rpcClient;\n }",
"function ProxyClient(options) {\n if (!(this instanceof ProxyClient)) {\n return new ProxyClient(options);\n }\n\n options = options || {};\n\n this.rootUrl = this.rootUrl || options.rootUrl || 'http://localhost';\n this.logger = this.logger || options.logger || sawmill.createMill(this.constructor.name);\n this.timeout = this.timeout || options.timeout || 5000;\n this.agent = this.agent || options.agent;\n\n this.headers = util._extend(this.headers || {}, options.headers);\n}",
"function SetupClient ()\n{\n client.registry.registerDefaults ();\n client.registry.registerGroups ([\n [\"bot\", \"Bot\"],\n [\"user\", \"User\"],\n [\"admin\", \"Admin\"],\n [\"social\", \"Social\"],\n [\"search\", \"Search\"],\n [\"random\", \"Random\"],\n [\"utility\", \"Utility\"],\n [\"reaction\", \"Reaction\"],\n [\"decision\", \"Decision\"],\n ]);\n client.registry.registerCommandsIn (__dirname + \"/Commands\");\n\n client.commandPrefix = config.Prefix;\n\n LogClient ();\n}",
"function ZeroCloudClient() {\n this._token = null;\n}",
"function getSubmissionApiWrapperClient () {\n if (submissionApiClient) {\n return submissionApiClient\n }\n\n submissionApiClient = submissionApi(_.pick(\n config,\n [\n 'AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',\n 'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',\n 'AUTH0_PROXY_SERVER_URL'\n ]\n ))\n\n return submissionApiClient\n}",
"withApiKey(apiKey) {\n JuspayEnvironment.apiKey = apiKey;\n return this;\n }",
"data () : DataClient {\n if (!this.announcement) {\n throw new Error(\"No handler configured, call open()!\")\n }\n\n return new DataClient(this.appID, this.appAccessKey, this.announcement.mqttAddress)\n }",
"_buildClient() {\n var metadata = (0, _frames.encodeFrame)({\n type: _frames.FrameTypes.DESTINATION_SETUP,\n majorVersion: null,\n minorVersion: null,\n group: this._config.setup.group,\n tags: this._tags,\n accessKey: this._accessKey,\n accessToken: this._accessToken,\n connectionId: this._connectionId,\n additionalFlags: this._additionalFlags\n });\n var transport = this._config.transport.connection !== undefined ? this._config.transport.connection : new _rsocketWebsocketClient.default({\n url: this._config.transport.url ? this._config.transport.url : 'ws://',\n wsCreator: this._config.transport.wsCreator\n }, _rsocketCore.BufferEncoders);\n var responder = this._config.responder || new _rsocket.UnwrappingRSocket(this._requestHandler);\n var finalConfig = {\n setup: {\n keepAlive: this._keepAlive,\n lifetime: this._lifetime,\n metadata,\n connectionId: this._connectionId,\n additionalFlags: this._additionalFlags\n },\n transport,\n responder\n };\n\n if (this._config.serializers !== undefined) {\n finalConfig.serializers = this._config.serializers;\n }\n\n this._client = new _FlowableRpcClient.default(finalConfig);\n }",
"function getClient() {\n return new googleapis.auth.OAuth2(\n config.clientId,\n config.clientSecret,\n config.redirectUrl\n );\n }",
"constructor() {\n //const LATTICE_NUM = globalThis.latticeNum;\n const LATTICE_PORT = 31415;\n const LATTICE_URL = `https://sustain.cs.colostate.edu:${LATTICE_PORT}`;\n this.service = new SustainClient(LATTICE_URL, \"sustainServer\");\n this.modelService = new JsonProxyClient(LATTICE_URL, \"sustainServer\");\n return this;\n }",
"setFeedURL(options) {\n // https://github.com/electron-userland/electron-builder/issues/1105\n let provider;\n\n if (typeof options === \"string\") {\n provider = new (_GenericProvider().GenericProvider)({\n provider: \"generic\",\n url: options\n }, this, (0, _providerFactory().isUrlProbablySupportMultiRangeRequests)(options));\n } else {\n provider = (0, _providerFactory().createClient)(options, this);\n }\n\n this.clientPromise = Promise.resolve(provider);\n }",
"configure() {\n\n let options = {};\n let pkgCloudConfiguration = this._config._configuration.pkgcloud;\n\n // openstack / rackspace / azure\n if (this._config._configuration.PKG_CLOUD_PROVIDER) {\n options.provider = this._config._configuration.PKG_CLOUD_PROVIDER\n } else if (pkgCloudConfiguration && pkgCloudConfiguration.provider) {\n options.provider = pkgCloudConfiguration.provider;\n } else {\n throw new Error('PkgClient: provider option is not defined, can\\'t create a client.')\n }\n\n if (options.provider === 'openstack' || options.provider === 'rackspace') {\n // Common option user name\n if (this._config._configuration.PKG_CLOUD_USER_NAME) {\n options.username = this._config._configuration.PKG_CLOUD_USER_NAME\n } else if (pkgCloudConfiguration && pkgCloudConfiguration.username) {\n options.username = pkgCloudConfiguration.username;\n } else {\n throw new Error('PkgClient: username option is not defined, can\\'t create a client.')\n }\n }\n\n if (options.provider == 'openstack') {\n\n if (this._config._configuration.PKG_CLOUD_AUTH_URL) {\n options.authUrl = this._config._configuration.PKG_CLOUD_AUTH_URL\n } else if (pkgCloudConfiguration && pkgCloudConfiguration.authUrl) {\n options.authUrl = pkgCloudConfiguration.authUrl;\n } else {\n throw new Error('PkgClient: authUrl option is not defined for openstack provider, can\\'t create a client.')\n }\n\n if (this._config._configuration.PKG_CLOUD_PASSWORD) {\n options.password = this._config._configuration.PKG_CLOUD_PASSWORD\n } else if (pkgCloudConfiguration && pkgCloudConfiguration.password) {\n options.password = pkgCloudConfiguration.password;\n } else {\n throw new Error('PkgClient: password option is not defined for openstack provider, can\\'t create a client.')\n }\n\n } else if (options.provider == 'rackspace') {\n\n if (this._config._configuration.PKG_CLOUD_API_KEY) {\n options.apiKey = this._config._configuration.PKG_CLOUD_API_KEY\n } else if (pkgCloudConfiguration && pkgCloudConfiguration.apiKey) {\n options.apiKey = pkgCloudConfiguration.apiKey;\n } else {\n throw new Error('PkgClient: apiKey option is not defined for openstack provider, can\\'t create a client.')\n }\n\n } else if (options.provider == 'azure') {\n\n if (this._config._configuration.PKG_CLOUD_AZURE_ACCOUNT) {\n options.storageAccount = this._config._configuration.PKG_CLOUD_AZURE_ACCOUNT;\n } else if (pkgCloudConfiguration && pkgCloudConfiguration.azureAccount) {\n options.storageAccount = pkgCloudConfiguration.azureAccount;\n } else {\n throw new Error('PkgClient: storageAccount option is not defined for azure provider, can\\'t create a client.')\n }\n\n if (this._config._configuration.PKG_CLOUD_AZURE_ACCESS_KEY) {\n options.storageAccessKey = this._config._configuration.PKG_CLOUD_AZURE_ACCESS_KEY;\n } else if (pkgCloudConfiguration && pkgCloudConfiguration.azureAccessKey) {\n options.storageAccessKey = pkgCloudConfiguration.azureAccessKey;\n } else {\n throw new Error('PkgClient: storageAccessKey option is not defined for azure provider, can\\'t create a client.')\n }\n\n } else {\n throw new Error(`PkgClient: Unexpected provider '${options.provider}'.`);\n }\n\n // Optional\n if (this._config._configuration.PKG_CLOUD_REGION) {\n options.region = this._config._configuration.PKG_CLOUD_REGION\n } else if (pkgCloudConfiguration && pkgCloudConfiguration.region) {\n options.region = pkgCloudConfiguration.region;\n }\n\n this._options = options;\n\n // Create a client\n this._client = require('pkgcloud').storage.createClient(options);\n }",
"setSelectedClient(state, selectedClient) {\n state.selectedClient = selectedClient;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IMGUI_API bool InputTextWithHint(const char label, const char hint, char buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void user_data = NULL); | function InputTextWithHint(label, hint, buf, buf_size = buf instanceof ImStringBuffer ? buf.size : ImGuiInputTextDefaultSize, flags = 0, callback = null, user_data = null) {
const _callback = callback && ((data) => callback(new ImGuiInputTextCallbackData(data, user_data))) || null;
if (Array.isArray(buf)) {
return bind.InputTextWithHint(label, hint, buf, buf_size, flags, _callback, null);
}
else if (buf instanceof ImStringBuffer) {
const ref_buf = [buf.buffer];
const _buf_size = Math.min(buf_size, buf.size);
const ret = bind.InputTextWithHint(label, hint, ref_buf, _buf_size, flags, _callback, null);
buf.buffer = ref_buf[0];
return ret;
}
else {
const ref_buf = [buf()];
const ret = bind.InputTextWithHint(label, hint, ref_buf, buf_size, flags, _callback, null);
buf(ref_buf[0]);
return ret;
}
} | [
"function InputText(label, buf, buf_size = buf instanceof ImStringBuffer ? buf.size : ImGuiInputTextDefaultSize, flags = 0, callback = null, user_data = null) {\r\n const _callback = callback && ((data) => callback(new ImGuiInputTextCallbackData(data, user_data))) || null;\r\n if (Array.isArray(buf)) {\r\n return bind.InputText(label, buf, buf_size, flags, _callback, null);\r\n }\r\n else if (buf instanceof ImStringBuffer) {\r\n const ref_buf = [buf.buffer];\r\n const _buf_size = Math.min(buf_size, buf.size);\r\n const ret = bind.InputText(label, ref_buf, _buf_size, flags, _callback, null);\r\n buf.buffer = ref_buf[0];\r\n return ret;\r\n }\r\n else {\r\n const ref_buf = [buf()];\r\n const ret = bind.InputText(label, ref_buf, buf_size, flags, _callback, null);\r\n buf(ref_buf[0]);\r\n return ret;\r\n }\r\n }",
"function InputTextMultiline(label, buf, buf_size = buf instanceof ImStringBuffer ? buf.size : ImGuiInputTextDefaultSize, size = ImVec2.ZERO, flags = 0, callback = null, user_data = null) {\r\n const _callback = callback && ((data) => callback(new ImGuiInputTextCallbackData(data, user_data))) || null;\r\n if (Array.isArray(buf)) {\r\n return bind.InputTextMultiline(label, buf, buf_size, size, flags, _callback, null);\r\n }\r\n else if (buf instanceof ImStringBuffer) {\r\n const ref_buf = [buf.buffer];\r\n const _buf_size = Math.min(buf_size, buf.size);\r\n const ret = bind.InputTextMultiline(label, ref_buf, _buf_size, size, flags, _callback, null);\r\n buf.buffer = ref_buf[0];\r\n return ret;\r\n }\r\n else {\r\n const ref_buf = [buf()];\r\n const ret = bind.InputTextMultiline(label, ref_buf, buf_size, size, flags, _callback, null);\r\n buf(ref_buf[0]);\r\n return ret;\r\n }\r\n }",
"function showAcceptedUserInputHint(input, label) {\n label.classList.add(\"active\");\n label.textContent = acceptedInputHints[input.id];\n}",
"function typeOnCanvas() {\n var memeText = $('#custom-text');\n gMeme.labels[0].txt = memeText.val();\n drawCanvas();\n}",
"function switchText_cb(new_string)\r\n{\r\n\twith(currObj);\r\n\tnew_string = new_string.replace(/~~~/gi, \"\\n\");\r\n\r\n\t// Remove the prefixed asterisk that was added in switchText().\r\n\tnew_string = new_string.substr(1);\r\n\tcurrObj.objToCheck.style.display = \"none\";\r\n\tcurrObj.objToCheck.value = new_string;\r\n\tcurrObj.objToCheck.disabled = false;\r\n\tif(currObj.spellingResultsDiv)\r\n\t{\r\n\t\tcurrObj.spellingResultsDiv.parentNode.removeChild(currObj.spellingResultsDiv);\r\n\t\tcurrObj.spellingResultsDiv = null;\r\n\t}\r\n\tcurrObj.objToCheck.style.display = \"block\";\r\n\tcurrObj.resetAction();\r\n}",
"function changeHint(classChange, innerText, callback) {\n getEl('hintbtn').className = classChange;\n getEl('hintbtn').innerHTML = innerText;\n getEl('hintbtn').setAttribute('onclick',callback);\n}",
"function firstHint() {\n hintState = 1;\n divHide('wrongmsg');\n changeHint('hint_btn1','Hint #2','secondHint()');\n jumbled = capital(jumbledArr, mapArr).join(\"\");\n getEl('gamebox').innerHTML = jumbled;\n getEl('user_id').focus();\n}",
"static TextEditCallbackStub(data) {\r\n // ExampleAppConsole* console = (ExampleAppConsole*)data->UserData;\r\n const _console = data.UserData;\r\n return _console.TextEditCallback(data);\r\n }",
"function emojiInputHandler(event) {\n var userInput = event.target.value;\n // var meaning = emojiDictionary[userInput];\n if (userInput in emojiDictionary) {\n setMeaning(emojiDictionary[userInput]);\n } else setMeaning(\"That's a new one! We don't have this in our database\");\n }",
"prompt(text, callback) {\n let wrap = this.element.appendChild(document.createElement(\"div\"))\n wrap.textContent = text + \" \"\n let input = wrap.appendChild(document.createElement(\"input\"))\n input.addEventListener(\"keydown\", event => {\n if (event.keyCode == 13) {\n let replace = document.createElement(\"span\")\n replace.textContent = input.value\n wrap.replaceChild(replace, input)\n callback(input.value, replace)\n }\n })\n input.focus()\n }",
"function w3_input(psa, label, path, val, cb, placeholder)\n{\n\tvar id = path? ('id-'+ path) : '';\n\tcb = cb || '';\n\tvar phold = placeholder? (' placeholder=\"'+ placeholder +'\"') : '';\n\tvar onchange = path? (' onchange=\"w3_input_change('+ sq(path) +', '+ sq(cb) +')\" onkeydown=\"w3int_input_key(event, '+ sq(path) +', '+ sq(cb) +')\"') : '';\n\tvar val = ' value='+ dq(w3_esc_dq(val) || '');\n\tvar inline = psa.includes('w3-label-inline');\n\tvar bold = !psa.includes('w3-label-not-bold');\n\tvar spacing = (label != '' && inline)? ' w3int-margin-input' : '';\n\n\t// type=\"password\" in no good because it forces the submit to be https which we don't support\n\tvar type = 'type='+ (psa.includes('w3-password')? '\"password\"' : '\"text\"');\n\n var psa3 = w3_psa3(psa);\n var psa_outer = w3_psa(psa3.left, inline? 'w3-show-inline-new':'');\n var psa_label = w3_psa_mix(psa3.middle, (label != '' && bold)? 'w3-bold':'');\n\tvar psa_inner = w3_psa(psa3.right, 'w3-input w3-border w3-hover-shadow '+ id + spacing, '', type + phold);\n\n\tvar s =\n\t '<div '+ psa_outer +'>' +\n w3_label(psa_label, label, path) +\n\t\t // NB: include id in an id= for benefit of keyboard shortcut field detection\n '<input id='+ dq(id) +' '+ psa_inner + val + onchange +'>' +\n '</div>';\n\t//if (path == 'Title') console.log(s);\n\t//w3int_input_set_id(id);\n\treturn s;\n}",
"function editText(text) {\n var pos = editor.$edit.get(0).selectionStart;\n var $newedit = editor.$edit.clone().val(text);\n var newedit = $newedit.get(0);\n editor.$edit.replaceWith($newedit);\n editor.$edit = $newedit;\n $newedit.on('keyup', editorUpdate);\n newedit.selectionStart = pos;\n newedit.selectionEnd = pos;\n editor.$edit.focus(hideControls).focus();\n }",
"swapPlaceholder(newText) {\n\n\t}",
"function aeInsertTextIntoTextbox(aTextboxElt, aInsertedText)\n{\n var text, pre, post, pos;\n text = aTextboxElt.value;\n\n if (aTextboxElt.selectionStart == aTextboxElt.selectionEnd) {\n var point = aTextboxElt.selectionStart;\n pre = text.substring(0, point);\n post = text.substring(point, text.length);\n pos = point + aInsertedText.length;\n }\n else {\n var p1 = aTextboxElt.selectionStart;\n var p2 = aTextboxElt.selectionEnd;\n pre = text.substring(0, p1);\n post = text.substring(p2, text.length);\n pos = p1 + aInsertedText.length;\n }\n\n aTextboxElt.value = pre + aInsertedText + post;\n aTextboxElt.selectionStart = pos;\n aTextboxElt.selectionEnd = pos;\n}",
"function addOrUpdateTextLabel() {\n showModalDialog(\n Data.Edit.Node ? 'Update or delete text label' : 'Add a text label',\n true, Data.Edit.Node ? Data.Edit.Node.textContent : '',\n 'OK', function textModalOK() {\n let textContent = getModalInputText();\n if (textContent) textContent = textContent.trim();\n if (textContent) {\n if (Data.Edit.Node) {\n Data.Edit.Node.textContent = textContent;\n const colour = getModalColourValue();\n if (colour) Data.Edit.Node.style.fill = colour;\n Data.Edit.Node.classList.remove(SELECT_CLASS);\n } else {\n const x = (Data.Pointer.X - parseFloat(Data.Svg.Node.style.left)) /\n Data.Svg.RatioX;\n const y = (Data.Pointer.Y - parseFloat(Data.Svg.Node.style.top)) /\n Data.Svg.RatioY;\n\n const text = document.createElementNS(SVG_NAMESPACE, 'text');\n text.setAttribute('class', TEXT_CLASS);\n text.setAttribute('transform',\n `translate(${x.toFixed(1)} ${y.toFixed(1)})`);\n text.textContent = textContent;\n\n const colour = getModalColourValue();\n text.style.fill = colour ? colour : Colours[0];\n\n Data.Svg.Node.appendChild(text);\n }\n\n hasEdits(true);\n }\n },\n Data.Edit.Node ? 'Delete' : undefined, function textDelete() {\n Data.Edit.Node.remove();\n hasEdits(true);\n },\n 'Cancel', function textModalCancel() {\n if (Data.Edit.Node) Data.Edit.Node.classList.remove(SELECT_CLASS);\n },\n false, undefined, undefined,\n true, 'Select a label colour:',\n Data.Edit.Node ? getHexForColour(Data.Edit.Node.style.fill) : '#ff0000');\n}",
"function printHint() {\n $('#hint').text(current_word.hint);\n}",
"function displayInput(){\r\n\tdrawNewInput();\r\n\tscrollToEnd();\r\n}",
"function hint(bool){\n\t/** SWITCH THIS STATEMENT TO TRUE IF WANT TO SHOW MORE ACCURATE HINT */\n\tvar showAnswer = false;\n\tvar hints = document.getElementById('hints');\n\t/** ADD IN THIS PART IF NEED THE HINT BAR TO SAY CORRECT. BUT REDUNDANT IN MESSAGE BOX ALREADY.\n\tif(bool == (colorCheck() && numberCheck())){\n\t\tdocument.getElementById('hints').innerHTML = \"Correct!\";\n\t\treturn;\n\t}\n\t*/\n\thints.innerHTML = \"\";\n\t//Checks if the user got a color logic error.\n\tif(bool != colorCheck()){\n\t\thints.innerHTML += showAnswer ? color[c1] + operation[op] + color[c2] + \" = \" + color[c3] : \"Color Logic Error\";\n\t\t//This only appear if there are both error compared to user's answer.\n\t\thints.innerHTML += colorCheck() == numberCheck() ? \" AND \" : \"\";\n\t}\n\t//Checks if the user got a number logic error.\n\tif(bool != numberCheck())\n\t\thints.innerHTML += showAnswer ? firstNumber + operation[op] + secondNumber + \" = \" + sum : \"Number Logic Error\";\n}",
"function hintStyle() {\n \n document.getElementById(\"hint\").style.display = \"none\";\n document.getElementById(\"hintDisplay\").style.display = \"inherit\";\n document.getElementById(\"hintDisplay\").style.margin = \"90px 0px -64px 18px\";\n \n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Use this method to render separate lists for each L1 service | renderServiceLists() {
const {
facility: {
attributes: { services },
},
} = this.props;
if (!services) {
return null;
}
return <div>{services.map(this.renderServiceBlock)}</div>;
} | [
"function servicesList() {\n connection.query(\"SELECT * FROM servicesList\", function (err, results) {\n\n if (err) throw err;\n \n }\n\n )}",
"getServices() {\n let services = []\n this.informationService = new Service.AccessoryInformation();\n this.informationService\n .setCharacteristic(Characteristic.Manufacturer, \"OpenSprinkler\")\n .setCharacteristic(Characteristic.Model, \"OpenSprinkler\")\n .setCharacteristic(Characteristic.SerialNumber, \"opensprinkler-system\");\n services.push(this.informationService)\n\n // Add the irrigation system service\n this.irrigationSystemService = new Service.IrrigationSystem(this.name);\n this.irrigationSystemService.getCharacteristic(Characteristic.Active)\n .on(\"get\", syncGetter(this.getSystemActiveCharacteristic.bind(this)))\n .on('set', promiseSetter(this.setSystemActiveCharacteristic.bind(this)))\n\n this.irrigationSystemService.getCharacteristic(Characteristic.InUse)\n .on('get', syncGetter(this.getSystemInUseCharacteristic.bind(this)))\n\n this.irrigationSystemService.getCharacteristic(Characteristic.ProgramMode)\n .on('get', syncGetter(this.getSystemProgramModeCharacteristic.bind(this)))\n\n this.irrigationSystemService.addCharacteristic(Characteristic.RemainingDuration)\n .on('get', syncGetter(this.getSystemRemainingDurationCharacteristic.bind(this)))\n\n this.irrigationSystemService.setPrimaryService(true)\n\n services.push(this.irrigationSystemService)\n\n // Add the service label service\n this.serviceLabelService = new Service.ServiceLabel()\n this.serviceLabelService.getCharacteristic(Characteristic.ServiceLabelNamespace).setValue(Characteristic.ServiceLabelNamespace.DOTS)\n\n // Add all of the valve services\n this.sprinklers.forEach(function (sprinkler) {\n sprinkler.valveService = new Service.Valve(\"\", \"zone-\" + sprinkler.sid);\n // sprinkler.valveService.subtype = \"zone-\" + sprinkler.sid\n\n // Set the valve name\n const standardName = 'S' + ('0' + sprinkler.sid).slice(-2);\n let userGaveName = standardName != sprinkler.name;\n // log(\"Valve name:\", sprinkler.name, userGaveName)\n if (userGaveName) {\n sprinkler.valveService.getCharacteristic(Characteristic.Name).setValue(sprinkler.name)\n // sprinkler.valveService.addCharacteristic(Characteristic.ConfiguredName).setValue(sprinkler.name)\n }\n\n sprinkler.valveService.getCharacteristic(Characteristic.ValveType).updateValue(Characteristic.ValveType.IRRIGATION);\n\n sprinkler.valveService\n .getCharacteristic(Characteristic.Active)\n .on('get', syncGetter(sprinkler.getSprinklerActiveCharacteristic.bind(sprinkler)))\n .on('set', promiseSetter(sprinkler.setSprinklerActiveCharacteristic.bind(sprinkler)))\n\n sprinkler.valveService\n .getCharacteristic(Characteristic.InUse)\n .on('get', syncGetter(sprinkler.getSprinklerInUseCharacteristic.bind(sprinkler)))\n\n sprinkler.valveService.addCharacteristic(Characteristic.SetDuration)\n .on('get', syncGetter(() => sprinkler.setDuration))\n .on('set', (duration, next) => {\n sprinkler.setDuration = duration\n log.debug(\"SetDuration\", duration)\n next()\n })\n\n sprinkler.valveService.addCharacteristic(Characteristic.RemainingDuration)\n\n // Set its service label index\n sprinkler.valveService.addCharacteristic(Characteristic.ServiceLabelIndex).setValue(sprinkler.sid)\n \n // Check if disabled\n sprinkler.disabledBinary = this.disabledStations.toString(2).split('').reverse()\n sprinkler.isDisabled = sprinkler.disabledBinary[sprinkler.sid - 1] === '1'\n\n // log('DISABLED length + sid -------->' + this.sprinklers.length + ' ' + sprinkler.sid)\n // log('DISABLED DATA -------->' + sprinkler.disabledBinary + ' ' + (sprinkler.sid - 1) + ' ' + sprinkler.isDisabled)\n\n // Set if it's not disabled\n // const isConfigured = !sprinkler.isDisabled ? Characteristic.IsConfigured.CONFIGURED : Characteristic.IsConfigured.NOT_CONFIGURED\n sprinkler.valveService.getCharacteristic(Characteristic.IsConfigured)\n .on('get', syncGetter(sprinkler.getSprinklerConfiguredCharacteristic.bind(sprinkler)))\n .on('set', promiseSetter(sprinkler.setSprinklerConfiguredCharacteristic.bind(sprinkler)))\n // .setValue(isConfigured)\n\n // Link this service\n this.irrigationSystemService.addLinkedService(sprinkler.valveService)\n this.serviceLabelService.addLinkedService(sprinkler.valveService)\n\n services.push(sprinkler.valveService)\n }.bind(this))\n\n return services\n }",
"function showList(a_oItems, g_nLoc){\n \n var s_List = \"\"; \n for (var i=0; i< a_oItems.length; i++){\n s_List = s_List + \"\\n\" + a_oItems[i].Name(g_nLoc); \n } \n return s_List; \n}",
"function TfLLineStatusList(props) {\n const lines = props.lineStatuses;\n const lineStatusItems = lines.map((status, index) =>\n <div key={index}>\n <h4>{status.statusSeverityDescription}</h4>\n <p>{status.reason}</p>\n <hr/>\n </div>\n );\n\n return (\n <ListGroup>{lineStatusItems}</ListGroup>\n );\n}",
"function renderListings(features,inputValue,layerID, noMatched, layerIDs) {\r\n\r\n if (features.length && inputValue !== '') {\r\n // display the filtered list\r\n $(\"#filtered-list-wrap\").removeClass(\"d-none\");\r\n features.forEach(function(feature) {\r\n var name = feature.properties.name;\r\n var addr = feature.properties.address;\r\n // replaced by place detail page link later\r\n // var link = feature.properties.link;\r\n var detailLink = \"placeDetail.html\";\r\n var w3wArr = str2CleanArr(feature.properties.w3w);\r\n var w3w = w3wArr.join(\".\");\r\n\r\n // optional features\r\n var hashtagsArr = feature.properties.hashtags ? str2CleanArr(feature.properties.hashtags) : null;\r\n var hashtags = hashtagsArr.join(\" #\");\r\n\r\n // insert into the framed html\r\n filteredListGrp.append('<a href='+detailLink+' class=\"list-group-item list-group-item-action border-bottom\"><div class=\"d-flex w-100 justify-content-between\"><p class=\"mb-0\">'+name+'</p><sm class=\"ex-sm text-muted\">'+w3w+'</sm></div><p class=\"mb-0 text-muted\"><sm class=\"ex-sm\">#'+ hashtags+'</sm></p><p class=\"mb-1 text-muted\"><small>'+addr+'</small></p></a>');\r\n });\r\n } else if (features.length === 0 && inputValue !== '') {\r\n noMatched.push(\"true\");\r\n // console.log(noMatched);\r\n // console.log(inputValue.length);\r\n if (noMatched.length >= layerIDs.length) {\r\n $(\"#filtered-list-wrap\").removeClass(\"d-none\");\r\n filteredListGrp.html(\"\");\r\n filteredListGrp.html('<a class=\"list-group-item list-group-item-action border-0\"><p class=\"mb-1\">No results found.</p></a>');\r\n }\r\n } else {\r\n filteredListGrp.html(\"\");\r\n $(\"#filtered-list-wrap\").addClass(\"d-none\");\r\n // remove feature filters\r\n map.setFilter(layerID, ['has','id']);\r\n map.setLayoutProperty(\r\n layerID,\r\n 'visibility',\r\n 'visible'\r\n );\r\n }\r\n}",
"function listServices(callback){\r\n\tjQuery.getJSON( 'APIS/returnServicesJSON.txt', \r\n\t\t\tfunction(returnData, status){\r\n\t\t\t\tif(returnData.RETURN.success){\r\n\t\t\t\t\tcallback(returnData.RETURN.success,returnData.SERVICES);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tcallback(returnData.RETURN.success,returnData.RETURN.errorDescription);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n}",
"loadAPIServices(){\n\n var selected = null;\n\n /**\n * Load Transactions Chart Data\n */\n this.loadGraph();\n\n /**\n * Load All API Services.\n */ \n this.loadVolumes(); \n this.loadMonthlyVolume();\n this.loadMonthlyVolumeByCard();\n this.loadVolumeAnalysis();\n }",
"function TfLLineList(props) {\n const lines = props.lines;\n const lineItems = lines.map((line) =>\n <Card key={line.id}>\n <Card.Header>{line.name}</Card.Header>\n <Card.Body>\n <TfLLineStatusList lineStatuses={line.lineStatuses}/>\n </Card.Body>\n </Card>\n );\n\n return (\n <ListGroup>{lineItems}</ListGroup>\n );\n}",
"function buildList() {\n $log.debug(\"Building list...\");\n vm.list = Object.keys(queryFields); //get the keys\n vm.definitions = queryFields;\n $log.debug(vm.definitions);\n }",
"showIngredients(ingredients) {\r\n let output = \"\";\r\n ingredients.forEach((ingredient) => {\r\n output += `<li>${ingredient.original}</li>`;\r\n });\r\n\r\n document.getElementById(\"ingredientList\").innerHTML = output;\r\n }",
"addServices (accessory) {\n const informationService = accessory.getService(Service.AccessoryInformation); // new Service.AccessoryInformation();\n this.remote_type = this.accessory.context.light_info.remote_type;\n if (informationService) {\n informationService\n .setCharacteristic(Characteristic.Manufacturer, 'MiLight')\n .setCharacteristic(Characteristic.Model, accessory.context.light_info.remote_type)\n .setCharacteristic(Characteristic.SerialNumber, accessory.context.light_info.group_id + '/' + accessory.context.light_info.device_id)\n .setCharacteristic(Characteristic.FirmwareRevision, packageJSON.version);\n } else {\n this.log('Error: No information service found');\n }\n const lightbulbService = new Service.Lightbulb(this.name);\n lightbulbService.addCharacteristic(new Characteristic.Brightness());\n if (this.platform.rgbRemotes.includes(this.remote_type) || this.platform.rgbcctRemotes.includes(this.remote_type)) {\n lightbulbService.addCharacteristic(new Characteristic.Saturation());\n lightbulbService.addCharacteristic(new Characteristic.Hue());\n }\n if (this.platform.whiteRemotes.includes(this.remote_type) || (this.platform.rgbcctMode && this.platform.rgbcctRemotes.includes(this.remote_type))) {\n lightbulbService\n .addCharacteristic(new Characteristic.ColorTemperature())\n .updateValue(370)\n .setProps({\n maxValue: 370, // maxValue 370 = 2700K (1000000/2700)\n minValue: 153 // minValue 153 = 6500K (1000000/6500)\n });\n }\n accessory.addService(lightbulbService);\n }",
"async getServiceOfferings(serviceLine) {\n try {\n this.$router.push('/ServiceLine')\n this.$store.commit('clearServiceOfferings'); \n this.$store.commit('addBreadcrumb', {\n index: 1, \n link: {\n 'text': serviceLine,\n 'disabled': false,\n 'to': 'ServiceLine'\n }\n });\n const res = await axios.get(`https://sharepoint.mcipac.usmc.mil/g6/internal/csb/_api/web/lists/getByTitle('Service Catalog')/items?$filter=Title eq '${serviceLine}'`)\n const data = res.data.d.results;\n console.log(data);\n for (let key in data) {\n const offering = data[key];\n this.$store.commit('addOffering', offering);\n }\n } catch (error) {\n console.log(error);\n }\n }",
"displayChallengers () {\n let challengers = this.challengers\n for (let i = 0, length = challengers.length; i < length; i++) {\n this.createListItem(challengers[i])\n }\n }",
"function showTermList() {\n scroll_list_ui.innerHTML = \"\"; // reset list contents\n for (var i = 0; i < term_list.length; i++) { // loop over list of terms\n scroll_list_ui.innerHTML = scroll_list_ui.innerHTML + term_list[i] + '<br>';\n // add term to list in UI\n }\n }",
"function displayTrainers(trainers) {\n // the argument that we're passing in when we call this function above //\n // in the REQUEST function //\n // are the trainers we're getting back from the API //\n let trainerHTML = trainers.map(trainer => renderTrainer(trainer))\n // for each trainer, pass in the info to the renderTrainer function below //\n // and save it to the variable trainerHTML\n // console.log(trainerHTML);\n trainerContainer.innerHTML = trainerHTML.join('')\n // set the innerHTML of the trainerContainer to be equivalent to the trainerHTML //\n // HTML that we just created above //\n // and join every string together //\n // the browser is smart enough to create HTML based on the string //\n }",
"function makeInsulaIdsListShortNamesList(){\n\t\tvar currentInsulaId;\n\t\tpompeiiInsulaLayer.eachLayer(function(layer){\n\t\t\tif(layer.feature!=undefined){\n\t\t\t\tcurrentInsulaId=layer.feature.properties.insula_id;\n\t\t\t\t//if(layer.feature.properties.insula_id!=currentInsulaId){\n\t\t\t\tif(insulaGroupIdsList.indexOf(currentInsulaId)==-1){\n\t\t\t\t\tinsulaGroupIdsList.push(currentInsulaId);\n\t\t\t\t}\n\t\t\t\t//}\n\t\t\t\tinsulaShortNamesDict[currentInsulaId]=layer.feature.properties.insula_short_name;\n\t\t\t}\n\t\t});\n\t}",
"_getServicesRecursively (serviceInfo) {\n if (Array.isArray(serviceInfo)) serviceInfo = serviceInfo[0]\n for (let i = 0; i < serviceInfo.service.length; i++) {\n const service = serviceInfo.service[i]\n if ('service' in service) this._getServicesRecursively(service)\n else {\n const srv = new Service(service)\n this.services[srv.name] = srv\n }\n }\n }",
"startServices () {\n for (let serviceId in this.services) {\n let service = this.services[serviceId]\n service.start().then(() => {\n this.logger.log(`${service.name}: OK`)\n }).catch(() => {\n // TODO: Figure out how to handle errors here.\n })\n }\n }",
"function renderAllStaff( allStaff ){\n for(var i = 0; i < allStaff.length; i++){\n renderOneStaff(allStaff[i]);\n }\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructor: Engine / Constructs a new Engine object. If width or height is given, / it will not attempt to fetch tiles outside the boundaries. / In that case 0,0 is assumed as the upperleft corner of the world, / but if no width/height is given also negative coords are valid. / / Parameters: / vp the instance to use as the viewport / func the function used for fetching tiles / w (integer) (optional) world width in tiles / h (integer) (optional) world height in tiles | function Engine(viewport, tileFunc, w, h) {
this.viewport = viewport;
this.tileFunc = tileFunc;
this.w = w;
this.h = h;
this.refreshCache = true;
this.cacheEnabled = false;
this.transitionDuration = 0;
this.cachex = 0;
this.cachey = 0;
this.tileCache = new Array(viewport.h);
this.tileCache2 = new Array(viewport.h);
for (var j = 0; j < viewport.h; ++j) {
this.tileCache[j] = new Array(viewport.w);
this.tileCache2[j] = new Array(viewport.w);
}
} | [
"function makeWorldPoint(point, w, h, scale, cameraPos) {\n return {\n x: point.x - ((w * scale) / 2) + cameraPos.x,\n y: point.y - ((h * scale) / 2) + cameraPos.y\n };\n}",
"function makeVisualPoint(point, w, h, scale, cameraPos) {\n return {\n x: point.x + ((w * scale) / 2) - cameraPos.x,\n y: point.y + ((h * scale) / 2) - cameraPos.y\n };\n}",
"function getMaskViewport({\n bounds,\n viewport,\n width,\n height\n}) {\n if (bounds[2] <= bounds[0] || bounds[3] <= bounds[1]) {\n return null;\n } // Single pixel border to prevent mask bleeding at edge of texture\n\n\n const padding = 1;\n width -= padding * 2;\n height -= padding * 2;\n\n if (viewport instanceof _viewports_web_mercator_viewport__WEBPACK_IMPORTED_MODULE_1__[\"default\"]) {\n const {\n longitude,\n latitude,\n zoom\n } = Object(_math_gl_web_mercator__WEBPACK_IMPORTED_MODULE_2__[\"fitBounds\"])({\n width,\n height,\n bounds: [[bounds[0], bounds[1]], [bounds[2], bounds[3]]],\n maxZoom: 20\n });\n return new _viewports_web_mercator_viewport__WEBPACK_IMPORTED_MODULE_1__[\"default\"]({\n longitude,\n latitude,\n zoom,\n x: padding,\n y: padding,\n width,\n height\n });\n }\n\n const center = [(bounds[0] + bounds[2]) / 2, (bounds[1] + bounds[3]) / 2, 0];\n const scale = Math.min(20, width / (bounds[2] - bounds[0]), height / (bounds[3] - bounds[1]));\n return new _views_orthographic_view__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n x: padding,\n y: padding\n }).makeViewport({\n width,\n height,\n viewState: {\n target: center,\n zoom: Math.log2(scale)\n }\n });\n}",
"getViewport() {\n return {\n minX: this.minX,\n maxX: this.maxX,\n minY: this.minY,\n maxY: this.maxY,\n xRange: this.currentXRange,\n yRange: this.currentYRange\n };\n }",
"function VectormapView(html_id) {\n var DEFAULT_ID = 'energy2d-vectormap-view',\n VECTOR_SCALE = 100,\n VECTOR_BASE_LEN = 8,\n WING_COS = Math.cos(0.523598776),\n WING_SIN = Math.sin(0.523598776),\n WING_LEN = 4,\n ARROW_COLOR = \"rgb(175,175,175)\",\n $vectormap_canvas,\n canvas_ctx,\n canvas_width,\n canvas_height,\n vectormap_u,\n vectormap_v,\n grid_width,\n grid_height,\n spacing,\n enabled = true,\n //\n // Private methods.\n //\n initHTMLelement = function initHTMLelement() {\n $vectormap_canvas = $('<canvas />');\n $vectormap_canvas.attr('id', html_id || DEFAULT_ID);\n canvas_ctx = $vectormap_canvas[0].getContext('2d');\n },\n // Helper method for drawing a single vector.\n drawVector = function drawVector(x, y, vx, vy) {\n var r = 1.0 / Math.sqrt(vx * vx + vy * vy),\n arrowx = vx * r,\n arrowy = vy * r,\n x1 = x + arrowx * VECTOR_BASE_LEN + vx * VECTOR_SCALE,\n y1 = y + arrowy * VECTOR_BASE_LEN + vy * VECTOR_SCALE,\n wingx = WING_LEN * (arrowx * WING_COS + arrowy * WING_SIN),\n wingy = WING_LEN * (arrowy * WING_COS - arrowx * WING_SIN);\n canvas_ctx.beginPath();\n canvas_ctx.moveTo(x, y);\n canvas_ctx.lineTo(x1, y1);\n canvas_ctx.lineTo(x1 - wingx, y1 - wingy);\n canvas_ctx.moveTo(x1, y1);\n wingx = WING_LEN * (arrowx * WING_COS - arrowy * WING_SIN);\n wingy = WING_LEN * (arrowy * WING_COS + arrowx * WING_SIN);\n canvas_ctx.lineTo(x1 - wingx, y1 - wingy);\n canvas_ctx.stroke();\n },\n //\n // Public API.\n //\n vectormap_view = {\n // Render vectormap on the canvas.\n renderVectormap: function renderVectormap() {\n if (!enabled) return;\n var dx, dy, x0, y0, uij, vij, i, j, iny, ijny;\n\n if (!vectormap_u || !vectormap_v) {\n throw new Error(\"Vectormap: bind vectormap before rendering.\");\n }\n\n dx = canvas_width / grid_width;\n dy = canvas_height / grid_height;\n canvas_ctx.clearRect(0, 0, canvas_width, canvas_height);\n canvas_ctx.strokeStyle = ARROW_COLOR;\n canvas_ctx.lineWidth = 1;\n\n for (i = 1; i < grid_width - 1; i += spacing) {\n iny = i * grid_height;\n x0 = (i + 0.5) * dx; // + 0.5 to move arrow into field center\n\n for (j = 1; j < grid_height - 1; j += spacing) {\n ijny = iny + j;\n y0 = (j + 0.5) * dy; // + 0.5 to move arrow into field center\n\n uij = vectormap_u[ijny];\n vij = vectormap_v[ijny];\n\n if (uij * uij + vij * vij > 1e-15) {\n drawVector(x0, y0, uij, vij);\n }\n }\n }\n },\n clear: function clear() {\n canvas_ctx.clearRect(0, 0, canvas_width, canvas_height);\n },\n\n get enabled() {\n return enabled;\n },\n\n set enabled(v) {\n enabled = v; // Clear vectormap, as .renderVectormap() call won't do it.\n\n if (!enabled) vectormap_view.clear();\n },\n\n // Bind vector map to the view.\n bindVectormap: function bindVectormap(new_vectormap_u, new_vectormap_v, new_grid_width, new_grid_height, arrows_per_row) {\n if (new_grid_width * new_grid_height !== new_vectormap_u.length) {\n throw new Error(\"Heatmap: provided U component of vectormap has wrong dimensions.\");\n }\n\n if (new_grid_width * new_grid_height !== new_vectormap_v.length) {\n throw new Error(\"Heatmap: provided V component of vectormap has wrong dimensions.\");\n }\n\n vectormap_u = new_vectormap_u;\n vectormap_v = new_vectormap_v;\n grid_width = new_grid_width;\n grid_height = new_grid_height;\n spacing = Math.round(new_grid_width / arrows_per_row);\n },\n getHTMLElement: function getHTMLElement() {\n return $vectormap_canvas;\n },\n resize: function resize() {\n canvas_width = $vectormap_canvas.width();\n canvas_height = $vectormap_canvas.height();\n $vectormap_canvas.attr('width', canvas_width);\n $vectormap_canvas.attr('height', canvas_height);\n }\n }; // One-off initialization.\n\n\n initHTMLelement();\n return vectormap_view;\n}",
"function Building(x,y,vx,width,height,speed,position,windowColumns,windowRows,rightKey,color) {\n this.x = x;\n this.y = y;\n this.vx = vx;\n this.width = width;\n this.height = height;\n this.speed = speed;\n this.position = position;\n this.windowColumns = windowColumns;\n this.windowRows = windowRows;\n this.rightKey = rightKey;\n this.color = color;\n}",
"function WebGLTurbulenzEngine() {}",
"function Terrain_Square(x,y,w,h,type,which_sprite_array,name_of_sprite_sheet){\n\n\tthis.x = x * w;\n\tthis.y = y * h; \n\tthis.w = w;\n\tthis.h = h;\n\n\t//console.log(\"1which_sprite_array is: \" + which_sprite_array);\n\t\n\t//so that these 4 values dont need to be calculated over and over again. \n\tthis.ulc_x = this.x;\n\tthis.urc_x = this.x + this.w;\n\tthis.ulc_y = this.y;\n\tthis.llc_y = this.y + this.h;\n\n\tthis.contains_mouse = false;\n\tthis.color = \"black\";//random default. not associated with any type currently. \n\n\tif(type == 0){\n\t\tthis.color = \"yellow\";\n\t}\n\telse if(type == 1){\n\t\tthis.color = \"red\";\n\t}\n\n\t\n\tthis.type = type; //can it be walked on.\n\tthis.sprite_sheet = document.getElementById(name_of_sprite_sheet);\n\tthis.ssi = new SSI();\n\tthis.ssi.set_x_y_w_h_dw_and_dh(which_sprite_array[0],\n\t\t\t\t\t\t\t\t which_sprite_array[1],\n\t\t\t\t\t\t\t\t which_sprite_array[2],\n\t\t\t\t\t\t\t\t which_sprite_array[3],\n\t\t\t\t\t\t\t\t this.w,\n\t\t\t\t\t\t\t\t this.h\n\t\t\t\t\t\t\t\t );\n\n}",
"setupCamera() {\r\n \r\n var camera = new Camera();\r\n camera.setPerspective(FOV, this.vWidth/this.vHeight, NEAR, FAR);\r\n //camera.setOrthogonal(-30, 30, -30, 30, NEAR, FAR);\r\n camera.setView();\r\n\r\n return camera;\r\n }",
"constructor(gameEngine, topLeftCornerX, topLeftCornerY, ctx, level) {\n Object.assign(this, {\n gameEngine,\n topLeftCornerX,\n topLeftCornerY,\n ctx,\n level,\n });\n\n // interact with the user entity that is fielded in sceneManager entity\n this.user = this.gameEngine.camera.user;\n\n this.menuBoxWidth = 140;\n this.menuBoxHeight = 590;\n\tthis.widthScale = widthScaling();\n\t\n this.selectedIcon = \"none\";\n this.storeIcons = [];\n this.towerImagesArray = this.retrieveTowerIconImages();\n\n\t// create the icon buttons for the menu\n this.initializeIcons();\n\t\n\t// create the mouse interactions for the tower store menu\t\n\tthis.towerStoreClick = this.createMouseClick(this);\n\tthis.towerStoreMove = this.createMouseMove(this);\n\tthis.implementMouseInteractions();\n }",
"function drawLandscapeTile(v, x, y){\n var top, sides, nearWater = false;\n\tvar v2 = noiseTracker2[y][x];\n if (v < 0.2) {\n top = color(184, 100, 98);\n sides = color(215, 56, 60);\n translate(0, 10);\n }\n else if (v < 0.75) {\n top = color(255, 74, 43);\n\t\tsides = color(215, 56, 60);\n }\n else {\n top = color(120, 100, 70);\n\t\tsides = color(276, 66, 62);\n translate(0, -40);\n }\n\n\n //regular cube\n if (v < 0.75) {\n fill(top);\n //top\n quad(0, 20, 40, 40, 0, 60, -40, 40);\n fill(sides);\n //left side\n quad(-40, 40, 0, 60, 0, 100, -40, 80);\n //right side\n quad(40, 40, 0, 60, 0, 100, 40, 80);\n\t\t\n\t\tnearWater = isThereWaterNearby(x, y);\n\t\tif(v > 0.19){\t\n\t\t\tif(nearWater && v2 > 0.5){\n\t\t\t\timage(city, 0, 30, 50, 50);\n\t\t\t}\n\t\t\telse if(v2 > 0.7){\n\t\t\t\t//calculations to give the trees varying sizes and allow to grow each day\n\t\t\t\tvar treeSize = ((v2 * 100) - 50) + (dayNumber * 5);\n\t\t\t\tif(treeSize > 50){\n\t\t\t\t\ttreeSize = 50;\n\t\t\t\t}\n\t\t\t\timage(trees, 0, 30, treeSize, treeSize);\n\t\t\t}\n\t\t}\n\t\t\n }\n //mountain\n else {\n fill(317, 97, 80);\n\t\t//left side\n quad(0, 20, 0, 60, 0, 100, -40, 80);\n\t\tfill(sides);\n //right side\n quad(0, 20, 0, 60, 0, 100, 40, 80);\n fill(top);\n }\n\n\n\n //reset any translations\n if (v < 0.2) {\n translate(0, -10);\n }\n else if (v < 0.75) {\n //do nothing\n }\n else {\n translate(0, 40);\n }\n}",
"beginHUD(renderer, w, h) {\n var cam = this.cam;\n renderer = renderer || cam.renderer;\n\n if(!renderer) return;\n this.pushed_rendererState = renderer.push();\n\n var gl = renderer.drawingContext;\n var w = (w !== undefined) ? w : renderer.width;\n var h = (h !== undefined) ? h : renderer.height;\n var d = Number.MAX_VALUE;\n\n gl.flush();\n // gl.finish();\n\n // 1) disable DEPTH_TEST\n gl.disable(gl.DEPTH_TEST);\n // 2) push modelview/projection\n // p5 is not creating a push/pop stack\n this.pushed_uMVMatrix = renderer.uMVMatrix.copy();\n this.pushed_uPMatrix = renderer.uPMatrix .copy();\n\n // 3) set new modelview (identity)\n //renderer.resetMatrix(); //behavior changed in p5 v1.6\n renderer.uMVMatrix = p5.Matrix.identity();\n \n // 4) set new projection (ortho)\n renderer._curCamera.ortho(0, w, -h, 0, -d, +d);\n // renderer.ortho();\n // renderer.translate(-w/2, -h/2);\n\n }",
"function project(vecPt, tileX, tileY, extent, tileSize) {\n var div = extent / tileSize;\n var xOffset = tileX * tileSize;\n var yOffset = tileY * tileSize;\n return {\n x: Math.floor(vecPt.x / div + xOffset),\n y: Math.floor(vecPt.y / div + yOffset)\n };\n}",
"function getTileViewports (viewport, maxTileSize) {\n var wmv = new WebMercatorViewport(viewport)\n var cols = Math.ceil(viewport.width / maxTileSize)\n var maxTileDim = [\n maxTileSize,\n maxTileSize / cols / 2\n ]\n var rows = Math.ceil(viewport.height / maxTileDim[1])\n\n return Array(cols).fill(null).map(function (_, col) {\n return Array(rows).fill(null).map(function (_, row) {\n var top = row * maxTileDim[1]\n var left = col * maxTileDim[0]\n var right = Math.min(viewport.width, left + maxTileDim[0])\n var bottom = Math.min(viewport.height, top + maxTileDim[1])\n var nw = wmv.unproject([left, top])\n var se = wmv.unproject([right, bottom])\n var tileWidth = right - left\n var tileHeight = bottom - top\n var bbox = [nw[0], se[1], se[0], nw[1]]\n const vp = fitViewportToBbox(tileWidth, tileHeight, bbox)\n vp.bbox = bbox\n vp.pixelBounds = [top, right, bottom, left]\n return vp\n })\n })\n}",
"static make(x, y, w, h) {\n\t\tif (QuadTree.pool.length) return QuadTree.pool.pop().reset(x, y, w, h)\n\t\treturn new QuadTree(x, y, w, h)\n\t}",
"function create_3dView() {\n var scene = new WebScene({\n portalItem: {\n id: \"159d275b250b4db1978a728bd20fa2ec\"\n }\n });\n\n var view = new SceneView({\n map: scene,\n container: \"globe\"\n })\n }",
"equals(viewport) {\n if (!(viewport instanceof Viewport)) {\n return false;\n }\n\n if (this === viewport) {\n return true;\n }\n\n return viewport.width === this.width && viewport.height === this.height && viewport.scale === this.scale && Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_2__[\"equals\"])(viewport.projectionMatrix, this.projectionMatrix) && Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_2__[\"equals\"])(viewport.viewMatrix, this.viewMatrix); // TODO - check distance scales?\n }",
"updateViewport() {\n const { width, height } = this.renderer.getSize();\n const rw = width / this.frameWidth;\n const rh = height / this.frameHeight;\n const ratio = Math.max(rw, rh);\n const rtw = this.frameWidth * ratio;\n const rth = this.frameHeight * ratio;\n\n let x = 0;\n let y = 0;\n\n if (rw < rh) {\n x = -(rtw - width) / 2;\n } else if (rw > rh) {\n y = -(rth - height) / 2;\n }\n\n this.renderer.setViewport(x, y, rtw, rth);\n }",
"function check_in_viewport( viewport, scene, dt ) {\n if(\n (Math.abs( this.boundingBox.center[0] - viewport.width / 2 ) > viewport.width / 2 + 2 * this.boundingBox.radius) ||\n (Math.abs( this.boundingBox.center[1] - viewport.height / 2 ) > viewport.height / 2 + 2 * this.boundingBox.radius) \n ) {\n console.debug(\"Discarding out of the box object\");\n scene.deregister(this);\n return false;\n }\n return true;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks app_key from the http request against "apps" collection. This is the first step of every write request to API. | function validateAppForWriteAPI(params) {
common.db.collection('apps').findOne({'key':params.qstring.app_key}, function (err, app) {
if (!app) {
if (common.config.api.safe) {
common.returnMessage(params, 400, 'App does not exist');
}
return false;
}
params.app_id = app['_id'];
params.app_cc = app['country'];
params.appTimezone = app['timezone'];
params.time = common.initTimeObj(params.appTimezone, params.qstring.timestamp);
params.callbackurl=app['callbackurl'];
var updateSessions = {};
common.fillTimeObject(params, updateSessions, common.dbMap['events']);
common.db.collection('sessions').update({'_id':params.app_id}, {'$inc':updateSessions}, {'upsert':true}, function(err, res){});
if (params.qstring.events) {
semusiApi.data.events.processEvents(params);
} else if (common.config.api.safe) {
common.returnMessage(params, 200, 'Success');
}
if (params.qstring.begin_session) {
semusiApi.data.usage.beginUserSession(params);
} else if (params.qstring.end_session) {
//semusiApi.data.usage.endUserSession(params);
if(parseInt(params.qstring.session_duration)>2000){
console.log("Session duration is too high: "+params.qstring.session_duration);
console.log(params.req.url);
}
if(parseInt(params.qstring.session_duration)<0){
console.log("Session duration is -ve: "+params.qstring.session_duration);
console.log(params.req.url);
}
if (params.qstring.session_duration) {
semusiApi.data.usage.processSessionDuration(params, function () {
semusiApi.data.usage.endUserSession(params);
});
} else {
semusiApi.data.usage.endUserSession(params);
}
} else if (params.qstring.session_duration) {
semusiApi.data.usage.processSessionDuration(params);
} else {
return false;
}
});
} | [
"function checkNewApps() {\n if (!localStorage[\"apps\"]) {\n localStorage[\"apps\"] = JSON.stringify(apps);\n } else {\n for (var i = 0; i < storedApps.length; i++) { // Look through saved apps\n if (!apps[i] || storedApps[i].id != apps[i].id) { // If an app is misplaced\n for (var j = 0; j < apps.length; j++) { // Find where it should be\n if (apps[j] && storedApps[i].id == apps[j].id) {\n break;\n }\n }\n apps.move(j, i);\n }\n }\n for (var i = 0; i < apps.length; i++) {\n if (!apps[i]) {\n apps.splice(i, 1);\n }\n }\n }\n localStorage[\"apps\"] = JSON.stringify(apps);\n}",
"function processNextApp() {\n\t\t\tif (appIds.length > 0) {\n\t\t\t\tcurrentApp = appIds.shift();\n\t\t\t\tcurrentPage = firstPage;\n\t\t\t\tqueuePage();\n\t\t\t} else {\n\t\t\t\temit('done with apps');\n\t\t\t}\n\t\t}",
"async existsInDB() {\n let result = {\n dataValues: null\n };\n try {\n const tmpResult = await db.appModel.findOne({\n where: {\n appId: this.appId\n }\n });\n\n if (tmpResult) {\n result = tmpResult;\n this.setApp(result.dataValues);\n return true;\n }\n } catch (err) {\n new ErrorInfo({\n appId: this.appId,\n message: err.message,\n func: this.existsInDB.name,\n file: constants.SRC_FILES_NAMES.APP\n }).addToDB();\n }\n return false;\n }",
"function checkAPIKey() {\n if (mashapeAPIKey == null) {\n console.error('ERROR: API Key must be set!');\n }\n}",
"function is_predef_app(name) {\n var rule = get_predefined_rules(name);\n\n if(rule.length) {\n rule = rule.split(\"\\x02\");\n if(rule[_category] == CATEGORY_APP) {\n return true;\n }\n }\n return false;\n}",
"function setAppData(appData) {\n self.LApp.data = appData;\n $log.debug('success storing application data');\n }",
"function addApplication(admin, app, applicationName) {\n //will find the application with the name in params\n app.db.models.applications.find({\n where: { applicationName: applicationName }\n })\n .then(appToAdd => {admin.addApplications([appToAdd]);})\n .catch(error => res.status(412).json({ msg: error.message }));\n}",
"function handle_init_app(req, startTime, apiName) {\n this.req = req; this.startTime = startTime; this.apiName = apiName;\n}",
"function getApp() {\n document.getElementById(\"submit\").addEventListener('click', function () {\n firebase.auth().onAuthStateChanged(function (user) {\n // User choice in the adding form (application or idea).\n var application = document.getElementById(\"app\").checked;\n var idea = document.getElementById(\"idea\").checked;\n\n // Value from text field.\n var n = document.getElementById(\"name\").value;\n var dn = document.getElementById(\"devname\").value;\n var desc = document.getElementById(\"desc\").value;\n var version = document.getElementById(\"version\").value;\n var date = document.getElementById(\"date\").value;\n var category = document.getElementById(\"cate\").value;\n var link = document.getElementById(\"link\").value;\n\n // Test if the value is successfully get.\n console.log(n);\n console.log(dn);\n console.log(desc);\n console.log(version);\n console.log(date);\n console.log(category);\n console.log(link);\n console.log(application);\n console.log(idea);\n\n // Updates the apps document.\n db.collection(\"apps\")\n .doc(docAppID).update({\n \"name\": n,\n \"application\": application,\n \"idea\": idea,\n \"dev_name\": dn,\n \"version\": version,\n \"date\": date,\n \"category\": category,\n \"link\": link,\n \"description\": desc,\n })\n // Does the uploadIconPic() function.\n .then(function () {\n uploadIconPic();\n })\n })\n })\n }",
"function DetermineAppID(u_inp) {\n if (NameOrID(u_inp)) {\n if (appIDMap.has(parseInt(u_inp, 10))) {\n appID = u_inp;\n validSearch = true\n } else {\n validSearch = false\n }\n\n } else if (UpCase_NameMap.has(u_inp.toUpperCase())) {\n validSearch = true;\n appID = appMap.get(UpCase_NameMap.get(u_inp.toUpperCase()));\n } else\n validSearch = false;\n\n\n}",
"function makeApp() {\n window.addEventListener('load', (event) => {\n db.collection(\"apps\").add({})\n .then(function (doc) {\n docAppID = doc.id;\n console.log(\"app id!\" + docAppID);\n })\n });\n }",
"static add(req, res) {\n // Make sure we have everything\n if(req.body.name && req.body.assertion_endpoint) {\n // Add the application into database\n let app = new Application({\n userId: req.user._id,\n name: req.body.name,\n assertionEndpoint: req.body.assertion_endpoint\n });\n app.save()\n .then(app => {\n req.flash('success', 'Application created with ID ' + app._id.toString());\n res.redirect(getRealUrl('/developer'));\n })\n .catch(e => {\n req.flash('error', 'Unknown Error: ' + JSON.stringify(e));\n ApplicationController._backToAddPage(res);\n })\n } else {\n req.flash('error', 'Name and Assertion Endpoint are required parameters.');\n ApplicationController._backToAddPage(res);\n }\n }",
"function runApp($location, $scope, $http, KubernetesApiURL, json, name, onSuccessFn, namespace, onCompleteFn) {\n if (name === void 0) { name = \"App\"; }\n if (onSuccessFn === void 0) { onSuccessFn = null; }\n if (namespace === void 0) { namespace = null; }\n if (onCompleteFn === void 0) { onCompleteFn = null; }\n if (json) {\n if (angular.isString(json)) {\n json = angular.fromJson(json);\n }\n name = name || \"App\";\n var postfix = namespace ? \" in namespace \" + namespace : \"\";\n Core.notification('info', \"Running \" + name + postfix);\n var items = convertKubernetesJsonToItems(json);\n angular.forEach(items, function (item) {\n var url = kubernetesUrlForItemKind(KubernetesApiURL, item);\n if (url) {\n $http.post(url, item).\n success(function (data, status, headers, config) {\n Kubernetes.log.debug(\"Got status: \" + status + \" on url: \" + url + \" data: \" + data + \" after posting: \" + angular.toJson(item));\n if (angular.isFunction(onCompleteFn)) {\n onCompleteFn();\n }\n Core.$apply($scope);\n }).\n error(function (data, status, headers, config) {\n var message = null;\n if (angular.isObject(data)) {\n message = data.message;\n var reason = data.reason;\n if (reason === \"AlreadyExists\") {\n // lets ignore duplicates\n Kubernetes.log.debug(\"entity already exists at \" + url);\n return;\n }\n }\n if (!message) {\n message = \"Failed to POST to \" + url + \" got status: \" + status;\n }\n Kubernetes.log.warn(\"Failed to save \" + url + \" status: \" + status + \" response: \" + angular.toJson(data, true));\n Core.notification('error', message);\n });\n }\n });\n }\n }",
"function checkRequestBinding(key, data, mac) {\n const macBits = sjcl.codec.bytes.toBits(mac);\n const observedMAC = createRequestBinding(key, data);\n const observedBits = sjcl.codec.bytes.toBits(observedMAC);\n\n return sjcl.bitArray.equal(macBits, observedBits);\n}",
"async ensureAppCredentials(appLookupParams) {\n var _this$credentials2, _this$credentials2$ac, _this$credentials2$ac2;\n\n const appCredentialsIndex = this.getAppCredentialsCacheIndex(appLookupParams);\n const {\n accountName\n } = appLookupParams;\n\n if (this.isPrefetched[accountName] || (_this$credentials2 = this.credentials) !== null && _this$credentials2 !== void 0 && (_this$credentials2$ac = _this$credentials2[accountName]) !== null && _this$credentials2$ac !== void 0 && (_this$credentials2$ac2 = _this$credentials2$ac.appCredentials) !== null && _this$credentials2$ac2 !== void 0 && _this$credentials2$ac2[appCredentialsIndex]) {\n return;\n }\n\n await this.refetchAppCredentials(appLookupParams);\n }",
"function sessionApp(next) {\n\n\tconsole.log(\"Asking a new challenge ...\");\n\t\n\t//Asking a new challenge\n\trequest(freebox.url+'login', function (error, response, body) {\n\n\t\tif (!error && response.statusCode == 200) {\n\n\t\t\tbody = JSON.parse(body);\n\n\t\t\tapp.logged_in = body.result.logged_in; //Update login status\n\t\t\tapp.challenge = body.result.challenge; //Update challenge\n\n\t\t\t//Update password\n\t\t\tapp.password = crypto.createHmac('sha1', app.app_token).update(app.challenge).digest('hex'); \n\n\t\t\t//If we're not logged_in\n\t\t\tif (!app.logged_in)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tconsole.log(\"App is not logged in\");\n\t\t\t\t\n\t\t\t\t//POST app_id & password\n\t\t\t\tvar options = {\n\t\t\t\t\turl : freebox.url+'login/session/',\n\t\t\t\t\tmethod : 'POST',\n\t\t\t\t\tjson : {\n\t\t\t\t\t\t\"app_id\" : app.app_id,\n\t\t\t\t\t\t\"app_version\" : app.app_version,\n\t\t\t\t\t\t\"password\" : app.password,\n\t\t\t\t\t\t},\n\t\t\t\t\tencode : 'utf-8'\n\t\t\t\t};\n\n\t\t\t\trequest(options, function (error, response, body) {\n\n\t\t\t\t\tif ( !error && (response.statusCode == 200 || response.statusCode == 403) ) {\n\n\t\t\t\t\t\tapp.challenge = body.result.challenge; //Update challenge\n\n\t\t\t\t\t\tif (response.statusCode == 200) { //OK\n\t\t\t\t\t\t\tapp.session_token = body.result.session_token; //Save session token\n\t\t\t\t\t\t\tapp.logged_in = true; //Update login status\n\t\t\t\t\t\t\tapp.permissions = body.result.permissions;\n\n\t\t\t\t\t\t\tconsole.log(\"App is now logged in ...\");\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(next) next();\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(response.statusCode == 403) { //Forbidden\n\t\t\t\t\t\t\tapp.logged_in = false; //Update login status\n\t\t\t\t\t\t\tconsole.log(body.msg + ' : ' + body.error_code);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tconsole.log(\"App cannot log in ...\");\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log(error);\n\t\t\t\t\t}\n\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log(error);\n\t\t}\n\n\t});\n\n}",
"function configApp(appConfig) {\n for (var i in appConfig) {\n if (appConfig.hasOwnProperty(i)) {\n config[i] = appConfig[i];\n }\n }\n}",
"registerExternalComponents(appId) {\n if (!this.appTouchedExternalComponents.has(appId)) {\n return;\n }\n const externalComponents = this.appTouchedExternalComponents.get(appId);\n if (externalComponents.size > 0) {\n this.registeredExternalComponents.set(appId, externalComponents);\n }\n }",
"async allApplicationsById(req, res) {\n try {\n res.send(await db.Application.findAll({\n where: {\n // find all applications related to the Applicaitons foreign key UserId...\n UserId: req.params.UserId\n }\n }))\n } catch (err) {\n res.status(500).send({\n error: \"Error has occured when trying to pull applications by UserId\"\n })\n }\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the next available socket with higher weight | function getSocket() {
var candidates = [];
this.sockets.forEach(function(socket) {
if (socket.status === C.SOCKET_STATUS_ERROR) {
return; // continue the array iteration
} else if (candidates.length === 0) {
candidates.push(socket);
} else if (socket.weight > candidates[0].weight) {
candidates = [socket];
} else if (socket.weight === candidates[0].weight) {
candidates.push(socket);
}
});
if (candidates.length === 0) {
// all sockets have failed. reset sockets status
this.sockets.forEach(function(socket) {
socket.status = C.SOCKET_STATUS_READY;
});
// get next available socket
getSocket.call(this);
return;
}
var idx = Math.floor((Math.random()* candidates.length));
this.socket = candidates[idx].socket;
} | [
"function getSocketById(id){\n var count = openSockets.length;\n var socket = null;\n for(var i=0;i<count;i++){\n \n if(openSockets[i].id==id){\n socket = openSockets[i];\n break;\n }\n }\n return socket;\n}",
"function getClientSocketNode(socket){\n var remoteAddr = socket.remoteAddress;\n var remotePort = socket.remotePort;\n \n var node = sockets[remoteAddr+':'+remotePort];\n return node;\n}",
"_socket (host, port) {\n const pool = this._getPool(host, port)\n return pool.acquire()\n }",
"getClient_sock_at(socket_id){\n \tif (this.nodes.has(socket_id))\n \t\treturn this.nodes.get(socket_id).socket;\n \tconsole.warn(\"Error:getClient_sock_at\");\n }",
"[kMaybeBind]() {\n if (this.#state !== kSocketUnbound)\n return;\n this.#state = kSocketPending;\n this.#lookup(this.#address, QuicEndpoint.#afterLookup.bind(this));\n }",
"function PushSocket() {\n Socket.call(this);\n this.use(queue());\n this.use(roundrobin({ fallback: this.enqueue }));\n}",
"async getTcpMaxConn()\n {\n return Promise.resolve()\n .then(() => getNetSnmpInfo4())\n .then((info) => +info.Tcp.MaxConn);\n }",
"updateConnectionWeight () {\n if (!this.connections.length) { return false }\n this.connections[Math.floor(Math.random() * this.connections.length)].weight = Math.random()\n }",
"function findFreePort(beg, ...rest){\n const p = rest.slice(0, rest.length - 1), cb = rest[rest.length - 1];\n let [end, ip, cnt] = Array.from(p);\n let exclude = p.find(arg => Array.isArray(arg) || (arg instanceof Set));\n console.log (p);\n if (!exclude) {\n console.log ('exclude not found');\n } else {\n console.log ('exclude found');\n }\n if (Array.isArray(exclude)) exclude = new Set(exclude);\n if (typeof ip !== 'string') ip = null;\n if (typeof cnt !== 'string' && typeof cnt !== 'number') cnt = null;\n if (typeof end !== 'string' && typeof end !== 'number') end = null;\n if (!ip && end && !/^\\d+$/.test(end)) { // deal with method 3\n ip = end;\n end = 65534;\n } else {\n if (end == null) { end = 65534; }\n }\n if (cnt == null) { cnt = 1; }\n\n const retcb = cb;\n const res = [];\n const getNextPort = function (port) {\n if (exclude) {\n console.log ('exclude', exclude);\n let nextPort = port + 1;\n console.log(nextPort);\n while(nextPort < end && exclude.has(nextPort)) {\n console.log(nextPort);\n nextPort++;\n }\n return nextPort;\n } else {\n return port + 1;\n }\n };\n const probe = function(ip, port, cb){\n const s = net.createConnection({port: port, host: ip})\n s.on('connect', function(){ s.end(); cb(null, getNextPort(port)); });\n s.on('error', err=> { cb(port); }); // can't connect, port is available\n };\n var onprobe = function(port, nextPort){\n if (port) {\n res.push(port);\n if (res.length >= cnt) {\n retcb(null, ...res)\n } else {\n setImmediate(()=> probe(ip, getNextPort(port), onprobe));\n }\n } else {\n if (nextPort>=end) {\n retcb(new Error(\"No available ports\"));\n } else {\n setImmediate(()=> probe(ip, nextPort, onprobe));\n }\n }\n };\n return probe(ip, beg, onprobe);\n}",
"function redirectConnection(socket, next)\n{\n console.log('Redirecting a connection to ' + socket.nsp.name);\n\n // Namespace regex\n const re = /^\\/(?<name>.+)/\n\n // Get the namespace name\n const nsp_name = socket.nsp.name;\n\n // Try to parse the lobby name\n const found = nsp_name.match(re);\n const match = found ? found.groups.name : undefined;\n const lobby_name = match ? decodeURIComponent(match) : undefined;\n\n // If it's for a lobby, redirect\n if (lobby_name)\n {\n // Find a lobby with this name\n const lobby = lobbies.find(lobby => lobby.name == lobby_name);\n\n // If there is a lobby, call the lobby onConnection function\n if (lobby)\n {\n lobby.onConnection(socket, next);\n }\n }\n}",
"function bindSocketApi (socketIo) {\n socketIo.on('connection', function onSocketConnect (socket) {\n socket.on('getAllInstances', (args) => {\n instanceManager.getAllInstances()\n /* TODO: Maybe its a good idea to remove some private instance properties\n since these calls came from external system API\n */\n .then((list) => {\n if (!args ||\n typeof args !== 'object' ||\n !args.requestId\n ) {\n socket.emit('getAllInstances', list)\n } else {\n socket.emit('getAllInstances', {\n requestId: args.requestId,\n data: list\n })\n }\n })\n .catch((error) => log(`ERROR: Unable to respond to socket request \"getAllInstances\": ${error.stack}`))\n })\n\n socket.on('getAllInstancesTypes', (args) => {\n instanceManager.getAllInstancesTypes()\n .then((types) => {\n if (!args ||\n typeof args !== 'object' ||\n !args.requestId\n ) {\n socket.emit('getAllInstancesTypes', types)\n } else {\n socket.emit('getAllInstancesTypes', {\n requestId: args.requestId,\n data: types\n })\n }\n })\n .catch((error) => log(`ERROR: Unable to respond to socket request \"getAllInstancesTypes\": ${error.stack}`))\n })\n\n socket.on('getAllInstancesByType', (args) => {\n if (!args ||\n typeof args !== 'object'\n ) {\n return\n }\n\n instanceManager.getAllInstancesByType(args.type)\n .then((list) => socket.emit('getAllInstancesByType', {\n requestId: args.requestId,\n data: list\n }))\n .catch((error) => log(`ERROR: Unable to respond to socket request \"getAllInstancesByType\": ${error.stack}`))\n })\n\n socket.on('getTotalInstancesByType', (args) => {\n if (!args ||\n typeof args !== 'object'\n ) {\n return\n }\n\n instanceManager.getTotalInstancesByType(args.type)\n .then((total) => socket.emit('getTotalInstancesByType', {\n requestId: args.requestId,\n data: total\n }))\n .catch((error) => log(`ERROR: Unable to respond to socket request \"getTotalInstancesByType\": ${error.stack}`))\n })\n\n /*\n Manage the total number of active services/instances of a certain type.\n Mainly used to handle higher or lower usage flow.\n */\n /* Example 'args' values '{\"type\": \"prime-number\", \"newTotal\": 5}' */\n socket.on('setTotalInstancesByType', (args) => {\n if (!args ||\n typeof args !== 'object'\n ) {\n return\n }\n\n instanceManager.getTotalInstancesByType(args.type)\n /* Decide if we need to add or remove instances and how many */\n .then(function setChangeDirection (currentTotal) {\n const diff = currentTotal - args.newTotal\n return {\n diff,\n fns: {\n instanceManagerFn: diff < 0 ? 'startInstanceByType' : 'deleteInstanceByType',\n nginxManagerFn: diff < 0 ? 'addServerAddressToLoadBalancer' : 'removeServerAddressFromLoadBalancer'\n }\n }\n })\n\n .then(function shouldChangeTotalInstances (request) {\n if (!request.diff) {\n return\n }\n\n const serviceLoadBalancerName = `${args.type}-balancer`\n\n /*\n Creates a sequence of adding or removing actions that will set the exact number of instances right to 'newTotal'.\n We need to follow this flow as a sequence and not as parallel because\n creating an instance must have its port as an increment from those instances already set.\n */\n Array.from({length: Math.abs(request.diff)})\n .reduce((chain) => chain\n .then(() => instanceManager[request.fns.instanceManagerFn](args.type))\n .then((instance) => nginxManager[request.fns.nginxManagerFn](serviceLoadBalancerName, `${instance.ip}:${instance.port}`)),\n Promise.resolve()\n )\n .then(nginxManager.serviceReload)\n .then(() => {\n const message = `nginx server restarted with ${args.newTotal} services of type \"${args.type}\"`\n log(message)\n socket.emit('setTotalInstancesByType', {\n requestId: args.requestId,\n data: message\n })\n })\n .catch((error) => {\n const message = `ERROR: Unable to start nginx server with ${args.newTotal} services of type \"${args.type}\": ${error.stack}`\n log(message)\n socket.emit('setTotalInstancesByType', {\n requestId: args.requestId,\n error: message\n })\n })\n })\n })\n })\n}",
"[kMaybeBind](callback = () => {}) {\n if (this.#state === kSocketBound)\n return process.nextTick(callback);\n\n this.once('ready', callback);\n\n if (this.#state === kSocketPending)\n return;\n this.#state = kSocketPending;\n\n for (const endpoint of this.#endpoints)\n endpoint[kMaybeBind]();\n }",
"function getOpponent(socket) {\n if (!players[socket.id].opponent) {\n return;\n }\n\n return players[players[socket.id].opponent].socket;\n}",
"static getSocketOption(seedIndex) {\n for (let i = 0; i < sockets.SocketItemOptionSettings.length; i++) {\n if (sockets.SocketItemOptionSettings[i][\"Index\"] === seedIndex) {\n return sockets.SocketItemOptionSettings[i];\n }\n }\n }",
"[kUsePreferredAddress](address) {\n process.nextTick(\n emit.bind(this, 'usePreferredAddress', address));\n }",
"function initSocket() {\n socketRef.current = io(\"localhost:8000\");\n setId(socketRef.current.id);\n setSocket(socketRef.current);\n }",
"function getGameInstance(socket){\n for(let game of activeGames){\n if(game.players.playerTop.userData._id === socket.guid) return game;\n else if(game.players.playerBottom.userData._id === socket.guid) return game;\n }\n}",
"getNodes() {\n this.privKey = tools.createPrivKey();\n this.publicKey = tools.getPublicKey(this.privKey);\n const serverSocket = io_cli.connect(config.mainServer, {\n query: {\n \"link_type\":\"miner\",\n \"port\":this.port,//for test\n \"publickey\":this.publicKey\n }\n });\n serverSocket.on('connect', () => {\n console.log('bootstrapServer is connected');\n serverSocket.emit('allNodes');\n })\n serverSocket.on('disconnect', () => {\n console.log(\"bootstrapServer is disconnected.\")\n })\n serverSocket.on('allNodes_response', (nodes) => {//addresses of nodes\n var isNodes = false;\n for(var each of nodes) {\n if(each == null || each == this.address) continue;\n isNodes = true;\n ((each) => {\n if(this.nodeRoom[each.address]) return;\n var eachSocket = io_cli.connect(each.address, {\n query: {\n \"link_type\":\"miner\",\n \"port\":this.port,//for test\n \"publickey\":this.publicKey\n }\n });\n eachSocket.on('connect', () => {\n console.log(each.address+\" is connected.\");\n this.nodeRoom[each.address] = {socket: eachSocket, publicKey: each.publickey};\n this.setNodeSocketListener(eachSocket, each.address, each.publickey);\n eachSocket.on('disconnect', () => {\n console.log(each.address+\" disconnected\");\n delete this.nodeRoom[each.address];\n delete this.sendBlockchainNode[each.address];\n eachSocket.removeAllListeners();\n })\n })\n })(each)\n }\n if(isNodes == false && this.blockchain.length == 0) {\n this.createGenesisBlock();\n }\n else {\n this.getBlockchain();\n }\n console.log('blockchainState:'+this.blockchainState);\n })\n }",
"getPlayerFromSocket(socket) {\n return this._players[socket.id];\n }",
"function findServer(callback) {\n const urls = [\n 'http://localhost:3000/server1',\n 'http://localhost:3000/server2',\n 'http://localhost:3000/server3',\n 'http://localhost:3000/server4',\n 'http://localhost:3000/server5'\n ];\n Promise.all(urls.map(url =>\n fetch(url)\n .then(checkOnlineStatus)\n .then(parseJSON)\n .catch(error => error)\n ))\n .then(data => {\n var find = _.filter(data, function (o) {\n return o !== null;\n });\n if (_.isEmpty(find)) {\n callback('no servers are online')\n } else {\n return Promise.resolve(find)\n }\n })\n .then((find) => {\n find.sort(function (a, b) {\n return a.priority - b.priority;\n });\n console.log(find)\n return Promise.resolve(find)\n })\n .then((find) => {\n callback(find[0])\n })\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
logger.enable(''); Internal Functions initPeer(el) Handle the initialization of a rtcremote target | function initPeer(el) {
var propValue = el.getAttribute('rtc-peer');
var targetStream = el.getAttribute('rtc-stream');
var peerRoles = propValue ? propValue.split(reSep) : ['*'];
// create a data container that we will attach to the element
var data = el._rtc || (el._rtc = {});
function addStream(stream) {
console.log('received remote stream', stream);
// if we don't have a stream or already have a stream id then bail
if (data.streamId) {
return;
}
// if we have a particular target stream, then go looking for it
if (targetStream) {
}
// otherwise, automatically associate with the element
else {
console.log('attaching stream');
media(stream).render(el);
data.streamId = stream.id;
}
}
function handleStream(evt) {
addStream(evt.stream);
}
// iterate through the peers and monitor events for that peer
peerRoles.forEach(function(role) {
eve.on('glue.peer.active.' + role, function(peer, peerId) {
// if the element already has a peer, then do nothing
if (data.peerId) {
return;
}
console.log('peer active', peer.getRemoteStreams());
// associate the peer id with the element
data.peerId = peerId;
// add existing streams
[].slice.call(peer.getRemoteStreams()).forEach(addStream);
// listen for add straem events
peer.addEventListener('addstream', handleStream);
});
});
eve.on('glue.peer.leave', function(peer, peerId) {
// if the peer leaving matches the remote peer, then cleanup
if (data.peerId === peerId) {
// reset the target media element
resetEl(el);
// reset the rtc data
data = el._rtc = {};
}
});
return el;
} | [
"addPeer() {\n\t}",
"function initWebRTC() {\n SDK.NIM.use(WebRTC);\n console.log(nim);\n const Netcall = WebRTC;\n netcall = Netcall.getInstance({\n nim: nim,\n container: document.getElementById('containerLocal'),\n remoteContainer: document.getElementById('containerRemote'),\n // chromeId: '', //Screen capture and Sharing\n debug: true // Enable debug log print?\n });\n registerObserver();\n}",
"init(actor) {\n this.host = actor\n }",
"constructor() { \n \n VpcPeeringConnection.initialize(this);\n }",
"function loraInit() {\n lora = new RN2483(Serial2, {reset:B0});\n\n lora.getStatus(function(x){console.log(\"Device EUI = \" + x.EUI);});\n\n // Setup the LoRa module\n setTimeout(function() {Serial2.println(\"mac set appeui \" + appEUI);} , 1000);\n setTimeout(function() {Serial2.println(\"mac set appkey \" + appKey);}, 2000);\n setTimeout(function() {Serial2.println(\"mac join otaa\");}, 3000);\n \n \n}",
"constructor(opts) {\n super();\n (0, _defineProperty2.default)(this, \"roomId\", void 0);\n (0, _defineProperty2.default)(this, \"type\", void 0);\n (0, _defineProperty2.default)(this, \"callId\", void 0);\n (0, _defineProperty2.default)(this, \"state\", void 0);\n (0, _defineProperty2.default)(this, \"hangupParty\", void 0);\n (0, _defineProperty2.default)(this, \"hangupReason\", void 0);\n (0, _defineProperty2.default)(this, \"direction\", void 0);\n (0, _defineProperty2.default)(this, \"ourPartyId\", void 0);\n (0, _defineProperty2.default)(this, \"client\", void 0);\n (0, _defineProperty2.default)(this, \"forceTURN\", void 0);\n (0, _defineProperty2.default)(this, \"turnServers\", void 0);\n (0, _defineProperty2.default)(this, \"candidateSendQueue\", void 0);\n (0, _defineProperty2.default)(this, \"candidateSendTries\", void 0);\n (0, _defineProperty2.default)(this, \"sentEndOfCandidates\", void 0);\n (0, _defineProperty2.default)(this, \"peerConn\", void 0);\n (0, _defineProperty2.default)(this, \"localVideoElement\", void 0);\n (0, _defineProperty2.default)(this, \"remoteVideoElement\", void 0);\n (0, _defineProperty2.default)(this, \"remoteAudioElement\", void 0);\n (0, _defineProperty2.default)(this, \"screenSharingStream\", void 0);\n (0, _defineProperty2.default)(this, \"remoteStream\", void 0);\n (0, _defineProperty2.default)(this, \"localAVStream\", void 0);\n (0, _defineProperty2.default)(this, \"inviteOrAnswerSent\", void 0);\n (0, _defineProperty2.default)(this, \"waitForLocalAVStream\", void 0);\n (0, _defineProperty2.default)(this, \"config\", void 0);\n (0, _defineProperty2.default)(this, \"successor\", void 0);\n (0, _defineProperty2.default)(this, \"opponentMember\", void 0);\n (0, _defineProperty2.default)(this, \"opponentVersion\", void 0);\n (0, _defineProperty2.default)(this, \"opponentPartyId\", void 0);\n (0, _defineProperty2.default)(this, \"opponentCaps\", void 0);\n (0, _defineProperty2.default)(this, \"inviteTimeout\", void 0);\n (0, _defineProperty2.default)(this, \"remoteOnHold\", void 0);\n (0, _defineProperty2.default)(this, \"unholdingRemote\", void 0);\n (0, _defineProperty2.default)(this, \"micMuted\", void 0);\n (0, _defineProperty2.default)(this, \"vidMuted\", void 0);\n (0, _defineProperty2.default)(this, \"callStatsAtEnd\", void 0);\n (0, _defineProperty2.default)(this, \"makingOffer\", void 0);\n (0, _defineProperty2.default)(this, \"ignoreOffer\", void 0);\n (0, _defineProperty2.default)(this, \"remoteCandidateBuffer\", new Map());\n (0, _defineProperty2.default)(this, \"gotUserMediaForInvite\", async stream => {\n if (this.successor) {\n this.successor.gotUserMediaForAnswer(stream);\n return;\n }\n\n if (this.callHasEnded()) {\n this.stopAllMedia();\n return;\n }\n\n this.localAVStream = stream;\n\n _logger.logger.info(\"Got local AV stream with id \" + this.localAVStream.id);\n\n this.setState(CallState.CreateOffer);\n\n _logger.logger.debug(\"gotUserMediaForInvite -> \" + this.type);\n\n const videoEl = this.getLocalVideoElement();\n\n if (videoEl && this.type === CallType.Video) {\n videoEl.autoplay = true;\n\n if (this.screenSharingStream) {\n _logger.logger.debug(\"Setting screen sharing stream to the local video element\");\n\n videoEl.srcObject = this.screenSharingStream;\n } else {\n videoEl.srcObject = stream;\n }\n\n videoEl.muted = true;\n\n try {\n await videoEl.play();\n } catch (e) {\n _logger.logger.info(\"Failed to play local video element\", e);\n }\n } // why do we enable audio (and only audio) tracks here? -- matthew\n\n\n setTracksEnabled(stream.getAudioTracks(), true);\n\n for (const audioTrack of stream.getAudioTracks()) {\n _logger.logger.info(\"Adding audio track with id \" + audioTrack.id);\n\n this.peerConn.addTrack(audioTrack, stream);\n }\n\n for (const videoTrack of (this.screenSharingStream || stream).getVideoTracks()) {\n _logger.logger.info(\"Adding video track with id \" + videoTrack.id);\n\n this.peerConn.addTrack(videoTrack, stream);\n } // Now we wait for the negotiationneeded event\n\n });\n (0, _defineProperty2.default)(this, \"gotUserMediaForAnswer\", async stream => {\n if (this.callHasEnded()) {\n return;\n }\n\n const localVidEl = this.getLocalVideoElement();\n\n if (localVidEl && this.type === CallType.Video) {\n localVidEl.autoplay = true;\n localVidEl.srcObject = stream;\n localVidEl.muted = true;\n\n try {\n await localVidEl.play();\n } catch (e) {\n _logger.logger.info(\"Failed to play local video element\", e);\n }\n }\n\n this.localAVStream = stream;\n\n _logger.logger.info(\"Got local AV stream with id \" + this.localAVStream.id);\n\n setTracksEnabled(stream.getAudioTracks(), true);\n\n for (const track of stream.getTracks()) {\n this.peerConn.addTrack(track, stream);\n }\n\n this.setState(CallState.CreateAnswer);\n let myAnswer;\n\n try {\n myAnswer = await this.peerConn.createAnswer();\n } catch (err) {\n _logger.logger.debug(\"Failed to create answer: \", err);\n\n this.terminate(CallParty.Local, CallErrorCode.CreateAnswer, true);\n return;\n }\n\n try {\n await this.peerConn.setLocalDescription(myAnswer);\n this.setState(CallState.Connecting); // Allow a short time for initial candidates to be gathered\n\n await new Promise(resolve => {\n setTimeout(resolve, 200);\n });\n this.sendAnswer();\n } catch (err) {\n _logger.logger.debug(\"Error setting local description!\", err);\n\n this.terminate(CallParty.Local, CallErrorCode.SetLocalDescription, true);\n return;\n }\n });\n (0, _defineProperty2.default)(this, \"gotLocalIceCandidate\", event => {\n if (event.candidate) {\n _logger.logger.debug(\"Call \" + this.callId + \" got local ICE \" + event.candidate.sdpMid + \" candidate: \" + event.candidate.candidate);\n\n if (this.callHasEnded()) return; // As with the offer, note we need to make a copy of this object, not\n // pass the original: that broke in Chrome ~m43.\n\n if (event.candidate.candidate !== '' || !this.sentEndOfCandidates) {\n this.queueCandidate(event.candidate);\n if (event.candidate.candidate === '') this.sentEndOfCandidates = true;\n }\n }\n });\n (0, _defineProperty2.default)(this, \"onIceGatheringStateChange\", event => {\n _logger.logger.debug(\"ice gathering state changed to \" + this.peerConn.iceGatheringState);\n\n if (this.peerConn.iceGatheringState === 'complete' && !this.sentEndOfCandidates) {\n // If we didn't get an empty-string candidate to signal the end of candidates,\n // create one ourselves now gathering has finished.\n // We cast because the interface lists all the properties as required but we\n // only want to send 'candidate'\n // XXX: We probably want to send either sdpMid or sdpMLineIndex, as it's not strictly\n // correct to have a candidate that lacks both of these. We'd have to figure out what\n // previous candidates had been sent with and copy them.\n const c = {\n candidate: ''\n };\n this.queueCandidate(c);\n this.sentEndOfCandidates = true;\n }\n });\n (0, _defineProperty2.default)(this, \"gotLocalOffer\", async description => {\n _logger.logger.debug(\"Created offer: \", description);\n\n if (this.callHasEnded()) {\n _logger.logger.debug(\"Ignoring newly created offer on call ID \" + this.callId + \" because the call has ended\");\n\n return;\n }\n\n try {\n await this.peerConn.setLocalDescription(description);\n } catch (err) {\n _logger.logger.debug(\"Error setting local description!\", err);\n\n this.terminate(CallParty.Local, CallErrorCode.SetLocalDescription, true);\n return;\n }\n\n if (this.peerConn.iceGatheringState === 'gathering') {\n // Allow a short time for initial candidates to be gathered\n await new Promise(resolve => {\n setTimeout(resolve, 200);\n });\n }\n\n if (this.callHasEnded()) return;\n const eventType = this.state === CallState.CreateOffer ? _event.EventType.CallInvite : _event.EventType.CallNegotiate;\n const content = {\n lifetime: CALL_TIMEOUT_MS\n }; // clunky because TypeScript can't folow the types through if we use an expression as the key\n\n if (this.state === CallState.CreateOffer) {\n content.offer = this.peerConn.localDescription;\n } else {\n content.description = this.peerConn.localDescription;\n }\n\n if (this.client._supportsCallTransfer) {\n content.capabilities = {\n 'm.call.transferee': true\n };\n } // Get rid of any candidates waiting to be sent: they'll be included in the local\n // description we just got and will send in the offer.\n\n\n _logger.logger.info(`Discarding ${this.candidateSendQueue.length} candidates that will be sent in offer`);\n\n this.candidateSendQueue = [];\n\n try {\n await this.sendVoipEvent(eventType, content);\n } catch (error) {\n _logger.logger.error(\"Failed to send invite\", error);\n\n if (error.event) this.client.cancelPendingEvent(error.event);\n let code = CallErrorCode.SignallingFailed;\n let message = \"Signalling failed\";\n\n if (this.state === CallState.CreateOffer) {\n code = CallErrorCode.SendInvite;\n message = \"Failed to send invite\";\n }\n\n if (error.name == 'UnknownDeviceError') {\n code = CallErrorCode.UnknownDevices;\n message = \"Unknown devices present in the room\";\n }\n\n this.emit(CallEvent.Error, new CallError(code, message, error));\n this.terminate(CallParty.Local, code, false); // no need to carry on & send the candidate queue, but we also\n // don't want to rethrow the error\n\n return;\n }\n\n this.sendCandidateQueue();\n\n if (this.state === CallState.CreateOffer) {\n this.inviteOrAnswerSent = true;\n this.setState(CallState.InviteSent);\n this.inviteTimeout = setTimeout(() => {\n this.inviteTimeout = null;\n\n if (this.state === CallState.InviteSent) {\n this.hangup(CallErrorCode.InviteTimeout, false);\n }\n }, CALL_TIMEOUT_MS);\n }\n });\n (0, _defineProperty2.default)(this, \"getLocalOfferFailed\", err => {\n _logger.logger.error(\"Failed to get local offer\", err);\n\n this.emit(CallEvent.Error, new CallError(CallErrorCode.LocalOfferFailed, \"Failed to get local offer!\", err));\n this.terminate(CallParty.Local, CallErrorCode.LocalOfferFailed, false);\n });\n (0, _defineProperty2.default)(this, \"getUserMediaFailed\", err => {\n if (this.successor) {\n this.successor.getUserMediaFailed(err);\n return;\n }\n\n _logger.logger.warn(\"Failed to get user media - ending call\", err);\n\n this.emit(CallEvent.Error, new CallError(CallErrorCode.NoUserMedia, \"Couldn't start capturing media! Is your microphone set up and \" + \"does this app have permission?\", err));\n this.terminate(CallParty.Local, CallErrorCode.NoUserMedia, false);\n });\n (0, _defineProperty2.default)(this, \"onIceConnectionStateChanged\", () => {\n if (this.callHasEnded()) {\n return; // because ICE can still complete as we're ending the call\n }\n\n _logger.logger.debug(\"Call ID \" + this.callId + \": ICE connection state changed to: \" + this.peerConn.iceConnectionState); // ideally we'd consider the call to be connected when we get media but\n // chrome doesn't implement any of the 'onstarted' events yet\n\n\n if (this.peerConn.iceConnectionState == 'connected') {\n this.setState(CallState.Connected);\n } else if (this.peerConn.iceConnectionState == 'failed') {\n this.hangup(CallErrorCode.IceFailed, false);\n }\n });\n (0, _defineProperty2.default)(this, \"onSignallingStateChanged\", () => {\n _logger.logger.debug(\"call \" + this.callId + \": Signalling state changed to: \" + this.peerConn.signalingState);\n });\n (0, _defineProperty2.default)(this, \"onTrack\", ev => {\n if (ev.streams.length === 0) {\n _logger.logger.warn(`Streamless ${ev.track.kind} found: ignoring.`);\n\n return;\n } // If we already have a stream, check this track is from the same one\n\n\n if (this.remoteStream && ev.streams[0].id !== this.remoteStream.id) {\n _logger.logger.warn(`Ignoring new stream ID ${ev.streams[0].id}: we already have stream ID ${this.remoteStream.id}`);\n\n return;\n }\n\n if (!this.remoteStream) {\n _logger.logger.info(\"Got remote stream with id \" + ev.streams[0].id);\n } // Note that we check by ID above and always set the remote stream: Chrome appears\n // to make new stream objects when tranciever directionality is changed and the 'active'\n // status of streams change\n\n\n this.remoteStream = ev.streams[0];\n\n _logger.logger.debug(`Track id ${ev.track.id} of kind ${ev.track.kind} added`);\n\n if (ev.track.kind === 'video') {\n if (this.remoteVideoElement) {\n this.playRemoteVideo();\n }\n } else {\n if (this.remoteAudioElement) this.playRemoteAudio();\n }\n });\n (0, _defineProperty2.default)(this, \"onNegotiationNeeded\", async () => {\n _logger.logger.info(\"Negotation is needed!\");\n\n if (this.state !== CallState.CreateOffer && this.opponentVersion === 0) {\n _logger.logger.info(\"Opponent does not support renegotiation: ignoring negotiationneeded event\");\n\n return;\n }\n\n this.makingOffer = true;\n\n try {\n const myOffer = await this.peerConn.createOffer();\n await this.gotLocalOffer(myOffer);\n } catch (e) {\n this.getLocalOfferFailed(e);\n return;\n } finally {\n this.makingOffer = false;\n }\n });\n (0, _defineProperty2.default)(this, \"onHangupReceived\", msg => {\n _logger.logger.debug(\"Hangup received for call ID \" + this.callId); // party ID must match (our chosen partner hanging up the call) or be undefined (we haven't chosen\n // a partner yet but we're treating the hangup as a reject as per VoIP v0)\n\n\n if (this.partyIdMatches(msg) || this.state === CallState.Ringing) {\n // default reason is user_hangup\n this.terminate(CallParty.Remote, msg.reason || CallErrorCode.UserHangup, true);\n } else {\n _logger.logger.info(`Ignoring message from party ID ${msg.party_id}: our partner is ${this.opponentPartyId}`);\n }\n });\n (0, _defineProperty2.default)(this, \"onRejectReceived\", msg => {\n _logger.logger.debug(\"Reject received for call ID \" + this.callId); // No need to check party_id for reject because if we'd received either\n // an answer or reject, we wouldn't be in state InviteSent\n\n\n const shouldTerminate = // reject events also end the call if it's ringing: it's another of\n // our devices rejecting the call.\n [CallState.InviteSent, CallState.Ringing].includes(this.state) || // also if we're in the init state and it's an inbound call, since\n // this means we just haven't entered the ringing state yet\n this.state === CallState.Fledgling && this.direction === CallDirection.Inbound;\n\n if (shouldTerminate) {\n this.terminate(CallParty.Remote, CallErrorCode.UserHangup, true);\n } else {\n _logger.logger.debug(`Call is in state: ${this.state}: ignoring reject`);\n }\n });\n (0, _defineProperty2.default)(this, \"onAnsweredElsewhere\", msg => {\n _logger.logger.debug(\"Call ID \" + this.callId + \" answered elsewhere\");\n\n this.terminate(CallParty.Remote, CallErrorCode.AnsweredElsewhere, true);\n });\n this.roomId = opts.roomId;\n this.client = opts.client;\n this.type = null;\n this.forceTURN = opts.forceTURN;\n this.ourPartyId = this.client.deviceId; // Array of Objects with urls, username, credential keys\n\n this.turnServers = opts.turnServers || [];\n\n if (this.turnServers.length === 0 && this.client.isFallbackICEServerAllowed()) {\n this.turnServers.push({\n urls: [FALLBACK_ICE_SERVER]\n });\n }\n\n for (const server of this.turnServers) {\n utils.checkObjectHasKeys(server, [\"urls\"]);\n }\n\n this.callId = genCallID();\n this.state = CallState.Fledgling; // A queue for candidates waiting to go out.\n // We try to amalgamate candidates into a single candidate message where\n // possible\n\n this.candidateSendQueue = [];\n this.candidateSendTries = 0;\n this.sentEndOfCandidates = false;\n this.inviteOrAnswerSent = false;\n this.makingOffer = false;\n this.remoteOnHold = false;\n this.unholdingRemote = false;\n this.micMuted = false;\n this.vidMuted = false;\n }",
"start() {\n\t\t// generate local_id\n\t\tnetwork.init(local_id);\n\t}",
"function createPeerConnection() {\n var pc_config = { iceServers: [] };\n var pc_constraints = {\n optional: [{ DtlsSrtpKeyAgreement: true }, { googIPv6: false }],\n mandatory: {\n OfferToReceiveAudio: true,\n OfferToReceiveVideo: false\n }\n };\n var self = this;\n\n LOGGER.log(\"Creating RTCPeerConnection...\");\n this.peerConnection = new RTCPeerConnection(pc_config, pc_constraints);\n this.peerConnection.ontrack = function(event) {\n LOGGER.log(\"Received remote stream\");\n if (self.remoteAudioVideo.srcObject !== event.streams[0]) {\n self.remoteAudioVideo.srcObject = event.streams[0];\n }\n };\n this.peerConnection.onicecandidate = function(event) {\n if (event.candidate) {\n LOGGER.log(\"ICE candidate received: \" + event.candidate.candidate);\n } else if (!(\"onicegatheringstatechange\" in RTCPeerConnection.prototype)) {\n // should not be done if its done in the icegatheringstatechange callback.\n LOGGER.log(\"Got all our ICE candidates, thanks!\");\n startCall.call(self);\n }\n };\n this.peerConnection.oniceconnectionstatechange = function(event) {\n if (self.peerConnection === null) {\n LOGGER.log(\"peerConnection is null, call has been hungup ?\");\n return;\n }\n\n LOGGER.log(\"ICE State : \" + self.peerConnection.iceConnectionState);\n LOGGER.log(\"ICE State : \" + self.peerConnection.iceConnectionState);\n LOGGER.log(\"ICE state change event: \" + event);\n };\n this.peerConnection.onicegatheringstatechange = function() {\n if (self.peerConnection.iceGatheringState !== \"complete\") {\n return;\n }\n LOGGER.log(\n \"Got all our ICE candidates (from onicegatheringstatechange), thanks!\"\n );\n startCall.call(self);\n };\n}",
"isInitiator() {\n\t\tconst self = this;\n\t\tconst data = { peerID: self.peerID, type: 'initial', peerName: self.peerName };\n\t\tjQuery.post( self.url + '/set', { [ self.grtcID ] : window.btoa( JSON.stringify( data ) ) }, ( resp ) => {\n\t\t\tself.emit( 'initiator', resp );\n\t\t} ).fail( () => {\n\t\t\tself.emit( 'initiator', false );\n\t\t} );\n\t}",
"async startConnection(self, friendtkn, peer) {\n console.log('starting connection with ' + friendtkn);\n // console.log(friendtkn);\n var mediaa = self.state.myMediaStreamObj;\n console.log(mediaa);\n self.sendMediaStream(self, peer, mediaa, friendtkn, false);\n }",
"componentDidMount() {\n this.props.localPeer.on('connection', (conn) => {\n conn.on('open', () => { \n this.receiveConnection(conn); // handles the connection from another peer\n });\n });\n this.props.localPeer.on('error', (err) => {\n this.setState({ errorMessage : \"Error with PeerJS!\" }); \n }); \n }",
"function initEtherMessages() {\n var etherTimer = function() {\n\n \t// Our ether messages will display between 7 and 20 seconds apart\n var rand = Math.round(Math.random() * (13000)) + 7000;\n\n setTimeout(etherTimer, rand);\n loadSlenderEtherMessages();\n\n }\n etherTimer()\n}",
"function ViewClient(recipient) {\n let pc = new RTCPeerConnection({'iceServers': [{'urls': 'stun:stun.l.google.com:19302'}]});\n\n // Local ICE candidate\n pc.onicecandidate = function(event) {\n if (event.candidate) {\n camera_sent(recipient, ice_candidate_key(event.candidate));\n send_message(recipient,\n {type: 'ice-candidate',\n from: 'replay-camera',\n candidate: event.candidate});\n }\n };\n\n let self = this;\n pc.onnegotiationneeded = function(event) {\n console.log('onnegotiationneeded fires');\n self.convey_offer();\n };\n\n this.connection = pc;\n \n this.setstream = function(stream) {\n let senders = pc.getSenders();\n for (var k = 0; k < senders.length; ++k) {\n pc.removeTrack(senders[k]);\n }\n stream.getTracks().forEach(function(track) {\n console.log(' adding track');\n pc.addTrack(track, stream);\n });\n };\n\n this.on_message = function(msg) {\n console.log('on_message ' + msg.type + ' from ' + msg.from);\n if (msg.type == 'answer') {\n this.on_answer(msg);\n } else if (msg.type == 'ice-candidate') {\n this.on_ice_candidate(msg);\n } else {\n console.error('Unrecognized message ' + msg);\n console.trace();\n }\n };\n this.on_answer = function(msg) {\n camera_received(recipient, 'answer');\n pc.setRemoteDescription(new RTCSessionDescription(msg.sdp));\n };\n this.on_ice_candidate = function(msg) { // Remote ICE candidate signaled\n let candidate = new RTCIceCandidate(msg.candidate);\n camera_received(recipient, ice_candidate_key(candidate));\n pc.addIceCandidate(candidate);\n };\n\n let ideal = {width: 0, height: 0};\n this.on_solicitation = function(msg) {\n if (msg.hasOwnProperty('ideal')) {\n ideal = msg.ideal;\n }\n this.convey_offer();\n };\n this.ideal = function() { return ideal; }\n \n this.convey_offer = function() {\n pc.createOffer()\n .then(function(offer) {\n return pc.setLocalDescription(offer);\n })\n .then(function() {\n camera_sent(recipient, 'offer');\n send_message(recipient,\n {type: 'offer',\n from: 'replay-camera',\n sdp: pc.localDescription});\n });\n };\n}",
"function addPeer(gun, ip, port) {\n //const oldPeers = gun.opt()['_'].opt.peers;\n return gun.opt({peers: [`http: *${ip}:${port}/gun`]}); // Should these be linked both ways?\n }",
"initHostInteractions(){\n\n }",
"function connectionNeo() {\n console.log(\"Connexion au broker iron-man OK\");\n}",
"function call() {\n if (gOurPeerId == null)\n failTest('calling, but not connected');\n if (gRemotePeerId == null)\n failTest('calling, but missing remote peer');\n if (gPeerConnection != null)\n failTest('calling, but call is up already');\n\n gPeerConnection = createPeerConnection();\n gPeerConnection.addStream(gLocalStream);\n}",
"function initializeOpcuaClient(){\n client = new OPCUAClient({keepSessionAlive:true});\n client.connect(\"opc.tcp://\" + os.hostname() + \":\" + port, onClientConnected);\n}",
"function joinRoom() {\n initSocket();\n initRoom();\n }",
"constructor(prev, msg) {\n\t\t//dh exchange\n\t\tvar dh = crypto.get_dh()\n\t\tdh.generateKeys();\n\t\tvar dh_pub = message.decodeMessagePayload(msg.type,\n\t\tcrypto.decrypt_rsa(msg.payload)).pub;\n\t\tvar password = dh.computeSecret(dh_pub).toString('hex');\n\t\tlet pub_key = peers[prev.id].pub;\n\t\tlet payload = crypto.encrypt_rsa(pub_key, messages.encodeMessagePayload(types.CREATED, {\n\t\t\tpub: dh.getPublicKey() // DH public key\n\t\t}));\n\t\tlet message = messages.encodeMessage({\n\t\t\ttype: types.CREATED,\n\t\t\tpayload: payload\n\t\t});\n\t\tprev.sendMessage(message);\n\n\t\tthis.prev = prev;\n\n\t\t// set aes encryption\n\t\tthis.prev.setEncryption((buffer) => {\n \t\t\t\treturn encrypt_aes(password, buffer);\n\t \t\t},\n\t \t\t(buffer) => {\n\t \t\t\treturn decrypt_aes(password, buffer);\n\t \t\t});\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
13. Write a Javascript program which accepts the radius of the sphere as input and compute the volume. Sample Output: Input the radius of the circle: 5 The volume of the sphere is: 392.699081625. | function volumeOfCircle(inputs) {
const { radius } = inputs;
if (!isNaN(Number(radius)) && Number(radius) > 0) {
const volume = (4/3 * Math.PI * Math.pow(radius, 3)).toFixed(8);
return `
<p class="output">Input the radius of the circle: ${radius}.</p>
<p class="output">The volume of the sphere is: ${volume}. </p>
`;
}
throw new Error("Please enter a valid number");
} | [
"function calculate() {\n\t\t'use strict';\n\t\n\t\t// For storing the volume:\n\t\tvar volume;\n \n // Get a reference to the form values:\n var length = document.getElementById('length').value;\n var width = document.getElementById('width').value;\n var height = document.getElementById('height').value;\n \n // Convert strings into numbers\n length = parseFloat(length);\n width = parseFloat(width);\n height = parseFloat(height);\n \n // Assertions\n try {\n \t\tassertCheck(((typeof length == 'number') && (length > 0)), 'The length must be a positive number.');\n \t\tassertCheck(((typeof width == 'number') && (width > 0)), 'The width must be a positive number.');\n \t\tassertCheck(((typeof height == 'number') && (height > 0)), 'The height must be a positive number.');\n } catch (err) {\n \t\tconsole.log('Caught: ' + err.name + ', because: ' + err.message);\n }\n\n\t\t// Verify box measurements\n console.log('length: ' + length);\n console.log('width: ' + width);\n console.log('height: ' + height);\n \n\t\t// Format the volume:\n\t\tvolume = parseFloat(length) * parseFloat(width) * parseFloat(height);\n\t\tvolume = volume.toFixed(4);\n\t\n\t\t// Display the volume:\n\t\tdocument.getElementById('volume').value = volume;\n\t\n\t\t// Return false to prevent submission:\n\t\treturn false;\n \n} // End of calculate() function.",
"function Sphere3D(radius) {\r\n\tthis.point = new Array();\r\n\tthis.color = \"rgb(100,0,255)\"\r\n\tthis.radius = (typeof(radius) == \"undefined\") ? 20.0 : radius;\r\n\tthis.radius = (typeof(radius) != \"number\") ? 20.0 : radius;\r\n\tthis.numberOfVertexes = 0;\r\n\r\n\t// It builds the middle circle on the XZ plane. Loop of 2*pi with a step of 0.17 radians.\r\n\tfor(alpha = 0; alpha <= 6.28; alpha += 0.17) {\r\n\t\tp = this.point[this.numberOfVertexes] = new Point3D();\r\n\t\t\r\n\t\tp.x = Math.cos(alpha) * this.radius;\r\n\t\tp.y = 0;\r\n\t\tp.z = Math.sin(alpha) * this.radius;\r\n\r\n\t\tthis.numberOfVertexes++;\r\n\t}\r\n\r\n\t// It builds two hemispheres:\r\n\t// - First hemisphere: loop of pi/2 with step of 0.17 (direction = 1)\r\n\t// - Second hemisphere: loop of pi/2 with step of 0.17 (direction = -1)\r\n\t\r\n\tfor(var direction = 1; direction >= -1; direction -= 2) {\r\n\t\tfor(var beta = 0.17; beta < 1.445; beta += 0.17) {\r\n\t\t\tvar radius = Math.cos(beta) * this.radius;\r\n\t\t\tvar fixedY = Math.sin(beta) * this.radius * direction;\r\n\r\n\t\t\tfor(var alpha = 0; alpha < 6.28; alpha += 0.17) {\r\n\t\t\t\tp = this.point[this.numberOfVertexes] = new Point3D();\r\n\r\n\t\t\t\tp.x = Math.cos(alpha) * radius;\r\n\t\t\t\tp.y = fixedY;\r\n\t\t\t\tp.z = Math.sin(alpha) * radius;\r\n\r\n\t\t\t\tthis.numberOfVertexes++;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n}",
"function SphereParticleEmitter(/**\n * The radius of the emission sphere.\n */radius,/**\n * The range of emission [0-1] 0 Surface only, 1 Entire Radius.\n */radiusRange,/**\n * How much to randomize the particle direction [0-1].\n */directionRandomizer){if(radius===void 0){radius=1;}if(radiusRange===void 0){radiusRange=1;}if(directionRandomizer===void 0){directionRandomizer=0;}this.radius=radius;this.radiusRange=radiusRange;this.directionRandomizer=directionRandomizer;}",
"function radius(e)\n{\n return 4*Math.sqrt(e.size);\n}",
"function pizzaArea(r){\n //area=r*r*Pi\n var area=r*r*Math.PI;\n return area;\n}",
"function radiusOutput () {\n dInput = document.getElementById('d-input').value\n dInput = parseInt(dInput)\n radius = dInput / 2\n document.getElementById('radius').style.display = 'block'\n document.getElementById('radius-input').innerHTML = radius\n if (document.getElementById('d-input').value === '') {\n document.getElementById('radius').style.display = 'none'\n }\n}",
"function addSphere() {\r\n sphereNum += 1;\r\n \r\n // Generate random position of particle\r\n var x = Math.random() * 2.4 - 1.2;\r\n var y = Math.random() * 2.4 - 1.2;\r\n var z = Math.random() * 2.4 - 1.2;\r\n \r\n pos.push(vec3.fromValues(x, y, z));\r\n \r\n // Generate random velocity of particle\r\n x = Math.random() * 0.1 + 0.05;\r\n y = Math.random() * 0.1 + 0.05;\r\n z = Math.random() * 0.1 + 0.05;\r\n \r\n vel.push(vec3.fromValues(x, y, z));\r\n \r\n // Keep track of where this sphere was created\r\n birth.push(time);\r\n}",
"function SphereData(id, radius, slices, stacks) {\n\tPrimitiveData.call(this, id);\n\n\tthis.radius = radius;\n\tthis.slices = slices;\n\tthis.stacks = stacks;\n}",
"function areaCircle (radius)\n{\n\t// var circle_Area = Math.PI * (radius * radius);\n\tvar circle_Area = Math.PI * (Math.pow(radius,2));\n\treturn circle_Area;\n}",
"function runAll (num) {\n\n let half = halfNumber(num);\n // this should take my half number function and half 7 into 3.5\n\n let sqRoot = squareNumber(half);\n // this should square root 3.5 cuz its taking my half var and using my function \n // squareNumber to square root it\n\n let areaCir = areaOfCircle (sqRoot);\n // this should calulate the area of 12.25, same concept as above\n\n let perOf = percentOf(areaCir, sqRoot);\n // this should tell me what percentage the area is of 12.25\n\n return perOf\n}",
"async function run() {\n await cloud.login('crownstoneEmail', 'crownstonePassword')\n\n // we can get all spheres that we have access to:\n let allSpheres = await cloud.spheres();\n\n // you can also get the data from a specific sphere, select the sphere by its ID;\n let officeSphereId = '5f3ea7fdd2eabaa437fdd2e6';\n let officeSphere = cloud.sphere(officeSphereId);\n let officeSphereData = await officeSphere.data();\n}",
"function omtrek (diameter) {\n return diameter * Math.PI;\n}",
"function findNb(m) {\n // your code\n let volume = 0\n let index = 1\n while (m > volume){\n volume += Math.pow(index,3);\n if (m === volume) return index;\n index ++;\n }\n return (-1);\n}",
"function radian_ah(a,h) {\n console.log(Math.acos(a/h))\n}",
"function getVoltsAO(amp,ohm) {\r\n const volts = amp*ohm\r\n document.querySelector('#ohm-answer').textContent = volts + 'V'\r\n}",
"function makeSphere(ctx, radius, lats, longs)\n{\n var geometryData = [ ];\n var normalData = [ ];\n var texCoordData = [ ];\n var indexData = [ ];\n\n for (var latNumber = 0; latNumber <= lats; ++latNumber) {\n for (var longNumber = 0; longNumber <= longs; ++longNumber) {\n var theta = latNumber * Math.PI / lats;\n var phi = longNumber * 2 * Math.PI / longs;\n var sinTheta = Math.sin(theta);\n var sinPhi = Math.sin(phi);\n var cosTheta = Math.cos(theta);\n var cosPhi = Math.cos(phi);\n\n var x = cosPhi * sinTheta;\n var y = cosTheta;\n var z = sinPhi * sinTheta;\n var u = 1-(longNumber/longs);\n var v = latNumber/lats;\n\n normalData.push(x);\n normalData.push(y);\n normalData.push(z);\n texCoordData.push(u);\n texCoordData.push(v);\n geometryData.push(radius * x);\n geometryData.push(radius * y);\n geometryData.push(radius * z);\n }\n }\n\n for (var latNumber = 0; latNumber < lats; ++latNumber) {\n for (var longNumber = 0; longNumber < longs; ++longNumber) {\n var first = (latNumber * (longs+1)) + longNumber;\n var second = first + longs + 1;\n indexData.push(first);\n indexData.push(second);\n indexData.push(first+1);\n\n indexData.push(second);\n indexData.push(second+1);\n indexData.push(first+1);\n }\n }\n\n var retval = { };\n\n retval.normalObject = ctx.createBuffer();\n ctx.bindBuffer(ctx.ARRAY_BUFFER, retval.normalObject);\n ctx.bufferData(ctx.ARRAY_BUFFER, new Float32Array(normalData), ctx.STATIC_DRAW);\n\n retval.texCoordObject = ctx.createBuffer();\n ctx.bindBuffer(ctx.ARRAY_BUFFER, retval.texCoordObject);\n ctx.bufferData(ctx.ARRAY_BUFFER, new Float32Array(texCoordData), ctx.STATIC_DRAW);\n\n retval.vertexObject = ctx.createBuffer();\n ctx.bindBuffer(ctx.ARRAY_BUFFER, retval.vertexObject);\n ctx.bufferData(ctx.ARRAY_BUFFER, new Float32Array(geometryData), ctx.STATIC_DRAW);\n\n retval.numIndices = indexData.length;\n retval.indexObject = ctx.createBuffer();\n ctx.bindBuffer(ctx.ELEMENT_ARRAY_BUFFER, retval.indexObject);\n ctx.bufferData(ctx.ELEMENT_ARRAY_BUFFER, new Uint16Array(indexData), ctx.STREAM_DRAW);\n retval.indexType = ctx.UNSIGNED_SHORT;\n\n return retval;\n}",
"function generateNSpheres(N, R) {\n\n var r_margin= R * 1.2\n var D = 2 * R ;\n var d_margin = 2 * R * 1.5 ; // 50% margin between 2 objects\n var elem_on_one_line = parseInt(1 / d_margin);\n var maxIndex = elem_on_one_line ** 2;\n const spheres = new Array();\n\n if (maxIndex < N) {\n throw new Error(\"Impossible situation, too many or too big spheres.\");\n }\n\n // Let's keep a bound on the computational cost of this:\n if (maxIndex > 1000000) {\n throw new Error(\"Radius is too small\");\n }\n\n occupied = [];\n // reservation of N values for N spheres\n for (var i = 0; i < N; i++) {\n occupied[i] = true;\n }\n // fill the rest of the array with false\n for (i = N; i < maxIndex; i++) {\n occupied[i] = false;\n }\n // Shuffle array so that occupied[i] = true is distributed randomly\n shuffleArray(occupied);\n var count = 0;\n for (var i = 0; i < maxIndex; i++) {\n if (occupied[i]) {\n // Random velocity. TODO: take velocity from Boltzmann distribution at set temperature!\n vx = (1 - 2 * Math.random()) * 0.3;\n vy =(1 - 2 * Math.random()) * 0.3;\n x = r_margin + d_margin * Math.floor(i / elem_on_one_line);\n y = r_margin + d_margin * (i % elem_on_one_line);\n sphere = new Sphere(R, 1, x, y, vx, vy, count);\n sphere.setStatus(STATUS_HEALTHY);\n spheres[count] = sphere;\n count++;\n }\n }\n // Setting the first sphere as infected\n spheres[N / 2].setStatus(STATUS_INFECTED)\n return spheres\n}",
"function projectOnSphere ( x, y, camera ) {\n\t\tvar projection = v3.subtract([x,y,0.0], rotOrigin);\n\t\tvar projectionLength = v3.length(projection); \n\t\tif (projectionLength <= rotRadius) {\n\t\t\tprojection[2] = Math.sqrt(1 - projectionLength);\n\t\t} else{\n\t\t\tv3.normalize(projection, projection);\n\t\t}\n\n\t\tif (v3.length(projection) > 0.0) {\n\t\t\tv3.normalize(projection, projection);\n\t\t}\n\t\treturn projection;\n\t}",
"function sphereTriangles(x,y,z,r,thetaMin,thetaMax,phiMin,phiMax){\n var increment = M_PI/heartQuality;\n var triangles = [];\n for(var phi=phiMin; phi<phiMax; phi+=increment){\n\t\tfor(var theta=thetaMin; theta<thetaMax; theta+=increment){\n\t\t\t\n\t\t\t//add vertices for triangle 1\n triangles.push([\n [x+r*Math.sin(phi)*Math.cos(theta),\n y+r*Math.sin(phi)*Math.sin(theta),\n z+r*Math.cos(phi)],\n \n [x+r*Math.sin(phi+increment)*Math.cos(theta),\n y+r*Math.sin(phi+increment)*Math.sin(theta),\n z+r*Math.cos(phi+increment)],\n \n [x+r*Math.sin(phi)*Math.cos(theta+increment),\n y+r*Math.sin(phi)*Math.sin(theta+increment),\n z+r*Math.cos(phi)]\n ]);\n\t\t\t\n\t\t\t//add vertices for triangle 2\n\t\t\t\n\t\t\ttriangles.push([\n [x+r*Math.sin(phi+increment)*Math.cos(theta),\n y+r*Math.sin(phi+increment)*Math.sin(theta),\n z+r*Math.cos(phi+increment)],\n \n [x+r*Math.sin(phi+increment)*Math.cos(theta+increment),\n y+r*Math.sin(phi+increment)*Math.sin(theta+increment),\n z+r*Math.cos(phi+increment)],\n \n [x+r*Math.sin(phi)*Math.cos(theta+increment),\n y+r*Math.sin(phi)*Math.sin(theta+increment),\n z+r*Math.cos(phi)],\n \n ]);\n }\n\t}\n return triangles;\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/kmmabignay mar17 loadEndReservation Set Attribute for image | function loadStartReservationSetAttrImage(MainEndArr){
var loadImg = MainEndArr.split("*");
for(var i=0; i<devicesArr.length; i++){
if(loadImg.length==5){
devicesArr[i].ImageUrl = loadImg[2];
devicesArr[i].ImageDestination = loadImg[3];
devicesArr[i].TypeImage = loadImg[4];
devicesArr[i].LoadImageEnable = true;
devicesArr[i].ImageDetail = false;
globalMAINCONFIG[pageCanvas].MAINCONFIG[0].LoadImageEnable = "true";
}else{
devicesArr[i].ImageServer = loadImg[4];
devicesArr[i].ImageFilePath = loadImg[5];
devicesArr[i].ImageFileName = loadImg[6];
devicesArr[i].ImageDestination = loadImg[7];
devicesArr[i].ImageType = loadImg[8];
devicesArr[i].TypeImage = loadImg[2];
devicesArr[i].LoadImageEnable = true;
devicesArr[i].ImageDetail = true;
globalMAINCONFIG[pageCanvas].MAINCONFIG[0].LoadImageEnable = "true";
}
}
} | [
"function saveEndReservationSetAttrImage(MainEndArr){\n\tvar saveImg = MainEndArr.split(\"*\");\n\tfor(var i=0; i<devicesArr.length; i++){\n\t\tif(saveImg.length==4){\n\t\t\tdevicesArr[i].SaveImageUrl = saveImg[1];\n\t\t\tdevicesArr[i].SaveImageDestination = saveImg[2];\n\t\t\tdevicesArr[i].SaveTypeImage = saveImg[3];\n\t\t\tdevicesArr[i].SaveImageEnable = \"true\";\n\t\t\tdevicesArr[i].SaveImageDetail = \"false\";\n\t\t\tglobalMAINCONFIG[pageCanvas].MAINCONFIG[0].SaveImageEnable = \"true\";\n\t\t}else{\n\t\t\tdevicesArr[i].SaveImageServer = saveImg[2];\n\t\t\tdevicesArr[i].ImageFilePath = saveImg[3];\n\t\t\tdevicesArr[i].SaveImageFileName = saveImg[4];\n\t\t\tdevicesArr[i].SaveImageDestination = saveImg[5];\n\t\t\tdevicesArr[i].SaveImageType = saveImg[6];\n\t\t\tdevicesArr[i].SaveTypeImage = saveImg[1];\n\t\t\tdevicesArr[i].SaveImageEnable = \"true\";\n\t\t\tdevicesArr[i].SaveImageDetail = \"true\";\n\t\t\tglobalMAINCONFIG[pageCanvas].MAINCONFIG[0].SaveImageEnable = \"true\";\n\t\t}\n \t}\n\treturn;\n}",
"function saveEndReservationSetAttrConfig(MainEndArr){\n\tvar saveCon = MainEndArr.split(\"*\");\n\tfor(var i=0; i<devicesArr.length; i++){\n\t\tif(saveCon.length==4){\n\t\t\tdevicesArr[i].SaveConfigUrl = saveCon[1];\n\t\t\tdevicesArr[i].SaveConfigDestination = saveCon[2];\n\t\t\tdevicesArr[i].SaveTypeConfig = saveCon[3];\n\t\t\tdevicesArr[i].SaveConfigEnable = \"true\";\n\t\t\tdevicesArr[i].SaveConfigDetail = \"false\";\n\t\t\tglobalMAINCONFIG[pageCanvas].MAINCONFIG[0].SaveConfigEnable = \"true\";\n\t\t}else{\n\t\t\tdevicesArr[i].SaveConfigServer = saveCon[2];\n\t\t\tdevicesArr[i].ConfigFilePath = saveCon[3];\n\t\t\tdevicesArr[i].SaveConfigFileName = saveCon[4];\n\t\t\tdevicesArr[i].SaveConfigDestination = saveCon[5];\n\t\t\tdevicesArr[i].SaveConfigType = saveCon[6];\n\t\t\tdevicesArr[i].SaveTypeConfig = saveCon[1];\n\t\t\tdevicesArr[i].SaveConfigEnable = \"true\";\n\t\t\tdevicesArr[i].SaveConfigDetail = \"true\";\n\t\t\tglobalMAINCONFIG[pageCanvas].MAINCONFIG[0].SaveConfigEnable = \"true\";\n\t\t}\n \t}\t\n\treturn;\n}",
"function calculateImageSize(value) {\r\n\r\n}",
"function get_img(i,f){var b,a=__CONF__.img_url+\"/img_new/{0}--{1}-{2}-1\",g=__CONF__.img_url+\"/img_src/{0}\",c=\"d96a3fdeaf68d3e8db170ad5\",d=\"43e2e6f41e3b3ebe22aa6560\",k=\"726a17bd880cff1fb375718c\",j=\"6ea1ff46aab3a42c975dd7ab\";i=i||\"0\";f=f||{};ObjectH.mix(f,{type:\"head\",w:30,h:30,sex:1});if(i!=\"0\"){if(f.type==\"src\"){b=g.format(i);}else{b=a.format(i,f.w,f.h);}}else{if(f.type==\"head\"){if(f.sex==1){b=a.format(c,f.w,f.h);}else{b=a.format(d,f.w,f.h);}}else{if(f.type==\"subject\"){b=a.format(k,f.w,f.h);}else{if(f.type==\"place\"){b=a.format(j,f.w,f.h);}else{b=a.format(\"0\",f.w,f.h);}}}}return b;}",
"function load_planets_image() {\n planets_image.source = new Image();\n planets_image.source.src = 'assets/img/planets.png';\n planets_image.source.onload = function() {\n planets_image.loaded = true;\n };\n }",
"imageLoaded(){}",
"function loadOrRestoreImage (row, data, displayIndex) {\n // Skip if it is a container-type VM\n if (data.vm.type === \"container\") {\n return;\n }\n\n var img = $('img', row);\n var url = img.attr(\"data-url\");\n\n if (Object.keys(lastImages).indexOf(url) > -1) {\n img.attr(\"src\", lastImages[url].data);\n lastImages[url].used = true;\n }\n\n var requestUrl = url + \"&base64=true\" + \"&\" + new Date().getTime();\n\n $.get(requestUrl)\n .done(function(response) {\n lastImages[url] = {\n data: response,\n used: true\n };\n\n img.attr(\"src\", response);\n })\n .fail(function( jqxhr, textStatus, error) {\n var err = textStatus + \", \" + error;\n console.warn( \"Request Failed: \" + err );\n });\n}",
"async fetchImg(key, element, type) {\n console.log(\"Fetching Image[SVG]\");\n try {\n let path = 'data/'+type+'/gallery_'+element.state.currentTab+'/'+element.state.currentImg+type+\".svg\";\n const response = await fetch(path);\n const data = await response.text();\n window.sessionStorage.setItem(key,data);\n document.getElementById(\"svg\").innerHTML = data;\n }catch (e) {\n console.log('data/'+type+'/gallery_'+element.state.currentTab+'/'+element.state.currentImg+type+\".svg\"+\"\\nStatus: Ikke funnet\");\n\n }\n }",
"function setImageHeight (img, bottomZ, bottomI, topZ, topI, dpi) {\n img.get = imgGet\n var view = new DataView(img.data.buffer)\n var imax = 256 * 256 * 256 - 1\n for (var row = 0; row < img.height; ++row) {\n for (var col = 0; col < img.width; ++col) {\n var intensity = (img.get(row, col, 0) + (img.get(row, col, 1) << 8) + (img.get(row, col, B) << 16)) / imax\n var z = bottomZ + (topZ - bottomZ) * (intensity - bottomI) / (topI - bottomI)\n var iz = Math.floor(0.5 + dpi * z / 25.4)\n view.setInt32((img.height - 1 - row) * 4 * img.width + col * 4, iz)\n }\n }\n}",
"function loadImgXML(uptable,lowtable){\n\tvar imgStat='';\n\tvar loadImgStat='';\n\tvar devFlag = false;\n\tif(globalInfoType == \"XML\"){\n\t\tfor(var i = 0; i < uptable.length; i++){\n\t\t\tloadImgStat+=\"<tr>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].getAttribute('HostName')+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].getAttribute('ManagementIP')+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].getAttribute('ConsoleIP')+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].getAttribute('Manufacturer')+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].getAttribute('Model')+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].getAttribute('Login')+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].getAttribute('Rommon_Mode')+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].getAttribute('Load_Image')+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].getAttribute('Recovery')+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].getAttribute('Verify_Image')+\"</td>\";\n\t\t\tloadImgStat+=\"</tr>\";\n\t\t\tif(window['variable' + LoadImageEnable[pageCanvas] ].toString() == \"true\" && uptable[i].getAttribute('Verify_Image').toLowerCase() != 'fail' && uptable[i].getAttribute('Verify_Image').toLowerCase() != 'completed' && uptable[i].getAttribute('Verify_Image').toLowerCase() != 'cancelled' && uptable[i].getAttribute('Verify_Image').toLowerCase() != 'device not accessible'){\n\t\t\t\tdevFlag = true;\t\t\n\t\t\t}\n\t\t}\n//2nd Table of Device Sanity\n\t\tfor(var i = 0; i < lowtable.length; i++){\n\t\t\timgStat+=\"<tr>\";\n\t\t\timgStat+=\"<td>\"+lowtable[i].getAttribute('TimeStamp')+\"</td>\";\n\t\t\timgStat+=\"<td>\"+lowtable[i].getAttribute('HostName')+\"</td>\";\n\t\t\timgStat+=\"<td>\"+lowtable[i].getAttribute('ManagementIP')+\"</td>\";\n\t\t\timgStat+=\"<td>\"+lowtable[i].getAttribute('File')+\"</td>\";\n\t\t\timgStat+=\"<td>\"+lowtable[i].getAttribute('State')+\"</td>\";\n\t\t\timgStat+=\"<td>\"+lowtable[i].getAttribute('Status')+\"</td>\";\n\t\t\timgStat+=\"</tr>\";\n\t\t}\n\t}else{\n\t\tfor(var i = 0; i < uptable.length; i++){\n\t\t\tloadImgStat+=\"<tr>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].HostName+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].ManagementIP+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].ConsoleIP+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].Manufacturer+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].Model+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].Login+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].Rommon_Mode+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].Load_Image+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].Recovery+\"</td>\";\n\t\t\tloadImgStat+=\"<td>\"+uptable[i].Verify_Image+\"</td>\";\n\t\t\tloadImgStat+=\"</tr>\";\n\t\t\tif(globalMAINCONFIG[pageCanvas].MAINCONFIG[0].LoadImageEnable.toString() == \"true\" && uptable[i].Verify_Image.toLowerCase() != 'fail' && uptable[i].Verify_Image.toLowerCase() != 'completed' && uptable[i].Verify_Image.toLowerCase() != 'cancelled' && uptable[i].Verify_Image.toLowerCase() != 'device not accessible'){\n\t\t\t\tdevFlag = true;\t\t\n\t\t\t}\n\t\t}\n//2nd Table of Device Sanity\n\t\tfor(var i = 0; i < lowtable.length; i++){\n\t\t\timgStat+=\"<tr>\";\n\t\t\timgStat+=\"<td>\"+lowtable[i].TimeStamp+\"</td>\";\n\t\t\timgStat+=\"<td>\"+lowtable[i].HostName+\"</td>\";\n\t\t\timgStat+=\"<td>\"+lowtable[i].ManagementIP+\"</td>\";\n\t\t\timgStat+=\"<td>\"+lowtable[i].File+\"</td>\";\n\t\t\timgStat+=\"<td>\"+lowtable[i].State+\"</td>\";\n\t\t\timgStat+=\"<td>\"+lowtable[i].Status+\"</td>\";\n\t\t\timgStat+=\"</tr>\";\n\t\t}\n\t}\n\t$(\"#loadImgTableStat > tbody\").empty().append(imgStat);\n\t$(\"#loadImgTable > tbody\").empty().append(loadImgStat);\n\tif(globalInfoType == \"JSON\"){\n var devices = getDevicesNodeJSON();\n }else{\n var devices =devicesArr;\n }\n\t$('#devTotalNo').empty().append(devices.length);\n\tif(globalDeviceType == \"Mobile\"){\n\t\t$(\"#loadImgTableStat\").table(\"refresh\");\n\t\t$(\"#loadImgTable\").table(\"refresh\");\n\t}\n\tif(devFlag == false && globalMAINCONFIG[pageCanvas].MAINCONFIG[0].LoadImageEnable.toString() == \"false\" && globalMAINCONFIG[pageCanvas].MAINCONFIG[0].LoadConfigEnable.toString() == \"false\"){\n\t\tLoadImageFlag = false;\n\t}\n\tif(devFlag == true){\n\t\tLoadImageFlag = true;\n\t}else{\n\t\tclearTimeout(TimeOut);\n\t}\n\tif(autoTriggerTab.toString() == \"true\"){\n\t\tif(devFlag == true){\n\t\t\tcheckFromSanity = \"true\";\n\t\t\t$('#liLoadImg a').trigger('click');\n\t\t}else if(globalMAINCONFIG[pageCanvas].MAINCONFIG[0].LoadConfigEnable.toString() == \"true\" && devFlag == false && LoadConfigFlag.toString() == \"false\"){\n\t\t\tcheckFromSanity = \"true\";\n\t\t\tLoadConfigFlag = \"true\";\n\t\t\t$('#liLoadConf a').trigger('click');\n\t\t}\n\t}else{\n\t\tif(devFlag == true){\n\t\t\tautoTrigger('loadImage');\n\t\t}\n\t}\n\n\t\n\treturn;\n}",
"static imageSrcSetUrlForRestaurant(restaurant) {\r\n return (`/img2/${restaurant.id}` + `-300_small.webp 300w, ` + `/img/${restaurant.id}` + `.webp 600w`);\r\n }",
"function loadInstructionImages() {\n\tif (window.omnibus.frontend.imagesLoaded !== true){\n\t\twindow.omnibus.frontend.imagesLoaded = true;\n\t\tdataLayer.push({'event': 'instructionModalOpen'});\n\t\tvar imgs = jQuery('#adobe-instructions-modal img');\n\t\t//change src from the transparent GIF to the actual source on modal open\n\t\tfor (var i = 0; i < imgs.length; i++) {\n\t\t\tif (imgs[i].getAttribute('data-src')) {\n\t\t\t\timgs[i].setAttribute('src', imgs[i].getAttribute('data-src'));\n\t\t\t}\n\t\t}\n\t}\n}",
"function loadUbuntuIcon() {\n var logo = new Image();\n logo.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAR0AAAEdCAYAAAAxarN7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAIYZJREFUeNrsnU2QFFXWhm+3KC2NNATT4s8wtLoV7NEV7YLSGBewsY34FhoYUrORheLXgyEudLB1mIUYKgO6aDYWhsQQMQvLDS4wtFgMrMZp1OXotKLjABp08y/4yZdv1k1Iuqsyb1Zl3p+87xtRUSjaVX0r86n3nHvOuT2CohJ0+fLle4KnxVn+n56enoNcOart9cEl8A4iK4KnodgDqsT+k0oBLzsZPKZn/Xk6+nMAqSP8ZAgdym2wDARPw/KxWIIkDhkbNSUfEZQa+HMApBl+ooQOZSdgKjHQDJXoV4wcUUM+A0Rf85MndCh9kLknBplKyQCTBUSN6MHwjNCh8oXMihhgRkXGpC4hRBE6lApo1kjARCETlU1TEkD1AEAfcDkIHao1aB6WoKGbyV/16MHENKFD0BA0BBChQxUMGiSCq/JB0JjTdAw+DMEIndKBZiAGGuZo7NNU8Kjhwe14QqcMrmZMwoZyJ/yq0f0QOq7BZoMETYWr4bT7GRfM/RA6DoRQcDZDXJHSCLmfHQy9CB3bYDMmH0wMl1s1uB/Ch9AhbCjCh9AhbCjChyJ0CBuqKO2Q8GHCmdDJDTjYjRoXTBBT7RUlnHcQPoRON7BZIy8kFvRRqpqSrmcPl4LQyQKbFdLZVLkaVIdqIBTnmI256uUSzAHO/4rmhDoCh+pGFVxHwfX0pswHUnQ6c2CDloUaQymqoJBrjK0VdDoRbAbwbSTdDYFDFaGh4FEPrrP36Xo8dzoyUVwT3JWi9Am7XFWfXY+XTifmbhoEDqVZi313Pd45HeZuKLoeOh2dwIl2pggcyibX49UOlxdOR36gcDejvM4pSzUpXU/p63pKDx0ZTjUE+6UoN8KtsbJXM5c6vIqFUwQO5Uq4VQuu23fodNwMp9AzVeV1TDkcblXK2DxaOujIvikM12aymCpDuFUpW56nVOGVzN9wd4oqU7g1KUerEDoWAmeDYP6GKqdqspiV0LEIOC+J5pY4RZVVY0gwl6Gex/mcjsz0V3lNUp7I+QSzs9BhwR9F8LgJHiehI4HTEEwYU/7K2Z0t56BD4FCU2+BxCjoEDtWJfvryc3Hhs0Pip6++ED8f+yZ4HBU/Hz8a/l3fypHw+Ya77hbz77xbLFi9Tly30KlcrXPgcQY6BA6VRf93Zkacqk+I0wf2XQGMqhasXiv6g8dNDz1G8PgKHQKHygqbk3tf6/pnzbt5uRh8dpe4cdX9BI9P0CFwKFWd/+zv4sTrmzI7GxXnM7h5lwthlxPgsRo6BA6lqpPvbc/F3SS5nmVb94j5d60keMoKHQKHUtXxwN2c+Whf4a/T279I3PpqneDpdh0JHMpl/TDxghbgQL+cPSW+f3403A2zXOg/bMiJC4SOomoEDpWm0wf+Kk7Vd2t9TYDn2CsbwoS1A+Cp29irZR10ZC8VWxuoRF069o34ceJFI6+NRPWJNza5sEzD0vFYBR6roCO7xau8pag0AThwHaZ07vCH4W6ZI+CpETqtgYN5OOO8nag04WbHTW9a2DFzRKM2zV22AjqxA/AoKlUz9Qkr3seFzw+54nagqi0TCI1DR2bYG7yVKBUhl2ODy7ENgIrCBMI1XkNHJrgwRJ0jRiklnTv0oV3v5/CHri1h3fRWummng2NiuDVOKev85/aFMw6FWEJYsJVuDDryILwqbyMqiy5YeINfcAs6Qn7R7/AKOjJxvIO3EJVFKMgzuU3eTpjT46CMJZa1QyfW4kBRmXTR0pv7lzPOzkivSQNQeqdTE0wcU5Qt0p7f0QodmcdhiwNF2aMhoTnVMU8jcJjHcUCX5AxhhAzxcAZ5i7QwIj5h74Y77xa9CwfCcRAOjILwXcjv1Ht6ej4oDXRiZ1RRlgjjGS6Gg8qPhlu+8WHlnQoVum0vtJuXi3nLll8ZgD5v2W8yjwHF/08VJuR3hgPwfF0WpzMuWI9jVAALtnbD5wQ4FCUADY/Zr43TGACiG1feL/oCCCWNBL0+AJWNcmSGcpoWS2PwQNEvVPjkQFl23eBtr9/J4NiVs4f3G4FMp1r4u0fFzc/uavv3/9nysHW/z+DmnS6dHJGmscDt/MVZp8OwSj9oTn+0L2wVyHs4uS6dCyApxK5EV2EbdPrK4XSuRCUyv1NYmFV0eIWwaog4KE5hA2QAGTQeugqauFD8h9+pXSiFkxmKHMCeVUiY2xr22RpmFbZlLnerxoiFYoTczH9feUIcrd4nftz9YimAc8XtJDR1YicMN7otGhh9soyXV0WWt7gFHYZVxQhzgb/ZcG84INzBDmc1oKY0ddpyo6McoES5nFZhViFFg4VAR1KSu1U5ClPqAJsTbzxTKlfT0ukEMEWI1U640bEFb1pLN24r88eAMKuQurrcoSNndYwTE/mHU2WHTVxnDiQfKzOYsMOlQwjxSuxyIlWLGPpVhNMZF+ytyl2mbzLdQmI86ZgX7GItMhRmIazCNrknyt3t5AodScUqEZG/sEOyqJxJy5bCLtaplFGgv9r457C40ERY5VFrx3DeSeVciwODN/dPwVxOYcI3/9HqvVbOlCnKUSyvfZpYpYw1QVJd19iLkhUCqgrHFA/19PTkMsMjN6cjBwIROAUKN9/A6Eav3E7aoXZYE5wvrsPxeAocCOmScaucjtxamxQsBMzsXHBT9a9em+lixi6WT0nlZX/cI/pH1qX+d9jhK6JwEDtly7buYbd80+10Xamcl9MZI3CyCbtRCJWwPYzTKrOcjb3k8ee8WiuAOWkL/eq6bAldT57Fg8ij3f72JwROU7m4na6djnQ5U4I7Vsr6YeIFcaq+e87FjcSoqmxsfCxSAAmAkpTfiQtFlKcP7OtojZBLWrB6XQj3krU45KFK4HYOmobOS4J1OcrhVFLS8/a3Plb+RoVTws/ySVnBA0W9aei2x7q3S8LjZ+OBUDdtxIbnagTQ6aovqyvo0OWoCx3ggETSzhOSobdtVx/eht6rsrZC5AmeVp9F9Dng5xEwet1Ot9Chy1G0+mhfUFGWHRJ8i6Ph0zcBFFgn5lncdDsdQ4cuR02t8jdp+YS02pRufn5Z1KwK3qW0q0XZ5Xa62b0aI3CSdfz1TZmBoFKJG9eS9VvCG9A3YZ2O/WlDGGKq7GxRuavjCKcjp0OXkywkjLENfuajfR3/jOW1fyjvnMy8PxHO1PFVgC6KJhcFD+ZntKqjup1OoYNeDB4n0wY4eZTlZ00q+1Yw2A4+Cx96NARQXlvd+DwJsraqBdD5vS7o/FuwGLAw4ERSrcSFzh7aH4YbVFPh6InfPSr6Vo1kSjjjM8SpGWcPfxjOa8ZROd3ultHtdAkd2WNV41oXCxwI5feohlW94H0rGMzqHAGQ69ucnZV09lce2/Ql1ngAnZeLhs4nwVOFa32tkDTuJofTTkvWPxeW96vIx4JBnc6J4GmpzB3omaAjh61Pcp31ACdSlqRynu8FOZKojwkH4l3XP5AKPSiP00IJHqdUDaCzpyjovCM4pOsa6aiTyZJU7rRgEDdUmP/o8MjfVoqOLsY56Be//KIUoV/aYYCeajKAzm9zh47cJp/m+l5VlkrjbpUlqawy4gH5ogUja5WO881T0fHGSNTqGryVt7I253oinIN+JG/ocJt81rf4d08/qO31siSV200YjECDXR0bWgiiZkycSuoagDwe6NVOytvnWaDDUaQpN3XRypJUjhcM4lRMgMbmlgFAfCYIU7FN7co41ixTATyQckJZCTpMIF+rb596wNg3c5akMsIsFMu5NBMGQEcbCGbh2J6MzlrS4IGUEsqq0HlT8IjgUKYbLLNWKrss5MzQTmKz84GLvGXru7wxmlJKKKs2fFa5ns0kqOmObuwAofrYByFngo57hJW2NrVinhFCWSrUsDxsszunE/yQh4Onuu+radPxLz7aeiSd4XpsHVrG/M4VjQVu5y/dOh2WuIrmcHBbbD5yHVnGX5RByEshjEHpgI2uR1fphAvQySO88h46CGds+4Y969mY0kjYgUPIhVyKTcLGAhL3lBiSG0+dQUeGVl7PzInOprJJKE779dufePuZIKyE60GtjE2uBwWZ2Pqnko1Kbzf/sw+yafekOaJzJ6thpZBoRi8Uclw2XS8UodOxsFtVZCNnVuDgBmMV7LVC8hZJ9TwP2OtG2F3EVr/nStzF6k0Irdb4HlrZEqPjhkIeg7sj7cMtABnNmLa4nSwntvrmdnrpcloL31Y2dEVznII6eND9bQN4sg7X9w06PQlOx+teKxtmDhM4nano+UaqytKyUlItbtWL1dsGOCt8Bg7CKgLHXdnieE6+95rvH0UlS3hV8XWVEIvPGLbGBE45wAO35fmZXISOihCLm9wij3apCJx8wGN6V8tztzOaBTreJpFNuhwCJ3+ZruPx3O0Mtdo6nwMdWcLs5VY5dqxMupylG7dxWzxnAeDLtprt1/Lc7VRUnI7HCWRzFwdaG1j4V4wAcgDdlDAN0eO6HSXoVHxcmfCwNUM7Vsg7sLWhWAHophLLcM9nDuzzdemHCZ02MpXLifqpKD3hq6n8zoy/xYLD8iSZ1tCRfznk26qEpxIYGhWxZP0W5nE0CfmdQUNnVsFFR4cR+u52etOskA/CMSimwqqBRzaSBhqFQwRNhVmn/Q2xKknQYWilUQyrzIVZJnazsH3uaUKZTicuDF0ykUBeaMmBd76GWQhrjbjqw/t9XHJC5xrLa6AxEN+ySx5/jne/QSGsNZFU9nTM7FA8mXwFOr4mkU3kcwZGN/refWyFTIAfGxa+h1i9DK30hlZwOYtGmTy2QajdMeF2fA+xvIbOhc/0D+nCMb/srfLb7Zz/7JCPSz3UCjre9VudNfCNM0CX473bodO5qop3TkfzOFLsWDGXYyN49NbtoC3Cw6NqWkJnyLdV0F0kpvviptRDXh9Ce8O6EknNcwU6aFX4+djR4NF8jtS36v4wOdtJzcvNsiRexzxdWHhUw1L2Ce4TJ4bqbIU5//nfvatGxwkzPT09B+fJf1hh45tErwpKxy8kdYDvvTqOom/liOhfvS5TslYXeBaMrOXdbbH6NUPngr99WM3TIOQZVw1b3hSGaWG2TTfb2QidsDOhmkMp+gSB29/6mBXIluurtYNaX8/D0yLGA6fzcq9NoRWSa98+9YA48cYzXdfPACBHq/cpH5iHfpyi5ukitCJw7BdCLJ3y1e1YAx3A4bunHxQXv/oi358bhF8AWdqc2nDsweadhTQCMrRyJ8TSqXhu0hNV4tAxKoQ2J/cWNyoUIPsuAE/aNiXcSBGNgDeuZALZBfVpTvSf99zpVEwCR8fuEWojvn9+NBU8RTQC9nHXygkhv6KzUNBDpzNk3On8MPGC1uNfI/CkNdzlOV0OeSK2PdDttITOcUJHq84e2i9O1Xdrf12A59grTySHQ8GFl1dSuW/VCO9khzRf8+F8PoZYRsIrOI0Tb2wy9kuj/WHm/eRpgQOjTzp5EVNdOtO7+HkVKYzQMeJ0Tu7dbvRQu+g9JIVZaATMYydrHnutnJLuqnEPt82HtUMHW9cmwqpWYdaplNnIC1avc+4iprqXyWOIfQqvtMmmQ8fSBrJ3W7dh8ihbqht3qg86l/zbwRK98uxybbLpGA64HSS026nbnYwbmM9xFDr6QuKfU4pWS7m+QuPwLlMnLyQJg7L7R1qHUdjqBjjyrpKm7NaNq0Y6ggGS0Nf1ZyuP0OmqLNHieTpfzcYZImmJPFwUnUKHOyFuCpsIeFCFSG8i+dJx+6xkmvPqZss767ceRfkgrdC5+KWdYYqHoyMpyg/o2KqkmiEmgymK0NG7QOyboihCh6IoQqe08nmWLUU5Dx1b+5DYqkBRJYWOjR3XaX02PpapU1Sh95zOF7NxtkxaAV831ciYlbKE15hzwufWbVjd2z+gVBza6ZltDmtKK3SwuFhk02Mt4kpr6mQLhH/CGfe6JiHgrLbbtn/gFXR6ceKezldcaNHRugBg0viKbqe6EVhuSmcRq4/zlrTvXg2M2nOUKoCTNL8Y33jdyCZHR9n5uV3vX8Onfuhg4j5O37RBOAE0SecOdX/MLFssHHQ6dKjlgo7Kza7lPaxPPnIYc3byGMPBC9gt6f6S8LDNZiqCzqRut7P0yW3Gfmtsky9KCfPSpgoqX8SEDl1O0re+Z202PT09X0fQmdb94jjUTvfZ0eGH3L9ILNu6JzGXE26Zfp7P7B9bO+spO74kfCxMNdoGMbh5l3Z7uXTjttS6CJyrnpfyghelRzoHzXk4Q3s6Dp1JE+8AbuPWV+vawDO4eWfqRDjkcvIGxXn2bzkhHEmkM7zyMJ8zGYfOtKl3EYGnyFAL3yi3v/VxKnCKOgSQTaOuuBy9n5Ov42yNQycCzy1b3w2Ty3lbTsBsee1TpVJzAKeIGg0Mf6fsl+7Pab7nTmfShneE5DIAkUcdD8rL4aAAs+sUdgiQxzlX0EUHy37Jw6NGXNO5LotBGV6latoapzPb9dz87C6x4m//Cp1Plg8GLgnAAmzQz6K6M3D6wF/Fyb2vFXtBH6LbsdrlHNqvvYLcs0bPK+YmbPjs6ek5cvnyZaveHeAD54NHlOCLYm5sa/4S/LvonCEcEwM4dfIhAjgn3nim8N/n9Ef7wt+FYmgVOXEPNX0FOlJTwWPIxncKAMG15F3TMPP+hPhx94tafgdAE9WuHn67WS98qekOrTwdHHdNTieCjlcXmi7gXIGcpnEJVMbQ97D+0KrPQ+gEEdXMbOhM+rQA0ZHBui9uwI6ySyffe037a3rodBrRH3pnx1s+SfckQ3ybnsqpp4vKRyjczKOxN4tMtP9YoKlW0Gn4tgo3GRixcfrAPt7pVrmc7dpfs5/Q8TO8gqLxqTqFb1XsmFF2uBwTvXF9fiaR54ZXMsnjXYiVNK60KP048SJzO566HOQRr/dwRGk7p+Ol2zFhdZnbMa8iGnttDekt0DTm6LSDTsM76IysSz37qghhSBhbI8wJbtOIsx7xMp9zjZnx3umYuhDgdkxd+AyrtmvfsWqG8mt9Da0ahM4smTqhAg2msPmUPsFdFt1nZ1Mob73TkXGXd8lkfPuY6oXBOA0mlTWu9+ubjLwudknT5jn5Gl7NsUK+6CZDhwAizCpicBjVOqwyNT7WpkMmNWsqnkQmdK6BzmPGZtYizELzKVWc0GxrKqwyGcJboDk8IXQsuTDQfMqD+YoRwtdjr2ww9vqY8eRpAnlOaNUSOpitIzzM60A4C8vkhH7cGMzvFLGuTxjZrTIdurvkdLx1O+HgMINuBzfG98+PEjw56vjrm4weA4QNCk9n50BT0sQQOolWOPhWMul2MOyL9Tv5CInjMx+ZbbBd8vgWuhxCJ1mIvU0n/XCjHH+dO1rdSMfca7qcHKEjLdGUrytlOrdD8HQPHB1zr+lyUlXP4nS8djumczsEj/vAwY6V5y5nMhpPmgU6dZ9XDG7HRCMowdO5kMOxAThwyUsef44up936tPuLgFIf+LxicDtLN26z4r0APN8+9QB3tRIEMJvO4USCS/a4Lqdz6NDtNMde2HI+EXa1vgvAwwLCawUQ/2fLw8Z3qSLBHS8a9f58s5Zb5YSOogaf3WXNe4nqeDjutCkAGCA2WYfT6npROcbaV5dD6CgINnnJenvi82aD6DPe53mQv/nu6QeNVhrPFubleJ48jlTrGDoy++w9eLD16eFh91YK83AQTtmSv7lyI/UvEoObd/EDSgmtVJwO3U5kmzfvNF67E7/AbUlya3c3loVTV68PhlWqvFCFzrTvK4njapast6PYC+/DpwscR8V8s+He0N3oPv5XRYtGnww3Haj00CqMoFR+yuXLl98JnqpcTyH++8oT4fwbU0KY9+u3P/EGNiYHb6l+Hre+WqfLuRpa3ZGH02GINctGmywazBJWuTp/GbBB3gY7dTYDp5nH2UngXNUOlf+oR/WnBW7n38HTENdVbtU+/aD210Vp/c2KW/gAzrE/bQgBiXku6J63uWAN9TbnDu8XM/XdYU2SG19AO32ee9xKQ7NHk3YLnZeCp3Gua1O6e3zwrbq89qnytypyILO3k7GlixMJbLpRAMezQbgK4NiYr2kn5HF+tfHPvBFi0VAAnEfydjorhMed5630w8QL4lTwzawlrHpymxh4RK3SFfOWMf40SRGAcK62TgcER3MhCJ9cBE187W7Z+i5vgGs1qto61ZPlpwbgeR8/nOt7VSjSK7oEP0vyGDf10eq9mW5mhGCAz42rRsS8AEB5FrghFEW49FPwuPDZIWdCp6TPgonjOVJKIHcKnYcFk8pzbnIkPIu8mXCRq4IAuz15FM4BRPOWLRc33HW3uK6/eYP1JbyHi19+EYCu2ZCKRDCg5zpgWq3J7QH8CZw5Gg+g83Ih0JHgYUJZI3iyWHlU6x6t3scPpAAhpwb4o16LmqPF7WbntIR3J1QTCgVAPgnffLgg8wZP1srjk++9xg8jJTSKqsrh4H4+dlT8IseF4HNrF5ISOImqZQFOp04H3nIKdON6F+t40GiqOvISIQ1em7oKCoSDSJYDNirAwOd3Mcw9NRPd+DOBk6rhtF6rrqEjwcPt84LBg/zBb/Z8qvzfo5jO5kI6XcL8I9Ql5VEWgHAV4kCutmoEwHkg6//UKXS4fV4weLIkj6NCQN9hA1fI0RJaVQmgc1ALdCR42I9VEHiy1oG0KgT0RXCEGJxF2LjhcsLQt4sXZXiVoCi5DIBkzUVkSx5v9xY4qApGCErgGFGt0/+xY+jIHosa1z4ZPHAs6JlSVZah3nBTM/UJ79YVYF72xz1sQzAnFAPu0Q4duh11oUkTzYEqoUKWA9pO7t3uZBtBt8CBg+T8GqPq6r7v6fbVmdtRF1oCkOdpB4osyWMfCwE73b5GOQG2wfGM2pzZ4SiS0Gj/mH/n3WLByFruVqW7nDu6+QF5QIc7WRmEkOjYK0/M2d7Omjw2PUzMduAAygg9zxzYl9kNoq5nYPRJjq1orY52rHKFjgTPm8HTGD8PdcV7pHBDoadH9RvWx0JAVRcIqP848WIuTbjNcPc5wueqOt6xKgI6rFLuMNzCTB5UzWbJ5fhWCKg61gP1Sife2JR7ngvh17LAhbLRs3uXkxt0JHhYpaxBuoeHmRZu+Nu2p49pKXq2Edsh1Id06YQOvgYmBTvQC5VvhYDLa/9IDTt1zDQieNRGkSqtY17vSHaa0ukUKN8KAVH8ZwtwIIRtyKV5eJ78eF7AydXpxBwPRtxViIh81clEQJelMhPaVKiZdV6145qWLmcmt/Ur4E1yF6sAYUfGp0LABavXJd7U2BLHmphQ8zx5b86SH8sTOIVAR87W2EFMUN0IW9VJOvH6JqMQRo2Uq+eKZVCjm3YHbeGVDLGYVC5A+HbHdEBXT1FQVdogelvqlLLOPHJQmQd0mQqvoqQyw6ychaQq+riQT0DtismTRovUTSkNskio2yAk9UvsdsaLAE5h0JHgQXEFT44oQMh1oFgO37Lots7Sxe6C+laNJLo9mwojT2vaOdOsqSynO1gRXs0Ks6YEK5ULV3Qsb/MQO7d7su788ETbv1M5SFC3VvztX2Xbycql8li704mFWVUiQY/7QY8QmkZxE2CUBppIo9MPnHE5K0cS//7sYfvCGXSwl0g7igRO4U4n5nh4MqhBoZgN7gcJ2KSjVkyCBs2czVNGk5s6p/7nLuvef5ZTO2wPq0QzeTxT5IvM0/TLVBlmmRPK9vFYEoNQdNQvTubUBSK4LuxM4cwpzK5RPRomHkLauGv3U3lOMh0tGjjaoINfJHA7AA8TyxZB6KZZ//68DBOicOESBl7JY1igVgOw4jC58s9BqDdf/nN4wF3wz3juNu9h6zHF0YF9jquw3SpTTifczQrAg6JBbqVbqii04aBz79QocrdqzpeUbpqKZtEgRVF2CL1VVZ0vqBU6sd2saX7WFGWFqnl2kNvodKLeLIZYVPZcwLLlXIR8tUMW8WpVr4nfVDaR1fiZU1lk6ykNjubAJoP78A8mXrjX1G8c/MK/F8zvUBmVVjxoQvGdO0eE9EbF1Iv3Gv7lK4L5HcpxV9HnntOp6KjHsRI68hev8FaiVJX1bHgd78exvquqrnocW51OlFiu8naiVISiRptCrH7LIJiiWhFDuZyDjgQPFoLTBikl3fSQHaM8MM/IoYP4GjKPaly9tqyIzKTXeEtR6dB5zAq3kzZS1SJhw8aahuteyxZnTHBHi1LQ0o3bjL4+oOeIywl3qkwmjq2GTiyxTPBQiQq75tebcRpocB18dheBUxKnEwcPt9KplPBmi5FRrYObd1lbqNgCOEdse2O9Nq4WwUNlCbN0FudhImP/yDoXlqZqI3CshY4EzxGCh0oTamRwvnjRjicMqQLgOJLHqZroqVK+t21fvcuXL98TPDUEpw5SKSpqaDucFICTZcqhYeDssfkN9riwigQPpSqMYsVxw3kcUwN3MzC60aX5x9YDxxnoEDxUVmH06kx9oqPjeCLYLAoeDrU4OAEcp6BD8FCdKDoP7Pxnh8IZy+3mLKPuBgPjb1x5vyuJYieB4xx0CB6Kchs4TkKH4KGoUNPC8l2qUkFHgmeFaB5pM8zrj/IQOBVb63BKCx0JngHpeAgeisBxRL0ur36scpmH+FE+CD2JQy4Dx3noROAJHo8IjsWgyq26sLB507vwqkW4tYHwoUqomi0DuAid1uBZI78VuLNFlUHObYl7Bx0JHu5sUa7L+YRxO/WW8dOSx6RWGGpRjqoUCWOvoCPBMyPjYB5hTLkkHPX72zIkjL0Kr1qEW/fIcGuI1zRlcTjlZIUxnU5r1wObOsxwi7JUDVyfPgDHG+jMCreqgtMIKXs0HlyXD8g8pB/3oo+fstzdguup8JqnDGkqeIyWNVlMpzPX9XyNbxfRTDLT9VC6tUOGU0e8vP98//TpeijN7gbJ4oM+L0Kv71cBXQ+lScjd3OE7cOh05rqeAWl9q1wNKic18IXmayhF6KjDZ40MuYa4GlSHmpaw2cOlYHilEnIdhBVmyEV1GkqJZhsDgUOn03HINS7YTkGlqy7dzddcCjqdblwPigr/IEOtGleEaqGGaHaEP0Lg0OkU4XzWSOdT4Wp4rynBLXA6HQ3O56DcYq/IbzjKX9hwC5xOh86HKjyMqjFBTOjYAp8VEj5VrkYpYTNOV0Po2AwfgAe7XZzT7LZqojlUi4V9hI4T8MFW+6iED2c1u6OpGGxmuByEjqsAWiPdzyjdj7VCjU3Nl0FahA7dD2XO1aDXrs76GkLHBwCtiAFoiCuiFTSRq2GuhtDxFkD3SACN0gERNIQOZcoB4VHhinSsSQmaOkFD6FDqABqQ4KlICDEMS3YzDfmoc+eJ0KHyc0ERhIY9D8UiyMDRNOhmCB1KnxMangWhMrqh6Qgu8nmSu02EDmUfiCIARX92pT6oIV1M5GSmCBhCh3IXSGvkHyuznoc0OaTIsQj5PB1/Zh6G0KH8dkpxLRZq+aPIoVzz7+hUqLj+X4ABAAW22X2zqIf0AAAAAElFTkSuQmCC';\n return logo;\n}",
"function loadingMainImgAfterLocationIsSelected(id){\r\n\tselectElement(id).innerHTML = \"<img src='layout/img/Design/what-is-on-the-menu-is.png' class='img-responsive img-rounded center-block' alt='' title='loading'/>\";\r\n}",
"function loadImgData(data){\n\tvar mydata = data;\n\tif(globalInfoType == \"XML\"){\n\t\tvar parser = new DOMParser();\n\t\tvar xmlDoc = parser.parseFromString( mydata , \"text/xml\" );\n\t\tvar row = xmlDoc.getElementsByTagName('MAINCONFIG');\n\t\tvar uptable = xmlDoc.getElementsByTagName('DEVICE');\n\t\tvar lowtable = xmlDoc.getElementsByTagName('STATUS');\n\t}else{\n\t\tdata = data.replace(/'/g,'\"');\n var json = jQuery.parseJSON(data);\n\t\tif(json.MAINCONFIG){\n var uptable = json.MAINCONFIG[0].DEVICE;\n var lowtable = json.MAINCONFIG[0].STATUS;\n }\t\n\t}\n\tvar imgStat='';\n\tvar loadImgStat='';\n\tif(json.MAINCONFIG){\n\t\tclearTimeout(TimeOut);\n\t\tTimeOut = setTimeout(function(){\n\t\t\tloadImgXML(uptable,lowtable);\n\t\t},5000);\n\t\treturn;\n\t}\n\tloadImgInit();\n\tTimeOut = setTimeout(function(){\n\t\tsanityQuery('loadImage');\n\t},5000);\t\n}",
"function getImage(direction){\r\n\t\r\n\tswitch(direction){\r\n\t\tcase 1:\r\n\t\t\timage = BS_N;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase 2:\r\n\t\t\timage = BS_NE;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase 3:\r\n\t\t\timage = BS_E;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase 4:\r\n\t\t\timage = BS_SE;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase 5:\r\n\t\t\timage = BS_S;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase 6:\r\n\t\t\timage = BS_SW;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase 7:\r\n\t\t\timage = BS_W;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase 8:\r\n\t\t\timage = BS_NW;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tdefault:\r\n\t\t\timage = BS_E;\r\n\t}\r\n\treturn image;\r\n}",
"function createImageTableDynamoDB(){\n\treturn ddb.createTable({\n\t\tTableName: CONFIG.ddb_image_table,\n\t\tBillingMode: \"PROVISIONED\",\n\t\tProvisionedThroughput: {\n\t\t\tReadCapacityUnits: 5,\n\t\t\tWriteCapacityUnits: 5\n\t\t},\n\t\tAttributeDefinitions: [\n\t\t\t{\n\t\t\t\tAttributeName: 'eventt',\n\t\t\t\tAttributeType: 'S'\n\t\t\t},\n\t\t\t{\n\t\t\t\tAttributeName: 's3_uri',\n\t\t\t\tAttributeType: 'S'\n\t\t\t}\n\t\t],\n\t\tKeySchema: [\n\t\t\t{\n\t\t\t\tAttributeName: 'eventt',\n\t\t\t\tKeyType: 'HASH'\n\t\t\t},\n\t\t\t{\n\t\t\t\tAttributeName: \"s3_uri\",\n\t\t\t\tKeyType: \"RANGE\"\n\t\t\t}\n\t\t]\n\t}).promise()\n}",
"addImageObstacle(){\n this.counter++;\n return new ImageObstacle(500,this.getRandomMeasurement(180,205),25,25,this.images[0].img,0,0,25,25)\n }",
"function loadComponentEnd(model, resource, jsonld) {\n var component = getComponent(model, jsonld.getReference(resource,\n 'http://linkedpipes.com/ontology/component'));\n component.end = jsonld.getString(resource,\n 'http://linkedpipes.com/ontology/events/created');\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
resolve contract code referenced by vmtrace in order to be used by asm listview. events: changed: triggered when an item is selected resolvingStep: when CodeManager resolves code/selected instruction of a new step | function CodeManager(_traceManager) {
this.event = new EventManager();
this.isLoading = false;
this.traceManager = _traceManager;
this.codeResolver = new CodeResolver({
getCode: address => tslib_1.__awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
this.traceManager.web3.eth.getCode(address, (error, code) => {
if (error) {
return reject(error);
}
return resolve(code);
});
});
})
});
} | [
"enterMethodInvocation_lf_primary(ctx) {\n\t}",
"enterMethodReference_lf_primary(ctx) {\n\t}",
"onResolve(context, reflection) {\n if (reflection.kindOf(index_1.ReflectionKind.ClassOrInterface)) {\n this.postpone(reflection);\n walk(reflection.implementedTypes, (target) => {\n this.postpone(target);\n if (!target.implementedBy) {\n target.implementedBy = [];\n }\n target.implementedBy.push(new index_2.ReferenceType(reflection.name, reflection, context.project));\n });\n walk(reflection.extendedTypes, (target) => {\n this.postpone(target);\n if (!target.extendedBy) {\n target.extendedBy = [];\n }\n target.extendedBy.push(new index_2.ReferenceType(reflection.name, reflection, context.project));\n });\n }\n function walk(types, callback) {\n if (!types) {\n return;\n }\n types.forEach((type) => {\n if (!(type instanceof index_2.ReferenceType)) {\n return;\n }\n if (!type.reflection ||\n !(type.reflection instanceof index_1.DeclarationReflection)) {\n return;\n }\n callback(type.reflection);\n });\n }\n }",
"function resolve_ip_click(e)\n{\n\tvar resolver = new vB_AJAX_WolResolve(this.innerHTML, this.id);\n\tresolver.resolve();\n\treturn false;\n}",
"codeRemovedEventHandler () {\n return (event) => {\n const code = event.detail.code\n code.theme.removeCode(code)\n // Reload button container\n this.reloadButtonContainer()\n // Dispatch codebook updated event\n LanguageUtils.dispatchCustomEvent(Events.codebookUpdated, { codebook: this.codebook })\n }\n }",
"function clickCode(){\n\tvar grid = abWasteRptProByReguCodeController.abWasteRptProByReguCodeGrid;\n\tvar num = grid.selectedRowIndex;\n\tvar rows = grid.rows;\n\tvar res = '1=1';\n\tvar code = rows[num]['waste_regulated_codes.regulated_code'];\n\tvar codeType = rows[num]['waste_regulated_codes.regulated_code_type'];\n\tvar res=new Ab.view.Restriction();\n\tres.addClause('waste_profile_reg_codes.regulated_code', code);\n\tres.addClause('waste_profile_reg_codes.regulated_code_type', codeType);\n\tabWasteRptProByReguCodeController.abWasteRptProByReguCodeDetailGrid.refresh(res);\n\t\n}",
"projectChanged() {\n const oldSI = this.getSimulationInterface();\n this.checkForDepositLibrary();\n this.treeController.reloadTree();\n this.workspaceController.resetEditors();\n const newSI = this.getSimulationInterface();\n oldSI.transferCallbacks(newSI);\n }",
"_updateContractScript() {\n try {\n if (this.contract.script === '') {\n const publicKey = this.publicKey;\n this.contract.script = core.getVerificationScriptFromPublicKey(publicKey);\n log.debug(`Updated ContractScript for Account: ${this.label}`);\n }\n } catch (e) {}\n }",
"eth_compileSolidity(code) {\n return this.request(\"eth_compileSolidity\", Array.from(arguments));\n }",
"static getConceptMapTargetAsCoding(conceptMap, sourceCode) {\n var _a, _b;\n if (((_a = conceptMap.group) === null || _a === void 0 ? void 0 : _a.length) && conceptMap.group[0].element.length) {\n const conceptMapGroupElement = conceptMap.group[0].element.find(element => element.code === sourceCode);\n if ((_b = conceptMapGroupElement === null || conceptMapGroupElement === void 0 ? void 0 : conceptMapGroupElement.target) === null || _b === void 0 ? void 0 : _b.length) {\n const conceptMapGroupElementTarget = conceptMapGroupElement.target[0];\n return data_type_factory_1.DataTypeFactory.createCoding({\n code: conceptMapGroupElementTarget.code,\n display: conceptMapGroupElementTarget.display,\n system: conceptMap.group[0].target\n }).toJSON();\n }\n else\n return null;\n }\n else\n return null;\n }",
"exitMethodReference_lf_primary(ctx) {\n\t}",
"snapshotCodeDiff() { }",
"function traceDepend(selectedAssetId, drawingController) {\n drawingController.resetDrawingHighlights();\n var dataSource = View.dataSources.get('traceDepend_ds');\n dataSource.clearParameters();\n dataSource.addParameter('eqDependId', selectedAssetId);\n var records = dataSource.getRecords();\n for (var i = 0; i < records.length; i++) {\n for (var levelIndex = 1; levelIndex < 10; levelIndex++) {\n var assetFrom = records[i].getValue('eq_system.level' + levelIndex);\n var assetTo = records[i].getValue('eq_system.level' + (levelIndex + 1));\n if (valueExistsNotEmpty(assetFrom) && valueExistsNotEmpty(assetTo)) {\n trace(assetFrom, assetTo, drawingController);\n }\n }\n }\n highlightAssetOnAction('trace', selectedAssetId, true, drawingController);\n if (!showMissingTraceAssets(drawingController)) {\n drawingController.svgControl.getAddOn('InfoWindow').setText(String.format(getMessage('afterTraceDepend'), selectedAssetId));\n }\n}",
"function CodeLocationObj() {\r\n\r\n var module = \"\"\r\n var func = \"\"\r\n var step = \"\";\r\n var box = \"\";\r\n\r\n}",
"function mapCode(code) {\n const _source = code._source;\n return {\n organization: _source.organization.organization,\n origin: _source.origin,\n project_name: _source.project_name,\n language: _source.language,\n metrics: _source.metrics,\n updatedAt: _source.updated_at,\n id: code._id,\n };\n}",
"registerSourceModuleChange() {\n\t\t\tthis.sourceModuleSelect = this.container.find('select[name=\"tabid\"]');\n\t\t\tthis.sourceTabId = this.sourceModuleSelect.val();\n\t\t\tthis.sourceModuleSelect.on('change', (e) => {\n\t\t\t\tlet value = $(e.currentTarget).val();\n\t\t\t\tif (this.sourceTabId !== value && this.sourceTabId !== null) {\n\t\t\t\t\tthis.sourceTabId = value;\n\t\t\t\t\tthis.loadConditionBuilderView(this.sourceTabId);\n\t\t\t\t}\n\t\t\t});\n\t\t}",
"handleChainChanged() {\n console.log(\"Chain changed to\", this.chainId);\n }",
"eth_compileLLL(code) {\n return this.request(\"eth_compileLLL\", Array.from(arguments));\n }",
"enterMethodInvocation_lfno_primary(ctx) {\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function Build the default focal oject dropdown | function buildFocalObjectDropdown(){
for (var i=0; i < allObjects.length; i++) {
if(i == 0){
selectedItem = allObjects[i][0];
}
$("#focal-object-list").append( "<option>" + allObjects[i][0] + "</option>" );
}
} | [
"function flavour1(){\n flavourSelect=[\"flavour1\", 100];\n }",
"function buildMenu() {\n for (const item of countries) {\n let countryOption = document.createElement(\"option\");\n\n countryOption.innerHTML = item.name;\n countryOption.value = item.code;\n // Set U.S. as the default.\n if (item.code == \"US\") {\n countryOption.selected = true;\n }\n\n countryMenu.appendChild(countryOption);\n }\n}",
"function GenerateOptionsandList() {\n var optn = '';\n var li = '';\n try {\n if (MasterPlainLanguages.length > 0) {\n for (var i = 0; i < MasterPlainLanguages.length; i++) {\n optn = optn + '<option value=\"' + MasterPlainLanguages[i].PlainLanguageName + '\">' + MasterPlainLanguages[i].PlainLanguageName + '</option>';\n li = li + '<li class=\"list-group-item\"><a>' + MasterPlainLanguages[i].PlainLanguageName + '</a></li>';\n }\n } else {\n throw \"Plain Languages Not Available\";\n }\n } catch (err) {\n console.log(err);\n }\n $(\"#selectplainlang\").append(optn);\n $('.plainlanglist').append(li);\n $(\"#selectplainlang\").customselect();\n return;\n }",
"function makeDropDownList(){\n fetchInfluencers.then(response => {\n response.json().then(data => {\n var dropdownlist = document.getElementById(\"dropdownlist\");\n for (i = 0; i <= data.data.length; i++) {\n var option = document.createElement(\"option\");\n option.setAttribute(\"label\",data.data[i])\n option.setAttribute(\"value\",data.data[i])\n dropdownlist.add(option);\n }\n })\n })\n}",
"function buildSelect(heroes) {\n var select = document.createElement(\"select\");\n heroes.forEach(h => {\n select.innerHTML += \"<option value='\" + h.link + \"' data-name='\" + h.name + \"'>\" + h.name + \"</option>\";\n })\n return select;\n }",
"function initierDropDowns() {\r\n console.log(\"initierDropDowns\");\r\n // Fyll inn dropdown for våpen\r\n initierDropDown(\"vaapen\", \"#selectVaapen\");\r\n initierListView(\"vaapen\", \"#vaapenList\");\r\n\r\n}",
"function showCountriesSelect(e) {\n select.innerHTML = '';\n if (e.currentTarget.value === 'Asia') {\n asia.map((val, i) => select.innerHTML += `<option value=\"${i}\">${val.name}</option>`)\n }\n else if (e.currentTarget.value === 'Europe') {\n europe.map((val, i) => select.innerHTML += `<option value=\"${i}\">${val.name}</option>`)\n }\n else if (e.currentTarget.value === 'Africa') {\n africa.map((val, i) => select.innerHTML += `<option value=\"${i}\">${val.name}</option>`)\n }\n else if (e.currentTarget.value === 'Americas') {\n americas.map((val, i) => select.innerHTML += `<option value=\"${i}\">${val.name}</option>`)\n }\n else {\n worldCorona.map((val, i) => select.innerHTML += `<option value=\"${i}\">${val.name}</option>`)\n }\n}",
"function populate_as_dropdown(element, entries, default_text) {\n if (element) {\n var name_attr = $(element).attr(\"name\");\n var id_attr = $(element).attr(\"id\");\n var class_attr = $(element).attr(\"class\");\n var other_attr = $(element).attr(\"other\");\n my_events = $._data( $(element)[0], \"events\");\n if (entries.length > 0) {\n var new_element = $(\"<select></select>\", {\"id\": id_attr, \"class\": class_attr, \"name\": name_attr, \"other\": other_attr});\n if (my_events) {\n $.each(my_events, function (i, event) {\n $.each(event, function (j, v){\n $(new_element).on(i, v.handler); \n });\n });\n }\n $(element).replaceWith(new_element);\n $(new_element).html(\"<option value=''>\" + default_text + \"</option>\");\n for (var i = 0; i < entries.length; i++) {\n $(new_element).append(\"<option value='\" + entries[i] + \"'>\" + entries[i] + \"</option>\");\n }\n $(new_element).append(\"<option value='Other'>Other</option>\");\n if (entries.length == 1) {\n $(new_element).val(entries[0]);\n $(new_element).trigger(\"change\");\n }\n handle_other_option(new_element);\n }\n }\n}",
"function createDropdowns(){\r\n\tdenominations.forEach(mainDropdown);\r\n\tupdateAddableCurrencies();\r\n}",
"DropdownOptionsLANG() {\n let html = '';\n let sel = '';\n let fileListData = spx.getJSONFileList('./locales/');\n fileListData.files.forEach((element,i) => {\n sel = '';\n if (element.name == config.general.langfile)\n {\n sel = 'selected';\n }\n html += '<option value=\"' + element.name + '\" ' + sel + '>' + element.name.replace('.json', '') + '</option>';\n });\n return html\n }",
"function caricaSelectEnum(list, select, /* Optional */ emptyValue) {\n var i;\n var el;\n var len = list.length;\n var str = \"<option value='\" + (emptyValue || \"\") + \"'></option>\";\n for (i = 0; i < len; i++) {\n el = list[i];\n str += \"<option value='\" + el._name + \"'>\" + el.codice + \" - \" + el.descrizione + \"</option>\";\n }\n return select.append(str);\n }",
"function createDropDown() {\t\r\n\t\tif(document.getElementById('programList')){\r\n\t\t\t\tvar sel = document.getElementById('programList');\r\n\t\t\t\tfor (const [id,name] of programsIDtoNAME.entries()) {\r\n\t\t\t\t\t\tvar opt = document.createElement('option');\t\t\r\n\t\t\t\t\t\t//console.log(name);\t\r\n\t\t\t\t\t\topt.innerHTML = name;\r\n\t\t\t\t\t\t//console.log(id);\t\r\n\t\t\t\t\t\topt.value = id;\r\n\t\t\t\t\t\tsel.appendChild(opt);\r\n\t\t\t\t}\t\t\r\n\t\t\t\tprogramListCreated=1;\t\t\t\r\n\t\t}\r\n}",
"function FillVersionCombo(){\n var objVersionsCombo= document.getElementById(\"ddlWfVersions\");\n \n //Empty version combo.\n for (var i = objVersionsCombo.options.length; i >=0; i--){\n objVersionsCombo.options[i] = null; \n }\n \n\n //Fill version combo:\n //The \"HidWfVersions\" hidden field contains a string with all workflows (idWfClass, idWorkflow, wfVersion) separated by the '|' char.\n //Include in combo only those wfs which have idWfClass equal to current WFClass combo selection\n var curIdWfClass= document.getElementById(\"ddlWorkflows\").value; //WFClass combo\n var sAllWorkflows = document.getElementById(\"HidWfVersions\").value; \n \n var arrWorkflows= sAllWorkflows.split(\"|\");\n for(var i= 0; i<arrWorkflows.length; ++i){\n var arrOneWorkflow = arrWorkflows[i].split(\",\");\n var idWfClass = arrOneWorkflow[0];\n var idWorkflow = arrOneWorkflow[1];\n var wfVersion = arrOneWorkflow[2];\n \n if(idWfClass == curIdWfClass){ \n objVersionsCombo.options[objVersionsCombo.options.length] = new Option(wfVersion, idWorkflow); \n }\n }\n ApplySelectmenuPlugin();\n}",
"function makeSelectField() {\n\t\tvar formTag = document.getElementsByTagName(\"form\"), //formTag is an array of all the form tags\n\t\t\tselectDiv = $(\"selectDiv\"),\n\t\t\tmakeSelect = document.createElement(\"select\");\n\t\t\tmakeSelect.setAttribute(\"id\", \"dropdownSelect\");\n\t\tfor(var i=0, j=pebbleGroups.length; i<j; i++){\n\t\t\tvar makeOption = document.createElement(\"option\");\n\t\t\tvar optText = pebbleGroups[i];\n\t\t\tmakeOption.setAttribute(\"value\", optText);\n\t\t\tmakeOption.innerHTML = optText;\n\t\t\tmakeSelect.appendChild(makeOption);\n\t\t}\n\t\tdocument.getElementById(\"selectDiv\").appendChild(makeSelect);\n\t}",
"function oField_mInitializeDropDownList(p_id, p_list, p_filter, p_placeholder) {\n if (typeof p_filter === 'undefined') p_filter = \"\";\n if (typeof p_placeholder === 'undefined') p_placeholder = \"Select...\";\n var h_data = [];\n if (p_list !== \"\") {\n h_data = oLists_mGetList(p_list);\n }\n $(\"#\" + p_id).kendoDropDownList({\n optionLabel: g_oTranslator.get(p_placeholder),\n dataTextField: \"text\",\n dataValueField: \"value\",\n dataSource: h_data,\n filter: p_filter,\n autoBind: true,\n index: 0,\n height: 350,\n noDataTemplate: g_oTranslator.get(\"No data found.\"),\n cascade: function (e) {\n var data = [{ id: e.sender.element[0].id, value: e.sender.element[0].value, type: 'select', action: 'change' }];\n $(document).trigger('mP_mOnChangeField', data);\n },\n select: function (e) {\n var data = [{ id: e.sender.element[0].id, value: e.sender.element[0].value, type: 'select', action: 'select' }];\n $(document).trigger('mP_mOnChangeField', data);\n },\n popup: {\n appendTo: \"#mainForm\"\n }\n });\n if (p_list === \"CNT\") {\n if (localStorage.scs_language === \"en\") $(\"#\" + p_id).data('kendoDropDownList').value(\"GB\");\n else if (localStorage.scs_language === \"de\") $(\"#\" + p_id).data('kendoDropDownList').value(\"DE\");\n else if (localStorage.scs_language === \"fr\") $(\"#\" + p_id).data('kendoDropDownList').value(\"FR\");\n else $(\"#\" + p_id).data('kendoDropDownList').value(\"NL\");\n }\n if (p_list === \"LNG\") {\n $(\"#\" + p_id).data('kendoDropDownList').value(localStorage.scs_language);\n }\n}",
"function woHTML(wo, refID){\n\tif(refID === 'co_dropdown') return '<option><span class=\"contractorOption\"> ' + wo.contractor + '</span></option>';\n\treturn '<option>'+\n // '<span class=\"woOption\"> '+\n wo.work_order +\n // '</span>' +\n // ' || ' +\n // '<span class=\"contractorOption\"> ' + wo.contractor + '</span>'+\n '</option>';\n }",
"function initAdminAgencyDropdown() {\n\t\n\tvar dropdown = document.getElementById(\"agencyDropdown\");\n\t//if the dropdown box exists\n\tif(dropdown) {\n\t\t//clear the dropdown box\n\t\tdropdown.options.length = 0;\n\n\t\t//add every agency to the dropdown box\n\t\tvar i;\n\t\tfor(i in agencies) {\n\t\t\tvar agency = agencies[i];\n\t\t\tdropdown.add(new Option(agency.name), null);\n\t\t}\n\t}\n}",
"function populateDropDown(allKeyWords) {\n const $dropdown = $('#filter');\n $dropdown.empty();\n $dropdown.append($('<option>', {value: 'default', text: 'Filter by Keyword'}));\n allKeyWords.forEach(keyword => {\n $dropdown.append($('<option>', { value: keyword, text: keyword }));\n });\n}",
"function initAdminProgramDropdown() {\n\tvar dropdown = document.getElementById(\"programDropdown\");\n\t//if the dropdown box exists\n\tif(dropdown) {\n\t\t//clear the dropdown box\n\t\tdropdown.options.length = 0;\n\t\t\n\t\t//add every program to the dropdown box\n\t\tvar i;\n\t\tfor(i in programs) {\n\t\t\tvar program = programs[i];\n\t\t\tdropdown.add(new Option(program.name), null);\n\t\t}\n\t}\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::S3::Bucket.ReplicationRuleFilter` resource | function cfnBucketReplicationRuleFilterPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnBucket_ReplicationRuleFilterPropertyValidator(properties).assertSuccess();
return {
And: cfnBucketReplicationRuleAndOperatorPropertyToCloudFormation(properties.and),
Prefix: cdk.stringToCloudFormation(properties.prefix),
TagFilter: cfnBucketTagFilterPropertyToCloudFormation(properties.tagFilter),
};
} | [
"function CfnBucket_ReplicationRuleFilterPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('and', CfnBucket_ReplicationRuleAndOperatorPropertyValidator)(properties.and));\n errors.collect(cdk.propertyValidator('prefix', cdk.validateString)(properties.prefix));\n errors.collect(cdk.propertyValidator('tagFilter', CfnBucket_TagFilterPropertyValidator)(properties.tagFilter));\n return errors.wrap('supplied properties not correct for \"ReplicationRuleFilterProperty\"');\n}",
"function cfnBucketReplicaModificationsPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnBucket_ReplicaModificationsPropertyValidator(properties).assertSuccess();\n return {\n Status: cdk.stringToCloudFormation(properties.status),\n };\n}",
"function CfnBucket_ReplicationRulePropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('deleteMarkerReplication', CfnBucket_DeleteMarkerReplicationPropertyValidator)(properties.deleteMarkerReplication));\n errors.collect(cdk.propertyValidator('destination', cdk.requiredValidator)(properties.destination));\n errors.collect(cdk.propertyValidator('destination', CfnBucket_ReplicationDestinationPropertyValidator)(properties.destination));\n errors.collect(cdk.propertyValidator('filter', CfnBucket_ReplicationRuleFilterPropertyValidator)(properties.filter));\n errors.collect(cdk.propertyValidator('id', cdk.validateString)(properties.id));\n errors.collect(cdk.propertyValidator('prefix', cdk.validateString)(properties.prefix));\n errors.collect(cdk.propertyValidator('priority', cdk.validateNumber)(properties.priority));\n errors.collect(cdk.propertyValidator('sourceSelectionCriteria', CfnBucket_SourceSelectionCriteriaPropertyValidator)(properties.sourceSelectionCriteria));\n errors.collect(cdk.propertyValidator('status', cdk.requiredValidator)(properties.status));\n errors.collect(cdk.propertyValidator('status', cdk.validateString)(properties.status));\n return errors.wrap('supplied properties not correct for \"ReplicationRuleProperty\"');\n}",
"function cfnBucketRulePropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnBucket_RulePropertyValidator(properties).assertSuccess();\n return {\n AbortIncompleteMultipartUpload: cfnBucketAbortIncompleteMultipartUploadPropertyToCloudFormation(properties.abortIncompleteMultipartUpload),\n ExpirationDate: cdk.dateToCloudFormation(properties.expirationDate),\n ExpirationInDays: cdk.numberToCloudFormation(properties.expirationInDays),\n ExpiredObjectDeleteMarker: cdk.booleanToCloudFormation(properties.expiredObjectDeleteMarker),\n Id: cdk.stringToCloudFormation(properties.id),\n NoncurrentVersionExpiration: cfnBucketNoncurrentVersionExpirationPropertyToCloudFormation(properties.noncurrentVersionExpiration),\n NoncurrentVersionExpirationInDays: cdk.numberToCloudFormation(properties.noncurrentVersionExpirationInDays),\n NoncurrentVersionTransition: cfnBucketNoncurrentVersionTransitionPropertyToCloudFormation(properties.noncurrentVersionTransition),\n NoncurrentVersionTransitions: cdk.listMapper(cfnBucketNoncurrentVersionTransitionPropertyToCloudFormation)(properties.noncurrentVersionTransitions),\n ObjectSizeGreaterThan: cdk.numberToCloudFormation(properties.objectSizeGreaterThan),\n ObjectSizeLessThan: cdk.numberToCloudFormation(properties.objectSizeLessThan),\n Prefix: cdk.stringToCloudFormation(properties.prefix),\n Status: cdk.stringToCloudFormation(properties.status),\n TagFilters: cdk.listMapper(cfnBucketTagFilterPropertyToCloudFormation)(properties.tagFilters),\n Transition: cfnBucketTransitionPropertyToCloudFormation(properties.transition),\n Transitions: cdk.listMapper(cfnBucketTransitionPropertyToCloudFormation)(properties.transitions),\n };\n}",
"function CfnBucket_ReplicationRuleAndOperatorPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('prefix', cdk.validateString)(properties.prefix));\n errors.collect(cdk.propertyValidator('tagFilters', cdk.listValidator(CfnBucket_TagFilterPropertyValidator))(properties.tagFilters));\n return errors.wrap('supplied properties not correct for \"ReplicationRuleAndOperatorProperty\"');\n}",
"function cfnStorageLensCloudWatchMetricsPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnStorageLens_CloudWatchMetricsPropertyValidator(properties).assertSuccess();\n return {\n IsEnabled: cdk.booleanToCloudFormation(properties.isEnabled),\n };\n}",
"function cfnVirtualGatewayLoggingFormatPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualGateway_LoggingFormatPropertyValidator(properties).assertSuccess();\n return {\n Json: cdk.listMapper(cfnVirtualGatewayJsonFormatRefPropertyToCloudFormation)(properties.json),\n Text: cdk.stringToCloudFormation(properties.text),\n };\n}",
"function cfnStorageLensDetailedStatusCodesMetricsPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnStorageLens_DetailedStatusCodesMetricsPropertyValidator(properties).assertSuccess();\n return {\n IsEnabled: cdk.booleanToCloudFormation(properties.isEnabled),\n };\n}",
"function cfnVirtualNodeFileAccessLogPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualNode_FileAccessLogPropertyValidator(properties).assertSuccess();\n return {\n Format: cfnVirtualNodeLoggingFormatPropertyToCloudFormation(properties.format),\n Path: cdk.stringToCloudFormation(properties.path),\n };\n}",
"function CfnBucket_S3KeyFilterPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('rules', cdk.requiredValidator)(properties.rules));\n errors.collect(cdk.propertyValidator('rules', cdk.listValidator(CfnBucket_FilterRulePropertyValidator))(properties.rules));\n return errors.wrap('supplied properties not correct for \"S3KeyFilterProperty\"');\n}",
"function cfnVirtualGatewayVirtualGatewayFileAccessLogPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualGateway_VirtualGatewayFileAccessLogPropertyValidator(properties).assertSuccess();\n return {\n Format: cfnVirtualGatewayLoggingFormatPropertyToCloudFormation(properties.format),\n Path: cdk.stringToCloudFormation(properties.path),\n };\n}",
"function cfnStorageLensS3BucketDestinationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnStorageLens_S3BucketDestinationPropertyValidator(properties).assertSuccess();\n return {\n AccountId: cdk.stringToCloudFormation(properties.accountId),\n Arn: cdk.stringToCloudFormation(properties.arn),\n Encryption: cfnStorageLensEncryptionPropertyToCloudFormation(properties.encryption),\n Format: cdk.stringToCloudFormation(properties.format),\n OutputSchemaVersion: cdk.stringToCloudFormation(properties.outputSchemaVersion),\n Prefix: cdk.stringToCloudFormation(properties.prefix),\n };\n}",
"function cfnVirtualGatewayVirtualGatewayLoggingPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualGateway_VirtualGatewayLoggingPropertyValidator(properties).assertSuccess();\n return {\n AccessLog: cfnVirtualGatewayVirtualGatewayAccessLogPropertyToCloudFormation(properties.accessLog),\n };\n}",
"function cfnVirtualNodeLoggingPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualNode_LoggingPropertyValidator(properties).assertSuccess();\n return {\n AccessLog: cfnVirtualNodeAccessLogPropertyToCloudFormation(properties.accessLog),\n };\n}",
"function cfnVirtualGatewayVirtualGatewayAccessLogPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualGateway_VirtualGatewayAccessLogPropertyValidator(properties).assertSuccess();\n return {\n File: cfnVirtualGatewayVirtualGatewayFileAccessLogPropertyToCloudFormation(properties.file),\n };\n}",
"function CfnBucket_NotificationFilterPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('s3Key', cdk.requiredValidator)(properties.s3Key));\n errors.collect(cdk.propertyValidator('s3Key', CfnBucket_S3KeyFilterPropertyValidator)(properties.s3Key));\n return errors.wrap('supplied properties not correct for \"NotificationFilterProperty\"');\n}",
"function cfnVirtualNodeAccessLogPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualNode_AccessLogPropertyValidator(properties).assertSuccess();\n return {\n File: cfnVirtualNodeFileAccessLogPropertyToCloudFormation(properties.file),\n };\n}",
"function cfnStorageLensStorageLensConfigurationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnStorageLens_StorageLensConfigurationPropertyValidator(properties).assertSuccess();\n return {\n AccountLevel: cfnStorageLensAccountLevelPropertyToCloudFormation(properties.accountLevel),\n AwsOrg: cfnStorageLensAwsOrgPropertyToCloudFormation(properties.awsOrg),\n DataExport: cfnStorageLensDataExportPropertyToCloudFormation(properties.dataExport),\n Exclude: cfnStorageLensBucketsAndRegionsPropertyToCloudFormation(properties.exclude),\n Id: cdk.stringToCloudFormation(properties.id),\n Include: cfnStorageLensBucketsAndRegionsPropertyToCloudFormation(properties.include),\n IsEnabled: cdk.booleanToCloudFormation(properties.isEnabled),\n StorageLensArn: cdk.stringToCloudFormation(properties.storageLensArn),\n };\n}",
"function cfnBucketServerSideEncryptionRulePropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnBucket_ServerSideEncryptionRulePropertyValidator(properties).assertSuccess();\n return {\n BucketKeyEnabled: cdk.booleanToCloudFormation(properties.bucketKeyEnabled),\n ServerSideEncryptionByDefault: cfnBucketServerSideEncryptionByDefaultPropertyToCloudFormation(properties.serverSideEncryptionByDefault),\n };\n}",
"function cfnStorageLensBucketsAndRegionsPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnStorageLens_BucketsAndRegionsPropertyValidator(properties).assertSuccess();\n return {\n Buckets: cdk.listMapper(cdk.stringToCloudFormation)(properties.buckets),\n Regions: cdk.listMapper(cdk.stringToCloudFormation)(properties.regions),\n };\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Defers removal of modal until animation completes.; removeInputBlocker is for the case when you wish to show one modal, dismiss/remove it, and show another immediately. We wouldn't want the input blocker to be removed then; just stay as is. | removeFromSuperview(removeInputBlocker = true) {
this.userInteractionEnabled = false;
if (removeInputBlocker) {
this.removeInputBlocker();
}
this.addAnimation(new PopOut(this))
.once('complete', () => {
super.removeFromSuperview();
});
} | [
"function hideDialogueUI() {\n\n\t\tif ( isInAnim ) return\n\n\t\tisInAnim = true ;\n\n\t\t// Hide joystick div\n\n\t\tdocument.getElementById('joystick-container').style.display = 'inherit' ;\n\t\tif ( input.params.isTouchScreen ) {\n\t\t\tdocument.getElementById('action-button').style.display = 'inherit' ;\n\t\t};\n\n\t\t// Dialogue UI animations\n\n\t\tdomChar.classList.remove( 'show-char' );\n\t\tdomChar.classList.add( 'hide-char' );\n\n\t\t// Hide the talk container after hiding the characters\n\t\tsetTimeout( ()=> {\n\n\t\t\tdomOverlay.style.display = 'none' ;\n\n\t\t\tdomTalkContainer.classList.remove( 'show-talk' );\n\t\t\tdomTalkContainer.classList.add( 'hide-talk' );\n\n\t\t\tdomCharName.classList.remove( 'show-talker-name' );\n\t\t\tdomCharName.classList.add( 'hide-talker-name' );\n\n\t\t\tisInAnim = false ;\n\n\t\t}, 300);\n\n\t}",
"async hide(isClosing = true) {\n const $obj = this.$();\n if (this.get('isTransitioning')) return;\n this.set('isClosing', isClosing);\n\n const promise = new Promise((resolve) => {\n $obj.on('hidden.bs.modal', () => {\n resolve();\n });\n });\n this.$().modal('hide');\n return promise;\n }",
"function cancelTrimming() {\n modal = document.querySelector('#trim-modal')\n modal.style.display = 'none'\n\n modal.parentNode.replaceChild(modal.cloneNode(true), modal)\n window.currentlyTrimming = undefined\n trimDoneBtn = document.querySelector('#trim-modal-done')\n trimDoneBtn.addEventListener('click', doneTrimming)\n}",
"function hideModalDialogs() {\n self.$createModalWindow.hide();\n self.$editModalWindow.hide();\n $.each([self.$createModalWindow.find(\"input\"), self.$editModalWindow.find(\"input\")],\n function(index, item) {\n $.each(item,\n function(index, input) {\n $(input).removeClass(\"error\");\n });\n });\n self.createModel.Age(\"\");\n self.createModel.Name(\"\");\n self.createModel.Position(\"\");\n self.createModel.StartDate(\"\");\n }",
"slideUp() {\n this.modalOnUI.style.removeProperty(\"top\");\n this.modalOnUI.style.removeProperty(\"opacity\");\n this.modalOnUI.style.setProperty(\"top\", \"0%\");\n this.modalOnUI.style.setProperty(\"opacity\", \"0\");\n }",
"function hideStrokeAnim() {\n zdStrokeAnim.kill();\n $(\"#soaBox\").css(\"display\", \"none\");\n zdPage.modalHidden();\n }",
"hideAcceptGameModal() {\n // Hide modal\n this.setState({ showAcceptModal: false })\n }",
"function waitForWithholdMsgInjectorModal() {\n\tif ($('#'+modalID+'_response .markItUpEditor').length > 0) {\n\t\tconsole.log(\"GBAT: Form for \" + modalID + \" is ready, continuing...\");\n\t\thookWithholdMsgInjectorUI();\n\t\tn = 0;\n\t} else {\n\t\tif (n < 50) {\n\t\t\tsetTimeout(waitForWithholdMsgInjectorModal, 100);\n\t\t\tn++;\n\t\t} else {\n\t\t\tconsole.warn(\"GBAT: Form for \" + modalID + \" failed after waiting 5 seconds, aborting...\");\n\t\t\tn = 0;\n\t\t}\n\t}\n}",
"function submitForm() {\n modal.style.display = \"none\";\n}",
"function hideResultModal() {\n\tvar modal = $('#popup-window');\n modal.css('display', 'none');\n}",
"hide() {\n\t\tlet _ = this\n\n\t\t_.timepicker.overlay.classList.add('animate')\n\t\t_.timepicker.wrapper.classList.add('animate')\n\t\tsetTimeout(function () {\n\t\t\t_._switchView('hours')\n\t\t\t_.timepicker.overlay.classList.add('hidden')\n\t\t\t_.timepicker.overlay.classList.remove('animate')\n\t\t\t_.timepicker.wrapper.classList.remove('animate')\n\n\t\t\tdocument.body.removeAttribute('mdtimepicker-display')\n\n\t\t\t_.visible = false\n\t\t\t_.input.focus()\n\n\t\t\tif (_.config.events && _.config.events.hidden)\n\t\t\t\t_.config.events.hidden.call(_)\n\t\t}, 300)\n\t}",
"function removeCodeblock() {\r\n\r\n // Disable the codeblock buttons so they can't be hit multiple times.\r\n changeCodeblockButtons(false);\r\n jQuery('#codeblock_remove').button('option', 'label', 'Removing...');\r\n\r\n // Request the server removes the codeblock. This will also remove any\r\n // timeslots that use this codeblock.\r\n jQuery.post(ajaxurl, {\r\n action : 'tw-ajax-codeblock-remove',\r\n block_id : current_block_id\r\n }, function(response) {\r\n\r\n // Re-enable the codeblock buttons upon response\r\n changeCodeblockButtons(true);\r\n jQuery('#codeblock_remove').button('option', 'label', 'Remove');\r\n\r\n // Only update the array if the request was successful.\r\n if (response.removed) {\r\n // Remove the entry from the codeblock array\r\n delete codeblocks[response.block_id];\r\n\r\n // Select the tab that comes before this one in the sequence (this\r\n // will cause the form to be updated with information from a new\r\n // codeblock)\r\n jQuery('#codeblock_tabs').tabs(\"select\",\r\n \"#codeblock_tab_\" + response.prev_id);\r\n\r\n // Remove the current tab as well.\r\n jQuery('#codeblock_tabs').tabs(\"remove\",\r\n \"#codeblock_tab_\" + response.block_id);\r\n\r\n current_block_id = response.prev_id;\r\n\r\n // Refresh the calendar, in case any timeslots have\r\n // been removed.\r\n jQuery('#calendar').weekCalendar('refresh');\r\n }\r\n });\r\n}",
"function display_form(){\r\n $('#staticBackdrop').modal('show');\r\n}",
"resizeBotIfUserInputHidden() {\n this.characterContainer.classList.add(\"hide\");\n if (this.botIntegrationContainer.classList.contains('container-show')) {\n window.character.resize(450, 685);\n }\n else {\n window.character.resize(200, 355);\n }\n setTimeout(() => {\n this.characterContainer.classList.remove(\"hide\");\n }, 400);\n }",
"function hidePlayer() {\r\n setBlockVis(\"annotations\", \"none\");\r\n setBlockVis(\"btnAnnotate\", \"none\");\r\n if (hideSegmentControls == true) { setBlockVis(\"segmentation\", \"none\"); }\r\n setBlockVis(\"player\", \"none\");\r\n}",
"function removeAnim() {\n let removeStartAnim = (document.getElementById(\n \"slideAnimStart\"\n ).style.display = \"none\");\n content.style.visibility = \"hidden\";\n\n // display second layer of animation ONLY if the first layer has been removed\n if (removeStartAnim) {\n animEnd.style.display = \"block\";\n }\n}",
"unregister() {\n this.customModal = undefined;\n }",
"showModal(user) {\n this.modalContainer.style.display = \"inherit\";\n this.updateModalInfo(user);\n }",
"hideVisit() {\n\t\tthis.modalContainer.classList.remove(\"visible\");\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to hide a dialog with product substitutes | function hide_product_substitutes()
{
//Hide the substitute modal
$("#product_view2").html("");
$('.overlay').hide();
$('#product_picker2').hide();
} | [
"function hide_add_product()\n{\n\t//hide the modal box \n\t$('.overlay').hide(); \n\t$('#product_picker').hide(); \n\tonBackKeyDown();\t\n\t//Redraw the screen \n\tredraw_order_list();\n}",
"function hideCreateDialog() {\n if (document.getElementById('editID').value != '-1') {\n $('#rfelement' + document.getElementById('editID').value).show();\n document.getElementById('editID').value = '-1';\n }\n $('#textarea_preview').hide();\n $('#singlechoice_preview').hide();\n $('#multiplechoice_preview').hide();\n $('#matrix_preview').hide();\n $('#grading_preview').hide();\n $('#tendency_preview').hide();\n $('#newquestion').hide();\n $('#text_preview').show();\n //$('#newquestion_button').show();\n}",
"function hide_global_supplier_settings()\n{\n\t//Empty the html \n\t$(\"#sup_list_view_global\").html(\"\");\n\t//Hide the modal box \n\t$('.overlay').hide(); \n\t$('#setng_supplier_global').hide();\n\t//Nothing else to be done \n}",
"function hideLayoutDialog() {\n if (document.getElementById('editID').value != '-1') {\n $('#rfelement' + document.getElementById('editID').value).show();\n document.getElementById('editID').value = '-1';\n }\n $('#newlayout').hide();\n //$('#newquestion_button').show();\n}",
"function closeProduct () {\n self.prodSelected = false;\n }",
"function show_product_substitutes(product_id)\n{\n\tvar substitute_html = \"\";\n\t//For each product go throuhg and create the HTML\n\t$.each(products_list, function(product_id, product_details)\n\t{\n\t\tvar img_str = product_details.product_data.image;\n\t\tvar productlabel = product_details.product_data.title;\n\t\tvar checked = \"\";\n\t\tvar padding = \"000000\" ;\n\t\tvar padded_product_id = \"DBAP\" + padding.substring(0, 6 - product_id.length) + product_id;\n\t\tvar productdescription = product_details.product_data.description;\n\t\tif (product_id in order_list[product_id].substitutes) checked = \" checked \";\n\t\t//Add the HTML of this product \n\t\tsubstitute_html = substitute_html + \"<div class='pp-product'><div class='pp-product-selector'><input id='\"+product_id+\"' type='checkbox' \"+checked+\" /></div><div class='pp-product-image'><img class='pp-productimage' src='\"+img_str\n\t\t\t\t\t+\"'/></div><div class='pp-product-description'><div class='pp-product-label'>\"\n\t\t\t\t\t+productlabel+\"</div><div class='pp-product-description'>Product ID-\"\n\t\t\t\t\t+padded_product_id+\" - \"+productdescription+\"</div></div></div>\";\n\t\t//Select only those products which are in the substitutes list of the product in order list \n\t});\n\t//copy html into the modal\n\t$(\"#product_view2\").html(kpr);\n\t//Show the modal box \n\t$('.overlay').fadeIn(100); \n\t$('#product_picker2').fadeIn(100);\n}",
"function hidePaymentNotSelectedModal() {\n return { type: types.PAYMENT_SELECTED };\n}",
"function closeProductDetail() {\n const productDetailDiv = document.querySelector('#product-detail');\n productDetailDiv.innerHTML = '';\n productDetailDiv.style.display = \"none\";\n}",
"function CloseCatalogue() {\n\t//Hide the purchaseDone_button, show the Work and Catalogue buttons\n\tdocument.getElementById(\"work_button\").style.display = \"inline\";\n\tdocument.getElementById(\"purchase_button\").style.display = \"inline\";\n\tdocument.getElementById(\"purchaseDone_button\").style.display = \"none\";\n\t\n\t//If items have been bought, display them\t\n\tShowItems();\n\t\n\t//Hide the catalogue area\n\tdocument.getElementById(\"catalogue_data\").style.display = \"none\";\n\tdocument.getElementById(\"catalogue_background\").style.display = \"none\";\n\t\n\t//Clear the gametext box\n\tdocument.getElementById(\"gametext\").innerHTML=\"\";\n\t\n\t//Update Game Variable Displays\n\tDisplayVariables();\n\t\n\t//Updates family status in \"gametext\" div\n\tfamilyStatus();\n}",
"function dismissPrompt() {\n $('#powerPrompt').hide();\n $('#faded').hide();\n}",
"function hide_supplier_selector(product_id)\n{\n\t$(\"#supplier_selector_dropdown_\"+product_id).hide();\n}",
"function hideResultModal() {\n\tvar modal = $('#popup-window');\n modal.css('display', 'none');\n}",
"function hidePopup () {\r\n editor.popups.hide('customPlugin.popup');\r\n }",
"function hidePaymentOptions() {\n // loop through paymentOptions object and set display to none\n for (prop in paymentOptions)\n toggleView(paymentOptions[prop], false);\n }",
"function funcionProductoBotones(nombreSustancia){\n\t\t$('#'+nombreSustancia+'boton').show();\n\t\t$('#'+nombreSustancia+'boton2').hide();\n\t\t$('#listaProductos'+nombreSustancia).remove();\n\t}",
"function confirmerSuppression() {\n let n = new Noty({\n text: 'Confirmer la demande de suppression ',\n layout: 'center', theme: 'sunset', modal: true, type: 'info',\n animation: {\n open: 'animated lightSpeedIn',\n close: 'animated lightSpeedOut'\n },\n buttons: [\n Noty.button('Oui', 'btn btn-sm btn-success marge ', function () {\n supprimer();\n n.close();\n }),\n Noty.button('Non', 'btn btn-sm btn-danger', function () { n.close(); })\n ]\n }).show();\n}",
"function showNoProductsScreen() {\n\t$(\"section.jsContainer #js-table\").css(\"display\", \"none\");\n\t$(\"section.jsContainer #extractResults\").css(\"display\", \"none\");\n\t$(\"section.jsContainer .export-section\").css(\"display\", \"none\");\n\t$(\"section.jsContainer #filterPopup\").css(\"display\", \"none\");\n\t$(\"section.jsContainer #optionsPage\").css(\"display\", \"none\");\n\t$(\"section.jsContainer .main-screen\").css(\"display\", \"block\");\n}",
"function _hidePopup(event) {\n if ($reverseNameResolver.css('display') != 'none') {\n $reverseNameResolver.fadeOut(300);\n }\n }",
"function hideViz() {\n viz.hide();\n}",
"function hide_global_supplier_settings()\n{\n\t//Empty the html \n\t$(\"#sup_list_view_global\").html(\"\");\n\t\n\t//Hide the modal box \n\t$('.overlay').hide(); \n\t$('#setng_supplier_global').hide();\n\t\n\t//update back array\n\tonBackKeyDown();\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detaches the component instance from its [`IdentityMap`]( | detach() {
if (this.hasPrimaryIdentifierAttribute()) {
const identityMap = this.constructor.getIdentityMap();
identityMap.removeComponent(this);
}
Object.defineProperty(this, '__isAttached', { value: false, configurable: true });
return this;
} | [
"detach() {\n const parentNode = this._container.parentNode;\n\n if (parentNode) {\n parentNode.removeChild(this._container);\n\n this._eventBus.fire('propertiesPanel.detach');\n }\n }",
"detach() {\n this.surface = null;\n this.dom = null;\n }",
"destroy() {\n this.map.off('dragging', this.listenDragging, this);\n this.map.off('dragend', this.listenDragEnd, this);\n this.customLayer.setMap(null);\n }",
"function eraseMap() {\n document.body.removeChild(map);\n }",
"componentWillUnmount() {\n if (!this.diagramRef.current) return;\n const diagram = this.diagramRef.current.getDiagram();\n if (diagram) {\n diagram.removeDiagramListener('ChangedSelection', this.props.onDiagramEvent);\n diagram.removeDiagramListener('ObjectDoubleClicked', this.props.onDiagramDoubleClicked);\n }\n }",
"destroy()\n {\n //first remove it from the scene.\n this.#scene.remove(this);\n //then destroy all components.\n while(this.#components.length > 0)\n {\n let currentComponent = this.#components.pop();\n currentComponent.destroy();\n }\n }",
"componentWillUnmount() {\n const { form } = this.props\n if (form) delete form.fields[this.id]\n }",
"componentWillUnmount(){\n this.props.getProviderErase();\n }",
"function removeOverlay() {\n imgOverlay.setMap(null);\n}",
"actorDeleted(actor) {\n let id = actor._id;\n let marker = ActorMarkers[id];\n // remove marker layer from map\n actorMarkers.removeLayer(marker);\n console.log(`delete marker for ${marker.options.id}`)\n\n // remove from hashtable\n delete ActorMarkers[id];\n }",
"removeComponent(){\n if (!this.state.components.length)\n return;\n const components = this.state.components;\n components.pop();\n this.setState({component: components});\n\n }",
"beforeUnmount() {\n this.observer.disconnect(), this.flatpickrInstance && this.flatpickrInstance.destroy();\n }",
"componentWillUnmount() {\n this.observer.disconnect();\n }",
"function deactivate() {\n global.hadronApp.appRegistry.deregisterRole('Collection.Tab', ROLE);\n global.hadronApp.appRegistry.deregisterAction('LatencyHistogram.Actions');\n global.hadronApp.appRegistry.deregisterStore('LatencyHistogram.Store');\n}",
"disposeSingle_() {\n olEvents.unlisten(this.layer, EventType.PROPERTYCHANGE, this.onLayerPropertyChange_, this);\n\n if (this.activeLayer_) {\n // clean up listeners\n events.unlistenEach(this.layer, STYLE_KEYS, this.onStyleChange_, this);\n events.unlistenEach(this.layer, RESOLUTION_KEYS, this.onZoomChange_,\n this);\n olEvents.unlisten(this.layer, 'change:extent', this.synchronize, this);\n olEvents.unlisten(this.layer, 'change', this.onChange_, this);\n\n if (this.activeLayer_.imageryProvider instanceof ImageryProvider) {\n this.activeLayer_.imageryProvider.dispose();\n }\n\n // remove layer from the scene and destroy it\n this.cesiumLayers_.remove(this.activeLayer_, true);\n this.activeLayer_ = null;\n\n Dispatcher.getInstance().dispatchEvent(MapEvent.GL_REPAINT);\n }\n }",
"function detachVertexHelper()\n{\n\t//if (INTERSECTED.name.category == 'stuff' && readOnly != 1) {\n\t\tfor (var i=0; i<vertexHelpers.length; i++){\n\t\t\tscene.remove(vertexHelpers[i]);\n\t\t}\n\t\tvertexHelpers = [];\n\t\tclickedVertex = null;\n\t//}\n}",
"unregister() {\n this.customModal = undefined;\n }",
"function removeAddress(){\n\tif(activeCounter >0){\n activeCounter--;\n\t\tif(markers[counter] != null){\n\t\t\tmarkers[counter].setMap(null);\n\t\t\tmarkers[counter] = null;\n if(activeCounter ==0){\n //if no active markers anymore, reinitialize the map\n initialize();\n }else{\n //otherwise, reset the bounds to fit previous list of properties\n setBounds();\n }\n\t\t}\n\t}\n\tdecrement();\n}",
"deactivate() {\n // Deactivate prompt.\n this.prompt.deactivate();\n this.prompt = null;\n\n // Deactivate display.\n this.display.deactivate();\n this.display = null;\n\n // Free up DOM element.\n this._app = null;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
| | Remove item in an array. | | | var a = [a,b,c,d,e] | removeArray(a, index) | function removeArray(array, index)
{
array.splice(index,1)
} | [
"removeItem (array, item, f) {\n const i = this.indexOf(array, item, f)\n if (i >= 0) array.splice(i, 1)\n }",
"function arrayRemove(arr, value) { return arr.filter(function (ele) { return ele != value; }); }",
"function remove(array, element) {\n const index = array.indexOf(element);\n var item = array.splice(index, 1);\n return item;\n}",
"function deleteElement(a, e) {\n var newArray = [];\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== e) {\n newArray[newArray.length] = a[i];\n } else {\n continue;\n }\n }\n return newArray;\n}",
"function recursiveRemove(array, val, index) {\n var removed;\n var length = array.length;\n if (val === array[index]._id || index >= length) {\n return removed.length;\n }\n\n removed = array.splice(index, 1);\n index = index++;\n recursiveRemove(array, val, index);\n }",
"function removeFruits(fruits, fruitsToRemove) {\n // FILL THIS IN\n for(var i = 0; i <= fruits.length; i++){\n if(fruits[i] == fruitsToRemove){\n fruits.splice(fruitsToRemove, fruitsToRemove.length);\n }\n }\n return fruits;\n }",
"function dropElements(arr, func) {\n var startArray = arr;\n var finalArray = startArray;\n for (var i=0; i<startArray.length; i++) {\n if (!(func(arr[i]))) {\n finalArray = startArray.slice(i+1, startArray.length);\n } else {\n return finalArray;\n }\n }\n return [];\n}",
"function deleteObject(array,index){\n delete(array[index]);\n array.splice(index, 1);\n}",
"function deleteNth(arr) {\n\n return [];\n}",
"function remove_duplicates(array)\n{\n\tfor (var i = 0; i < array.length; i++)\n\t{\n\t\twhile (array.slice(i+1,array.length).indexOf(array[i]) != -1)\n\t\t{\n\t\t\tarray.splice(i,1);\n\t\t}\n\t}\n\treturn array;\n}",
"function removeVals(arr,start,end) {\n var temp=end-1;\n arr.splice(start,temp);\n return arr;\n }",
"function gemSplice(){\n // Remove array gemNum item i\n gemNum.splice(i, 1);\n // Console log updated array\n //(\"Gem Array Updated: \" +gemNum); \n }",
"function pullAtIndex(array, ...indexes) {\n window[\"__checkBudget__\"]();\n // If we've been given an array instead of an argument list, use the array\n let argState = Array.isArray(indexes[0]) ? indexes[0] : indexes;\n let removed = [];\n let pulled = array\n .map((v, i) => (argState.includes(i) ? removed.push(v) : v))\n .filter((v, i) => !argState.includes(i));\n array.length = 0;\n pulled.forEach(v => array.push(v));\n return removed;\n}",
"function remove (bookList, bookName) {\n let mutatedArr = [...bookList];\n let indexToRemove = mutatedArr.indexOf(bookName);\n\n if (indexToRemove >= 0) {\n \n mutatedArr.splice(indexToRemove, 1);\n \n // Add your code above this line\n }\n return mutatedArr; \n}",
"function addAnElementInGeneral(array, index, element) {\n array.splice(index, 0, element);\n return array;\n}",
"function removeElement(nums, val) {\r\n let index = 0\r\n for (let i = 0; i < nums.length; i++) {\r\n if (nums[i] != val) {\r\n nums[index++] = nums[i]\r\n }\r\n }\r\n return index\r\n}",
"function remove_duplicates(arr) {\n console.log(\"Duplicates removed from array\");\n}",
"function stripAllEmailsInArray (email, index, arr) {\n arr[index] = stripEmailString (email);\n}",
"function applySplice(array, index, item1, item2) {\n array.splice(index, 2, item1, item2);\n return array;\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine if we need to compute the display states of the cues. This could be the case if a cue's state has been changed since the last computation or if it has not been computed yet. | function shouldCompute(cues){for(var i=0;i<cues.length;i++){if(cues[i].hasBeenReset||!cues[i].displayState){return true;}}return false;}// We don't need to recompute the cues' display states. Just reuse them. | [
"function privateCheckSongVisualization(){\n\t\tvar changed = false;\n\n\t\t/*\n\t\t\tChecks to see if the song actually has a specific visualization\n\t\t\tdefined.\n\t\t*/\n\t\tif( config.active_metadata.visualization ){\n\t\t\t\n\t\t\t/*\n\t\t\t\tIf the visualization is different and there is an active\n\t\t\t\tvisualization. We must stop the active visualization\n\t\t\t\tbefore setting the new one.\n\t\t\t*/\n\t\t\tif( config.active_metadata.visualization != config.active_visualization && config.active_visualization != '' ){\n\t\t\t\tprivateStopVisualization();\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t\tSet the visualization changed to true\n\t\t\t\t\tso we return the status change.\n\t\t\t\t*/\n\t\t\t\tchanged = true;\n\n\t\t\t\t/*\n\t\t\t\t\tSets the active visualization to the new\n\t\t\t\t\tvisualization that the song uses.\n\t\t\t\t*/\n\t\t\t\tconfig.active_visualization = config.active_metadata.visualization;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t\tReturns the status of the new song visualization.\n\t\t\tIf there is a change it returns true and we will\n\t\t\thave to start the the visualization.\n\t\t*/\n\t\treturn changed;\n\t}",
"enCours() {\n return !this.estGagne() && !this.estPerdu();\n }",
"function display() {\n let display = state.context.session_time;\n if (state.value === 'paused') {\n if (state.historyValue) {\n state.historyValue.states.counting.current === 'break' \n ? display = state.context.break_time\n : display = state.context.session_time\n }\n }\n if (state.value.counting === 'break') {\n display = state.context.break_time\n }\n return display\n }",
"isHandComplete(lineup, dealer, state) {\n const activePlayers = activeLineup(lineup, dealer, state, this.rc);\n const allInPlayerCount = this.countAllIn(lineup);\n if (state === 'showdown') {\n if (checkForReceipt(lineup, Type.SHOW, this.rc)) {\n return (activePlayers.length === 0 && allInPlayerCount === 0);\n }\n return (activePlayers.length <= 1 && allInPlayerCount === 0);\n }\n return (\n (activePlayers.length <= 1 && allInPlayerCount === 0) ||\n (activePlayers.length === 0 && allInPlayerCount === 1)\n );\n }",
"areComponentsLoaded() {\n return this.vues.filter((component) => !component.isLoaded).length === 0;\n }",
"function hasActionChanged() {\r\n\r\n return( action !== previousAction );\r\n\r\n }",
"ifConversionRatesAvailable() {\n return !!(\n this.initialCurrencyConversionData?.rates &&\n Object.keys(this.initialCurrencyConversionData.rates).length !== 0\n );\n }",
"function isClear() {\n return display.text() === '0' || display.text() === '';\n }",
"updateTileStates() {\n const refinementStrategy = this.opts.refinementStrategy || STRATEGY_DEFAULT;\n\n const visibilities = new Array(this._cache.size);\n let i = 0;\n // Reset state\n for (const tile of this._cache.values()) {\n // save previous state\n visibilities[i++] = tile.isVisible;\n tile.isSelected = false;\n tile.isVisible = false;\n }\n for (const tile of this._selectedTiles) {\n tile.isSelected = true;\n tile.isVisible = true;\n }\n\n // Strategy-specific state logic\n (typeof refinementStrategy === 'function'\n ? refinementStrategy\n : STRATEGIES[refinementStrategy])(Array.from(this._cache.values()));\n\n i = 0;\n // Check if any visibility has changed\n for (const tile of this._cache.values()) {\n if (visibilities[i++] !== tile.isVisible) {\n return true;\n }\n }\n\n return false;\n }",
"function CCisNew(captions) {\n const currentCC = videoCC.getAttribute(\"captions-id\")\n const newCC = \"CC\" + captions.id\n return currentCC != newCC\n}",
"function checkUEC(targetBlock) {\n if (targetBlock.id.equals('mekanism:ultimate_energy_cube')) {\n if (!!targetBlock.entityData.EnergyContainers[0]) {\n if (!!targetBlock.entityData.EnergyContainers[0].stored) {\n if (targetBlock.entityData.EnergyContainers[0].stored == 4096000000) {\n return true\n }\n }\n }\n }\n return false\n }",
"function isGameAgainstComp() {\n return !!document.getElementById('computer');\n}",
"calculateHasConfidence(){\n return this.props.techniques.find(r => r.confidence !== undefined) !== undefined;\n }",
"function checkIfResult() {\n if (isFinalResult) {\n isFinalResult = false;\n displayContent = \"\";\n }\n}",
"function clockCheck() {\n\n if (clockOnly.checked === true && clockTracker === 0) {\n clockTracker = 1;\n clockOptions.checked = false;\n toolTip.checked = false;\n\n optionsPanel.style.opacity = 0;\n toolTipPanel.style.opacity = 0;\n\n }\n\n else if (clockOptions.checked === true && clockTracker === 1) {\n clockTracker = 0;\n clockOnly.checked = false;\n clockOptions.checked === true;\n\n optionsPanel.style.opacity = 1;\n\n }\n\n else if (toolTip.checked === true && clockTracker === 1) {\n clockTracker = 0;\n clockOnly.checked = false;\n toolTip.checked === true;\n\n toolTipPanel.style.opacity = 1;\n\n };\n\n}",
"function cardOnHand() {\n if (player.selectedCarte.visible) return 1;\n else if (playerHand.selectedCarte.visible) return 2;\n else if (playerBoard.selectedCarte.visible) return 3;\n else if (playerPower.selectedCarte.visible) return 4;\n else return 0;\n}",
"function isEnoughCoinsForGraf() {\n if (state.activeCoins.length === 0) {\n return false;\n }\n return true;\n }",
"function checkWinStates() {\n const xtop = /XXX....../; // x top row\n const xmid = /...XXX.../; // x middle row\n const xbot = /......XXX/; // x bottom row\n const xldg = /X...X...X/; // x left to right diagonal\n const xrdg = /..X.X.X../; // x right to left diagonal\n const xlco = /X..X..X../; // x left column\n const xmco = /.X..X..X./; // x middle column\n const xrco = /..X..X..X/; // x right column\n\n const otop = /OOO....../; // o top row\n const omid = /...OOO.../; // o middle row\n const obot = /......OOO/; // o bottom row\n const oldg = /O...O...O/; // o left to right diagonal\n const ordg = /..O.O.O../; // o right to left diagonal\n const olco = /O..O..O../; // o left column\n const omco = /.O..O..O./; // o middle column\n const orco = /..O..O..O/; // o right column\n\n const empt = /E/; // there is an empty square\n\n state = '';\n for(let i=0;i<9;i++) state += boardData[currentBoard].getSquare(i).state;\n\n switch(true) {\n case xtop.test(state):\n case xmid.test(state):\n case xbot.test(state):\n case xldg.test(state):\n case xrdg.test(state):\n case xlco.test(state):\n case xmco.test(state):\n case xrco.test(state):\n boardData[currentBoard].state = X;\n globalBoardVictorySprites[currentBoard].visible = true;\n globalBoardVictorySprites[currentBoard].setTexture(resources[\"res/VictoryX.svg\"].texture);\n break;\n case otop.test(state):\n case omid.test(state):\n case obot.test(state):\n case oldg.test(state):\n case ordg.test(state):\n case olco.test(state):\n case omco.test(state):\n case orco.test(state):\n boardData[currentBoard].state = O;\n globalBoardVictorySprites[currentBoard].visible = true;\n globalBoardVictorySprites[currentBoard].setTexture(resources[\"res/VictoryO.svg\"].texture);\n break;\n case empt.test(state):\n // NO WIN CONDITION, BOARD STILL PLAYABLE\n break;\n default:\n boardData[currentBoard].state = C;\n globalBoardVictorySprites[currentBoard].visible = true;\n globalBoardVictorySprites[currentBoard].setTexture(resources[\"res/cats.svg\"].texture);\n }\n\n \n state = '';\n for(let i=0;i<9;i++) state += boardData[i].state;\n let xOffset = globalBoardVictorySprites[0].width / 2;\n let yOffset = globalBoardVictorySprites[0].height / 2;\n let x1, x2, y1, y2;\n\n switch(true) {\n case xtop.test(state):\n x1 = globalBoardVictorySprites[0].x + xOffset;\n y1 = globalBoardVictorySprites[0].y + yOffset;\n x2 = globalBoardVictorySprites[2].x + xOffset;\n y2 = globalBoardVictorySprites[2].y + yOffset;\n drawLine(x1, y1, x2, y2, 0x007BFE);\n victory = true;\n break;\n case xmid.test(state):\n x1 = globalBoardVictorySprites[3].x + xOffset;\n y1 = globalBoardVictorySprites[3].y + yOffset;\n x2 = globalBoardVictorySprites[5].x + xOffset;\n y2 = globalBoardVictorySprites[5].y + yOffset;\n drawLine(x1, y1, x2, y2, 0x007BFE);\n victory = true;\n break;\n case xbot.test(state):\n x1 = globalBoardVictorySprites[6].x + xOffset;\n y1 = globalBoardVictorySprites[6].y + yOffset;\n x2 = globalBoardVictorySprites[8].x + xOffset;\n y2 = globalBoardVictorySprites[8].y + yOffset;\n drawLine(x1, y1, x2, y2, 0x007BFE);\n victory = true;\n break;\n case xldg.test(state):\n x1 = globalBoardVictorySprites[0].x + xOffset;\n y1 = globalBoardVictorySprites[0].y + yOffset;\n x2 = globalBoardVictorySprites[8].x + xOffset;\n y2 = globalBoardVictorySprites[8].y + yOffset;\n drawLine(x1, y1, x2, y2, 0x007BFE);\n victory = true;\n break;\n case xrdg.test(state):\n x1 = globalBoardVictorySprites[2].x + xOffset;\n y1 = globalBoardVictorySprites[2].y + yOffset;\n x2 = globalBoardVictorySprites[6].x + xOffset;\n y2 = globalBoardVictorySprites[6].y + yOffset;\n drawLine(x1, y1, x2, y2, 0x007BFE);\n victory = true;\n break;\n case xlco.test(state):\n x1 = globalBoardVictorySprites[0].x + xOffset;\n y1 = globalBoardVictorySprites[0].y + yOffset;\n x2 = globalBoardVictorySprites[6].x + xOffset;\n y2 = globalBoardVictorySprites[6].y + yOffset;\n drawLine(x1, y1, x2, y2, 0x007BFE);\n victory = true;\n break;\n case xmco.test(state):\n x1 = globalBoardVictorySprites[1].x + xOffset;\n y1 = globalBoardVictorySprites[1].y + yOffset;\n x2 = globalBoardVictorySprites[7].x + xOffset;\n y2 = globalBoardVictorySprites[7].y + yOffset;\n drawLine(x1, y1, x2, y2, 0x007BFE);\n victory = true;\n break;\n case xrco.test(state):\n x1 = globalBoardVictorySprites[2].x + xOffset;\n y1 = globalBoardVictorySprites[2].y + yOffset;\n x2 = globalBoardVictorySprites[8].x + xOffset;\n y2 = globalBoardVictorySprites[8].y + yOffset;\n drawLine(x1, y1, x2, y2, 0x007BFE);\n victory = true;\n break;\n case otop.test(state):\n x1 = globalBoardVictorySprites[0].x + xOffset;\n y1 = globalBoardVictorySprites[0].y + yOffset;\n x2 = globalBoardVictorySprites[2].x + xOffset;\n y2 = globalBoardVictorySprites[2].y + yOffset;\n drawLine(x1, y1, x2, y2, 0xFF2D55);\n victory = true;\n break;\n case omid.test(state):\n x1 = globalBoardVictorySprites[3].x + xOffset;\n y1 = globalBoardVictorySprites[3].y + yOffset;\n x2 = globalBoardVictorySprites[5].x + xOffset;\n y2 = globalBoardVictorySprites[5].y + yOffset;\n drawLine(x1, y1, x2, y2, 0xFF2D55);\n victory = true;\n break;\n case obot.test(state):\n x1 = globalBoardVictorySprites[6].x + xOffset;\n y1 = globalBoardVictorySprites[6].y + yOffset;\n x2 = globalBoardVictorySprites[8].x + xOffset;\n y2 = globalBoardVictorySprites[8].y + yOffset;\n drawLine(x1, y1, x2, y2, 0xFF2D55);\n victory = true;\n break;\n case oldg.test(state):\n x1 = globalBoardVictorySprites[0].x + xOffset;\n y1 = globalBoardVictorySprites[0].y + yOffset;\n x2 = globalBoardVictorySprites[8].x + xOffset;\n y2 = globalBoardVictorySprites[8].y + yOffset;\n drawLine(x1, y1, x2, y2, 0xFF2D55);\n victory = true;\n break;\n case ordg.test(state):\n x1 = globalBoardVictorySprites[2].x + xOffset;\n y1 = globalBoardVictorySprites[2].y + yOffset;\n x2 = globalBoardVictorySprites[6].x + xOffset;\n y2 = globalBoardVictorySprites[6].y + yOffset;\n drawLine(x1, y1, x2, y2, 0xFF2D55);\n victory = true;\n break;\n case olco.test(state):\n x1 = globalBoardVictorySprites[0].x + xOffset;\n y1 = globalBoardVictorySprites[0].y + yOffset;\n x2 = globalBoardVictorySprites[6].x + xOffset;\n y2 = globalBoardVictorySprites[6].y + yOffset;\n drawLine(x1, y1, x2, y2, 0xFF2D55);\n victory = true;\n break;\n case omco.test(state):\n x1 = globalBoardVictorySprites[1].x + xOffset;\n y1 = globalBoardVictorySprites[1].y + yOffset;\n x2 = globalBoardVictorySprites[7].x + xOffset;\n y2 = globalBoardVictorySprites[7].y + yOffset;\n drawLine(x1, y1, x2, y2, 0xFF2D55);\n victory = true;\n break;\n case orco.test(state):\n x1 = globalBoardVictorySprites[2].x + xOffset;\n y1 = globalBoardVictorySprites[2].y + yOffset;\n x2 = globalBoardVictorySprites[8].x + xOffset;\n y2 = globalBoardVictorySprites[8].y + yOffset;\n drawLine(x1, y1, x2, y2, 0xFF2D55);\n victory = true;\n break;\n case empt.test(state):\n // NO WIN CONDITION, PLAY CONTINUES\n break;\n default:\n let x = 0;\n let o = 0;\n for(let i=0;i<9;i++) {\n if(boardData[i].state == X) x++;\n if(boardData[i].state == O) o++;\n }\n\n if(o > x) {\n // O VICTORY\n } else if(x > o) {\n // X VICTORY\n } else {\n // CATS GAME\n }\n victory = true;\n }\n}",
"async __cardChanged() {\n this._currentX = this._leftX;\n try {\n await isOnScreen(this);\n this._lazyImage = this._image;\n }\n catch (error) {\n \n console.error(error);\n }\n }",
"function is_overlay_needed(){\n // never displayed => needed\n if (!localStorage.__fp_overlay_last_){\n console.log(\"overlay needed (never displayed before)\");\n return true;\n }\n\n // allotted time passed => needed\n var elapsed_msec = Date.now() - localStorage.__fp_overlay_last_;\n var interval_msec = get_time_allowed_msec();\n\n if (elapsed_msec > interval_msec){\n console.log(\"overlay needed (time elapsed)\");\n return true;\n }\n\n return false;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the contents of an entry | 'entries.get' (entryId) {
console.log('get text for entry');
// If no user is logged in, throw an error
if (!Meteor.user()) {
console.log("No user is logged in!");
throw Error("User is not logged in");
}
// Locate the entry
let entry = JournalEntryCollection.findOne({_id: entryId});
// If no entry exists, the logged in user can't access it
if (!entry) {
console.log(`entry with ID ${entryId} wasn't found`);
throw Error("Unable to find entry with given ID");
}
console.log(`Entry found: ${entry._id}, ${entry.text}`);
// If the entry's owner is not the logged in user, they
// can't access it
if (entry.ownerId != Meteor.userId()) {
console.log(`This entry belongs to ${entry.ownerId} but the logged in user is ${Meteor.userId()}`);
throw Error("Logged in user does not have permission to view this entry");
}
// The entry exists and the logged in user is the owner,
// so they can access it
return entry;
} | [
"getEntries(t, e) {\n return this.getAllFromCache(t, e);\n }",
"function readEntry(entry, done) {\n if (options.verbose) {\n console.log(\"Found \" + entry.path);\n }\n \n var ws = new MemoryStream();\n ws.on('finish', function() {\n var xml = ws.toString();\n xml2js(xml, function(error, result) {\n try {\n if (error) {\n throw error;\n }\n \n done(result);\n }\n catch (e) {\n if (options.verbose) {\n console.error(e);\n }\n var func = callback;\n callback = function(error, result) { };\n func(e);\n }\n });\n \n }); \n entry.pipe(ws);\n }",
"getEntry(t, e) {\n this.assertNotApplied();\n const n = this.changes.get(e);\n return void 0 !== n ? Ks.resolve(n.document) : this.getFromCache(t, e);\n }",
"getContentFor(id) {\n return this._content[id] || \"\";\n }",
"async function zipGetData(entry, writer, options = undefined) {\n try {\n return await entry.getData(writer, options);\n } catch (e) {\n if (e instanceof ProgressEvent && e.type === \"error\") {\n throw e.target.error;\n } else {\n throw e;\n }\n }\n}",
"parseEntries() {}",
"function entries() {\n var each = function each(callback) {\n for (var i = 0; i < this.length; i++) {\n callback(this[i]);\n }\n };\n\n var els = this.elsByTag('entry');\n els.each = each;\n return els;\n}",
"contentFor(page) {\n\t\tlet reader = this.readers[page.extension];\n\t\tlet pathToFile = this.pathToPageContent(page);\n\n\t\tlet content = '';\n\t\tif (typeof reader.readFile !== 'undefined') {\n\t\t\tcontent = reader.readFile(pathToFile);\n\t\t} else {\n\t\t\tcontent = fs.readFileSync(pathToFile, 'utf8');\n\t\t}\n\n\t\tif (!reader) {\n\t\t\tthrow new Error(`No reader for file extension '${page.extension}'`)\n\t\t} else if (typeof reader.read !== 'function') {\n\t\t\tthrow new Error(`Reader for file extension '${page.extension}' has no read method`);\n\t\t}\n\n\t\treturn reader.read(content);\n\t}",
"function getRuneInfo(id)\n {\n if (id in rune)\n return rune[id]\n else\n throw new Error (\"No rune with id \" + id)\n }",
"static get(id){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\treturn new kaltura.RequestBuilder('contentdistribution_entrydistribution', 'get', kparams);\n\t}",
"function EntryList() { }",
"function getEntryMetadata(entryId, done) {\n\tdbEntry.getEntry(entryId, function(err, entry) {\n\t\tif (err) {\n\t\t\treturn done(err);\n\t\t}\n\n\t\t//got the core challenge info, now construct the meta data\n\t\tvar metadata = {\n\t\t\tfbAppId: dynamicConfig.facebookClientId,\n\t\t\tpublisherName : config.branding.siteName,\n\t\t\timageURL : dynamicConfig.nodeHostname + config.url.entryImages + entry.id + \".\" + mime.extension(entry.imageType),\n\t\t\tpageTitle : \"Caption Entry: \" + entry.caption + \" | \" + config.branding.siteName,\n\t\t\tpageURL : dynamicConfig.nodeHostname + config.url.entry + entry.id,\n\t\t\tpageDescription : \"Posted by \" + entry.postedByUser.displayName + \". Like this entry? Check out more such entries, and challenge yourself to post one of your own! It takes just a few minutes, and it's free :)\",\n\t\t\timageType : entry.imageType,\n\t\t\tauthorName : entry.postedByUser.displayName\n\t\t};\n\n\t\tvar output = {\n\t\t\tentry: entry,\n\t\t\tmetadata: metadata\n\t\t};\n\n\t\treturn done(null, output);\n\t});\n}",
"function getContent(dir) {\n return fs.readdirSync(`${__dirname}/${dir}`).reduce((result, entry) => {\n const raw = fs.readFileSync(`${__dirname}/${dir}/${entry}`, 'utf-8').toString();\n const regex = /(?:\\r?\\n){2}/g;\n const meta = raw.split(regex)[0];\n const content = raw.split(regex).slice(1).join('\\n\\n');\n\n result[path.basename(entry, '.txt')] = {\n title: meta.match(/^TITLE:(.*)$/m) && meta.match(/^TITLE:(.*)$/m)[1],\n author: meta.match(/^AUTHOR:(.*)$/m) && meta.match(/^AUTHOR:(.*)$/m)[1],\n date: meta.match(/^DATE:(.*)$/m) && meta.match(/^DATE:(.*)$/m)[1],\n noMenu: meta.match(/^(NOMENU:1)$/m) ? true : false,\n url: meta.match(/^URL:(.*)$/m) && meta.match(/^URL:(.*)$/m)[1],\n content: marked(content)\n };\n\n return result;\n }, {});\n}",
"function viewEntry() {\n\n inq.prompt({\n name: \"choice\",\n type: \"rawlist\",\n message: \"Which type of entry would you like to view?\",\n choices: [\n \"employee\",\n \"role\",\n \"department\",\n \"manager\",\n \"return to start\"\n ]\n }).then(answer => {\n switch (answer.choice) {\n case \"employee\":\n viewEmployee();\n break;\n\n case \"role\":\n viewRole();\n break;\n\n case \"department\":\n viewDepartment();\n break;\n\n case \"manager\":\n viewManager();\n break;\n\n case \"return to start\":\n startPage();\n }\n\n });\n}",
"static readData(key) {\n return AsyncStorage.getItem(key)\n }",
"getAllEntries() {\n //return a Promise object, which can be resolved or rejected\n return new Promise((resolve, reject) => {\n //use the find() function of the database to get the data, \n //with error first callback function, err for error, entries for data\n this.db.find({}, function(err, entries) {\n //if error occurs reject Promise\n if (err) {\n reject(err);\n //if no error resolve the promise and return the data\n } else {\n resolve(entries);\n //to see what the returned data looks like\n console.log('function all() returns: ', entries);\n }\n })\n })\n }",
"static addContent(entryId, resource){\n\t\tlet kparams = {};\n\t\tkparams.entryId = entryId;\n\t\tkparams.resource = resource;\n\t\treturn new kaltura.RequestBuilder('baseentry', 'addContent', kparams);\n\t}",
"function themeFeedEntry(entry) {\n\t\tclasses = [ 'entry', 'well' ];\n\t\tif (new Date(entry.publishedDate).isToday()) {\n\t\t\tclasses.push('today');\n\t\t}\n\t\toutput = '<div class=\"' + classes.join(' ') + '\">';\n\t\toutput += '<h2 class=\"title\"><a href=\"' + entry.link + '\" data-eid=\"' + entry.eid + '\" rel=\"external\" target=\"_blank\">' + entry.title + '</a></h2>';\n\t\toutput += '<h2><small>' + entry.author + '</small></h2>';\n\t\toutput += '<p><small>' + entry.publishedDate + '</small></p>';\n\t\toutput += '<p>' + entry.contentSnippet + '</p>';\n\t\toutput += '<p><small>Tagged under ' + entry.categories.join(', ') + '</small></p>';\n\t\toutput += '<div class=\"actions\"><a class=\"btn twitter-share-button\" href=\"http://twitter.com/intent/tweet?text=' + encodeURIComponent(entry.title + ' ' + entry.link) + '&related=pennolson,amarnus\">Share on Twitter</a></div>';\n\t\toutput += '</div>';\n\t\treturn output;\n\t}",
"async readMain(x) {\n assert(typeof x === 'string');\n assert(isAbsolute(x));\n\n const j = await readJSON(x);\n\n if (!isObject(j))\n return null;\n\n if (this.field) {\n const m = await this.fieldMain(x, j);\n\n if (m)\n return m;\n }\n\n if (!isString(j.main))\n return null;\n\n return j.main;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shim requestAnimationFrame to ensure it is available to all browsers | shimRequestAnimationFrame() {
/* Paul Irish rAF.js: https://gist.github.com/paulirish/1579671 */
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame'];
}
if (!window.requestAnimationFrame)
window.requestAnimationFrame = function(callback, element) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
timeToCall);
lastTime = currTime + timeToCall;
return id;
};
if (!window.cancelAnimationFrame)
window.cancelAnimationFrame = function(id) {
clearTimeout(id);
};
} | [
"function animate() {\n requestAnimationFrame(animate);\n // Insert animation frame to update here.\n }",
"function update()\r\n{\r\n rebind.update()\r\n requestAnimationFrame(update)\r\n}",
"function debouncedAnimationFrame(cb) {\n return buildScheduler(function (cb) { return requestAnimationFrame(cb); }, cb);\n}",
"function tick() {\n current_animation_frame = requestAnimFrame(tick);\n draw();\n animate();\n}",
"function polyfill(callback) {\n callback();\n}",
"render(){\n\t\tif (this.active)\n\t\t{\n\t\t\trequestAnimationFrame(this.render.bind(this));\n\t\t\tif (this.checkFrameInterval())\n\t\t\t{\n\t\t\t\tthis.frameInfo.then = this.frameInfo.now - (this.frameInfo.elapsed % this.frameInfo.fpsInterval);\n\t\t\t\tthis.clearScreen();\n\t\t\t\tthis.draw();\n\t\t\t}\n\t\t}\n\t}",
"run() {\n function main(tFrame) {\n game = window.game;\n game.stopMain = window.requestAnimationFrame(main);\n var nextTick = game.lastTick + game.tickLength;\n var numTicks = 0;\n\n //If tFrame < nextTick then 0 ticks need to be updated (0 is default for numTicks).\n //If tFrame = nextTick then 1 tick needs to be updated (and so forth).\n //Note: As we mention in summary, you should keep track of how large numTicks is.\n //If it is large, then either your game was asleep, or the machine cannot keep up.\n if (tFrame > nextTick) {\n var timeSinceTick = tFrame - game.lastTick;\n numTicks = Math.floor(timeSinceTick / game.tickLength);\n }\n\n queueUpdates(game, numTicks);\n game.render(tFrame);\n game.lastRender = tFrame;\n }\n\n function queueUpdates(game, numTicks) {\n for (var i = 0; i < numTicks; i++) {\n game.lastTick = game.lastTick + game.tickLength; //Now lastTick is this tick.\n game.update(game.lastTick);\n }\n }\n\n this.lastTick = performance.now();\n this.lastRender = this.lastTick; //Pretend the first draw was on first update.\n this.tickLength = 20; //This sets your simulation to run at 20Hz (50ms)\n\n this.setInitialState();\n\n this.time_start = performance.now();\n main(performance.now()); // Start the cycle\n }",
"function animate() {\n illustration.updateRenderGraph();\n requestAnimationFrame(animate);\n\n hook.rotate.y -= 0.01;\n}",
"function runn_animation(target_animation_engine,deltatime)\n{\n target_animation_engine.runn(deltatime);\n}",
"function _redraw() {\n\n // Retrieve the URI of the next frame\n var uri = \"\";\n if (_frames.length > 1) { // Specified array of frames\n uri = _frames[_frame];\n }\n else {\n uri = _frames[0].replace('{frame}', _frame); // Single URL with {frame} placeholder\n }\n\n // Create a new tilelayer for the requested frame\n // Visibility must be set to true and the tilelayer must have non-zero opacity\n // in order for tiles to be requested\n var tileOptions = {\n mercator: new Microsoft.Maps.TileSource({ uriConstructor: uri }),\n opacity: 0.01,\n visible: true\n };\n\n // Add the tilelayer onto the end of the tile queue\n var tileLayer = new Microsoft.Maps.TileLayer(tileOptions);\n _satanimatedTileLayer.push(tileLayer);\n\n // If there is only one frame of animation in the queue, make it visible\n if (_satanimatedTileLayer.getLength() == 1) {\n var x = _satanimatedTileLayer.get(0);\n x.setOptions({ opacity: _options.opacity });\n //_animatedTileLayer.get(0).setOptions({ opacity: _options.opacity });\n }\n // If there is more than one frame\n else while (_satanimatedTileLayer.getLength() > _options.lookAhead + 1) {\n\n // Display the next frame depending on the mode selected\n switch (_options.mode) {\n\n case 'safe':\n // Set the opacity using the API method - incurs slight delay\n //_animatedTileLayer.get(1).setOptions({ opacity: _options.opacity });\n var x = _satanimatedTileLayer.get(1);\n x.setOptions({ opacity: _options.opacity });\n break;\n\n case 'dangerous':\n // Can reduce flicker by setting opacity directly through the DOM\n // See http://www.bing.com/community/maps/f/12284/t/665816.aspx\n _map.getModeLayer().children[0].children[1].style.opacity = _options.opacity;\n break;\n }\n // Remove the currently displayed frame\n _satanimatedTileLayer.removeAt(0);\n \n }\n\n // If specified, fire the frameChange callback\n if (_options.frameChangeCallback) {\n _options.frameChangeCallback(_frame);\n }\n }",
"cancel() {\n if (this.raf) {\n cancelAnimationFrame(this.raf);\n }\n }",
"function runGame(){\n movePaddle();\n moveBall();\n drawAll();\n requestAnimationFrame(runGame); // argument is self recursion\n}",
"function Sprite_FrameEffect_1() {\n this.initialize.apply(this, arguments);\n}",
"function runPolyfill() {\n polyfillCustomElements(document);\n}",
"_startAnimationLoop() {\n\t\t\tconst xTermMaterials = Array.from(this._xTermLayerMap.values());\n\t\t\tconst timeUniforms = this._shaderPasses.filter(pass => {\n\t\t\t\treturn pass.getFullscreenMaterial().uniforms.time !== undefined;\n\t\t\t}).map(pass => {\n\t\t\t\treturn pass.getFullscreenMaterial().uniforms.time;\n\t\t\t});\n\n\t\t\tconst xTermMaterialsLength = xTermMaterials.length;\n\t\t\tconst timeUniformsLength = timeUniforms.length;\n\n\t\t\tconst that = this;\n\n\t\t\t(function render() {\n\t\t\t\tthat._animationId = window.requestAnimationFrame(render);\n\n\t\t\t\tfor (let i = 0; i < timeUniformsLength; i++) {\n\t\t\t\t\ttimeUniforms.value = that._clock.getElapsedTime();\n\t\t\t\t}\n\n\t\t\t\tfor (let i = 0; i < xTermMaterialsLength; i++) {\n\t\t\t\t\txTermMaterials[i].map.needsUpdate = true;\n\t\t\t\t}\n\n\t\t\t\tthat._composer.render(that._clock.getDelta());\n\t\t\t})();\n\t\t}",
"function animateGradient() {\n updateGradient();\n requestAnimationFrame(animateGradient);\n}",
"refresh(timeNow, enableAnimation) {\n }",
"function drawFrame(c)\n{\t\t\n\tgame.frame.endFrameMillis = game.frame.startFrameMillis;\n\tgame.frame.startFrameMillis = Date.now();\n\n\tgame.frame.dt = game.frame.startFrameMillis - game.frame.endFrameMillis;\n\t\n\t\t// modify the delta time to something we can use\n\t\t// we want 1 to represent 1 second, so if the delta is in milliseconds\n\t\t// we divide it by 1000 (or multiply by 0.001). This will make our \n\t\t// animations appear at the right speed, though we may need to use\n\t\t// some large values to get objects movement and rotation correct\n\tvar dt = game.frame.dt * 0.001;\n\t\t// validate it within range\n\tif(dt > .4)\n\t\tdt = .4;\n\t\n\t\t// update the game object\n\tupdate(dt);\n\t\t// draw the scene\n\tdraw(c);\t\t\n\t\n\t// update the frame counter \n\tgame.frame.fpsTime += game.frame.dt;\n\tgame.frame.fpsCount++;\n\tif(game.frame.fpsTime >= 1000)\n\t{\n\t\tgame.frame.fpsTime = 0;\n\t\tgame.frame.fps = game.frame.fpsCount;\n\t\tgame.frame.fpsCount = 0;\t\t\n\t}\n\t\n\tsetTimeout(\"drawFrame(game.context)\", 0);\n}",
"function loop(){\n drawScene();\n updateData();\n window.requestAnimationFrame(loop);\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setTreeMapLegendData gets legend info from chart Data | function setTreeMapLegendData(data) {
var legendArray = [];
for (var i = 0; i < data.chartData.children.length; i++) {
if (legendArray.indexOf(data.chartData.children[i][data.dataTable.series]) == -1) {
legendArray.push((data.chartData.children[i][data.dataTable.series]));
}
}
return legendArray;
} | [
"function update_legend(legendData) {\n\n mymap.removeControl(legend);\n\n if(legendData) {\n currentLegendData = new Array();\n //Create an array that holds the bin intervals\n minValue = parseInt(legendData.min);\n interval = parseInt(legendData.interval);\n for(var i = 0; i <= 7; i++)\n currentLegendData.push(minValue + interval * i);\n\n //Remove the legend then add it back with the new values\n legend.addTo(mymap);\n }\n}",
"initLegend() {\n const self = this;\n\n // Array containing all legend lines (visible or not)\n self.d3.legendLines = [];\n self.curData.forEach(function (datum, index) {\n self.d3.legendLines.push(\n self.d3.o.legend.append(\"p\")\n .style(\"color\", function () {\n if (self.d3.visibleCurves[index]) {\n return self.colorPalette[index];\n } else {\n return \"#CCC\";\n }\n })\n .attr(\"class\", \"ts_label\")\n .style(\"font-size\", \"0.8em\")\n .style(\"cursor\", \"pointer\")\n .style(\"margin\", \"0px 3px\")\n .text(datum.funcId)\n .on(\"click\", function () {\n if (!self.isLoading) {\n // Toggle visibility of the clicked TS\n self.d3.visibleCurves[index] = !self.d3.visibleCurves[index];\n self.quickUpdate();\n }\n })\n .on(\"mouseover\", function () {\n d3.select(this).style(\"text-decoration\", \"underline\");\n })\n .on(\"mouseout\", function () {\n d3.select(this).style(\"text-decoration\", \"none\");\n })\n );\n });\n }",
"function _initializeLegend(){\r\n // TODO Invoke d3.oracle.ary()\r\n gAry = d3.oracle.ary()\r\n .hideTitle( true )\r\n .showValue( false )\r\n .leftColor( true )\r\n .numberOfColumns( 3 )\r\n .accessors({\r\n color: gLineChart.accessors( 'color' ),\r\n label: gLineChart.accessors( 'series' )\r\n });\r\n\r\n gLegend$ = $( '<div>' );\r\n\r\n if ( pOptions.legendPosition ==='TOP' ) {\r\n gChart$.before( gLegend$ );\r\n } else {\r\n gChart$.after( gLegend$ );\r\n }\r\n }",
"function drawTreeMap(dataSet, userSelect) {\n let details = dataSetDetails.filter(d => d.name === userSelect)[0];\n let title = details.title;\n let description = details.description;\n\n //set title\n d3.select(\"#title\")\n .text(title);\n\n //set description\n d3.select(\"#description\") \n .text(description)\n \n let root = d3.hierarchy(dataSet)\n .sum(d => d.value)\n .sort((a, b) => b.height - a.height || b.value - a.value);\n let children = dataSet.children.map(d => d.name);\n\n //color scale\n let colorScale = d3.scaleOrdinal()\n .domain(children)\n .range(d3.schemeCategory20);\n \n //computes the position of each element of the hierarchy\n d3.treemap()\n .size([width, height])\n .paddingInner(1)\n (root)\n \n //add rects\n let rects = treeMap\n .selectAll(\"rect\")\n .data(root.leaves());\n \n rects.exit()\n .remove();\n\n rects\n .enter()\n .append(\"rect\")\n .classed(\"tile\", true)\n .merge(rects)\n .attr(\"x\", d => d.x0)\n .attr(\"y\", d => d.y0)\n .attr(\"width\", d => d.x1-d.x0)\n .attr(\"height\", d => d.y1-d.y0) \n .attr(\"data-name\", d => d.data.name)\n .attr(\"data-category\", d => d.data.category)\n .attr(\"data-value\", d => d.data.value) \n .style(\"stroke\", \"lightgrey\")\n .style(\"fill\", d => colorScale(d.parent.data.name))\n .on(\"mouseover\", showTooltip)\n .on(\"touchstart\", showTooltip)\n .on(\"mouseout\", hideTooltip) \n .on(\"touchend\", hideTooltip); \n \n //add text \n let texts = treeMap\n .selectAll(\"text\")\n .data(root.leaves())\n\n texts.exit()\n .remove();\n\n texts\n .enter()\n .append(\"text\")\n // .append(\"tspan\")\n .merge(texts)\n .classed(\"tile-text\", true)\n .attr(\"x\", d => d.x0+5)\n .attr(\"y\", d => d.y0+15)\n .html(textFormater);\n \n //add legend\n let legendBoxes = legend\n .selectAll(\".legend-item\")\n .data(children)\n\n legendBoxes.exit()\n .remove();\n\n legendBoxes\n .enter() \n .append(\"rect\")\n .merge(legendBoxes)\n .classed(\"legend-item\", true)\n .attr(\"x\", 30)\n .attr(\"y\", (d, i) => { return (i+1) * 30;})\n .attr(\"width\", 20)\n .attr(\"height\", 20)\n .style(\"fill\", d => colorScale(d));\n\n let legendTexts = legend\n .selectAll(\".legend-text\")\n .data(children);\n\n legendTexts.exit()\n .remove();\n\n legendTexts \n .enter() \n .append(\"text\")\n .merge(legendTexts)\n .classed(\"legend-text\", true)\n .attr(\"x\", 75)\n .attr(\"y\", (d, i) => { return (i+1.45) * 30;})\n .text(d => d)\n .attr(\"font-size\", \"12\");\n\n //tooltip functions\n function showTooltip(d) {\n d3.select(this).classed(\"highlight\", true);\n\n tooltip\n .attr(\"data-value\", d.data.value)\n .style(\"opacity\", 1)\n .style(\"left\", `${d3.event.x - tooltip.node().offsetWidth/2}px`)\n .style(\"top\", `${d3.event.y - tooltip.node().offsetHeight/2}px`)\n .html(`\n <p>Name: ${d.data.name}</p>\n <p>Category: ${d.data.category}</p>\n <p>Value: ${d.data.value}</p>\n `); \n }\n\n function hideTooltip() { \n tooltip\n .style(\"opacity\", 0);\n }\n \n function textFormater(d){\n let words = d.data.name.split(\" \");\n let tspans = words.reduce((accumulator, word, i) => { \n accumulator += ` ${word}`;\n if(i%2 ===1 || words.length === (i+1)) accumulator = accumulator + `</tspan><tspan x=${d.x0+3} dy=${i+8} font-size='9'>`;\n return accumulator;\n },\"<tspan font-size='9'>\");\n return tspans;\n }\n }",
"function createLegend(legend, chartData, chartOptions, total, rowIndex) {\n\n var totalText = (chartOptions[0].legend[0].totalText) ? chartOptions[0].legend[0].totalText : \"Total : \";\n var legendTitle = (chartOptions[0].legend[0].title) ? chartOptions[0].legend[0].title : \"\";\n var html = \"\";\n\n if (chartOptions[0].legend[0].title) {\n html += \"<div class='spc-legend-head'><h3>\" + legendTitle + \"</h3></div>\";\n }\n html += \"<table class='spc-legend-content'>\";\n html += \"<tr class='spc-legend-th'>\";\n for (var i = 0; i < chartOptions[0].legend[0].columns.length; i++) {\n if (i === 0) {\n html += \"<td colspan='2'>\" + chartOptions[0].legend[0].columns[i] + \"</span></td>\";\n } else {\n html += \"<td>\" + chartOptions[0].legend[0].columns[i] + \"</span></td>\";\n }\n\n }\n html += \"</tr>\";\n var rowsArray = [];\n for (var i = 0; i < chartData.length; i++) {\n var legendGuidesHmtl = \"<div class='spc-legend-guides' style='width:16px;height:16px;background-color:\" + chartData[i].color + \"'></div>\";\n var trId = canvasId + \"_legcol_\" + i;\n\n rowsArray.push(trId);\n\n html += \"<tr id='\" + trId + \"' style='color:\" + chartData[i].color + (typeof rowIndex === 'number' && rowIndex === i ? ';background:' + '#F3F3F3' : '') + \"'>\";\n html += \"<td width='21'>\" + legendGuidesHmtl + \"</td>\"; // Slice guides\n\n for (var k = 0; k < chartOptions[0].legend[0].columns.length; k++) {\n var content = \"\";\n switch (k) {\n case 0:\n content = chartData[i].name;\n break;\n case 1:\n content = chartData[i].value;\n break;\n case 2:\n content = Math.round((chartData[i].value / total) * 100) + \"%\";\n break;\n }\n html += \"<td><span>\" + content + \"</span></td>\";\n }\n html += \"</tr>\";\n\n\n }\n html += \"</table>\";\n if (chartOptions[0].legend[0].showTotal) {\n html += \"<div class='spc-legend-foot'><p>\" + totalText + \"\" + total + \"</span></div>\";\n }\n\n legend.innerHTML = html;\n\n // Interactivity preference\n var interactivity = (chartOptions[0].interactivity) ? chartOptions[0].interactivity : \"enabled\";\n if (interactivity === \"enabled\") { // If enabled\n\n // Attach mouse Event listeners to table rows\n for (var i = 0; i < rowsArray.length; i++) {\n var thisRow = document.getElementById(rowsArray[i]);\n thisRow.chrtData = chartData;\n thisRow.options = chartOptions;\n thisRow.sliceData = chartData[i];\n thisRow.slice = i;\n thisRow.mouseout = true;\n\n thisRow.addEventListener(\"mousedown\", function (e) {\n return function () {\n handleClick(this.chrtData, this.options, this.slice, this.sliceData);\n };\n }(this.chrtData, this.options, this.slice, this.sliceData), false);\n\n var mouseOverFunc = function () {\n\n return function () {\n this.style.background = '#F3F3F3';\n this.style.cursor = 'pointer';\n handleOver(this.chrtData, this.options, this.sliceData);\n };\n };\n\n thisRow.addEventListener(\"mouseover\", mouseOverFunc(this.chrtData, this.options, this.sliceData), false);\n\n thisRow.addEventListener(\"mouseleave\", function (e) {\n if (e.target === this && e.target.clientHeight !== 0) {\n this.style.background = 'transparent';\n this.sliceData.mouseIn = false;\n this.sliceData.focused = false;\n draw(this.chrtData, this.options);\n }\n }, false);\n }\n }\n\n function handleOver(data, options, sliceData) {\n // Assign the hovered element in sliceData\n if (!sliceData.mouseIn) {\n sliceData.mouseIn = true;\n sliceData.focused = true;\n console.log(\"mouse in\");\n draw(data, options);\n }\n return;\n }\n\n /*\n * Handles mouse clicks on legend table rows\n */\n function handleClick(data, options, slice, sliceData) {\n // Reset explode slices\n for (var i = 0; i < data.length; i++) {\n if (i !== slice) {\n data[i].explode = false;\n }\n }\n\n // Check if slice is explode and pull it in or explode it accordingly\n sliceData.explode = (sliceData.explode) ? false : true;\n draw(data, options);\n }\n\n }",
"function createLegendBrokerDHT() {\n const broker_point = createGeoJsonPoint([10,10]);\n\n const path = d3.geoPath();\n const legend_table = d3.select(\"#legend-table\");\n\n // -- broker --\n const broker_row = legend_table.append(\"tr\");\n const broker_svg = broker_row.append(\"td\").append(\"svg\");\n broker_svg\n .attr(\"height\", 20)\n .attr(\"width\", 20);\n\n // point\n path.pointRadius(3.5)\n broker_svg.append(\"path\")\n .attr(\"fill\", \"black\")\n .datum(broker_point)\n .attr(\"d\", path);\n\n // outline\n path.pointRadius(7)\n broker_svg.append(\"path\")\n .attr(\"fill\", \"none\")\n .attr(\"stroke\", \"black\")\n .attr(\"stroke-width\", \"2.5\")\n .datum(broker_point)\n .attr(\"d\", path);\n\n // text\n broker_row.append(\"td\").text(\"– Broker (can be clicked to highlight corresponding row in table)\");\n\n // -- text for colormap --\n let colormapDHT = [\"#a2c9e6\", \"#7ab4e1\", \"#509edf\", \"#2387e0\", \"#146ec2\", \"#0b559f\"];\n\n const colormap_row = legend_table.append(\"tr\");\n const colormap_svg = colormap_row.append(\"td\").append(\"svg\")\n .attr(\"height\", 20)\n .attr(\"width\", 120);\n\n for (let i = 0; i < colormapDHT.length; i++) {\n colormap_svg.append(\"rect\")\n .attr(\"width\", 20)\n .attr(\"height\", 20)\n .attr(\"x\", 0+i*20)\n .attr(\"y\", 0)\n .attr(\"fill\", colormapDHT[i]);\n }\n\n colormap_row.append(\"td\").html(\"– Broker colors, from 0 topics to most individual topics\");\n}",
"function drawLegend() {\n var shown = buildLabels();\n var idx = 0;\n var legend = svgPath.selectAll(\".legend\").data(colorPath.domain()).enter()\n .append(\"g\").attr(\"class\", \"legend\").attr(\"transform\", function(d) {\n // Use our enumerated idx for labels, not all-color index i\n var y = 0;\n if (shown.includes(d)) {\n y = ph_m + (idx * (pl_w + 2));\n idx++;\n }\n return \"translate(0,\" + y + \")\";\n });\n legend.append(\"rect\").attr(\"x\", ph_m).attr(\"width\", pl_w).attr(\"height\",\n pl_w).style(\"fill\", colorPath).style(\"visibility\", function(d) {\n return shown.includes(d) ? \"visible\" : \"hidden\";\n });\n var x_offset = (ph_m * 2) + pl_w;\n var y_offset = pl_w / 2;\n legend.append(\"text\").attr(\"x\", x_offset).attr(\"y\", y_offset).attr(\"dy\",\n \".35em\").style(\"text-anchor\", \"begin\").style(\"font-size\", \"12px\")\n .text(function(d) {\n if (shown.includes(d)) {\n var core = '';\n var label = '';\n if (d % 2 === 0) {\n isd = d / 4 + 1;\n core = ' (core)';\n } else {\n isd = (d - 1) / 4 + 1;\n }\n if (iaLabels && iaLabels.ISD && iaLabels.ISD[String(isd)]) {\n label = ' ' + iaLabels.ISD[String(isd)];\n }\n return 'ISD-' + isd + label + core;\n } else {\n return null;\n }\n });\n}",
"updateLegendLabel(color, label) {\n let currentLegendData = cloneDeep(this.state.pluginData[\"Legend\"]);\n currentLegendData[this.state.activeEntry][color] = label;\n this.updatePluginData(\"Legend\", currentLegendData);\n }",
"function drawTreeMapChart() {\n var area = $(\"#treeMapChart\");\n area.empty();\n\n\n var chart = {\n chart: {\n margin: [0,0,0,0]\n },\n series: [{\n type: \"treemap\",\n layoutAlgorithm: 'squarified',\n data: []\n }],\n title: {\n text: null\n },\n tooltip: {\n formatter: function(){\n return '<strong>' + this.point.name + '</strong>: $ ' + Math.floor(this.point.value * 1000);\n }\n }\n };\n\n var cData = {};\n $.each(current_data, function(key, value) {\n if(current_dimension === key || current_dimension === \"totals\") {\n $.each(value, function (key, value) {\n if(!(value[\"cc\"] in cData)) {\n cData[value[\"cc\"]] = 0;\n }\n\n cData[value[\"cc\"]] += value[\"amount\"];\n });\n }\n });\n\n for (cc in cData) {\n chart.series[0].data.push({\n name: countries[cc][\"full_name\"],\n value: cData[cc]\n });\n }\n\n Highcharts.chart('treeMapChart', chart);\n\n var title = $(\"#treeMapTitle\");\n\n if(current_dimension === \"totals\")\n title.text(\"Absolute Trade Amounts\");\n if(current_dimension === \"exports\")\n title.text(\"Largest Export Partners\");\n if(current_dimension === \"imports\")\n title.text(\"Largest Import Partners\");\n}",
"render() {\n\n let mapViewport = {\n center: [47.3511, -120.7401],\n zoom: 6\n }\n\n let legend = \n <div className='info legend'>\n <i style={{background:\"#C7E5D7\"}}></i>0-30%<br></br>\n <i style={{background:\"#9DD1B9\"}}></i>30-40%<br></br>\n <i style={{background:\"#81C4A5\"}}></i>40-50%<br></br>\n <i style={{background:\"#65B891\"}}></i>50-60%<br></br>\n <i style={{background:\"#539777\"}}></i>60-70%<br></br>\n <i style={{background:\"#41765D\"}}></i>70-80%<br></br>\n <i style={{background:\"#2E5442\"}}></i>80-90%<br></br>\n <i style={{background:\"#1C3328\"}}></i>90+%<br></br>\n </div>;\n\n // Returns a map that contains a legend and and the map itself. This data is layered over the initial tile layer.\n return (\n <Map ref=\"map\" id=\"map\" viewport={mapViewport} style={{ height: '470px' }}>\n <TileLayer\n url='https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1Ijoia3lsZWF2YWxhbmkiLCJhIjoiY2pvdzd3NGtzMGgxMjNrbzM0cGhwajRxNyJ9.t8zAjKz12KLZQ8GLp2hDFQ'\n attribution='Map data © <a href=\"https://www.openstreetmap.org/\">OpenStreetMap</a> contributors, <a href=\"https://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA</a>, Imagery © <a href=\"https://www.mapbox.com/\">Mapbox</a>'\n minZoom='2'\n maxZoom='20'\n id='mapbox.streets'\n />\n {this.state.data.length > 0 ? \n <div>\n <GeoJSON ref=\"geojson\" key={hash(this.state.geojsondata)} data={this.state.geojsondata} style={this.addStyle} onEachFeature={this.onEachFeature.bind(this)}/>\n \n {this.state.listOfCounties ? \n this.state.listOfCounties.includes(this.props.county) ?\n <GeoJSON ref=\"geojson2\" key={hash(this.props.county)} data={this.getSpecificCountyData()} style={this.addSpecificStyling} onEachFeature={this.onEachFeature.bind(this)}/>\n :\n <div />\n :\n <div />}\n \n </div>\n : \n <div />}\n\n <Control position=\"bottomright\"> {/* Legend popup */}\n <div>\n {legend}\n </div>\n </Control>\n <Control position=\"topright\"> {/* Main County Information popup */}\n <div className='info legend'>\n {this.state.countyInfoPopup}\n </div>\n </Control>\n <Control position='bottomleft'> {/* Home County popup on map */}\n \n {this.state.listOfCounties ? \n this.state.listOfCounties.includes(this.props.county) ?\n <div className='info'>\n Home County: {this.props.county}\n </div>\n :\n <div className='info'>\n Enter your Home County in the Form Above\n </div>\n :\n <div/>\n }\n \n </Control>\n </Map>\n );\n }",
"beforeUpdate(chart, _args, options) {\n const legend = chart.legend;\n layouts.configure(chart, legend, options);\n legend.options = options;\n }",
"function createLegendBrokerDisGB() {\n const path = d3.geoPath();\n const legend_table = d3.select(\"#legend-table\");\n\n // -- broker --\n const broker_row = legend_table.append(\"tr\");\n const broker_svg = broker_row.append(\"td\").append(\"svg\");\n broker_svg\n .attr(\"height\", 20)\n .attr(\"width\", 20);\n const broker_point = createGeoJsonPoint([10,10]);\n\n // point\n path.pointRadius(3.5)\n broker_svg.append(\"path\")\n .attr(\"fill\", \"black\")\n .datum(broker_point)\n .attr(\"d\", path);\n\n // outline\n path.pointRadius(7)\n broker_svg.append(\"path\")\n .attr(\"fill\", \"none\")\n .attr(\"stroke\", \"black\")\n .attr(\"stroke-width\", \"2.5\")\n .datum(broker_point)\n .attr(\"d\", path);\n\n // text\n broker_row.append(\"td\").text(\"– Broker\");\n\n // -- area --\n const broker_row2 = legend_table.append(\"tr\");\n broker_row2.append(\"td\").text(\"Colored area\")\n broker_row2.append(\"td\").text(\"– Broker area\")\n}",
"function refreshLegend() {\n if (isSmall) {\n legend.refresh();\n } else {\n expandLegend.refresh();\n }\n }",
"function drawLegend() {\n var legend = $(\"#legend\");\n legend.empty();\n\n var legendContainer = $(\"<div>\");\n legendContainer.addClass(\"legendContainer\");\n\n // Nur die Labels, die wir auch anzeigen!\n for(var lbl of usedLabels.entries()) {\n var catId = lbl[0];\n var category = categories[catId];\n var color = resourceColorTable[catId];\n legendContainer.append(\"<div class='label'><div class='color' style='background: \"+color+\"'> </div> \"+category+\"</div>\");\n }\n\n legend.append(legendContainer);\n}",
"function createLegendBrokerFlooding() {\n const path = d3.geoPath();\n const legend_table = d3.select(\"#legend-table\");\n\n // -- broker --\n const broker_row = legend_table.append(\"tr\");\n const broker_svg = broker_row.append(\"td\").append(\"svg\");\n broker_svg\n .attr(\"height\", 20)\n .attr(\"width\", 20);\n const broker_point = createGeoJsonPoint([10,10]);\n\n // point\n path.pointRadius(3.5)\n broker_svg.append(\"path\")\n .attr(\"fill\", \"black\")\n .datum(broker_point)\n .attr(\"d\", path);\n\n // outline\n path.pointRadius(7)\n broker_svg.append(\"path\")\n .attr(\"fill\", \"none\")\n .attr(\"stroke\", \"black\")\n .attr(\"stroke-width\", \"2.5\")\n .datum(broker_point)\n .attr(\"d\", path);\n\n // text\n broker_row.append(\"td\").text(\"– Broker\");\n\n // -- area --\n const broker_row2 = legend_table.append(\"tr\");\n broker_row2.append(\"td\").text(\"Colored area\")\n broker_row2.append(\"td\").text(\"– Area in which clients for a given broker can be located\")\n}",
"function createLegendBrokerBG() {\n const path = d3.geoPath();\n const legend_table = d3.select(\"#legend-table\");\n\n // -- leader --\n const leader_row = legend_table.append(\"tr\");\n const leader_svg = leader_row.append(\"td\").append(\"svg\");\n leader_svg\n .attr(\"height\", 20)\n .attr(\"width\", 20);\n const leader_point = createGeoJsonPoint([10,10]);\n\n // point\n path.pointRadius(3.5)\n leader_svg.append(\"path\")\n .attr(\"fill\", \"black\")\n .datum(leader_point)\n .attr(\"d\", path);\n\n // outline\n path.pointRadius(7)\n leader_svg.append(\"path\")\n .attr(\"fill\", \"none\")\n .attr(\"stroke\", \"black\")\n .attr(\"stroke-width\", \"2.5\")\n .datum(leader_point)\n .attr(\"d\", path);\n\n // text\n leader_row.append(\"td\").text(\"– Leader\");\n\n // -- member --\n const member_row = legend_table.append(\"tr\");\n const member_svg = member_row.append(\"td\").append(\"svg\");\n member_svg\n .attr(\"height\", 20)\n .attr(\"width\", 20);\n const member_point = createGeoJsonPoint([10,10]);\n\n // point\n path.pointRadius(3.5)\n member_svg.append(\"path\")\n .attr(\"fill\", \"black\")\n .datum(member_point)\n .attr(\"d\", path);\n\n // text\n member_row.append(\"td\").text(\"– Member\");\n\n // -- area --\n const broker_row2 = legend_table.append(\"tr\");\n broker_row2.append(\"td\").text(\"Colored area\")\n broker_row2.append(\"td\").text(\"– Area that covers all brokers of a broadcast group\")\n}",
"function createLegendBrokerGQPS() {\n const broker_point = createGeoJsonPoint([10,10]);\n\n const path = d3.geoPath();\n const legend_table = d3.select(\"#legend-table\");\n\n // -- broker --\n const broker_row = legend_table.append(\"tr\");\n const broker_svg = broker_row.append(\"td\").append(\"svg\");\n broker_svg\n .attr(\"height\", 20)\n .attr(\"width\", 20);\n\n // point\n path.pointRadius(3.5)\n broker_svg.append(\"path\")\n .attr(\"fill\", \"black\")\n .datum(broker_point)\n .attr(\"d\", path);\n\n // outline\n path.pointRadius(7)\n broker_svg.append(\"path\")\n .attr(\"fill\", \"none\")\n .attr(\"stroke\", \"black\")\n .attr(\"stroke-width\", \"2.5\")\n .datum(broker_point)\n .attr(\"d\", path);\n\n // text\n broker_row.append(\"td\").text(\"– Broker (can be clicked to show quorum)\");\n\n // -- broker clicked --\n const broker_clicked_row = legend_table.append(\"tr\");\n const broker_clicked_svg = broker_clicked_row.append(\"td\").append(\"svg\");\n broker_clicked_svg\n .attr(\"height\", 20)\n .attr(\"width\", 20);\n\n // point\n path.pointRadius(3.5)\n broker_clicked_svg.append(\"path\")\n .attr(\"fill\", highlight_clicked_color)\n .datum(broker_point)\n .attr(\"d\", path);\n\n // outline\n path.pointRadius(7)\n broker_clicked_svg.append(\"path\")\n .attr(\"fill\", \"none\")\n .attr(\"stroke\", highlight_clicked_color)\n .attr(\"stroke-width\", \"2.5\")\n .datum(broker_point)\n .attr(\"d\", path);\n\n // text\n broker_clicked_row.append(\"td\").text(\"– Broker (clicked)\");\n\n // -- broker in quorum --\n const broker_highlight_row = legend_table.append(\"tr\");\n const broker_highlight_svg = broker_highlight_row.append(\"td\").append(\"svg\");\n broker_highlight_svg\n .attr(\"height\", 20)\n .attr(\"width\", 20);\n\n // point\n path.pointRadius(3.5)\n broker_highlight_svg.append(\"path\")\n .attr(\"fill\", highlight_color)\n .datum(broker_point)\n .attr(\"d\", path);\n\n // outline\n path.pointRadius(7)\n broker_highlight_svg.append(\"path\")\n .attr(\"fill\", \"none\")\n .attr(\"stroke\", highlight_color)\n .attr(\"stroke-width\", \"2.5\")\n .datum(broker_point)\n .attr(\"d\", path);\n\n // text\n broker_highlight_row.append(\"td\").text(\"– Broker (part of quorum)\");\n}",
"function drawDatamap(){\n\n // create promise for json of gdp-data\n d3v5.json(\"gdp_data_clean.json\").then(function(data) {\n\n // create datamap\n var map = new Datamap({element: document.getElementById('container'),\n fills: {\n '>25000': '#1a9641',\n '15000-25000': '#a6d96a',\n '7500-15000': '#ffffbf',\n '3500-7500': '#fdae61',\n '<3500': '#d7191c',\n defaultFill: 'grey'\n },\n data: data,\n geographyConfig: {\n popupTemplate: function(geography, data) {\n return '<div class=\"hoverinfo\">' + geography.properties.name + '<br />' + 'GDP per capita: ' + data.GDP\n }},\n done: function(datamap) {\n datamap.svg.selectAll('.datamaps-subunit').on('click', function(geography) {\n country = geography.properties.name;\n\n // create promise for suicide data\n d3v5.json(\"suicidedata.json\").then(function(data) {\n objects_interest_order = getObjectsInterest(data, country)\n // suicide data available\n if (objects_interest_order != 1){\n d3v5.select(\"#graph\").remove()\n drawbar(objects_interest_order);\n }\n // no suicide data avaibale\n else{\n d3v5.select('#graph').remove()\n noDataAvailable();\n }\n });\n });\n }\n });\n // draw legend for datamap\n map.legend({\n legendTitle : \"GDP per capita\",\n defaultFillName: \"No data: \",\n labels: {\n q0: \"one\",\n q1: \"two\",\n q2: \"three\",\n q3: \"four\",\n q4: \"five\",\n },\n });\n });\n}",
"function forceRepositionLegend()\n{\n // XXX: this could be improved.\n // See https://stackoverflow.com/questions/55931159/legends-do-not-stay-in-place-when-resizing-linked-graphs-in-dygraphs\n var oldLegendDirection = g_state.legendDirection;\n g_state.legendDirection = 0;\n showLegend(oldLegendDirection);\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Take input and convert to unsigned uint64 bigendian bytes | function toBigendianUint64BytesUnsigned(i, bufferResponse = false) {
let input = i
if (!Number.isInteger(input)) {
input = parseInt(input, 10)
}
const byteArray = [0, 0, 0, 0, 0, 0, 0, 0]
for (let index = 0; index < byteArray.length; index += 1) {
const byte = input & 0xFF // eslint-disable-line no-bitwise
byteArray[index] = byte
input = (input - byte) / 256
}
byteArray.reverse()
if (bufferResponse === true) {
const result = Buffer.from(byteArray)
return result
}
const result = new Uint8Array(byteArray)
return result
} | [
"function UInt32toUInt8(value) {\n console.log(value);\n t = [\n value >> 24,\n (value << 8) >> 24,\n (value << 16) >> 24,\n (value << 24) >> 24\n ];\n console.log(t);\n return t;\n}",
"function read64() {\n var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U64);\n var buffer = Buffer.from(bytes);\n return (0, _leb.decodeInt64)(buffer);\n }",
"function byteArrayToLong(byteArray) {\n var value = 0;\n for (var i = byteArray.length - 1; i >= 0; i--){\n value = (value * 256) + byteArray[i];\n }\n return value;\n}",
"static uint64(v) { return n(v, 64); }",
"static uint88(v) { return n(v, 88); }",
"static fromBuffer(buffer: Buffer): u64 {\n assert(buffer.length === 8, `Invalid buffer length: ${buffer.length}`);\n return new BN(\n [...buffer]\n .reverse()\n .map(i => `00${i.toString(16)}`.slice(-2))\n .join(''),\n 16,\n );\n }",
"static bytes2(v) { return b(v, 2); }",
"function UInt8toUInt32(value) {\n return (new DataView(value.buffer)).getUint32();\n}",
"static uint72(v) { return n(v, 72); }",
"function hs_wordToWord64(low) {\n return [0, low];\n}",
"static uint56(v) { return n(v, 56); }",
"static uint(v) { return n(v, 256); }",
"function longToByteArray(long){\n var byteArray = new Uint8Array(8);\n\n for (var index = 0; index < byteArray.length; index++){\n var byte = long & 0xff;\n byteArray [index] = byte;\n long = (long - byte) / 256 ;\n }\n return byteArray;\n}",
"static bytes8(v) { return b(v, 8); }",
"function bigint2bytes(m,l)\n{\n\tlet r = [];\n\n\tm = BigInt(m); // just in case\n\n\tfor(let i = 1 ; i <= l ; i++)\n\t{\n\t\tr[l - i] = Number(m & 0xFFn);\n\t\tm >>= 8n;\n\t}\n\n\tif (m != 0n)\n\t\tconsole.log(\"m too big for l\", m, l, r);\n\n\treturn r;\n}",
"static bytes6(v) { return b(v, 6); }",
"static bytes22(v) { return b(v, 22); }",
"static uint216(v) { return n(v, 216); }",
"function convertIPv4toUInt32(ip) {\n if (ip === 'localhost')\n ip = '127.0.0.1';\n let bytes = ip.split('.');\n // console.assert(bytes.length === 4);\n let uint = 0;\n bytes.forEach(function iterator(byte) {\n uint = uint * 256 + (+byte);\n });\n return uint >>> 0;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
display the panel to display game stats | function displayrpsStatsPanel() {} | [
"function displayGameScreen()\n{\n\t\n\tdisplayResourceElement();\n\t\t\t\n\tdisplayInfoElement();\n\t\n\tdisplayMapElement();\n\t\n\tjoinGame();\n\t\n\tif(player.onTurn == true)\n\t{\n\t\tdisplayEndTurnElement(\"salmon\");\n\t\t\n\t\tdisplayTurnCounterElement(\"lightGreen\");\n\t}\n\telse\n\t{\n\t\tdisplayEndTurnElement(\"lightSlateGrey\");\n\t\n\t\tdisplayTurnCounterElement(\"salmon\");\n\t}\n\t\n\tgameStarted = true;\n\t\n\tstage.update();\n}",
"function updateGameInfo() {\n\t\tvar $ = jewel.dom.$;\n\t\t$(\"#game-screen .score span\")[0].innerHTML = gameState.score;\n\t\t$(\"#game-screen .level span\")[0].innerHTML = gameState.level;\n\t}",
"function updateStats(){\n var newStats = statsTemplate({\n money:(f.format(player.money)), tick:player.tick/1000\n });\n $(\"#tabStats\").html(newStats);\n}",
"function displayGameInfo(){\n // Game Stats\n document.getElementById(\"dealer-points\").innerHTML = dealer.points;\n document.getElementById(\"player-points\").innerHTML = player.points;\n document.getElementById(\"bet-amount\").innerHTML = player.bet;\n document.getElementById(\"bank-amount\").innerHTML = player.bank;\n document.getElementById(\"wins\").innerHTML = player.wins;\n document.getElementById(\"totalhands\").innerHTML = player.totalhands;\n // Control Buttons\n // document.getElementById(\"bet-button\").style.display = \"none\";\n // document.getElementById(\"cancel-button\").style.display = \"none\";\n // document.getElementById(\"deal-button\").style.display = \"none\";\n // document.getElementById(\"hit-button\").style.display = \"none\";\n // document.getElementById(\"stand-button\").style.display = \"none\";\n document.getElementById(\"messages\").innerHTML = \"Pick the bet amount\";\n document.getElementById(\"playerSection\").style.display = \"flex\";\n\n\n // Array.from(chip).forEach(function(element){\n // element.style.display = \"\";\n // });\n chipbuttons.style.display = \"flex\";\n // document.getElementById(\"controlbuttons\").style.display = \"none\";\n }",
"updatePanel() {\n document.getElementById(\"score\").innerText = this.score\n document.getElementById(\"lives\").innerText = '💖'.repeat(this.lives)\n }",
"function updateDisplay(){\n\t\t// Update any changes the Hero element\n\t\t$(\".hero\").html(\n\t\t\t\t\"<p>\" + hero.name + \"</p>\" +\n\t\t\t\t\"<img src='\" + hero.img + \"' >\" +\n\t\t\t\t\"<p> HP: \" + hero.hitPoints + \"</p>\"\n\t\t);\n\t\t// Update any changes the Defender element\n\t\t$(\".defender\").html(\n\t\t\t\t\"<p>\" + defender.name + \"</p>\" +\n\t\t\t\t\"<img src='\" + defender.img + \"' >\" +\n\t\t\t\t\"<p> HP: \" + defender.hitPoints + \"</p>\"\n\t\t);\n\t}",
"display() {\n this.draw(this.points.length);\n }",
"function displayHud() {\n // 2D screen-aligned rendering section\n easycam.beginHUD()\n // this._renderer._enableLighting = false // fix for issue #1\n let state = easycam.getState()\n\n // Get number of points\n let numPoints = 0\n\n if (letters) {\n numPoints = letters.points.length\n }\n if (drawingLetters) {\n numPoints = drawingLetters.points.length\n }\n if (disappearingLetters) {\n numPoints = disappearingLetters.points.length\n }\n\n // Render the background box for the HUD\n noStroke()\n fill(0)\n rect(x, y, 20, 140)\n fill(50, 50, 52, 20) // a bit of transparency\n rect(x + 20, y, 450, 140)\n\n // Render the labels\n fill(69, 161, 255)\n text(\"Distance:\", x + 35, y + 25)\n text(\"Center: \", x + 35, y + 25 + 20)\n text(\"Rotation:\", x + 35, y + 25 + 40)\n text(\"Framerate:\", x + 35, y + 25 + 60)\n text(\"GPU Renderer:\", x + 35, y + 25 + 80)\n text(\"Total Points:\", x + 35, y + 25 + 100)\n\n // Render the state numbers\n fill(0, 200, 0)\n text(nfs(state.distance, 1, 2), x + 160, y + 25)\n text(nfs(state.center, 1, 2), x + 160, y + 25 + 20)\n text(nfs(state.rotation, 1, 3), x + 160, y + 25 + 40)\n text(nfs(frameRate(), 1, 2), x + 160, y + 25 + 60)\n text(nfs(getGLInfo().gpu_renderer, 1, 2), x + 163, y + 25 + 80)\n text(nfs(numPoints, 1, 0), x + 160, y + 25 + 100)\n easycam.endHUD()\n}",
"function displayScores() {\n\tget('js_score').innerHTML = temp.points;\n\tget('js_answered').innerHTML = answered;\n\tget('js_error').innerHTML = temp.errors;\n\tget('js_left').innerHTML = data.length-answered;\n}",
"function displayScoreWinsLoses() {\n\n\t\t// Display random game number\n\t\t$(\"#score\").text(randomGameNumber);\n\n\t\t// Load Crystals\n\t\tloadCrystals();\n\t}",
"function DOMDisplay(parent, level) {\n\tthis.wrap = parent.appendChild(elMaker(\"div\", \"game\"));\n\tthis.level = level;\n\n\tthis.wrap.appendChild(this.drawBackground());\n\tthis.activeLayer = null;\n\tthis.drawFrame();\n}",
"function drawStats(stats) {\r\n textAlign(LEFT);\r\n fill('gray');\r\n blendMode(ADD);\r\n drawStat(0, 'objectsDrawn', stats.objectsDrawn, 800);\r\n drawStat(1, 'highestNote', stats.highestNote, 127);\r\n // drawStat(2, 'highestNoteMax', stats.highestNoteMax, 127);\r\n}",
"function init() {\n\t\tstatsPanelBind()\n\t}",
"function updateSlotDisplays(player){\n\t\tdocument.getElementById(\"header\").innerHTML = \n\t\t\t\t\t\"<h3>3-of-a-Kind Slot-o-Rama</h3>\" + \n\t\t\t\t\t\"<h4>$\" + payout + \" per credit bet<br>\" +\n\t\t\t\t\t\"Max bet = \" + multiplierMax + \" credits</h4>\";\n\t\tdocument.getElementById(\"credit_cost\").innerHTML = \"<b>$\" + creditCost + \"</b><br>per credit\";\n\t\tdocument.getElementById(\"recent_win_payout\").innerHTML = \"Recent Win Payout:<br><b>$\" + recentWinPayout + \"</b>\";\n\t\tdocument.getElementById(\"previous_turn_payout\").innerHTML = \"Previous Turn Payout:<br><b>$\" + previousTurnPayout + \"</b>\";\n\t\tdocument.getElementById(\"current_bet\").innerHTML = \"Current Bet:<br><b>\" + multiplier + \" credit</b>\";\n\t\tif (player) {\n\t\t\tdocument.getElementById(\"balance\").innerHTML = \"Balance:<br><b>$\" + player.getBalance().toFixed(2) + \"</b>\";\t\n\t\t}\n\t\toutputResults();\n\t}",
"afficherStats() {\n if (this.estConnecte()) {\n window.pseudoUtilisateur.innerHTML = this.getPseudo();\n window.niveauUtilisateur.innerHTML = \"Niv. \" + this.getNiveau();\n window.scoreUtilisateur.innerHTML = this.getScore() + \" pts\";\n }\n }",
"function displayGameplay() {\n image(backgroundImg, width / 2, height / 2, 1500, 800);\n\n // Handle input for the player\n player.handleInput();\n\n // Move all the supplies\n player.move();\n for (let i = 0; i < supply.length; i++) {\n supply[i].move();\n // Handle the bee eating any of the supply\n player.handleEating(supply[i]);\n supply[i].display();\n }\n\n //Display firstAid kit\n firstAid.move();\n firstAid.display();\n\n //Display battery\n battery.move();\n battery.display();\n\n // Handle the player collecting any of the supply\n player.handleEating(water);\n player.handleEating(food);\n player.handleCharging(battery);\n player.handleHealing(firstAid);\n\n //Check if the player is dead and to end game\n player.endGame();\n // Display the player\n player.display();\n\n //display the flashlight\n flashlight.display();\n\n // display health (health bar)\n healthBar.updateHealth(player.health);\n healthBar.display();\n\n //display flashlight battery (battery bar)\n batteryBar.updateBattery(player.batteryLevel);\n batteryBar.display();\n}",
"function AddGamePanel( appid )\n{\n\t// Check to see if the panel exists or not\n\tvar oPanel = $( '#game_' + appid );\n\n\tif( oPanel ) // Panel exists... maybe make sure it's visible?\n\t{\n\t\treturn true;\n\t}\n\n\t// Else create..\n\tvar app = GetAppInfo( appid );\n\tif( !app )\n\t\treturn false;\n\n\tvar oParent = $('#GamesContainer');\n\tvar oButton = $.CreatePanel('Button', oParent, 'game_' + app.appid );\n\toButton.AddClass('GameRow');\n\toButton.AddClass('StatsRow');\n\n\t// Logo image\n\tvar oImage = $.CreatePanel('Image', oButton, '' );\n\toImage.SetAttributeString( 'logo', app.logo );\n\toImage.AddClass('LogoImage');\n\n\t$.RegisterEventHandler('ReadyPanelForDisplay', oButton, onReadyForDisplay );\n\t$.RegisterEventHandler('PanelDoneWithDisplay', oButton, onDoneWithDisplay );\n\n\t// Title wrapper panel\n\tvar oWrapperPanel = $.CreatePanel('Panel', oButton, '' );\n\toWrapperPanel.AddClass('TextCol');\n\n\t// Title\n\tvar oLabel = $.CreatePanel('Label', oWrapperPanel, '' );\n\toLabel.text = app.name;\n\toLabel.AddClass('Title');\n\n\t// Playtime\n\tvar oPlaytime = $.CreatePanel('Label', oWrapperPanel, '' );\n\tvar strHrs = '';\n\n\tif( app.hours_forever )\n\t\tstrHrs += app.hours_forever + \" hrs on record\";\n\n\tif( app.hours )\n\t{\n\t\tif( strHrs.length > 0 )\n\t\t\tstrHrs += ' / ';\n\t\tstrHrs += app.hours + \" last two weeks\";\n\t}\n\n\toPlaytime.text = strHrs;\n\toPlaytime.AddClass('Playtime');\n\n\tvar fnContextMenu = CreateContextMenu( app, g_rgBucket );\n\n\n\t//$.RegisterKeyBind( oButton, 'steampad_a', fnContextMenu );\n\t$.RegisterEventHandler('Activated', oButton, fnContextMenu );\n\n\n}",
"function drawTrafficFlowPopup(panelId) {\n document.getElementById('traffic_table_' + panelId).style.display = 'block';\n}",
"function updateStats(){\n\t//update p1 stats on page\n\tdocument.getElementById(\"p1def\").innerText=player1.def;\n\tdocument.getElementById(\"p1def\").innerText=player1.def;\n\tdocument.getElementById(\"p1lck\").innerText=player1.luck;\n document.getElementById(\"p1atk\").innerText=player1.atk;\n document.getElementById(\"p1spd\").innerText=player1.speed;\n\t\n\t//update p2 stats on page\n\tdocument.getElementById(\"p2def\").innerText=player2.def;\n\tdocument.getElementById(\"p2lck\").innerText=player2.luck;\n document.getElementById(\"p2atk\").innerText=player2.atk;\n document.getElementById(\"p2spd\").innerText=player2.speed;\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a functioning graph type button to the nav bar | function addGraphType(graphType, title, toolbar) {
let dropdown = document.getElementById('graphdropdown')
let a = document.createElement('a')
a.setAttribute('href', '#')
let t = document.createTextNode(title)
dropdown.appendChild(a)
a.appendChild(t)
a.addEventListener('mousedown', event => {
graph = graphType
repaint()
toolBar = toolbar
toolBar.add()
})
} | [
"function addLoanMenuButton(loan) {\n const loanNavButton = `\n <button class=\"btn btn-primary loan-button\" onclick=\"displayGraph('${\n loan.name\n }')\">${loan.name.replace(\"_\", \" \")}</button>\n `;\n const $loanNavMenu = $(\"#loanNavMenu\");\n $loanNavMenu.append(loanNavButton);\n}",
"function fillNav()\n {\n //make buttons\n var forecast = makeNewButton('Forecast')\n forecast.setAttribute('class', 'col forecast')\n\n var almanac = makeNewButton('Almanac')\n almanac.setAttribute('class', 'col almanac')\n \n var astronomy = makeNewButton('Astronomy')\n astronomy.setAttribute('class', 'col astronomy')\n\n var conditions = makeNewButton('Update Conditions')\n conditions.setAttribute('class', 'col conditions')\n\n //add buttons to nav\n var nav = $('nav')\n nav.append(almanac)\n nav.append(astronomy)\n nav.append(conditions)\n nav.append(forecast)\n }",
"function createFunctionNavBar() {\n $(\"#nav-bar\").html(\"\");\n for (let i = 0; i < functions.length; i++) {\n let navBar = $('<button class = \"function-nav-bar nav-btn\"> </button>');\n // navBar.attr(\"href\", \"#\" + functions[i]);\n navBar.attr(\"id\", \"fc-\" + parseInt(i));\n navBar.text(functions[i]);\n $(\"#nav-bar\").append(navBar);\n navBar.css({ display: \"flex\" }, { \"flex-direction\": \"column\" });\n }\n}",
"addToNavBar() {\r\n const link = $$(\"<a>\");\r\n link.className = \"nav-item nav-link\";\r\n link.href = \"/money/account/\" + this.model.id;\r\n link.textContent = this.model.name;\r\n $$(\".navbar-nav\").appendChild(link);\r\n }",
"function addNavigation() {\n let length = this.innerElements.length;\n for (let i = 0; i < length; i++) {\n const BTN = document.createElement('button');\n BTN.classList.add('slider-button');\n if (i == 0) BTN.classList.add('slider-button--active');\n BTN.addEventListener('click', () => this.goTo(i));\n this.selector.nextSibling.appendChild(BTN);\n }\n }",
"onAddVisitButtonPressed(event) {\n\t\tthis.showVisit();\n\t}",
"function enableNav(type) {\n\tswitch (type) {\n\t\tcase('back'):\n\t\t\tbackIsDim = false;\n\t\t\t$(shell.pageNav.backBtn).removeClass('dim');\n\t\t\t//$(shell.pageNav.backBtn).removeAttr('disabled');\n\t\t\t$(shell.pageNav.backBtn).css('cursor','pointer');\n\t\t\tif (scoNode.nodePrev.name == shell.menuJSONName) {\n\t\t\t\tdisableNav('back');\n\t\t\t} else {\n\t\t\t\tsetNav('back', scoNode.nodePrev.id, scoNode.nodePrev.name);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase('next'):\n\t\t\tnextIsDim = false;\n\t\t\t$(shell.pageNav.nextBtn).removeClass('dim');\n\t\t\t//$(shell.pageNav.nextBtn).removeAttr('disabled');\n\t\t\t$(shell.pageNav.nextBtn).css('cursor','pointer');\n\t\t\tif (scoNode.nodeNext.name == shell.menuJSONName) {\n\t\t\t\tdisableNav('next',true);\n\t\t\t} else {\n\t\t\t\tsetNav('next', scoNode.nodeNext.id, scoNode.nodeNext.name);\n\t\t\t}\n\t\t\tbreak;\n\t}\n}",
"function ELEMENT_ARROW_BUTTON$static_(){FavoritesToolbar.ELEMENT_ARROW_BUTTON=( FavoritesToolbar.BLOCK.createElement(\"arrow-button\"));}",
"function createEventNavBar() {\n $(\"#nav-bar\").html(\"\");\n for (let i = 0; i < events.length; i++) {\n let navBar = $('<button class = \"event-nav-bar nav-btn\"> </button>');\n // navBar.attr(\"href\", \"#\" + events[i]);\n navBar.attr(\"id\", \"ev-\" + parseInt(i));\n navBar.text(events[i]);\n $(\"#nav-bar\").append(navBar);\n navBar.css({ display: \"flex\" }, { \"flex-direction\": \"column\" });\n }\n}",
"function setupBtnsSensorSelect() {\n\n //add a click action listener to the select buttons\n $(\"#sidebar button.sensorNavBtn\").click(function () {\n var button = $(this);\n\n //check if this is already the current page loaded \n if (!button.hasClass(\"current\")) { //if not then\n loadContent(button.attr(\"data-graph-sensor\")); //load new page\n $(\"#sidebar button.current\").removeClass(\"current\"); //remove current from the previous button\n button.addClass(\"current\"); //add current to the button pressed\n }\n });\n}",
"function displayGraph(loanName) {\n let visuals = $(\".uiVisualizer\");\n visuals.each(function(index) {\n visuals[index].style.display = \"none\";\n });\n\n let prefix = null;\n switch (LoanM8.activeComponent) {\n case \"loanPaymentsGraphs\":\n prefix = \"payments-graph-\";\n break;\n case \"loanLifetimeTotalsGraphs\":\n prefix = \"lifetime-totals-graph-\";\n break;\n case \"loanLifetimeTotalsTables\":\n prefix = \"lifetime-totals-table-\";\n break;\n default:\n prefix = \"payments-graph-\";\n break;\n }\n id = prefix + loanName;\n document.getElementById(id).style.display = \"inline-block\";\n LoanM8.activeLoan = loanName;\n}",
"function includeNavigation() {\n app.getView().render('account/accountnavigation');\n}",
"createButton () {\n\n this.button = document.createElement('button')\n\n this.button.title = 'This model has multiple views ...'\n\n this.button.className = 'viewable-selector btn'\n\n this.button.onclick = () => {\n this.showPanel(true)\n }\n\n const span = document.createElement('span')\n span.className = 'fa fa-list-ul'\n this.button.appendChild(span)\n\n const label = document.createElement('label')\n this.button.appendChild(label)\n label.innerHTML = 'Views'\n \n this.viewer.container.appendChild(this.button)\n }",
"function GraphButton() {\n\t\tif(functionInput.value!=\"\"){\n\t\t// Clean the Console. For Debug Purposes\n\t\tconsole.clear(); \n\t\t\n\t\t// Clear Canvas\n\t\twipe(0);\n\t\t\n\t\t// Variables\n\t\tvar x = -1*Math.floor((vLines/2)+1); // Start From Very Left of Canvas\n\t\tvar y; // Declare Y Value variable\n\t\t\n\t\t// Make a \"Re-Formatter\" Function to Make the Function Input Evaluable by eval().\n\t\treformatted = Reformat(functionInput.value); // Reformatted Function Argument\n\t\t//alert(reformatted);\n\t\t\n\t\t// Print function input that the page actually evaluates.\n\t\tconsole.log(\"Graphing: \" + reformatted + \".\");\n\t\t\n\t\t// Locate Extrema\n\t\tfindExtrema();\n\t\tGraph(x,y,reformatted,\"blue\");\n\t\t\n\t\t\n\t\t// If Derivative Boxes Are Checked?\t\n\t\tif(firstDer.checked==true)\n\t\t\tfirstDerivative();\n\t\tif(secondDer.checked==true)\n\t\t\tsecondDerivative();\n\t\t}\n}",
"function displayAggregateTagWorkspaceButtons() {\n if($('ul#tagButtonList li').length > 0)\n\t$('div#aggregateTagButtons').show();\n else\n\t$('div#aggregateTagButtons').hide();\n}",
"function setNav(type, nodeId, title) {\n\t//alert(\"setNav\");\n\tvar targetEl, isDimmed, targetElId;\n\tswitch (type) {\n\t\tcase('back'):\n\t\t\ttargetElId = shell.pageNav.backBtn;\n\t\t\tisDimmed = backIsDim;\n\t\t\ttitle = \"Previous Page: \" + title;\n\t\t\tbreak;\n\t\tcase('next'):\n\t\t\ttargetElId = shell.pageNav.nextBtn;\n\t\t\tisDimmed = nextIsDim;\n\t\t\ttitle = \"Next Page: \" + title;\n\t\t\tbreak;\n\t\t}\n\ttargetEl = $(targetElId);\n\ttargetEl.attr('title',title);\n\ttargetEl.css('cursor','pointer');\n\ttargetEl.off('click');\n\t//console.log('made it ' + targetElId);\n\t$(targetElId).on('click',function() {\n\t\t//console.log('clicked '+ $(this).attr('id'));\n\t\tvar isDisabled = $(this).attr('disabled');\n\t\tif (!isDisabled) {\n\t\t\tloadPage(nodeId);\n\t\t}\n\t\treturn false;\n\t});\n\tif (isDimmed && shell.tracking.pagesVisited[shell.currPageNum-1] != 0) {\n\t\tenableNav(type);\n\t}\n}",
"function jvizToolNavbarBtn(obj)\n{\n\t//Check for undefined object\n\tif(typeof obj === 'undefined'){ var obj = {}; }\n\n\t//Button ID\n\tthis.id = (typeof obj.id !== 'undefined')? obj.id : '';\n\n\t//Button class\n\tthis.class = (typeof obj.class !== 'undefined')? obj.class : 'jvizFormBtn';\n\n\t//Button title\n\tthis.title = (typeof obj.title === 'undefined') ? 'Button' : obj.title;\n\n\t//Show button\n\tthis.show = true;\n\n\t//Element type\n\tthis.type = 'button';\n\n\t//Return the button\n\treturn this;\n}",
"function showToolBar(route){\n if(route.includes('pca')){\n document.querySelector('#pca-toolbar').classList.remove('hidden');\n document.querySelector('#hca-toolbar').classList.add('hidden');\n }else if(route.includes('hca')){\n document.querySelector('#hca-toolbar').classList.remove('hidden');\n document.querySelector('#pca-toolbar').classList.add('hidden');\n }\n}",
"defaultNavStyles() {\n const btnElements = document.getElementsByClassName(\"actionNavs\");\n Array.prototype.forEach.call(btnElements, function (element) {\n element.style.backgroundColor = \"slategray\";\n element.style.color = \"white\";\n });\n const actionElements = document.getElementsByClassName(\"methods\");\n Array.prototype.forEach.call(actionElements, function (action) {\n action.style.display = \"none\";\n });\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function moves workToMove to the top of the list of recdent work that can be edited, which will be reflected on the welcome page. | moveWorkToTop(workToMove) {
// REMOVE THE WORK IF IT EXISTS
this.removeWork(workToMove);
// AND THEN ADD IT TO THE TOP OF THE STACK
this.prependWork(workToMove);
} | [
"function moveContinueWatchingToTop() {\n\t\tvar $continueWatching = getSectionByType('continueWatching');\n\t\t\n\t\tgetContainers().$mainView.prepend($continueWatching);\n\t}",
"function moveMyListToTop() {\n\t\tvar $myList = getSectionByType('queue');\n\t\t\n\t\tgetContainers().$mainView.prepend($myList);\n\t}",
"makeMove(toStackId) {\n this.moveItem(this.find_stack_by_contents(this.currently_dragged),\n this.find_stack_by_id(toStackId))\n }",
"function moveLegTop(){\n if(leg.moveDone){\n // reset motion\n leg.vy=0;\n leg.move1=false;\n leg.move3=false;\n\n // paw facing down\n // invert shapes\n leg.paw=-abs(leg.paw);\n leg.h=-abs(leg.h);\n leg.extend=-abs(leg.extend);\n // set position\n legStartPos=-200;\n // start motion\n leg.move3=true;\n leg.moveDone=false;\n\n }\n}",
"function masterMover(moveIndex){\n $('#person' + oldActiveIndex).stop(true, true);\n $('#person' + activeIndex).stop(true, true);\n moveIndex();\n updateDom();\n updateIndexPoint();\n}",
"function moveBack() { //return the items to initial state\n document.getElementById(clickedItems[0]).style.backgroundColor = \"\";\n document.getElementById(clickedItems[1]).style.backgroundColor = \"\";\n clickedItems = []; //once items are compared they may be removed from clickedItems array\n ++moveNumber;\n document.getElementById(\"moveId\").innerHTML = \"Move \" + moveNumber; //update move number\n\n let gridItems3 = document.querySelectorAll(\".grid-item\");\n gridItems3.forEach((element, index) => {\n element.style.pointerEvents = \"auto\"; // after checking procedure enable clicking on items\n });\n }",
"function ksfHelp_mainTourBegin()\n{\n\tif(ksfHelp_mainTour.ended())\n\t{\n\t\tksfHelp_mainTour.restart();\n\t}\n\tksfHelp_mainTourResize();\n}",
"function revertMove () {\n if ((turnHistory.length > 0 && difficultyLevel === 0) || (turnHistory.length > 1 && difficultyLevel > 0)) {\n let iteration = 1;\n if (difficultyLevel > 0) {\n iteration = 2;\n\n if (!isStarted && currentTurn === -1) {\n iteration = 1;\n changeTurn();\n }\n } else {\n changeTurn();\n }\n if (!isStarted) isStarted = true;\n\n for (let i = 0; i < iteration; i++) {\n const lastPosition = turnHistory.pop();\n unmarkField(lastPosition);\n selectedArray[lastPosition] = 0;\n }\n turnCounter -= iteration;\n } else {\n toggleErrorMessage('Derzeit sind nicht genug Felder belegt um etwas Rückgängig zu machen.');\n }\n }",
"moveStyles() {\n document\n .getElementById(`${this.previousHeadPosition}`)\n .classList.remove(snakeOccupiedSpaceStyle);\n document\n .getElementById(`${this.currentHeadPosition}`)\n .classList.add(snakeOccupiedSpaceStyle);\n }",
"moveAround() {\r\n\r\n\r\n }",
"function addPrevMoveButton(mList, mPlayer) {\n var $list = $('#moves_list');\n var $item = $('<li>', { 'id': 'move_' + mList.length });\n var $button = $('<button>', { 'class': 'prev_move', 'text': 'Go to Move #' + mList.length });\n var copyList = $.extend(true, [], mList);\n copyList.pop(); // remove the last move in moves list because we want to jump back to it and replay it\n $button.data({ 'list': copyList, 'player': mPlayer });\n $button.on('click', clickPrevMoveButton);\n $item.append($button);\n $list.append($item);\n }",
"moveTaskBack(task) {\n const index = this.state.tasksDone.indexOf(task);\n this.state.tasksDone.splice(index, 1);\n this.state.toDoTasks.unshift(task);\n this.setState({toDoTasks: this.state.toDoTasks,\n tasksDone: this.state.tasksDone\n })\n }",
"function moveMiddle () {\n console.log('│ current index is ' + search_keybindings_currentIndex)\n var mid = Math.floor(search_keybindings_resultLinks.length / 2)\n\n search_keybindings_currentIndex = mid\n console.log('└ targeting ' + search_keybindings_currentIndex)\n selectResult(search_keybindings_currentIndex)\n}",
"moveToStartingPosition() {\r\n this.currentLocation.x = this.startingPosition.x;\r\n this.currentLocation.y = this.startingPosition.y;\r\n }",
"moveItem(fromStack, toStack, thisMoveCounter){\n toStack.add_item(fromStack.top_item())\n fromStack.remove_item()\n $(toStack.id).prepend($(fromStack.id).children()[0])\n if (thisMoveCounter) {\n $(\"#counter\").text(\"Move Counter: \"+thisMoveCounter)\n }\n else {\n $(\"#counter\").text(\"Move Counter: \"+this.counter)\n this.counter += 1\n }\n $(\"#moves\").prepend(\"<div>\"+toStack.top_item()+\" from \"+fromStack.id+\" to \"+toStack.id+\"</div>\")\n $(fromStack.id).css(\"background-color\", \"white\")\n if (toStack.current_set.length === this.total && toStack !== this.board[0]){\n $(toStack.id).css(\"background-color\", \"lightgreen\")\n }\n else {\n $(toStack.id).css(\"background-color\", \"white\")\n }\n }",
"function backToHomeFromEditBill() {\n /* If came from search biller then addBill will be true and on back will move to search biller*/\n if (addBill) {\n \tnavigateToBillerSearch(false);\n } else {\n \tnavigateToHome();\n }\n clearIntervalApp(addEditBillerCountdown);\n}",
"function initSortable() {\n var originalIndex;;\n _list.sortable({\n start: (event, ui) => {\n originalIndex = ui.item.index();\n },\n update: (event, ui) => {\n chrome.tabs.move(_tabs[originalIndex].id, {index: ui.item.index()});\n }\n });\n}",
"function move(currentorder)\n\n/** \n * Every if of the function, checks the value of the objetct direction(string). First step is check where is looking the Rover.\nSedcond step is depending on where is looking the Rover, the function will ++ or -- a position into the Rover coordinates. \nOr change the value of the object direction.\n */ \n{\n if (Myrover.direction === 'up') {\n\n switch (currentorder) {\n case 'f':\n Myrover.position.x++\n break;\n case 'r':\n Myrover.direction = 'right';\n return;\n break;\n case 'b':\n Myrover.position.x--\n break;\n case 'l':\n Myrover.direction = 'left'\n return;\n break;\n };\n };\n\n\n if (Myrover.direction === 'right') {\n switch (currentorder) {\n case 'f':\n Myrover.position.y++\n break;\n case 'r':\n Myrover.direction = 'down';\n return;\n break;\n case 'b':\n Myrover.position.y--\n break;\n case 'l':\n Myrover.direction = 'up';\n return;\n break;\n };\n };\n\n if (Myrover.direction === 'down') {\n switch (currentorder) {\n case 'f':\n Myrover.position.x--\n break;\n case 'r':\n Myrover.direction = 'left'\n return;\n break;\n case 'b':\n Myrover.position.x++\n break;\n case 'l':\n Myrover.direction = 'right'\n return;\n break;\n };\n };\n\n if (Myrover.direction === 'left') {\n switch (currentorder) {\n case 'f':\n Myrover.position.y--\n break;\n case 'r':\n Myrover.direction = 'up'\n return;\n break;\n case 'b':\n Myrover.position.y++\n break;\n case 'l':\n Myrover.direction = 'down'\n return;\n break;\n };\n };\n}",
"goToPreviousNewComment() {\n if (cd.g.autoScrollInProgress) return;\n\n const commentInViewport = Comment.findInViewport('backward');\n if (!commentInViewport) return;\n\n // This will return invisible comments too in which case an error will be displayed.\n const comment = reorderArray(cd.comments, commentInViewport.id, true)\n .find((comment) => comment.newness && comment.isInViewport(true) !== true);\n if (comment) {\n comment.$elements.cdScrollTo('center', true, () => {\n comment.registerSeen('backward', true);\n this.updateFirstUnseenButton();\n });\n }\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The tree of nodes associated with the current `LView`. The nodes have been normalized into a tree structure with relevant details pulled out for readability. | get nodes() {
const lView = this._raw_lView;
const tNode = lView[TVIEW].firstChild;
return toDebugNodes(tNode, lView);
} | [
"get tree() {\n return this.buffer ? null : this._tree._tree\n }",
"tree(tree) {\n if (tree) {\n this._tree = tree;\n }\n return this._tree;\n }",
"buildTree() {\n this.clear();\n\n const columnsCount = this.#sourceSettings.getColumnsCount();\n let columnIndex = 0;\n\n while (columnIndex < columnsCount) {\n const columnSettings = this.#sourceSettings.getHeaderSettings(0, columnIndex);\n const rootNode = new TreeNode();\n\n this.#rootNodes.set(columnIndex, rootNode);\n this.buildLeaves(rootNode, columnIndex, 0, columnSettings.origColspan);\n\n columnIndex += columnSettings.origColspan;\n }\n\n this.rebuildTreeIndex();\n }",
"get nodelist() {\n\t\treturn this.nodes.values();\n\t}",
"get tree() {\n let syntax = this.facet(EditorState.syntax);\n return syntax.length ? syntax[0].getTree(this) : Tree.empty;\n }",
"buildTree() {\n if (!this.drawnAnnotations.length && !this.annosToBeDrawnAsInsets.size) {\n // Remove all exlisting clusters\n this.areaClusterer.cleanUp(new KeySet());\n return;\n }\n\n // if (this.newAnno) this.tree.load(this.drawnAnnotations);\n\n this.createInsets();\n }",
"getData() {\n const { tree, props } = this\n const { root } = props\n\n /* Create a new root, where each node contains height, depth, and parent.\n * Embeds the old node under the data attribute of the new node */\n const rootHierarchy = d3.hierarchy(\n root,\n (d) => d.children && Object.values(d.children)\n )\n\n /* Adds x, y to each node */\n tree(rootHierarchy)\n\n /* Return the array of nodes */\n const data = rootHierarchy.descendants()\n\n /* Use fixed depth to maintain position as items are added / removed */\n data.forEach((d) => {\n d.y = d.depth * 180\n })\n return data\n }",
"function TreeListNodesRequest() {\n _classCallCheck(this, TreeListNodesRequest);\n\n _defineProperty(this, \"Node\", undefined);\n\n _defineProperty(this, \"Recursive\", undefined);\n\n _defineProperty(this, \"Ancestors\", undefined);\n\n _defineProperty(this, \"WithVersions\", undefined);\n\n _defineProperty(this, \"WithCommits\", undefined);\n\n _defineProperty(this, \"Limit\", undefined);\n\n _defineProperty(this, \"Offset\", undefined);\n\n _defineProperty(this, \"FilterType\", undefined);\n }",
"function dist_syntaxTree(state) {\n let field = state.field(Language.state, false)\n return field ? field.tree : dist_Tree.empty\n }",
"function wrapTree(target){ \n\t\tvar tree = $(target); \n\t\ttree.addClass('tree'); \n\t\t \n\t\twrapNode(tree, 0); \n\t\t \n\t\tfunction wrapNode(ul, depth){ \n\t\t\t$('>li', ul).each(function(){ \n\t\t\t\tvar node = $('<div class=\"tree-node\"></div>').prependTo($(this)); \n\t\t\t\tvar text = $('>span', this).addClass('tree-title').appendTo(node).text(); \n\t\t\t\t$.data(node[0], 'tree-node', { \n\t\t\t\t\ttext: text \n\t\t\t\t}); \n\t\t\t\tvar subTree = $('>ul', this); \n\t\t\t\tif (subTree.length){ \n\t\t\t\t\t$('<span class=\"tree-folder tree-folder-open\"></span>').prependTo(node); \n\t\t\t\t\t$('<span class=\"tree-hit tree-expanded\"></span>').prependTo(node); \n\t\t\t\t\twrapNode(subTree, depth+1); \n\t\t\t\t} else { \n\t\t\t\t\t$('<span class=\"tree-file\"></span>').prependTo(node); \n\t\t\t\t\t$('<span class=\"tree-indent\"></span>').prependTo(node); \n\t\t\t\t} \n\t\t\t\tfor(var i=0; i<depth; i++){ \n\t\t\t\t\t$('<span class=\"tree-indent\"></span>').prependTo(node); \n\t\t\t\t} \n\t\t\t}); \n\t\t} \n\t\treturn tree; \n\t}",
"function createTree(){\n var colCount=0;\n head.find(selectors.row).first().find(selectors.th).each(function () {\n var c = parseInt($(this).attr(attributes.span));\n colCount += !c ? 1 : c;\n });\n\n root = new Node(undefined,colCount,0);\n var headerRows = head.find(selectors.row);\n var currParents = [root];\n // Iteration through each row\n //-------------------------------\n for ( var i = 0; i < headerRows.length; i++) {\n\n var newParents=[];\n var currentOffset = 0;\n var ths = $( headerRows[i] ).find(selectors.th);\n\n // Iterating through each th inside a row\n //---------------------------------------\n for ( var j = 0 ; j < ths.length ; j++ ){\n var colspan = $(ths[j]).attr(attributes.span);\n colspan = parseInt( !colspan ? '1' : colspan);\n var newChild = 0;\n\n // Checking which parent is the newChild parent (?)\n // ------------------------------------------------\n for( var k = 0 ; k < currParents.length ; k++){\n if ( currentOffset < currParents[k].colspanOffset + currParents[k].colspan ){\n var newChildId = 'cm-'+i+'-'+j+'-'+k ;\n $(ths[j]).addClass(currParents[k].classes);\n $(ths[j]).addClass(currParents[k].id);\n $(ths[j]).attr(attributes.id, newChildId);\n \n newChild = new Node( currParents[k], colspan, currentOffset, newChildId );\n tableNodes[newChild.id] = newChild;\n currParents[k].addChild( newChild );\n break;\n }\n }\n newParents.push(newChild);\n currentOffset += colspan;\n }\n currParents = newParents;\n }\n\n var thCursor = 0;\n var tdCursor = 0;\n var rows = body.find(selectors.row);\n var tds = body.find(selectors.td);\n /* Searches which 'parent' this cell belongs to by \n * using the values of the colspan */\n head.find(selectors.row).last().find(selectors.th).each(function () {\n var thNode = tableNodes[$(this).attr(attributes.id)];\n thCursor += thNode.colspan;\n while(tdCursor < thCursor) {\n rows.each(function () {\n $(this).children().eq(tdCursor).addClass(thNode.classes + ' ' + thNode.id);\n });\n tdCursor += $(tds[tdCursor]).attr(attributes.span) ? $(tds[tdCursor]).attr(attributes.span) : 1;\n }\n });\n\n /* Transverses the tree to collect its leaf nodes */\n var leafs=[];\n for ( var node in tableNodes){\n if ( tableNodes[node].children.length === 0){\n leafs.push(tableNodes[node]);\n }\n }\n /* Connects the last row of the header (the 'leafs') to the first row of the body */\n var firstRow = body.find(selectors.row).first();\n for ( var leaf = 0 ; leaf < leafs.length ; leaf++){\n firstRow.find('.' + leafs[leaf].id ).each(function(index){\n var newNode = new Node( leafs[leaf] , 1 , 0, leafs[leaf].id + '--' + leaf + '--' + index);\n newNode.DOMelement = $(this);\n leafs[leaf].addChild(newNode);\n tableNodes[newNode.id] = newNode;\n newNode.DOMelement.attr(attributes.id, newNode.id);\n });\n }\n }",
"get topNode() {\n return new TreeNode(this, 0, 0, null)\n }",
"rebuildTreeIndex() {\n let columnIndex = 0;\n\n this.#rootsIndex.clear();\n\n arrayEach(this.#rootNodes, ([, { data: { colspan } }]) => {\n // Map tree range (colspan range/width) into visual column index of the root node.\n for (let i = columnIndex; i < columnIndex + colspan; i++) {\n this.#rootsIndex.set(i, columnIndex);\n }\n\n columnIndex += colspan;\n });\n }",
"function buildUlTree(tree)\n{\n\tvar unordered_list = '';\n\tfor (node in tree)\n\t{\n\t\tnode = tree[node];\n\t\t\n\t\tunordered_list += '<ul style=\"margin-bottom: 0\">';\n\t\tunordered_list += println(node['title']);\n\t\tif(node['children'])\n\t\t{\n\t\t\tunordered_list += buildUlTree(node['children']);\n\t\t}\n\t\tunordered_list += '</ul>';\n\t}\n\treturn unordered_list;\n}",
"function itemTree() {\n return col('col-12 col-xl-3', \n div('itemTree', itemTreeTitle() + '<hr>' + itemTreeChange() + '<hr>' + itemTreeTree() + '<hr>' + itemTreeAdd())\n )\n}",
"function ReposOwnerRepoGitTreesTree() {\n _classCallCheck(this, ReposOwnerRepoGitTreesTree);\n\n ReposOwnerRepoGitTreesTree.initialize(this);\n }",
"function TreeObject(_ref) {\n var path = _ref.path,\n tree = _ref.tree,\n url = _ref.url,\n selected = _ref.selected,\n pathSelected = _ref.pathSelected,\n onBlob = _ref.onBlob,\n depth = _ref.depth,\n filepath = _ref.filepath,\n comparer = _ref.comparer;\n var classes = useStyles();\n\n var _filepath = _path.default.join(filepath || '', path);\n\n var icon = selected ? /*#__PURE__*/_react.default.createElement(_icons.Folder, null) : /*#__PURE__*/_react.default.createElement(_icons.FolderOpen, null);\n return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.ListItem, {\n button: true,\n selected: selected,\n className: classes.root,\n style: {\n paddingLeft: depth + 'em'\n }\n }, /*#__PURE__*/_react.default.createElement(_core.ListItemIcon, {\n style: {\n marginRight: 0\n }\n }, icon), /*#__PURE__*/_react.default.createElement(_core.ListItemText, {\n className: classes.pathText,\n primary: path + '/'\n })), /*#__PURE__*/_react.default.createElement(_.Tree, {\n pathSelected: pathSelected,\n tree: tree,\n url: url,\n selected: selected,\n onBlob: onBlob,\n depth: depth + 1,\n filepath: _filepath,\n comparer: comparer\n }));\n}",
"tree() {\n return trie;\n }",
"function initTreeView(){\n\n\t\tFS.root.on('added:node', function(parent, node){\n\n\t\t\tif( node.type == 'folder'){\n\t\t\t\tvar treeNode = new UIBase.Tree.Folder(node.name);\n\t\t\t\t\n\t\t\t\ttreeNode.icon = 'icon-project-folder icon-small';\n\t\t\t}else{\n\t\t\t\tvar treeNode = new UIBase.Tree.File(node.name);\n\n\t\t\t\tif( node.data.getThumb ){\n\t\t\t\t\t// use asset thumb\n\t\t\t\t\tvar base64Src = node.data.getThumb(20);\n\t\t\t\t\tvar image = new Image();\n\t\t\t\t\timage.src = base64Src;\n\t\t\t\t\timage.className = 'asset-thumb-'+node.data.type;//for default asset thumb\n\t\t\t\t\ttreeNode.icon = image;\n\t\t\t\t}else{\n\t\t\t\t\ttreeNode.icon = 'icon-project-file icon-small';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(node.data){\n\t\t\t\ttreeNode.dataSource = node.getPath();\t\t\t\t\t\t\t\t\t\n\t\t\t\ttreeNode.dataType = node.data.type;\n\t\t\t}\n\t\t\ttreeView.find( parent.getPath() ).add( treeNode, true);\n\t\t})\n\t\tFS.root.on('moved:node', function(parent, parentPrev, node){\n\t\t\t\n\t\t\tvar nodePrevPath = parentPrev.getPath() + '/' + node.name;\n\t\t\tvar treeNode = treeView.find( nodePrevPath );\n\t\t\tif( ! treeNode){\n\t\t\t\tconsole.warn( 'node '+nodePrevPath+' not exist in the project tree');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\ttreeView.find( parent.getPath() ).add( treeNode, true);\n\t\t})\n\t\tFS.root.on('removed:node', function(parent, node){\n\t\t\t\n\t\t\ttreeView.remove(node.getPath());\n\t\t})\n\t\tFS.root.on('updated:name', function(node, name){\n\n\t\t\tvar treeNode = treeView.find(node.getPath());\n\t\t\tif( ! treeNode){\n\t\t\t\tconsole.warn( 'node '+node.getPath()+' not exist in the project tree');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttreeNode.setName(name, true);\n\t\t})\n\t\ttreeView.on('added:node', function(parent, node){\n\n\n\t\t})\n\t\ttreeView.on('moved:node', function(parent, parentPrev, node){\n\n\t\t\tvar nodePrevPath = parentPrev.getPath() + '/' + node.name;\n\t\t\tvar fsNode = FS.root.find(nodePrevPath);\n\t\t\tif( ! fsNode){\n\t\t\t\tconsole.warn( 'file '+nodePrevPath+' not exist in the project');\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tFS.root.find(parent.getPath()).add(fsNode, true);\n\t\t})\n\t\ttreeView.on('removed:node', function(parent, node){\n\n\t\t})\n\t\ttreeView.on('click:node', function(node){\n\t\t\tvar fsNode = FS.root.find( node.getPath() );\n\t\t\tif( ! fsNode){\n\t\t\t\tconsole.warn( 'file '+nodePrevPath+' not exist in the project');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// inspect asset properties\n\t\t\tif(fsNode.data){\n\t\t\t\thub.trigger('inspect:object', fsNode.data.getConfig() );\n\t\t\t}\n\t\t})\n\t}",
"function Tree(location, scales) {\n\tthis.trs = mult(translate(location), scalem(scales));\n\tthis.type = TREETYPES[++treeTypeCount];\n\tif(treeTypeCount == 4){\n\t\ttreeTypeCount = 0;\n\t}\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Input: a string strng an array of strings arr Output of function contain_all_rots(strng, arr) (or containAllRots or containallrots): a boolean true if all rotations of strng are included in arr (C returns 1) false otherwise (C returns 0) Examples: contain_all_rots( "bsjq", ["bsjq", "qbsj", "sjqb", "twZNsslC", "jqbs"]) > true contain_all_rots( "Ajylvpy", ["Ajylvpy", "ylvpyAj", "jylvpyA", "lvpyAjy", "pyAjylv", "vpyAjyl", "ipywee"]) > false) Note: Though not correct in a mathematical sense we will consider that there are no rotations of strng == "" and for any array arr: contain_all_rots("", arr) > true | function containAllRots(strng, arr) {
let copyStr = strng
let letter = ""
let restOfStr = ""
let final = ""
for (let i = 0; i < strng.length; i++) {
if (arr.includes(copyStr)) {
letter = copyStr[0]
restOfStr = copyStr.substring(1)
copyStr = restOfStr + letter
} else {
return false
}
}
} | [
"function includesOneOf(str, arr) {\n for (let i = 0; i < arr.length; i++) {\n if (str.includes(arr[i])) return true;\n }\n return false;\n}",
"function containsAny(str, arr){\n\tif(str == null){\n\t\treturn false;\n\t}\n\treturn arr.map(function(elem){\n\t\treturn str.toLowerCase().indexOf(elem.toLowerCase());\n\t}).some(function(elem){\n\t\treturn elem > -1;\n\t});\n}",
"function allStringsPass(strings, test) {\n // YOUR CODE BELOW HERE //\n // I = array of strings and test function\n // O = Boolean\n // C = ALL strings must pass to return true\n // use for loop to loop through entire array of strings\n // pass strings into test function\n // test with if condition to see if any strings do not pass and return false\n \n for (var i = 0; i < strings.length; i++) { \n var resultTest = test(strings[i]);\n if(resultTest === false) {\n return false;\n }\n }\n return true;\n}",
"function arraySubstring(words, str) {\n const result = [];\n for( let i = 0; i < words.length; i++) {\n if (words[i].includes(str)) {\n result.push(true);\n } else {\n result.push(false);\n }\n }\n return result;\n}",
"function inBox(arr) {\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tfor (let j = 0; j < arr[i].length; j++) {\n\t\t\tif (arr[i][j] === \"*\") {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n}",
"function isRotation(arrA, arrB) {\n let pB = 0,\n shiftedElems = [];\n\n if (arrA.length !== arrB.length) // arrays aren't of same length\n return false;\n\n // look for first matching element in arrB\n while (arrB[pB] !== arrA[0] && pB < arrB.length) {\n shiftedElems.push(arrB[pB]);\n pB++;\n }\n\n if (pB === arrB.length - 1) // no matching element found\n return false;\n\n arrB = [...arrB.slice(pB), ...shiftedElems];\n\n return arrA.join('') === arrB.join('');\n}",
"function FindIntersection(strArr) {\n let intersection = [];\n\n strArr[0].split(\", \").forEach((char0) => {\n strArr[1].split(\", \").forEach((char1) => {\n if (char0 === char1) intersection.push(char1);\n });\n });\n\n if (intersection.length === 0) return false;\n else return intersection;\n}",
"function onlyIncludes(array, str) {\n return array.filter(el => el.includes(str));\n}",
"function w3_ext_param_array_match_str(arr, s, func)\n{\n var found = false;\n arr.forEach(function(a_el, i) {\n var el = a_el.toString().toLowerCase();\n //console.log('w3_ext_param_array_match_str CONSIDER '+ i +' '+ el +' '+ s);\n if (!found && el.startsWith(s)) {\n //console.log('w3_ext_param_array_match_str MATCH '+ i);\n if (func) func(i, a_el.toString());\n found = true;\n }\n });\n return found;\n}",
"function substrMatchAny(substrs,items)\n{\n for (var i = 0; i < substrs.length; ++i)\n if (! matchAny(substrs[i],items))\n return false;\n return true;\n}",
"function costas_verify ( array ){\n var result;\n var diff_array = array_diff_vector( array );\n var array_set = set_of_values( array );\n var diff_array_set = set_of_values( diff_array );\n //console.log( 'diff_array length', diff_array.length );\n //console.log( 'diff_array_set length', diff_array_set.length );\n return ( diff_array.length === diff_array_set.length && array_set.length === array.length );\n}",
"function verificaArray (elemento, array) {\r\n var inclusoArray = false;\r\n\r\n for (var count = 0; count < array.length; count++) {\r\n if (elemento === array[count]) {\r\n inclusoArray = true;\r\n }\r\n }\r\n\r\n return inclusoArray;\r\n}",
"function XO(str) {\n let format = str.toLowerCase()\n\tlet x = format.match(/x/gi), o = format.match(/o/gi);\n let arr = format.split('')\n \n\tif (arr.includes('x') && arr.includes('o')) {\n\t\tif (x.length === o.length) {\n return true\n } else {\n return false\n }\n } else if (arr.includes('x') && !arr.includes('o')) {\n return false\n } else if (!arr.includes('x') && arr.includes('o')) {\n return false\n } else if (!arr.includes('x') && !arr.includes('o')) {\n return true\n }\n}",
"function isFinder( arr ){\n var hasIs = [];\n var noIs = [];\n arr.forEach( function( word ){\n if ( word.test( /\\w*is\\w*/ ) === true ){\n hasIs.push( word );\n } else {\n noIs.push( word );\n }\n });\n return hasIs;\n}",
"function canAlternate(s) {\n\tlet a = 0;\n\tlet b = 0;\n\t\n\tfor (let i = 0; i < s.length; i++) {\n\t\tif (s[i] === \"1\") {\n\t\t\ta++;\n\t\t} else b++;\n\t}\n\t\n\treturn a === b - 1 || a === b + 1 || a === b;\n}",
"function verifyIfExists(data, array) {\n //If the given data is an array\n if (data.constructor === Array) {\n // console.log(data);\n // console.log(array);\n\n let count = 0;\n\n //Verifies if any of the data content is equal to the data in the given array\n for (let i = 0; i < data.length; i++) {\n for (let j = 0; j < array.length; j++) {\n if (typeof(data[i]) == \"object\" && typeof(array[j]) == \"object\") {\n if (data[i].name == array[j].name) {\n count++;\n }\n }\n else if (typeof(data[i]) == \"string\" && typeof(array[j]) == \"object\") {\n if (data[i] == array[j].name) {\n count++;\n }\n }\n else if (typeof(data[i]) == \"string\" && typeof(array[j]) == \"string\") {\n if (data[i] == array[j]) {\n count++;\n }\n }\n else if (data[i].name == array[j]) {\n count++;\n }\n }\n }\n if (count == data.length) {\n return true;\n }\n else {\n return false;\n }\n }\n //If the given data is not an array\n else {\n \n for (let i = 0; i < array.length; i++) {\n if (typeof(array[i]) == \"object\" && array[i].name == data) {\n return true;\n }\n else if (array[i] == data) {\n return true;\n }\n \n }\n return false;\n }\n}",
"function mutation(arr) {\n var first = arr[0].toLowerCase();\n var second = arr[1].toLowerCase();\n \n for(var i = 0; i < second.length; i++){\n if(first.indexOf(second.charAt(i)) == -1){\n return false;\n }\n }\n \n return true;\n}",
"function lostCarcosa (input) {\n return input.some(x => x.includes('Lost'));\n}",
"isAll(...roles) {\n\t\treturn Roles.coerceRoleArray(roles).every(role => this.is(role));\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
render pup to dog bar function | function renderPup(pup){
let divTag = document.getElementById("dog-bar")
divTag.innerHTML += `<span data-id=${pup.id}>${pup.name}</span>`
} | [
"function loadAllPups(pup) {\n const dogBar = document.getElementById('dog-bar')\n const dogNameButton = document.createElement('span')\n dogNameButton.innerText = pup.name\n dogNameButton.dataset.id = pup.id\n dogNameButton.style.cursor = \"pointer\"\n dogBar.appendChild(dogNameButton)\n\n // challenge 2: when a user clicks on a dog's name, that pup's info should show up in the dog info section\n dogNameButton.addEventListener(\"click\", onDogNameClick)\n}",
"get barParts() {\n return this.barFill ? 'bar' : 'bar bar-zero';\n }",
"function displayTrainersPokemon(pokemons) {\n let pokeHTML = pokemons.map(pokemon => {\n // for every pokemon in the pokemon array //\n // map over each pokemon and set it equal to the local variable pokeHTML //\n return `\n <li id=\"pokemon ${pokemon.id}\">${pokemon.nickname} (${pokemon.species}) <button class=\"release\" data-pokemon-id=\"${pokemon.id}\">Release</button></li>\n `\n // return the string of HTML with the interpolated pokemon data //\n // for each pokemon in the array that we've mapped over\n })\n // console.log('HTML', pokeHTML);\n return pokeHTML.join('')\n // return a joined string of HTML\n }",
"function renderAllPups(){getPups().then(pups => {\n pups.forEach(pup => {\n renderPup(pup)\n })\n })}",
"function pokemonImage(pokemon){\n\n}",
"function displayPaddle(paddle) {\n rect(paddle.x, paddle.y, paddle.w, paddle.h);\n}",
"function displayPaddle(paddle) {\n // Draw the paddles\n push();\n fill(paddle.paddleColourR,paddle.paddleColourG,paddle.paddleColourB);\n rect(paddle.x, paddle.y, paddle.w, paddle.h);\n pop();\n}",
"function bar(){\n push();\n fill(50);\n noStroke();\n\n // draw centerBar\n rect(\n width/2,\n height/2,\n centerBar.width,\n centerBar.height,\n centerBar.round,\n );\n\n // draw centerBar text\n fill(100);\n textSize(centerBar.height*0.4);\n textAlign(LEFT, CENTER);\n text(stationName, 100, height/2);\n\n // draw platform number badges and text\n var alternate = [-1, 1, -1, 1];\n textSize(40);\n textAlign(CENTER, CENTER);\n for (i = 0; i < qtyPlatforms; i++){\n //badges\n fill(75);\n stroke(15);\n strokeWeight(5);\n ellipse( space * (i+1) + offset, height/2- (centerBar.height/2*alternate[i]), 60);\n\n // text\n noStroke();\n fill(15);\n text((i+1).toString(), space * (i+1) + offset, height/2- (centerBar.height/2*alternate[i]));\n }\n\n pop();\n}",
"function longBurp(num) {\n\treturn `Bu${'r'.repeat(num)}p`;\n}",
"barMethod() {\n const wide = Math.abs(this.props.qual.score / 10.0).toString() + \"vw\";\n const color = this.props.qual.color;\n let style1 = {\n width: wide,\n backgroundColor: color,\n paddingTop: \"0.3vw\",\n paddingBottom: \"0.3vw\"\n };\n\n let style3 = {\n marginLeft: \"6vw\"\n };\n\n let style4 = {\n marginRight: \"1vw\"\n };\n\n let right = {\n borderRight: \"1px dashed\",\n borderLeftStyle: \"hidden\",\n borderTopStyle: \"hidden\",\n borderBottomRightStyle: \"dashed\",\n borderRightColor: \"black\",\n color: \"white\"\n };\n\n let left = {\n borderLeft: \" 1px dashed\",\n borderRightStyle: \"hidden\",\n borderTopStyle: \"hidden\",\n borderBottomLeftStyle: \"dashed\",\n borderLeftColor: \"black\",\n color: \"white\"\n };\n\n if (this.props.qual.score > 0) {\n return (\n <div className=\"dot-line\" style={style3}>\n <div style={right}>|</div>\n <div className=\"bar\" style={style1} />\n </div>\n );\n }\n return (\n <div className=\"dot-line\" style={style4}>\n <div className=\"bar\" style={style1} />\n <div style={left}>|</div>\n </div>\n );\n }",
"function renderAllPokemon(pokemons){\n const pokemonContainer = document.querySelector(\"#pokemon-container\");\n pokemonContainer.innerHTML = \"\";\n pokemons.forEach(renderSinglePokemon);\n}",
"function showdown(p1, p2) {\n\tconst a1 = p1.split('Bang!')[0].length;\n\tconst a2 = p2.split('Bang!')[0].length;\n\treturn a1 < a2 ? 'p1' : a1 > a2 ? 'p2' : 'tie';\n}",
"drawBlood() {\n log(LogLevel.DEBUG, 'TileSplat drawBlood');\n for (let i = 0; i < this.data.drips.length; i++) {\n const drip = this.data.drips[i];\n const text = new PIXI.Text(drip.glyph, this.style);\n text.x = drip.x;\n text.y = drip.y;\n text.pivot.set(drip.width / 2, drip.height / 2);\n text.angle = drip.angle;\n this.tile.addChild(text);\n }\n }",
"function createTooltipsAtIndex(index, currOffset, bar) {\n var bottomDiv = document.createElement(\"div\");\n bottomDiv.className = \"bottom-div\";\n\n var topDiv = document.createElement(\"div\");\n topDiv.className = \"top-div\";\n\n bar.appendChild(bottomDiv);\n bar.appendChild(topDiv);\n var barSVG = getBarSVGAtIndex(index);\n\n // TODO improve performance by building the SVG like the above\n var voteArrowsSVG = $('<div><svg class=\"upvote\" width=\"20\" height=\"20\">'+\n '<polygon class=\"vote-polygon\" points=\"0, 20 10, 0 20, 20\" />'+\n '</svg><span style=\"position: absolute; margin-left: 5px; margin-top:15px;\">Vote</span></div>'+\n '<div style=\"padding-top: 5px;\"><svg class=\"downvote\" width=\"20\" height=\"20\">'+\n '<polygon class=\"vote-polygon\" points=\"0, 0 20, 0 10, 20\" />'+\n '</svg></div>');\n\n $(topDiv).tooltipster({\n content: $(voteArrowsSVG),\n offsetX: currOffset,\n offsetY: $(chartDiv).height() - barSVG.getBoundingClientRect().height - 61/2,\n interactive: true,\n autoClose: false,\n position: \"top\",\n theme: \"tooltipster-invisible\"\n });\n\n \n $(bottomDiv).tooltipster({\n content: $(\"<span>\" + barBaseLabels[index] + \" \" + roundNumber(options.categoryScores[index + 1], 2) + \"</span>\"),\n offsetX: $(chartDiv).position().left + ($(chartDiv).width() / 2), //currOffset\n offsetY: $(chartDiv).position().top + $(chartDiv).height() - 10,\n position: \"bottom\",\n theme: \"tooltipster-invisible\"\n });\n }",
"function renderDogs() {\n fetchDogs()\n .then((dogs) => dogs.forEach(dog => {\n renderDog(dog);\n }));\n}",
"function createFemaleAndMaleDognut(population_of_male, population_of_female){\n let female_and_male_ctx = document.getElementById(\"dognut-chart\");\n\n //feed chart with data\n let female_and_male_chart = new Chart(female_and_male_ctx, {\n type: \"doughnut\",\n data: {\n datasets: [{\n label: '# of Votes',\n data: [population_of_male, population_of_female],\n backgroundColor: [\n \"#B1D2C2\",\n \"#F0F2EF\"\n ]\n }],\n labels: [\"Male\", \"Female\"],\n }\n \n })\n}",
"function display_pet_page() {\n str = '';\n for (i = 0; i < products.length; i++) {\n str += `\n <section class=\"pups\">\n <h2>${products[i].color}</h2>\n <p>$${products[i].price}</p>\n <label id=\"quantity${i}_label\"}\">Quantity</label>\n <input type=\"text\" placeholder=\"# of Puppies\" name=\"quantity${i}\" \n onkeyup=\"checkQuantityTextbox(this);\">\n <img src=\"./images/${products[i].image}\">\n </section>\n `;\n }\n return str;\n }",
"function formatPhrase(item) {\n //$(\"#arbre\").append('<li id=\"li' + sentenceId + '\">');\n var svg = document.createElementNS(svgNS, \"svg\");\n //$(\"#det\" + curid).append('<h3>Syntax</h3>');\n $(\"#arbre\").append('<div id=\"s' + item.sentenceid + '\">');\n $(\"#s\" + item.sentenceid).append(svg);\n\n var use_deprel_as_type = true;\n var sentencelength = 0;\n\n if (showr2l) {\n sentencelength = item.length;\n }\n\n if (flatgraph) {\n drawDepFlat(svg, item.tree, sentencelength, use_deprel_as_type);\n } else {\n drawDepTree(svg, item.tree, sentencelength, use_deprel_as_type, 0);\n }\n}",
"function displayTreasureCount() {\n let treasureCountWidth = 180;\n let treasureCountHeight = 50;\n\n fill(43, 12, 145);\n rect(10, 12.5, treasureCountWidth, treasureCountHeight, 5);\n\n fill(\"white\");\n textSize(16);\n textAlign(CENTER);\n\n textFont('Algerian');\n textStyle(BOLD);\n text(\"TREASURE LEFT: \" + (treasureNumber - treasureFound), 100, 42.5);\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handleRawImages() The callback function used to render the Raw Images section | function handleRawImages(o)
{
if (o.success == true)
{
if (!checkForTimeout(o))
{
$('#raw_images').html();
$.jGrowl("Loading unprocessed images...");
$('#raw_images').html(o.rows);
makeCroppable();
}
}
else
{
$.jGrowl(o.errors, {sticky: true});
}
} | [
"function handleImage(request, response, next) {\n\t\tswitch (request.params.imageMode) {\n\t\t\tcase 'raw':\n\t\t\t\tproxyImage(request, response, next);\n\t\t\t\tbreak;\n\t\t\tcase 'debug':\n\t\t\t\tdebug(request, response, next);\n\t\t\t\tbreak;\n\t\t\tcase 'placeholder':\n\t\t\t\tplaceholder(request, response, next);\n\t\t\t\tbreak;\n\t\t\tcase 'metadata':\n\t\t\t\tgetImageMeta(request, response, next);\n\t\t\t\tbreak;\n\t\t\tcase 'purge':\n\t\t\t\tresponse.redirect(`/__origami/service/image/v2/purge/url/?url=${encodeURIComponent(request.params.imageUrl)}`);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tnext();\n\t\t\t\tbreak;\n\t\t}\n\t}",
"function renderImages() {\n\t\t$('.landing-page').addClass('hidden');\n\t\t$('.img-round').removeClass('hidden');\n\t\tupdateSrcs();\n\t\tcurrentOffset+=100;\n\t}",
"_renderImages(){\r\n let images = [];\r\n this.state.image.map((item, index) => {\r\n images.push(\r\n <Image\r\n key = {index}\r\n source = {{uri:item}}\r\n style = {{width: 200, height: 150, marginBottom:5}}\r\n />\r\n );\r\n });\r\n\r\n return images;\r\n}",
"function displayImagesThumbnail()\n\t{\n\t\t// Stored action to know if user act during the process\n\t\tvar actionID = _actionID + 0;\n\n\t\tfunction cleanUp()\n\t\t{\n\t\t\tURL.revokeObjectURL(this.src);\n\t\t}\n\n\t\tfunction process()\n\t\t{\n\t\t\t// Stop here if we change page.\n\t\t\tif (actionID !== _actionID) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar nodes = jQuery('.img:lt(5)');\n\t\t\tvar load = 0;\n\t\t\tvar total = nodes.length;\n\n\t\t\t// All thumbnails are already rendered\n\t\t\tif (!total) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Work with current loaded files\n\t\t\tnodes.each(function(){\n\t\t\t\tvar self = jQuery(this);\n\n\t\t\t\tClient.getFile( self.data('path'), function( data ) {\n\t\t\t\t\t// Clean from memory...\n\t\t\t\t\tMemory.remove(self.data('path'));\n\t\t\t\t\tself.removeClass('img').addClass('thumb');\n\n\t\t\t\t\tvar url = getImageThumbnail( self.data('path'), data );\n\n\t\t\t\t\t// Display image\n\t\t\t\t\tif (url) {\n\t\t\t\t\t\tvar img = self.find('img:first').get(0);\n\t\t\t\t\t\tif (url.match(/^blob\\:/)){\n\t\t\t\t\t\t\timg.onload = img.onerror = img.onabort = cleanUp;\n\t\t\t\t\t\t}\n\t\t\t\t\t\timg.src = url;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Fetch next range.\n\t\t\t\t\tif ((++load) >= total) {\n\t\t\t\t\t\tsetTimeout( process, 4 );\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tprocess();\n\t}",
"imageLoaded(){}",
"generateUserImages(imageArr)\n {\n const toReturn = imageArr.map((curImage) =>\n\n <img className={AdminPageStyles.reviewTemplateImageBorder}\n src={curImage}\n alt=\"\"\n key ={curImage}\n onClick={() => { this.setState({ displayCurUserImage: true }); this.setState({ currentUserImage: curImage }); }}\n />\n\n );\n\n return(toReturn);\n }",
"displayImages() {\n observeDocument(node => this.displayOriginalImage(node));\n qa('iframe').forEach(iframe => iframe.querySelectorAll('a[href] img[src]').forEach(this.replaceImgSrc));\n }",
"function handleImageImport(evt) {\r\n\t\t// Loop through the FileList and render image files as thumbnails.\r\n\t\tvar files = evt.target.files; // FileList object\r\n\t\t//console.log('handleImageImport '+files.length);\r\n\t\t// Loop through the FileList and render image files as thumbnails.\r\n\t\tfor (var i = 0, f; f = files[i]; i++) {\r\n\r\n\t\t\tif (!f.type.substr('image')) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\t//console.log('handleImageImport '+f.type);\r\n\t\t\tvar reader = new FileReader();\r\n\t\t\treader.onload = (function(theFile) {\r\n\t\t\t\t//console.log('handleImageImport '+theFile.name);\r\n\t\t\t\treturn function(e) {\r\n\t\t\t\t\t//console.log('handleImageImport '+ e.target.result);\r\n\t\t\t\t\taddBackgroundImage(e.target.result);\r\n\t\t\t\t};\r\n\t\t\t})(f);\r\n\t\t\treader.readAsDataURL(f);\r\n\t\t}\r\n\t}",
"function displayImageOutput() {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tkey=\"content-block-image\"\n\t\t\t\t\tclassName=\"content-block-content content-block\"\n\t\t\t\t\tstyle={ { textAlign: props.attributes.alignmentRight } }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={ props.attributes.imgURL }\n\t\t\t\t\t\talt={ props.attributes.imgAlt }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}",
"function onImageLoaded() {\r\n\t\t++numImagesLoaded;\r\n\t\t\r\n\t\tif (numImagesLoaded == numImagesRequested) {\r\n\t\t\tnumImagesLoaded = 0;\r\n\t\t\tnumImagesRequested = 0;\r\n\t\t\timagesToLoad = [];\r\n\r\n\t\t\tif (onAllImagesLoadedCallback !== null && onAllImagesLoadedCallback !== undefined) {\r\n\t\t\t\tonAllImagesLoadedCallback();\r\n\t\t\t\tonAllImagesLoadedCallback = null;\r\n\t\t\t}\r\n\t\t}\r\n\t}",
"renderFileThumb() {\n if (!this.renderPreview) {\n this.resetFileThumb();\n return;\n }\n const fileThumb = this.dom.querySelector(\".file-details-thumbnail\");\n const fileType = this.dom.querySelector(\".file-details-type\");\n const fileBuffer = new Uint8Array(this.buffer);\n const type = isImage(fileBuffer);\n\n if (type && type !== \"image/tiff\" && fileBuffer.byteLength <= 512000) {\n // Most browsers don't support displaying TIFFs, so ignore them\n // Don't render images over 512,000 bytes\n const blob = new Blob([fileBuffer], {type: type}),\n url = URL.createObjectURL(blob);\n fileThumb.src = url;\n } else {\n this.resetFileThumb();\n }\n fileType.textContent = type ? type : detectFileType(fileBuffer)[0]?.mime ?? \"unknown\";\n }",
"function fetchDogImages() {\n fetch(imgUrl)\n .then(function(resp) {\n return resp.json()\n })\n .then(function(json) {\n renderDogImages(json)\n })\n}",
"function renderGallery() {\n var imgs = getImgs()\n var strHtmls = imgs.map(img => {\n return `<img onclick=\"onImageClick(this)\" id=\"${img.id}\" src=\"${img.url}\" alt=\"${img.keywords}\"> `\n })\n document.querySelector('.gallery-container').innerHTML = strHtmls.join('')\n}",
"function lazyLoadImages(){\n\t\tvar wrappers = document.querySelector('#image_container');\n\t\tvar imgLoad = imagesLoaded( wrappers );\n\t\tfunction onAlways( instance ) {\n\t\t\t//This should only happen once all of the images have finished being loaded\n\t\t\tconsole.log(\"All images loaded\");\n\t\t\tcollage();\n\t\t\t$('.Collage').collageCaption();\n\t\t}\n\t\timgLoad.on( 'always', onAlways );\n\t}",
"parsImages() {\n const parsedImages = [];\n // recursive images parsing\n function parsInnerImages(obj) {\n for (const prop in obj) {\n const value = obj[prop];\n if (value !== undefined && value !== null) { \n if (typeof value === 'object') {\n parsInnerImages(value);\n } else {\n parsedImages.push(value);\n }\n }\n }\n return parsedImages;\n }\n\n parsInnerImages(this.props.data.sprites);\n\n this.setState({\n pokemonParsedImages: parsedImages,\n isLoaded: true,\n });\n }",
"render(src) {\n this.innerHTML = null;\n this.innerHTML = `\n <img \n src=\"${src}\" \n height=\"${this.height}\" \n width=\"${this.width}\" \n alt=\"${this.alt}\" \n fetchpriority=\"${this.fetchpriority}\"\n decoding=\"${this.decoding}\"\n loading=\"${this.loading}\"\n />`;\n this.rendering = false;\n }",
"function processNewUpload(fileList) {\n let file = getFile(fileList);\n if (file !== null) {\n \n //displayImg.onload = customImgOnload();\n displayImg.onload = function(){\n if (displayImg.naturalHeight > displayImg.naturalWidth){\n //portrait ratio\n origImgH = containerHeight;\n origImgW = displayImg.naturalWidth * containerHeight / displayImg.naturalHeight;\n dispImgLeft = (containerWidth - origImgW) / 2;\n dispImgTop = 0;\n displayImg.height = origImgH;\n displayImg.width = origImgW;\n } else {\n //landscape (or square) ratio\n if(displayImg.naturalWidth/displayImg.naturalHeight > containerWidth/containerHeight){\n // w/h ratio is larger than that of the frame where the image is dislayed\n origImgH = displayImg.naturalHeight * containerWidth / displayImg.naturalWidth;\n origImgW = containerWidth;\n dispImgTop = (containerHeight - origImgH) / 2;\n dispImgLeft = 0;\n displayImg.height = origImgH;\n displayImg.width = origImgW;\n } else {\n // w/h ratio is smaller than that of the frame where the image is dislayed \n origImgH = containerHeight;\n origImgW = displayImg.naturalWidth * containerHeight / displayImg.naturalHeight;\n dispImgLeft = (containerWidth - origImgW) / 2;\n dispImgTop = 0;\n displayImg.height = origImgH;\n displayImg.width = origImgW;\n }\n }\n //assigns the value of the original display to the display (the one that changes with zoom, rotate and dragging)\n dispImgH = origImgH; \n dispImgW = origImgW;\n dispImgOriginX = origImgW/2;\n dispImgOriginY = origImgH/2;\n \n updateDisplayImageAttributes();\n }\n \n displayImg.src = URL.createObjectURL(file);\n console.log('displayImg', displayImg);\n\n //Saves the image in the imgArray\n imgNames.push({\n \"name\": file.name,\n \"size\": file.size,\n \"type\": file.type,\n \"naturalW\": displayImg.naturalWidth,\n \"naturalH\": displayImg.naturalHeight,\n \"dispOrigW\": origImgW,\n \"dispOrigH\": origImgH,\n\n \"src\": dispImgInfo.loca\n });\n \n //Updates the image list with the name of the recently uploaded image\n lista.insertAdjacentHTML('beforeend',\"<li class='list-item'>\" + imgNames[imgNames.length-1].name + \"</li>\");\n \n //Assigns the IDs of all the elements in the list\n refreshIds();\n\n //Adds, to the newly added list item, the listener to change on click\n lista.lastElementChild.addEventListener('click', (e) => {\n killE(e);\n selectNthChild(e.target.id);\n });\n //Selects the most recently uploaded image's name on the list\n selectNthChild(lista.children.length-1);\n\n checkButtons();\n }\n}",
"function doLazyLoadImages() {\n DomUtil.doLoadLazyImages( self.$scroller, self.$pugs.find( \"pug\" ) );\n }",
"function renderImage(response) {\n\n //getting the link of the first item in the response\n const imageLink = response.items[0].link\n\n //creating an image element with the src as the above imageLink\n //and width and heright of 200rem\n const image = document.createElement('img')\n image.setAttribute('src', imageLink)\n image.setAttribute('width', '200rem')\n image.setAttribute('height', '200rem')\n\n //getting the food name (this is the searchTerm from the response)\n const foodName = response.queries.request[0].searchTerms\n\n //adding the image element to the list\n addImageToFood(image, foodName)\n \n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
load the sensor home content | function loadContent(content) {
$.get("/Main/LoadContent", { name: content },function (data) {
//load the html comming back from the get request into the #main div
$("#main").html(data);
//Setup all the charting buttons for sensors (ie not == to home)
if(content !== "Home")
{
try {
chartProperties = JSON.parse($("#chartProperties").attr("data-chart-prop"));
}
catch (e) {
//set a default chartProperties string
chartProperties = {
chartType: "line",
datasetLabel: "Default Dataset - error with Parse",
backgroundColor: "rgba(255,0,0,1)",
borderColor: "rgba(255,0,0,1)",
labelString: "Default"
};
}
//must be a chart page. set up charting buttons
setupBtnsSensorData(); //setup the demand and usage buttons
setupBtnsSensorScale(); //setup the scale buttons
setupBtnsSensorScroll(); //setup the scroll buttons
updateChart(); //draw the chart first time
}
}, "html");
//start the timer for user input
} | [
"function loadOnScreen(){\n\tHeadingArray = getOnScreenHeadingArray();\n URLArray = getOnScreenURLArray();\n\t\n\tfor(var i = 0; i<HeadingArray.length; i++)\n\t getFeed(HeadingArray[i],URLArray[i]);\n}",
"function homeContent() {\n\t$('#main-nav li').removeClass('current');\n\t$('#home-btn').parent().addClass('current');\n\tperformGetRequest(serviceRootUrl + 'page' + pageNO() + videoLibraryCount(), onVideoLibrariesPerPageLoadSuccess, videoLibrariesErrorMessage);\n}",
"function loadContent() {\n\t\tMassIdea.loadHTML($contentList, URL_LOAD_CONTENT, {\n\t\t\tcategory : _category,\n\t\t\tsection : _section,\n\t\t\tpage : 0\n\t\t});\n\t}",
"function refreshDiscovery(){\n\n\t//show \"load\" gif in room_config page\n\t$('.box').fadeIn('slow');\n\n\n\t//discovery for sensors\n\tfor ( var i in sensor_types) {\n\t\t\tvar type = sensor_types[i];\n\t\t\twebinos.discovery.findServices(new ServiceType(type), {\n\t\t\t\tonFound: function (service) {\n\t\t\t\t\tconsole.log(\"Service \"+service.serviceAddress+\" found (\"+service.api+\")\");\n\n\t\t\t\t\tif(service.serviceAddress.split(\"/\")[0]==pzh_selected || pzh_selected==\"\"){\n\t\t\t\t\t\t//flag used to avoid to change sensors state\n\t\t\t\t\t\tvar flag=false;\n\t\t\t\t\t\tfor(var j in sensors){\n\t\t\t\t\t\t\tif((service.id)==sensors[j].id){\n\t\t\t\t\t\t\t\tflag=true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\t \n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//put it inside sensors[]\n\t\t\t\t\t\tsensors[service.id] = service;\n\t\t\t\t\t\tservice.bind({\n\t\t\t\t\t\t\tonBind:function(){\n\t\t\t \t\t\tconsole.log(\"Service \"+service.api+\" bound\");\n\t\t\t \t\t\tconsole.log(service);\n\t\t\t \t\t\tservice.configureSensor({timeout: 120, rate: 500, eventFireMode: \"fixedinterval\"}, \n\t\t\t \t\t\t\tfunction(){\n\t\t\t \t\t\t\t\tvar sensor = service;\n\t\t\t \t\t\tconsole.log('Sensor ' + service.api + ' configured');\n\t\t\t \t\t\tvar params = {sid: sensor.id};\n\t\t\t \t\t\t\tvar values = sensor.values;\n\t\t\t \t\t\t\tvar value = (values && values[values.length-1].value) || '−';\n\t\t\t \t\t\t\tvar unit = (values && values[values.length-1].unit) || '';\n\t\t\t \t\t\t\tvar time = (values && values[values.length-1].time) || '';\n\n\t\t\t \t\t\tservice.addEventListener('onEvent', \n\t\t\t \t\t\tfunction(event){\n\t\t\t \t\tconsole.log(\"New Event\");\n\t\t\t \t\tconsole.log(event);\n\t\t\t \t\tonSensorEvent(event);\n\t\t\t \t\t},\n\t\t\t \t\t\tfalse\n\t\t\t \t\t);\n\n\t\t\t \t\t\tif(flag==false){\n\t\t\t\t\t \t\t//event listener is active (value=1)\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tsensorEventListener_state.push({\n\t\t\t\t\t\t\t\t\t\t\t key: service.id,\n\t\t\t\t\t\t\t\t\t\t\t value: 1\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tfunction (){\n\t\t\t\t\t\t\t\t\t\tconsole.error('Error configuring Sensor ' + service.api);\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}\n\t\t\t\t\t\t});\n\t\t\t\t\t \n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\t\n\t\t// discovering actuators\n\t\tfor ( var i in actuator_types) {\n\t\t\tvar type = actuator_types[i];\n\t\t\twebinos.discovery.findServices(new ServiceType(type), {\n\t\t\t\tonFound: function (service) {\n\t\t\t\t\tconsole.log(\"Service \"+service.serviceAddress+\" found (\"+service.api+\")\");\n\t\t\t\t\tif(service.serviceAddress.split(\"/\")[0]==pzh_selected || pzh_selected==\"\"){\n\t\t\t\t\t\t//put it in actuators[]\n\t\t\t\t\t\tactuators[service.id] = service;\n\t\t\t\t\t\tservice.bind({\n\t\t\t\t\t\t\tonBind:function(){\n\t\t\t \t\t\tconsole.log(\"Service \"+service.api+\" bound\");\n\t\t\t\t\t\t\t\tvar params = {aid: service.id};\n\t\t\t \t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t//load rules GUI\n\t\tsetTimeout(initRulesUI,1000);\n\t\tsetTimeout(refreshRules,1000);\n\n \t\t/** load file and GUI of room_config **/\n \t\tload_data_from_file(room_config_file);\n\n}",
"function loadLandingPage() {\n //Clearing the content on the page\n document.body.innerHTML = \"\";\n\n //Adding the static content in the landing page\n document.body.appendChild(createLandingPageContent());\n\n //Manage the music when the speaker is on\n if(speakerImage === 'speaker_on'){\n //If arrived from game over page, sounds may already be initaited\n //Stop the levelUp sound and start game sound in this case\n if(sounds.levelUp != undefined){\n //Stop levelup music\n sounds.levelUp.pause();\n sounds.levelUp.currentTime = 0.0;\n }\n if(sounds.game != undefined){\n //Start game music\n sounds.game.loop = true;\n sounds.game.play();\n }\n }\n //Resetting the score to zero\n score = 0;\n\n //Resetting the timer\n resetTimer();\n}",
"function loadDashboard() {\n loadReservations();\n loadTables();\n }",
"loadMainHeader() {\n // Get site name and description from store\n const siteName = model.getPostBySlug('site-name', 'settings'),\n siteDescription = model.getPostBySlug('site-description', 'settings');\n view.updateSiteName(siteName.content);\n view.updateSiteDescription(siteDescription.content);\n }",
"function loadInitial() {\n var nameContainer = $('#list-recent-title');\n var dateContainer = $('#list-recent-time');\n var imageContainer = $('#list-recent-image');\n\n var vis = visuals[0];\n var id = vis.id;\n var name = vis.name;\n var image = vis.imageall;\n var datecreated = vis.datecreated;\n\n firstImage = name;\n selectedImage = firstImage;\n\n nameContainer.html(name);\n dateContainer.html(datecreated);\n imageContainer.attr('src', 'assets/vis/' + image);\n}",
"function resourceOnload() {\n initShowdownExt();\n hljs.initHighlightingOnLoad();\n mermaidAPI.initialize({\n startOnLoad: false\n });\n mermaid.parseError = function(err, hash) {\n console.error(err);\n };\n\n onLoadCallback.call(self);\n }",
"function load() {\n dashBoardService.getDashboardData().success(function(data) {\n var formatData = [];\n _.forEach(data, function(elem) {\n try {\n formatData.push({id: elem._id, title: elem._id.title, ip: elem._id.ip, count: elem.count, last: moment(elem.lastEntry).fromNow(), down: elem.timeIsOver});\n } catch (err) {\n console.log(err);\n }\n });\n vm.data = formatData;\n\n }).error( function(data, status, headers) {\n alert('Error: ' + data + '\\nHTTP-Status: ' + status);\n });\n }",
"function loadContent(){\n pole = game.instantiate(new Pole(Settings.pole.size));\n pole.setColor(Settings.pole.color);\n pole.setPosition(Settings.canvasWidth /2 , Settings.canvasHeight /2);\n\n shield = game.instantiate(new Shield(pole));\n shield.getBody().immovable = true;\n shield.setColor(Settings.shield.color);\n\n player = game.instantiate(new Player(\"\"));\n player.setPole(pole);\n player.setShield(shield);\n pole.setPlayer(player);\n\n //Player labels, name is set once again when the user has filled in his/her name\n scoreLabel = game.instantiate(new ScoreLabel(player, \"Score: 0\"));\n scoreLabel.setPosition(Settings.label.score);\n\n nameLabel = game.instantiate(new Label(\"Unknown Player\"));\n nameLabel.setPosition(Settings.label.name);\n\n highscoreLabel = game.instantiate(new Label(\"Highscore: 0\"));\n highscoreLabel.setPosition(Settings.label.highscore);\n\n createTempImage();\n setTimeout(deleteTempImage, 3000);\n\n //Hide the canvas for the player until a username is filled in and accepted\n var gameElem = document.getElementById(\"gameCanvas\");\n gameElem.style.display=\"none\";\n}",
"function loadHoses() {\n $.get(\"/api/list/hoses\", {}\n ).done(function (data) {\n updateHoses(data.hoses);\n });\n}",
"function init(){\n homeScreen.createHomePage();\n beaverEvents.addModel(beaverApp);\n beaverEvents.addModel(beaverRelations);\n beaverEvents.getViewState(homeScreen);\n beaverEvents.getViewState(profileView);\n beaverEvents.activeView = homeScreen.name;\n beaverEvents.viewState.homeScreen.showMapButton();\n // Display beavers\n beaverEvents.displayBeavers();\n // beaverEvents.getGeoLocation();\n homeScreenHandlers.setupEvents();\n}",
"function loadContents(){\r\n\t//Load all of the table contents when the page loads\r\n\tupdateTable(\"brand\");\r\n\tupdateTable(\"drum_kit\"); \r\n\tupdateTable(\"stick\");\r\n\tupdateTable(\"drummer\");\r\n\tupdateTable(\"plays\");\r\n\t//Update all drop down menu values when the page loads\r\n\tupdateDropDowns();\r\n}",
"function load() {\n _data_id = m_data.load(FIRST_SCENE, load_cb, preloader_cb);\n}",
"function ready_content() {\n app.param.generate.addClass('ready');\n $('.generate-container .thumb').html('<i class=\"fa fa-check fa-2x\" aria-hidden=\"true\"></i>');\n (!app.param.checkbox.prop('checked') ? media = 'Movie' : media = '<br>TV Show');\n $('.generate-container .header').html('See Random ' + media + ' <i class=\"fa fa-angle-right\" aria-hidden=\"true\"></i>');\n\n app.param.generate.on('click', function() {\n if ($(this).hasClass('ready')) {\n show_content();\n $('.container').addClass('active');\n app.param.generate.hide();\n $('.switch-container').hide();\n }\n });\n }",
"function getChartResource() {\n\tif (isFirstTime) {\n\t\tisFirstTime = false;\n\t\t$.ajax({\n\t\t\ttype : \"GET\",\n\t\t\turl : \"getChartSourceContent\",\n\t\t\tsuccess : function(data) {\n\t\t\t\t$('#chartContents').html(data);\n\t\t\t},\n\t\t\tfailure : function(errMsg) {\n\t\t\t\talert(errMsg);\n\t\t\t}\n\t\t});\n\t}\n}",
"function loadTopbar() {\n loadSection(\"/Frontend/shared/topbar/topbar.html\")\n .then(html => {\n TOPBARCONTAINER.innerHTML = html;\n })\n .catch(error => {\n console.warn(error);\n });\n}",
"function loadLocalData() {\r\n var xmlhttp=new XMLHttpRequest();\r\n xmlhttp.open(\"GET\",\"Buses.xml\",false);\r\n xmlhttp.send();\r\n xmlData=xmlhttp.responseXML;\r\n generateBusList(xmlData, \"SAMPLE\");\r\n loadRouteColors(); // Bus list must be loaded first\r\n displayRoutesFromTripId(tripRouteShapeRef); // Bus list must be loaded first to have the trip IDs\r\n showPOIs();\r\n getTrolleyData(scope);\r\n loadTrolleyRoutes();\r\n getTrolleyStops(scope);\r\n getCitiBikes();\r\n addDoralTrolleys();\r\n addDoralTrolleyRoutes();\r\n addMetroRail();\r\n addMetroRailRoutes();\r\n addMetroRailStations();\r\n addMiamiBeachTrolleys();\r\n addMiamiBeachTrolleyRoutes();\r\n // Refresh Miami Transit API data every 5 seconds\r\n setInterval(function() {\r\n callMiamiTransitAPI();\r\n }, refreshTime);\r\n if (!test) {\r\n alert(\"Real-time data is unavailable. Check the Miami Transit website. Using sample data.\");\r\n }\r\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TAU returns the universal circle constant | function TAU() {
return τ;
} | [
"function calcSunRtAscension(t) {\n var e = calcObliquityCorrection(t);\n var lambda = calcSunApparentLong(t);\n var tananum = (Math.cos(degToRad(e)) * Math.sin(degToRad(lambda)));\n var tanadenom = (Math.cos(degToRad(lambda)));\n var alpha = radToDeg(Math.atan2(tananum, tanadenom));\n return alpha; // in degrees\n}",
"function calcSunRadVector(t) {\n var v = calcSunTrueAnomaly(t);\n var e = calcEccentricityEarthOrbit(t);\n var R = (1.000001018 * (1 - e * e)) / (1 + e * Math.cos(degToRad(v)));\n return R; // in AUs\n}",
"function areaCircle (radius)\n{\n\t// var circle_Area = Math.PI * (radius * radius);\n\tvar circle_Area = Math.PI * (Math.pow(radius,2));\n\treturn circle_Area;\n}",
"function heatPerUnitArea$1 (rxi, taur) {\n return rxi * taur\n}",
"function calcSunApparentLong(t) {\n var o = calcSunTrueLong(t);\n var omega = 125.04 - 1934.136 * t;\n var lambda = o - 0.00569 - 0.00478 * Math.sin(degToRad(omega));\n return lambda; // in degrees\n}",
"function radian_oa(o,a) {\n console.log(Math.atan(o/a))\n}",
"function areaCirculo(radio){\n\nreturn (radio * radio) * PI;\n\n}",
"function calcSunDeclination(t) {\n var e = calcObliquityCorrection(t);\n var lambda = calcSunApparentLong(t);\n var sint = Math.sin(degToRad(e)) * Math.sin(degToRad(lambda));\n var theta = radToDeg(Math.asin(sint));\n return theta; // in degrees\n}",
"static cauchyRand() {\n return Math.tan(Math.PI * (Math.random() - 0.5));\n }",
"function squareAreaToCircle(size){\n return +(Math.PI * size / 4).toFixed(8);\n}",
"function calcObliquityCorrection(t) {\n var e0 = calcMeanObliquityOfEcliptic(t);\n var omega = 125.04 - 1934.136 * t;\n var e = e0 + 0.00256 * Math.cos(degToRad(omega));\n return e; // in degrees\n}",
"function theta_oh(o,h) {\n console.log((Math.asin(o/h))*180/Math.PI)\n}",
"static get PI(): number {\n return 3.14;\n }",
"function calcMeanObliquityOfEcliptic(t) {\n var seconds = 21.448 - t*(46.8150 + t*(0.00059 - t*(0.001813)));\n var e0 = 23.0 + (26.0 + (seconds/60.0))/60.0;\n return e0; // in degrees\n}",
"function face_target_rad(mx, my, tx, ty) {\n\tvar rad_angle = Math.atan(Math.abs(ty-my)/(Math.abs(tx-mx)==0?0.00001:Math.abs(tx-mx)) );\n\tif (tx<mx) rad_angle=Math.PI-rad_angle;\n\tif (ty<my) rad_angle=2*Math.PI-rad_angle;\n\treturn rad_angle;\n}",
"function omtrek (diameter) {\n return diameter * Math.PI;\n}",
"get KM_PER_AU() {\n return (this.CM_PER_AU / this.CM_PER_KM);\n }",
"static Teal() {\n return new Color3(0, 1.0, 1.0);\n }",
"function areaCircle(d){\n var rad = d / 2;\n\n var areaC = 3.14 * (rad * rad);\n\n return(areaC)\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
const WEB3STORAGE_TOKEN = require('./WEB3STORAGE_TOKEN') | function getAccessToken() {
// If you're just testing, you can paste in a token
// and uncomment the following line:
// return 'paste-your-token-here'
// In a real app, it's better to read an access token from an
// environement variable or other configuration that's kept outside of
// your code base. For this to work, you need to set the
// WEB3STORAGE_TOKEN environment variable before you run your code.
//return process.env.WEB3STORAGE_TOKEN
return 'Insert your WEB3STORAGE_TOKEN Here'
//return WEB3STORAGE_TOKEN
} | [
"function getToken() {\n return localStorage.getItem('token');\n}",
"function getToken() {\n\treturn localStorage.getItem('token')\n}",
"createJWT () {\n const token = {\n iat: parseInt(Date.now() / 1000),\n exp: parseInt(Date.now() / 1000) + 20 * 60, // 20 minutes\n aud: this.mqtt.project\n }\n return jwt.sign(token, fs.readFileSync(this.device.key.file), { algorithm: this.device.key.algorithm })\n }",
"function api(provider) {\n switch (provider) {\n case \"s3\":\n return require(\"./storage/s3.js\")\n case \"gcs\":\n return require(\"./storage/gcs.js\")\n case \"filesystem\":\n return require(\"./storage/filesystem.js\")\n case \"minio\":\n return require(\"./storage/s3.js\")\n case \"s3-v4-compat\":\n return require(\"./storage/s3.js\")\n case \"digitalocean-spaces\":\n return require(\"./storage/s3.js\")\n case \"exoscale-sos\":\n return require(\"./storage/s3.js\")\n case \"wasabi\":\n return require(\"./storage/s3.js\")\n case \"scaleway-objectstorage\":\n return require(\"./storage/s3.js\")\n case \"linode-objectstorage\":\n return require(\"./storage/s3.js\")\n case \"noop\":\n return require(\"./storage/noop.js\")\n default:\n return null\n }\n}",
"function storeToken(token) {\n try {\n fs.mkdirSync(TOKEN_DIR);\n } catch (err) {\n if (err.code != \"EEXIST\") {\n throw err;\n }\n }\n fs.writeFile(TOKEN_PATH, JSON.stringify(token));\n console.log(\"Token stored to \" + TOKEN_PATH);\n}",
"get githubAppId () {\n return process.env.GITHUB_APP_ID\n }",
"constructor() { \n \n S3StorageConfig.initialize(this);\n }",
"constructor(config_dir){\n if(fs.existsSync(config_dir)){\n if(typeof require(config_dir) == 'json' || typeof require(config_dir) == 'object'){\n this.config = require(config_dir);\n\n // Load the access token key.\n if(this.config.mode == 'sandbox') this.config.token = this.config.keys.sandbox;\n else if(this.config.mode == 'production') this.config.token = this.config.keys.production;\n\n // Log to console.\n if(this.config.mode == 'sandbox'){\n console.log('[Flip Gocardless] => Running in ' + this.config.mode);\n console.log('[Flip GoCardless] => Loaded configuration files.');\n }\n }\n else throw '[Flip GoCardless] => Invalid config file contents.';\n }\n else throw '[Flip GoCardless] => Invalid config file.';\n }",
"function createToken(payload){\r\n return jwt.sign(payload, SECRET_KEY, {expiresIn})\r\n}",
"function getTokenInCookie(){\n let token = document.cookie.slice(document.cookie.lastIndexOf(\"=\")+1);\n return token;\n}",
"function getStoredToken() {\n return authVault.getToken();\n }",
"function fetchTokens() {\n _.each(['fbtoken', 'dropboxtoken', 'livetoken'], function(key) {\n var token = localStorage.getItem(key);\n if (token != null) {\n Storage.getInstance().set(key, token);\n } \n Storage.getInstance().get(key).then(function (value) {\n console.log(key + \" \" + value);\n })\n });\n }",
"function loadToken() {\n var tokenCookie = \"staticReader\";\n var t_value = document.cookie;\n var t_start = t_value.indexOf(tokenCookie + \"=\");\n if (t_start != -1){\n t_start = t_value.indexOf(\"=\") + 1;\n t_end = t_value.length;\n accessToken = \"access_token=\" + t_value.substr(t_start, t_end);\n colorGreen('tokenButton');\n document.getElementById('tokenField').value = accessToken;\n gistQuery = gitAPI + gistID + \"?\" + accessToken;\n \n }\n}",
"async prepareCredentials() {\n if (this.env[DEFAULT_ENV_SECRET]) {\n const secretmanager = new SecretManager({\n projectId: this.env.GCP_PROJECT,\n });\n const secret = await secretmanager.access(this.env[DEFAULT_ENV_SECRET]);\n if (secret) {\n const secretObj = JSON.parse(secret);\n if (secretObj.token) {\n this.oauthToken = secretObj;\n } else {\n this.serviceAccountKey = secretObj;\n }\n this.logger.info(`Get secret from SM ${this.env[DEFAULT_ENV_SECRET]}.`);\n return;\n }\n this.logger.warn(`Cannot find SM ${this.env[DEFAULT_ENV_SECRET]}.`);\n }\n // To be compatible with previous solution.\n const oauthTokenFile = this.getContentFromEnvVar(DEFAULT_ENV_OAUTH);\n if (oauthTokenFile) {\n this.oauthToken = JSON.parse(oauthTokenFile);\n }\n const serviceAccountKeyFile =\n this.getContentFromEnvVar(DEFAULT_ENV_KEYFILE);\n if (serviceAccountKeyFile) {\n this.serviceAccountKey = JSON.parse(serviceAccountKeyFile);\n }\n }",
"getLibrary() {\n let libraryPath = path.join(this.userLibraryDir, 'library.json')\n return new Promise((resolve, reject) => {\n fs.readFile(libraryPath, 'utf8', (err, data) => {\n /* istanbul ignore next */\n if (err) reject(err)\n else resolve(JSON.parse(data))\n })\n })\n }",
"function getToken(email) {\n //console.log(\"cleanAuth-getToken\", email);\n const token = jwt.sign(\n {\n user_id: email,\n },\n process.env.TOKEN_KEY,\n {\n expiresIn: `${EXPIRES_TIME}h`,\n }\n );\n return token;\n}",
"function bootstrap($TOKEN) {\n console.log($TOKEN);\n var TelegramBot = require('node-telegram-bot-api');\n var Telegram = new TelegramBot($TOKEN, {polling: true});\n var DrupalerBot = require('./src/drupalerbot.js');\n\n /**\n * Project information.\n *\n * @command\n * /project [project_name]\n * /p [project_name]\n */\n Telegram.onText(/\\/(project|p) (.+)/, function (msg, match) {\n DrupalerBot.getProjectInfo(match[2], function (message) {\n Telegram.sendMessage(msg.chat.id, message, {\n parse_mode: 'Markdown',\n disable_web_page_preview: true\n });\n });\n });\n}",
"function setUpStorageClient(err, credentials){\n if (err) return console.log(err);\n\n storageClient = new StorageManagementClient(credentials, subscriptionId);\n //getStorageAccountsLists();\n //getStorageKeyList();\n createStorageAccount();\n //getStorageKeyList();\n}",
"constructor() {\r\n this.web3 = new Web3(\"ws://localhost:7545\");\r\n this.network = 'ganache';\r\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public Methods Initializes the doco settings. | function initializeDocoSettings() {
getDocoSettings();
} | [
"init(){\n this.dxcFolder = _path_.join( this.path, '.dxc'); \n this.binFolder = _path_.join( this.dxcFolder, 'bin');\n this.apiFolder = _path_.join( this.dxcFolder, 'api');\n this.cfgFolder = _path_.join( this.dxcFolder, 'cfg');\n this.devFolder = _path_.join( this.dxcFolder, 'dev');\n this.pluginsFolder = _path_.join( this.dxcFolder, 'plugins');\n this.tmpFolder = _path_.join( this.dxcFolder, 'tmp');\n\n // config\n this.configPath = _path_.join( this.cfgFolder, FILENAME_CONFIG);\n this.oldconfigPath = _path_.join( this.cfgFolder, FILENAME_OLDCONFIG);\n\n DexcaliburWorkspace.mkdirIfNotExists(this.dxcFolder);\n DexcaliburWorkspace.mkdirIfNotExists(this.binFolder);\n DexcaliburWorkspace.mkdirIfNotExists(this.apiFolder);\n DexcaliburWorkspace.mkdirIfNotExists(this.cfgFolder);\n DexcaliburWorkspace.mkdirIfNotExists(this.devFolder);\n DexcaliburWorkspace.mkdirIfNotExists(this.tmpFolder);\n DexcaliburWorkspace.mkdirIfNotExists(this.pluginsFolder);\n }",
"function init(){\n initConfig();\n loadOtherdata();\n if(config.log) clearLog({getLock: false, initConfig: false, keepRows: config.log_max_rows - 1});\n}",
"configure() {\n mongoose.connect(nconf.get('DATABASE'), this.opts);\n }",
"function initializeSettings() {\n if (Drupal.eu_cookie_compliance !== undefined && Drupal.eu_cookie_compliance.hasAgreed()) {\n $('.js-social-media-settings-open').removeClass('hidden');\n\n if (cookieExists()) {\n sources = cookieGetSettings();\n }\n else {\n sources = settings.sources;\n cookieSaveSettings();\n }\n }\n }",
"inicializa(){\n globais.flappyBird = criarFlappyBird();\n globais.canos = criarCanos();\n globais.chao = criarChao();\n }",
"function iglooSettings () {\n\tthis.popup = null;\n\tthis.settingsEnabled = true;\n\tthis.isOpen = false;\n}",
"initializing() {\n\n\n\n\n\n\n this._showInitMessage();\n this.log(yosay(\n chalk.yellow(\"Hi...!\\n\") +\n chalk.yellow(\"Share your ideas with me\\n\") +\n chalk.red(\"twitter:@dchatnu\")));\n\n //Initialize the project dependencies\n this.dependencies = [\n 'gitignore',\n 'babelrc',\n 'editorconfig',\n 'eslintrc',\n '_README.md',\n '_webpack.config.dev.js',\n '_webpack.config.prod.js'\n ];\n\n }",
"function init(){\n controllerInit(routerInitModel);\n serviceAuthorizeOps(globalEmitter,'admin',globalDataAccessCall);\n serviceAuthenticate(globalEmitter,'user',globalDataAccessCall);\n genericDataAccess(dataAccessInitModel);\n}",
"function settingsToDefault() {\n ftpSettings = {\n connect: \"FTP\",\n host : \"localhost\",\n port : \"21\",\n user : \"\",\n pwd : \"\",\n savepwd: \"\",\n remoteRoot : \"\"\n };\n }",
"_init() {\n try {\n if (!fs.existsSync(LINKS_DIR)) {\n fs.mkdirSync(LINKS_DIR);\n }\n this.links = require(LINKS_PATH);\n\n for (const key in this.links) {\n if (this.links.hasOwnProperty(key)) {\n const url = this.links[key].url;\n\n if (!this._urls[url]) {\n this._urls[url] = key;\n }\n }\n }\n }\n catch (e) {\n pino.error('Could not load links: ' + e.message);\n }\n }",
"constructor(dbUrl) {\n\t\tthis.dbURL = dbUrl\n\t\tthis.client = null\n \tthis.db = null\n\n\t\tthis.Mongo_Collections = []\n\n\t\tthis.content_mongo = []\n\t\tthis.content = new Map()\n\n\t\tthis.local_memory = new Map()\n\n\t\tthis.noise_words = new Map()\n\n\t\t/*\n\t\t* DATABASE NAMES\n\t\t*/\t\n\t\tthis.contentTB = \"content\"\n\t\tthis.noisewordsTB = \"noisewords\"\n\t\tthis.memoryindexTB = \"memoryindex\"\n \t}",
"async initialize() {\n this.loadEnv();\n this.loadConfiguration();\n }",
"function ConfigFunction () {\n\n\n }",
"function cytoscapeInit() {\r\n var container = document.getElementById('web');\r\n var cytoscapeInitObject = {\r\n container: container,\r\n elements: [],\r\n // Use the modularized style for this thing\r\n style: getCytoscapeStyle(),\r\n // Comments in javascript can be place in object literals, cool!\r\n // Layout is an important setting which determines how to nodes are placed\r\n // See more at http://js.cytoscape.org/#layout\r\n layout: {},\r\n\r\n // viewport state\r\n zoom: 1,\r\n pan: { x : 0, y : 0 },\r\n\r\n // interaction options:\r\n minZoom: 0.1, // ZOOM MIN/MAX\r\n maxZoom: 2,\r\n zoomingEnabled: true,\r\n userZoomingEnabled: true,\r\n panningEnabled: true,\r\n userPanningEnabled: true,\r\n boxSelectionEnabled: false,\r\n selectionType: 'single',\r\n touchTapThreshold: 8,\r\n desktopTapThreshold: 4,\r\n // Settings on whether or not one can move around and grab nodes\r\n autolock: GRAPH_LOCKED,\r\n autoungrabify: GRAPH_LOCKED,\r\n autounselectify: GRAPH_LOCKED,\r\n\r\n // rendering options:\r\n headless: false,\r\n styleEnabled: true,\r\n hideEdgesOnViewport: false,\r\n hideLabelsOnViewport: false,\r\n textureOnViewport: false,\r\n motionBlur: false,\r\n motionBlurOpacity: 0.2,\r\n wheelSensitivity: 0.1,\r\n pixelRatio: 'auto'\r\n };\r\n return cytoscapeInitObject;\r\n}",
"function _initEditor() {\n\n var modules;\n\n if(cl.editorType === cl.EditorType.GameEditor) {\n modules = [\n \"cocos2d-js/frameworks/cocos2d-html5/CCBoot\",\n \n \"hack/hackBrackets\",\n \"hack/hackCocos\",\n\n \"core/ObjectManager\",\n \"core/Hierarchy\",\n \"core/Inspector\",\n \"core/Undo\",\n \"core/ComponentManager\",\n \"core/Selector\",\n \"core/Project\",\n \"core/MenusManager\",\n \"core/GameEditor\",\n \"core/CopyManager\",\n \n \"thirdparty/vue\",\n \"thirdparty/colorpicker/js/bootstrap-colorpicker\",\n \"thirdparty/webui-popover/jquery.webui-popover\",\n \"thirdparty/jquery-ui\",\n\n \"editor/EditorManager\",\n \"editor/SceneEditor\",\n \"editor/MeshEditor\",\n \"editor/Control2D\",\n \"editor/Simulator\",\n \"editor/PhysicsEditor\",\n \"editor/CanvasControl\"];\n\n _initNodeDomain();\n }\n else if(cl.editorType === cl.EditorType.IDE) {\n modules = [\"ide/ide\",\n \"ide/ChromeConnect\"];\n }\n\n modules.push(\"common\");\n\n require(modules);\n }",
"function setup(argv, log, cb) {\n var dbFile = argv.d;\n if (!dbFile && !argv.c) {\n cb(new Error('config file or db filename required.'));\n return;\n } else if (!dbFile) {\n var cfgFileName = argv.c;\n var stats = fs.statSync(cfgFileName);\n if (!stats || !stats.isFile()) {\n cb(new Error('config file cannot be found.'));\n return;\n }\n var cfg = null;\n try {\n cfg = JSON.parse(fs.readFileSync(cfgFileName));\n } catch (e) {\n cb(e);\n return;\n }\n if (!cfg.dbFile) {\n cb(new Error('Config file contains no dbFile field.'));\n return;\n }\n dbFile = cfg.dbFile;\n }\n\n var d = new db.Db({\n 'fileName': dbFile,\n 'log': log\n });\n\n d.on('ready', function () {\n cb(null, d);\n });\n\n d.on('error', function (err) {\n cb(err);\n });\n}",
"function init(){\n buildToolbar();\n initEditor();\n }",
"function loadDojo() {\n\tparseQueryParams(window.location);\n\tif (!window.dojoConfig) {\n\t\tdojoConfig = {\n\t isDebug: myApp.config.isDebug || true,\n\t parseOnLoad: myApp.config.parseOnLoad || true,\n\t debugAtAllCosts: myApp.config.debugAtAllCosts || false,\n\t packages: [\n\t\t {\n\t\t \t name: \"idx\",\n\t\t \t location: myApp.config.idxLocation + \"/idx/\"\n\t\t },\n\t\t {\n\t\t \t name: \"cwapp\",\n\t\t \t location: myApp.config.cwAppLocation\n\t\t }\n\t ],\n\t sendMethod: 'xhrPost', \n\t sendInterval: myApp.config.logInterval || 10000, \n\t analyticsUrl: myApp.config.logURL,\n\t };\n\t}\n\t\n\t//import dojo\n\tdojoScriptImport(myApp.config.dojoLocation + \"/dojo/\" + myApp.config.dojoScript, \"insertDojoHere\");\n\t//import a set of JS Modules\n\t//dojoScriptImport(myApp.config.dojoLocation + \"/dojo/\" + myApp.config.mainScript, \"insertDojoHere\");\n\t//dojoScriptImport(myApp.config.dojoLocation + \"/dojo/\" + myApp.config.homeScript, \"insertDojoHere\");\n\t//dojoScriptImport(myApp.config.dojoLocation + \"/dojo/\" + myApp.config.referenceScript, \"insertDojoHere\");\n}",
"_onResetDefaults(event) {\n event.preventDefault();\n game.settings.set(\"core\", DrawingsLayer.DEFAULT_CONFIG_SETTING, {});\n this.object.data = canvas.drawings._getNewDrawingData({});\n this.render();\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
compares answer given and valid color increments correct answers if needed resets words | function checkAnswerAndReset(colorChosen) {
if (colorChosen === validColor) {
setCorrectAnswers(correctAnswers + 1);
}
startNewGame(false);
} | [
"function solveCurrentExamAnswer(containerId, currentAnswer, rightAnswer) {\n if (currentAnswer === rightAnswer) {\n $(\"#\" + containerId + \"Label\" + (currentAnswer)).css(\"color\", \"lightgreen\");\n } else {\n $(\"#\" + containerId + \"Label\" + (currentAnswer)).css(\"color\", \"red\");\n $(\"#\" + containerId + \"Label\" + (rightAnswer)).css(\"color\", \"lightgreen\");\n }\n $(\"#\" + containerId + \"1\").attr(\"disabled\", true);\n $(\"#\" + containerId + \"2\").attr(\"disabled\", true);\n $(\"#\" + containerId + \"3\").attr(\"disabled\", true);\n}",
"function calculatePossible(){\n\tvar allLetters = '';\n\tvar l = table.find('button');\n\tfor(var i = 0; i < l.length; i++){\n\t\tallLetters += l[i].innerHTML;\n\t}\n\t\tvar canBeFormed;\n\t\tvar yesCounter;\n\t\tvar tmpAllLetters;\n\t\tfor(var k = 0; k < wordsArray.length; k ++){\n\t\t\tyesCounter = 0;\n\t\t\ttmpAllLetters = allLetters;\n\t\t\tif(canBeFormed == true){\n\t\t\t\tvar postfixNum = k - 1;\n\t\t\t\tlsId = \"ls\" + postfixNum;\n\t\t\t\t$('#' + lsId).addClass('text-warning');\n\t\t\t\t$('#' + lsId).css( \"color\", \"orange\" );\n\t\t\t\tCheckStatus(lsId);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tvar postfixNum = k - 1;\n\t\t\t\tlsId = \"ls\" + postfixNum;\n\t\t\t\t$('#' + lsId).removeClass('text-warning');\n\t\t\t\t$('#' + lsId).css(\"color\", \"#333333\");\n\t\t\t\tstopCounter(lsId);\n\t\t\t}\n\t\t\tfor(var l = 0; l < wordsArray[k].length; l++){\n\t\t\t\tcanBeFormed = false;\n\t\t\t\tfor(var m = 0; m < tmpAllLetters.length; m++){\n\t\t\t\t\tif(wordsArray[k].charAt(l) == tmpAllLetters.charAt(m)){\n\t\t\t\t\t\tyesCounter++;\n\t\t\t\t\t\tvar let = wordsArray[k].charAt(l);\n\t\t\t\t\t\tvar reg = new RegExp(let);\n\t\t\t\t\t\ttmpAllLetters = tmpAllLetters.replace(reg, \"\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\tif(yesCounter == wordsArray[k].length){\n\t\t\t\t\tcanBeFormed = true;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tcanBeFormed = false;\n\t\t\t\t}\n\t\t}\n\t\tif(canBeFormed == true){\n\t\t\tvar postfixNum = k - 1;\n\t\t\tlsId = \"ls\" + postfixNum;\n\t\t\t$('#' + lsId).addClass('text-warning');\n\t\t\t$('#' + lsId).css(\"color\", \"orange\");\n\t\t\tCheckStatus(lsId);\n\t\t}\n\t\telse{\n\t\t\tvar postfixNum = k - 1;\n\t\t\tlsId = \"ls\" + postfixNum;\n\t\t\t$('#' + lsId).removeClass('text-warning');\n\t\t\t$('#' + lsId).css(\"color\", \"#333333\");\n\t\t\tstopCounter(lsId);\n\t\t}\n}",
"function checkAnswer(currIndex) {\r\n if (userClickedPattern[currIndex] === gamePattern[currIndex]) {\r\n\r\n // If userClickedPattern = gamePattern entirely, then go to next sequence.\r\n\r\n if (userClickedPattern.length === gamePattern.length) {\r\n userClickedPattern = [];\r\n\r\n setTimeout(function() {\r\n nextInSequence();\r\n }, 1000);\r\n }\r\n }\r\n\r\n // Game Over - If user's color choice does not match matching index color of gamePattern, reset level, userClickedPattern, and gamePattern.\r\n\r\n else {\r\n $(\"h1\").text(\"Game Over, Press Any Key to Restart\");\r\n\r\n playSound(\"wrong\");\r\n animate(\"body\", 200, \"game-over\");\r\n\r\n level = 0;\r\n userClickedPattern = [];\r\n gamePattern = [];\r\n }\r\n}",
"function generateHints(guess) {\n var guessArray = guess.split('');// split the strings to arrays \n\tvar solutionArray = solution.split('');// split the strings to arrays \n\tvar correctPlacement = 0; // create a variable for correctPlacement\n\t// create for loop that checks each items in the solution array against guess array\n\tfor (var i = 0; i < solutionArray.length; i++) {\n\t// if there is a match, set the location to null\n\t\tif (solutionArray[i] === guessArray[i]) {\n\t\t\tcorrectPlacement++; \n\t\t\tsolutionArray[i] = null;\n\t\t}\n\t}\n\tvar correctLetter = 0; // create a variable for correctLetter\n\t// create for loop that checks indexOf each items in the guess array against solution array\n\t// note: indexOf automatically returns -1 if there are no instances\n // if there is a match it signifies correctLetter\n\tfor (var i = 0; i < solutionArray.length; i++\t) {\n\t\tvar targetIndex = solutionArray.indexOf(guessArray[i]);\n\t\tif (targetIndex > -1) {\n\t\t\tcorrectLetter++;\n\t\t\tsolutionArray[targetIndex] = null;\n\t\t}\n}\nreturn colors.red(correctPlacement + ' - ' + correctLetter);\n}",
"get correct(){ return(\n this.#correctIdx === undefined\n ? <i>— ei oikeaa tai väärää vastausta</i> // ...no correct answer at all...\n : this.#text[this.#text.length-1]==='=' // question ends with '='?\n ? this.#answers[this.#correctIdx] // ...if so, don't alter\n : ': '+this.#answers[this.#correctIdx] // ...but if not, fiddle with it a bit.\n )}",
"function checkFractionQuiz() {\n var CN = $( \"#carsNumerator\" ).val();\n var CD = $( \"#carsDenominator\" ).val();\n var PN = $( \"#pizzaNumerator\" ).val();\n var PD = $( \"#pizzaDenominator\" ).val();\n var BN = $( \"#ballsNumerator\" ).val();\n var BD = $( \"#ballsDenominator\" ).val();\n\n if( CN != \"?\" && CD != \"?\") {\n if(CN == \"3\" && CD == \"7\") {\n $( \"#CarsFractionQuiz\" ).css(\"background\", \"green\");\n }\n else {\n $( \"#CarsFractionQuiz\" ).css(\"background\", \"red\");\n }\n }\n if( PN != \"?\" && PD != \"?\") {\n if(PN == \"1\" && PD == \"5\") {\n $( \"#PizzaFractionQuiz\" ).css(\"background\", \"green\");\n }\n else {\n $( \"#PizzaFractionQuiz\" ).css(\"background\", \"red\");\n }\n }\n if( BN != \"?\" && BD != \"?\") {\n if(BN == \"4\" && BD == \"9\") {\n $( \"#BallsFractionQuiz\" ).css(\"background\", \"green\");\n }\n else {\n $( \"#BallsFractionQuiz\" ).css(\"background\", \"red\");\n }\n }\n}",
"function showHint() {\n clueToGuess = clue[Math.floor(Math.random() * clue.length)];\n for (var i = 0; i < clue; i++) {\n if (correctGuess === wordToGuess) {\n clue++;\n }\n clueToGuess.push(\" \");\n }\n document.getElementById(\"hint\").innerHTML = (\"Hint: \" + clueToGuess);\n}",
"function resetResults() {\n correct = 0;\n incorrect = 0;\n unanswered = 0;\n }",
"function hint(bool){\n\t/** SWITCH THIS STATEMENT TO TRUE IF WANT TO SHOW MORE ACCURATE HINT */\n\tvar showAnswer = false;\n\tvar hints = document.getElementById('hints');\n\t/** ADD IN THIS PART IF NEED THE HINT BAR TO SAY CORRECT. BUT REDUNDANT IN MESSAGE BOX ALREADY.\n\tif(bool == (colorCheck() && numberCheck())){\n\t\tdocument.getElementById('hints').innerHTML = \"Correct!\";\n\t\treturn;\n\t}\n\t*/\n\thints.innerHTML = \"\";\n\t//Checks if the user got a color logic error.\n\tif(bool != colorCheck()){\n\t\thints.innerHTML += showAnswer ? color[c1] + operation[op] + color[c2] + \" = \" + color[c3] : \"Color Logic Error\";\n\t\t//This only appear if there are both error compared to user's answer.\n\t\thints.innerHTML += colorCheck() == numberCheck() ? \" AND \" : \"\";\n\t}\n\t//Checks if the user got a number logic error.\n\tif(bool != numberCheck())\n\t\thints.innerHTML += showAnswer ? firstNumber + operation[op] + secondNumber + \" = \" + sum : \"Number Logic Error\";\n}",
"function gradeWord(words, answer) {\n const headWord = words.head.value;\n let mValue = headWord.memory_value;\n words.remove(headWord);\n if (!answer) {\n mValue = 1;\n headWord.incorrect_count++;\n } else {\n mValue *= 2;\n headWord.correct_count++;\n }\n headWord.memory_value = mValue;\n words.insertAt(headWord, mValue);\n return words;\n}",
"function correctGuess() {\n score += wrongAnswersLeft;\n if (score > hScore) {\n hScore = score;\n }\n setCorrectScreen(wrongAnswersLeft);\n }",
"function searchCorrect() {\n $(\"div\").each(function() {\n //if div text = answer\n if ($(this).text() === questionList[index].answer) {\n //show correct answer display\n $(this).addClass(\"correct\").append(correctIcon);\n }\n })\n }",
"function updateCount(){\r\n var commentText = document.getElementById(\"comment\").value;\r\n var charCount = countCharacters(commentText);\r\n var wordCountBox = document.getElementById(\"wordCount\");\r\n wordCountBox.value = charCount + \"/1000\";\r\n if (charCount > 1000) {\r\n wordCountBox.style.color = \"white\";\r\n wordCountBox.style.backgroundColor = \"red\";\r\n } else {\r\n wordCountBox.style.color = \"black\";\r\n wordCountBox.style.backgroundColor = \"white\";\r\n }\r\n}",
"function change_result_panel_color(correct_answer, user_choice, result_panel) {\n if (correct_answer === user_choice) {\n result_panel.find('span').css('background-color', '#5cb85c');\n result_panel.find('span').css('color', '#fff');\n result_panel.find('span').css('border-color', '#4cae4c');\n }\n else {\n result_panel.find('span').css('background-color', '#d9534f');\n result_panel.find('span').css('color', '#fff');\n result_panel.find('span').css('border-color', '#d43f3a');\n }\n}",
"function correct() {\n wins++;\n restartGame();\n }",
"function checkAnswer() {\n if (roundQuestions[currentQuestion].correct === selectedAnswer) {\n setCurrentScore(currentScore + 1)\n }\n setSubmitted(true);\n }",
"function score(answer) {\n if (answer == \"gr\") {\n dog.data[0].count++;\n } else if (answer == \"is\") {\n dog.data[1].count++;\n } else if (answer == \"ch\") {\n dog.data[2].count++;\n } else {\n dog.data[3].count++;\n }\n }",
"function review () { \n\tfor (var i = 0; i < questions.length; i++) {\n\t\tvar userChoice = $(\"input[name = 'question-\" + i +\"']:checked\");\n\t\tif (userChoice.val() == questions[i].correctAnswer) {\n\t\t\tcorrectAnswers++; \n\n\t\t\t} else {\n\t\t\t\tincorrectAnswers++;\n\t\t\t\t\n\t\t}\n\t}\n\t$(\"#correctAnswers\").append(\" \" + correctAnswers);\n\t$(\"#incorrectAnswers\").append(\" \" + incorrectAnswers); \n}",
"function changeTrivia() {\n if (answer === \"Question\") {\n $trivia.textContent = ('This is a sequel of sorts to The Moody Blues 1986 hit \"Your Wildest Dreams.\" Both songs were written by the groups guitarist, Justin Hayward,\" who told as that the success of \"Dreams\" showed him that such subject matter had universal appeal and was far from frivolous. As for the inspiration, he said: \"They both were about at least one particular person. I would not say it was all about one person, but at least one particular person. And my advice to anybody who wants to go back is that you can never go home. And best to leave the past as the past.')\n }\n if (answer === \"Cheverolet\") {\n $trivia.textContent = (\"Seven different V8s were available in 1957. One of the options was the legendary 'Super Turbo Fire V8' which produced 283 horsepower thanks to continuous fuel injection. A vehicle with this option is rare since most Tri Fives were fitted with a two or four barrel carburetor.\")\n }\n if (answer === \"Yosemite\") {\n $trivia.textContent = (\"Not just a great valley, but a shrine to human foresight, the strength of granite, the power of glaciers, the persistence of life, and the tranquility of the High Sierra.\")\n }\n if (answer === \"Puns\") {\n $trivia.textContent = (\"The humorous use of a word or phrase so as to emphasize or suggest its different meanings or applications, or the use of words that are alike or nearly alike in sound but different in meaning; a play on words.\")\n }\n if (answer === \"Bokeh\") {\n $trivia.textContent = (\"The orbs created when lights are out of focus in an image. It’s a neat effect to have in the background of a photo, created through wide apertures. It will have an interesting effect on your image quality. \")\n }\n if (answer === \"Sassafrass\") {\n $trivia.textContent = (\"This is used as an ingredient in making Root Beer.\")\n }\n if (answer === \"Beav\") {\n $trivia.textContent = (\"Nickname of the title character of Poppy's favorite show from the 50s.\")\n }\n if (answer === \"Melinda\") {\n $trivia.textContent = (\"A genius-level intellect, who kept her brains secret for many years as her hidden super power only to gradually unveil her talents over many years so as to not overwhelm the world with her greatness.\")\n }\n if (answer === \"Jennifer\") {\n $trivia.textContent = (\"Being always a little too grown up for her age, she was prepared to be a triumphant adult from an early age. She has an unending supply of love and compassion for anyone in need of it.\")\n }\n if (answer === \"Rhodonna\") {\n $trivia.textContent = (\"Famous for her Annette Funicello figure, she use to walk home everyday when she wasn't hanging out outside the photography room.\")\n }\n if (answer === \"Jackson\") {\n $trivia.textContent = (\"The pioneer in grandchilding, this person has never failed in making the most outlandish messes with baked beans.\")\n }\n if (answer === \"Lydia\") {\n $trivia.textContent = (\"The female lead in a cast of misfits, she has always stood out in her calm and kindness even from her young age.\")\n }\n if (answer === \"Ethan\") {\n $trivia.textContent = (\"A self-proclaimed superhero from birth, this young man carries a personality that is 100 times bigger than his actual size.\")\n }\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
load google translate(GT) APIs | function loadGoogleTranslate( win, rel )
{
// load OLAS GT API with appropriate relative link
if( typeof( rel ) == 'undefined' )
rel = ( win.name == 'myFrame' ? '../' : '' ) + '../../';
addJs( rel + "SCOFunctions/googletranslate.js?v=" + getPlayerWindow().GOOGLE_TRANSLATE_VERSION, win.document );
} | [
"function googleTranslateElementInit(){\n new google.translate.TranslateElement({pageLanguage:'en'},'google_translate_element');\n}",
"function loadGmailApi() {\n gapi.client.load('gmail', 'v1', listLabels);\n }",
"function loadAPIs(){\n\t\t\n\t\t//load youtube api\n\t\tif(g_temp.isYoutubePresent)\n\t\t\tg_ugYoutubeAPI.loadAPI();\n\t\t\n\t\tif(g_temp.isVimeoPresent)\n\t\t\tg_ugVimeoAPI.loadAPI();\n\t\t\n\t\tif(g_temp.isHtml5VideoPresent)\n\t\t\tg_ugHtml5MediaAPI.loadAPI();\n\t\t\n\t\tif(g_temp.isSoundCloudPresent)\n\t\t\tg_ugSoundCloudAPI.loadAPI();\n\t\t\n\t\tif(g_temp.isWistiaPresent)\n\t\t\tg_ugWistiaAPI.loadAPI();\n\t\t\n\t}",
"function loadTranslations(translations) {\n // Ensure the translate function exists\n if (!$localize.translate) {\n $localize.translate = translate;\n }\n if (!$localize.TRANSLATIONS) {\n $localize.TRANSLATIONS = {};\n }\n Object.keys(translations).forEach(key => {\n $localize.TRANSLATIONS[key] = parseTranslation(translations[key]);\n });\n}",
"function start() {\n\n service.gapi = gapi.client.init({\n 'apiKey': GOOGLE_API_KEY,\n 'discoveryDocs': [GOOGLE_API_LANGUAGE_URL]\n });\n \n if (cb) {\n cb();\n }\n \n }",
"function googleLanguages() {\n return {\n 'Afrikaans (Suid-Afrika)': 'af-ZA',\n 'Bahasa Indonesia (Indonesia)': 'id-ID',\n 'Bahasa Melayu (Malaysia)': 'ms-MY',\n 'Català (Espanya)': 'ca-ES',\n 'Čeština (Česká republika)': 'cs-CZ',\n 'Dansk (Danmark)': 'da-DK',\n 'Deutsch (Deutschland)': 'de-DE',\n 'English (Australia)': 'en-AU',\n 'English (Canada)': 'en-CA',\n 'English (Great Britain)': 'en-GB',\n 'English (India)': 'en-IN',\n 'English (Ireland)': 'en-IE',\n 'English (New Zealand)': 'en-NZ',\n 'English (Philippines)': 'en-PH',\n 'English (South Africa)': 'en-ZA',\n 'English (United States)': 'en-US',\n 'Español (Argentina)': 'es-AR',\n 'Español (Bolivia)': 'es-BO',\n 'Español (Chile)': 'es-CL',\n 'Español (Colombia)': 'es-CO',\n 'Español (Costa Rica)': 'es-CR',\n 'Español (Ecuador)': 'es-EC',\n 'Español (El Salvador)': 'es-SV',\n 'Español (España)': 'es-ES',\n 'Español (Estados Unidos)': 'es-US',\n 'Español (Guatemala)': 'es-GT',\n 'Español (Honduras)': 'es-HN',\n 'Español (México)': 'es-MX',\n 'Español (Nicaragua)': 'es-NI',\n 'Español (Panamá)': 'es-PA',\n 'Español (Paraguay)': 'es-PY',\n 'Español (Perú)': 'es-PE',\n 'Español (Puerto Rico)': 'es-PR',\n 'Español (República Dominicana)': 'es-DO',\n 'Español (Uruguay)': 'es-UY',\n 'Español (Venezuela)': 'es-VE',\n 'Euskara (Espainia)': 'eu-ES',\n 'Filipino (Pilipinas)': 'fil-PH',\n 'Français (France)': 'fr-FR',\n 'Galego (España)': 'gl-ES',\n 'Hrvatski (Hrvatska)': 'hr-HR',\n 'IsiZulu (Ningizimu Afrika)': 'zu-ZA',\n 'Íslenska (Ísland)': 'is-IS',\n 'Italiano (Italia)': 'it-IT',\n 'Lietuvių (Lietuva)': 'lt-LT',\n 'Magyar (Magyarország)': 'hu-HU',\n 'Nederlands (Nederland)': 'nl-NL',\n 'Norsk bokmål (Norge)': 'nb-NO',\n 'Polski (Polska)': 'pl-PL',\n 'Português (Brasil)': 'pt-BR',\n 'Português (Portugal)': 'pt-PT',\n 'Română (România)': 'ro-RO',\n 'Slovenčina (Slovensko)': 'sk-SK',\n 'Slovenščina (Slovenija)': 'sl-SI',\n 'Suomi (Suomi)': 'fi-FI',\n 'Svenska (Sverige)': 'sv-SE',\n 'Tiếng Việt (Việt Nam)': 'vi-VN',\n 'Türkçe (Türkiye)': 'tr-TR',\n 'Thai (Thailand)': 'th-TH',\n 'Ελληνικά (Ελλάδα)': 'el-GR',\n 'Български (България)': 'bg-BG',\n 'Русский (Россия)': 'ru-RU',\n 'Српски (Србија)': 'sr-RS',\n 'Українська (Україна)': 'uk-UA',\n 'עברית (ישראל)': 'he-IL',\n 'العربية (إسرائيل)': 'ar-IL',\n 'العربية (الأردن)': 'ar-JO',\n 'العربية (الإمارات)': 'ar-AE',\n 'العربية (البحرين)': 'ar-BH',\n 'العربية (الجزائر)': 'ar-DZ',\n 'العربية (السعودية)': 'ar-SA',\n 'العربية (العراق)': 'ar-IQ',\n 'العربية (الكويت)': 'ar-KW',\n 'العربية (المغرب)': 'ar-MA',\n 'العربية (تونس)': 'ar-TN',\n 'العربية (عُمان)': 'ar-OM',\n 'العربية (فلسطين)': 'ar-PS',\n 'العربية (قطر)': 'ar-QA',\n 'العربية (لبنان)': 'ar-LB',\n 'العربية (مصر)': 'ar-EG',\n 'فارسی (ایران)': 'fa-IR',\n 'हिन्दी (भारत)': 'hi-IN',\n '한국어 (대한민국)': 'ko-KR',\n '國語 (台灣)': 'cmn-Hant-TW',\n '廣東話 (香港)': 'yue-Hant-HK',\n '日本語(日本)': 'ja-JP',\n '普通話 (香港)': 'cmn-Hans-HK',\n '普通话 (中国大陆)': 'cmn-Hans-CN',\n }\n}",
"function loadLocale() {\n\tvar xobj = new XMLHttpRequest();\n\txobj.overrideMimeType(\"application/json\");\n\txobj.open('GET', '/locales/' + langCode + '.json', true);\n\txobj.onreadystatechange = function () {\n\t\tif (xobj.readyState == 4) {\n\t\t\tif (xobj.status == \"200\") {\n\t\t\t\tlocale = JSON.parse(xobj.responseText);\n\t\t\t\tholdRelease();\n\t\t\t} else {\n\t\t\t\tsplashHandler(\"doa\");// an app without language is unusable\n\t\t\t}\n\t\t}\n\t};\n\txobj.send(null);\n}",
"function pull() {\n\tvar locales = [],\n\t\tstrings = [],\n\t\ttransferAmount = 0;\n\n\tconsole.log('Fetching remote project information');\n\tasync.parallel([\n\t\t\t\n\t\t// Get the list of locales from Web Translate It\n\t\tfunction (next) {\n\t\t\trequest(wtiPrefix + privateKey + '.json', function (error, response, body) {\n\t\t\t\tif (body) {\n\t\t\t\t\ttransferAmount += body.length;\n\t\t\t\t}\n\t\t\t\tif (error) {\n\t\t\t\t\tnext('Could not fetch the Web Translate It information: ' + error);\n\t\t\t\t} else if (response.statusCode !== 200) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnext('Could not fetch the Web Translate It information: server returned ' +\n\t\t\t\t\t\t\tresponse.statusCode + ': ' + JSON.parse(body).error + '\\n');\n\t\t\t\t\t} catch(e) {\n\t\t\t\t\t\tnext('Could not fetch the Web Translate It information: server returned ' + response.statusCode + '\\n');\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tbody = JSON.parse(body);\n\t\t\t\t\t\tif (body.error) {\n\t\t\t\t\t\t\tnext('Could not fetch the Web Translate It information: ' + body.error);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (body.project && body.project.target_locales) {\n\t\t\t\t\t\t\tbody.project.target_locales.forEach(function(locale) {\n\t\t\t\t\t\t\t\tlocales.push(locale.code);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tnext();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnext('Could not fetch the Web Translate It information: invalid server response');\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch(e) {\n\t\t\t\t\t\tnext('Could not parse the Web Translate It locale response: ' + e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\t\t\n\t\t// Get the list of strings from Web Translate It\n\t\tfunction (next) {\n\t\t\trequest(wtiPrefix + privateKey + '/strings', function (error, response, body) {\n\t\t\t\tif (body) {\n\t\t\t\t\ttransferAmount += body.length;\n\t\t\t\t}\n\t\t\t\tif (error) {\n\t\t\t\t\tnext('Could not fetch the Web Translate It strings: ' + error);\n\t\t\t\t} else if (response.statusCode !== 200) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnext('Could not fetch the Web Translate It information: server returned ' +\n\t\t\t\t\t\t\tresponse.statusCode + ': ' + JSON.parse(body).error + '\\n');\n\t\t\t\t\t} catch(e) {\n\t\t\t\t\t\tnext('Could not fetch the Web Translate It information: server returned ' + response.statusCode + '\\n');\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tbody = JSON.parse(body);\n\t\t\t\t\t\tif (body.error) {\n\t\t\t\t\t\t\tnext('Could not fetch the Web Translate It information: ' + body.error);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbody.forEach(function (str) {\n\t\t\t\t\t\t\tstrings.push(str.id);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tnext();\n\t\t\t\t\t} catch(e) {\n\t\t\t\t\t\tnext('Could not parse the Web Translate It string response: ' + e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t], function(err) {\n\t\tif (err) {\n\t\t\tconsole.error(err);\n\t\t\tprocess.exit(1);\n\t\t} else {\n\t\t\tvar numRequests = locales.length * strings.length,\n\t\t\t\tlocaleTasks = [],\n\t\t\t\tpb = new progress(' :paddedPercent [:bar] :etas', {\n\t\t\t\t\tcomplete: '=',\n\t\t\t\t\tincomplete: '.',\n\t\t\t\t\twidth: 65,\n\t\t\t\t\ttotal: numRequests\n\t\t\t\t}),\n\t\t\t\ttranslations = {};\n\t\t\t\n\t\t\tconsole.log(' Fetched ' + locales.length + ' locales and ' + strings.length + ' strings\\nFetching remote internationalization information');\n\t\t\tpb.tick(1);\n\t\t\tlocales.forEach(function (locale) {\n\t\t\t\ttranslations[locale] = {};\n\t\t\t\tlocaleTasks.push(function (localeNext) {\n\t\t\t\t\tvar stringTasks = [];\n\t\t\t\t\tstrings.forEach(function (str) {\n\t\t\t\t\t\tstringTasks.push(function (strNext) {\n\t\t\t\t\t\t\trequest(wtiPrefix + privateKey + '/strings/' + str + '/locales/' + locale + '/translations.json', function (error, response, body) {\n\t\t\t\t\t\t\t\tif (body) {\n\t\t\t\t\t\t\t\t\ttransferAmount += body.length;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (error) {\n\t\t\t\t\t\t\t\t\tstrNext('Could not fetch the translations for \"' + str + '\": ' + error);\n\t\t\t\t\t\t\t\t} else if (response.statusCode !== 200) {\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tstrNext('Could not fetch the translations for \"' + str + '\": server returned ' +\n\t\t\t\t\t\t\t\t\t\t\tresponse.statusCode + ': ' + JSON.parse(body).error + '\\n');\n\t\t\t\t\t\t\t\t\t} catch(e) {\n\t\t\t\t\t\t\t\t\t\tstrNext('Could not fetch the translations for \"' + str + '\": server returned ' + response.statusCode + '\\n');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbody = JSON.parse(body);\n\t\t\t\t\t\t\t\t\tif (body.error) {\n\t\t\t\t\t\t\t\t\t\tstrNext('Could not fetch the translations for \"' + str + '\": ' + body.error);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (body.text) {\n\t\t\t\t\t\t\t\t\t\ttranslations[locale][body.string.key] = body.text;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tstrNext();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tpb.tick(1);\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\tasync.parallel(stringTasks, function(err, result) {\n\t\t\t\t\t\tlocaleNext(err, result);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t\tasync.parallel(localeTasks, function(err) {\n\t\t\t\t\n\t\t\t\tif (err) {\n\t\t\t\t\tconsole.error(err);\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t} else {\n\t\t\t\t\tvar projectTasks = [],\n\t\t\t\t\t\tnumLocalesAssembled = 0;\n\t\t\t\t\t\n\t\t\t\t\tconsole.log('\\n ' + (transferAmount / 1000).toFixed(0) + ' kb transferred in ' +\n\t\t\t\t\t\t((Date.now() - startTime) / 1000).toFixed(1) + ' seconds\\nAssembling local locale files');\n\t\t\t\t\tObject.keys(projects).forEach(function (projectName) {\n\t\t\t\t\t\tprojectTasks.push(function(projectNext) {\n\t\t\t\t\t\t\tconsole.log(' Assembling locale files for ' + projectName);\n\t\t\t\t\t\t\tvar masterLocaleFilePath = path.join(projects[projectName], 'locales', 'en.js'),\n\t\t\t\t\t\t\t\tmasterLocale,\n\t\t\t\t\t\t\t\tstr,\n\t\t\t\t\t\t\t\ttargetLocale;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tmasterLocale = JSON.parse(fs.readFileSync(masterLocaleFilePath));\n\t\t\t\t\t\t\t} catch(e) {\n\t\t\t\t\t\t\t\tprojectNext('Could not parse master locale file for ' + projectName + ': ' + e.message);\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tlocales.forEach(function (locale) {\n\t\t\t\t\t\t\t\tif (locale !== 'en') {\n\t\t\t\t\t\t\t\t\ttargetLocale = {};\n\t\t\t\t\t\t\t\t\tfor(str in masterLocale) {\n\t\t\t\t\t\t\t\t\t\ttargetLocale[str] = translations[locale] && translations[locale][str];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tfs.writeFileSync(path.join(projects[projectName], 'locales', locale + '.js'),\n\t\t\t\t\t\t\t\t\t\tJSON.stringify(targetLocale, false, '\\t'));\n\t\t\t\t\t\t\t\t\tnumLocalesAssembled++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tprojectNext();\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t\n\t\t\t\t\tasync.parallel(projectTasks, function(err) {\n\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\tconsole.log('\\n',err);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconsole.log(' Assembled ' + numLocalesAssembled + ' locale files\\n\\nSuccessfully pulled all remote i18n data\\n');\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n}",
"async function getTranslatedString(string, targetLang){\n AWS.config.region = \"us-east-1\";\n var ep = new AWS.Endpoint(\"https://translate.us-east-1.amazonaws.com\");\n AWS.config.credentials = new AWS.Credentials(\"AKIAJQLVBELRL5AAMZOA\", \"Kl0ArGHFySw+iBEdGXZDrTch2V5VAaDbSs+EKKEZ\");\n var translate = new AWS.Translate();\n translate.endpoint = ep;\n var params = {\n Text: string,\n SourceLanguageCode: \"en\",\n TargetLanguageCode: targetLang\n };\n var promise = new Promise((resolve, reject)=>{\n translate.translateText(params, (err, data)=>{\n if (err) return reject(err);\n else {\n return resolve(data);\n }\n });\n });\n var result = await promise;\n return result.TranslatedText;\n}",
"function getTranslatedUrl(text){\n return serverUrl + \"?\" + \"text=\" + text; \n\n}",
"function startYandexSdk() {\n (function(d) {\n var t = d.getElementsByTagName('script')[0];\n var s = d.createElement('script');\n s.src = 'https://yandex.ru/games/sdk/v2';\n s.async = true;\n t.parentNode.insertBefore(s, t);\n s.onload = initSDK;\n })(document);\n}",
"function onGooglePayLoaded() {\n var paymentsClient = getGooglePaymentsClient();\n paymentsClient.isReadyToPay(getGoogleIsReadyToPayRequest())\n .then(function (response) {\n if (response.result) {\n addGooglePayButton();\n // this is to improve performance after confirming site functionality\n prefetchGooglePaymentData();\n }\n }).catch(function (e) {\n console.error(e);\n\n if (Logger) {\n Logger.Error({ message: \"Error occured in onGooglePayLoaded method \", exception: e });\n }\n });\n}",
"function LoadGeoIP():IEnumerator\n\t{\n\t\tDebug.Log(\"Loading GeoIP lookup\");\n\t\tyield StartCoroutine(Playtomic.GeoIP.Lookup());\n\t\tvar response = Playtomic.GeoIP.GetResponse(\"Lookup\");\n\t\t\n\t\tif(response.Success)\n\t\t{\n\t\t\tDebug.Log(\"Country is: \" + response.GetValue(\"Code\") + \" - \" + response.GetValue(\"Name\"));\n\t\t}\n\t\telse\n\t\t{\n\t\t\tDebug.Log(\"Lookup failed because of \" + response.ErrorCode + \": \" + response.ErrorDescription);\n\t\t}\n\t}",
"function getCountryFromApi(country) {\n if (country === \"faroe islands\") {\n $(\"#js-error-message\").append(\n \"Sorry, there was a problem. Please select a country from the drop-down list!\"\n );\n throw new Error(\n \"Sorry, there was a problem. Please select a country from the drop-down list!\"\n );\n }\n\n const url = `https://agile-oasis-81673.herokuapp.com/api/country/${country}`;\n\n request(url)\n .then((rawCountryData) => {\n let translateRes, geoCodeRes, timeZone1Res, timeZone2Res;\n\n let countryData = findCountry(rawCountryData, country);\n\n $(\"html\").removeClass(\"first-background\");\n $(\"html\").addClass(\"second-background\");\n\n const googleTranslatePromise = googleTranslateApi(countryData).then(\n (res) => {\n translateRes = res;\n }\n );\n\n const geoCodingPromise = geoCodeCapitalApi(countryData)\n .then((res) => {\n geoCodeRes = res;\n return timeZoneApi1(geoCodeRes);\n })\n .then((res) => {\n timeZone1Res = res;\n return timeZoneApi2(timeZone1Res);\n })\n .then((res) => {\n timeZone2Res = res;\n });\n\n Promise.all([googleTranslatePromise, geoCodingPromise]).then(() => {\n $(\"body\").addClass(\"centered\");\n let countryCapital = countryData.capital;\n let countryName = countryData.name;\n displayTimeResults(\n timeZone2Res,\n countryCapital,\n countryName,\n translateRes\n );\n restartButton();\n $(\"header\").addClass(\"hidden\");\n $(\"footer\").addClass(\"hidden\");\n });\n })\n .catch((err) => {\n $(\"#js-error-message\").append(\n \"Sorry, there was a problem. Please select a country from the drop-down list! \" +\n err.message +\n \".\"\n );\n });\n}",
"getWordsFromBackend(successCbk, errorCbk){\n \n var url = 'https://nx-puzzle.firebaseio.com/words.json?auth=' + this.auth;\n\n this.$http.get(url).then(function(res){\n\n console.log('WordsService -≥ getWordsFromBackend : Words were loaded successfully. Response:',res);\n\n successCbk(res); \n\n }, function (res) {\n console.error('WordsService -≥ getWordsFromBackend : There was an error during loading words. Response:', res);\n\n errorCbk(res); \n });\n }",
"function loadLocale() {\n let {\n pathPrefix,\n locale,\n extension\n } = configuration;\n\n const url = `${pathPrefix}/${locale}${extension}`;\n\n fetch(url)\n .then(res => res.json())\n .then(res => json = res)\n .then(consumeSubscribers)\n .catch(loadFallbackLocale);\n}",
"function translateQuote(quote) {\nvar langCode = langDrop.options[langDrop.selectedIndex].id\nconsole.log(langCode);\nfetch(`https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=${langCode}`, {\n method: \"POST\",\n headers: {\n \"Ocp-Apim-Subscription-Key\": \"5377b25d2ec94e7aa99cd9209862184f\",\n \"Ocp-Apim-Subscription-Region\": \"eastus\",\n \"Content-Type\": \"application/json; charset=UTF-8\",\n },\n body: JSON.stringify([\n {\"Text\": quote}\n]),\n})\n .then((response) => {\n return response.json();\n })\n .then((response) => {\n console.log(response);\n for(var prop in response){\n console.log(response[prop].translations[prop].text);\n var translatedQuote = response[prop].translations[prop].text;\n var transQuoteHolder = document.getElementById(\"tr-Quote\");\n\n transQuoteHolder.append(translatedQuote);\n localStorage.setItem(\"translatedQuote\", response[prop].translations[prop].text);\n };\n })\n .catch((err) => {\n console.error(err);\n });\n}",
"function geocodeRequest(key, address, callback)\r\n{\r\n let script = document.createElement('script');\r\n script.src = \"https://api.opencagedata.com/geocode/v1/json?q=\" + encodeURIComponent(address) + \"&key=\" + key + \"&jsonp=\" + callback;\r\n document.body.appendChild(script);\r\n}",
"function initializeI18n() {\n var language = app.utils.i18n.getLanguage();\n i18next\n .use(i18nextXHRBackend)\n .init({\n lng: language.lang,\n fallbackLng: 'en',\n whitelist: ['en', 'hi', 'ar'],\n nonExplicitWhitelist: true,\n preload: ['en', 'hi', 'ar'],\n backend: {\n loadPath: 'assets/custom/i18n/{{lng}}.json'\n }\n },\n function() {\n app.utils.i18n.setLanguage(language);\n });\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
basic FS setup, for config data see setConfigData(), for voices see setVoiceData() | function setUpVFS() {
var optionFiles = {
'croak': 'language variant\nname croak\ngender male 70\npitch 85 117\nflutter 20\nformant 0 100 80 110\n',
'f1': 'language variant\nname female1\ngender female 70\npitch 140 200\nflutter 8\nroughness 4\nformant 0 115 80 150\nformant 1 120 80 180\nformant 2 100 70 150 150\nformant 3 115 70 150\nformant 4 110 80 150\nformant 5 110 90 150\nformant 6 105 80 150\nformant 7 110 70 150\nformant 8 110 70 150\nstressAdd -10 -10 -20 -20 0 0 40 60\n',
'f2': 'language variant\nname female2\ngender female\npitch 142 220\nroughness 3\nformant 0 105 80 150\nformant 1 110 80 160\nformant 2 110 70 150\nformant 3 110 70 150\nformant 4 115 80 150\nformant 5 115 80 150\nformant 6 110 70 150\nformant 7 110 70 150\nformant 8 110 70 150\nstressAdd 0 0 -10 -10 0 0 10 40\nbreath 0 2 3 3 3 3 3 2\necho 140 10\nconsonants 125 125\n',
'f3': 'language variant\nname female3\ngender female\npitch 140 240\nformant 0 105 80 150\nformant 1 120 75 150 -50\nformant 2 135 70 150 -250\nformant 3 125 80 150\nformant 4 125 80 150\nformant 5 125 80 150\nformant 6 120 70 150\nformant 7 110 70 150\nformant 8 110 70 150\nstressAmp 18 18 20 20 20 20 20 20\n//breath 0 2 4 4 4 4 4 4\nbreath 0 2 3 3 3 3 3 2\necho 120 10\nroughness 4\n',
'f4': 'language variant\nname female4\ngender female\necho 130 15\npitch 142 200\nformant 0 120 80 150\nformant 1 115 80 160 -20\nformant 2 130 75 150 -200\nformant 3 123 75 150\nformant 4 125 80 150\nformant 5 125 80 150\nformant 6 110 80 150\nformant 7 110 75 150\nformant 8 110 75 150\nstressAdd -20 -20 -20 -20 0 0 20 120\nstressAmp 18 16 20 20 20 20 20 20\n',
'f5': 'language variant\nname female5\ngender female\npitch 160 228\nroughness 0\nformant 0 105 80 150\nformant 1 110 80 160\nformant 2 110 70 150\nformant 3 110 70 150\nformant 4 115 80 200\nformant 5 115 80 100\nformant 6 110 70 150\nformant 7 110 70 100\nformant 8 110 70 150\nstressAdd 0 0 -10 -10 0 0 10 40\nbreath 0 4 6 6 6 6 0 10\necho 140 10\nvoicing 75\nconsonants 150 150\nbreathw 150 150 200 200 400 400\n',
'klatt': 'language variant\nname klatt\nklatt 1\n',
'klatt2': 'language variant\nname klatt2\nklatt 2\n',
'klatt3': 'language variant\nname klatt3\nklatt 3\n',
'm1': 'language variant\nname male1\ngender male 70\npitch 75 109\nflutter 5\nroughness 4\nconsonants 80 100\nformant 0 98 100 100\nformant 1 97 100 100\nformant 2 97 95 100\nformant 3 97 95 100\nformant 4 97 85 100\nformant 5 105 80 100\nformant 6 95 80 100\nformant 7 100 100 100\nformant 8 100 100 100\n//stressAdd -10 -10 -20 -20 0 0 40 70\n',
'm2': 'language variant\nname male2\ngender male\npitch 88 115\necho 130 15\nformant 0 100 80 120\nformant 1 90 85 120\nformant 2 110 85 120\nformant 3 105 90 120\nformant 4 100 90 120\nformant 5 100 90 120\nformant 6 100 90 120\nformant 7 100 90 120\nformant 8 100 90 120\n',
'm3': 'language variant\nname male3\ngender male\npitch 80 122\nformant 0 100 100 100\nformant 1 96 97 100\nformant 2 96 97 100\nformant 3 96 103 100\nformant 4 95 103 100\nformant 5 95 103 100\nformant 6 100 100 100\nformant 7 100 100 100\nformant 8 100 100 100\nstressAdd 10 10 0 0 0 0 -30 -30\n',
'm4': 'language variant\nname male4\ngender male\npitch 70 110\nformant 0 103 100 100\nformant 1 103 100 100\nformant 2 103 100 100\nformant 3 103 100 100\nformant 4 106 100 100\nformant 5 106 100 100\nformant 6 106 100 100\nformant 7 103 100 100\nformant 8 103 100 100\nstressAdd -10 -10 -30 -30 0 0 60 90\n',
'm5': 'language variant\nname male5\ngender male\nformant 0 100 85 130\nformant 1 90 85 130 40\nformant 2 80 85 130 310\nformant 3 105 85 130\nformant 4 105 85 130\nformant 5 105 85 130\nformant 6 105 85 150\nformant 7 105 85 150\nformant 8 105 85 150\nintonation 2\n',
'm6': 'language variant\nname male6\ngender male\npitch 82 117\nformant 0 100 90 120\nformant 1 100 90 140\nformant 2 100 70 140\nformant 3 100 75 140\nformant 4 100 80 140\nformant 5 100 80 140\n',
'm7': 'language variant\nname male7\npitch 75 125\nformant 0 100 125 100\nformant 1 100 90 80\nformant 2 100 70 90\nformant 3 100 60 90\nformant 4 100 60 90\nformant 5 75 50 90\nformant 6 90 50 100\nformant 7 100 50 100\nformant 8 100 50 100\nvoicing 155\n',
'whisper': 'language variant\nname whisper\npitch 75 125\nformant 0 100 125 100\nformant 1 100 90 80\nformant 2 100 70 90\nformant 3 100 60 90\nformant 4 100 60 90\nformant 5 75 50 90\nformant 6 90 50 100\nformant 7 100 50 100\nformant 8 100 50 100\nvoicing 155\n',
'whisperf': 'language variant\nname female whisper\ngender female\npitch 160 220\nroughness 3\nformant 0 105 0 150\nformant 1 110 40 160\nformant 2 110 70 150\nformant 3 110 70 150\nformant 4 115 80 150\nformant 5 115 80 150\nformant 6 110 70 150\nformant 7 110 70 150\nformant 8 110 70 150\nstressAdd 0 0 -10 -10 0 0 10 40\n// whisper\nvoicing 20\nbreath 75 75 50 40 15 10\nbreathw 150 150 200 200 400 400\n'
};
var dir = eSpeakVoicesDir + '/!v';
eSpeak.FS.createPath('/', dir.substring(1), true, true);
eSpeak.FS.root.write = true;
for (var fn in optionFiles) {
eSpeak.FS.createDataFile(dir, fn, decodeStringToArray(optionFiles[fn]), true, true);
}
} | [
"setUp(options){\n this.setUpDeviceListeners(undefined, this.onOSCMessage);\n this.setUpDevice({ osc: options });\n }",
"init(){\n this.dxcFolder = _path_.join( this.path, '.dxc'); \n this.binFolder = _path_.join( this.dxcFolder, 'bin');\n this.apiFolder = _path_.join( this.dxcFolder, 'api');\n this.cfgFolder = _path_.join( this.dxcFolder, 'cfg');\n this.devFolder = _path_.join( this.dxcFolder, 'dev');\n this.pluginsFolder = _path_.join( this.dxcFolder, 'plugins');\n this.tmpFolder = _path_.join( this.dxcFolder, 'tmp');\n\n // config\n this.configPath = _path_.join( this.cfgFolder, FILENAME_CONFIG);\n this.oldconfigPath = _path_.join( this.cfgFolder, FILENAME_OLDCONFIG);\n\n DexcaliburWorkspace.mkdirIfNotExists(this.dxcFolder);\n DexcaliburWorkspace.mkdirIfNotExists(this.binFolder);\n DexcaliburWorkspace.mkdirIfNotExists(this.apiFolder);\n DexcaliburWorkspace.mkdirIfNotExists(this.cfgFolder);\n DexcaliburWorkspace.mkdirIfNotExists(this.devFolder);\n DexcaliburWorkspace.mkdirIfNotExists(this.tmpFolder);\n DexcaliburWorkspace.mkdirIfNotExists(this.pluginsFolder);\n }",
"function generalSetup() {\n // Scene\n scene = new THREE.Scene();\n // Camera setup\n camera = new THREE.PerspectiveCamera(75, canvasSize.width / canvasSize.height, 0.1, 1000);\n camera.position.set(1, 0, 0);\n // Renderer setup\n renderer = new THREE.WebGLRenderer({antialias: true});\n renderer.setSize(canvasSize.width, canvasSize.height);\n cv.appendChild(renderer.domElement);\n // Post processing setup\n composer = new POSTPROCESSING.EffectComposer(renderer);\n composer.addPass(new POSTPROCESSING.RenderPass(scene, camera));\n const effectPass = new POSTPROCESSING.EffectPass(camera, new POSTPROCESSING.BloomEffect());\n effectPass.renderToScreen = true;\n composer.addPass(effectPass);\n}",
"function setup() {\n createCanvas(windowWidth + canvasEdge, windowHeight + canvasEdge, WEBGL);\n smooth();\n\n initializeStates();\n initializePlanets();\n initializeStars();\n initializeUI();\n initializeSound();\n\n}",
"function setup()\n{\n commandQueue = [];\n commandQueue.push({c : createDefaultFolders , msg : \"Folders -> OK\"});\n commandQueue.push({c : writeIndexBoilerplate , msg : \"Index Boilerplate -> OK\"});\n commandQueue.push({c : writePluginsJS , msg : \"Default Plugins -> OK\"});\n commandQueue.push({c : writeDefaultIcon , msg : \"Default Icon -> OK\"});\n commandQueue.push({c : writeGitIgnore , msg : \"git ignore -> OK\"});\n \n processQueue();\n}",
"function mySetup(){\n\t//Create an example document.\n\tvar myDocument = app.documents.add();\n\tmyDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;\n\tmyDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;\n\tmyDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;\n\tmyDocument.documentPreferences.pageWidth = 222 + 72;\n\tmyDocument.documentPreferences.pageHeight = 214.658 + 72;\n\twith(myDocument.metadataPreferences){\n\t\tauthor = \"Adobe Systems\";\n\t\tdescription = \"This is a sample PDF with XMP metadata.\";\n\t}\n\tvar myPage = myDocument.pages.item(0);\n\tapp.polygonPreferences.numberOfSides = 5;\n\tapp.polygonPreferences.insetPercentage = 50;\n\tvar myPolygon = myPage.polygons.add({geometricBounds:[72, 72, 214.658, 222]});\n\tmyPolygon.exportFile(ExportFormat.pdfType, File(\"/c/test.pdf\"));\n\tmyDocument.close(SaveOptions.no);\n\tmyDocument = app.documents.add();\n\tmyDocument.pages.item(0).place(File(Folder.desktop + \"/test.pdf\"));\n}",
"function startSPE() {\n\t// initialize object\n\tvar spe = new SPE();\n\tspe.reloadSPE = restartSPE;\n\t// initialize hidden html structure\n\tspe.generateBodyStructure();\n\t// enable loading animation\n\tspe.hideLoading(false);\n\t// as a start load the text instead of animation while loading\n\tspe.generateLoaderMessage(\"Scatter Plot Explorer\");\n\t// timeout allows the repaint to catch a break between preload and init\n\tsetTimeout(function(){\n\t\tspe.preloadData();\n\t}, 1);\n}",
"function init() {\n checkBiquadFilterQ().then(function(flag) {\n hasNewBiquadFilter = flag;\n context = new AudioContext();\n hasIIRFilter = context['createIIRFilter'] ? true : false;\n });\n\n const magStyle = document.querySelector('#mag-select');\n magStyle.addEventListener('change', (event) => {\n setPlotType(event.target.value);\n });\n\n const freqStyle = document.querySelector('#freq-select');\n freqStyle.addEventListener('change', (event) => {\n setFreqType(event.target.value);\n });\n}",
"function init() {\n var test = AppConfig.testPaper;\n DataManager.loadJSON('/test_assets/' + test + '/' + test + '.json')\n .done(function(){\n\n // load assets\n DataManager.setAssetIndexes({ assetIndex: 0, fileIndex: 0 });\n loadAssets('core');\n })\n .fail(function(){\n\n // stop everything and notify user\n var message = {\n header: \"Initialisation Failure\",\n body: \"<div style='width:400px;'>Unable to initialise \" + test + \".json</div>\",\n footer: \"<button class='close'>OK</button>\",\n modal: true\n }\n Modal.showModal(message);\n });\n }",
"function setupHud() {\n setAttributes(\"antialias\", true)\n easycam = createEasyCam()\n document.oncontextmenu = function () {\n return false\n }\n\n // set initial camera state\n easycam.setState(state)\n easycam.state_reset = state // state to use on reset\n\n // use the loaded font\n textFont(f)\n textSize(16)\n}",
"function setupUserConfig() {\n let cfg = path.join(u.dataLoc(), 'cfg.env')\n if(shell.test(\"-f\", cfg)) return\n\n shell.echo(`\\n\\nCreating configuration file...`)\n shell.echo(`# understand/\n# We use environment variables to configure various skills and services.\n# In order to pass the information to the required components we need to\n# set them in this file.\n\n# For Telegram Channel\nTELEGRAM_TOKEN=\n\n# For what-wine skill\nMASHAPE_KEY=\n\n# for AI Artist Skill\nAIARTIST_HOST=\nAIARTIST_PORT=\n`).to(cfg)\n shell.echo(`Please edit this file: ${cfg}`)\n shell.echo(`To add your own TELEGRAM_TOKEN, etc...\\n\\n`)\n}",
"function setup() {\n createCanvas(windowWidth,windowHeight);\n noStroke();\n textAlign(CENTER,CENTER);\n\n // Creates the onscreen text\n onscreenText = new OnscreenText(width/2,height/9,50,pixelFont);\n\n // Creates the input field\n input = createInput();\n input.position(width/2 - input.width/2, 200);\n\n // Creates blank fears (we will fill them later based on player input)\n for (var i = 0; i < 10; i++) {\n fears[i] = new Fear(\" \",50,pixelFont);\n }\n}",
"async start () {\n log('starting')\n\n // start the daemon\n this._ipfs = await IPFS.create(\n Object.assign({}, { start: true, libp2p: getLibp2p }, this._options)\n )\n\n // start HTTP servers (if API or Gateway is enabled in options)\n this._httpApi = new HttpApi(this._ipfs)\n await this._httpApi.start()\n\n this._httpGateway = new HttpGateway(this._ipfs)\n await this._httpGateway.start()\n\n const config = await this._ipfs.config.getAll()\n\n if (config.Addresses && config.Addresses.RPC) {\n this._grpcServer = await gRPCServer(this._ipfs)\n }\n\n log('started')\n }",
"function setupInstruments(){\n // set at which octave each voice will play\n syn1.oct=12;\n syn3.oct=-24;\n syn2.oct=0;\n // assign phrasesto each synth\n syn2.notes=phrase1;\n syn1.notes=phrase2;\n syn3.notes=phrase3;\n loadAnInstrument(syn2);\n loadAnInstrument(syn1);\n loadAnInstrument(syn3);\n}",
"function initApplication() \n{\n console.log(\"Loading sounds\\n\");\n\n var outval = {};\n var result;\n\n /*\n Create an oscillator DSP units for the tone.\n */\n result = gSystem.createDSPByType(FMOD.DSP_TYPE_OSCILLATOR, outval);\n CHECK_RESULT(result);\n gDSP = outval.val;\n\n result = gDSP.setParameterFloat(FMOD.DSP_OSCILLATOR_RATE, 440.0); /* Musical note 'A' */\n CHECK_RESULT(result);\n}",
"setupSteps() {\n // Functions for setting up the DOM for each step. Order is important\n this.steps = [() => this.fileUploadStep(), () => this.requiredInfoStep(), () => this.resultsStep()];\n // Setup current step\n this.steps[this.currentStep]();\n }",
"async initVolumeManager_() {\n const allowedPaths = this.getAllowedPaths_();\n const writableOnly =\n this.launchParams_.type === DialogType.SELECT_SAVEAS_FILE;\n const disabledVolumes =\n /** @type {!Array<!VolumeManagerCommon.VolumeType>} */ (\n await this.getDisabledVolumes_());\n\n // FilteredVolumeManager hides virtual file system related event and data\n // even depends on the value of |supportVirtualPath|. If it is\n // VirtualPathSupport.NO_VIRTUAL_PATH, it hides Drive even if Drive is\n // enabled on preference.\n // In other words, even if Drive is disabled on preference but the Files app\n // should show Drive when it is re-enabled, then the value should be set to\n // true.\n // Note that the Drive enabling preference change is listened by\n // DriveIntegrationService, so here we don't need to take care about it.\n this.volumeManager_ = new FilteredVolumeManager(\n allowedPaths, writableOnly,\n this.fileBrowserBackground_.getVolumeManager(),\n this.launchParams_.volumeFilter, disabledVolumes);\n }",
"static init()\n {\n let aeFDC = Component.getElementsByClass(document, PCx86.APPCLASS, \"fdc\");\n for (let iFDC = 0; iFDC < aeFDC.length; iFDC++) {\n let eFDC = aeFDC[iFDC];\n let parmsFDC = Component.getComponentParms(eFDC);\n let fdc = new FDC(parmsFDC);\n Component.bindComponentControls(fdc, eFDC, PCx86.APPCLASS);\n }\n }",
"function run(context) {\n\n \"use strict\";\n\n // This holds a representation of the AFE model populated by parseAFEJson()\n var afeModel = {};\n\n var app = adsk.core.Application.get(), ui;\n if (app) {\n ui = app.userInterface;\n }\n\n var filename = \"\"; // Name of the file to import\n\n // Create the command definition.\n var createCommandDefinition = function() {\n var commandDefinitions = ui.commandDefinitions;\n var commandDefinitions = ui.commandDefinitions;\n\n // Be fault tolerant in case the command is already added...\n var cmDef = commandDefinitions.itemById('ForceEffectImport');\n if (!cmDef) {\n cmDef = commandDefinitions.addButtonDefinition('ForceEffectImport',\n 'ForceEffect Import',\n 'Import a ForceEffect or ForceEffect Motion document.',\n './resources'); // relative resource file path is specified\n }\n return cmDef;\n };\n\n // CommandCreated event handler.\n var onCommandCreated = function(args) {\n try {\n // Connect to the CommandExecuted event.\n var command = args.command;\n command.execute.add(onCommandExecuted);\n\n // Terminate the script when the command is destroyed\n command.destroy.add(function () { adsk.terminate(); });\n\n // Define the inputs.\n var inputs = command.commandInputs;\n\n var initValScale = adsk.core.ValueInput.createByReal(afeModel.Scale);\n inputs.addValueInput('scale', 'Scale', 'cm' , initValScale); // REVIEW: What about unitless values?\n\n var initValCompWidth = adsk.core.ValueInput.createByReal(afeModel.ComponentWidth);\n inputs.addValueInput('componentWidth', 'Component Width', 'cm' , initValCompWidth);\n\n inputs.addBoolValueInput('extrude', 'Extrude', true, \".\", true);\n\n var initValExtrudeDist = adsk.core.ValueInput.createByReal(afeModel.ExtrudeDist);\n inputs.addValueInput('extrudeHeight', 'Extrude Distance', 'cm' , initValExtrudeDist);\n\n var initValJointHoleDiam = adsk.core.ValueInput.createByReal(afeModel.JointHoleDiameter);\n inputs.addValueInput('jointHoleDiameter', 'Joint Hole Diameter', 'cm' , initValJointHoleDiam);\n }\n catch (e) {\n ui.messageBox('Failed to create command : ' + (e.description ? e.description : e));\n }\n };\n\n // CommandExecuted event handler.\n var onCommandExecuted = function(args) {\n try {\n\n // Extract input values\n var unitsMgr = app.activeProduct.unitsManager;\n var command = adsk.core.Command(args.firingEvent.sender);\n var inputs = command.commandInputs;\n\n var scaleInput, componentWidthInput, extrudeInput, extrudeHeightInput, jointHoleDiameterInput;\n\n // Problem with a problem - the inputs are empty at this point. We\n // need access to the inputs within a command during the execute.\n for (var n = 0; n < inputs.count; n++) {\n var input = inputs.item(n);\n if (input.id === 'scale') {\n scaleInput = adsk.core.ValueCommandInput(input);\n }\n else if (input.id === 'componentWidth') {\n componentWidthInput = adsk.core.ValueCommandInput(input);\n }\n else if (input.id === 'extrude') {\n extrudeInput = adsk.core.BoolValueCommandInput(input);\n }\n else if (input.id === 'extrudeHeight') {\n extrudeHeightInput = adsk.core.ValueCommandInput(input);\n }\n else if (input.id === 'jointHoleDiameter') {\n jointHoleDiameterInput = adsk.core.ValueCommandInput(input);\n }\n }\n\n if (!scaleInput || !componentWidthInput || !extrudeInput || !extrudeHeightInput || !jointHoleDiameterInput) {\n ui.messageBox(\"One of the inputs don't exist.\");\n return;\n }\n\n var scale = unitsMgr.evaluateExpression(scaleInput.expression, \"cm\");\n if (scale <= 0.0) {\n ui.messageBox(\"Invalid scale: must be > 0\");\n return;\n }\n\n afeModel.Scale = scale;\n\n var componentWidth = unitsMgr.evaluateExpression(componentWidthInput.expression, \"cm\");\n if (componentWidth <= 0.0) {\n ui.messageBox(\"Invalid component width: must be > 0\");\n return;\n }\n\n afeModel.ComponentWidth = componentWidth;\n\n var doExtrude = extrudeInput.value;\n\n var extrudeHeight = unitsMgr.evaluateExpression(extrudeHeightInput.expression, \"cm\");\n if (extrudeHeight <= 0.0) {\n ui.messageBox(\"Invalid extrude height: must be > 0\");\n return;\n }\n\n afeModel.ExtrudeHeight = extrudeHeight;\n\n var jointHoleDiameter = unitsMgr.evaluateExpression(jointHoleDiameterInput.expression, \"cm\");\n if (jointHoleDiameter <= 0.0) {\n ui.messageBox(\"Invalid joint hole diameter: must be > 0\");\n return;\n }\n\n afeModel.JointHoleDiameter = jointHoleDiameter;\n\n // Generate the drawing\n generateDrawing(afeModel, doExtrude);\n }\n catch (e) {\n ui.messageBox('Failed to import : ' + (e.description ? e.description : e));\n }\n };\n\n // Convert AFE value into centimeters\n function afeVal2cm(unit, value)\n {\n if (unit === \"ft\")\n return (value * 12 * 2.54); // ft -> in -> cm\n else if (unit == \"in\")\n return (value * 2.54); // in -> cm\n else if (unit == \"mm\")\n return (value / 10); // mm -> cm\n else if (unit == \"m\")\n return (value * 100); // meter -> cm\n else\n return (+value); // error?\n };\n\n // Return the Ids (keys) of a hashtable\n function hastableKeys(dict)\n {\n var ids = [];\n\n for (var id in dict)\n {\n if (dict.hasOwnProperty(id))\n ids.push(id);\n }\n\n return ids;\n };\n\n // Find the Joint's Point with a specified label\n function getJointPoint(joint, label)\n {\n if (!joint.Point.length)\n {\n if (joint.Point.Label === label)\n return joint.Point;\n }\n else // array\n {\n // Iterate over points\n for (var i = 0; i < joint.Point.length; ++i)\n {\n if (joint.Point[i].Label === label)\n return joint.Point[i];\n }\n }\n\n return null; // not found\n };\n\n // Rotate the X,Y point around the origin point.\n // Returns rotated point: {x,y}\n function rotatePoint(angleRadians, x, y, xOrigin, yOrigin)\n {\n return {\n\t\t x: Math.cos(angleRadians) * (x-xOrigin) - Math.sin(angleRadians) * (y-yOrigin) + xOrigin,\n\t\t y: Math.sin(angleRadians) * (x-xOrigin) + Math.cos(angleRadians) * (y-yOrigin) + yOrigin\n\t };\n };\n\n // Parses the AFE file and populates the afeModel object.\n function parseAFEFile(filename)\n {\n // The AFE Model object\n afeModel =\n {\n Title: \"\",\n Filename: filename,\n\n LengthUnit: \"ft\",\n\n // Hashtables (id -> elem)\n Joints: {},\n Components: {},\n Supports: {},\n\n // Will contain bounds of all elements\n Bounds:\n {\n xMin: Number.MAX_VALUE,\n yMin: Number.MAX_VALUE,\n xMax: Number.MIN_VALUE,\n yMax: Number.MIN_VALUE\n },\n\n // Min/Max line lengths\n LineLengths:\n {\n min: Number.MAX_VALUE,\n max: Number.MIN_VALUE,\n },\n\n // Amount to scale source model when creating Fusion model.\n Scale: 1.0,\n\n // Amount to extrude\n ExtrudeDist: app.activeProduct.unitsManager.evaluateExpression(\"0.3\", \"cm\"),\n\n // Set width of component bodies\n ComponentWidth: app.activeProduct.unitsManager.evaluateExpression(\"0.5\", \"cm\"),\n\n // Set diameter of joint holes\n JointHoleDiameter: app.activeProduct.unitsManager.evaluateExpression(\"1\", \"mm\")\n };\n\n // The current format of an AFE file comes in binary or text formats. The\n // text file contains an XML representation while the binary also contains\n // XML as well as other binary data.\n //\n // This parsing code determines which is which by looking at the first set\n // of values in the file. If they are text based then we assume it's a\n // text file. Otherwise, it's a binary. This is a hack but works for now.\n\n // Begin by reading in the buffer.\n var buffer = adsk.readFile(filename);\n if (!buffer) {\n ui.messageBox('Failed to open ' + filename);\n return null;\n }\n\n var bytes = new Uint8Array(buffer);\n if (bytes.byteLength < 20) {\n ui.messageBox('Invalid data file. Not enough data: ' + filename);\n return null;\n }\n\n // At the start of a binary version of the file is a header:\n //\n // 16 bytes (?)\n // 4 bytes (length of XML section)\n // XML section\n // Remainder of binary data\n //\n // Let's look at the first set of bytes to see if they are binary or text.\n // That will determine how we parse.\n var parseBinary = false;\n var asciiChars = /^[ -~\\t\\n\\r]+$/;\n for (var ii = 0; ii < 16; ++ii) {\n var ch = String.fromCharCode(bytes[ii]);\n if ( !asciiChars.test( ch ) ) {\n // non-ascii character\n parseBinary = true;\n break;\n }\n }\n\n var xmlBytes; // This will hold the XML to parse\n\n // This is a binary file\n if (parseBinary) {\n\n // Extract the XML section length from the header\n var xmlLength = (+bytes[16]) + (256 * bytes[17]);\n\n // Now extract the XML. Note, offset another 2 bytes later\n xmlBytes = bytes.subarray(20,xmlLength+20); // args = begin, end\n }\n else {\n xmlBytes = bytes; // XML text file so use all of it.\n }\n\n // Convert the model xml to a JSON string\n var xml = adsk.utf8ToString(xmlBytes);\n var jsonAFE = $.xml2json(xml);\n if (!jsonAFE) {\n ui.messageBox('Failed to convert file ' + filename);\n return null;\n }\n\n // Begin parsing - Extract settings from the file header.\n //\n // <File Schema=\"9\" Title=\"Diagram00014\" IsImperial=\"1\" UnitsVisible=\"1\" LengthUnit=\"ft\" AppType=\"afe\"\n // ForceUnit=\"lb\" MovieIsValid=\"0\" ScreenWidth=\"320\" ScreenHeight=\"524\" SimulationSpeed=\"35.000000\">\n if (jsonAFE.Title) {\n afeModel.Title = jsonAFE.Title;\n }\n\n if (afeModel.Title === \"\") {\n afeModel.Title = \"ForceEffect Import\";\n }\n\n if (jsonAFE.LengthUnit) {\n afeModel.LengthUnit = jsonAFE.LengthUnit;\n }\n\n // Parse the \"Elements\"\n if (jsonAFE.Elements && jsonAFE.Elements.Ided)\n {\n for (var iElem = 0; iElem < jsonAFE.Elements.Ided.length; ++iElem)\n {\n var elem = jsonAFE.Elements.Ided[iElem];\n if (!elem.TypeID) {\n continue;\n }\n\n if (elem.TypeID == \"Joint\")\n {\n // <Ided TypeID=\"Joint\" ObjectId=\"3\" Index=\"1\">\n afeModel.Joints[elem.ObjectId] = elem;\n }\n else if (elem.TypeID == \"Component\")\n {\n // <Ided TypeID=\"Component\" ObjectId=\"2\">\n afeModel.Components[elem.ObjectId] = elem;\n }\n else if (elem.TypeID == \"Support\")\n {\n // <Ided TypeID=\"Support\" ObjectId=\"1\">\n afeModel.Supports[elem.ObjectId] = elem;\n }\n }\n }\n\n // Iterate through the elements to calc bounding box.\n var idsComps = hastableKeys(afeModel.Components); // get Ids of components\n for (var i = 0; i < idsComps.length; ++i)\n {\n var idComp = idsComps[i];\n var comp = afeModel.Components[idComp];\n\n var startJoint = afeModel.Joints[comp.StartJoint.ObjId];\n var endJoint = afeModel.Joints[comp.EndJoint.ObjId];\n\n if (!startJoint || !endJoint)\n {\n console.log(\"Error: Unable to find start or end joint\");\n continue;\n }\n\n // Get the joint positions and convert to correct units\n var ptStart = getJointPoint(startJoint,\"Origin\");\n var ptEnd = getJointPoint(endJoint,\"Origin\");\n\n var xStart = afeVal2cm(afeModel.LengthUnit, ptStart.x);\n var yStart = afeVal2cm(afeModel.LengthUnit, ptStart.y);\n var xEnd = afeVal2cm(afeModel.LengthUnit, ptEnd.x);\n var yEnd = afeVal2cm(afeModel.LengthUnit, ptEnd.y);\n\n // Track bounds of all elements\n afeModel.Bounds.xMin = Math.min(afeModel.Bounds.xMin, Math.min(xStart,xEnd));\n afeModel.Bounds.yMin = Math.min(afeModel.Bounds.yMin, Math.min(yStart,yEnd));\n afeModel.Bounds.xMax = Math.max(afeModel.Bounds.xMax, Math.max(xStart,xEnd));\n afeModel.Bounds.yMax = Math.max(afeModel.Bounds.yMax, Math.max(yStart,yEnd));\n\n // Length of this line\n var lineLen = Math.sqrt((xEnd -= xStart) * xEnd + (yEnd -= yStart) * yEnd);\n if (lineLen < afeModel.LineLengths.min)\n afeModel.LineLengths.min = lineLen;\n if (lineLen > afeModel.LineLengths.max)\n afeModel.LineLengths.max = lineLen;\n }\n\n return afeModel;\n };\n\n // Generate the Fusion drawing from the ForceEffect model\n var generateDrawing = function(afeModel, doExtrude) {\n\n if (!afeModel)\n return;\n\n // Get the active design.\n var product = app.activeProduct;\n var design = adsk.fusion.Design(product);\n var title = afeModel.Title + '(' + afeModel.Filename + ')';\n if (!design) {\n ui.messageBox('No active Fusion design', title);\n adsk.terminate();\n return;\n }\n\n var rootComp = design.rootComponent;\n\n // Create a pair of new sketches.\n var sketches = rootComp.sketches;\n var xzPlane = rootComp.xZConstructionPlane;\n\n // This sketch contains the actual layout of the parts as defined in the\n // imported model. Additionally, part labels are added for reference by\n // the parts sketch.\n var sketchInstructions = sketches.add(xzPlane);\n sketchInstructions.name = \"Instructions\";\n\n // Begin adding INSTRUCTION geometry\n var sketchLines = sketchInstructions.sketchCurves.sketchLines;\n var sketchArcs = sketchInstructions.sketchCurves.sketchArcs;\n var sketchCircles = sketchInstructions.sketchCurves.sketchCircles;\n\n // Defer compute while sketch geometry added.\n sketchInstructions.isComputeDeferred = true;\n\n // The \"Components\" are lines that connect joints. Iterate over\n // these and create sketch lines.\n var idsComps = hastableKeys(afeModel.Components); // get Ids of components\n for (var iComp = 0; iComp < idsComps.length; ++iComp)\n {\n var comp = afeModel.Components[idsComps[iComp]];\n\n // Which joints are connected?\n var startJoint = afeModel.Joints[comp.StartJoint.ObjId];\n var endJoint = afeModel.Joints[comp.EndJoint.ObjId];\n\n if (!startJoint || !endJoint)\n {\n console.log(\"Error: Unable to find start or end joint for component\");\n continue;\n }\n\n // Get the joint positions and convert to correct units\n var ptStartSrc = getJointPoint(startJoint,\"Origin\");\n var ptEndSrc = getJointPoint(endJoint,\"Origin\");\n\n var xStart = afeVal2cm(afeModel.LengthUnit, ptStartSrc.x) * afeModel.Scale;\n var yStart = afeVal2cm(afeModel.LengthUnit, ptStartSrc.y) * afeModel.Scale;\n var xEnd = afeVal2cm(afeModel.LengthUnit, ptEndSrc.x) * afeModel.Scale;\n var yEnd = afeVal2cm(afeModel.LengthUnit, ptEndSrc.y) * afeModel.Scale;\n\n var ptStart = adsk.core.Point3D.create(xStart, yStart, 0);\n var ptEnd = adsk.core.Point3D.create(xEnd, yEnd, 0);\n\n // Create a line for this afe component\n var aLine = sketchLines.addByTwoPoints( ptStart, ptEnd );\n if (!aLine) {\n console.log(\"Error: Unable to create sketch geometry.\");\n }\n\n // TODO: Text not supported in API\n // Create a text element to mark this line\n }\n\n // Enable now that geometry has been added\n sketchInstructions.isComputeDeferred = false;\n\n if (doExtrude)\n {\n // This sketch contains the parts of the model placed in a line and\n // labeled to match those in the instructions.\n\n // Array of contruction planes for each part\n var sketchPartsArray = [];\n\n //var sketchParts = sketches.add(xzPlane);\n //sketchParts.name = \"Parts\";\n\n // this will contain circles for cutting holes in the parts\n var sketchPartsHoles = sketches.add(xzPlane);\n sketchPartsHoles.name = \"PartsHoles\";\n\n var sketchCirclesHoles = sketchPartsHoles.sketchCurves.sketchCircles;\n\n // Defer compute while sketch geometry added.\n sketchPartsHoles.isComputeDeferred = true;\n\n var extrudeDistPerSketch = afeModel.ExtrudeDist * 1.2;\n\n // The \"Components\" are lines that connect joints. Iterate over\n // these and create sketch lines.\n //var idsComps = hastableKeys(afeModel.Components); // get Ids of components\n for (var iComp = 0; iComp < idsComps.length; ++iComp)\n {\n var comp = afeModel.Components[idsComps[iComp]];\n\n // Which joints are connected?\n var startJoint = afeModel.Joints[comp.StartJoint.ObjId];\n var endJoint = afeModel.Joints[comp.EndJoint.ObjId];\n\n if (!startJoint || !endJoint)\n {\n console.log(\"Error: Unable to find start or end joint for component\");\n continue;\n }\n\n // Create the sketch plane and sketch for this part.\n // NOTE: We need 1 sketch plane per part so that we can keep them\n // from intersecting with each other when extruded and have them\n // sit in the same location as the instructions.\n var cpi = rootComp.constructionPlanes.createInput();\n cpi.setByOffset( xzPlane, adsk.core.ValueInput.createByReal(iComp * extrudeDistPerSketch) );\n var sketchPlane = rootComp.constructionPlanes.add( cpi );\n var sketchParts = sketches.add(sketchPlane);\n sketchPartsArray.push(sketchParts);\n sketchParts.name = \"Part - \" + iComp;\n\n // Begin adding PARTS geometry\n var sketchLines = sketchParts.sketchCurves.sketchLines;\n var sketchArcs = sketchParts.sketchCurves.sketchArcs;\n var sketchCircles = sketchParts.sketchCurves.sketchCircles;\n\n // Defer compute while sketch geometry added.\n sketchParts.isComputeDeferred = true;\n\n // Get the joint positions and convert to correct units\n var ptStartSrc = getJointPoint(startJoint,\"Origin\");\n var ptEndSrc = getJointPoint(endJoint,\"Origin\");\n\n var xStart = afeVal2cm(afeModel.LengthUnit, ptStartSrc.x) * afeModel.Scale;\n var yStart = afeVal2cm(afeModel.LengthUnit, ptStartSrc.y) * afeModel.Scale;\n var xEnd = afeVal2cm(afeModel.LengthUnit, ptEndSrc.x) * afeModel.Scale;\n var yEnd = afeVal2cm(afeModel.LengthUnit, ptEndSrc.y) * afeModel.Scale;\n\n var ptStart = adsk.core.Point3D.create(xStart, yStart, 0);\n var ptEnd = adsk.core.Point3D.create(xEnd, yEnd, 0);\n\n // Length of this line\n //var lineLen = Math.sqrt((xEnd -= xStart) * xEnd + (yEnd -= yStart) * yEnd);\n\n var halfWidth = afeModel.ComponentWidth / 2;\n\n // Calc the angle of the line\n var angleRadians = Math.atan2(yEnd-yStart,xEnd-xStart);\n\n var angle90InRadians = (90 * Math.PI/180);\n\n var ptEdgeOffset1 = rotatePoint(angleRadians + angle90InRadians, halfWidth, 0, 0, 0);\n var ptEdgeOffset2 = rotatePoint(angleRadians - angle90InRadians, halfWidth, 0, 0, 0);\n\n // Edge 1\n var edge1Start = adsk.core.Point3D.create(xStart+ptEdgeOffset1.x, yStart+ptEdgeOffset1.y, 0);\n var edge1End = adsk.core.Point3D.create(xEnd +ptEdgeOffset1.x, yEnd +ptEdgeOffset1.y, 0);\n var line1 = sketchLines.addByTwoPoints( edge1Start, edge1End );\n\n // Start arc\n var arc1 = sketchArcs.addByCenterStartSweep( ptStart, edge1Start, Math.PI );\n\n // Edge 2\n var edge2Start = adsk.core.Point3D.create(xStart+ptEdgeOffset2.x, yStart+ptEdgeOffset2.y, 0);\n var edge2End = adsk.core.Point3D.create(xEnd +ptEdgeOffset2.x, yEnd +ptEdgeOffset2.y, 0);\n\n var line2 = sketchLines.addByTwoPoints( edge2Start, edge2End );\n\n // End arc\n var arc2 = sketchArcs.addByCenterStartSweep( ptEnd, edge2End, Math.PI );\n\n // These are the cutting holes and go in the other sketch\n // Start hole\n var circle1 = sketchCirclesHoles.addByCenterRadius( ptStart, afeModel.JointHoleDiameter/2 );\n\n // End hole\n var circle2 = sketchCirclesHoles.addByCenterRadius( ptEnd, afeModel.JointHoleDiameter/2 );\n\n // TODO: Text not supported in API\n // Create a text element to mark this line. String should match the\n // one added in the instructions sketch.\n\n // Enable now that geometry has been added to this sketch\n sketchParts.isComputeDeferred = false;\n }\n\n // Enable now that geometry has been added\n sketchPartsHoles.isComputeDeferred = false;\n\n // Create the extrusion.\n var extrudes = rootComp.features.extrudeFeatures;\n\n // Keep track of timeline so we can group these operations\n var timelineStartIndex = design.timeline.count;\n\n for (var iSketchParts = 0; iSketchParts < sketchPartsArray.length; ++iSketchParts)\n {\n var sketchParts = sketchPartsArray[iSketchParts];\n\n for (var iProf = 0; iProf < sketchParts.profiles.count; ++iProf)\n {\n var prof = sketchParts.profiles.item(iProf);\n var extInput = extrudes.createInput(prof, adsk.fusion.FeatureOperations.NewBodyFeatureOperation);\n\n var distance = adsk.core.ValueInput.createByReal(afeModel.ExtrudeDist);\n extInput.setDistanceExtent(false, distance);\n var ext = extrudes.add(extInput);\n\n var fc = ext.faces.item(0);\n var bd = fc.body;\n bd.name = 'AFE Part - ' + iSketchParts+'.'+iProf;\n }\n }\n\n // Cut the holes\n for (var iProfHoles = 0; iProfHoles < sketchPartsHoles.profiles.count; ++iProfHoles)\n {\n var prof = sketchPartsHoles.profiles.item(iProfHoles);\n var extInput = extrudes.createInput(prof, adsk.fusion.FeatureOperations.CutFeatureOperation);\n\n var distance = adsk.core.ValueInput.createByReal((sketchPartsArray.length + 1) * extrudeDistPerSketch);\n extInput.setDistanceExtent(false, distance);\n var ext = extrudes.add(extInput);\n\n var fc = ext.faces.item(0);\n var bd = fc.body;\n bd.name = 'AFE Part - ' + iProf;\n }\n\n // Now group these operations in the timeline\n var timelineEndIndex = design.timeline.count - 1;\n if (timelineEndIndex > timelineStartIndex)\n design.timeline.timelineGroups.add(timelineStartIndex, timelineEndIndex);\n }\n\n // Now fit the view to show new items\n app.activeViewport.fit();\n };\n\n try {\n\n if (adsk.debug === true) {\n /*jslint debug: true*/\n debugger;\n /*jslint debug: false*/\n }\n\n // Prompt first for the name of the AFE file to import\n var dlg = ui.createFileDialog();\n dlg.title = 'Import ForceEffect File';\n dlg.filter = 'ForceEffect (*.afe);;ForceEffect Motion (*.afem);;All Files (*.*)';\n if (dlg.showOpen() !== adsk.core.DialogResults.DialogOK) {\n adsk.terminate();\n return;\n }\n\n filename = dlg.filename;\n\n // Parse the file\n afeModel = parseAFEFile(filename);\n\n if (afeModel) {\n // Create and run command\n var command = createCommandDefinition();\n var commandCreatedEvent = command.commandCreated;\n commandCreatedEvent.add(onCommandCreated);\n\n command.execute();\n }\n }\n catch (e) {\n if (ui) {\n ui.messageBox('Failed : ' + (e.description ? e.description : e));\n }\n\n adsk.terminate();\n }\n}",
"_initAudioParams() {\n this.pan = this.audioComponents.channelStrip.pan;\n this.gain = this.audioComponents.channelStrip.outputGain;\n // TODO: can also expose frequency as frequency of first overtone?\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset the parsley form or fields. | reset() {
if (!isNone(fields)) {
$(fields).each(function() {
// reset parsley field.
$(this).parsley().reset();
if ($(this).is('form')) {
$('form .form-control-feedback').remove();
}
});
}
} | [
"function clear_form(){\n $(form_fields.all).val('');\n }",
"function resetForm() {\n setInputs(initial);\n }",
"destroy() {\n\t\t\t\t// destroy all parsley fields.\n\t\t\t\tif (!isNone(fields)) {\n\t\t\t\t\t$(fields).each(function() {\n\t\t\t\t\t\t// remove parsley on field.\n\t\t\t\t\t\t$(this).parsley().destroy();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}",
"function clearForm() {\n form.reset();\n }",
"function resetForms(){\r\n $('.user-col form').attr('data-mode', 'working');\r\n // $('.user-col fieldset, .user-col textarea').addClass('untouched');\r\n $('.pairwise-decision, .pairwise-guidelines').addClass('untouched');\r\n // $('.pairwise-reasoning').removeClass('untouched')\r\n $('.user-col input').prop('checked', false);\r\n $('.user-col textarea').val('');\r\n}",
"function resetForm() {\n console.log(\"Resetting form\");\n\n // Clear all checkboxes and radio buttons\n $('input:checkbox').each(function(index){\n var $this = $(this);\n if ($this.prop('checked')) {\n $this.prop('checked', false).checkboxradio('refresh');\n }\n });\n $('input:radio').each(function(index){\n var $this = $(this);\n if ($this.prop('checked')) {\n $this.prop('checked', false).checkboxradio('refresh');\n }\n });\n $('fieldset').each(function(index){\n hideAndClearSubQuestionsFor($(this).attr('id'));\n });\n\n // Remove additional repeating groups\n $('.append-to').empty();\n }",
"function onClickReset() {\r\n cleanInputs();\r\n resetFieldsUi();\r\n}",
"function resetFields() {\n\n fields.forEach(field => {\n field.innerHTML = \"\";\n });\n\n}",
"function resetForm() {\n $formLogin.validate().resetForm();\n $formLost.validate().resetForm();\n $formRegister.validate().resetForm();\n }",
"function resetImportForm(){\n // Reset previously selected values for next import\n resetInputPaths({label: true, runs: true})\n resetImportValidation({analType: true, label: true, runs: true});\n\n $(\"#analType\").val('');\n $('input:radio[name=dataFormat]')[0].checked = true;\n $('input:radio[name=delimiterOption]')[0].checked = true;\n}",
"function resetForm() {\n $leaveComment\n .attr('rows', '1')\n .val('');\n $cancelComment\n .closest('.create-comment')\n .removeClass('focused');\n }",
"function clearPledgeForm() {\n pledgeAddressData = {};\n $.each(pledgeRootElement.find('input, textarea'), function(index, value) {\n setPledgeFieldValidity($(value), null);\n $(value).val('');\n });\n $.each(pledgeRootElement.find('label'), function(index, value) {\n $(value).removeClass('active');\n })\n }",
"function projectResetForm(){\n $('.field-project-id').val('');\n $('.field-project-name').val('');\n $('.field-project-description').val('');\n}",
"function resetCampos(contexto){\r\n\t\t$(\":input\", contexto).each(function(){\r\n\t\t\t$(this).val(\"\").removeClass(\"req\");\r\n\t\t});\t\t\r\n\t\t$(\"div\", contexto).each(function(){\r\n\t\t\t$(this).text(\"\");\r\n\t\t});\t\t\t\t\r\n\t}",
"reset() {\n const reset = (frm) => {\n frm.track();\n frm.children.forEach(reset)\n }\n reset(this);\n }",
"function resetForm(sl) {\n document.querySelector(sl).reset();\n}",
"function testcaseResetForm(){\n $('.field-testcase-id').val('');\n $('.field-testcase-name').val('');\n $('.field-testcase-action').val('');\n $('.field-testcase-expectedResult').val('');\n $('.field-testcase-actualResult').val('');\n $('.field-testcase-status').val('');\n $('.field-testcase-comment').val('');\n}",
"function userResetForm(){\n $('.field-user-id').val('');\n $('.field-user-name').val('');\n $('.field-user-username').val('');\n $('.field-user-password').val('');\n $('.field-user-email').val('');\n}",
"function resetRFQForm()\n{\n $(\"#to_company\").val(\"\");\n\n $(\"#outside_supplier\").attr(\"checked\", false);\n\n $(\"#supplier_country\").val(\"\");\n\n $(\"#supplier_state\").val(\"\");\n\n $(\"#supplier_city\").val(\"\");\n\n $(\"#supplier_addr\").val(\"\");\n\n $(\"#supplier_zipcode\").val(\"\");\n\n $(\"#email\").val(\"\");\n\n $(\"#rfq_terms_cond\").attr(\"checked\", false);\n\n $(\"#items\").empty();\n\n $(\"#rfq_form_error\").text(\"\");\n\n $(\"#selected_ven_key\").val(\"\");\n\n $(\"#quote_ref\").val(\"\");\n\n sNo = 0;\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prepare the players for ng repeat and save the game config to local storage | initPlayers() {
for( var i = 0; i < this.gameConfig.numPlayers; i++ ) {
this.gameConfig.players.push({
name : '',
imgPath : 'img/ninja-odd.png',
killed : false,
nameToKill: '',
word : ''
})
}
this.saveGameConfig();
} | [
"setNumPlayers( numPlayers ) {\n this.gameConfig.numPlayers = numPlayers;\n this.saveGameConfig();\n\n }",
"configPlayersTasks() {\n\n let numPlayers = this.gameConfig.numPlayers - 1;\n\n this.gameConfig.players = _.shuffle(this.gameConfig.players);\n\n for( let i = 0; i <= numPlayers; i++ ) {\n let word = this.words.pop(),\n nameToKillIndex = 0;\n\n if( i < numPlayers ) {\n nameToKillIndex = i + 1;\n }\n this.gameConfig.players[i].word = word;\n this.gameConfig.players[i].nameToKill = this.gameConfig.players[nameToKillIndex].name;\n }\n this.saveGameConfig();\n }",
"startLocalStorage(){\n //if localStorage does not exist, then create one.\n if(localStorage.getItem(this.playerListLSName) !== null){\n\n this.allPlayerList = JSON.parse(localStorage.getItem(this.playerListLSName))\n }\n else{\n //create localStorage\n //console.log(\"Did not find player list, will create a new with a testPlayer\")\n let playerList = []\n\n playerList.push(new HumanPlayer('Admin', 1))\n //playerList.push(new HumanPlayer('test', 10))\n\n localStorage.setItem(this.playerListLSName, JSON.stringify(playerList))\n this.allPlayerList = playerList\n }\n\n //Create bots local storage.\n if(localStorage.getItem(this.botsListLSName) !== null){\n this.allBotsList = JSON.parse(localStorage.getItem(this.botsListLSName))\n }\n else{\n //create localStorage\n let botsList = []\n \n //botsList.push(new HardBot('testBot', 1))\n botsList.push(new EasyBot('Joey'))\n botsList.push(new MediumBot('Elaine'))\n botsList.push(new HardBot('Amy'))\n\n localStorage.setItem(this.botsListLSName, JSON.stringify(botsList))\n this.allBotsList = botsList\n }\n }",
"function create(ids,names,gameid){\r\n var ng = new Game(gameid);\r\n if (ids.length < 12){\r\n var roles=[\"WW\",\"WW\",\"Seer\",\"Witch\",\"Hunter\",\"Cupid\"];\r\n for (i = 0; i < (ids.length - 6); i++) {\r\n roles.push(\"Villager\");\r\n }\r\n }else if((ids.length > 11 && ids.length < 18)){\r\n var roles=[\"WW\",\"WW\",\"WW\",\"Seer\",\"Witch\",\"Hunter\",\"Cupid\"];\r\n for (i = 0; i < (ids.length - 7); i++) {\r\n roles.push(\"Villager\");\r\n }\r\n }else if((ids.length > 17 )){\r\n var roles=[\"WW\",\"WW\",\"WW\", \"WW\",\"Seer\",\"Witch\",\"Hunter\",\"Cupid\"];\r\n for (i = 0; i < (ids.length - 8); i++) {\r\n roles.push(\"Villager\");\r\n }\r\n }\r\n shuffled=shuffle(roles);\r\n for (i = 0; i < (ids.length); i++){\r\n var np = new GamePlayer(ids[i], names[i], shuffled[i]);\r\n np.checkwitch();\r\n final_players.push(np)\r\n console.log(\"np.id display role \");\r\n ng.addplayer(np);\r\n ng.Roles.push(np.role);\r\n ////////\r\n }\r\n return ng;\r\n\r\n }",
"saveGameConfig() {\n this.store.set('gameConfig', this.gameConfig);\n }",
"function initPlayers () {\n for (player in room.getOccupants()) {\n\t if (player.getAttribute(ClientAttributes.STATUS, Settings.GAME_ROOMID)\n\t\t== PongClient.STATUS_READY) {\n\t\taddPlayer(player);\n\t }\n\t}\n}",
"function prepare() {\n let i = 0, j = 0;\n for (i = 0; i < boardSize; i++) {\n for (j = 0; j < boardSize; j++) {\n setPlace(i, j, {playable: true, player: null, turn: null, won: false});\n }\n }\n\n for (i = 0; i < 3; i++) {\n for (j = 0; j < 3; j++) {\n setBoardWin(i, j, {player: null, condition: null});\n }\n }\n\n updateStatus(\"It's your turn\");\n playing = true;\n}",
"function saveGame() {\n pauseGame();\n let cardsData = '';\n $('.card').each(function() {\n cardsData += $(this).attr('class') + '@' + $(this).html() + '@@';\n });\n localStorage.setItem('cardsData', cardsData);\n localStorage.setItem('clockState', clockState);\n localStorage.setItem('playDuration', playDuration);\n localStorage.setItem('moves', moves);\n resumeGame();\n}",
"createPlayerManagers() {\n dg(`creating 4 player managers`, 'debug')\n for (let i = 0; i < 4; i++) {\n let player = new PlayerManager(i, this)\n player.init()\n this._playerManagers.push(player)\n this._playerManagers[0].isTurn = true\n }\n dg('player managers created', 'debug')\n }",
"_initializeGameValues() {\n this.currentFPS = GameConfig.STARTING_FPS;\n this.scoreBoard.resetScore();\n\n this.player = new Player(this.gameView.getPlayerName(), \"white\");\n this.food = new Food(this.boardView.getRandomCoordinate(this.player.segments), \"lightgreen\");\n this.gameView.hideChangeNameButton();\n }",
"function seedPlayerData(){\n\tconsole.info('seeding player data');\n \tconst seedData = [];\n \tfor (let i=1; i<=10; i++) {\n \tseedData.push({\n \t\tfirstName: faker.name.firstName(),\n \tlastName: faker.name.lastName(),\n \t\tstatus: faker.lorem.word(),\n \t\tpreferredPosition: faker.lorem.word()\n \t});\n\t}\n\tconsole.log('SEED DATA: '+seedData[0].firstName);\n \treturn Player.insertMany(seedData);\n}",
"function initialPopulateSelectedPlayers() {\n avail_positions.forEach(function(player) {\n selectedPlayers.push({'position': player,\n 'playerid' : '',\n 'name' : '',\n 'team' : '',\n 'opp' : '',\n 'proj' :'',\n 'salary' : '' });\n });\n}",
"function saveSettings(){\n localStorage[\"pweGameServerStatus\"] = gameselection;\n //console.log('saved: ' + gameselection);\n}",
"function getSettings() {\n var savedselection = localStorage[\"pweGameServerStatus\"];\n if (savedselection) { \n gameselection = savedselection; \n } else {\n gameselection = $.map(_jsongames.games, function(item) { if(item.hasOwnProperty('scrape')) { return '#' + item.name + '_block';} }).join(\", \");\n saveSettings();\n }\n}",
"init() {\n const squaresCopy = this.board.squares.slice(0);\n this.board.placePlayers(this.players, squaresCopy);\n this.board.placeWeapons(this.weapons, squaresCopy);\n this.board.placeWalls(this.nbOfWalls, squaresCopy);\n }",
"buildDungeonPrompts() {\n let dataToWrite = {};\n\n Object.values(DungeonManagersList.ByID).forEach((dungeonManager) => {\n // Add this dungeon info to the catalogue.\n dataToWrite[dungeonManager.id] = {\n id: dungeonManager.id,\n nameDefinitionID: dungeonManager.nameDefinitionID,\n difficulty: dungeonManager.difficultyName,\n gloryCost: dungeonManager.gloryCost,\n maxPlayers: dungeonManager.maxPlayers,\n };\n });\n\n // Turn the data into a string.\n dataToWrite = JSON.stringify(dataToWrite);\n\n Utils.checkClientCataloguesExists();\n\n // Write the data to the file in the client files.\n fs.writeFileSync(\"../client/src/catalogues/DungeonPrompts.json\", dataToWrite);\n\n Utils.message(\"Dungeon prompts info catalogue written to file.\");\n }",
"gameInit() {\n\t\tthis.curGameData = new gameData.GameData(this.genome.length);\n\t\tthis.playHist = [];\n\t\tfor (let i = 0; i < this.hist.length; i++) {\n\t\t\tthis.playHist.push(this.hist[i]);\n\t\t}\n\t}",
"function initalizeGame() { // Start initializeGame\n\t\t\tfor (var i in characters) {\n\t\t\t\tcreateCharacter(characters[i], \"#characterSection\");\n\t\t\t\t}\n\t\t\t}",
"initializeGame(stageGenerationSettings) {\n\t\tconsole.log(`[WSS INFO] Singleplayer stage generated with settings: ${JSON.stringify(stageGenerationSettings)}`);\n\t\n this.gameInProgress = true;\n\t\tthis.lobbyPlayers.forEach((player) => {\n\t\t\tplayer.status = \"In Game\";\n\t\t\tplayer.type = \"Human\";\n\t\t})\n\n\t\t// Change generation settings according to stage size\n\t\tif (stageGenerationSettings.stageSize === \"Small\") {\n\t\t\tthis.generationSettings = EngineProperties.SingleplayerStageGenerationSettings.Small;\n\t\t}\n\t\telse if (stageGenerationSettings.stageSize === \"Medium\") {\n\t\t\tthis.generationSettings = EngineProperties.SingleplayerStageGenerationSettings.Medium;\n\t\t}\n\t\telse if (stageGenerationSettings.stageSize === \"Large\") {\n\t\t\tthis.generationSettings = EngineProperties.SingleplayerStageGenerationSettings.Large;\n\t\t}\n\t\tthis.generationSettings.stageType = \"singleplayer\";\n\t\tthis.generationSettings.numberEasyBots = stageGenerationSettings.numEasyBots;\n\t\tthis.generationSettings.numberMediumBots = stageGenerationSettings.numMedBots;\n\t\tthis.generationSettings.numberHardBots = stageGenerationSettings.numHardBots;\n\n\t\t// Initialize bot players here\n\t\tif (this.generationSettings && this.generationSettings.numberEasyBots) {\n\t\t\tfor (let i = 0; i < this.generationSettings.numberEasyBots; i++) {\n\t\t\t\tthis.lobbyPlayers.push({\n\t\t\t\t\tpid: `EasyBot${i}`,\n\t\t\t\t\tstatus: \"Bot\",\n\t\t\t\t\ttype: \"EasyBot\"\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tif (this.generationSettings && this.generationSettings.numberMediumBots) {\n\t\t\tfor (let i = 0; i < this.generationSettings.numberMediumBots; i++) {\n\t\t\t\tthis.lobbyPlayers.push({\n\t\t\t\t\tpid: `MediumBot${i}`,\n\t\t\t\t\tstatus: \"Bot\",\n\t\t\t\t\ttype: \"MediumBot\"\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tif (this.generationSettings && this.generationSettings.numberHardBots) {\n\t\t\tfor (let i = 0; i < this.generationSettings.numberHardBots; i++) {\n\t\t\t\tthis.lobbyPlayers.push({\n\t\t\t\t\tpid: `HardBot${i}`,\n\t\t\t\t\tstatus: \"Bot\",\n\t\t\t\t\ttype: \"HardBot\"\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// NOTE: We pass in an anonymous function so that it can be called by ./game-engine/StageSingleplayer.js and access the 'this' keyword to refer to this Lobby instance\n\t\tthis.singleplayerGame = new SingleplayerGame(\n\t\t\tthis.ws,\n\t\t\tthis.wss,\n\t\t\tthis.lobbyId,\n this.lobbyPlayers.map(player => ({ pid: player.pid, status: player.status, type: player.type })),\n this.generationSettings,\n\t\t\t(playerId, playerWon) => {\n\t\t\t\t// function \"name\" is endSingleplayerGame\n\t\t\t\tconsole.log(\"endSingleplayerGame() in LobbySingleplayer called\");\n\t\t\t\tconsole.log(\"The player won? \" + playerWon);\n\n\t\t\t\tlet gameWinner = this.singleplayerGame.getGameWinner();\n\t\t\t\tconsole.log(\"The game winner is \" + gameWinner); // \"-1 means bots won\"\n\t\t\t\tif (playerWon) {\n\t\t\t\t\tlet index = this.lobbyPlayers.findIndex(player => player.pid == playerId);\n\t\t\t\t\tthis.lobbyPlayers[index].status = \"In Lobby\";\n\t\t\t\t}\n\t\t\t\tthis.endGame(gameWinner);\n\t\t\t}\n\t\t);\n\n\t\ttry {\n\t\t\t// Run the multiplayer game on an interval\n\t\t\tthis.singleplayerGameInterval = setInterval(async () => {\n\t\t\t\t// console.log(\"[GAME STATUS] SENDING UPDATES TO PLAYERS\");\n\t\t\t\tif (this.singleplayerGame && !this.singleplayerGame.gameHasEnded) {\n\t\t\t\t\t(this.singleplayerGame && this.singleplayerGame.calculateUpdates());\n\t\t\t\t\t(this.singleplayerGame && this.singleplayerGame.sendPlayerUpdates(this.wss));\n\t\t\t\t}\n\t\t\t}, 20);\n\t\t} catch (e) {\n\t\t\tconsole.log(`[WSS WARNING] ${e}`);\n\t\t}\n\n\t\t// Return initial game state\n\t\tlet initialState = this.singleplayerGame.getInitialState();\n\t\t// console.log(initialState);\n\t\treturn initialState;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public function `map`. Maps each value from the `data` to the corresponding predicate and returns the result object. Supports nested objects. If the `data` is not nested and the same function is to be applied across all of it, a single predicate function may be passed in. | function map (data, predicates) {
assert.object(data);
if (isFunction(predicates)) {
return mapSimple(data, predicates);
}
assert.object(predicates);
return mapComplex(data, predicates);
} | [
"_mapData (root, data, entities) {\n if (!entities) entities = this.privateSchema\n\n Object.keys(entities).map(function (objectKey, index) {\n let entity = entities[objectKey]\n let item = data[entities[objectKey]._privateName]\n\n if (!this._isUndefined(entity._decorator)) {\n let decorator = entity._decorator\n if (this._isFunction(decorator)) {\n item = decorator(item)\n }\n }\n\n if (objectKey === '_item') {\n data.map(function (item, index) {\n root[index] = {}\n this._mapData(root[index], item, entity)\n }, this)\n }\n\n if (objectKey.charAt(0) !== '_') {\n if (this._publicCheck(item, entity)) {\n if (!this._isUndefined(item) && this._isObject(item)) {\n root[objectKey] = {}\n this._mapData(root[objectKey], item, entity)\n } else if (!this._isUndefined(item) && this._isArray(item)) {\n if (!this._isUndefined(entity._item)) {\n root[objectKey] = []\n this._mapData(root[objectKey], item, entity)\n } else {\n root[objectKey] = item\n }\n } else if (!this._isUndefined(item)) {\n root[objectKey] = item\n }\n }\n }\n }, this)\n }",
"map(closure) {\n return new this.constructor({ data: this._data.map(closure) });\n }",
"function mapObject(object, fn) {\n return Object.keys(object).reduce(function(result, key) {\n result[key] = fn(object[key]);\n return result;\n }, object);\n}",
"map(fn, iterable) {\n return (function*() {\n for (let val of iterable) {\n yield fn(val);\n }\n })();\n }",
"function mapScalars(f, pojo) {\n assert(isPOJO(pojo));\n if (isScalar(pojo)) {\n return f(pojo);\n } else if (pojo instanceof Array) {\n return pojo.map(subpojo => mapScalars(f, subpojo));\n } else {\n // pojo is a plain object, depending on the assumption that it is a POJO\n var result = {};\n for (let key in pojo) {\n result[key] = mapScalars(f, pojo[key]);\n }\n return result;\n }\n}",
"function mapTree(tree, fn) {\n const { children, ...rest } = tree;\n return children\n ? { ...fn(rest), children: children.map(processChild(fn)) }\n : fn(rest);\n}",
"function map ( f, iterable/*, ... */ )\n {\n var res = [];\n var iters = [];\n var row;\n \n foreach(function (x)\n { iters.push(iter(x)); },\n list(arguments).slice(1));\n\n var argc = iters.length;\n var push = ( 0 === cmp(undefined,f) ) ?\n function ( x ) { res.push(x); } :\n function ( x ) { res.push(f.apply(this,x)); };\n var stops = 0;\n var i;\n\n // FIXME: these nested try/catch blocks are ugly, can it be refactored?\n try\n {\n while ( true )\n {\n row = [];\n for ( i=0; i<argc; ++i )\n {\n try\n { row.push(iters[i].next()); }\n catch ( e )\n {\n if ( e !== StopIteration )\n { throw e; }\n if ( argc <= ++stops ) \n { throw e; }\n iters[i].next = pass;\n row.push(iters[i].next());\n }\n }\n \n push(row);\n }\n }\n catch ( e )\n {\n if ( e !== StopIteration )\n { throw e; }\n }\n \n return res;\n }",
"function map(env, fn, exprs) {\n return exprs.map(function (expr) {\n return fn(env, expr);\n });\n}",
"function mapMethod() {\n\tvar testarray=[1,2,3,4];\n\tvar result=_.map(testarray, function(num) {\n\t\treturn num*3;\n\t});\n\tconsole.log(result);\n}",
"getPredicates(subject, object, graph) {\n const results = [];\n this.forPredicates(p => {\n results.push(p);\n }, subject, object, graph);\n return results;\n }",
"function runInternalDataHandlers($data) {\n return runGenericHandlers($data, internalDataHandlers);\n }",
"eachCompare(context, checkFunc, expected, isFilterMask = false) {\n const result = {};\n for (const key in context) {\n if (helpers_1.isNullOrUndefined(expected)) {\n result[key] = checkFunc(context[key]);\n }\n else {\n const expectedValue = expected[key];\n if (isFilterMask) {\n if (this._includedInFilter(expectedValue)) {\n result[key] = checkFunc(context[key], expectedValue);\n }\n }\n else {\n if (typeof expectedValue !== 'undefined') {\n result[key] = checkFunc(context[key], expectedValue);\n }\n }\n }\n }\n return result;\n }",
"static mapEffects(effects, mapping) {\n if (!effects.length)\n return effects;\n let result = [];\n for (let effect of effects) {\n let mapped = effect.map(mapping);\n if (mapped)\n result.push(mapped);\n }\n return result;\n }",
"function filter_object(data,pcoa_switch){\r\n var returnDictionary = {};\r\n\r\n //debugging command\r\n returnDictionary[\"select_category\"] = function(selector){\r\n console.log(data[\"metadataOverview\"][selector])\r\n }\r\n // given a metadata category and a fitting criterion generate a list of IDs\r\n // which fits to the given filter criterions\r\n returnDictionary[\"generic_filter\"] = function(category,filter_criterion){\r\n filtered_samples = []\r\n switch (category) {\r\n\r\n case \"Age\":\r\n if(filter_criterion === \"all\"){\r\n filtered_samples = data[\"metadataOverview\"]\r\n }\r\n else{\r\n for (i = 0; i < data[\"metadataOverview\"].length; i++){\r\n if(data[\"metadataOverview\"][i][category] >= filter_criterion[0] && data[\"metadataOverview\"][i][category] <= filter_criterion[1]){\r\n filtered_samples.push(data[\"metadataOverview\"][i])\r\n }\r\n }\r\n }\r\n break;\r\n\r\n case \"Sex\":\r\n case \"Nationality\":\r\n case \"BMI_group\":\r\n if(filter_criterion === \"all\"){\r\n filtered_samples = data[\"metadataOverview\"]\r\n }\r\n else{\r\n for (i = 0; i < data[\"metadataOverview\"].length; i++){\r\n if(data[\"metadataOverview\"][i][category] === filter_criterion){\r\n filtered_samples.push(data[\"metadataOverview\"][i])\r\n }\r\n }\r\n }\r\n break;\r\n default:\r\n console.log(\"ERROR WRONG CATEGORY\")\r\n }\r\n return filtered_samples\r\n }\r\n //calculate the intersection of all Id-lists which are contained in the\r\n // id-array\r\n returnDictionary[\"intersection\"] = function(id_array){\r\n var internal_array = id_array\r\n while(internal_array.length > 1){\r\n internal_array[internal_array.length-2] = internal_array[internal_array.length-1].filter(\r\n a => internal_array[internal_array.length-2].some( b => a.SampleID === b.SampleID ) );\r\n internal_array.pop()\r\n }\r\n return internal_array[0]\r\n\r\n }\r\n // as the data-structur is different for the PCoA to different functions\r\n // are used for the dataset Filtering\r\n\r\n if(pcoa_switch){\r\n\r\n //generates an object which contains the filtered dataset for use with the\r\n // pcoa functions\r\n returnDictionary[\"filter_data\"] = function(sample_ids){\r\n var sample_ids = sample_ids;\r\n var data_internal = data[\"dataExploration\"];\r\n var object_internal = {\"dataExploration\":data[\"dataExploration\"],\r\n \"PCsPercentage\":data[\"PCsPercentage\"],\r\n \"metadataOverview\":data[\"metadataOverview\"]};\r\n var out_obj = {}\r\n //out_array = out_array.filter(row => sample_ids.includes(row[\"\"]))\r\n\r\n sample_ids.forEach(function(elem){\r\n out_obj[elem] = data_internal[elem]\r\n }\r\n )\r\n object_internal[\"dataExploration\"] = out_obj\r\n return object_internal\r\n }\r\n }\r\n\r\n else{\r\n // returns the dataExploration dataset filtered for the sample_ids\r\n returnDictionary[\"filter_data\"] = function(sample_ids,bool_arr){\r\n var sample_ids = sample_ids;\r\n var data_internal = data[\"dataExploration\"];\r\n var out_array = []\r\n\r\n\r\n sample_ids.forEach(function(elem){\r\n for(var i = 0; i < data_internal.length; i++){\r\n if(data_internal[i][\"\"] === elem){\r\n out_array.push(filter_from_object(data_internal[i], bool_arr))\r\n break;\r\n }\r\n }\r\n })\r\n\r\n return out_array\r\n }\r\n }\r\n\r\n // returns the metadataOverview dataset filtered for the sampleIds\r\n returnDictionary[\"filter_metadata\"] = function(sample_ids){\r\n var sample_ids = sample_ids;\r\n var metadata_internal = data[\"metadataOverview\"];\r\n var out_array = []\r\n sample_ids.forEach(function(elem){\r\n for(var i = 0; i < metadata_internal.length; i++){\r\n if(metadata_internal[i][\"SampleID\"] === elem){\r\n out_array.push(metadata_internal[i])\r\n break;\r\n }\r\n }\r\n })\r\n\r\n return out_array\r\n }\r\n return returnDictionary\r\n }",
"function map3 (xss, f) {\n var k = 0;\n var output = a();\n const length = getWithDefault(xss, \"length\", 0);\n while (k < length) {\n let lookbehind = access(xss, k-1);\n let currentval = access(xss, k);\n let lookahead = access(xss, k+1);\n output.pushObject(f(lookbehind, currentval, lookahead));\n k++;\n }\n return output;\n}",
"function mapobjMethod() {\n\tvar obj={key1:2, key2:3,key3:5};\n\tvar result=_.map(obj, function(num, key) {\n\t\treturn num+3;\n\t});\n\tconsole.log(result);\n\tvar testarray=[[1,2],[3,4],[7,8]];\n\tvar result1=_.map(testarray,_.first);\n\tconsole.log(result1);\n}",
"function map(fun, seq) {\n 'use strict';\n return function() {\n return couple(\n fun(nth(0, seq)),\n map(fun, skip(1, seq))\n ); \n };\n }",
"function mapResources(resourceOrCollection, mapFn) {\n if (resourceOrCollection instanceof _typesCollection2[\"default\"]) {\n return resourceOrCollection.resources.map(mapFn);\n } else {\n return mapFn(resourceOrCollection);\n }\n}",
"function filter(object, property, callback) {\n\tif (Array.isArray(object)) {\n\t\treturn object.map((item) => filter(item, property, callback));\n\t} else if (isObject(object)) {\n\t\treturn Object.entries(object).reduce((acc, [key, value]) => {\n\t\t\treturn {\n\t\t\t\t...acc,\n\t\t\t\t[key]:\n\t\t\t\t\tkey === property\n\t\t\t\t\t\t? callback(value)\n\t\t\t\t\t\t: filter(value, property, callback),\n\t\t\t};\n\t\t}, {});\n\t} else {\n\t\treturn object;\n\t}\n}",
"function stream_map(f, s) {\n return is_null(s)\n ? null\n : pair(f(head(s)),\n () => stream_map(f, stream_tail(s)));\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates a tooltip and appends it to a parent | function createTooltip(title, tiptext, parent) {
let box = create("td");
let tooltip = create("a");
append(box, tooltip);
tooltip.classList.add("tooltip");
appendText(tooltip, title);
let tooltipText = create("span");
tooltipText.classList.add("tooltiptext");
appendText(tooltipText, tiptext);
append(tooltip, tooltipText);
append(parent, box);
} | [
"function create_tooltips() {\n $(\"#additional_volunteers .might-overflow\").tooltip({ placement: \"left\"});\n $(\"#additional_volunteers .volunteer_name\").hover(function() {\n $(this).children(\".help-edit\").removeClass(\"hidden\");\n }, function() {\n $(this).children(\".help-edit\").addClass(\"hidden\");\n }).click(function() {\n $(this).addClass(\"editing\");\n var old_name = $(this).attr(\"volunteer_name\");\n var old_email = $(this).attr(\"volunteer_email\");\n var old_combined = old_name + ':' + old_email;\n $(this).attr(\"value\",old_combined);\n $(\"#volunteer_name\").val($(this).attr(\"volunteer_name\"));\n $(\"#volunteer_email\").val($(this).attr(\"volunteer_email\"));\n $(\"#add_edit_additional_volunteer\").html(\"Edit volunteer\");\n });\n }",
"show(parent) {\n parent.appendChild(this.StartOverPopoverBlock);\n parent.appendChild(this.StartOverPopoverDiv);\n }",
"generateToolTip() {\n //Order the data array\n let data = formatArray.collectionToBottom(this.data, ['Database IDs', 'Comment']);\n\n if (!(data) || data.length === 0) {\n return generate.noDataWarning(this.name);\n }\n\n //Ensure name is not blank\n this.validateName();\n\n if (!(this.data)) { this.data = []; }\n return h('div.tooltip-image', [\n h('div.tooltip-heading', this.name),\n h('div.tooltip-internal', h('div', (data).map(item => generate.parseMetadata(item, true), this))),\n h('div.tooltip-buttons',\n [\n h('div.tooltip-button-container',\n [\n h('div.tooltip-button', { onclick: this.displayMore() }, [\n h('i', { className: classNames('material-icons', 'tooltip-button-show') }, 'fullscreen'),\n h('div.describe-button', 'Additional Info')\n ]),\n ])\n ])\n ]);\n }",
"function ToolTips(){\n\t\n\t// connector divs\n\tthis.createConnectors();\n\t\n\t// over lap of connector and trigger \n\tthis.overlapH = 10;\n\tthis.overlapV = -5;\n\n\t// time delay\n\tthis.showDelay = 500; // milliseconds\n\t\n\t// current showing tip\n\tthis.currentShowingEl = 0;\n}",
"function addTooltip(className, tooltipHtml) {\n\t \tvar tags = document.getElementsByClassName(className);\n\t \tfor (var i = 0; i < tags.length; i++) {\n\t \t\tvar tooltip = document.createElement(\"span\")\n\t \t\ttooltip.classList.add(\"tooltip-text\");\n\t \t\ttooltip.innerHTML = tooltipHtml\n\t \t\ttags[i].appendChild(tooltip);\n\t \t}\n\t }",
"function createMeasureTooltip() {\n if (measureTooltipElement && measureTooltipElement.parentNode) {\n measureTooltipElement.parentNode.removeChild(measureTooltipElement);\n }\n measureTooltipElement = document.createElement('div');\n measureTooltipElement.className = 'tooltip tooltip-measure';\n measureTooltip = new Overlay({\n element: measureTooltipElement,\n offset: [0, -30],\n positioning: 'bottom-center',\n });\n App4Sea.OpenLayers.Map.addOverlay(measureTooltip);\n }",
"function constructTooltipHTML(d){\n\t\t\t\t\tvar name = d.name;\n\t\t\t\t\tvar count = d.count;\n\t\t\t\t\tvar university = d.university;\n\t\t\t\t\tvar years = d.dates.toString();\n\t\t\t\t\tvar find =',';\n\t\t\t\t\tvar re = new RegExp(find,'g');\n\t\t\t\t\tvar fYears = years.replace(re,', ');\n\n\t\t\t\t\tvar html = \n\t\t\t\t\t'<div class=\"panel panel-primary\">' + \n\t\t\t\t\t\t'<div class=\"panel-heading\">' +\n\t\t\t\t\t\t\tname +\n\t\t\t\t\t\t'</div>' +\n\t\t\t\t\t\t'<div class=\"panel-body\">' + \n\t\t\t\t\t\t\t'<p><strong class=\"tooltip-body-title\">University: </strong>' + university +\n\t\t\t\t\t\t\t'</p><p><strong class=\"tooltip-body-title\">Number of times coauthored: </strong>' + count +\n\t\t\t\t\t\t\t'</p><p><strong class=\"tooltip-body-title\">Years Co-Authored: </strong>' + fYears + '</p>' +\n\t\t\t\t\t\t\t'<p>Double-Click to go to ' + name + '\\'s</p>'+\n\t\t\t\t\t\t'</div></div>';\n\n\t\t\t\t\treturn html;\n\t\t\t\t}",
"function showTooltip(content, event) {\n tt.style('opacity', 1.0)\n .style('pointer-events', 'all')\n .html(content);\n\n updatePosition(event);\n }",
"function addTooltips() {\n\t$('#article-text span').each(function() {\n\t\tvar term = $(this).text().toLowerCase();\n\n\t\t$(this).mouseover(function() {\n\t\t\tif (dijit.byId('shicoDialog') !== undefined) {\n\t\t\t\tdijit.byId('shicoDialog').destroy();\n\t\t\t}\n\n\t\t\tvar shicoDialog = new dijit.TooltipDialog({\n\t\t\t\tid: 'shicoDialog',\n\t\t\t\tcontent: '<a href=\"javascript:startShiCoSearch(\\'' + term + '\\');\">Search <em>' + term + '</em> in ShiCo</a>',\n\t\t\t\tonMouseLeave: function() {\n\t\t\t\t\tdijit.popup.close(shicoDialog);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tdijit.popup.open({\n\t\t\t\tpopup: shicoDialog,\n\t\t\t\taround: $(this).attr('id'),\n\t\t\t});\n\t\t});\n\t});\n}",
"function Tooltip(wrapper, options) {\n\t var _this = this;\n\n\t _classCallCheck(this, Tooltip);\n\n\t this.wrapper = wrapper;\n\t this.options = typeof options == \"string\" ? { direction: options } : options;\n\t this.dir = this.options.direction || \"above\";\n\t this.pointer = wrapper.appendChild(elt(\"div\", { class: prefix + \"-pointer-\" + this.dir + \" \" + prefix + \"-pointer\" }));\n\t this.pointerWidth = this.pointerHeight = null;\n\t this.dom = wrapper.appendChild(elt(\"div\", { class: prefix }));\n\t this.dom.addEventListener(\"transitionend\", function () {\n\t if (_this.dom.style.opacity == \"0\") _this.dom.style.display = _this.pointer.style.display = \"\";\n\t });\n\n\t this.isOpen = false;\n\t this.lastLeft = this.lastTop = null;\n\t }",
"createTooltips() {\n for (let i = 0; i < this.shopItems.length; i++) {\n let tooltipPosition = this.getSelectionPosition(i);\n let tooltipPanel = this.add.nineslice(tooltipPosition.x, tooltipPosition.y,\n 0, 0, 'greyPanel', 7).setOrigin(1, 0);\n // Flip tooltip for lower selections so it doesn't get cut off at the bottom of the screen\n if (i >= tooltipFlipIndex) {\n tooltipPanel.setOrigin(1, 1);\n }\n\n // Create tooltip game objects\n let tooltipTitle = this.add.text(0, 0, \"\", { ...this.tooltipTextStyle, font: \"18px Verdana\" }).setOrigin(0.5, 0);\n let tooltipPrice = this.add.text(0, 0, \"\", { ...this.tooltipTextStyle, font: \"16px Verdana\" }).setOrigin(0.5, 0);\n let tooltipGrowthRate = this.add.text(0, 0, \"\", { ...this.tooltipTextStyle, font: \"16px Verdana\" }).setOrigin(0.5, 0);\n let tooltipClickValue = this.add.text(0, 0, \"\", { ...this.tooltipTextStyle, font: \"16px Verdana\" }).setOrigin(0.5, 0);\n let tooltipDescription = this.add.text(0, 0, \"\", this.tooltipTextStyle).setOrigin(0.5, 0);\n let tooltipTexts = [\n tooltipTitle, \n tooltipPrice, \n tooltipGrowthRate,\n tooltipClickValue,\n tooltipDescription\n ];\n let tooltipTitleBreak = this.add.line(0, 0, 0, 0, 0, 0, 0x999999).setOrigin(0, 0);\n let tooltipPriceBreak = this.add.line(0, 0, 0, 0, 0, 0, 0x999999).setOrigin(0, 0);\n let tooltipRatesBreak = this.add.line(0, 0, 0, 0, 0, 0, 0x999999).setOrigin(0, 0);\n let tooltipBreaks = [\n tooltipTitleBreak,\n tooltipPriceBreak,\n tooltipRatesBreak\n ];\n let tooltip = this.add.group([tooltipPanel].concat(tooltipTexts).concat(tooltipBreaks));\n tooltip.setVisible(false);\n this.tooltips.push(tooltip);\n\n // Set tooltip text values\n if (getType(this.shopItems[i].selection) == ShopSelectionType.DEMOLITION) {\n tooltipTitle.setText(\"Demolish building\");\n tooltipPrice.setText(\"Costs half of the construction cost for the selected building\");\n // Hide unneeded text and breaks\n tooltipPriceBreak.setAlpha(0);\n tooltipRatesBreak.setAlpha(0);\n tooltipGrowthRate.setText(\"\");\n tooltipClickValue.setText(\"\");\n tooltipDescription.setText(\"\");\n } else if (getType(this.shopItems[i].selection) == ShopSelectionType.EXPAND_MAP) {\n tooltipTitle.setText(\"Expand map\");\n formatPhaserCashText(tooltipPrice, getPrice(this.shopItems[i].selection), \"\", false, true);\n this.priceTexts[this.shopItems[i].selection][\"tooltipPriceText\"] = tooltipPrice;\n tooltipGrowthRate.setText(\"Add a set of new tiles to the map\");\n // Hide unneeded text and breaks\n tooltipRatesBreak.setAlpha(0);\n tooltipClickValue.setText(\"\");\n tooltipDescription.setText(\"\");\n } else {\n this.priceTexts[this.shopItems[i].selection][\"tooltipPriceText\"] = tooltipPrice;\n tooltipTitle.setText(this.shopItems[i].selection);\n formatPhaserCashText(tooltipPrice, getPrice(this.shopItems[i].selection), \"\", false, true);\n formatPhaserCashText(tooltipGrowthRate,\n getSelectionProp(this.shopItems[i].selection, 'baseCashGrowthRate'),\n \"/second\", true, false);\n formatPhaserCashText(tooltipClickValue,\n getSelectionProp(this.shopItems[i].selection, 'baseClickValue'),\n \"/click\", true, false);\n tooltipDescription.setText(getSelectionProp(this.shopItems[i].selection, 'description'));\n \n tooltipPriceBreak.setAlpha(1);\n tooltipRatesBreak.setAlpha(1);\n }\n \n // Resize and set positions of tooltip elements\n let panelWidth = 0;\n let panelHeight = tooltipTextMargin;\n let tooltipTextYDiff = [];\n // Resize panel\n for (let i = 0; i < tooltipTexts.length; i++) {\n if (!isBlank(tooltipTexts[i].text)) {\n panelWidth = Math.max(panelWidth, tooltipTexts[i].width + 2 * tooltipTextMargin);\n // No line break is added between the cash growth rates. Also should ignore presence of \"/click\"\n // in the last text, since it is the description, no the click value.\n if (i > 0 && (i == tooltipTexts.length - 1 || !tooltipTexts[i].text.includes(\"/click\"))) {\n panelHeight += tooltipTextBreakYMargin;\n }\n tooltipTextYDiff[i] = panelHeight;\n panelHeight += tooltipTexts[i].height + tooltipTextMargin;\n }\n }\n // There is a bug in Phaser 3 that causes fonts to looks messy after resizing\n // the nineslice. For now using the workaround of creating and immediately\n // deleting a dummy text object after resizing the nineslice.\n // When this is fixed in a future Phaser release this can be removed.\n // See https://github.com/jdotrjs/phaser3-nineslice/issues/16\n // See https://github.com/photonstorm/phaser/issues/5064\n tooltipPanel.resize(panelWidth, panelHeight);\n let dummyText = this.add.text(0, 0, \"\");\n dummyText.destroy();\n \n // Move text and break objects\n for (let i = 0; i < tooltipTexts.length; i++) {\n tooltipTexts[i].setPosition(tooltipPanel.getTopCenter().x, tooltipPanel.getTopCenter().y + tooltipTextYDiff[i]);\n tooltipTexts[i].width = panelWidth - 2 * tooltipTextMargin;\n }\n let breakX = tooltipPanel.getTopLeft().x + tooltipTextBreakXMargin;\n let breakY = tooltipPrice.getTopCenter().y - (tooltipTextBreakYMargin + tooltipTextMargin) / 2;\n tooltipTitleBreak.setTo(breakX, breakY, tooltipPanel.getTopRight().x - tooltipTextBreakXMargin, breakY);\n breakY = tooltipGrowthRate.getTopCenter().y - (tooltipTextBreakYMargin + tooltipTextMargin) / 2;\n tooltipPriceBreak.setTo(breakX, breakY, tooltipPanel.getTopRight().x - tooltipTextBreakXMargin, breakY);\n breakY = tooltipDescription.getTopCenter().y - (tooltipTextBreakYMargin + tooltipTextMargin) / 2;\n tooltipRatesBreak.setTo(breakX, breakY, tooltipPanel.getTopRight().x - tooltipTextBreakXMargin, breakY);\n }\n }",
"function wordLablelToolTip(){\n\t$('#wordLabel').popover();\n\tsetTimeout(function(){\n\t\t$('.label-div').expose();\n\t}, 300);\n\tsetTimeout(function(){\n\t\t$('#wordLabel').popover('show');\n\t\t$('.popover').css('z-index', '9999999');\n\t}, 400);\n}",
"function createTitle(title) {\n group\n .append('text')\n .attr('class', 'title')\n .attr('y', -30)\n .attr('x', (innerWidth / 2))\n .text(title);\n}",
"function wordsListToolTip(){\n\t$('#wordsList').popover();\n\tsetTimeout(function(){\n\t\t$('#list-div').expose();\n\t}, 100);\n\tsetTimeout(function(){\n\t\t$('#wordsList').popover('show');\n\t\t$('.popover').css('z-index', '9999999');\n\t}, 200);\n\t\n}",
"function setTooltipListeners() {\n\t\t\td3.selectAll(\"path.trend-area\").filter(function(d) {return !d3.select(this).classed(\"null\");}).tooltip(function(d, i) {\n\t\t\t\tvar content = '<div><p>';\n\t\t\t\tcontent += '<strong>Income Poverty:</strong> ' + (trends[d.id].Einkommen_Arm*100).toFixed(2) + '% → ' + (trends[d.id].Einkommen_Arm_t2*100).toFixed(2) +'%<br/>';\n\t\t\t\t//content += '<strong>Erwachsenen Armut:</strong> ' + (trends[d.id].Erwa_Arm*100).toFixed(2) + '%<br/>';\n\t\t\t\t//content += '<strong>Altersarmut:</strong> ' + (trends[d.id].Alter_Arm*100).toFixed(2) + '%';\n\t\t\t\tcontent += '<hr/>';\n\t\t\t\tcontent += '<strong>Rent Price:</strong> ' + (trends[d.id].Mietpreise*1).toFixed(2) + '€ → ' + (trends[d.id].Mietpreise_t2*1).toFixed(2) +'€<br/>';\n\t\t\t\tcontent += '<strong>Condominiums:</strong> ' + (trends[d.id].Anteil_ETW*100).toFixed(2) + '% → ' + (trends[d.id].Anteil_ETW_t2*100).toFixed(2) +'%<br/>';\n\t\t\t\tcontent += '<strong>Affordable Flats:</strong> ' + (trends[d.id].Anteil_KDU*100).toFixed(2) + '% → ' + (trends[d.id].Anteil_KDU_t2*100).toFixed(2) +'%<br/>';\n\t\t\t\tcontent += '</p></div>';\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"popover\",\n\t\t\t\t\ttitle: '<strong style=\"font-size:1.5em;\">' + trends[d.id].Stadtteil + '</strong><br/>' + trends[d.id].Bezirk,\n\t\t\t\t\tcontent: content,\n\t\t\t\t\tdetection: \"shape\",\n\t\t\t\t\tplacement: \"mouse\",\n\t\t\t\t\tgravity: 'up',\n\t\t\t\t\tposition: path.centroid(_.where(topojson.feature(dataset, dataset.objects.immoscout).features, {id: d.id})[0]),\n\t\t\t\t\tdisplacement: [10, 10],\n\t\t\t\t\tmousemove: false,\n\t\t\t };\n\t\t\t});\n\t\t}",
"function createElementsForPopup() {\r\n _dom.el.css(\"position\", \"absolute\");\r\n _dom.el.addClass(\"s-c-p-popup\");\r\n _dom.arrow = $(\"<div></div>\")\r\n .appendTo(_dom.el)\r\n .addClass(\"s-c-p-arrow\");\r\n _dom.arrowInner = $(\"<div></div>\")\r\n .appendTo(_dom.arrow)\r\n .addClass(\"s-c-p-arrow-inner\");\r\n }",
"function _initializeTooltip(){\r\n gTooltipGenerator = d3.oracle.tooltip()\r\n .accessors({\r\n label : (pOptions.tooltipX || pOptions.tooltipSeries) ?\r\n function( d ) {\r\n if ( pOptions.tooltipX && !pOptions.tooltipSeries) {\r\n return pOptions.xDataType.toLowerCase() === 'number' ? gXValueFormatter(d.x) : gXValueFormatter(new Date(d.x));\r\n } else if ( !pOptions.tooltipX && pOptions.tooltipSeries) {\r\n return d.series;\r\n } else {\r\n var formattedXValue = pOptions.xDataType.toLowerCase() === 'number' ? gXValueFormatter(d.x) : gXValueFormatter(new Date(d.x));\r\n return d.series + ' (' + formattedXValue + ')';\r\n }\r\n } : null,\r\n value : pOptions.tooltipY ? function( d ) { return d.y; } : null,\r\n color : function() { return gTooltipColor },\r\n content : function( d ) {\r\n return d.tooltip;\r\n }\r\n })\r\n .formatters({\r\n value : gYValueFormatter\r\n })\r\n .transitions({\r\n enable : false\r\n }) \r\n .symbol( 'circle' );\r\n }",
"function setLinkToolTip()\n{\n linkToolTip = d3.tip()\n .attr(\"class\", \"d3-tip\")\n .html(\"some text\")\n .offset([-10, 0]);\n\n svg.call(linkToolTip);\n}",
"initTooltip() {\n const self = this;\n\n // Array containing all tooltip lines (visible or not)\n self.d3.tooltipLines = [];\n self.curData.forEach(function (datum, index) {\n if (index > self.colorPalette.length) {\n notify().error(\"Palette does not contain enough colors to render curve with color, \" +\n \"this should never occur, contact an administrator\");\n self.d3.tooltipLines.push(\n self.d3.o.tooltip.append(\"p\")\n .style(\"color\", \"#000\")\n .style(\"margin\", \"0 0 4px\")\n .style(\"font-size\", \"0.8em\")\n );\n } else {\n self.d3.tooltipLines.push(\n self.d3.o.tooltip.append(\"p\")\n .style(\"color\", self.colorPalette[index])\n .style(\"margin\", \"0 0 4px\")\n .style(\"font-size\", \"0.8em\")\n );\n }\n });\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show Google Pay payment sheet when Google Pay payment button is clicked | function onGooglePaymentButtonClicked() {
const paymentDataRequest = getGooglePaymentDataRequest();
paymentDataRequest.transactionInfo = getGoogleTransactionInfo();
const paymentsClient = getGooglePaymentsClient();
paymentsClient.loadPaymentData(paymentDataRequest)
.then(function(paymentData) {
// handle the response
processPayment(paymentData);
})
.catch(function(err) {
// show error in developer console for debugging
console.error(err);
});
} | [
"function onGooglePaymentButtonClicked() {\n pushTrackingEvents(createGooglePayEvent(\"GooglePayChosen\"));\n\n var paymentDataRequest = getGooglePaymentDataRequest();\n paymentDataRequest.transactionInfo = getGoogleTransactionInfo();\n\n var paymentsClient = getGooglePaymentsClient();\n paymentsClient.loadPaymentData(paymentDataRequest)\n .then(function (paymentData) {\n // handle the response\n processPayment(paymentData);\n }, function (rejectData) {\n var rejectReason = \"\";\n if (rejectData) {\n rejectReason = rejectData.statusCode;\n }\n dataLayerService.pushEvent(\"GooglePayReject\", { \"google_status_code\": rejectReason });\n pushTrackingEvents(createGooglePayEvent(\"GooglePayReject\", \"GooglePayReject\", { \"google_status_code\": rejectReason }));\n if (Logger) {\n Logger.Error({ message: \"Google Pay - client wallet rejected. Rejection status code: \" + rejectReason });\n }\n }).catch(function (e) {\n console.error(e);\n\n if (Logger) {\n Logger.Error({ message: \"Error occured in onGooglePaymentButtonClicked method \", exception: e });\n }\n });\n}",
"function addGooglePayButton() {\n var paymentsClient = getGooglePaymentsClient();\n var button = paymentsClient.createButton({\n onClick: onGooglePaymentButtonClicked,\n buttonColor: \"black\",\n buttonType: \"short\"\n });\n document.getElementsByClassName(\"btn-wrap-gpay\")[0].appendChild(button);\n}",
"function onBuyClicked() {\n createPaymentRequest()\n .show()\n .then(function (response) {\n // Dismiss payment dialog.\n response.complete(\"success\");\n // handlePaymentResponse(response);\n $(\"#checkout\").css(\"display\", \"none\");\n $(\"#completeOrd\").css(\"display\", \"block\");\n $('#placeOrder').css(\"display\", \"inline\");\n })\n .catch(function (err) {\n console.log(\"show() error! \" + err.name + \" error: \" + err.message);\n });\n}",
"function onGooglePayLoaded() {\n var paymentsClient = getGooglePaymentsClient();\n paymentsClient.isReadyToPay(getGoogleIsReadyToPayRequest())\n .then(function (response) {\n if (response.result) {\n addGooglePayButton();\n // this is to improve performance after confirming site functionality\n prefetchGooglePaymentData();\n }\n }).catch(function (e) {\n console.error(e);\n\n if (Logger) {\n Logger.Error({ message: \"Error occured in onGooglePayLoaded method \", exception: e });\n }\n });\n}",
"function paypalPrompt(booking) {\n\tsidepane.clear();\n\tsidepane.appendHeader(\"PAYMENT\");\n\tsidepane.append(view.payment(booking));\n\t// render paypal button\n\tpaypal.Button.render({\n\t env: 'sandbox', // sandbox | production\n\t style: {\n\t label: 'pay',\n\t tagline: false,\n\t size: 'medium', // small | medium | large | responsive\n\t shape: 'rect', // pill | rect\n\t color: 'blue' // gold | blue | silver | black\n\t },\n\t client: {\n\t sandbox: document.head.querySelector(\"[name~=paypal-sandbox-key][content]\").content,\n\t production: document.head.querySelector(\"[name~=paypal-production-key][content]\").content\n\t },\n\t payment: function(data, actions) {\n\t return actions.payment.create({\n\t payment: {\n\t transactions: [\n\t {\n\t amount: { total: '0.01', currency: 'AUD' }\n\t }\n\t ]\n\t }\n\t });\n\t },\n\t onAuthorize: function(data, actions) {\n\t return actions.payment.execute().then(function() {\n\t \tvar headers = new Headers();\n\t \theaders.append(\"Content-Type\", \"application/json\");\n\t \tvar request = new Request('/api/bookings/pay');\n\t \t\n\t \tfetch(request)\n\t\t\t\t.then(res => {\n\t\t\t\t\tif (res.status == 200) {\n\t\t\t\t\t\treturn callback(true);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn callback(false);\n\t\t\t\t\t}\n\t\t\t\t});\n\t \t\n\t\t \tsidepane.clear();\n\t\t \tsidepane.appendHeader(\"PAYMENT\");\n\t\t \tsidepane.append(view.paymentConfirmation(true));\n\t\t \t\n\t });\n\t },\n\t onError: function(err) {\n\t \tsidepane.clear();\n\t \tsidepane.appendHeader(\"PAYMENT\");\n\t \tsidepane.append(view.paymentConfirmation(false));\n\t }\n\t}, '#paypal-button-container');\n\tsidepane.open();\n}",
"clickPayBillsButton () {\n this.payBillsButton.click(); \n }",
"function payment() {\n // оплатить можно только с непустым заказом\n if (order.length){\n unpayed = false;\n var btn = document.querySelector('.make-order');\n btn.disabled = true;\n btn.innerHTML = 'заказ оплачен';\n }\n }",
"function display_layout1group1layer7 ()\n{\n\tCurrentPayment = 'next';\n\tget_payment_arrangements('schedule', populate_next_payment_adjustment, document.forms['Application'].application_id.value, document.forms['Application'].company_id.value);\n// get_schedule_preview(document.getElementById('application_id').value,\n// document.getElementById('company_id').value);\n\tdocument.getElementById('schedule_preview').style.display = 'block';\n}",
"function paymentOptions(option) {\r\n const ccDIV = document.getElementById(\"credit-card\");\r\n const ppDIV = document.getElementById(\"paypal\");\r\n const bitcoinDIV =document.getElementById(\"bitcoin\");\r\n if(option == \"credit card\"){\r\n ccDIV.style.display = \"inherit\";\r\n ppDIV.style.display = \"none\";\r\n bitcoinDIV.style.display = \"none\";\r\n } else if (option == \"paypal\"){\r\n ccDIV.style.display = \"none\";\r\n ppDIV.style.display = \"inherit\";\r\n bitcoinDIV.style.display = \"none\";\r\n } else if (option == \"bitcoin\"){\r\n ccDIV.style.display = \"none\";\r\n ppDIV.style.display = \"none\";\r\n bitcoinDIV.style.display = \"inherit\";\r\n }\r\n}",
"function updatePaymentInfo () {\n\n switch (document.querySelector(\"#payment\").value) {\n\n case \"credit card\":\n document.querySelector (\"#credit-card\").style.display = \"\";\n document.querySelector (\"#paypal\").style.display = \"none\";\n document.querySelector (\"#bitcoin\").style.display = \"none\";\n break;\n\n case \"paypal\":\n document.querySelector (\"#credit-card\").style.display = \"none\";\n document.querySelector (\"#paypal\").style.display = \"\";\n document.querySelector (\"#bitcoin\").style.display = \"none\";\n break;\n\n case \"bitcoin\":\n document.querySelector (\"#credit-card\").style.display = \"none\";\n document.querySelector (\"#paypal\").style.display = \"none\";\n document.querySelector (\"#bitcoin\").style.display = \"\";\n break;\n\n default: // this should never happen\n alert (\"internal error: no payment option detected\");\n break;\n }\n }",
"function createCheckoutButton(preference) {\n var script = document.createElement(\"script\");\n\n // The source domain must be completed according to the site for which you are integrating.\n // For example: for Argentina \".com.ar\" or for Brazil \".com.br\".\n script.src = \"https://www.mercadopago.com.br/integrations/v1/web-payment-checkout.js\";\n script.setAttribute(\"data-button-label\", \"Pague a compra\")\n script.type = \"text/javascript\";\n script.dataset.preferenceId = preference;\n document.getElementById(\"button-checkout\").innerHTML = '';\n document.querySelector(\"#button-checkout\").appendChild(script);\n}",
"clickPayByCheckLink() {\n this.lnkPayByCheck.click();\n }",
"function setupPaymentMethods17() {\n const queryParams = new URLSearchParams(window.location.search);\n if (queryParams.has('message')) {\n showRedirectErrorMessage(queryParams.get('message'));\n }\n\n $('input[name=\"payment-option\"]').on('change', function(event) {\n\n let selectedPaymentForm = $('#pay-with-' + event.target.id + '-form .adyen-payment');\n\n // Adyen payment method\n if (selectedPaymentForm.length > 0) {\n\n // not local payment method\n if (!('localPaymentMethod' in\n selectedPaymentForm.get(0).dataset)) {\n\n resetPrestaShopPlaceOrderButtonVisibility();\n return;\n }\n\n let selectedAdyenPaymentMethodCode = selectedPaymentForm.get(\n 0).dataset.localPaymentMethod;\n\n if (componentButtonPaymentMethods.includes(selectedAdyenPaymentMethodCode)) {\n prestaShopPlaceOrderButton.hide();\n } else {\n prestaShopPlaceOrderButton.show();\n }\n } else {\n // In 1.7 in case the pay button is hidden and the customer selects a non adyen method\n resetPrestaShopPlaceOrderButtonVisibility();\n }\n });\n }",
"function sendPhoneToSheet(phone, pageId) {\n\tvar args = \"form=CallMe&phone=\" + encodeURIComponent(phone) + \"&page=\" + encodeURIComponent(pageId);\n\tget(\"https://script.google.com/macros/s/AKfycbyAxaPtYwy-Uwp27vEu9uTaiJ1NnevuR4U2CRn5zVNczMnGYTs/exec?\"+args).then(function(){\n\t\tCALL_ME_FORM.classList.add(\"survey-sent\");\n\t\tdocument.getElementById(\"phoneSubmit\").innerText = \"Merci :)\";\n\t\tdocument.getElementById(\"phoneSubmit\").disabled = true;\n\t})\n\t.catch(function(error){\n\t\tconsole.log('error', error.message);\n\t});\n}",
"function hideChromePayButton() {\n var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);\n if (!isChrome) {\n $('.chrome-pay-button-enable').hide();\n }\n}",
"function show_payment_form() {\n var $payment_el = $(this); // Using `this` is gross.\n var $form = $payment_el.parents('form');\n var payment_type = $payment_el.val();\n var class_name = 'payment-info-' + payment_type;\n $form.find('.payment-info').each(function () {\n var $el = $(this);\n if ($el.hasClass(class_name))\n $el.show();\n else\n $el.hide();\n });\n show_element($form);\n if (payment_type == 'paypal') {\n var $email = $form.find('[name=\"paypal_email\"]');\n if ($email.val() === '')\n $email.val($form.find('[name=\"email\"]').val());\n }\n }",
"function uiPagePurchaseSuccess() {\n updateModalVisilibity(\n ['shop-success'], ['shop-tshirt', 'shop-checkout']);\n}",
"function hideAllPaymentOptions() {\n creditCard.style.display = 'none';\n paypal.style.display = 'none';\n bitcoin.style.display = 'none';\n}",
"clickAccountActivityButton () {\n this.accountActivityButton.click(); \n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::IAM::ServiceLinkedRole` resource | function cfnServiceLinkedRolePropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnServiceLinkedRolePropsValidator(properties).assertSuccess();
return {
AWSServiceName: cdk.stringToCloudFormation(properties.awsServiceName),
CustomSuffix: cdk.stringToCloudFormation(properties.customSuffix),
Description: cdk.stringToCloudFormation(properties.description),
};
} | [
"role() {\n return this.props.projectData.role \n .map(role => \n <span className=\"tag is-size-5 is-white has-text-weight-bold\">{role}</span>\n );\n }",
"get roleId() {\n return this.getStringAttribute('role_id');\n }",
"function displayComponent() {\n var range = SpreadsheetApp.getActiveRange();\n var cell = range.getValue().trim();\n \n var documentProperties = PropertiesService.getDocumentProperties();\n var hdID = documentProperties.getProperty('hdID');\n \n var component = getComponentAttributes(getComponent(hdID,cell));\n \n var header = '<html><head><link rel=\"stylesheet\" href=\"https://unpkg.com/purecss@1.0.0/build/pure-min.css\" integrity=\"sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w\" crossorigin=\"anonymous\"></head><body>';\n var footer = '</body></html>';\n \n var cFlat = '<table class=\"pure-table pure-table-bordered\"><caption>Properties of component \"' + cell + '\"' + '<thead><tr><td>Property</td><td>Value</td></tr></thead>';\n for (var e in component) {\n cFlat += '<tr><td>' + e + '</td><td>'+ component[e] + '</td></tr>';\n }\n cFlat += '</table>';\n \n var html = HtmlService.createHtmlOutput(header + cFlat + footer)\n .setTitle('Component Properties')\n .setWidth(450);\n SpreadsheetApp.getUi()\n .showSidebar(html);\n}",
"aliasHandleLambdaRole(currentTemplate, aliasStackTemplates, currentAliasStackTemplate) {\n\n\t\tconst stageStack = this._serverless.service.provider.compiledCloudFormationTemplate;\n\t\tconst aliasStack = this._serverless.service.provider.compiledCloudFormationAliasTemplate;\n\t\tlet stageRolePolicies = _.get(stageStack, 'Resources.IamRoleLambdaExecution.Properties.Policies', []);\n\t\tlet currentRolePolicies = _.get(currentTemplate, 'Resources.IamRoleLambdaExecution.Properties.Policies', []);\n\n\t\t// Older serverless versions (<1.7.0) do not use a inline policy.\n\t\tif (_.isEmpty(currentRolePolicies) && _.has(currentTemplate, 'Resources.IamPolicyLambdaExecution')) {\n\t\t\tthis._serverless.cli.log('WARNING: Project created with SLS < 1.7.0. Using resources from policy.');\n\t\t\tcurrentRolePolicies = [ _.get(currentTemplate, 'Resources.IamPolicyLambdaExecution.Properties') ];\n\t\t}\n\t\tif (_.isEmpty(stageRolePolicies) && _.has(stageStack, 'Resources.IamPolicyLambdaExecution')) {\n\t\t\tstageRolePolicies = [ _.get(stageStack, 'Resources.IamPolicyLambdaExecution.Properties') ];\n\t\t}\n\n\t\t// There can be a service role defined. In this case there is no embedded IAM role.\n\t\tif (_.has(this._serverless.service.provider, 'role')) {\n\t\t\t// Use the role if any of the aliases reference it\n\t\t\tif (!_.isEmpty(currentRolePolicies) &&\n\t\t\t\t_.some(aliasStackTemplates, template => !template.Outputs.AliasFlags.Value.hasRole)) {\n\t\t\t\tstageStack.Reosurces.IamRoleLambdaExecution = _.cloneDeep(currentTemplate.Resources.IamRoleLambdaExecution);\n\t\t\t}\n\n\t\t\taliasStack.Outputs.AliasFlags.Value.hasRole = true;\n\n\t\t\treturn BbPromise.resolve([ currentTemplate, aliasStackTemplates, currentAliasStackTemplate ]);\n\t\t}\n\n\t\t// For now we only merge the first policy document and exit if SLS changes this behavior.\n\t\tif (stageRolePolicies.length !== 1) {\n\t\t\treturn BbPromise.reject(new Error('Policy count should be 1! Please report this error to the alias plugin owner.'));\n\t\t}\n\n\t\tconst stageRolePolicyStatements = _.get(stageRolePolicies[0], 'PolicyDocument.Statement', []);\n\t\tconst currentRolePolicyStatements = _.get(currentRolePolicies[0], 'PolicyDocument.Statement', []);\n\n\t\t_.forEach(currentRolePolicyStatements, statement => {\n\t\t\t// Check if there is already a statement with the same actions and effect.\n\t\t\tconst sameStageStatement = _.find(stageRolePolicyStatements, value => value.Effect === statement.Effect &&\n\t\t\t\tvalue.Action.length === statement.Action.length &&\n\t\t\t\t_.every(value.Action, action => _.includes(statement.Action, action)));\n\n\t\t\tif (sameStageStatement) {\n\t\t\t\t// Merge the resources\n\t\t\t\tsameStageStatement.Resource = _.uniqWith(_.concat(sameStageStatement.Resource, statement.Resource), (a,b) => _.isEqual(a,b));\n\t\t\t} else {\n\t\t\t\t// Add the different statement\n\t\t\t\tstageRolePolicyStatements.push(statement);\n\t\t\t}\n\t\t});\n\n\t\t// Remove all resource references of removed resources\n\t\tconst voidResourceRefs = utils.findReferences(stageRolePolicyStatements, this.removedResourceKeys);\n\t\tconst voidResourcePtrs = _.compact(_.map(voidResourceRefs, ref => {\n\t\t\tconst ptrs = /\\[([0-9]+)\\].Resource\\[([0-9]+)\\].*/.exec(ref);\n\t\t\tif (ptrs && ptrs.length === 3) {\n\t\t\t\treturn { s: ptrs[1], r: ptrs[2] };\n\t\t\t}\n\t\t\treturn null;\n\t\t}));\n\t\t_.forEach(voidResourcePtrs, ptr => {\n\t\t\tconst statement = stageRolePolicyStatements[ptr.s];\n\t\t\t_.pullAt(statement.Resource, [ ptr.r ]);\n\t\t\tif (_.isEmpty(statement.Resource)) {\n\t\t\t\t_.pullAt(stageRolePolicyStatements, [ ptr.s ]);\n\t\t\t}\n\t\t});\n\n\t\t// Insert statement dependencies\n\t\tconst dependencies = _.reject((() => {\n\t\t\tconst result = [];\n\t\t\tconst stack = [ _.first(stageRolePolicyStatements) ];\n\t\t\twhile (!_.isEmpty(stack)) {\n\t\t\t\tconst statement = stack.pop();\n\n\t\t\t\t_.forOwn(statement, (value, key) => {\n\t\t\t\t\tif (key === 'Ref') {\n\t\t\t\t\t\tresult.push(value);\n\t\t\t\t\t} else if (key === 'Fn::GetAtt') {\n\t\t\t\t\t\tresult.push(value[0]);\n\t\t\t\t\t} else if (_.isObject(value)) {\n\t\t\t\t\t\tstack.push(value);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn result;\n\t\t})(), dependency => _.has(stageStack.Resources, dependency));\n\n\t\t_.forEach(dependencies, dependency => {\n\t\t\tstageStack.Resources[dependency] = currentTemplate.Resources[dependency];\n\t\t});\n\n\t\treturn BbPromise.resolve([ currentTemplate, aliasStackTemplates, currentAliasStackTemplate ]);\n\t}",
"renderStoreManagerForm() {\n console.log('@renderStoreManagerForm')\n console.log(this.props.loggedInUser.role[0])\n if (this.props.loggedInUser.roles[0] == \"ROLE_USER\") {\n return (\n <span style={{ fontSize: 12, color: \"#504F5A\", marginTop: 5 }}>Create a Store Manager</span>\n );\n }\n return;\n }",
"static get(name, id, state, opts) {\n return new ServiceLinkedRole(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }",
"function cfnVirtualNodeListenerTlsSdsCertificatePropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualNode_ListenerTlsSdsCertificatePropertyValidator(properties).assertSuccess();\n return {\n SecretName: cdk.stringToCloudFormation(properties.secretName),\n };\n}",
"function cfnStorageLensAwsOrgPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnStorageLens_AwsOrgPropertyValidator(properties).assertSuccess();\n return {\n Arn: cdk.stringToCloudFormation(properties.arn),\n };\n}",
"function writeContextMenuProperty(item){\r\n var link=\"<span class=\\\"contextmenu_property\\\">\"+item[\"property\"]+\":<\\/span> \"+item[\"val\"]+\"<br/>\";\r\n return link;\r\n}",
"getRole() {\n return this.empRole;\n }",
"function cfnVirtualNodeTlsValidationContextSdsTrustPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualNode_TlsValidationContextSdsTrustPropertyValidator(properties).assertSuccess();\n return {\n SecretName: cdk.stringToCloudFormation(properties.secretName),\n };\n}",
"function formatLinkedAttributes (Ctor) {\n const { observedAttributes, props } = Ctor;\n\n if (!props) {\n return;\n }\n\n keys(props).forEach((name) => {\n const prop = props[name];\n const attr = prop.attribute;\n if (attr) {\n // Ensure the property is updated.\n const linkedAttr = prop.attribute = attr === true ? dashCase(name) : attr;\n\n // Automatically observe the attribute since they're linked from the\n // attributeChangedCallback.\n if (observedAttributes.indexOf(linkedAttr) === -1) {\n observedAttributes.push(linkedAttr);\n }\n }\n });\n\n // Merge observed attributes.\n Object.defineProperty(Ctor, 'observedAttributes', {\n configurable: true,\n enumerable: true,\n get () {\n return observedAttributes;\n }\n });\n}",
"constructor(scope, id, props) {\n super(scope, id, { type: CfnInstanceProfile.resourceTypeName, properties: props });\n cdk.requireProperty(props, 'roles', this);\n this.instanceProfileArn = this.getAtt('Arn').toString();\n this.instanceProfileName = this.ref.toString();\n }",
"function cfnVirtualGatewayVirtualGatewayTlsValidationContextSdsTrustPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualGateway_VirtualGatewayTlsValidationContextSdsTrustPropertyValidator(properties).assertSuccess();\n return {\n SecretName: cdk.stringToCloudFormation(properties.secretName),\n };\n}",
"showProperties() {\n // FIXME: this is a stop gap pending transition to queryParams tabbed nav in datasets.\n // :facepalm:\n run(() => {\n scheduleOnce('afterRender', null, () => {\n $('.tabbed-navigation-list li.active:not(#properties)').removeClass('active');\n $('.tabbed-navigation-list #properties').addClass('active');\n });\n });\n }",
"toString() {\n const {name, _schema: schema} = this.constructor;\n return `${ name }<Model> {\\n ${\n Object.keys(schema.attributeIdentities).map(attribute => (\n `${ attribute }: ${ this[attribute] }`\n )).join(',\\n ')\n }\\n}`;\n }",
"function cfnVirtualGatewayVirtualGatewayListenerTlsAcmCertificatePropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualGateway_VirtualGatewayListenerTlsAcmCertificatePropertyValidator(properties).assertSuccess();\n return {\n CertificateArn: cdk.stringToCloudFormation(properties.certificateArn),\n };\n}",
"drawLastLi() {\n return `<li class=\"list-group-item\"><b>School:</b> ${this.employee.school}</li>`\n }",
"function cfnVirtualNodeTlsValidationContextAcmTrustPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualNode_TlsValidationContextAcmTrustPropertyValidator(properties).assertSuccess();\n return {\n CertificateAuthorityArns: cdk.listMapper(cdk.stringToCloudFormation)(properties.certificateAuthorityArns),\n };\n}",
"getRole (roleId) {\n assert.equal(typeof roleId, 'string', 'roleId must be string')\n return this._apiRequest(`/role/${roleId}`)\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Output: None. Input: array of courses and selected department code. Side effects: None. Notes: Filters through the courses for the chosen department. Creates a relationship matrix (used for the bundle visualization) and begins the visualization. | function split_buildings(courses, dept)
{
var buildings = [];
selected_courses = [];
if (dept != "Resize"){
if (selected_departments[0] == "All" || dept == "All"){
selected_departments = [];
}
if (dept != ""){
selected_departments.push(dept);
}
}
// Aggregate all courses into buildings by adding Enrolled students.
selected_departments.forEach(function(dept_element, dept_index, dept_array)
{
courses.forEach(function(element, index, array)
{
if (dept_element == "All" || dept_element == element.Department){
selected_courses.push(element);
var index = contains_building(buildings, element.BuildingName);
Num = parseInt(element.Enrolled);
// -1 means that buildings isn't in the array yet.
if (index == -1){
buildings.push({"Building": element.BuildingName, "Enrolled" : Num, "Courses": [element]});
} else {
buildings[index].Enrolled += Num;
buildings[index].Courses.push(element);
}
}
});
});
// Remove buildings with only 1 student in them. This can result from those
// independent study courses.
buildings = buildings.filter(function(element)
{
return element.Enrolled > 1;
});
compounded_buildings = create_matrix(buildings);
begin_viz();
} | [
"devideCoursesInSemesters(courses) {\n this.devidedCourses = {}; // Define empty object\n\n courses.map((course) => { // For each course\n // Have we seen a course in this semester before?\n if (this.devidedCourses[course.semester] == undefined)\n this.devidedCourses[course.semester] = []; // No, so define it\n\n // Add the course to the semester\n this.devidedCourses[course.semester][course.id] = course;\n });\n }",
"GetCourseList(deptId)\n {\n if(this.deptCourses.has(deptId))\n {\n return this.deptCourses.get(deptId);\n }\n var courseList = this.courses.filter((value,index,array)=>{\n return value.deptId == deptId\n })\n console.log(\"Course list length :\" + courseList.length);\n this.SetDependencies(courseList);\n this.deptCourses.set(deptId,courseList);\n return courseList;\n }",
"function findCoursesByDepartment(code) {\n var courseIds = [];\n var courses = coursesByDepartments[code];\n for (var i = 0; i < courses.length; i++) {\n courseIds.push(code + '.' + courses[i].cnum);\n }\n return courseIds;\n}",
"function setCollegeAndCourse(courseId) {\n collegeArray.forEach((collegeMap) => {\n collegeMap.courses.filter((coursesMap) => {\n if (coursesMap.id == courseId) {\n college.value = collegeMap.id;\n college.innerHTML = `<option>${collegeMap.college}</option>`;\n document.getElementById(\n 'user-college'\n ).innerText = `${collegeMap.college}`;\n\n course.value = coursesMap.id;\n course.innerHTML = `<option>${coursesMap.course}</option>`;\n document.getElementById('user-course').innerText = `${coursesMap.id}`;\n }\n });\n });\n}",
"function getCourses() {\n //create data object which will act as payload in AJAX request to server side code\n var data = {};\n //check if there is a URL param to act as a filter server side\n if (getParameterByName('c') != undefined) {\n //if there is a URL param called c add it to the data payload\n data.c = getParameterByName('c');\n }\n //send AJAX request to server to retrieve courses\n $.ajax({\n url: 'php/getCourses.php',\n type: 'post',\n dataType: 'json',\n data: data,\n success: function(data) {\n\n /*\n data model returned is an array of objects. each object is modelled like so:\n {\n courseTypeId:NUMBER,\n courseTypeTitle:STRING,\n courses:ARRAY[\n {\n courseId:NUMBER,\n courseTitle:STRING\n }\n ]\n }\n */\n\n //clear the course select menu of exisitng options\n $('#course').html('');\n //start adding elements to the #course select menu\n $('#course').append('<option value=\"\">Select a course...</option>');\n //loop thru each object in the array of results of AJAX request\n var numCourseTypes = data.length;\n for (var i = 0; i < numCourseTypes; i++) {\n //start concatenating the optgroup string\n var optGroup = '<optgroup label=\"' + data[i].courseTypeTitle + '\">';\n //now loop thru each course in the objects's courses array\n var numCourses = data[i].courses.length;\n for (var c = 0; c < numCourses; c++) {\n //add an option for each course\n optGroup += '<option value=\"' + data[i].courses[c].courseId + '\">' + data[i].courses[c].courseTitle + '</option>';\n }\n //complete the optgroup string\n optGroup += '</optgroup>';\n //add it to the select menu\n $('#course').append(optGroup);\n\n }\n //add 'chosen' jquery plugin functionality to the select menu\n //$('#course').chosen(config);\n $(\"#course\").selectmenu();\n },\n error: function(h, m, s) {\n console.log(m);\n }\n });\n }",
"static view() {\n const coursesByDepartment = getCoursesByDepartment(\n courses.list,\n selectedDepartment,\n );\n return getUniqueYears(coursesByDepartment).map(year =>\n m(expandableContent, { name: `Year ${year}`, level: 0 }, [\n getUniqueLecturesByYear(\n coursesByDepartment,\n year,\n ).map(lecture =>\n m(\n expandableContent,\n { name: lecture, level: 1 },\n coursesByDepartment\n .filter(course => course.lecture.year === year)\n .filter(course => course.lecture.title === lecture)\n .map(displayCard),\n ))]));\n }",
"function updateSelectedDepartment() {\n\n }",
"findStudentCourses(courseArray){\r\n \tlet studentCourseList = [];\r\n \tfor(let courseName of courseArray){\r\n studentCourseList.push(this.courses.get(courseName));\r\n\t\t}\r\n\t\treturn studentCourseList;\r\n\t}",
"function permutation(courses, arrangement) {\n if (courses.length == 0) {\n permutations.push(arrangement);\n } else {\n // check to see that course is not empty i.e wrong course\n if (courses[0].meeting_sections != null){\n //check to see that there are meeting sections for the course\n if (courses[0].meeting_sections.length != 0){\n for (var i = 0; i < courses[0].meeting_sections.length; i++) {\n // if its a lecture section, add the course.\n //if (courses[0].meeting_sections[i].code[0] == 'L' && courses[0].meeting_sections[i].times.length != 0) {\n var course = {\n \"meeting_section\" : courses[0].meeting_sections[i],\n \"course_code\" : courses[0].code\n };\n var newArrangement = arrangement.slice(0);\n newArrangement.push(course);\n\n permutation(courses.slice(1), newArrangement);\n //} else {\n // tutorial, skip this iteration\n //continue; \n //} \n }\n } else {\n //no meeting section, alert user, continue to next course\n permutation(courses.slice(1), arrangement);\n }\n }\n else{\n //wrong course, alert user, continue to next course\n permutation(courses.slice(1), arrangement);\n }\n }\n \n}",
"function clearCourses() {\n //Resets the classes that can be fulfilled by multiple classes\n CheckSocialScience = 0;\n CheckEthics = 0;\n CheckRtc2 = 0;\n CheckRtc3 = 0;\n CheckElsj = 0;\n CheckDiversity = 0;\n CheckCi3 = 0;\n CheckAmth108 = 0;\n CheckMath53 = 0;\n CheckAmth106 = 0;\n CheckChem11 = 0;\n doubledip = 0;\n\n //Sets the indicator box to a incomplete\n var x = document.getElementsByName(\"requirement\");\n var arrayLength = x.length;\n for (var i = 0; i < arrayLength; i++) {\n x[i].innerHTML = \"NO!\";\n x[i].style.backgroundColor = \"rgb(242, 38, 19)\";\n }\n\n //Deletes the electives table\n var t = electives.length;\n for (var j = 0; j < t; j++) {\n document.getElementById(\"electiveRow\").deleteCell(0);\n }\n\n //Resets the course arrays\n electives = [];\n technicalElectives = [];\n courses = [];\n specialCases = [];\n\n //Populates the course with the new lists\n populate();\n}",
"function parseXMLCourses(xmlCourseArray) {\r\n var i,\r\n j,\r\n course,\r\n sections = [];\r\n\r\n for (i = 0; i < xmlCourseArray.length; i += 1) {\r\n sections.push(new Section(xmlCourseArray[i]));\r\n }\r\n\r\n for (i = 0; i < sections.length; i += 1) {\r\n course = new Course(sections[i].section.match(idPattern)[0], sections[i].title);\r\n for (j = 0; j < sections.length; j += 1) {\r\n if (sections[j].section.match(idPattern)[0] === course.id) {\r\n course.addSection(sections.splice(j, 1)[0]);\r\n i -= (i === j) ? 1 : 0;\r\n j -= 1;\r\n }\r\n }\r\n courses.push(course);\r\n }\r\n test();\r\n }",
"function getAssignedCategoriesForAccordionMenu(cat){\r\n var assignedCategoriesPOPStageArray = null; // this stores array of the specialized assigned Categories for speicalized users to be work on in case of ParallelizedOPStage\r\n var assignedCategoryList = new Array(); // this stores the array/list of assigned categories medical hierachy list only for filtered accordion menu only\r\n\r\n if(assignedCategoriesForParallelizedOPStage != null)\r\n assignedCategoriesPOPStageArray = assignedCategoriesForParallelizedOPStage.split(',');\r\n\r\n var count = -1;\r\n if(assignedCategoriesPOPStageArray != null){\r\n // it will check from total categories\r\n for( k = 0; k < cat.length; k++) {\r\n // then will check and populate for primary assigned categories\r\n for( j = 0; j < assignedCategoriesPOPStageArray.length; j++) {\r\n if(cat[k].name == assignedCategoriesPOPStageArray[j].trim() && cat[k].level == 1) {\r\n count++;\r\n assignedCategoryList[count] = cat[k];\r\n break;\r\n }\r\n }\r\n // then will check and populate the assigend subcategories\r\n for(var l = 0; l < assignedCategoryList.length; l++) {\r\n if(cat[k].parentid == assignedCategoryList[l].id) {\r\n count++;\r\n assignedCategoryList[count] = cat[k];\r\n break;\r\n }\r\n }\r\n }\r\n return assignedCategoryList; \r\n }\r\n}",
"function fillCoursesTable(studentJson) {\n var arrayCourses = studentJson.monAnnee.monOffre.cours;\n if (typeof arrayCourses !== \"undefined\" && arrayCourses !== null && arrayCourses.length > 0) {\n var $frag = $(document.createDocumentFragment());\n $.each(arrayCourses, function (index, course) {\n var $row = createJQObjectNoText(\"<tr/>\", {}, $frag);\n addRowCourse(course, $row);\n });\n $frag.appendTo($(\"#table_courses\"));\n }\n}",
"static async findAvailableCourses(collegeCode){\n const result=await pool.query('SELECT course.coursecode,coursename,coursetag,coursedescription,has.available FROM has,course WHERE has.collegecode=? AND has.coursecode=course.coursecode',collegeCode);\n return result;\n }",
"function refreshCoursePlanner(semester) {\n //remove all children\n $(\"#course_planner > tbody\").empty();\n var courses = user.getCourses();\n for (var courseID in courses) {\n var course = user.getCourse(courseID);\n if (course && course.getSemester() == semester) {\n renderCourse(course);\n }\n }\n}",
"function filterOUs(course) {\n if (actionOUs.map(setStrings).indexOf(course.split('-')[0]) != -1) {\n actionCourses.push(course);\n }\n }",
"function parse_courses()\n{\n\n // This will need to happen when we move on to use\n // a real hosted csv file.\n\n\t/*if (window.XMLHttpRequest)\n {// code for IE7+, Firefox, Chrome, Opera, Safari\n xmlhttp=new XMLHttpRequest();\n }\n else\n {// code for IE6, IE5\n xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n }\n xmlhttp.onreadystatechange=function()\n {\n if (xmlhttp.readyState==4 && xmlhttp.status==200)\n {\n return xmlhttp.responseText;\n }\n }\n xmlhttp.open(\"GET\", \"CourseLocations.csv\", false );\n xmlhttp.send(); \n */\n\n\tvar parsed_data = d3.csv.parse(courseLocations);\n\n // Doing some work on the parsed course objects.\n parsed_data.forEach(function(element, index, array)\n {\n element.Dept = element.Course.split(\" \")[0];\n element.Location = element.Location.split(\" \")[0];\n });\n\n return parsed_data;\n}",
"function updateCourses() {\n element.find('.courses > .course').each(function (index) {\n var course = scope.courses[index];\n var courseElem = angular.element(this);\n courseElem.data('id', course.id);\n courseElem.find('.actions').attr('aria-label', COURSE_ACTIONS_ARIA_LABEL(course.code));\n });\n }",
"function undergradbyCollegeChart() {\r\n\t\t\tvar undergradData = getundergradbyCollegeChart(ualbyCollege);\r\n\r\n\t\t\tvar data = google.visualization.arrayToDataTable([\r\n\t\t\t\t['College', 'Student Enrollment'],\r\n\t\t\t\t['College of Arts and Sciences', undergradData.artsAndScience],\r\n\t\t\t\t['College of Bible', undergradData.bible],\r\n\t\t\t\t['College of Business', undergradData.business],\r\n\t\t\t\t['College of Education', undergradData.education]\r\n\t\t\t]);\r\n\r\n\t\t\tvar options = {\r\n\t\t\t\tchartArea: { width: '100%', height: '100%' },\r\n\t\t\t\tis3D: true\r\n\t\t\t};\r\n\r\n\t\t\tvar chart = new google.visualization.PieChart(document.getElementById('undergradAdultByCollegeChart'));\r\n\t\t\tchart.draw(data, options);\r\n\r\n\t\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle click on content item with children | function handleClickOnContentItemWithChildren(contentItem) {
// Show loader
Canvas.WindowManager.showLoader(true);
// Get children
Canvas.ContentItemService.findContentItemsByParentContent(contentItem);
} | [
"function onContentItemClick() {\n var elementId = $(this).attr(\"data-id\");\n showFolderOrFileContentById(elementId);\n }",
"function handleClickOnTimeline() {\r\n // Find clicked item\r\n var clickedContentItem = getContentItemOnMousePosition();\r\n\r\n // If no item found zoom out\r\n if (clickedContentItem === undefined) {\r\n clickedContentItem = Canvas.Breadcrumbs.decreaseDepthAndGetTheNewContentItem();\r\n }\r\n\r\n // Make sure root is not reached\r\n if (clickedContentItem !== undefined && clickedContentItem.id !== 0) {\r\n handleClickOnContentItem(clickedContentItem);\r\n }\r\n }",
"function handleClickOnContentItemWithoutChildren(contentItem) {\r\n // Update bread crumbs\r\n Canvas.Breadcrumbs.setContentItem(contentItem);\r\n\r\n // Update content items array\r\n _contentItems = [contentItem];\r\n\r\n // Mark content item as fullscreen mode\r\n contentItem.setIsFullScreen(true);\r\n _fullscreenContentItem = contentItem;\r\n\r\n document.getElementById(\"addButton\").style.display = \"none\";\r\n document.getElementById(\"editButton\").style.display = \"inline-block\";\r\n \r\n }",
"handleClick(id) {\n this.props.onClickSubItem(id);\n }",
"function itemClick(event) {\n\n\n $(this).find(\"input[type=checkbox]\").click();\n\n updateCompletedBtn();\n updateCheckCount();\n\n // Don't bubble up the event to the enclosing <li> element ?? Ask Willis\n event.stopPropagation();\n}",
"function onclick(x,y) {\n // only select child elements if we are not iconified\n if (!iconified) {\n // go through each of the children and see if they were clicked; make\n // sure to transform the coordinate relative to each child's coord space\n var ty = -1+ONE_THIRD;\n\n for (var obj of children) {\n var h = obj.getHeight() * ONE_THIRD, hh = h/2;\n var cx = x/ONE_THIRD/(1-VISUAL_PADDING/hh);\n var cy = (y - ty) / ONE_THIRD / (1-VISUAL_PADDING/hh);\n\n // call 'onclick()' on the child element so it can bounds check itself\n // and any children it might have\n var result = obj.onclick(cx,cy);\n if (result != null) {\n return result;\n }\n\n ty += h;\n }\n }\n\n if (x >= getBounds(\"left\") && x <= getBounds(\"right\")\n && y >= getBounds(\"upper\") && y <= getBounds(\"lower\"))\n {\n return this;\n }\n\n return null;\n }",
"clickNavItem(item) {\n\t item.click()\n\t}",
"function selectItem(e) {\n removeBorder();\n removeShow();\n // Add Border to current feature\n this.classList.add('feature-border');\n // Grab content item from DOM\n const featureContentItem = document.querySelector(`#${this.id}-content`);\n // Add show\n featureContentItem.classList.add('show');\n}",
"function selectItem(e) {\r\n removeBorder();\r\n removeShow();\r\n // Add border to current tab\r\n this.classList.add('tab-border');\r\n // Grab content from DOM\r\n console.log(this.id);\r\n const tabContentItem = document.querySelector(`#${this.id}-content`);\r\n\t// Add show class\r\n\ttabContentItem.classList.add('show');\r\n\r\n}",
"function theClickedItem(item) {\n setHighlightItem(item);\n }",
"handleItemClick({ facetValueToRefine, originalEvent, isRefined }) {\n if (isSpecialClick(originalEvent)) {\n // do not alter the default browser behavior\n // if one special key is down\n return;\n }\n\n if (originalEvent.target.tagName === 'INPUT') {\n this.refine(facetValueToRefine, isRefined);\n return;\n }\n\n let parent = originalEvent.target;\n\n while (parent !== originalEvent.currentTarget) {\n if (\n parent.tagName === 'LABEL' &&\n (parent.querySelector('input[type=\"checkbox\"]') ||\n parent.querySelector('input[type=\"radio\"]'))\n ) {\n return;\n }\n\n if (parent.tagName === 'A' && parent.href) {\n originalEvent.preventDefault();\n }\n\n parent = parent.parentNode;\n }\n\n originalEvent.stopPropagation();\n\n this.refine(facetValueToRefine, isRefined);\n }",
"_onClick() {\n this.expanded = !this.expanded;\n\n // Dispatch an event that signals a request to expand to the\n // `<howto-accordion>` element.\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: {isExpandedNow: this.expanded},\n bubbles: true,\n })\n );\n }",
"function itemClicked(){\n $(\".listing-container li > div\").off().on(\"click\",function(){ \n if ($(this).children(\"i:first-child\").hasClass(\"permision_ok\") ){\n ulelment=$(\"[path='\"+$(this).parent(\"li\").attr(\"path\")+\"']\").find(\"ul\") \n //ajaxGetChildren($(\"#\"+$(this).parent(\"li\").attr(\"id\")+\"_ul\"),$(this).parent(\"li\").attr(\"path\"),1,0)\n if ($(this).parent(\"li\").attr(\"ftype\")===\"file\"){\n $(\".listing-container ul,li div.bg-primary\").removeClass(\"bg-primary\");\n $(this).addClass(\"bg-primary\"); \n }\n else if (ulelment.is(':visible')){\n $(\"[path='\"+$(this).parent(\"li\").attr(\"path\")+\"'] > ul\").hide()\n }\n else {\n $(\".listing-container ul,li div.bg-primary\").removeClass(\"bg-primary\");\n $(this).addClass(\"bg-primary\");\n $(this).parent(\"li\").find(\"ul\").remove()\n $(\".loader\").show()\n $(this).parent(\"li\").append(\"<ul level='\"+$(this).parent(\"li\").attr(\"level\")+\"_ul' ></ul>\")\n ajaxGetChildren($(\"[path='\"+$(this).parent(\"li\").attr(\"path\")+\"'] > ul\"),$(this).parent(\"li\").attr(\"path\"),parseInt($(this).parent(\"li\").attr(\"level\").match(/(\\d+)$/)[0])+1,parseInt($(this).parent(\"li\").attr(\"level\").match(/(\\d+)$/)[0]))\n $(\"[path='\"+$(this).parent(\"li\").attr(\"path\")+\"'] > ul\").show() \n }\n itemClicked()\n \n }\n\n //console.log(this.parentElement.find(\"ul\"))\n //this.parent().find(\"ul\").slideToggle()\n });\n }",
"function handleClick (e) {\n if (e.target.matches('input')) {\n let index = e.target.dataset.index;\n let item = this.querySelector(`.item${index}`)\n item.classList.toggle('completed');\n if(item.classList.contains('completed')){\n showNotification('completed');\n }\n toggleCompleted(todos, index);\n localStorage.setItem('todos', JSON.stringify(todos));\n } else if (e.target.matches('.edit-button')){\n let index = e.target.dataset.index;\n let item = todos[index];\n toggleEditModal();\n populateEditForm(index, item, projects);\n } else if (e.target.matches('.expand-button')){\n let item = e.target;\n let parent = item.parentNode;\n let details = parent.parentNode.querySelector('.details');\n details.classList.toggle('expand-details');\n }\n}",
"function onFolderNameClick() {\n var clickedLink = $(this);\n if (clickedLink.closest(\"li\").hasClass(\"collapsed\")) {\n clickedLink.siblings('div').click();\n }\n const elementId = $(this).attr(\"data-id\");\n showFolderOrFileContentById(elementId);\n }",
"function elementClickedHandler() {\n\n showToolbar(this);\n\n }",
"function handleItemCheckClicked() {\n $('.js-shopping-list').on('click', '.js-item-toggle', event => {\n const itemIndex = getItemIndexFromElement(event.currentTarget);\n toggleCheckedForListItem(itemIndex);\n renderShoppingList();\n });\n}",
"addNavigationToChildrenButtons() {\n const buttons = this.el.querySelectorAll('button')\n for (let entry of buttons) {\n $(entry).click(function () {\n // console.log(\"CLICKED \" + entry.textContent)\n $('html, body').animate({\n scrollTop: $('#' + entry.textContent.toLowerCase()).offset().top\n }, 1000);\n });\n }\n }",
"_handleCheckboxContainerClick(e) {\n const checkbox = dom(e.target).querySelector('input');\n if (!checkbox) { return; }\n checkbox.click();\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check whether an item is in an array. We don't use Array.prototype.indexOf so we don't clobber any existing polyfills. This is a really simple alternative. | function inArray( arr, item ) {
for ( var i = 0, len = arr.length; i < len; i++ ) {
if ( arr[ i ] === item ) {
return true;
}
}
return false;
} | [
"function includes(item, anArray) {\r\n\r\n for (let i = 0; i < anArray.length; i++) {\r\n if (anArray[i] == item) {\r\n return true;\r\n } \r\n }\r\n return false;\r\n}",
"function in_array(val, array) {\n\t\tfor(var i = 0, l = array.length; i < l; i++) {\n\t\t\tif(array[i] == val) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"contains (array, item, f) { return this.indexOf(array, item, f) >= 0 }",
"static isExistInArray(arr, value, index=0){\n\t\tif( typeof arr === 'object'){\n\t\t\tlet arrList = [];\n\t\t\tforEach( arr, (item, key) => {\n\t\t\t\tif(item.id){\n\t\t\t\t\tarrList.push(item.id);\n\t\t\t\t}\n\t\t\t});\n\t\t\tif(indexOf(arrList, value, index) >= 0){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}",
"function isInside(arr, ele) { // [1,2,3], 3\n // if (arr.indexOf(ele) >= 0) {\n // return true;\n // } else {\n // return false;\n // }\n\n return arr.indexOf(ele) >= 0;\n}",
"function arrayContains(arr, obj){\n \tfor (var i=0; i < arr.length; i++){\n \t\tif (arr[i] == obj){\n \t\t\treturn i;\n \t\t}\n \t}\n \treturn false;\n }",
"function in_array(variable, theArray)\n{\n\tfor (var i in theArray)\n\t\tif (theArray[i] == variable)\n\t\t\treturn true;\n\n\treturn false;\n}",
"function isin(element, array) {\n\n var output = false;\n\n for (var i = 0; i <= array.length; i++) {\n\n if (element == array[i]) {\n\n output = true;\n\n }\n\n }\n\n return output;\n\n }",
"function isInArray(x,y)\n{\n\tvar counter = 0;\n\n\tfor (var i = 0; i < x.length; i++) \n\t{\n\t\tif(x[i] === y)\n\t\t{\n\t\t\tcounter++;\n\t\t}\n\t}\n\n\tif(counter === 0)\n\t{\n\t\treturn false;\n\t}\n\telse\n\t{\n\t\treturn true;\n\t}\n}",
"function contains(arr, x) {\n let contine = false;\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] === x) {\n contine = true;\n break;\n }\n }\n return contine;\n}",
"function includes(arr, val) {\n return arr.includes(val);\n}",
"function inArray(value, array) {\n for (var i = 0; i < array.length; i++) {\n if (array[i] == value) return i;\n }\n return -1;\n}",
"function array_key_exists (key, search) {\n if(!search || (search.constructor !== Array && search.constructor !== Object)){\n return false;\n }\n return search[key] !== undefined;\n}",
"function IN(needle, lookup) {\n\n // Return `#NA!` when the needle and lookup are blank.\n if (ISBLANK(needle) && ISBLANK(lookup)) {\n return error$2.na;\n }\n\n // Return `#NA!` when the lookup is not an array.\n if (!ISARRAY(lookup)) {\n return error$2.na;\n }\n\n // Return true when some of the values match the needle.\n return lookup.some(function (n) {\n return EQ(n, needle);\n });\n}",
"static #checkIfObjectIsFound(array) {\n\n\t\t// Check if input is defined.\n\t\tif (!array) {\n\t\t\treturn console.log(`${array} is undefined or null.`)\n\t\t}\n\n\t\treturn array.length !== 0;\n\t}",
"contains(x)\n {\n let contains=false;\n if(x instanceof Hashable)\n {\n let i=this.evaluatePosition(x);\n if(this.#_arrayOfll[i].search(x)!=null)\n {\n contains=true;\n \n }\n }\n else\n {\n throw new Error(\"'contains(x):' Only takes a Hashable object as parameter\");\n }\n return contains;\n }",
"function locate(arr,value){\n value = value.toString();\n return leveler(arr).includes(value) ? true : false;\n}",
"function search_in_array(element,array){\r\n\r\n var found = 0;\r\n \r\n for(i=0;i<array.length;i++)\r\n {\r\n if(array[i] == element)\r\n {\r\n found = 1;\r\n return 1;\r\n }\r\n }\r\n\r\n if(found == 0){\r\n return 0;\r\n }\r\n\r\n}",
"function verificaArray (elemento, array) {\r\n var inclusoArray = false;\r\n\r\n for (var count = 0; count < array.length; count++) {\r\n if (elemento === array[count]) {\r\n inclusoArray = true;\r\n }\r\n }\r\n\r\n return inclusoArray;\r\n}",
"function quickCheck(arr, elem) {\n // Only change code below this line\nif(arr.indexOf(elem) >= 0){\n return true;\n} else {\n return false;\n}\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Integer GetNumElements(String prList) Returns number of elements in a list | function GetNumElements(prList) {
var bLoop = true;
var nElements = 0;
var nIndexStr = -1;
//Loop over the passed list. If the character is a comma, increment the number of elements.
if(prList != "") {
while(bLoop){
nIndexStr = prList.indexOf(",", nIndexStr + 1);
if(nIndexStr != -1 && nIndexStr < prList.length)
nElements++;
else
bLoop = false;
}
}
if(prList != "") nElements++;
return nElements;
} | [
"function numStrings(list) {\n var count = 0;\n for(i = 0; i < list.length; i++) {\n\t\t//loops through each string, counting amount. \n \tif( typeof list[i] == \"string\") {\n \tcount++;\n \t}\n } \n \t\n return count;\n\n}",
"function unit_list_size(unit_list)\n{\n return unit_list.length;\n}",
"function GetListIndex(prElement, prList) {\r\n\tvar cReg = \"\";\r\n\tvar szElement = \"\";\r\n\tvar nIndex = -1;\r\n\t\r\n\t//Loop over the length of the passed list\r\n\tfor(var nIndexStr = 0; nIndexStr <= prList.length; nIndexStr++) {\r\n\t\t\r\n\t\t//Get the current character in this list\r\n\t\tcReg = prList.charAt(nIndexStr);\r\n\t\tif(cReg == \",\" || nIndexStr == prList.length) {\r\n\t\t\t//if we have just finished a list element, compare it against the element stored in szElement\r\n\t\t\tnIndex++;\r\n\t\t\tif(szElement == prElement) {\r\n\t\t\t\t//if the two are identical, return the index.\r\n\t\t\t\treturn nIndex;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t//otherwise, set the stored element blank.\r\n\t\t\t\tszElement = \"\";\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\t//if we are in the middle of a list element, append the current character to the stored element.\r\n\t\t\tszElement += cReg;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn -1;\r\n}",
"function countElements() {\n var theCount = $(\"*\").css(\"padding\", \"1px\").length;\n console.log(\"There are \" + theCount + \" elements\");\n }",
"function numberOfElements(){\n var count = document.getElementsByTagName('div').length;\n console.log('There are ' + count + ' DIVs. in the HTML page');\n}",
"function count_p(parenttag)\n {\n var n = 0;\n var c = parenttag.childNodes;\n for (var i = 0; i < c.length; i++) {\n if (c[i].tagName == \"p\" || c[i].tagName == \"P\")\n n++;\n }\n return n;\n }",
"function countOf(array, element) {\n var x = 0;\n for (var i = 0; i < array.length; i++) {\n if (array[i] == element) {\n x++;\n }\n }\n return x;\n}",
"function hc_nodelistindexgetlengthofemptylist() {\n var success;\n var doc;\n var emList;\n var emNode;\n var textNode;\n var textList;\n var length;\n doc = load(\"hc_staff\");\n emList = doc.getElementsByTagName(\"em\");\n emNode = emList.item(2);\n textNode = emNode.firstChild;\n\n textList = textNode.childNodes;\n\n length = textList.length;\n\n assertEquals(\"length\",0,length);\n \n}",
"function getRequiredPages(list)\n{\n // assume by default that the list length divided by the max items per page has no remainder. \n let result = list.length / MAX_ITEMS_PER_PAGE;\n\n // in case the list length divided by the max items per page HAS a remainder. \n if (list.length % MAX_ITEMS_PER_PAGE !== 0)\n result = parseInt(Math.ceil(result)); // result needs to be updated.\n\n // result now stores the correct value. \n return result; \n}",
"function getElIndex(nList, el){\n\n var index = 0\n\n for(element of nList){\n\n if(element == el){\n return index\n }\n index++\n }\n\n}",
"function count(input) {\n return input.length;\n}",
"function GetElementCount(selector)\n {\n return parseInt(typeof selector.attr(\"data-max\") !== \"undefined\" ? selector.attr(\"data-max\") : base.options.elementCount)\n }",
"function getNumberOfProductTypes(){\n\tvar numberofproducttypes = 0;\n\t$('.numbers :input').each(function(){\n\t\tif(parseInt($(this).val(), 10)>0){\n\t\t\tnumberofproducttypes++;\n\t\t}\n\t});\n\treturn numberofproducttypes;\n}",
"function getNumAllowedDepositTypesInputChecked() {\r\n\tvar allowedDepositTypes = document.getElementById(\"Form:AllowedDepositTypesInput\").getElementsByTagName('input');\t\r\n\tvar cnt = 0;\r\n\tfor (var j = 0 ; j < allowedDepositTypes.length; j++) {\t\t\t\r\n\t\tif (allowedDepositTypes.item(j).checked) {\t\t\t\t\r\n\t\t\tcnt++;\t\t\r\n\t\t}\r\n\t}\t\r\n\treturn cnt;\r\n}",
"function buildList(countSpan, resultList, foundElements) {\n var result = \"\";\n for (var i = 0; i < foundElements[0].length; ++i) {\n result += '<li>';\n result += '<a href=\"' + foundElements[1][i] + '\">';\n result += foundElements[0][i];\n result += '</a></li>';\n }\n\n if (countSpan) {\n countSpan.innerHTML = \"\" + foundElements[0].length;\n }\n resultList.innerHTML = result;\n}",
"function comparePrice(p){\n\n var numOfMatchingProducts = 0;\n for(var i = 0; i<productList.length; i++) {\n \tif(productList[i].cost < p)\n \t\tnumOfMatchingProducts = numOfMatchingProducts+1\n } \n\n \n return numOfMatchingProducts;\n}",
"function countOfNumStr(arr) {\n const num = arr.filter(item => typeof (item) === \"number\").length;\n const str = arr.filter(item => typeof (item) === \"string\").length;\n console.log(`Numbers: ${num}, String: ${str}`);\n}",
"numOfPages() {\n var totPages = Math.ceil(this.productList.length / this.numOfProductsPerPage);\n return totPages;\n }",
"function getItemLength(multifield) {\n return $(multifield[0]).find('coral-multifield-item').length;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION NAME : loadConfigData AUTHOR : Clarice A. Salanda DATE : March 11, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : PARAMETERS : | function loadConfigData(data){
var mydata = data;
if(globalInfoType == "XML"){
var parser = new DOMParser();
var xmlDoc = parser.parseFromString( mydata , "text/xml" );
var row = xmlDoc.getElementsByTagName('MAINCONFIG');
var uptable = xmlDoc.getElementsByTagName('DEVICE');
var lowtable = xmlDoc.getElementsByTagName('STATUS');
}else{
data = data.replace(/'/g,'"');
var json = jQuery.parseJSON(data);
if(json.MAINCONFIG){
var uptable = json.MAINCONFIG[0].DEVICE;
var lowtable = json.MAINCONFIG[0].STATUS;
}
}
var confStat='';
var loadConfStat='';
if(json.MAINCONFIG){
clearTimeout(TimeOut);
TimeOut = setTimeout(function(){
loadConfigXML(uptable,lowtable);
},5000);
return;
}
loadConfInit();
TimeOut = setTimeout(function(){
sanityQuery('loadConfig');
},5000);
} | [
"function loadConfig() {\n\tconfig_file = fs.readFileSync(\"./config.json\");\n\tconfig = JSON.parse(config_file);\n}",
"function wrs_loadConfiguration() {\r\n if (typeof _wrs_conf_path == 'undefined') {\r\n _wrs_conf_path = wrs_getCorePath();\r\n }\r\n\r\n var httpRequest = typeof XMLHttpRequest != 'undefined' ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');\r\n var configUrl = _wrs_int_conf_file.indexOf(\"/\") == 0 || _wrs_int_conf_file.indexOf(\"http\") == 0 ? _wrs_int_conf_file : wrs_concatenateUrl(_wrs_conf_path, _wrs_int_conf_file);\r\n httpRequest.open('GET', configUrl, false);\r\n httpRequest.send(null);\r\n\r\n var jsonConfiguration = JSON.parse(httpRequest.responseText);\r\n var variables = Object.keys(jsonConfiguration);\r\n for (var variable in variables) {\r\n window[variables[variable]] = jsonConfiguration[variables[variable]];\r\n }\r\n\r\n // Services path (tech dependant).\r\n wrs_loadServicePaths(configUrl);\r\n\r\n // End configuration.\r\n _wrs_conf_configuration_loaded = true;\r\n if (typeof _wrs_conf_core_loaded != 'undefined') {\r\n _wrs_conf_plugin_loaded = true;\r\n }\r\n}",
"initLoad(){\n //Load Main config file\n var sectionData = '';\n\n if(typeof(this.section) == 'object'){\n var ObjKeys = Object.keys(this.section);\n if(ObjKeys.length > 0){\n if(this.section['params'] && Object.keys(this.section['params']).length > 0) this.extraPrms = this.section['params'];\n if(this.section['successCall']) this.successCallBack = this.section['successCall'];\n if(this.section['endpoint']) this.section = this.section['endpoint'];\n }\n }\n\n if(configArr[this.section]) sectionData = configArr[this.section];\n if(!sectionData) this.getResponse(false, {error: 'Unable to load configuration for selected page'});\n this.sectionObj = sectionData;\n }",
"function loadConfigXML(uptable,lowtable){\n\tvar confStat='';\n\tvar loadConfStat='';\n\tvar devFlag = false;\n\tif(globalInfoType == \"XML\"){\n\t\tfor(var i = 0; i < uptable.length; i++){\n\t\t\tloadConfStat+=\"<tr>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].getAttribute('HostName')+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].getAttribute('ManagementIP')+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].getAttribute('ConsoleIP')+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].getAttribute('Manufacturer')+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].getAttribute('Model')+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].getAttribute('Login')+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].getAttribute('Load_Config')+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].getAttribute('Recovery')+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].getAttribute('Restoration_Configuration')+\"</td>\";\n\t\t\tloadConfStat+=\"</tr>\";\n\t\t\tif(window['variable' + LoadConfigEnable[pageCanvas] ].toString() == \"true\" && uptable[i].getAttribute('Restoration_Configuration').toLowerCase() != 'fail' && uptable[i].getAttribute('Restoration_Configuration').toLowerCase() != 'completed' && uptable[i].getAttribute('Restoration_Configuration').toLowerCase() != 'cancelled' && uptable[i].getAttribute('Restoration_Configuration').toLowerCase() != 'device not accessible'){\n\t\t\t\tdevFlag = true;\t\t\n\t\t\t}\n\t\t}\n\t//2nd Table of Device Sanity\n\t\tfor(var i = 0; i < lowtable.length; i++){\n\t\t\tconfStat+=\"<tr>\";\n\t\t\tconfStat+=\"<td>\"+lowtable[i].getAttribute('TimeStamp')+\"</td>\";\n\t\t\tconfStat+=\"<td>\"+lowtable[i].getAttribute('HostName')+\"</td>\";\n\t\t\tconfStat+=\"<td>\"+lowtable[i].getAttribute('ManagementIP')+\"</td>\";\n\t\t\tconfStat+=\"<td>\"+lowtable[i].getAttribute('Config_Name')+\"</td>\";\n\t\t\tconfStat+=\"<td>\"+lowtable[i].getAttribute('State')+\"</td>\";\n\t\t\tconfStat+=\"<td>\"+lowtable[i].getAttribute('Status')+\"</td>\";\n\t\t\tconfStat+=\"</tr>\";\n\t\t}\n\t}else{\n\t\tfor(var i = 0; i < uptable.length; i++){\n\t\t\tloadConfStat+=\"<tr>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].HostName+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].ManagementIP+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].ConsoleIP+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].Manufacturer+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].Model+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].Login+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].Load_Config+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].Recovery+\"</td>\";\n\t\t\tloadConfStat+=\"<td>\"+uptable[i].Restoration_Configuration+\"</td>\";\n\t\t\tloadConfStat+=\"</tr>\";\n\t\t\tif(globalMAINCONFIG[pageCanvas].MAINCONFIG[0].LoadConfigEnable.toString() == \"true\" && uptable[i].Restoration_Configuration.toLowerCase() != 'fail' && uptable[i].Restoration_Configuration.toLowerCase() != 'completed' && uptable[i].Restoration_Configuration.toLowerCase() != 'cancelled' && uptable[i].Restoration_Configuration.toLowerCase() != 'device not accessible'){\n\t\t\t\tdevFlag = true;\t\t\n\t\t\t}\n\t\t}\n\t//2nd Table of Device Sanity\n\t\tfor(var i = 0; i < lowtable.length; i++){\n\t\t\tconfStat+=\"<tr>\";\n\t\t\tconfStat+=\"<td>\"+lowtable[i].TimeStamp+\"</td>\";\n\t\t\tconfStat+=\"<td>\"+lowtable[i].HostName+\"</td>\";\n\t\t\tconfStat+=\"<td>\"+lowtable[i].ManagementIP+\"</td>\";\n\t\t\tconfStat+=\"<td>\"+lowtable[i].Config_Name+\"</td>\";\n\t\t\tconfStat+=\"<td>\"+lowtable[i].State+\"</td>\";\n\t\t\tconfStat+=\"<td>\"+lowtable[i].Status+\"</td>\";\n\t\t\tconfStat+=\"</tr>\";\n\t\t}\n\t}\n\t$(\"#loadConfigTableStat > tbody\").empty().append(confStat);\n\t$(\"#loadConfigTable > tbody\").empty().append(loadConfStat);\n\tif(globalInfoType == \"JSON\"){\n var devices = getDevicesNodeJSON();\n }else{\n var devices =devicesArr;\n }\n\t$('#devTotalNo').empty().append(devices.length);\n\tif(globalDeviceType == \"Mobile\"){\n\t\t$(\"#loadConfigTableStat\").table(\"refresh\");\n\t\t$(\"#loadConfigTable\").table(\"refresh\");\n\t}\n\tif(devFlag == false){\n\t\tLoadConfigFlag = \"false\";\n\t}\n\tif(devFlag == true){\n\t\tLoadConfigFlag = \"true\";\n\t}else{\n\t\tclearTimeout(TimeOut);\n\t}\n\tif(autoTriggerTab.toString() == \"true\"){\n\t\tif(devFlag == true){\n\t\t\tcheckFromSanity = \"true\";\n\t\t\t$('#liLoadConf a').trigger('click');\n\t\t}else{\n\t\t\tLoadConfigFlag = \"false\";\n\t\t}\n\t}else{\n\t\tif(devFlag == true){\n\t\t\tautoTrigger('loadConfig');\n\t\t}\n\t}\n\t\n\treturn;\n}",
"function loadMainConfig() {\n return $http({\n method: 'Get',\n data: {},\n url: 'config.json',\n withCredentials: false\n })\n .then(transformResponse)\n .then(conf => {\n try {\n if (conf && conf.endpoints && conf.endpoints.mdx2json) {\n MDX2JSON = conf.endpoints.mdx2json.replace(/\\//ig, '').replace(/ /g, '');\n NAMESPACE = conf.namespace.replace(/\\//ig, '').replace(/ /g, '');\n }\n } catch (e) {\n console.error('Incorrect config in file \"config.json\"');\n }\n adjustEndpoints();\n })\n }",
"function loadImgData(data){\n\tvar mydata = data;\n\tif(globalInfoType == \"XML\"){\n\t\tvar parser = new DOMParser();\n\t\tvar xmlDoc = parser.parseFromString( mydata , \"text/xml\" );\n\t\tvar row = xmlDoc.getElementsByTagName('MAINCONFIG');\n\t\tvar uptable = xmlDoc.getElementsByTagName('DEVICE');\n\t\tvar lowtable = xmlDoc.getElementsByTagName('STATUS');\n\t}else{\n\t\tdata = data.replace(/'/g,'\"');\n var json = jQuery.parseJSON(data);\n\t\tif(json.MAINCONFIG){\n var uptable = json.MAINCONFIG[0].DEVICE;\n var lowtable = json.MAINCONFIG[0].STATUS;\n }\t\n\t}\n\tvar imgStat='';\n\tvar loadImgStat='';\n\tif(json.MAINCONFIG){\n\t\tclearTimeout(TimeOut);\n\t\tTimeOut = setTimeout(function(){\n\t\t\tloadImgXML(uptable,lowtable);\n\t\t},5000);\n\t\treturn;\n\t}\n\tloadImgInit();\n\tTimeOut = setTimeout(function(){\n\t\tsanityQuery('loadImage');\n\t},5000);\t\n}",
"loadConfigulation(url, annotationDataSource = null) {\n console.assert(url, 'url is necessary!')\n\n this._eventEmitter.emit('textae-event.resource.startLoad')\n\n jquery_default()\n .ajax({\n type: 'GET',\n url,\n cache: false,\n xhrFields: {\n withCredentials: false\n },\n timeout: 30000,\n dataType: 'json'\n })\n .done((config) =>\n this._configLoaded(url, config, annotationDataSource)\n )\n .fail(() => this._configLoadFailed(url))\n .always(() =>\n this._eventEmitter.emit('textae-event.resource.endLoad')\n )\n }",
"async _loadDbConfig() {\n //dont trow exception for the case where the database is not installed\n try {\n //get config from db\n const configs = await this._configModel.findAll({})\n //set the config on an object\n await utils.asyncMap(configs, config => {\n this._configs[config.code] = {id: config.id, value: config.value}\n })\n } catch (error) {\n\n }\n }",
"function configsLoad(pth) {\n return pth.split(';').map(p => configLoad(p));\n}",
"function ParseConfiguration (err, data)\n{\n if (err)\n return console.log (err);\n\n config = JSON.parse (data);\n\n SetupClient ();\n}",
"function loadConfInit(){\n\tvar confStat='';\n\tvar loadConfStat='';\n\tif(globalInfoType == \"JSON\"){\n var devices = getDevicesNodeJSON();\n }else{\n var devices =devicesArr;\n }\n\tfor(var i = 0; i < devices.length; i++){\n\t\tif(HostName && HostName != \"\" && devices[i].HostName != HostName){continue;}\n\t\tconfStat+=\"<tr>\";\n\t\tconfStat+=\"<td>\"+devices[i].HostName+\"</td>\";\n\t\tconfStat+=\"<td>\"+devices[i].ManagementIp+\"</td>\";\n\t\tconfStat+=\"<td>\"+devices[i].ConsoleIp+\"</td>\";\n\t\tconfStat+=\"<td>\"+devices[i].Manufacturer+\"</td>\";\n\t\tconfStat+=\"<td>\"+devices[i].Model+\"</td>\";\n\t\tconfStat+=\"<td>Init</td>\";\n\t\tconfStat+=\"<td>Waiting..</td>\";\n\t\tconfStat+=\"<td>Waiting..</td>\";\n\t\tconfStat+=\"<td>Waiting..</td>\";\n\t\tconfStat+=\"</tr>\";\n//2nd Table of Load Image\n\t\tloadConfStat+=\"<tr>\";\n\t\tloadConfStat+=\"<td></td>\";\n\t\tloadConfStat+=\"<td>\"+devices[i].HostName+\"</td>\";\n\t\tloadConfStat+=\"<td>\"+devices[i].ManagementIp+\"</td>\";\n\t\tloadConfStat+=\"<td>\"+devices[i].ConfigUrl+\"</td>\";\n\t\tloadConfStat+=\"<td>Init</td>\";\n\t\tloadConfStat+=\"<td>Waiting..</td>\";\n\t\tloadConfStat+=\"</tr>\";\n\n\t}\n\t$(\"#loadConfigTableStat > tbody\").empty().append(loadConfStat);\n\t$(\"#loadConfigTable > tbody\").empty().append(confStat);\n\tif(globalInfoType == \"JSON\"){\n var devices = getDevicesNodeJSON();\n }else{\n var devices =devicesArr;\n }\n\t$('#devTotalNo').empty().append(devices.length);\n\tif(globalDeviceType == \"Mobile\"){\n\t\t$(\"#loadConfTableStat\").table(\"refresh\");\n\t\t$(\"#loadConfTable\").table(\"refresh\");\n\t}\n}",
"function loadConfig() {\n var configScript = document.createElement('SCRIPT');\n configScript.setAttribute('type', 'text/javascript');\n configScript.setAttribute('src', dcpConfigHref);\n configScript.setAttribute('id', '_dcp_config');\n if (_dcpConfig || schedulerURL) { /* Preserve local configuration as overrides */\n let html = '';\n if (!thisScript.id)\n thisScript.id='_dcp_client_loader';\n html += configScript.outerHTML + '\\n<script>';\n if (_dcpConfig) {\n thisScript.localDcpConfig = _dcpConfig;\n html += `Object.assign(dcpConfig, document.getElementById('${thisScript.id}').localDcpConfig);`;\n }\n if (schedulerURL)\n html += `dcpConfig.scheduler.location=new URL(\"${schedulerURL}\");`;\n html += '</scr'+'ipt>\\n';\n document.write(html);\n } else {\n document.write(configScript.outerHTML);\n }\n configScript = document.getElementById(configScript.id);\n configScript.onerror = function(e) {\n alert('Error DCP-1001: Could not load or parse scheduler configuration from URL (\"' + configScript.getAttribute('src') + '\")');\n console.error('dcpConfig load error: ', e);\n };\n }",
"function getConfig() {\n var wb = SpreadsheetApp.getActiveSpreadsheet();\n var sheet = wb.getSheetByName('configuration'); \n var configdata = getRowsData(sheet, sheet.getDataRange(), 1);\n\n config = {};\n for (i=1; i<configdata.length; i++) {\n var param = configdata[i];\n var thisparam = normalizeHeader(param.parameter)\n config[thisparam] = param.value;\n\n // special processing this script\n if (thisparam == 'open' && param.value) {\n config[thisparam] = param.value.toLowerCase();\n }\n };\n\n Logger.log( 'config = ' + Utilities.jsonStringify(config) );\n return config;\n}",
"get ConfigData() {\r\n const cfg_data = [];\r\n this.native.IterateConfigData((cfg) => {\r\n cfg_data.push(new ImFontConfig(cfg));\r\n });\r\n return cfg_data;\r\n }",
"async load() {\n await this.ensureExists();\n this.conf = await fs.readJSON(this.location);\n }",
"function _loadConfigurationFromDatabaseToMemory(){\n return new Promise(function(resolve, reject){\n let pool = system.systemVariable.get('pool');\n let query = 'SELECT config FROM siteconfig LIMIT 1';\n\n pool.getConnection(function(err, connection){\n if(err){ return reject(err); }\n connection.query(query, function(err, results){\n if(err){ return reject(err); }\n connection.release();\n let configuration;\n if(err || results.length === 0){\n reject(new Error('bootstrap/_lcfdtm: error loading configuration from database'));\n return;\n }\n configuration = JSON.parse(results[0].config);\n system.systemVariable.updateConfig(configuration, function(error){\n if(error){ return reject(error); }\n resolve();\n });\n });\n });\n });\n}",
"load(environment) {\n if (environment && environment.match(/[a-z]+/)) {\n environment = '.' + environment;\n } else {\n environment = '';\n }\n var err = new Error('Invalid configuration file, JSON expected. Check /config' + environment + '.json');\n this.$http.get('/config' + environment + '.json').success((result) => {\n if (!_.isObject(result)) {\n throw err;\n }\n this._loadingDeferred.resolve(result);\n }).error((e) => {\n err.details = e;\n throw err;\n });\n }",
"async _getConfig() {\n const url = `${PARTNER_CONF_URL}/campaigns.json`\n const res = await fetch(url)\n if (res.status !== 200) {\n logger.error('Failed to fetch campaigns JSON')\n return\n }\n const config = await res.json()\n\n if (!config) {\n logger.error('No config - probably an error')\n return\n }\n\n this.validCodes = Object.keys(config)\n\n if (this.validCodes.length === 0) {\n logger.warn('Found 0 valid codes from campaigns.json')\n return\n }\n\n PARTNER_NAMES = {}\n PARTNER_REWARDS = {}\n\n // Get the rewards for the code\n for (const code of this.validCodes) {\n const conf = config[code]\n if (!conf) {\n logger.debug(`Code \"${code}\" has no config`)\n continue\n }\n PARTNER_REWARDS[code] = conf.reward\n PARTNER_NAMES[code] = conf.partner ? conf.partner.name : null\n }\n\n this.lastConfLoad = new Date()\n logger.info(\n `Loaded campaigns.json config at ${this.lastConfLoad.toString()}`\n )\n }",
"function init(){\n initConfig();\n loadOtherdata();\n if(config.log) clearLog({getLock: false, initConfig: false, keepRows: config.log_max_rows - 1});\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mimics the render() method in React that happens after the componentWillMount lifehook. "Renders the user data" using the logger function. And lets the DOM know that the component mounted. | render() {
this.mounted = true
this.logger('display')
this.componentDidMount()
} | [
"componentDidMount() {\n if(this.mounted === true) {\n this.simulateUserActions()\n }\n }",
"onRender() {\n const users = this.users.length === 1 ? this.users : this.users.filter(user => !user.isMine);\n // Clear the innerHTML if we have rendered something before\n if (this.users.length) {\n this.innerHTML = '';\n }\n\n // Render each user\n this.properties.firstUserIsAnonymous = false;\n if (users.length === 1) {\n this._renderUser(users[0]);\n } else {\n this._sortMultiAvatars().forEach(this._renderUser.bind(this));\n }\n\n // Add the \"cluster\" css if rendering multiple users\n // No classList.toggle due to poor IE11 support\n this.toggleClass('layer-avatar-cluster', users.length > 1 && !this.properties.firstUserIsAnonymous);\n if (users.length === 1 && this.showPresence && Client.isPresenceEnabled) {\n this.createElement('layer-presence', {\n size: this.size === 'larger' ? 'large' : this.size,\n item: users[0],\n name: 'presence',\n parentNode: this,\n classList: ['layer-presence-within-avatar'],\n });\n }\n }",
"componentDidMount() {\n const {activeChat, user, socket, userlist} = this.props;\n\n if (!activeChat) {\n const newChat = factories.createChat({name});\n this.props.setActiveChat(newChat);\n this.createChat(newChat, socket);\n }\n\n if (user && activeChat) {\n this.props.addUserToChat(user, activeChat.id, socket);\n this.props.getMessagesFromServer(activeChat.id);\n }\n\n if(!userlist && activeChat) {\n this.props.getUserListFromServer(activeChat.id);\n }\n }",
"componentDidMount() {\n console.log(this.state.completed_challenges);\n // if not logged on, redirect to home.\n if (!localStorage.getItem(\"logged_on\")) {\n this.props.history.push('/');\n }\n console.log(localStorage);\n if (localStorage.getItem(\"user\")) { \n this.getCompletedChallenges(JSON.parse(localStorage.getItem(\"user\")));\n window.onload = this.drawChart;\n window.onresize = this.drawChart;\n }\n }",
"_render() {\n if (this._connected && !!this._template) {\n render(this._template(this), this, {eventContext: this});\n }\n }",
"componentDidMount() {\n //loads Employees from DB\n this.loadEmployees();\n\t\tconst obj = getFromStorage('the_main_app');\n\t\tif (obj && obj.token) {\n\t\t\tconst { token } = obj;\n\t\t\t//verify token\n\t\t\tfetch('/api/account/verify?token=' + token).then((res) => res.json()).then((json) => {\n\t\t\t\tif (json.success) {\n\t\t\t\t\tthis.setState({\n\t\t\t\t\t\ttoken\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n //false entry renders a diffrent page if they were loged in \n\t\t\tthis.setState({\n\t\t\t\tfalseEntry: true\n });\n //redirects them to the login page in 3sec\n\t\t\tsetTimeout(() => {\n\t\t\t\twindow.location.assign('/login');\n\t\t\t}, 3000);\n\t\t}\n }",
"componentDidMount() {\n if (localStorage.getItem('user') && localStorage.getItem('password')) {\n this.setState({ loggedIn: true });\n } else {\n this.setState({ loggedIn: false });\n }\n }",
"onRender() {}",
"componentDidMount() {\n this.setState({ hasLoaded: true })\n\n }",
"render() {\n // set the permission.\n this.auth.setPermission(permissions[this.props.user]);\n const AliceDiv = <p>This is alice's data.</p>\n const BobDiv = <p>This is bob's data.</p>\n return (\n <div>\n <p>====</p>\n { this.auth.permission.check('read', 'alice_data') && AliceDiv }\n { this.auth.permission.check('read', 'bob_data') && BobDiv }\n <p>====</p>\n </div>\n )\n }",
"render () {\n console.log(\"IAMHERE\")\n if (this.state.isAppReady) {\n return (\n <HomeScreen\n logout={() => this.setState({ isLoggedIn: false, isAppReady: false })}\n />\n )\n } else {\n return (\n <AuthScreen\n login={this._simulateLogin}\n signup={this._simulateSignup}\n isLoggedIn={this.state.isLoggedIn}\n isLoading={this.state.isLoading}\n onLoginAnimationCompleted={() => this.setState({ isAppReady: false })}\n />\n )\n }\n }",
"async componentDidMount() {\n try {\n // returns a promise, rest of app will wait for this response\n // from amplify auth with cognito\n //await Auth.currentSession();\n // if 200 OK from above with session info then execute next\n //this.userHasAuthenticated(true);\n\n // if OK pull role from cognito custom attribute and store in state\n //this.userHasPermission(\"admin\");\n } catch ( err ) {\n\n /*\n if (err !== \"No current user\") {\n // eslint-disable-next-line\n alert(err);\n }\n */\n }\n // loading user session is asyn process, we need to make sure\n // that our app does not change state when it first loads\n // we wait to render until isAuthenticating is false\n this.setState({\n //isAuthenticating: false\n });\n }",
"onLoggedIn(user) {\r\n this.setState({\r\n user\r\n });\r\n }",
"render() {\n return (\n <LayoutDiv>\n <Title/>\n <CenterDiv>\n <FormContainer dataReturnHandler={this.handleData}/>\n {this.state.FormInputData === '' ? null : <WordCloudDisplay rawData={this.state.FormInputData}/>}\n </CenterDiv>\n {this.state.AlertDisplay === true ? <Alert /> : null}\n </LayoutDiv>\n );\n }",
"componentWillMount() {\n this._getBallot(this.state.session);\n }",
"componentDidMount() {\n this.loadAccount();\n }",
"render(){\n return(\n <div>\n <form id=\"loginForm\" onSubmit={this.ifSubmit}>\n <input type=\"text\" name=\"name\" value={this.state.input.name} onChange={this.ifChange} id=\"userInput\" placeholder=\"username\" />\n <input type=\"password\" name=\"password\" value={this.state.input.password} onChange={this.ifChange} id=\"pwdInput\" placeholder=\"Enter password\" />\n <input type=\"submit\" value=\"Submit\" />\n </form>\n {this.props.isLogged ? \n <GridList cellHeight={260} cols={4}>\n {UserData.map((tile) => (\n <GridListTile key={tile.id} cols={1}>\n <h1>Username: <br/> {tile.name}</h1>\n <p>Password: <br /> {tile.password}</p>\n </GridListTile>\n ))}\n </GridList>\n : ''} \n </div>\n\n )\n }",
"render() {\n let chatPanelHeader;\n let chatPanelFooter;\n if (this.state.thread && this.state.thread.id !== -1) {\n chatPanelHeader = <ChatPanelHeader thread={this.state.thread} />;\n chatPanelFooter = (<ChatPanelFooter\n text={this.state.text}\n onTextChange={this.onTextChange}\n onKeyDown={this.onKeyDown}\n />);\n }\n\n return (\n <div className=\"col-xs-12 col-sm-8 col-md-9 col-lg-9 right-box\">\n <div className=\"col-inside decor-default chat\">\n {chatPanelHeader}\n <ChatPanelBody messages={this.state.messages} currentUser={this.props.currentUser} />\n {chatPanelFooter}\n </div>\n </div>\n );\n }",
"render() {\n // For example:\n // console.log('The object \"' + this.holder.id + '\" is ready');\n // this.holder.style.backgroundColor = this.options.color;\n // this.holder.innerHTML = 'Hello World!';\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the add to bag button selector | get addToBag() {
return 'button#AddToBag'
} | [
"button(x, y, content, opts){\n\n let button = new Button(x, y, content, opts);\n this.layer.buttons.push(button);\n return button;\n\n }",
"function addButtons() {\n target.css({\n 'border-width': '5px'\n });\n //console.log(\"INSIDE addButtons, thisID: \" + thisId + \" and thisKittenId: \" + thisKittenId);\n // append the delete and edit buttons, with data of metric document id, and kitten document id\n target.append(\"<button type='button' class='btn btn-default btn-xs littleX' data_idKitten=\" + \n thisKittenId + \" data_id=\" + \n thisId + \"><span class='glyphicon glyphicon-remove' aria-hidden='true'></span></button>\");\n target.append(\"<button type='button' class='btn btn-default btn-xs littleE' data_idKitten=\" + \n thisKittenId + \" data_id=\" + \n thisId + \"><span class='glyphicon glyphicon-pencil' aria-hidden='true'></span></button>\");\n // set boolean to true that delete and edit buttons exist\n littleButton = true;\n }",
"addToolBarItems() {\n // Ignore if the buttons are already there\n if (document.getElementsByClassName('rvt-tools').length !== 0) {\n return;\n }\n\n let btnGroup = `<div class=\"BtnGroup rvt-tools\">\n <a id=\"${Constants.SHOW_ALL_BUTTON_ID}\" class=\"${Constants.TOOL_BUTTON_CLASS}\" href=\"#\" aria-label=\"Show All\">Show All Files</a>\n <a id=\"${Constants.COLLAPSE_ALL_BUTTON_ID}\" class=\"${Constants.TOOL_BUTTON_CLASS}\" href=\"#\" aria-label=\"Collapse All\">Collapse All Files</a>\n </div>`;\n\n document.querySelector(Constants.DIFF_BAR_SELECTOR).insertAdjacentHTML('afterBegin', btnGroup);\n\n document.getElementById(Constants.COLLAPSE_ALL_BUTTON_ID).addEventListener('click', this.hideAllBodies);\n document.getElementById(Constants.SHOW_ALL_BUTTON_ID).addEventListener('click', this.showAllBodies);\n }",
"_startChoose(e) {\n let target = e.target;\n if (target.nodeName !== 'BUTTON') {\n target = target.parentElement;\n }\n this._chosenServer = target.dataset.server;\n let choices = this._state.packages[target.dataset.app];\n let chosen = choices.findIndex(choice => choice.Name === target.dataset.name);\n this._push_selection.choices = choices;\n this._push_selection.chosen = chosen;\n this._push_selection.show();\n }",
"function rtGuiClick() { rtGuiAdd(this.id); }",
"get firstRaceDropdownButton2() {return browser.element(\"//android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[3]/android.view.ViewGroup/android.view.ViewGroup[1]/android.widget.Button\");}",
"get BBTag() {return browser.element(\"//android.view.ViewGroup[1]/android.view.ViewGroup[3]/android.widget.Button\");}",
"get ownersDropdownButton() {return browser.element(\"//android.view.ViewGroup[10]/android.widget.Button/android.view.ViewGroup\");}",
"get firstRaceDropdownButton() {return browser.element(\"//android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[3]/android.view.ViewGroup/android.view.ViewGroup/android.widget.Button\");}",
"function buttons(arrayUse, addClass, addButton){\n $(addButton).empty();\n\n for (var i = 0; i < arrayUse.length; i++){\n\n let d = $(\"<button>\");\n d.addClass(addClass);\n d.attr(\"data-type\", arrayUse[i]);\n d.text(arrayUse[i]);\n\n $(addButton).append(d);\n\n }\n }",
"createButton () {\n\n this.button = document.createElement('button')\n\n this.button.title = 'This model has multiple views ...'\n\n this.button.className = 'viewable-selector btn'\n\n this.button.onclick = () => {\n this.showPanel(true)\n }\n\n const span = document.createElement('span')\n span.className = 'fa fa-list-ul'\n this.button.appendChild(span)\n\n const label = document.createElement('label')\n this.button.appendChild(label)\n label.innerHTML = 'Views'\n \n this.viewer.container.appendChild(this.button)\n }",
"get buttons() { return getSidebar().querySelectorAll('.priority-labels button'); }",
"_createSceneryButton(buttons) {\r\n\t\tlet tokenButton = buttons.find((b) => b.name === 'token');\r\n\t\tif (tokenButton && game.user.isGM) {\r\n\t\t\ttokenButton.tools.push({\r\n\t\t\t\tname: 'scenery',\r\n\t\t\t\ttitle: 'NT.ButtonTitle',\r\n\t\t\t\ticon: 'fas fa-theater-masks',\r\n\t\t\t\tvisible: game.user.isGM,\r\n\t\t\t\ttoggle: true,\r\n\t\t\t\tactive: this.sharedState.scenery,\r\n\t\t\t\tonClick: (toggle) => {\r\n\t\t\t\t\tthis.scenery(toggle);\r\n\t\t\t\t},\r\n\t\t\t});\r\n\t\t}\r\n\t}",
"function addButtonAvail() {\n var highlighted = get_Highlight_Text_No_Remove();\n\n if (highlighted === \"\") {\n document.getElementById(\"add-but\").disabled = true;\n } else {\n document.getElementById(\"add-but\").disabled = false;\n }\n}",
"createMoveButton(index) {\n let scope = this;\n let modifyButtonElement = document.createElement('button');\n modifyButtonElement.className = cssConstants.ICON + ' ' + cssConstants.EDITOR_FEATURE_MODIFY;\n modifyButtonElement.title = langConstants.EDITOR_FEATURE_MODIFY;\n modifyButtonElement.setAttribute('feat_id', index);\n jQuery(modifyButtonElement).click(function(event) {\n scope.modifyFeatureFunction(event);\n });\n return modifyButtonElement;\n }",
"function addBaseLayerButton(layer,layerCollection){\n buildToolbar();\n document.querySelector('.baselayer-button-container') === null ? createNode('.toolbar', 'div', ['baselayer-button-container', 'button-container']): false;\n\n let i = layerCollection.array_.filter(layer => layer.values_.isBaseLayer === true).length;\n let layers = [];\n let layerTitle = layer.get('title');\n let layerId = layer.ol_uid;\n createNode('.baselayer-button-container', 'div', ['baselayer-button','tool-button', `baselayer-${layerId}`, layerTitle.toLowerCase().replace(/ /g,'_'),],'',[{'title': 'Klik hier voor de ' + layerTitle + ' achtergrondkaart'}]);\n let layerButton = document.querySelector(`.baselayer-${layerId}`);\n layerButton.addEventListener('click', () => {\n layers = GeoApp.layers.array_.filter(layer => layer.values_.isBaseLayer === true);\n let otherLayers = layers.filter(thisLayer => thisLayer.ol_uid !== layer.ol_uid);\n otherLayers.forEach(otherLayer => {otherLayer.setVisible(false);});\n layer.setVisible(true);\n let buttons = Array.from(document.querySelectorAll('.baselayer-button'));\n let otherButton = buttons.filter(thisButton => thisButton !== layerButton)[0];\n if (layerButton.classList.contains('active') === false) {\n layerButton.classList.add('active');\n otherButton.classList.remove('active');\n }\n });\n if (i === 1) {\n layerButton.classList.add('active');\n layer.setVisible(true);\n }\n}",
"static set toolbarButton(value) {}",
"function addButtonToDropdown(dropdownMenu, button)\n {\n button = button.get(0);\n // Create li element\n li = $('<li><a></a></li>');\n li.children('a').html(button.innerHTML);\n\n // Move all attributes\n for (i = 0; i < button.attributes.length; i++)\n {\n var a = button.attributes[i];\n li.attr(a.name, a.value);\n }\n // Remove and add classes\n li.removeClass($.fn.anToolbar.defaults.removeClass);\n li.removeClass($.fn.anToolbar.defaults.addClass);\n\n dropdownMenu.prepend(li);\n }",
"createSelector() {\n\t\t// Add a selector icon and scales it\n\t\tthis.selector = this.add.image(32, 32, 'selector');\n\t\tthis.selector.alpha = 0;\n\n\t\t// Listen to mouse movement\n\t\tthis.input.on('pointermove', function (pointer) {\n\t\t\t// Grabs mouse position & divide by 64 (To get index of array)\n\t\t\tlet mouseY = Math.floor(pointer.y / 64);\n\t\t\tlet mouseX = Math.floor(pointer.x / 64);\n\n\t\t\t// Check if position available\n\t\t\tif (this.checkPosition(mouseY, mouseX)) {\n\t\t\t\t// If true, update cursor position (32 to center)\n\t\t\t\tthis.selector.setPosition(mouseX * 64 + 32, mouseY * 64 + 32);\n\t\t\t\tthis.selector.alpha = 0.9;\n\t\t\t} else {\n\t\t\t\t// If false\n\t\t\t\tthis.selector.alpha = 0;\n\t\t\t}\n\t\t}.bind(this));\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the scheduler to the supplied, approved sceduler. | function krnSetScheduler(newScheduler)
{
if(_Scheduler.processEnqueued)
{
_StdIn.putText("Please wait for executing processes to complete!");
}
else if(_Scheduler.name === newScheduler)
{
_StdIn.putText("Scheduler is already in use!");
}
else if(newScheduler === "fcfs")
{
_Scheduler = new FCFS();
_StdIn.putText("New Scheduler is " + _Scheduler.name);
}
else if(newScheduler === "rr")
{
_Scheduler = new RoundRobin();
_StdIn.putText("New Scheduler is " + _Scheduler.name);
}
else if(newScheduler === "priority")
{
_Scheduler = new Priority();
_StdIn.putText("New Scheduler is " + _Scheduler.name);
}
else
{
_StdIn.putText("Scheduler "+ newScheduler+ " not found, supported schedulers include: [fcfs,rr,priority]")
}
} | [
"function updateSchedule(axios$$1, token, payload) {\n return restAuthPut(axios$$1, 'schedules/' + token, payload);\n }",
"playScheduler() {\n this.deselect();\n this.scheduler.play();\n }",
"function requestSchedule() {\n\tvar dataForm;\n\tdataForm = \"algorithmSettingForm\";\n\trequestScheduleAlgorithm(requestScheduleUrl, dataForm, \"scheduleSettingsForm\");\n}",
"function krnSetQuantum(quantum)\n{\n // If the quantum is a valid number and the scheduler has a quantum set the quantum.\n if(_Scheduler.setQuantum)\n {\n _Scheduler.setQuantum(quantum);\n }\n else\n {\n _StdIn.putText(\"The scheduler doesn't have a quantum.\");\n }\n}",
"function approveSchedule(departmentCode) {\n var newScheduleStatus = \"A\";\n var url = \"lib/adminUpdateSchedule.php\";\n var obj = {\n dept: departmentCode,\n action: newScheduleStatus\n };\n return $http.post(url, obj);\n }",
"function setEarliestSubRange(schedule) {\n var minId, minRange;\n for(var i = 0, len = schedule.subRanges.length; i < len; i++) {\n var sub = schedule.subRanges[i];\n\n if(!minId || (sub.range[0] < minRange[0])) {\n minId = sub.id;\n minRange = sub.range;\n }\n }\n\n schedule.id = minId;\n schedule.range = minRange;\n }",
"static update(scheduleResourceId, scheduleResource){\n\t\tlet kparams = {};\n\t\tkparams.scheduleResourceId = scheduleResourceId;\n\t\tkparams.scheduleResource = scheduleResource;\n\t\treturn new kaltura.RequestBuilder('schedule_scheduleresource', 'update', kparams);\n\t}",
"function or_set_date(supplier_id)\n{\n\tvar date_del=$(\"#rdate_\"+supplier_id).val();\n\t//Set the date \n\tsupplier_orders_list[supplier_id].requested_delivery_date = date_del;\n}",
"function stateSetApprover() {\n var FlowState = w2ui.propertyForm.record.FlowState;\n var si = getCurrentStateInfo();\n var uid = 0;\n\n if (si == null) {\n console.log('Could not determine the current stateInfo object');\n return;\n }\n if (typeof w2ui.stateChangeForm.record.ApproverName == \"object\" && w2ui.stateChangeForm.record.ApproverName != null) {\n if (w2ui.stateChangeForm.record.ApproverName.length > 0) {\n uid = w2ui.stateChangeForm.record.ApproverName[0].UID;\n }\n }\n if (uid == 0) {\n w2ui.stateChangeForm.error('ERROR: You must select a valid user');\n return;\n }\n si.ApproverUID = uid;\n si.Reason = \"\";\n var x = document.getElementById(\"smApproverReason\");\n if (x != null) {\n si.Reason = x.value;\n }\n if (si.Reason.length < 2) {\n w2ui.stateChangeForm.error('ERROR: You must supply a reason');\n return;\n }\n finishStateChange(si,\"setapprover\");\n}",
"function setDefault() {\n if (ctrl.rrule.bymonthday || ctrl.rrule.byweekday) return\n ctrl.rrule.bymonthday = ctrl.startTime.getDate()\n }",
"function scheduleCommandInvocation(axios$$1, token, schedule, payload) {\n return restAuthPost(axios$$1, 'assignments/' + token + '/invocations/schedules/' + schedule, payload);\n }",
"static get(scheduleResourceId){\n\t\tlet kparams = {};\n\t\tkparams.scheduleResourceId = scheduleResourceId;\n\t\treturn new kaltura.RequestBuilder('schedule_scheduleresource', 'get', kparams);\n\t}",
"function SetSupervisor(vbRec,vbOwner,vbAmount,approverLevel,approver,k) {\n\tvar appDelegate = getDelegateApprover(approver);\n\tvar amntFilter = new Array();\n\tvar amntColumn = new Array();\n\tamntFilter[0] = new nlobjSearchFilter('internalid',null,'is',approverLevel);\n\tamntColumn[0] = new nlobjSearchColumn('custrecord_spk_apl_mxm_apvlmt');\n\tvar rec_amnt = nlapiSearchRecord('customrecord_spk_apl_lvl',null,amntFilter,amntColumn);\n\tif(rec_amnt) {\n\t\t/****** Getting the supervisor Approval limit and comparing with Bill amount to determine the flow ******/\t\t\t\t\t\n\t\tvar approvalLimit = parseFloat(rec_amnt[0].getValue('custrecord_spk_apl_mxm_apvlmt'));\n\t\tnlapiLogExecution('DEBUG', 'Approver limit is', approvalLimit);\n\t\tif(vbAmount > approvalLimit) {\n\t\t\tfor(var i = 1;i <= 100; i++) {\n\t\t\t\t// Creating an Entry of the supervisor based on the Bill Amount\n\t\t\t\tif(i == 1) {\n\t\t\t\t\tvar mtrxFlag = false;\n\t\t\t\t\tvar apMtrxCount = vbRec.getLineItemCount('recmachcustrecord_spk_apvmtx_tranno');\n\t\t\t\t\tnlapiLogExecution('DEBUG', 'apMtrxCount is', apMtrxCount);\n\t\t\t\t\tvar updatedTitle = '';\n\t\t\t\t\tfor(var m = 1;m<= apMtrxCount; m++) {\n\t\t\t\t\t\tvar mtrxApp = vbRec.getLineItemValue('recmachcustrecord_spk_apvmtx_tranno','custrecord_spk_apvmtx_apvr',m);\n\t\t\t\t\t\tvar mtrxTitle = vbRec.getLineItemValue('recmachcustrecord_spk_apvmtx_tranno','custrecord_spk_apvmtx_apvrl',m);\n\t\t\t\t\t\tvar sprvsrApp = vbRec.getLineItemValue('recmachcustrecord_spk_apvmtx_tranno','custrecord_spk_apvmtx_delgtof',m);\n\t\t\t\t\t\tif((mtrxApp == approver && !sprvsrApp)|| (mtrxApp == appDelegate && sprvsrApp == approver)) {\n\t\t\t\t\t\t\tupdatedTitle = mtrxTitle + ',' + 'Supervisor' ;\n\t\t\t\t\t\t\tvbRec.setLineItemValue('recmachcustrecord_spk_apvmtx_tranno','custrecord_spk_apvmtx_apvrl',m,updatedTitle);\n\t\t\t\t\t\t\tmtrxFlag = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(mtrxFlag == false) {\n\t\t\t\t\t\tk = k+1;\n\t\t\t\t\t\tvbRec.selectNewLineItem('recmachcustrecord_spk_apvmtx_tranno');\n\t\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_seq', k);\n\t\t\t\t\t\tif(appDelegate) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_apvr',appDelegate);\n\t\t\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_delgtof', approver);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\n\t\t\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_apvr', approver);\n\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_apvrl','Supervisor');\n\t\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_apmanager',nlapiGetUser());\n\t\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_invown',vbOwner);\n\t\t\t\t\t\tvbRec.commitLineItem('recmachcustrecord_spk_apvmtx_tranno');\n\t\t\t\t\t\t//return k;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// Check for Active Invoice Owner & Approvers\n\t\t\t\t\tvar f2 = new Array();\n\t\t\t\t\tf2[0] = new nlobjSearchFilter('custrecord_spk_ioa_invown',null,'is',approver);\n\t\t\t\t\tf2[1] = new nlobjSearchFilter('isinactive',null,'is','F');\t\t\t\t\t\t\t\t\n\t\t\t\t\tvar col2 = new Array();\n\t\t\t\t\tcol2[0] = new nlobjSearchColumn('custrecord_spk_ioa_apvr');\n\t\t\t\t\tcol2[1] = new nlobjSearchColumn('custrecord_spk_ioa_apvlvl');\n\t\t\t\t\tvar InvOwnresults = nlapiSearchRecord('customrecord_spk_inv_own_apvr',null,f2,col2);\t\t\n\t\t\t\t\tif(InvOwnresults) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tvar approver = InvOwnresults[0].getValue('custrecord_spk_ioa_apvr');\n\t\t\t\t\t\t\tvar delegateApp = getDelegateApprover(approver);\n\t\t\t\t\t\t\tvar approverLevel = InvOwnresults[0].getValue('custrecord_spk_ioa_apvlvl');\n\t\t\t\t\t\t\tvar approvalFilter = new Array();\n\t\t\t\t\t\t\tvar approvalColumn = new Array();\n\t\t\t\t\t\t\tapprovalFilter[0] = new nlobjSearchFilter('internalid',null,'is',approverLevel);\n\t\t\t\t\t\t\tapprovalColumn[0] = new nlobjSearchColumn('custrecord_spk_apl_mxm_apvlmt');\n\t\t\t\t\t\t\tvar amntRec = nlapiSearchRecord('customrecord_spk_apl_lvl',null,approvalFilter,approvalColumn);\n\t\t\t\t\t\t\tif(amntRec) {// Determining the approval limit based on level of the approver\n\t\t\t\t\t\t\t\tvar approvalLimit = parseFloat(amntRec[0].getValue('custrecord_spk_apl_mxm_apvlmt'));\n\t\t\t\t\t\t\t\tvar currentTitle = '';\n\t\t\t\t\t\t\t\tvar supervisorFlag = false;\n\t\t\t\t\t\t\t\tvar mtrxCount = vbRec.getLineItemCount('recmachcustrecord_spk_apvmtx_tranno');\n\t\t\t\t\t\t\t\tnlapiLogExecution('DEBUG', 'mtrxCount5 is', mtrxCount);\n\t\t\t\t\t\t\t\tfor(var m1 = 1;m1<= mtrxCount; m1++) {\n\t\t\t\t\t\t\t\t\tvar mtrxAprvr = vbRec.getLineItemValue('recmachcustrecord_spk_apvmtx_tranno','custrecord_spk_apvmtx_apvr',m1);\n\t\t\t\t\t\t\t\t\tvar mtrxTitle = vbRec.getLineItemValue('recmachcustrecord_spk_apvmtx_tranno','custrecord_spk_apvmtx_apvrl',m1);\n\t\t\t\t\t\t\t\t\tvar dlgte_sprvsr = vbRec.getLineItemValue('recmachcustrecord_spk_apvmtx_tranno','custrecord_spk_apvmtx_delgtof',m1);\n\t\t\t\t\t\t\t\t\tif((mtrxAprvr == approver && !dlgte_sprvsr) || (mtrxAprvr == delegateApp && dlgte_sprvsr == approver)) {\n\t\t\t\t\t\t\t\t\t\tcurrentTitle = mtrxTitle + ',' + 'Supervisor' ;\n\t\t\t\t\t\t\t\t\t\tvbRec.setLineItemValue('recmachcustrecord_spk_apvmtx_tranno','custrecord_spk_apvmtx_apvrl',m1,currentTitle);\n\t\t\t\t\t\t\t\t\t\tsupervisorFlag = true;\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\tif(supervisorFlag == false) {\t\n\t\t\t\t\t\t\t\t\tk = k+1;\n\t\t\t\t\t\t\t\t\tvbRec.selectNewLineItem('recmachcustrecord_spk_apvmtx_tranno');\n\t\t\t\t\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_seq', k);\n\t\t\t\t\t\t\t\t\tif(delegateApp) {\n\t\t\t\t\t\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_apvr',delegateApp);\n\t\t\t\t\t\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_delgtof', approver);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_apvr', approver);\n\t\t\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_apvrl','Supervisor');\n\t\t\t\t\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_apmanager',nlapiGetUser());\n\t\t\t\t\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_invown',vbOwner);\n\t\t\t\t\t\t\t\t\tvbRec.commitLineItem('recmachcustrecord_spk_apvmtx_tranno');\n\t\t\t\t\t\t\t\t\t//return k;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(vbAmount <= approvalLimit) {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\t\tnlapiLogExecution('ERROR', e.name || e.getCode(), e.message || e.getDetails());\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\t\t\t\t\n\t\telse {\n\t\t\tvar currentTitle = '';\n\t\t\tvar supervisorFlag = false;\n\t\t\tvar mtrxCount = vbRec.getLineItemCount('recmachcustrecord_spk_apvmtx_tranno');\n\t\t\tnlapiLogExecution('DEBUG', 'mtrxCount11 is', mtrxCount);\n\t\t\tfor(var m2 = 1;m2<= mtrxCount; m2++) {\n\t\t\t\tvar mtrxAprvr = vbRec.getLineItemValue('recmachcustrecord_spk_apvmtx_tranno','custrecord_spk_apvmtx_apvr',m2);\n\t\t\t\tvar mtrxTitle = vbRec.getLineItemValue('recmachcustrecord_spk_apvmtx_tranno','custrecord_spk_apvmtx_apvrl',m2);\n\t\t\t\tvar sprvsrDlgte = vbRec.getLineItemValue('recmachcustrecord_spk_apvmtx_tranno','custrecord_spk_apvmtx_delgtof',m2);\n\t\t\t\tif((mtrxAprvr == approver && !sprvsrDlgte) || (mtrxAprvr == appDelegate && sprvsrDlgte == approver)) {\n\t\t\t\t\tcurrentTitle = mtrxTitle + ',' + 'Supervisor' ;\n\t\t\t\t\tvbRec.setLineItemValue('recmachcustrecord_spk_apvmtx_tranno','custrecord_spk_apvmtx_apvrl',m2,currentTitle);\n\t\t\t\t\tsupervisorFlag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(supervisorFlag == false) {\n\t\t\t\tk = k+1;\n\t\t\t\tvbRec.selectNewLineItem('recmachcustrecord_spk_apvmtx_tranno');\n\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_seq', k);\n\t\t\t\tif(appDelegate) {\n\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_apvr',appDelegate);\n\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_delgtof', approver);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_apvr', approver);\n\t\t\t\t}\t\n\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_apvrl','Supervisor');\n\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_apmanager',nlapiGetUser());\n\t\t\t\tvbRec.setCurrentLineItemValue('recmachcustrecord_spk_apvmtx_tranno', 'custrecord_spk_apvmtx_invown',vbOwner);\n\t\t\t\tvbRec.commitLineItem('recmachcustrecord_spk_apvmtx_tranno');\n\t\t\t\t//return k;\n\t\t\t}\n\t\t}\n\t}\n\treturn k;\n}",
"function swapScheduleHandler(request, reply) {\n const origin = request.payload.originSchedule;\n const target = request.payload.targetSchedule;\n\n const promises = [\n apiHelper.updateDocument('schedule', {_id: new mongo.ObjectID(origin._id)}, {$set: {userId: new mongo.ObjectID(target.userId)}}),\n apiHelper.updateDocument('schedule', {_id: new mongo.ObjectID(target._id)}, {$set: {userId: new mongo.ObjectID(origin.userId)}})\n ];\n\n Promise.all(promises).then(values => {\n var response = {\n originSchedule: values[0],\n targetSchedule: values[1]\n };\n\n reply(response).code(200);\n });\n}",
"function assignTask(taskStringId, assigneeStringId) {\n client.tasks.update(taskStringId, {assignee: assigneeStringId});\n}",
"applyTo(sculpt) {\n this.sculpt = sculpt;\n }",
"schedule(runner, delay, when) {\n if (runner == null) {\n return this._runners.map(makeSchedule);\n } // The start time for the next animation can either be given explicitly,\n // derived from the current timeline time or it can be relative to the\n // last start time to chain animations direclty\n\n\n var absoluteStartTime = 0;\n var endTime = this.getEndTime();\n delay = delay || 0; // Work out when to start the animation\n\n if (when == null || when === 'last' || when === 'after') {\n // Take the last time and increment\n absoluteStartTime = endTime;\n } else if (when === 'absolute' || when === 'start') {\n absoluteStartTime = delay;\n delay = 0;\n } else if (when === 'now') {\n absoluteStartTime = this._time;\n } else if (when === 'relative') {\n const runnerInfo = this._runners[runner.id];\n\n if (runnerInfo) {\n absoluteStartTime = runnerInfo.start + delay;\n delay = 0;\n }\n } else {\n throw new Error('Invalid value for the \"when\" parameter');\n } // Manage runner\n\n\n runner.unschedule();\n runner.timeline(this);\n const persist = runner.persist();\n const runnerInfo = {\n persist: persist === null ? this._persist : persist,\n start: absoluteStartTime + delay,\n runner\n };\n this._lastRunnerId = runner.id;\n\n this._runners.push(runnerInfo);\n\n this._runners.sort((a, b) => a.start - b.start);\n\n this._runnerIds = this._runners.map(info => info.runner.id);\n\n this.updateTime()._continue();\n\n return this;\n }",
"function assignTask(){\n var priority_sheet=SpreadsheetApp.getActiveSpreadsheet().getSheetByName(\"priority_queue\"); \n var all_priority_range = priority_sheet.getDataRange();\n var all_priority_data = all_priority_range.getValues();\n var eventCal=CalendarApp.getCalendarById(\"impanyu@gmail.com\");\n var currentTime=new Date();\n for(i=1;i<all_priority_range.getNumRows();i++){//read all tasks for processing\n var current_row=all_priority_data[i];\n var requested_starting_time=current_row[column_index[\"requested starting time\"]];\n var requested_ending_time=current_row[column_index[\"requested ending time\"]];\n var requested_starting_date=new Date(requested_starting_time);\n if(requested_ending_time && requested_starting_time && currentTime<requested_starting_date) {//find a task need to be registered into calendar\n var task_name=\"\";\n var link=current_row[column_index[\"link\"]];\n var task_info=\"info: \"+current_row[column_index[\"task info\"]];\n if(link) task_info+=\"\\nlink: \"+link;\n if(current_row[column_index[\"task group\"]]) task_name+=current_row[column_index[\"task group\"]]+\" \";\n task_name+=current_row[column_index[\"task name\"]];\n eventCal.createEvent(task_name, requested_starting_time, requested_ending_time,{description:task_info}); \n \n }\n }\n}",
"schedule (runner, delay, when) {\r\n if (runner == null) {\r\n return this._runners.map(makeSchedule)\r\n }\r\n\r\n // The start time for the next animation can either be given explicitly,\r\n // derived from the current timeline time or it can be relative to the\r\n // last start time to chain animations direclty\r\n\r\n var absoluteStartTime = 0;\r\n var endTime = this.getEndTime();\r\n delay = delay || 0;\r\n\r\n // Work out when to start the animation\r\n if (when == null || when === 'last' || when === 'after') {\r\n // Take the last time and increment\r\n absoluteStartTime = endTime;\r\n } else if (when === 'absolute' || when === 'start') {\r\n absoluteStartTime = delay;\r\n delay = 0;\r\n } else if (when === 'now') {\r\n absoluteStartTime = this._time;\r\n } else if (when === 'relative') {\r\n let runnerInfo = this._runners[runner.id];\r\n if (runnerInfo) {\r\n absoluteStartTime = runnerInfo.start + delay;\r\n delay = 0;\r\n }\r\n } else {\r\n throw new Error('Invalid value for the \"when\" parameter')\r\n }\r\n\r\n // Manage runner\r\n runner.unschedule();\r\n runner.timeline(this);\r\n\r\n const persist = runner.persist();\r\n const runnerInfo = {\r\n persist: persist === null ? this._persist : persist,\r\n start: absoluteStartTime + delay,\r\n runner\r\n };\r\n\r\n this._lastRunnerId = runner.id;\r\n\r\n this._runners.push(runnerInfo);\r\n this._runners.sort((a, b) => a.start - b.start);\r\n this._runnerIds = this._runners.map(info => info.runner.id);\r\n\r\n this.updateTime()._continue();\r\n return this\r\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disable buttons (as if power is off) | function disableButtons() {
let buttons = document.getElementsByTagName("button");
for (let i = 0; i < buttons.length; i++) {
if (buttons[i].id !== "power-button") buttons[i].disabled = true;
}
} | [
"function disableAllButtons() {\n disableOrEnableButtons(false);\n }",
"function disableControls() {\n $(\"button.play\").attr('disabled', true);\n $(\"select\").attr('disabled', true);\n $(\"button.stop\").attr('disabled', false);\n }",
"function DisableCCButton(){\n\n\t EnCC.Disable = true;\n\t EnCCFull.Disable = true;\n\t DiCC.Disable = true;\n\t DiCCFull.Disable = true;\n}",
"function stopAllButtonPressing() {\n canButtonsBeCurrentlyPressed = false;\n console.log(`Turned off the override for ${pauseTime} miliseconds.`);\n setTimeout(function() {\n canButtonsBeCurrentlyPressed = true;\n console.log(`Turned on the override.`);\n }, pauseTime);\n}",
"function setButtons() {\n hitButton.disabled = false;\n standButton.disabled = false;\n continueButton.disabled = true;\n }",
"function powerOff() {\n setVisible(powerOffButton, false);\n setVisible(powerOnButton, true);\n if (fmRadio.isPlaying()) {\n fmRadio.stop();\n }\n saveCurrentStation();\n saveVolume();\n }",
"function buttondeact()\n{\n\tfor(i=0;i<document.all.btn.length;i++)\n\t{document.all.btn[i].disabled = true;}\n}",
"function resetButtons() {\n hitButton.disabled = true;\n standButton.disabled = true;\n continueButton.disabled = false;\n }",
"function disableMainPageButtons() {\n\t\t\tevents.forEach( ev => { \n\t\t\t\tev.button.mouseEnabled = false;\n\t\t\t\tev.button.cursor = \"default\";\n\t\t\t});\n\t\t\n\t\t\tcultures.forEach( cu => { \n\t\t\t\tcu.button.mouseEnabled = false;\n\t\t\t\tcu.button.cursor = \"default\";\n\t\t\t});\n\t\t\n\t\t\tself.aboutUsBtn.mouseEnabled = false;\n\t\t\tself.aboutUsBtn.cursor = \"default\";\n\t\t\n\t\t\tself.returnBtn.mouseEnabled = false;\n\t\t\tself.returnBtn.cursor = \"default\";\n\t\t}",
"function enableControls() {\n $(\"button.play\").attr('disabled', false);\n $(\"select\").attr('disabled', false);\n $(\"button.stop\").attr('disabled', true);\n }",
"function disableVoteButtons() {\n\t$(\"#yes-btn\").prop('disabled', true);\n\t$(\"#no-btn\").prop('disabled', true);\n}",
"function deactivateButtons(){\n $scope.clickMemoryButton = null;\n }",
"disable() {\n BluetoothSerial.disable()\n .then(res => {\n BluetoothActions.setIsEnabled(false);\n })\n .catch(err => console.log(err.message));\n }",
"function enableAllButtons() {\n disableOrEnableButtons(true);\n owner.notifyButtonStatesChanged();\n }",
"function powerOff() {\n sendPowerCommand('off');\n}",
"function byeGuardian() {\n document.getElementById(\"guardianButton\").disabled = true\n}",
"function blockTheMainButtons() {\n buttons.forEach((button) => {\n button.classList.add('disable');\n });\n}",
"function enableResetButton() {\n resetButton.disabled = false;\n}",
"function guessClearResetButtonsOff() {\n guessButton.disabled = false;\n clearButton.disabled = false;\n resetButton.disabled = false;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
scan to the previous interval. | function scanprev() {
setTime(startdateinmilliseconds - diffmilliseconds, enddateinmilliseconds - diffmilliseconds);
} | [
"function scanhalfprev() {\n setTime(startdateinmilliseconds - diffmilliseconds/2, enddateinmilliseconds - diffmilliseconds/2);\n}",
"function scanUp() {\n fmRadio.scan(\n upconvert(band.getMin()),\n upconvert(band.getMax()),\n band.getStep());\n }",
"function scanDown() {\n fmRadio.scan(\n upconvert(band.getMin()),\n upconvert(band.getMax()),\n -band.getStep());\n }",
"selectPrevious() {\n\n // select the previous, or if it is the first entry select the last again\n if (this.selected <= 0) {\n this.selected = this.sequence.length -1;\n }\n else {\n this.selected--;\n }\n\n // highlight the selected entry\n this.highlightSelected();\n\n }",
"function privatePrevious() {\n\t \timageCurrent--;\n\t \tif (imageCurrent < 0) {\n\t \t\timageCurrent = image.length - 1;\n\t \t\tcontainer.animate({left: \"-=\" + (sliceWidth * image.length - sliceWidth)}, speedSlice);\n\t \t} else {\n\t \t\tcontainer.animate({left: \"+=\" + sliceWidth}, speedSlice);\n\t \t}\n\t }",
"__occurance(i) {\n if (i === 0) return this.start.clone();\n const addition = multiplyValues(this.interval, i);\n return this.start.clone().add(addition);\n }",
"getPreviousStep (time, asIndex) {\n\t\tlet ref = this.tzero;\n\t\ttime -= ref;\n\t\ttime /= (60 * 1000);\n\t\tlet ret = Math.floor(time / this.getStepInterval());\n\t\tif (asIndex)\n\t\t\tret = ret % this.getTotalStepCount();\n\t\treturn ret;\n\t}",
"function previousSlide(step) {\n pos = Math.max(pos - step, -(slideCount - 1));\n setTransform();\n }",
"function scanhalfnext() {\n setTime(startdateinmilliseconds + diffmilliseconds/2, enddateinmilliseconds + diffmilliseconds/2);\n}",
"skipPrevious() {\n const { selectedSongIdx } = this.state\n const songIdx = selectedSongIdx < 1 ? (this.countTracks() - 1)\n : selectedSongIdx -1\n\n this.selectSong(songIdx)\n this.play(songIdx)\n }",
"walkBackWhile(startingPosition, condition) {\n let currentPos = startingPosition;\n let currentChar = this.getChar(currentPos);\n while (condition(currentChar)) {\n currentPos = this.getPrev(currentPos);\n currentChar = this.getChar(currentPos);\n if (currentPos.line === 0 && currentPos.character === 0)\n break;\n }\n return currentPos;\n }",
"function previous() {\n // if month equals to the value of 0 so the year will subtracts 1 then month will go to 11 that the value of Dec\n // else just only subtract the month and keep year in the same year\n if (month == 0) {\n year = year - 1;\n month = 11;\n } else {\n month = month - 1;\n }\n showCalendar(month, year);\n}",
"next() {\n let from = this.to,\n wasPoint = this.point\n this.point = null\n let trackOpen = this.openStart < 0 ? [] : null\n for (;;) {\n let a = this.minActive\n if (\n a > -1 &&\n (this.activeTo[a] - this.cursor.from ||\n this.active[a].endSide - this.cursor.startSide) < 0\n ) {\n if (this.activeTo[a] > from) {\n this.to = this.activeTo[a]\n this.endSide = this.active[a].endSide\n break\n }\n this.removeActive(a)\n if (trackOpen) remove(trackOpen, a)\n } else if (!this.cursor.value) {\n this.to = this.endSide = 1000000000 /* C.Far */\n break\n } else if (this.cursor.from > from) {\n this.to = this.cursor.from\n this.endSide = this.cursor.startSide\n break\n } else {\n let nextVal = this.cursor.value\n if (!nextVal.point) {\n // Opening a range\n this.addActive(trackOpen)\n this.cursor.next()\n } else if (\n wasPoint &&\n this.cursor.to == this.to &&\n this.cursor.from < this.cursor.to\n ) {\n // Ignore any non-empty points that end precisely at the end of the prev point\n this.cursor.next()\n } else {\n // New point\n this.point = nextVal\n this.pointFrom = this.cursor.from\n this.pointRank = this.cursor.rank\n this.to = this.cursor.to\n this.endSide = nextVal.endSide\n this.cursor.next()\n this.forward(this.to, this.endSide)\n break\n }\n }\n }\n if (trackOpen) {\n this.openStart = 0\n for (let i = trackOpen.length - 1; i >= 0 && trackOpen[i] < from; i--)\n this.openStart++\n }\n }",
"getPreviousTime (step, time) {\n\t\tlet ret = this.getStepTime(step);\n\t\tlet totalTime = this.getTotalInterval() * 60 * 1000;\n\t\twhile (ret > time)\n\t\t\tret -= totalTime;\n\t\treturn ret;\n\t}",
"function GetRecordsPrevious(){\n CleanTable('available_records_table');\n GetRecords(records.previous_page);\n}",
"scanUntil(regexp) {\n const index = this._tail.search(regexp);\n let match;\n switch (index) {\n case -1:\n match = this._tail;\n this._tail = '';\n break;\n case 0:\n match = '';\n break;\n default:\n match = this._tail.substring(0, index);\n this._tail = this._tail.substring(index);\n }\n this._pos += match.length;\n return match;\n }",
"next() {\n let from = this.to;\n this.point = null;\n let trackOpen = this.openStart < 0 ? [] : null, trackExtra = 0;\n for (;;) {\n let a = this.minActive;\n if (a > -1 && (this.activeTo[a] - this.cursor.from || this.active[a].endSide - this.cursor.startSide) < 0) {\n if (this.activeTo[a] > from) {\n this.to = this.activeTo[a];\n this.endSide = this.active[a].endSide;\n break;\n }\n this.removeActive(a);\n if (trackOpen)\n remove(trackOpen, a);\n }\n else if (!this.cursor.value) {\n this.to = this.endSide = Far;\n break;\n }\n else if (this.cursor.from > from) {\n this.to = this.cursor.from;\n this.endSide = this.cursor.startSide;\n break;\n }\n else {\n let nextVal = this.cursor.value;\n if (!nextVal.point) { // Opening a range\n this.addActive(trackOpen);\n this.cursor.next();\n }\n else { // New point\n this.point = nextVal;\n this.pointFrom = this.cursor.from;\n this.pointRank = this.cursor.rank;\n this.to = this.cursor.to;\n this.endSide = nextVal.endSide;\n if (this.cursor.from < from)\n trackExtra = 1;\n this.cursor.next();\n if (this.to > from)\n this.forward(this.to, this.endSide);\n break;\n }\n }\n }\n if (trackOpen) {\n let openStart = 0;\n while (openStart < trackOpen.length && trackOpen[openStart] < from)\n openStart++;\n this.openStart = openStart + trackExtra;\n }\n }",
"previous() {\n let tmp = this.currentNode.previous();\n if (!tmp.done) {\n this.currentNode = tmp.value;\n this.currentNode.clearChildren();\n //this.currentNode.children.forEach((child) => child.clearChildren());\n console.log(\" ================ PREV ================ \");\n this.ptree();\n }\n return tmp;\n }",
"prev() {\n\t\t\tif (this.currPage > 1) {\n\t\t\t\tthis.currPage--;\n\t\t\t\tthis._loadPage();\n\t\t\t}\n\t\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get PID values from quadcopter on connect | function readPidData() {
return txChar.readValue()
.then(originalPid => {
// Convert from dataView to Uint8Array and save original PID data for possible reset
originalPidData = new Uint8Array(originalPid.buffer, 0, 20);
txCharVal = originalPidData;
console.log("Original PID data received:", originalPid);
// Write original PID data to input boxes
for(var i = 1; i <= 18; i++) {
select(inputMap[i]).value = originalPidData[i];
}
resolve(originalPidData);
});
} | [
"controlViaPid() {\n console.log(\"PID\")\n const { pb, ti, td } = this.pidConsts;\n const KP = 1 / (pb / 100); // proportionalBand\n const KI = KP / ti; // integrativeTime\n const KD = KP * td; // derivativeTime\n const H = 0.1;\n\n const pidController = new Controller(KP, KI, KD, H);\n const temperature = this.getTemp();\n this.errorValue = this.getTemp() - this.setpoint;\n\n pidController.setTarget(this.setpoint);\n this.output = pidController.update(temperature);\n\n if (this.output < 2 && this.setpoint > 30) {\n this.output *= 1.05;\n }\n if (this.output > 1023) {\n this.output = 1023;\n } else if (this.output < 0) {\n this.output = 0;\n }\n this.board.pwmWrite(19, 0, 25, 10, this.output);\n }",
"function getnumberfrompid( pid ) {\n\tvar parid;\n\n\tif( pid == \"#commentbox\" || pid == \"commentbox\" ) {\n\t\tparid = 0;\n\t} else {\n\t\tparid = pid;\n\t\twhile( (i = parid.indexOf( \"-\" )) >= 0 ) {\n\t\t\tparid = parid.substr( i + 1 );\n\t\t}\n\t}\n\treturn( parid );\n}",
"pid() {\n return cluster.isMaster ? process.pid : cluster.worker.process.pid;\n }",
"async function TabPids() {\n const tabs = await tabsQuery({});\n const procIds = await Promise.all(\n tabs.filter(tab => tab.id)\n .map(tab => getProcId(tab.id)));\n const procs = await getProcInfo(procIds, false);\n return Object.values(procs).map(p => p.osProcessId);\n}",
"function ListProcs() {\n\n // Get easy access to the debug output method\n var dbgOutput = host.diagnostics.debugLog;\n\n dbgOutput(\"List Processes!\\n\\n\");\n\n var processes = host.currentSession.Processes;\n\n for (var process of processes)\n {\n dbgOutput(\"Found Process:\\n\");\n dbgOutput(\"\\tName : \", process.Name, \"\\n\");\n dbgOutput(\"\\tId : \", process.Id, \"\\n\");\n }\n\n}",
"function send_to_ppnr_slider(p,s_value){\n var dict = {type : \"slider\", value : s_value};\n var json_message = JSON.stringify(dict);\n connection_ppnr = ppnr_dict[\"client_id\"][p];//123. Might be an error here\n connection_ppnr.send(json_message);\n}",
"function getPortIdforManageConnectivity(portObj,action){\n\tvar port =\"\";\n\tif(globalInfoType == \"JSON\"){\n\t\tvar ojb = portObj.split(\".\")[0];\n\t\tvar objArr = obj.split(\".\");\n var prtArr = getAllPortOfDevice(objArr[0]);\n }else{\n var prtArr= portArr;\n }\n\tfor (var a=0; a<prtArr.length; a++){\n\t\tif (prtArr[a].ObjectPath == portObj){\n\n\t\t\tif (action == \"lineName\"){\n\t\t\t\tport = \"t\"+prtArr[a].Speed+\"_\"+window['variable' + dynamicLineConnected[pageCanvas]].length+1;\t\t\t\t\n\t\t\t}else{\n\t\t\t\tport = prtArr[a].PortId;\n\t\t\t}\n\t\t}\n\t}\n\treturn port;\n}",
"function displayConnections() {\n console.log(\"\\nid:\\tIP Address\\t\\tPort No.\");\n for (i = 0; i < clientSockets.length; i++) {\n var ip = clientSockets[i].request.connection._peername.address;\n\n if (ip == '127.0.0.1') {\n ip = clientIP;\n }\n var port = clientSockets[i].request.connection._peername.port;\n console.log((i + 1) + \"\\t\" + ip + \"\\t\\t\" + port);\n }\n console.log(\"\\n\");\n} // End displayConnections()",
"function getEggRunningInfo() {\n const { stdout } = shell.exec('ps aux | grep node', { silent: true });\n const pidList = [];\n let port;\n\n stdout.split('\\n').forEach(line => {\n if (!line.includes('node ')) {\n return;\n }\n\n const m = line.match(REGEX);\n if (!m) return;\n\n const pid = m[1];\n const cmd = m[2];\n if (cmd.includes(`\"title\":\"egg-server-${pkgInfo.name}\"`)) {\n pidList.push(pid);\n\n if (!port && PORT_REGEX.test(cmd)) {\n port = RegExp.$1;\n }\n }\n });\n\n return {\n pidList,\n port,\n };\n}",
"function getProcId(host) {\n var domainId = getDomainId(host)\n var subdomainId = getSubdomainId(host)\n\n return procs.list[subdomainId] ? subdomainId : domainId\n}",
"function LMSGetPooledQuestionNos() {\n return (LMSGetValue(\"instancy.pooledquestionnos\"));\n}",
"function getPlayQueue (pid, range) {\n sendCmd('player/get_queue', {\n pid: '-652946493'\n });\n}",
"function getProc(host) {\n return procs.list[getProcId(host)]\n}",
"function getConferenceUrl(number) {\n\n // Handle the HTTP request to get the conference mapping\n function onResponse(res) {\n if (res.code === 200) {\n let result = JSON.parse(res.text);\n if (result.conference) {\n confId = number;\n confJID = result.conference;\n\n // Move to the next IVR state to check for a password\n confGetPasswordState.enter(userCall);\n\n } else {\n triggerPlaybackOnInboundCall(\"unknownConference\",\n \"You have specified an unknown conference number.\",\n handleConferenceFailedPlaybackFinished);\n }\n } else {\n Logger.write(`Conference number confirmation call failed for cid: ${number} with status: ${res.code},` +\n `message: ${res.text}, headers ${JSON.stringify(res.headers)}`);\n triggerPlaybackOnInboundCall(\"lookupError\",\n \"Something went wrong confirming your conference number, please try again.\",\n handleConferenceFailedPlaybackFinished);\n }\n }\n\n // Helper function for grabbing conferencing info\n let url = MAPPER_URL + \"?cid=\" + number;\n Net.httpRequest(url, e => {\n if (e.code === 200 || (e.code >= 400 && e.code < 500)) {\n onResponse(e);\n } else {\n Logger.write(`retrying ${url} because of error: ${e.code} -> ${e.error}`);\n // e.code can be <= 8 https://voximplant.com/docs/references/voxengine/net/httprequestresult#code\n // or any of HTTP code (2xx-5xx)\n Net.httpRequest(url, e => {\n if (e.code !== 200) {\n Logger.write(`httpRequest error after 2nd attempt for ${url}: ${e.code} -> ${e.error}`);\n }\n onResponse(e);\n }, { timeout: HTTP_REQUEST_TIMEOUT_SEC });\n }\n }, { timeout: HTTP_REQUEST_TIMEOUT_SEC });\n}",
"function next_qus()\n{\n qus_counter++ ;\n show_qus(qus_counter);\n}",
"function getProcessor() {\n var wmi = new WmiClient({\n username: 'administrator',\n password: 'Messeiry@2012',\n host: '10.10.10.9'\n });\n wmi.query(\"SELECT * FROM Win32_Processor\", function (err, result) {\n console.log(result);\n /*\n messeiry@ubuntu:~/Desktop/NodeJSApps/wmi$ sudo nodejs windowsEventos.js\n[ { AddressWidth: 64,\n Architecture: 9,\n Availability: 3,\n Caption: 'Intel64 Family 6 Model 63 Stepping 2',\n ConfigManagerErrorCode: 0,\n ConfigManagerUserConfig: false,\n CpuStatus: 1,\n CreationClassName: 'Win32_Processor',\n CurrentClockSpeed: 2401,\n CurrentVoltage: 33,\n DataWidth: 64,\n Description: 'Intel64 Family 6 Model 63 Stepping 2',\n DeviceID: 'CPU0',\n ErrorCleared: false,\n ErrorDescription: null,\n ExtClock: 0,\n Family: 2,\n InstallDate: null,\n L2CacheSize: 0,\n L2CacheSpeed: 0,\n L3CacheSize: 0,\n L3CacheSpeed: 0,\n LastErrorCode: 0,\n Level: 6,\n LoadPercentage: 1,\n Manufacturer: 'GenuineIntel',\n MaxClockSpeed: 2401,\n Name: 'Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz',\n NumberOfCores: 1,\n NumberOfLogicalProcessors: 1,\n OtherFamilyDescription: null,\n PNPDeviceID: null,\n PowerManagementCapabilities: null,\n PowerManagementSupported: false,\n ProcessorId: '0FABFBFF000306F2',\n ProcessorType: 3,\n Revision: 16130,\n Role: 'CPU',\n SecondLevelAddressTranslationExtensions: false,\n SocketDesignation: 'CPU socket #0',\n Status: 'OK',\n StatusInfo: 3,\n Stepping: null,\n SystemCreationClassName: 'Win32_ComputerSystem',\n SystemName: 'DC',\n UniqueId: null,\n UpgradeMethod: 4,\n Version: null,\n VirtualizationFirmwareEnabled: false,\n VMMonitorModeExtensions: false,\n VoltageCaps: 2 } ]\n[ { AddressWidth: 64,\n Architecture: 9,\n Availability: 3,\n Caption: 'Intel64 Family 6 Model 63 Stepping 2',\n ConfigManagerErrorCode: 0,\n ConfigManagerUserConfig: false,\n CpuStatus: 1,\n CreationClassName: 'Win32_Processor',\n CurrentClockSpeed: 2401,\n CurrentVoltage: 33,\n DataWidth: 64,\n Description: 'Intel64 Family 6 Model 63 Stepping 2',\n DeviceID: 'CPU0',\n ErrorCleared: false,\n ErrorDescription: null,\n ExtClock: 0,\n Family: 2,\n InstallDate: null,\n L2CacheSize: 0,\n L2CacheSpeed: 0,\n L3CacheSize: 0,\n L3CacheSpeed: 0,\n LastErrorCode: 0,\n Level: 6,\n LoadPercentage: 0,\n Manufacturer: 'GenuineIntel',\n MaxClockSpeed: 2401,\n Name: 'Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz',\n NumberOfCores: 1,\n NumberOfLogicalProcessors: 1,\n OtherFamilyDescription: null,\n PNPDeviceID: null,\n PowerManagementCapabilities: null,\n PowerManagementSupported: false,\n ProcessorId: '0FABFBFF000306F2',\n ProcessorType: 3,\n Revision: 16130,\n Role: 'CPU',\n SecondLevelAddressTranslationExtensions: false,\n SocketDesignation: 'CPU socket #0',\n Status: 'OK',\n StatusInfo: 3,\n Stepping: null,\n SystemCreationClassName: 'Win32_ComputerSystem',\n SystemName: 'DC',\n UniqueId: null,\n UpgradeMethod: 4,\n Version: null,\n VirtualizationFirmwareEnabled: false,\n VMMonitorModeExtensions: false,\n VoltageCaps: 2 } ]\n\n */\n});\n}",
"function selectParcel(parid) {\n\t\tif (parid) {\n\t\t\tvar query = new Query('https://ags.agdmaps.com/arcgis/rest/services/MonongaliaWV/MapServer/' + parcelLayerIDX);\n\t\t\tquery.where = \"dmp = '\" + parid.replace(/^0/,'') + \"'\";\n\t\t\tquery.outFields = ['*'];\n\t\t\tquery.returnGeometry = true;\n\t\t\tquery.outSpatialReference = map.spatialReference;\n\t\t\tvar deferred = parcelLayer.queryFeatures(query, selectionHandler);\n\t\t}\n\t}",
"function getNextPID() {\n DropballEntityPIDInc = DropballEntityPIDInc + 1;\n return DropballEntityPIDInc;\n }",
"function getCapabilities(){\n// Gets available capabilities and update indexes\n getSupervisorCapabilityes(function(err, caps){\n // Just for the ready message\n var descriptions = [];\n // Update indexes\n _.each(caps, function(capsDN , DN){\n capsDN.forEach(function(cap , index){\n var capability = mplane.from_dict(cap);\n //if (!__availableProbes[DN])\n // __availableProbes[DN] = [];\n capability.DN = DN;\n\n // If source.ip4 param is not present we have no way to know where the probe is with respect of our net\n if (_.indexOf(capability.getParameterNames() , PARAM_PROBE_SOURCE) === -1){\n showTitle(\"The capability has no \"+PARAM_PROBE_SOURCE+\" param\");\n }else{\n descriptions.push(\"(\"+DN+\") \" + capability.get_label() + \" : \" +capability.result_column_names().join(\" , \"));\n var sourceParamenter = capability.getParameter(PARAM_PROBE_SOURCE);\n var ipSourceNet = (new mplane.Constraints(sourceParamenter.getConstraints()['0'])).getParam();\n capability.ipAddr= ipSourceNet;\n // Add to the known capabilities\n var index = (__availableProbes.push(capability))-1;\n var netId = ipBelongsToNetId(ipSourceNet);\n if (netId){\n if (!__IndexProbesByNet[netId])\n __IndexProbesByNet[netId] = [];\n __IndexProbesByNet[netId].push(index);\n }\n var capTypes = capability.result_column_names();\n capTypes.forEach(function(type , i){\n if (!__IndexProbesByType[type])\n __IndexProbesByType[type] = [];\n __IndexProbesByType[type].push(index);\n });\n }\n }); // caps of a DN\n });\n info(descriptions.length+\" capabilities discovered on \"+cli.options.supervisorHost);\n descriptions.forEach(function(desc , index){\n info(\"......... \"+desc);\n });\n\n console.log(\"\\n\");\n console.log();\n cli.info(\"--------------------\");\n cli.info(\"INIT PHASE COMPLETED\");\n cli.info(\"--------------------\");\n console.log();\n\n // Periodically scan all the net\n if (cli.options.mode == \"AUTO\"){\n setInterval(function(){\n scan();\n }\n ,configuration.main.scan_period);\n setInterval(function(){\n // Periodically check if results are ready\n checkStatus();\n }\n ,configuration.main.results_check_period);\n }else{\n waitForTriggers();\n }\n });\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the simulated elections results | function getElectionsResults() {
return electionsResults;
} // getElectionsResults | [
"function getNumVotersPerElection() {\n return numVotersPerElection;\n } // getNumVoters",
"function election(votes) {\n for(var student in votes) { \n var votesCast = votes[student];\n \n var counter = 1;\n for(var officer in votesCast) { //targeting the officer position and voted name\n var officerName = votesCast[officer];\n if (voteCount[officer][officerName]) {\n voteCount[officer][officerName] += 1\n }\n else {\n voteCount[officer][officerName] = 1\n }\n }\n }\n}",
"getRandomSolution() {\n var sol = []\n for (let g = 0; g < this.genesCount; g++) {\n // 0 or 1 randomly\n sol.push(Math.round(Math.random()))\n }\n\n return sol;\n }",
"static getAll() {\n return db.any(`\n SELECT * FROM results`\n )\n .then(resultArray => {\n const instanceArray = resultArray.map(resultObj => {\n return new Result(resultObj.id, resultObj.id_resultset, resultObj.id_question, resultObj.correct);\n });\n return instanceArray;\n });\n }",
"async init(ctx) {\n // Initialize election\n let election = await this.getOrGenerateElection(ctx);\n await this.generateRegistrars(ctx);\n let voters = [];\n\n let votableItems = await this.generateVotableItems(ctx);\n //generate ballots for all voters\n for (let i = 0; i < voters.length; i++) {\n if (!voters[i].ballot) {\n //give each registered voter a ballot\n await this.generateBallot(ctx, votableItems, election.id, voters[i]);\n } else {\n console.log('these voters already have ballots');\n break;\n }\n }\n return voters;\n }",
"async getOrGenerateElection (ctx) {\n //query for election first before creating one.\n let currElections = JSON.parse(await this.queryByObjectType(ctx, 'election'));\n let election;\n\n if (currElections.length === 0) {\n // TODO: Improve Date handling. Maybe using Luxon.\n let electionDate = electionData.date;\n let electionStartDate = await new Date(electionDate.start.year, electionDate.start.month,\n electionDate.start.day, electionDate.start.hour, electionDate.start.minute);\n let electionEndDate = await new Date(electionDate.end.year, electionDate.end.month,\n electionDate.end.day, electionDate.end.hour, electionDate.end.minute);\n\n //create the election\n election = await new Election(electionData.name, electionData.country,\n electionDate.start.year, electionStartDate, electionEndDate);\n\n await ctx.stub.putState(election.electionId, Buffer.from(JSON.stringify(election)));\n } else {\n election = currElections[0];\n }\n return election;\n }",
"function test(number) {\n for (let i = 0; i < number; i++) {\n const result = findOptimalStrategiesSet(strategiesArr);\n console.log('result', result);\n }\n return _.sum(times)/times.length;\n}",
"async function getInvestableRegions() {\n const investable_regions = {\n regions: [\"camden\", \"kew\", \"rochdale\"],\n };\n\n await waitFor(Math.random() * 3000);\n\n return investable_regions;\n}",
"function resetResults() {\n correct = 0;\n incorrect = 0;\n unanswered = 0;\n }",
"rouletteWheel_Selection() {\n // Total sum of fitness values\n let sumFitness = this.fitness_values.reduce((a, b) => a + b);\n\n // random point on the circle (random sum) \n var randomPoint = Math.random() * sumFitness;\n\n var currentSum = 0;\n // Loop through solutions and add their sum\n for (let s = 0; s < this.solutionsCount; s++) {\n // add sum of the current solution\n currentSum += this.fitness_values[s];\n\n // if currenSum exceed the random sum -> select solution\n if (currentSum > randomPoint) {\n return this.population[s];\n }\n }\n\n // return the first solution otherwise\n return this.population[0];\n }",
"async checkElectionid(ctx, givenElenctionId) {\n let queryString = {};\n queryString.selector = {};\n queryString.selector.docType = 'election';\n queryString.selector.electionId = givenElenctionId;\n let result = await this.GetQueryResultForQueryString(ctx, JSON.stringify(queryString));\n\n let obj = JSON.parse(result);\n\t\tlet size = Object.keys(obj).length;\n\n if(size === 0)\n {\n throw new Error(`${givenElectionId} does not exist`);\n }\n else\n {\n var s = \"You are eligible for vote\";\n return s;\n }\n\n }",
"function countVotes(votos, nvotos, n, mu, lambda, npartidos) {\n /*\n http://security.hsr.ch/msevote/seminar-papers/HS09_Homomorphic_Tallying_with_Paillier.pdf\n */\n\n\n var producto = 1;\n var n2 = bignum(n).pow(2);\n\n console.log(votos[0]);\n console.log(n);\n console.log(mu);\n console.log(lambda);\n console.log(bignum(mu).invertm(n));\n\n\n for (var i = 0; i < nvotos; i++) {\n console.log(\"Votante \" + i + \" \" + votos[i]);\n producto = bignum(producto).mul(bignum(votos[i]));\n }\n\n console.log(producto);\n\n var tally = bignum(producto).mod(n2);\n\n console.log(\"N: \" + n);\n console.log(\"N^2: \" + n2);\n\n var resultado_f1 = bignum(tally).powm(lambda, n2);\n var resultado_f2 = (bignum(resultado_f1).sub(1)).div(n);\n var resultados = bignum(resultado_f2).mul(mu).mod(n);\n\n console.log(\"RESULTADOS: \" + resultados);\n\n var resultado = {};\n\n for (var i = 1; i <= npartidos; i++) {\n\n resultado[i + 'partido'] = Math.floor((resultados / Math.pow(10, i - 1)) % 10);\n }\n\n /*var resultado = {\n '1partido' : Math.floor((resultados / 1) % 10),\n '2partido' : Math.floor((resultados / 10) % 10),\n '3partido' : Math.floor((resultados / 100) % 10),\n '4partido' : Math.floor((resultados / 1000) % 10)\n };*/\n\n return resultado;\n\n }",
"function updateCards(votes) {\n var voteSum = 0;\n var voteCount = 0;\n consoleLog(\"calling updateCards\");\n var resultHeader = document.createElement(\"p\");\n resultHeader.setAttribute(\"class\", \"resultHeader\");\n votingContainer.appendChild(resultHeader);\n var resultHeaderText = document.createTextNode(\"Results:\");\n resultHeader.appendChild(resultHeaderText);\n for (const user in votes) {\n if (votes.hasOwnProperty(user)) {\n const singleVote = votes[user];\n for (const vote in singleVote) {\n if (singleVote.hasOwnProperty(vote)) {\n if (singleVote[vote] == \"?\") {\n var result = \"?\";\n var nanVote = true;\n } else {\n var result = parseInt(singleVote[vote]);\n }\n\n var resultSpace = document.createElement(\"p\");\n voteCount = voteCount + 1;\n consoleLog(result);\n voteSum = voteSum + result;\n drawVote(resultSpace, result, voteCount);\n }\n }\n }\n }\n consoleLog(voteSum);\n consoleLog(voteCount);\n var breakPoint = document.createElement(\"br\");\n resultSpace.appendChild(breakPoint);\n if (nanVote) {\n voteAverage = \"?\";\n } else {\n var voteAverage = voteSum / voteCount;\n }\n consoleLog(\"vote average: \" + voteAverage);\n drawStats(voteAverage);\n}",
"eliminateRandomCandidate(data) {\n\t\t\t// destructures these values from incoming data\n\t\t\tconst { competing_candidates, rank_num } = data;\n\t\t\t// randomly chooses an eliminated candidate from the competing_candidates array\n\t\t\tconst randomly_eliminated = competing_candidates[Math.floor(Math.random() * competing_candidates.length)];\n\t\t\t// sets rank-specific data (useful for election analytics and results verification)\n\t\t\t_runoffResultsData[`rank_${rank_num}_results`][`random_resolution_of_tie_breaker`] = {\n\t\t\t\tcompeting_candidates,\n\t\t\t\trandomly_eliminated\t\t\t\t\t\t\t\t\t\t\n\t\t\t};\n\t\t\t// adds to result data\n\t\t\t_runoffResultsData.eliminated = randomly_eliminated;\n\t\t}",
"getEAData() {\n const clubId = process.env.CLUB_ID;\n const platform = process.env.PLATFORM;\n\n /* Get match data */\n let data = Meteor.http.call('GET', `http://www.easports.com/iframe/nhl14proclubs/api/platforms/${platform}/clubs/${clubId}/matches`, { params: {\n filters: 'sum, pretty',\n match_type: 'gameType5',\n matches_returned: 10\n }}).data.raw;\n\n /* Loop through the matches */\n for (gm in data) {\n let game = data[gm];\n let match = {};\n match.game_teams = [];\n\n if (Matches.findOne({timestamp: game.timestamp})) {\n console.log('match skipped');\n continue;\n }\n\n /* collect game_teams data, and \"flattening\" details for compatability with old style */\n for (club in game.clubs) {\n let team = Object.assign(game.clubs[club], game.clubs[club].details);\n match.game_teams.push(team);\n }\n\n /* Get member data for both teams in the game. Combine info from club with player stats */\n let members = {};\n for (club in game.clubs) {\n members = Object.assign(members, Meteor.http.call('GET', `http://www.easports.com/iframe/nhl14proclubs/api/platforms/${platform}/clubs/${club}/members`).data.raw[0]);\n }\n let membersdata = [];\n for (member in members) {\n membersdata.push({member: members[member], data: Meteor.http.call('GET', `http://www.easports.com/iframe/nhl14proclubs/api/platforms/${platform}/members/${member}/stats`).data.raw});\n }\n\n /* Get player data from the players that was in the game compare with previous collected data and add name from team member data */\n match.game_players = [];\n let i = 0;\n for (team in game.players) {\n for (player in game.players[team]) {\n match.game_players[i] = game.players[team][player];\n let gameMembersData = (Meteor.http.call('GET', `http://www.easports.com/iframe/nhl14proclubs/api/platforms/${platform}/members/${player}/stats`).data.raw);\n let tempGMD = gameMembersData[Object.keys(gameMembersData)[0]];\n delete tempGMD.memberId; // remove the id which is unique to this query\n let actualPlayer = {};\n for (let j = 0; j < membersdata.length; j++) {\n let tempMD = membersdata[j].data.length !== 0 ? membersdata[j].data[Object.keys(membersdata[j].data)[0]] : {memberId: 'non existant'}; //Make sure an empty object doesn't break the comparision\n delete tempMD.memberId; // remove id here aswell so we have comparable objects\n if (JSON.stringify(tempGMD) == JSON.stringify(tempMD)) {\n actualPlayer = membersdata[j];\n break;\n }\n }\n match.game_players[i].personaName = actualPlayer.member ? actualPlayer.member.name : 'Deleted';\n match.game_players[i].team = team;\n i++;\n }\n }\n\n /* add match id and timestamp and insert into database*/\n match.matchId = game.matchId;\n match.timestamp = game.timestamp;\n try {\n Matches.insert(match);\n Meteor.call('calculateStats');\n console.log('game added');\n }\n catch(err) {\n console.log(err);\n }\n }\n\n }",
"function sim_test_people(run_people){\n console.log(\"\\nsim_test_people with %i people\", run_people);\n expected_disease_count = run_people * odds_for_disease;\n expected_false_positive_count = run_people * odds_for_false_positive;\n disease_count = 0;\n false_positive_count = 0;\n for (i=1; i<= run_people; i++){\n // simulate for the ith person\n patientID = i;\n // we are only interested in positive tests\n positive_test = lib.roll_dice_with_odds(odds_for_false_positive);\n //if the test is positive, compute chance that ith person has disease\n has_disease = lib.roll_dice_with_odds(odds_for_disease);\n\n\n if ((positive_test == true ) && (has_disease == false)){\n false_positive_count++;\n //positive test and ith person really has disease\n }\n if (has_disease == true){\n disease_count++;\n }\n }\n\n \n //console.log(\"has_disease %b is and positive_test is %b\", has_disease, positive_test)\n\n console.log(\"expected false_positive %i for %i people\", expected_false_positive_count, run_people);\n console.log(\"expected disease count of %i for %i people\", expected_disease_count, run_people);\n\n console.log(\"false_positive is %f and true positive is %f\", false_positive_count, disease_count);\n\n console.log(\"chance a positive test reflects real disease is %i disease count in %i false positives\", \n disease_count, false_positive_count );\n console.log(\"chance of disease on positive test %f \", disease_count / false_positive_count);\n console.log(\"chance of disease on positive test %f as a percentage\", ((disease_count / false_positive_count)*100));\n\n //console.log(\"real disease: \", true_positive);\n}",
"function getSimulationSize() {\n return Math.floor(MAX_SIZE / sizePerElection);\n } // getSimulationSize",
"async triggerMatch(){\n const teams = this.teams;\n\n let fetchTeamsPromises = [];\n teams.forEach((teamId) => {\n let team = new Team(teamId, this.tournamentId);\n fetchTeamsPromises.push(team.fetchTeamDetails());\n });\n\n // 1. Get individual Team info.\n let teamsInfo = await Promise.all(fetchTeamsPromises);\n console.log(\"RS\", teamsInfo);\n\n // 2. get winning Match Score \n let payload = { tournamentId: this.tournamentId , round: this.round, match: this.match};\n let matchScore = await this.getMatchScore(payload);\n\n\n // 3. Get the Winning Score\n let teamScores = teamsInfo.map( (team) => {\n return team.score;\n });\n\n let winnerPayload = {tournamentId: this.tournamentId, teamScores: teamScores, matchScore: matchScore};\n let winningScore = await this.getWinnerScore(winnerPayload);\n\n //4. Find the teams which has the Winning Score\n let winnerTeams = teamsInfo.filter((team) => {\n return ( winningScore === team.score );\n });\n\n //5. If WinnerTeams more than one , with lowest teamId wins.\n if(winnerTeams.length>1){\n winnerTeams.sort((a,b) => a.teamId-b.teamId);\n }\n\n //6. Set the progress of the match in the DOM.\n this.setIndicatorLoading(this.round, this.match);\n return winnerTeams[0];\n }",
"function vote() {\n for (party in total_votes_per_party) {\n if (total_votes_per_party[party] > 0) {\n // Calculate the increment for this party\n var increment = Math.round(multiplier * Math.random());\n // Vote and then remove those votes from the counters\n var votes_left = total_votes_per_party[party];\n var votes_to_cast = (votes_left > increment) ? increment : votes_left;\n var inc = {};\n inc['votes.' + party] = votes_to_cast;\n db.votetotals.update({\n constituency: \"uk\"\n }, {\n $inc: inc\n }, {\n upsert: true\n }, {});\n total_votes_per_party[party] = votes_left - votes_to_cast;\n }\n }\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load and execute a script with the file name as the only argument. | function exec_script(script_name) {
$.getScript(script_name, function(){
alert(script_name + " loaded and executed.");
});
} | [
"function playFile(fileName){\n // Starts the pythonscript with the --File= option\n args = [\"--File=\" + fileName];\n runPythonScript(args);\n}",
"function loadUserWorkerScript() {\n\t\t// We've passed path of target worker script from master process to this worker proces in arguments.\n\t\tvar userScriptRelPath = process.argv[1];\n\t\tuserScriptRelPath = sanitizePath(userScriptRelPath);\n\t\ttry {\n\t\t\t// Try to load the path as is (it could be a whole module)\n\t\t\tvar ctx = require(userScriptRelPath);\n\t\t} catch (e) {\n\t\t\t// If the loading fails, add ./ and try again\n\t\t\tuserScriptRelPath = relativizie(userScriptRelPath);\n\t\t\tvar ctx = require(userScriptRelPath);\n\t\t}\n\t\t// Handle transpiler/bundle ES module format using 'default' key.\n\t\tif (ctx.hasOwnProperty('default'))\n\t\t\tctx = ctx['default'];\n\t\t// And finally set the export context of the module as fachmans lookup input.\n\t\tsetContext(ctx);\n\t}",
"function loadScript(test) {\n\n\t\t$.ajax({\n\t\t\turl: 'tests-js/'+test,\n\t\t\tsuccess: function(data) {\n\t\t\t\ttst = new Function([], \"return \" + data);\n\t\t\t\toptions = tst();\n\t\t\t\trunChart(options, test);\n\t\t\t\t},\n\t\t\tdataType: 'text'\n\t\t});\n\t}",
"function loadModule(filename, module,require){\n\tvar privateWrapper = '(function(module,exports,require) {' +\n\t\t\t\t\t\tfs.readFileSync(filename, 'utf8') +\n\t\t\t\t\t\t'}) (module,module.exports, require);';\n\teval (privateWrapper);\n}",
"loadCommandFile(mod, file, skipCheck = false) {\n const fileLoc = path.resolve(mod.moduleFolder, file);\n\n try {\n if (!skipCheck && !fs.statSync(fileLoc).isFile()) {\n throw `${fileLoc} is not a file`;\n }\n } catch (error) {\n throw `No file './src/modules/${mod.id}/${file}' found`;\n }\n\n\n if (path.parse(file).ext !== '.js') {\n throw `Provided file '${file}' is not a js file`;\n }\n\n // Invalidate the cache incase it's been loaded before and changed\n delete require.cache[require.resolve(fileLoc.slice(0, -3))];\n const command = require(fileLoc.slice(0, -3));\n const cmdName = path.parse(file).name;\n const cmdId = `${mod.id}.${cmdName}`;\n\n // Load in the ID and mod reference\n command.id = cmdId;\n command.mod = mod;\n\n const check = this.validateCommand(command);\n if (check) {\n throw `Error validating command '${cmdId}': ${check}`;\n }\n\n mod.commands.push(command);\n this.registerCommand(command);\n\n this.bot.debug(`Loaded command '${cmdId}'`);\n }",
"function loadScript(directoryName, filesArr) {\n\n for (var i = 0; i < filesArr.length; i++) {\n\n w.load(\"modules/\" + directoryName + \"/\" + filesArr[i] + '.js');\n }\n }",
"function loadPriorityScripts(){\r\n executeFunctions([loadGeneralStuff,loadCommandLoader,loadSettingsLoader,loadBigPlaylist]);\r\n}",
"function isScriptFile(filename) {\n var ext = path.extname(filename).toLowerCase();\n return ext === '.js' || ext === '.json';\n}",
"run(script) {\n script._init(this.ecs, this.eventsManager, this);\n script.init();\n this.scripts.push(script);\n }",
"function loadFunction(f) {\n\treturn fs.readFile(f, 'utf8')\n\t.then(b => ({ file: f, body: b, name: functionName(b) }))\n\t.catch(err => { err.message = f + \": \" + err.message; throw err; });\n}",
"function executeScript() {\n chrome.tabs.executeScript(null, {\n file: 'scripts/getPagesSource.js'\n }, function() {\n // If you try and inject into an extensions page or the webstore/NTP you'll get an error\n if (chrome.runtime.lastError) {\n showErrorNotification('There was an error injecting script : \\n' + chrome.runtime.lastError.message, true);\n }\n });\n}",
"isScriptFile(filePath) {\n return ['.js', '.json'].includes(path_1.extname(filePath));\n }",
"async run(path, ...args) {\n\t\tunit.action(\"run\", path, ...args);\n\n\t\t// open links in browser\n\t\tfor (let protocol of [\"http://\", \"https://\", \"nttp://\"]) {\n\t\t\tif (path.startsWith(protocol)) {\n\t\t\t\treturn await Application.load(fs.extinfo(protocol).opener, path);\n\t\t\t}\n\t\t}\n\n\t\tif (fs.isDirectory(path) && !fs.isExecuteable(path)) {\n\t\t\treturn await Application.load(fs.extinfo(\".\").opener, path, ...args);\n\t\t}\n\n\t\tswitch (fs.ext(path)) {\n\t\t\tcase \"js\":\n\t\t\t\t{\n\t\t\t\t\treturn await Application.load(path.split(\".\").slice(0, -1).join(\".\"), ...args);\n\t\t\t\t}\n\t\t\tcase \"exe\":\n\t\t\t\t{\n\t\t\t\t\treturn await Application.load(path, ...args);\n\t\t\t\t}\n\t\t\tcase \"lnk\":\n\t\t\t\t{\n\t\t\t\t\treturn await Application.run(await fs.resolve(path).path, ...args);\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\t{\n\t\t\t\t\tconst extinfo = fs.extinfo(fs.ext(path));\n\n\t\t\t\t\tif (extinfo && extinfo.opener) {\n\t\t\t\t\t\treturn await Application.load(extinfo.opener, path, ...args);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(\"Can't open or run '\" + fs.fix(path) + \"'\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t}",
"function scriptError (e) {\n\t\t\t\tthrow \"Hey, Loader here. I couldn't find this script: \" + e.target.src\n\t\t\t}",
"function findRunningScript(filename, args, server) {\n for (var i = 0; i < server.runningScripts.length; ++i) {\n if (server.runningScripts[i].filename == filename &&\n compareArrays(server.runningScripts[i].args, args)) {\n return server.runningScripts[i];\n }\n }\n return null;\n}",
"function includeJS(file_path){ \r\n var j = document.createElement(\"script\");\r\n j.type = \"text/javascript\";\r\n j.onload = function(){\r\n lib_loaded(file_path);\r\n };\r\n j.src = file_path;\r\n document.getElementsByTagName('head')[0].appendChild(j); \r\n}",
"function loadModifyCode(scene) {\r\n loadScriptWithinContext(\"../modify.mjs\", scene);\r\n}",
"function script(name, completer, cb) {\n var p = pth.join(__dirname, 'completion.sh');\n\n fs.readFile(p, 'utf8', function (er, d) {\n if (er) return cb(er);\n cb(null, d);\n });\n}",
"async load(path, ...args) {\n\t\tunit.action(\"load\", path, ...args);\n\n\t\tconst exeinfo = fs.exeinfo(path);\n\n\t\tfor (let dll of exeinfo.dependencies) {\n\t\t\tawait DLL.load(dll);\n\t\t}\n\n\t\tif (Version(config.version) < Version(exeinfo.requirements.os.version)) {\n\t\t\tthrow new Error(\"Application '\" + exeinfo.name + \"' requires OS version '\" + exeinfo.requirements.os.version + \"' (Currently installed version is '\" + config.version + \"')\");\n\t\t}\n\n\t\tconst process = new Process(path);\n\t\tprocess.log.mark(\"start\");\n\n\t\tconst proxies = {\n\t\t\tWindow: {\n\t\t\t\tobject: Window,\n\t\t\t\tconstruct() {\n\t\t\t\t\treturn function(...args) {\n\t\t\t\t\t\tconst w = new Window(...args);\n\t\t\t\t\t\tprocess.addWindow(w);\n\n\t\t\t\t\t\treturn w;\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\tset(k, value) {\n\t\t\t\t\tWindow[k] = value;\n\t\t\t\t},\n\t\t\t\tget(k) {\n\t\t\t\t\treturn Window[k];\n\t\t\t\t}\n\t\t\t},\n\t\t\tTimer: {\n\t\t\t\tobject: {\n\t\t\t\t\tget top() {\n\t\t\t\t\t\treturn Timer.top;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tconstruct() {\n\t\t\t\t\treturn function(fx, time) {\n\t\t\t\t\t\tconst t = new Timer(fx, time);\n\t\t\t\t\t\tprocess.addTimer(t);\n\n\t\t\t\t\t\treturn t;\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\tget(k) {\n\t\t\t\t\treturn Timer[k];\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst proxy = prop => {\n\t\t\tconst f = prop.construct();\n\n\t\t\tfor (let k in prop.object) {\n\t\t\t\tObject.defineProperty(f, k, {\n\t\t\t\t\tget() {\n\t\t\t\t\t\treturn prop.get(k);\n\t\t\t\t\t},\n\t\t\t\t\tset(value) {\n\t\t\t\t\t\tprop.set(k, value);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn f;\n\t\t};\n\n\t\targs.has = p => {\n\t\t\treturn args.includes(\"-\" + p) || args.includes(\"/\" + p);\n\t\t};\n\n\t\targs.get = (p, osse = 0) => {\n\t\t\tconsole.log(args, p, ((args.indexOf(\"-\" + p) + 1) || (args.indexOf(\"/\" + p) + 1) || -1) + osse)\n\t\t\t\n\t\t\treturn args[((args.indexOf(\"-\" + p) + 1) || (args.indexOf(\"/\" + p) + 1) || -1) + osse];\n\t\t};\n\t\t\n\t\tconst exports = {};\n\t\t\n\t\tfor (let dll of DLL.loadedModules) {\n\t\t\tfor (let exp in dll.exports) {\n\t\t\t\texports[exp] = dll.exports[exp];\n\t\t\t}\n\t\t}\n\t\t\n\t\tconst persistentState = {};\n\t\tconst persistentPath = fs.paths.programData(path) + \"/pstate.json\";\n\t\t\n\t\tif (fs.exists(persistentPath)) {\n\t\t\tconst d = JSON.parse(await fs.read(persistentPath)).state;\n\t\t\t\n\t\t\tfor (let k in d) {\n\t\t\t\tpersistentState[k] = d[k];\n\t\t\t}\n\t\t}\n\t\t\n\t\tpersistentState.save = async () => {\n\t\t\tlet f = \"\";\n\t\t\tfor (let part of persistentPath.split(\"/\")) {\n\t\t\t\tif (!fs.exists(f + part)) {\n\t\t\t\t\tawait fs.mkdir(f + part);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tf += part + \"/\"\n\t\t\t}\n\t\t\t\n\t\t\tif (!fs.exists(persistentPath)) {\n\t\t\t\tawait fs.create(persistentPath, \"{}\");\n\t\t\t}\n\t\t\t\n\t\t\tawait fs.write(persistentPath, JSON.stringify({\n\t\t\t\tvalue: exeinfo.version,\n\t\t\t\tstate: persistentState\n\t\t\t}));\n\t\t};\n\t\t\n\t\tif (!fs.exists(persistentPath)) {\n\t\t\tfor (let key in (exeinfo.initialPersistentState || {})) {\n\t\t\t\tpersistentState[key] = exeinfo.initialPersistentState[key];\n\t\t\t}\n\t\t\t\n\t\t\tawait persistentState.save();\n\t\t}\n\t\t\n\t\tconst params = {\n\t\t\t...exports,\n\t\t\t\n\t\t\tapplication: {\n\t\t\t\tpersistentState,\n\t\t\t\tpath,\n\t\t\t\tlog: process.log,\n\t\t\t\targuments: args,\n\t\t\t\tprocess,\n\t\t\t\tresource(p) {\n\t\t\t\t\tconst pp = fs.fix(path + \"/resources/\" + p);\n\n\t\t\t\t\tif (fs.exists(pp)) {\n\t\t\t\t\t\treturn fs.fix(pp);\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new Error(\"Resource '\" + p + \"' not found\");\n\t\t\t\t}\n\t\t\t},\n\t\t\targuments: args,\n\t\t\texit(code) {\n\t\t\t\tprocess.exit(code);\n\t\t\t},\n\t\t\tconfiguration: exeinfo.configuration,\n\t\t\tprocess,\n\t\t\t\n\t\t\tfs,\n\t\t\tget config() {\n\t\t\t\tconsole.warn(\"config is deprecated\");\n\t\t\t\t\n\t\t\t\treturn config;\t\n\t\t\t},\n\t\t\tget console() {\n\t\t\t\tconsole.warn(\"console is deprecated. Use application.log instead\");\n\t\t\t\t\n\t\t\t\treturn config;\n\t\t\t},\n\t\t\t\n\t\t\tObject,\n\t\t\tDLL,\n\t\t\tMath,\n\t\t\tRegExp,\n\t\t\tError,\n\t\t\tPromise,\n\t\t\tDate,\n\t\t\tJSON,\n\t\t\t\n\t\t\tsetTimeout(handler, time) {\n\t\t\t\tconsole.warn(\"setTimeout is deprecated\");\n\t\t\t\t\n\t\t\t\treturn setTimeout(handler, time);\n\t\t\t},\n\t\t\tsetInterval(handler, time) {\n\t\t\t\tconsole.warn(\"setInterval is deprecated\");\n\t\t\t\t\n\t\t\t\treturn setInterval(handler, time);\n\t\t\t}\n\t\t};\n\n\t\tfor (let key in proxies) {\n\t\t\tparams[key] = proxy(proxies[key]);\n\t\t}\n\n\t\tif (fs.exists(path)) {\n\t\t\tconst scope = process.scopedEnvironnement.createVoidScope(\"const arguments = application.arguments; \" + await fs.read(path + \"/main.js\"), \"Application Main\");\n\t\t\tscope.run(params);\n\n\t\t\treturn process;\n\t\t} else {\n\t\t\tthrow new Error(\"Application \" + path + \" does not exist\");\n\t\t}\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
OffendingLine "subclass" for creating OffendingLine objects which contains the offense information needed to read and parse later. These objects are later stored in an OffendingFile object as a collection. If a parameter is undefined, the class will give its variables a default value. Extends: Collection | function OffendingLine ( line, line_num ) {
Collection.call( this );
this._line = line || 'No line defined.';
this._line_num = line_num || -1;
this.getLine = function () {
return this._line;
};
this.getLineNumber = function () {
return this._line_num;
};
} | [
"function OffendingFile ( path ) {\n Collection.call( this );\n this._path = path || 'No path defined.';\n \n this.getTotalOffenses = function () {\n var total = 0;\n for (var e in this._collection) {\n total += this._collection[e].getLength();\n }\n return total;\n };\n this.getFilePath = function () {\n return this._path;\n };\n}",
"constructor(startingLines = []) {\n this.alphabetizedLines = startingLines;\n }",
"constructor(source, offset, length) {\n this.source = source\n this.offset = offset\n this.length = length\n this.cachedContent = null\n this.cachedLineCount = null\n }",
"static line(spec) {\n return new LineDecoration(spec);\n }",
"function collectionLines(xy, N){\n this.d=random(.2,2); //size of the circles\n this.lines=[]; //lines array\n this.N=N; //number of lines (passed in)\n // loop through and create lines\n for (var i=0; i<N; i++){\n this.lines.push(new randomLine(xy,this.d));\n }\n // add point to the line\n this.updateLines=function(){\n for (var i=0; i<this.N; i++){\n this.lines[i].addPoint();\n }\n }\n // draw the new line\n this.drawLines=function(){\n for (var i=0; i<this.N; i++){\n this.lines[i].drawCurve();\n }\n }\n}",
"function Line( x1, y1, x2, y2 ){\n this.startX = x1;\n this.startY = y1; \n this.endX = x2; \n this.endY = y2;\n}",
"function Textline() {\n // TODO: Better dimensions interface\n this.height = 0;\n this.width = 0;\n}",
"_dkobj(item) {\n item.appendln = function () {\n item.append('\\n');\n var res = item.append.apply(item, arguments);\n item.append('\\n');\n return res;\n };\n return item;\n }",
"function LineSeg(begin, end) {\n\t\tObject.defineProperties(this, {\n\t\t\tbegin: { value: begin, enumerable: true },\n\t\t\tend: { value: end, enumerable: true }\n\t\t});\n\t}",
"function createLineElement(doc, line) {\n var gedLineRe = /^([0-9]+)\\s+([\\-A-Z0-9_@]+)\\s?(.*)\\r?$/;\n var matched = line.match(gedLineRe);\n var newElem;\n if (matched) {\n var level = parseInt(matched[1]);\n if (level == 0 && matched[2].charAt(0) == '@') {\n newElem = createElement(doc, level, matched[3], matched[2]);\n } else {\n newElem = createElement(doc, level, matched[2], matched[3]);\n }\n }\n return [level, newElem];\n}",
"function aggregateScopeLineItemCollection(lineItems, collection) {\n if(angular.isArray(lineItems)) {\n angular.forEach(lineItems, function(item) {\n collection.push(item);\n });\n } else {\n if(lineItems !== undefined) {\n collection.push(lineItems);\n }\n }\n }",
"noteAt(note, glyph, withLineTo = true) {\n if (!note) throw \"NeumeBuilder.noteAt: note must be a valid note\";\n\n if (!glyph) throw \"NeumeBuilder.noteAt: glyph must be a valid glyph code\";\n\n note.setGlyph(this.ctxt, glyph);\n var noteAlignsRight = note.glyphVisualizer.align === \"right\";\n\n var needsLine =\n withLineTo &&\n this.lastNote !== null &&\n (this.lineIsHanging ||\n (this.lastNote.glyphVisualizer &&\n this.lastNote.glyphVisualizer.align === \"right\") ||\n Math.abs(this.lastNote.staffPosition - note.staffPosition) > 1);\n\n if (needsLine) {\n var line = new NeumeLineVisualizer(\n this.ctxt,\n this.lastNote,\n note,\n this.lineIsHanging\n );\n this.neume.addVisualizer(line);\n line.bounds.x = Math.max(this.minX, this.x - line.bounds.width);\n\n if (!noteAlignsRight) this.x = line.bounds.x;\n }\n \n let xOffset = 0;\n if (note.shapeModifiers & NoteShapeModifiers.Linea) {\n var linea = new LineaVisualizer(\n this.ctxt,\n note\n );\n this.neume.addVisualizer(linea);\n note.origin.x += linea.origin.x;\n xOffset = linea.origin.x;\n }\n\n // if this is the first note of a right aligned glyph (probably an initio debilis),\n // then there's nothing to worry about. but if it's not then first, then this\n // subtraction will right align it visually\n if (noteAlignsRight && this.lastNote)\n note.bounds.x = this.x - note.bounds.width;\n else {\n note.bounds.x = this.x + xOffset;\n this.x += note.bounds.width + xOffset;\n }\n\n this.neume.addVisualizer(note);\n\n this.lastNote = note;\n this.lineIsHanging = false;\n\n return this;\n }",
"updateLinePreview() {\n this['linePreview'] = [];\n\n if (this['file']) {\n var content = /** @type {string} */ (this['file'].getContent());\n if (content) {\n var preview = content.split(/\\r?\\n/, 50);\n\n // only include non-empty lines\n for (var i = 0, n = preview.length; i < n; i++) {\n var line = preview[i].trim();\n if (line) {\n this['linePreview'].push(line);\n }\n }\n }\n }\n }",
"function LineOrVertical(line, x) {\n this.vertical = (line === null);\n if (this.vertical) {\n this.x = x;\n } else {\n this.m = line.m;\n this.c = line.c;\n }\n}",
"set line_items(value) {\n this._data.line_items = value;\n }",
"#getBioLineString() {\n let bioLinesString = \"\";\n let startIndex = 0;\n // Jump to the start of == Biography\n if (this.#biographyIndex > 0) {\n startIndex = this.#biographyIndex;\n }\n // assume it ends at end of bio then pick smallest\n // of Research Notes, Sources, references, acknowledgements\n // which is also after the start of the biography\n let endIndex = this.#bioLines.length;\n if (this.#researchNotesIndex > 0 && this.#researchNotesIndex > startIndex) {\n endIndex = this.#researchNotesIndex;\n }\n if (this.#sourcesIndex > 0 && this.#sourcesIndex < endIndex) {\n endIndex = this.#sourcesIndex;\n }\n if (this.#referencesIndex > 0 && this.#referencesIndex < endIndex) {\n endIndex = this.#referencesIndex;\n }\n if (this.#acknowledgementsIndex > 0 && this.#acknowledgementsIndex < endIndex) {\n endIndex = this.#acknowledgementsIndex;\n }\n startIndex++;\n if (this.#biographyIndex === endIndex) {\n this.#style.bioHeadingWithNoLinesFollowing = true;\n } else {\n if (endIndex >= 0) {\n while (startIndex < endIndex) {\n bioLinesString += this.#bioLines[startIndex];\n startIndex++;\n }\n }\n }\n let str = bioLinesString.trim();\n if (str.length === 0) {\n this.#style.bioHeadingWithNoLinesFollowing = true;\n }\n return bioLinesString;\n }",
"function extendLine (line, st) {\n if ((line.length + st.length) > 78) {\n output += line + \"-\\n\";\n return \"M V30 \" + st;\n }\n return line + st;\n }",
"positionMarkings() {}",
"constructor(canvasElementId, canvasWidth = '', imageSrc = '',\n lineWidth = '2', lineColor = '#000000', lineHead = false, fontFamily = 'Arial',\n fontSize = '20', fontColor = '#000000', fontStyle = 'regular', fontAlign = 'center',\n fontBaseline = 'middle', mark = 'X', orderType = ORDER_TYPE_NUM,\n // Below are specific class parameters\n listObjectsCoords = [], strokeRectObject = true,) {\n\n super(canvasElementId, canvasWidth, imageSrc, lineWidth, lineColor, lineHead, fontFamily,\n fontSize, fontColor, fontStyle, fontAlign, fontBaseline, mark, orderType);\n\n // own properties of the class\n this.listObjectsCoords = listObjectsCoords; // array of objects coordinates in the image\n this._listObjectsAssociated = []; // array to store the array of objects coordinates positioned by user\n this.strokeRectObject = strokeRectObject; // define if object will be put into a rectangle\n this._numberAssociationsConnected = 0;\n\n // binding click event to canvas element to allow the position object exercise execution\n this._canvasElement.addEventListener(\"click\", this.clickAction.bind(this), false);\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to Resize the selected image to MobileNet Input Size | function processImage(image_id){
// Code to Resize the selected image to MobileNet Input Size
const img = new Image();
img.crossOrigin = "anonymous";
img.src = document.getElementById(image_id).src;
img.width = 224;
img.height = 224;
return img;
} | [
"function mobileImageResize() {\n\t\t$mirage('.imageStyle').each(function(){\n\t\t\tif( window.orientation == 0 ){\n\t\t\t\tif( ($mirage(this).width() > 280) ) {\n\t\t\t\t\t$mirage(this).width(280);\n\t\t\t\t}\n\t\t\t} else if ( (window.orientation == 90) || (window.orientation == -90) ) {\n\t\t\t\tif( ($mirage(this).width() > 440) ) {\n\t\t\t\t\t$mirage(this).width(440);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t$mirage('.logo img').each(function(){\n\t\t\tif( window.orientation == 0 ){\n\t\t\t\tif( ($mirage(this).width() > 300) ) {\n\t\t\t\t\t$mirage(this).width(300);\n\t\t\t\t}\n\t\t\t} else if ( (window.orientation == 90) || (window.orientation == -90) ) {\n\t\t\t\tif( ($mirage(this).width() > 460) ) {\n\t\t\t\t\t$mirage(this).width(460);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\t$mirage('.iPhoneHeaderImage').each(function(){\n\t\t\tif( window.orientation == 0 ){\n\t\t\t\t$mirage(this).width(320);\n\t\t\t} else if ( (window.orientation == 90) || (window.orientation == -90) ) {\n\t\t\t\t$mirage(this).width(480);\n\t\t\t}\n\t\t});\n\t}",
"function imsanity_resize_images() {\n\t// start the recursion\n\timsanity_resize_next(0);\n}",
"function resize() {\n return new Promise(function (resolve, reject) {\n // print the attributes of the image \n im.identify(['-format', '%wx%h', './public/images/img' + path.extname(file_original_name)], function (err, output) {\n if (err) reject(err);\n console.log('dimensions of original image (w x h): ' + output);\n // resize to 200 x 200 and save it \n im.resize({\n srcPath: './public/images/img' + path.extname(file_original_name),\n dstPath: './public/images/img224' + path.extname(file_original_name),\n width: 224,\n height: 224\n }, function (err, stdout, stderr) {\n if (err) reject(error);\n console.log('./public/images/img' + path.extname(file_original_name)+' resized image to 224x224px');\n resolve(true);\n });\n\n })\n\n })\n}",
"function resizeToTargetSize(jimpImage, pixelImage) {\n const result = jimpImage.clone();\n result.resize(pixelImage.mode.width, pixelImage.mode.height);\n return result;\n}",
"function resize() {\n\n var mapratio= parseInt(d3.select(tag_id).style('width'));\n\n if (width > 8*height) {\n mapratio = width /5;\n } else if (width > 6*height) {\n mapratio = width /4;\n } else if(width>4*height){\n mapratio = width /3;\n } else if(width> 2*height){\n mapratio = width/2;\n } else if(width >= height){\n mapratio = width;\n }\n\n projection.scale([mapratio]).translate([width/2,height/2]);\n }",
"function calculateNewSize(query, callback){\n\n\t//Raw param\n\tvar widthOrHeight = query.size;\n\t// Set to true if user passed in width by height\n\tvar nSizeHandW = false;\n\t// Set to default raw query\n\tvar nWidth = nHeight = widthOrHeight;\n\t//Split by 'x' (times char) and seperate the size\n\tif(widthOrHeight.indexOf(\"x\") != -1){\n\t\t var whArr = widthOrHeight.split(\"x\");\n\t\t nWidth = whArr[0];\n\t\t nHeight = whArr[1];\n\t\t nSizeHandW = true;\n\t}\n\t// Empty object to populate\n\tvar imageSize = {};\n\n\teasyimg.info(getImagePath(query.source)).then(function(stdout){\n\t\t//Get current size\n\t\tvar cWidth, cHeight;\n\t\tconsole.log(stdout);\n\t\tcWidth = stdout.width;\n\t\tcHeight = stdout.height;\n\t\tif(cWidth === undefined || cHeight === undefined){\n\t\t\timageSize =\t{ width : roundSize(nWidth) };\n\t\t}else if(nSizeHandW){\n\t\t\t// If new height and width make sure they are smaller than the current image.\n\t\t\tnWidth = Math.min(nWidth,cWidth);\n\t\t\tnHeight = Math.min(nHeight,cHeight);\n\t\t\t//Set new file path\n\t\t\timageSize =\t{\n\t\t\t\theight : roundSize(nHeight),\n\t\t\t \twidth : roundSize(nWidth)\n\t\t\t };\n\t\t}else{\n\t\t\t// resize to to the smallest size\n\t\t\tif(cWidth >= cHeight){\n\t\t\t\timageSize =\t{ width : roundSize(Math.min(nWidth,cWidth)) };\n\t\t\t}else{\n\t\t\t\tvar ratio = cHeight/cWidth;\n\t\t\t\timageSize = { width : roundSize(ratio * nHeight) };\n\t\t\t}\n\t\t}\n\t\tcallback(null, imageSize);\n\t}).catch((err)=>{\n\t\tconsole.log(\"error while getting info\", err);\n\t\tcallback(false, null);\n\t\treturn;\n\t});\n}",
"function calculateImageSize(value) {\r\n\r\n}",
"function scaleImage(scalePercentage){\n\n imgInContainer.style.width=scalePercentage+\"%\";\n imgInContainer.style.height= \"auto\";\n\n}",
"function resizeActivePictureAndScaleStyles(newWidth)\n{\n\tvar idImgS = charIDToTypeID( \"ImgS\" );\n\tvar desc2 = new ActionDescriptor();\n\tvar idWdth = charIDToTypeID( \"Wdth\" );\n\tvar idPxl = charIDToTypeID( \"#Pxl\" );\n\tdesc2.putUnitDouble( idWdth, idPxl, newWidth);\n\tvar idscaleStyles = stringIDToTypeID( \"scaleStyles\" );\n\tdesc2.putBoolean( idscaleStyles, true );\n\tvar idCnsP = charIDToTypeID( \"CnsP\" );\n\tdesc2.putBoolean( idCnsP, true );\n\tvar idIntr = charIDToTypeID( \"Intr\" );\n\tvar idIntp = charIDToTypeID( \"Intp\" );\n\tvar idBcbc = charIDToTypeID( \"Bcbc\" );\n\tdesc2.putEnumerated( idIntr, idIntp, idBcbc );\n\texecuteAction( idImgS, desc2, DialogModes.NO );\n}",
"function aspectScale() {\n $(\".media-container\").each(function () {\n var container = $(this);\n container.find(\"img, video\").each(function () {\n var dims = {\n w: this.naturalWidth || this.videoWidth || this.clientWidth,\n h: this.naturalHeight || this.videoHeight || this.clientHeight\n },\n space = {\n w: container.width(),\n h: container.height()\n };\n if (dims.w > space.w || dims.h > space.h) {\n $(this).css({width: \"\", height: \"\"}); // Let CSS handle the downscale\n } else {\n if (dims.w / dims.h > space.w / space.h) {\n $(this).css({width: \"100%\", height: \"auto\"});\n } else {\n $(this).css({width: \"auto\", height: \"100%\"});\n }\n }\n });\n });\n }",
"updateImageDimensions(imageUrl) {\n // If the imageUrl is not provided return.\n if(imageUrl === undefined) return;\n\n // Get the image size.\n ImageSize.getSize(imageUrl).then(sizeInfo => {\n if(this.currentImageUri === imageUrl) {\n // The image width and height is available.\n const newLayout = {\n imageWidth: sizeInfo.width,\n imageHeight: sizeInfo.height,\n // Set it to true as the image size is available.\n isImageSizeAvailable: true,\n // If the view size is also available then the zoom view is\n // ready for rendering.\n isReadyForLayout: this.state.isViewSizeAvailable,\n }\n \n // Update the state variable.\n this.setState((prevState) => ({\n ...prevState,\n ...newLayout\n })); \n }\n }, (failure)=>{\n // TODO: check with team, what we do for errors.\n });\n }",
"_setImageSize() {\n this.images[0].style.width = this.container.offsetWidth + 'px';\n }",
"async resize (width, height) {\n this.page.set('viewportSize', {width, height})\n }",
"function autoscale(){\n\t\t// find our parentHeight and parentWidth to compare to\n\t\tvar el = image_div.parentNode;\n\t\tvar parentWidth = '';\n\t\tvar parentHeight = '';\n\t\twhile(el !== null && parentWidth === '' && parentHeight === ''){\n\t\t\tif (typeof el.style !== 'undefined'){\n\t\t\t\tparentWidth = parseInt(el.style.width);\n\t\t\t\tparentHeight = parseInt(el.style.height);\n\t\t\t}\n\t\t\tel = el.parentNode;\n\t\t} \n\t\t// if width or height isn't specified, grab the current window width or height\n\t\tif (parentWidth === '' || isNaN(parseFloat(parentWidth))){\n\t\t\tparentWidth = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;\n\t\t}\n\t\tif (parentHeight === '' || isNaN(parseFloat(parentHeight))){\n\t\t\tparentHeight = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight;\n\t\t}\n\t\t\n\t\t// find how our image compares to the screen ...\n\t\tvar widthComparison = origWidth / parentWidth;\n\t\tvar heightComparison = origHeight / parentHeight;\n\t\t\n\t\t// test to see if we need to scale\n\t\tif (options.autoScale === 'fit' || (options.autoScale === 'scaledown' && (widthComparison > 1 || heightComparison > 1))){\n\t\t\tvar old_zoom = parseFloat(document.getElementById(options.id+'_zoom').value);\n\t\t\tif (widthComparison > heightComparison){\n\t\t\t\tvar zoom = 1 / widthComparison;\n\t\t\t} else {\n\t\t\t\tvar zoom = 1 / heightComparison;\n\t\t\t}\n\t\t\tzoomSet = zoom;\n\t\t\tcurZoom = zoom;\n\t\t\tvar zoom_ratio = zoom / old_zoom;\n\t\t\t\n\t\t\t// Finally we update our zoom, image, image div, and shadowbox\n\t\t\tdocument.getElementById(options.id+'_zoom').value = zoom;\n\t\t\timage.style.width = origWidth * zoom + \"px\";\n\t\t\timage.style.height = origHeight * zoom + \"px\";\n\t\t\timage_div.style.width = origWidth * zoom + \"px\";\n\t\t\timage_div.style.height = origHeight * zoom + \"px\";\n\t\t\tshadowbox.style.width = origWidth * zoom + \"px\";\n\t\t\tshadowbox.style.height = origHeight * zoom + \"px\";\n\t\t}\n\t}",
"function setShowImgSize(url, callback) {\n $('<img/>').attr('src', url).on('load', function() {\n var w = this.naturalWidth,\n h = this.naturalHeight,\n s = imgShowMaxSize;\n if (w > s || h > s) {\n if (w > h) {\n h = Math.floor(h * (s / w));\n w = s;\n } else {\n w = Math.floor(w * (s / h));\n h = s;\n }\n }\n callback({width: w, height: h});\n });\n }",
"function resizedw(){\n loadSlider(slider);\n }",
"function resize(){\n const width = window.innerWidth - 100;\n const topHeight = d3.select(\".top\").node().clientHeight\n const height = window.innerHeight - topHeight - 50\n console.log(width, height)\n \n self.camera.aspect = width / height;\n self.camera.updateProjectionMatrix();\n self.renderer.setSize(width, height);\n render()\n\n }",
"_thumbnailsBoxResized() {\n this._updateSize();\n this._redisplay();\n }",
"_setupResizerCreator() {\n\t\tconst editor = this.editor;\n\t\tconst editingView = editor.editing.view;\n\n\t\teditingView.addObserver( ImageLoadObserver );\n\n\t\tthis.listenTo( editingView.document, 'imageLoaded', ( evt, domEvent ) => {\n\t\t\t// The resizer must be attached only to images loaded by the `ImageInsert`, `ImageUpload` or `LinkImage` plugins.\n\t\t\tif ( !domEvent.target.matches( RESIZABLE_IMAGES_CSS_SELECTOR ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst domConverter = editor.editing.view.domConverter;\n\t\t\tconst imageView = domConverter.domToView( domEvent.target );\n\t\t\tconst widgetView = imageView.findAncestor( { classes: IMAGE_WIDGETS_CLASSES_MATCH_REGEXP } );\n\t\t\tlet resizer = this.editor.plugins.get( WidgetResize ).getResizerByViewElement( widgetView );\n\n\t\t\tif ( resizer ) {\n\t\t\t\t// There are rare cases when the image will be triggered multiple times for the same widget, e.g. when\n\t\t\t\t// the image's source was changed after upload (https://github.com/ckeditor/ckeditor5/pull/8108#issuecomment-708302992).\n\t\t\t\tresizer.redraw();\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst mapper = editor.editing.mapper;\n\t\t\tconst imageModel = mapper.toModelElement( widgetView );\n\n\t\t\tresizer = editor.plugins\n\t\t\t\t.get( WidgetResize )\n\t\t\t\t.attachTo( {\n\t\t\t\t\tunit: editor.config.get( 'image.resizeUnit' ),\n\n\t\t\t\t\tmodelElement: imageModel,\n\t\t\t\t\tviewElement: widgetView,\n\t\t\t\t\teditor,\n\n\t\t\t\t\tgetHandleHost( domWidgetElement ) {\n\t\t\t\t\t\treturn domWidgetElement.querySelector( 'img' );\n\t\t\t\t\t},\n\t\t\t\t\tgetResizeHost() {\n\t\t\t\t\t\t// Return the model image element parent to avoid setting an inline element (<a>/<span>) as a resize host.\n\t\t\t\t\t\treturn domConverter.viewToDom( mapper.toViewElement( imageModel.parent ) );\n\t\t\t\t\t},\n\t\t\t\t\t// TODO consider other positions.\n\t\t\t\t\tisCentered() {\n\t\t\t\t\t\tconst imageStyle = imageModel.getAttribute( 'imageStyle' );\n\n\t\t\t\t\t\treturn !imageStyle || imageStyle == 'block' || imageStyle == 'alignCenter';\n\t\t\t\t\t},\n\n\t\t\t\t\tonCommit( newValue ) {\n\t\t\t\t\t\t// Get rid of the CSS class in case the command execution that follows is unsuccessful\n\t\t\t\t\t\t// (e.g. Track Changes can override it and the new dimensions will not apply). Otherwise,\n\t\t\t\t\t\t// the presence of the class and the absence of the width style will cause it to take 100%\n\t\t\t\t\t\t// of the horizontal space.\n\t\t\t\t\t\teditingView.change( writer => {\n\t\t\t\t\t\t\twriter.removeClass( RESIZED_IMAGE_CLASS, widgetView );\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\teditor.execute( 'resizeImage', { width: newValue } );\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\tresizer.on( 'updateSize', () => {\n\t\t\t\tif ( !widgetView.hasClass( RESIZED_IMAGE_CLASS ) ) {\n\t\t\t\t\teditingView.change( writer => {\n\t\t\t\t\t\twriter.addClass( RESIZED_IMAGE_CLASS, widgetView );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tresizer.bind( 'isEnabled' ).to( this );\n\t\t} );\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find a row by entity type and id | function findByTypeAndId(entity, id, callback){
if( Database[entity] ){
Database[entity].find(id).success(callback);
}
else{
callback({err: "No entity matching the name '" + entity + "' was found."});
}
} | [
"findRecord(store, type, id, record) {\n this.logToConsole(OP_FIND_RECORD, [store, type, id, record]);\n return this.asyncRequest(OP_FIND_RECORD, type.modelName, id);\n }",
"find(type, group, instance) {\n\t\tif (Array.isArray(type)) {\n\t\t\t[type, group, instance] = type;\n\t\t} else if (typeof type === 'object') {\n\t\t\t({type, group, instance} = type);\n\t\t}\n\t\tlet query = {\n\t\t\ttype,\n\t\t\tgroup,\n\t\t\tinstance,\n\t\t};\n\n\t\tlet index = bsearch.eq(this.records, query, compare);\n\t\treturn index > -1 ? this.records[index] : null;\n\n\t}",
"static async findById(id) {\n // Ensure model is registered before finding by ID\n assert.instanceOf(this.__db, DbApi, 'Model must be registered.');\n\n // Return model found by ID\n return await this.__db.findById(this, id);\n }",
"function findById(id) {\n return _.find(fields, { '_id': id });\n }",
"async pegarPorId(id) {\n const encontrado = await ModeloTabelaFornecedor.findOne({\n where : {id},\n raw : true\n });\n if(!encontrado) {\n throw new NaoEncontrado(`Fornecedor de id ${id}`);\n } \n return encontrado;\n }",
"indexOfId(id) {\n var Model = this.constructor.classes().model;\n var index = 0;\n var result = -1;\n id = String(id);\n\n while (index < this._data.length) {\n var entity = this._data[index];\n if (!(entity instanceof Model)) {\n throw new Error('Error, `indexOfId()` is only available on models.');\n }\n if (String(entity.id()) === id) {\n result = index;\n break;\n }\n index++;\n }\n return result;\n }",
"function findEntry(resultId, db) {\n for (const page of db) {\n if (page.id === resultId) {\n return page;\n }\n }\n return resultId;\n}",
"function getEntityFromElementID(entityID) {\n entityID = entityID.substring(6, entityID.length)\n var entity;\n // Look through all the squares\n for(i = 0; i < squares.length; i++){\n // If it has an entity and that entityElements id is equal to the id we're looking for\n if(squares[i] && squares[i].id == entityID) { \n entity = squares[i];\n break;\n }\n }\n return entity;\n}",
"function getRow(id) {\n\treturn /spot(\\d)\\d/.exec(id)[1];\n }",
"async show({ params }) {\n const { id } = params;\n return Type.findOrFail(id);\n }",
"function findBy(filter) {\n return db('marks')\n .where(filter)\n .select()\n .first();\n}",
"function getGraphvCodeByIdentity(target, ip, target_type, code_type, callback) {\n // Gets a specific document from DB\n var queryoptions = {};\n if (target)\n queryoptions.target = target;\n if (ip)\n queryoptions.ip = ip;\n if (target_type)\n queryoptions.target_type = target_type;\n if (code_type)\n queryoptions.code_type = code_type;\n\n graphvCodeModel.findOne(queryoptions, function(err, doc) {\n if (err) {\n console.error('vCodeService getGraphvCodeByIdentity findOne err:', err);\n return callback(err, null);\n } else {\n return callback(null, doc);\n }\n });\n}",
"findImage (data, id) {\n return data.find(image => image.id === id);\n }",
"findById(id) {\n return db.one(`\n SELECT parks.id, parks.name, states.name AS state\n FROM parks\n JOIN states\n ON states.code = parks.state\n WHERE parks.id = $1`, id);\n }",
"function findPerson(id) {\n var foundPerson = null;\n for (var i = 0; i < persons.length; i++) {\n var person = persons[i];\n if (person.id == id) {\n foundPerson = person;\n break;\n }\n }\n\n return foundPerson;\n }",
"function findEmployeeById(id) {\n var foundEmployee = null; \n employeesDB.some(function(employee) {\n if(employee.id === id) {\n foundEmployee = employee;\n return true;\n }\n return false;\n });\n\n return foundEmployee;\n}",
"function recordsetDialog_searchByType(stype) {\r\n\tfor (ii = 0; ii < MM.rsTypes.length;ii++) {\r\n\t\tif (dw.getDocumentDOM().serverModel.getServerName() == MM.rsTypes[ii].serverModel) {\r\n\t\t\tif (MM.rsTypes[ii].type == stype) {\r\n\t\t\t\treturn ii;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn -1;\r\n}",
"hasId(entity) {\n return this.metadata.primaryColumns.every(primaryColumn => {\n const columnName = primaryColumn.propertyName;\n return !!entity &&\n entity.hasOwnProperty(columnName) &&\n entity[columnName] !== null &&\n entity[columnName] !== undefined &&\n entity[columnName] !== \"\";\n });\n }",
"static getById(id) {\n return db.one(`\n SELECT * FROM results WHERE id = $1`,\n [id]\n )\n .then(result => {\n return new Result(result.id, result.id_resultset, result.id_question, result.correct);\n });\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParsertrace_file_clause. | visitTrace_file_clause(ctx) {
return this.visitChildren(ctx);
} | [
"visitDatabase_file_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitLog_file_group(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitAdd_logfile_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitDrop_logfile_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitRegister_logfile_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitCreate_datafile_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function processEach(params, file, done) {\r\n console.log(\"Parsing file: \", file);\r\n parseUtils\r\n .parseFile(file)\r\n .then(function(parseResult) {\r\n // instrument the code.\r\n var result = instrument(parseResult.src, parseResult.ast, file);\r\n\r\n // write the modified code back to the original file.\r\n if (result != null) {\r\n fs.writeFileSync(file, result, \"utf8\");\r\n }\r\n\r\n // just return the block & function data.\r\n done(null);\r\n })\r\n .catch(function(e) {\r\n // don't kill the whole process.\r\n console.error(\"Problem instrumenting file. \", e, \" in file: \", file);\r\n done(null);\r\n })\r\n .done();\r\n}",
"visitImport_stmt(ctx) {\r\n console.log(\"visitImport_stmt\");\r\n if (ctx.import_name() !== null) {\r\n return this.visit(ctx.import_name());\r\n } else {\r\n return this.visit(ctx.import_from());\r\n }\r\n }",
"visitDatafile_tempfile_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitTablespace_logging_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitControlfile_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitOpen_statement(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function traceDepend(selectedAssetId, drawingController) {\n drawingController.resetDrawingHighlights();\n var dataSource = View.dataSources.get('traceDepend_ds');\n dataSource.clearParameters();\n dataSource.addParameter('eqDependId', selectedAssetId);\n var records = dataSource.getRecords();\n for (var i = 0; i < records.length; i++) {\n for (var levelIndex = 1; levelIndex < 10; levelIndex++) {\n var assetFrom = records[i].getValue('eq_system.level' + levelIndex);\n var assetTo = records[i].getValue('eq_system.level' + (levelIndex + 1));\n if (valueExistsNotEmpty(assetFrom) && valueExistsNotEmpty(assetTo)) {\n trace(assetFrom, assetTo, drawingController);\n }\n }\n }\n highlightAssetOnAction('trace', selectedAssetId, true, drawingController);\n if (!showMissingTraceAssets(drawingController)) {\n drawingController.svgControl.getAddOn('InfoWindow').setText(String.format(getMessage('afterTraceDepend'), selectedAssetId));\n }\n}",
"visitDatafile_specification(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"prettyPrintSql(file, connectionName) {\n console.log(this.logger.colors.gray(`------------- ${file.file.name} -------------`));\n console.log();\n file.queries.map((sql) => {\n prettyPrint_1.prettyPrint({\n connection: connectionName,\n sql: sql,\n ddl: true,\n method: utils_1.getDDLMethod(sql),\n bindings: [],\n });\n console.log();\n });\n console.log(this.logger.colors.gray('------------- END -------------'));\n }",
"visitFrom_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function parse_StatementList(){\n\t\n\n\t\n\n\tvar tempDesc = tokenstreamCOPY[parseCounter][0]; //check desc of token\n\tvar tempType = tokenstreamCOPY[parseCounter][1]; //check type of token\n\n\tif (tempDesc == ' print' || tempType == 'identifier' || tempType == 'type' || tempDesc == ' while' || tempDesc == ' if' || tempDesc == '{' ){ //if next token is a statment\n\t\tdocument.getElementById(\"tree\").value += \"PARSER: parse_StatementList()\" + '\\n';\n\t\tCSTREE.addNode('StatementList', 'branch');\n\t\t\n\t\t\n\t\tparse_Statement(); \n\t\n\t\tparse_StatementList();\n\t\t\n\t\tCSTREE.endChildren();\n\t\n\t\t\n\t\t\n\t}\n\telse{\n\t\t\n\t\t\n\t\t//e production\n\t}\n\n\n\n\n\t\n\t\n}",
"function logFileOp(message) {\n events.emit('verbose', ' ' + message);\n}",
"function getSourceFileOfNode(node) {\n while (node && node.kind !== ts.SyntaxKind.SourceFile) {\n node = node.parent;\n }\n return node;\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
extract the text information form the html, in the return, it will return a list containing each text chunk and its coordinate information. | function extractTextInfo(pageContent) {
text_block = pageContent;
text_info = [];
for (var i = 0; i < text_block.length; i++) {
//getting the text coordinate information
var res = text_block[i].split(";");
var coordinate_split_left = res[3].split(":");
var coordinate_split_top = res[4].split(":");
var coordinate_split_width = res[5].split(":");
var coordinate_split_height = res[6].split(":");
var left = coordinate_split_left[1];
var top = coordinate_split_top[1];
var width = coordinate_split_width[1];
var height = coordinate_split_height[1];
left = parseInt(left);
top = parseInt(top);
width = parseInt(width);
height = parseInt(height);
var single_coordinate = [left, top, width, height];
// getting the text field string, remove the html tag and other redundant information.
var sample = text_block[i];
var mark = 'font-size';
var res = '';
var index_start = sample.indexOf(mark);
var sub_sample = sample.substr(index_start);
indices = getIndicesOf(sub_sample,'font-size');
var result = "";
for (var l = 0; l < indices.length; l++) {
var index_start = indices[l];
var curr_sample = sub_sample.substr(index_start+16);
var index_start = curr_sample.indexOf('</span>');
if (index_start != -1) {
curr_sample = curr_sample.substring(0, index_start);
}
curr_sample = curr_sample.split("<br>").join("");
curr_sample = curr_sample.split("\n").join("");
result += curr_sample;
}
text_info.push([single_coordinate, result]);
}
return text_info;
} | [
"convertHtml(htmlText, lnMode) {\n const docDef = [];\n this.lineNumberingMode = lnMode || LineNumberingMode.None;\n // Cleanup of dirty html would happen here\n // Create a HTML DOM tree out of html string\n const parser = new DOMParser();\n const parsedHtml = parser.parseFromString(htmlText, 'text/html');\n // Since the spread operator did not work for HTMLCollection, use Array.from\n const htmlArray = Array.from(parsedHtml.body.childNodes);\n // Parse the children of the current HTML element\n for (const child of htmlArray) {\n const parsedElement = this.parseElement(child);\n docDef.push(parsedElement);\n }\n return docDef;\n }",
"function extractData(begin_line_index, end_line_index, filecontent) {\n\ttext = [];\n\tborder = [];\n\ttext_temp = [];\n\tborder_temp = [];\n\tvar i = parseInt(begin_line_index[0]);\n\n\t// Read each line in range, determine whether it stores text or border info and store\n\t// it respectively. \n\twhile (i <= parseInt(end_line_index[0])) {\n\n\t\tif (filecontent[i].indexOf('a name') != -1) {\n\t\t\ttext.push(text_temp);\n\t\t\tborder.push(border_temp);\n\t\t\ttext_temp = [];\n\t\t\tborder_temp = [];\n\t\t}\n\t\tif (filecontent[i].indexOf('textbox') != -1) {\n\t\t\ttext_temp.push(filecontent[i]);\n\t\t}\n\t\tif (filecontent[i].indexOf('border: black') != -1) {\n\t\t\tborder_temp.push(filecontent[i]);\n\t\t}\n\t\ti++;\n\t}\n\n\t// check if there are textboxes included in the last page \n\t// since above algorithm only run lines between two search \n\t// keywords. for the last page where end keyword resides, it\n\t// didn't run over the border information. Need to do a further\n\t// search over the ending line but stop before new page appears.\n\n\tif (text_temp.length != 0) {\n\t\twhile (filecontent[i].indexOf('a name') == -1) {\n\t\t\tif (filecontent[i].indexOf('border: black') != -1) {\n\t\t\t\tborder_temp.push(filecontent[i]);\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\ttext.push(text_temp);\n\t\tborder.push(border_temp);\n\t}\n\treturn [text, border];\n}",
"function extractContent(html) {\n\n var contentString = new DOMParser().parseFromString(html, \"text/html\").documentElement.textContent;\n var numb = contentString.match(/\\d/g);\n return numb.join(\"\");\n\n}",
"function parse(html, shouldSort) {\n var $ = cheerio.load(html);\n\n return $('page').map((idx, pageElem) => {\n var $page = $(pageElem);\n\n return new Page(\n $page.attr('width'), $page.attr('height'),\n $page.children('word').map((idx, wordElem) => {\n var $word = $(wordElem);\n\n return new Text(\n $word.attr('xmin'), $word.attr('xmax'),\n $word.attr('ymin'), $word.attr('ymax'), $word.text().trim()\n );\n }).get()\n );\n }).get();\n}",
"function getElements() {\n\n for(let i = 0; i < 6; i++) {\n var idxBeg = $(\"source\").value.indexOf(begSubstrings[i]);\n eoeElements[i] = $(\"source\").value.substring(idxBeg + begSubstrings[i].length - 1);\n var idxEnd = eoeElements[i].indexOf(\"</\");\n eoeElements[i] = eoeElements[i].substring(i,idxEnd);\n }\n\n //A little post-loop cleanup to catch irregularities in styling from page to page\n eoeElements[0] = eoeElements[0].substring(1,eoeElements[0].length)\n\n if(eoeElements[1].substring(0,7) == ` class=`) {\n eoeElements[1] = eoeElements[1].substring(19,eoeElements[1].length)\n }\n\n startOfLinkText = eoeElements[4].lastIndexOf(`>`) + 1\n eoeElements[4] = eoeElements[4].substring(startOfLinkText,eoeElements[4].length)\n\n endOfLink = eoeElements[3].indexOf('jcr:') -1\n eoeElements[3] = \"http://www.buffalo.edu/ubit/news/article.host.html/\" + eoeElements[3].substring(0, endOfLink) + \".detail.html\"\n\n endOfImageLink = eoeElements[5].indexOf(`\"`)\n eoeElements[5] = \"http://www.buffalo.edu/content/shared/www\" + eoeElements[5].substring(0,endOfImageLink)\n\n $(\"textArea\").innerHTML = \"<b>Title: </b>\" + eoeElements[0] +\n \"<br><b>Teaser: </b>\" + eoeElements[1] +\n \"<br><b>Link text: </b>\" + eoeElements[4] +\n \"<br><b>Link: </b>\" + eoeElements[3];\n\n $(\"image\").innerHTML = \"<img src='\" + eoeElements[5] + \"'></img>\"\n}",
"display_raw_text(div, raw_text, word_lists=[], colors=[], positions=false) {\n div.classed('lime', true).classed('text_div', true);\n div.append('h3').text('Text with highlighted words');\n let highlight_tag = 'span';\n let text_span = div.append('span').text(raw_text);\n let position_lists = word_lists;\n if (!positions) {\n position_lists = this.wordlists_to_positions(word_lists, raw_text);\n }\n let objects = []\n for (let i of range(position_lists.length)) {\n position_lists[i].map(x => objects.push({'label' : i, 'start': x[0], 'end': x[1]}));\n }\n objects = sortBy(objects, x=>x['start']);\n let node = text_span.node().childNodes[0];\n let subtract = 0;\n for (let obj of objects) {\n let word = raw_text.slice(obj.start, obj.end);\n let start = obj.start - subtract;\n let end = obj.end - subtract;\n let match = document.createElement(highlight_tag);\n match.appendChild(document.createTextNode(word));\n match.style.backgroundColor = colors[obj.label];\n try {\n let after = node.splitText(start);\n after.nodeValue = after.nodeValue.substring(word.length);\n node.parentNode.insertBefore(match, after);\n subtract += end;\n node = after;\n }\n catch (err){\n }\n }\n }",
"function getHtmlContent(){\n \n }",
"function readParagraphs() \n{\n if ((xhrContent.readyState === 4) && (xhrContent.status === 200)) \n {\n let MyContent = JSON.parse(xhrContent.responseText);\n let paragraphs = MyContent.paragraphs;\n paragraphs.forEach(function (paragraph) \n {\n let paragraphElements = document.getElementById(paragraph.id);\n //Searches element ids and aligns them with suitable paragraphs in the html\n if(paragraphElements) \n {\n paragraphElements.innerHTML = paragraph.content;\n } \n }, this);\n }\n}",
"function analyzeContentParts(cp) {\n let input = ''\n let images = []\n for (let i = 0, len = cp.length; i < len; i++) {\n if (i === 0) {\n input = getTextFromHTML(cp[i].content)\n } else {\n images.push(getTextFromHTML(cp[i].content))\n }\n }\n return {\n input,\n images\n }\n}",
"function parse_editor(values_with_html){\t\t\n\t\tvalues_with_html=values_with_html.replace(/(<([^>]+)>)/ig,' ');\n\t\tvalues_with_html=values_with_html.replace(/( ){1,}/ig,' ');\n\t\tvalues_with_html=values_with_html.trim();\n\t\tvar values_with_spaces=values_with_html.replace(/\\s{2,}/g, ' ');\n\t\tvar array_of_numbers = values_with_spaces.split(' ');\t\n\t\treturn array_of_numbers;\n\t}",
"function processResponse(str) {\n\tvar data = JSON.parse(str);\n\t\n\t\n\t// We only use this portion of the return from google\n\t// Need to figure out how to tell google to not send us the \n\t// rest of it\n\tvar textAnnotations = data.responses[0].textAnnotations;\n\n\tvar imageTopY = textAnnotations[0].boundingPoly.vertices[0].y;\n\n\tvar imageBottomY = textAnnotations[0].boundingPoly.vertices[2].y;\n\tvar imageLeftX = textAnnotations[0].boundingPoly.vertices[0].x;\n\tvar imageRightX = textAnnotations[0].boundingPoly.vertices[2].x;\n\n\tvar imageWidth = imageRightX - imageLeftX;\n\tvar imageHeight = imageBottomY - imageTopY;\n\n\tvar arrayOfLines = new Array();\n\n\t// Skip the first block (was for the entire image)\n\t// Make the Image();\n\tvar previousMidY;\n\tvar bufferWidth;\n\tvar currLine = new Array(); // Array of Block objects, not a Line object\n\tvar lineList = new Array();\n\n\tfor (var i = 1; i < textAnnotations.length; i++) {\n\t\tlet unprocessedBlock = textAnnotations[i];\n\t\tlet currString = unprocessedBlock.description;\n\t\tlet blockTopY = unprocessedBlock.boundingPoly.vertices[0].y;\n\t\tlet blockLeftX = unprocessedBlock.boundingPoly.vertices[0].x;\n\t\tlet blockRightX = unprocessedBlock.boundingPoly.vertices[2].x;\n\t\tlet blockBottomY = unprocessedBlock.boundingPoly.vertices[2].y;\n\n\t\t// Averages\n\t\tlet blockMidX = (blockLeftX + blockRightX) / 2;\n\t\tlet blockMidY = (blockTopY + blockBottomY) / 2;\n\n\t\t// W&H\n\t\tlet blockWidth = blockRightX - blockLeftX;\n\t\tlet blockHeight = blockBottomY - blockTopY;\n\n\t\tvar block = new Block(currString, blockMidX, blockMidY, blockTopY, blockBottomY, blockLeftX, blockRightX, blockWidth, blockHeight);\n\n\t\t// Just starting out\n\t\tif (previousMidY == undefined) {\n\t\t\tcurrLine.push(block);\n\t\t\tpreviousMidY = blockMidY;\n\t\t\tbufferWidth = blockHeight / 2;\n\t\t} else {\n\t\t\t// Add current Line to lineList if that Line is finished, and make a new Line with the current Block\n\t\t\t// Otherwise, add the current Block to the lineList\n\t\t\t// console.log(currString + \" => block.MidY: \" + blockMidY + \", previousMidY: \" + previousMidY + \", bufferWidth: \" + bufferWidth);\n\t\t\tif (blockMidY < previousMidY + bufferWidth && blockMidY > previousMidY - bufferWidth ) {\n\t\t\t\t// line is not finished\n\t\t\t\tcurrLine.push(block);\n\t\t\t\tpreviousMidY = blockMidY;\n\t\t\t\tbufferWidth = blockHeight / 2;\n\t\t\t} else {\n\t\t\t\t// Line is finished\n\n\t\t\t\tvar completedLine = new Line(sortBlocksBasedOnX(currLine));\n\t\t\t\tlineList.push(completedLine);\n\t\t\t\tcurrLine = new Array();\n\t\t\t\tcurrLine.push(block);\n\t\t\t\tpreviousMidY = blockMidY;\n\t\t\t\tbufferWidth = blockHeight / 2;\n\t\t\t}\n\t\t}\n\t}\n\n\tvar image = new Image(lineList, imageTopY, imageBottomY, imageLeftX, imageRightX);\n\tconsole.log(\"############ MADE IMAGE ###############\");\n\tconsole.log(image.toString());\n\tconsole.log(\"############ DONE IMAGE ###############\");\n\n\tvar returnString = processImageByStoreName(image);\n\n\tdebug(\"Done processing\");\n\tconsole.log(returnString);\n}",
"function extractSentences(raw) {\n return $.map(raw[0], (function(v) { return v[0]; })).join('');\n}",
"function parseText(header, section) {\r\n let textArray = [];\r\n let indexArray = [];\r\n //get indexes of text breaks into sections based on header\r\n for (let i = 0; i < section.text.length; i++) {\r\n if (section.text.substr(i, header.length) == header && section.text.charAt(i + header.length) != \"#\" && section.text.charAt(i - 1) != \"#\" ) {\r\n indexArray.push(i);\r\n }\r\n }\r\n //get name if there is one after the header, break text, push into array\r\n for (let i = 0; i < indexArray.length; i++) {\r\n let pos = indexArray[i] + header.length;\r\n let name = \"\";\r\n for (let j = pos; j < section.text.length; j++) {\r\n if (section.text.charAt(j) == \"\\n\") {\r\n break;\r\n }\r\n name += section.text.charAt(j);\r\n }\r\n let end = 0;\r\n if (i == indexArray.length - 1) {\r\n end = section.text.length;\r\n } else {\r\n end = indexArray[i + 1];\r\n }\r\n textArray.push({\"name\": name, \"text\": section.text.substring(pos, end)});\r\n }\r\n\r\n if (textArray.length > 0) {\r\n for (let i = 0; i < textArray.length; i++) {\r\n section.sections.push({\r\n \"name\": textArray[i].name,\r\n \"id\": section.id + \".\" + i,\r\n \"text\": textArray[i].text,\r\n \"sections\": [],\r\n \"level\": section.level + 1,\r\n \"header\": header + \"#\",\r\n \"data\": {\r\n \"annotations\": [],\r\n /*\r\n {\r\n \"text\"\r\n \"start\"\r\n \"end\"\r\n }\r\n */\r\n \"highlights\": [],\r\n /*\r\n {\r\n \"key\"\r\n \"text\"\r\n \"start\"\r\n \"end\"\r\n }\r\n */\r\n \"topics\": []\r\n /*\r\n {\r\n \"key\"\r\n \"text\"\r\n \"start\"\r\n \"end\"\r\n }\r\n */\r\n }\r\n });\r\n }\r\n //recursively call on each section\r\n for (let i = 0; i < section.sections.length; i++) {\r\n parseText(section.sections[i].header, section.sections[i]);\r\n }\r\n }\r\n\r\n}",
"function textArea(){\r\n\tvar text = document.getElementById(\"info\").value;\r\n\tvar splitValue = [];\r\n\tsplitValue = text.split(\"\\n\");\r\n\timportLatLng(splitValue);\r\n}",
"function extUtils_getOffsetsAfterCheckingForBodySelection(allText,currOffs)\n{\n var offsets = currOffs;\n var selStr = allText.substring(offsets[0],offsets[1]);\n var newStartOff = currOffs[0];\n var newEndOff = currOffs[1];\n var openBracketInd,closeBracketInd,nOpenBrackets,nCloseBrackets;\n var ind;\n\n if ( selStr.indexOf(\"<BODY\") == 0 || selStr.indexOf(\"<body\") == 0 ){\n nOpenBrackets = 1;\n nCloseBrackets = 0;\n closeBracketInd = 0; // index of closing bracket of </body>\n ind=1;\n\n while ( !closeBracketInd && selStr.charAt(ind) ) {\n if ( selStr.charAt(ind) == \"<\" ){\n nOpenBrackets++;\n } else if (selStr.charAt(ind) == \">\" ){\n nCloseBrackets++;\n if( nOpenBrackets == nCloseBrackets ){\n closeBracketInd = ind;\n }\n }\n ind++;\n }\n\n // get first non-newline character inside of the body tag\n newStartOff = closeBracketInd + 1;\n while ( selStr.charAt(newStartOff) == \"\\n\" ||\n selStr.charAt(newStartOff) == \"\\r\" ) {\n newStartOff++;\n }\n\n // get last non-newline character inside of the body tag\n openBracketInd = selStr.lastIndexOf(\"<\"); // open bracket index of </body>\n newEndOff = openBracketInd - 1;\n while ( selStr.charAt(newEndOff) == \"\\n\" ||\n selStr.charAt(newEndOff) == \"\\r\" ) {\n newEndOff--;\n }\n\n // add 1 because selection actually goes to newEndOff minus one\n newEndOff++;\n\n newStartOff += currOffs[0];\n newEndOff += currOffs[0];\n }\n\n return new Array(newStartOff,newEndOff);\n}",
"getElements(display) {\n const lines = display.textContent.split('\\n');\n for(let i = 0; i < this[ELEMENTS].length; ++i) {\n const el = this[ELEMENTS][i];\n el.textContent = lines[this[REGION][1] + i].substr(this[REGION][0], this[REGION][2]);\n }\n const lineLength = lines[0].length;\n return this[ELEMENTS].map((e, i) => [this[REGION][0] + (this[REGION][1] + i) * (lineLength + 1), e]);\n }",
"function splitParagraph(text){\n\n\tvar fragments = [];\n\n\twhile( text != ''){\n\t\tif (text.charAt(0) == \"*\"){\n\t\t\tfragments.push({type: 'emphasized',\n\t\t\t\t\t\t\t\t\t\t\tcontent: text.slice(1,takeUpTo('*',text))});\n\t\t\t//modify text so we remove the string we just stored\n\t\t\t//we add 1 because we want to remove the string added\n\t\t\t//PLUS the character at the end which may be } or *\n\t\t\ttext = text.slice(takeUpTo('*',text)+1);\n\t\t} else if (text.charAt(0) == \"{\"){\n\t\t\tfragments.push({type: 'footnote',\n\t\t\t\t\t\t\t\t\t\t\tcontent: text.slice(1,takeUpTo('}',text))});\n\t\t\t//modify text so we remove the string we just stored\n\t\t\ttext = text.slice(takeUpTo('}',text)+1);\n\t\t} else {\n\t\t\tfragments.push({type: 'normal',\n\t\t\t\t\t\t\t\t\t\t\tcontent: text.slice(0,takeNormal(text))});\n\t\t\t//modify text so we remove the string we just stored\n\t\t\ttext = text.slice(takeNormal(text));\n\t\t}\n\t}\n\n\treturn fragments;\n}",
"function parseRecipieContent(recipieText) {\n return parseRecipie(JSON.parse(recipieText));\n}",
"parse(text,context){\n\t\tconst title=context.title||\"\",s1=new Section(1,[new Text(title)]),\n\t\t\tarticle=new Article(title,[s1]),tl=text.length;\n\t\t\n\t\tcontext=context||{};\n\t\tcontext.self_close=context.self_close||(()=>false);\n\t\t\n\t\tthis.pos=0;\n\t\tthis.cur=article.subsections[0];\n\t\tthis.path=[];\n\t\t\n\t\twhile(this.pos<tl){\n\t\t\tlet x;\n\t\t\twhile(\n\t\t\t\t!(x=this.parse_start(text,context)) ||\n\t\t\t\tthis.parse_header(text)\n\t\t\t){\n\t\t\t\tthis.cur.paragraphs.push(x);\n\t\t\t}\n\t\t\t\n\t\t\tx=this.parse_rest(text,context);\n\t\t\tif(x){\n\t\t\t\tthis.cur.paragraphs.push(new Paragraph(x));\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn article;\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Progression 3 Filter players that debuted in ___ year | function filterByDebut (year) {
let arr = []
for (const i of players)
{
if (i.debut == year)
{
arr.push(i)
}
}
return arr
} | [
"function filterYear(data) {\n let filteredData = data.filter(function(d, i) {\n return data[i].year === \"1980\";\n });\n data = filteredData;\n return data;\n }",
"function filterByNoOfAwardsxTeamxAge(awardwontimes, teamname, ageofplayer) {\n let list = [];\n players.filter(details => {\n if (details.team === teamname && details.age < ageofplayer && details.awards.length >= awardwontimes) {\n list.push(details);\n }\n });\n return list;\n}",
"function filter_movies_year(search, movieList){\r\n let filtered = [];\r\n\r\n for(let movieId in movieList){\r\n let currRelease = movieList[movieId].released.toUpperCase();\r\n let currYear = currRelease.substr(currRelease.length-4);\r\n let newSearch = search.toUpperCase();\r\n\r\n //console.log(currTitle);\r\n if(currYear == newSearch){\r\n filtered.push(movieList[movieId]);\r\n }\r\n }\r\n // console.log(filtered)\r\n return filtered;\r\n}",
"function optionChanged(newYear) {\n yearFilter.push(newYear)\n var filterLength = yearFilter.length\n if (filterLength >= 2) {\n yearFilter.shift();\n }\n buildCharts(yearFilter, dataFilter, baseFilter, regionFilter);\n secondChart(yearFilter, dataFilter, baseFilter, regionFilter, compareFilter);\n thirdChart(yearFilter, dataFilter, baseFilter, regionFilter);\n }",
"function filterByAwardxTimes(awardwon, times) {\n let count = 0;\n let list = [];\n players.filter(details => {\n details.awards.forEach(val => {\n if (val.name === awardwon) {\n count += 1;\n }\n if (count === times) {\n list.push(details);\n count = 0;\n }\n });\n count = 0;\n });\n return list;\n}",
"listYearly() {\n const tenYearBefore = dateService.getYearsBefore(10);\n return this.trafficRepository.getYearlyData(tenYearBefore)\n .then(data => {\n data = this.mapRepositoryData(data);\n const range = numberService.getSequentialRange(tenYearBefore.getFullYear(), 10);\n const valuesToAdd = range.filter(x => !data.find(item => item.group === x));\n return data.concat(this.mapEmptyEntries(valuesToAdd));\n });\n }",
"function getPublicationsListFromFilters()\n\t {\n\t\t var filteredPublicationsArray = [];\n\n\t\t for (var i=0; i<publicationsArray.length; i++)\n\t\t {\n\t\t\t var publicationSufficesAllFilters = true;\n\t\t\t\tvar content;\n\n\t\t \t// Checking the Time filter.\n\t\t\t\tcontent = $(TIME_FILTER_SELECTION_CLASS_ID).html();\n\t\t\t\tif (content.indexOf(ALL_TIME_TEXT) === -1)\n\t\t\t\t{\n\t\t\t\t\t// Cleaning content.\n\t\t\t\t\tcontent = content.replace('TIME:', '');\n\t\t\t\t\tcontent = content.replace('<span class=\"caret\"></span>', '');\n\t\t\t\t\tcontent = content.replace(/ /gi, '');\n\t\t\t\t\tcontent = content.replace('<', '< ');\n\n\t\t\t\t\tif (content.localeCompare(OLDER_TEXT) === 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor (var k=0; k<yearsArray.length && k<NUMBER_OF_TIMES_IN_FILTER; k++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (publicationsArray[i].year == yearsArray[k])\n\t\t\t\t\t\t\t\tpublicationSufficesAllFilters = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if ((publicationsArray[i].year + \"\").indexOf(content) === -1)\n\t\t\t\t\t\tpublicationSufficesAllFilters = false;\n\t\t\t\t}\n\n\t\t \t// Checking the Authors filter.\n\t\t\t\tcontent = $(AUTHOR_FILTER_SELECTION_CLASS_ID).html();\n\t\t\t\tif (content.indexOf(ALL_AUTHORS_TEXT) === -1 &&\n\t\t\t\t\t publicationSufficesAllFilters)\n\t\t\t\t{\n\t\t\t\t\t// Cleaning content.\n\t\t\t\t\tcontent = content.replace('AUTHOR:', '');\n\t\t\t\t\tcontent = content.replace('<span class=\"caret\"></span>', '');\n\t\t\t\t\tcontent = content.replace(/ /gi, '');\n\n\t\t\t\t\tif (publicationsArray[i].author.toUpperCase().indexOf(content) === -1)\n\t\t\t\t\t\tpublicationSufficesAllFilters = false;\n\t\t\t\t}\n\n\t\t\t\t// Checking if publication suffices the search text.\n\t\t\t\tif (publicationSufficesAllFilters)\n\t\t\t\t{\n\t\t\t\t\t\tvar searchValue = $(SEARCH_TEXT_FIELD_CLASS_ID).val();\n\n\t\t\t\t\t\tif (searchValue.length > 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvar regExp = new RegExp(searchValue + \"+\", \"i\");\n\t\t\t\t\t\t\t\tpublicationSufficesAllFilters = regExp.test(publicationsArray[i].booktitle) || regExp.test(publicationsArray[i].author) || regExp.test(publicationsArray[i].year);\n\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Adding filtered publication to the array of publications to be shown to the user.\n\t\t\t\tif (publicationSufficesAllFilters)\n\t\t\t\t\tfilteredPublicationsArray.push(publicationsArray[i]);\n\t\t }\n\n\t\t // Cleaning content.\n\t\t content = $(SORTBY_FILTER_SELECTION_CLASS_ID).html();\n\t\t content = content.replace('<span class=\"caret\"></span>', '');\n\t\t content = content.replace(/ /gi, '');\n\n\t\t // Checking the SortBy filter.\n\t\t if (content.length !== 0)\n\t\t {\n\t\t\t if (content.indexOf(SORT_BY_MOST_RECENT_TEXT) !== -1)\n\t\t\t\t {\n\t\t\t\t\t \tfilteredPublicationsArray.sort(function(a, b) {return b.year - a.year});;\n\t\t\t\t }\n\t\t\t else if (content.indexOf(SORT_BY_OLDEST_TEXT) !== -1)\n\t\t\t\t {\n\t\t\t\t\t \tfilteredPublicationsArray.sort(function(a, b) {return a.year - b.year});;\n\t\t\t\t }\n\t\t }\n\n\t \t\treturn filteredPublicationsArray;\n\t }",
"function FilterByTeamxSortByNoOfAwards() {\n let arr=[]; let noofawards=[];\n for(var i=0;i<=players.length;i++)\n {\n noofawards[i]=players[i].awards.length;\n players[i].push({\"noOfAwards\":noofawards[i]});\n }\n for(var i=0;i<=players.length;i++)\n { \n if(players[i].team==team)\n for(var j=i+1;j<=players.length;j++)\n {\n if(players[i].noOfAwards<players[j].noOfAwards)\n {\n arr[i]=players[i];\n players[i]=players[j];\n players[j]=arr[i];\n }\n arr.push(players[i]);\n }\n }\n return arr;\n}",
"function filterByPlayer() {\n const nameFilterValue = getById('filter-bar').value;\n if (nameFilterValue) {\n fetch(`${server}?action=filter&name=${nameFilterValue}`, {\n headers: {\n 'Accept': 'application/json'\n },\n mode: \"no-cors\"\n })\n .then(response => response.json())\n .then(data => insertNewDataIntoTable(data));\n } else {\n loadGameData();\n }\n}",
"function filter(players, fn) {\n let arr = [];\n for (var i in players) {\n if (fn(players[i])) {\n arr.push(players[i]);\n }\n }\n return arr;\n}",
"bornInThe70() {\n let content = this.title(\"Entrepreneurs né dans les 70's \") +\n this.people\n .filter(person => /^197\\d$/.test(String(person.year)))\n .map(person => this.line(`${person.first} ${person.last}, année de naissance : ${person.year}`))\n .join(\"\")\n\n return content + \"</p>\"\n }",
"function getYears(getFinals) {\n return getFinals(fifaData).map(function(data){\n return data[\"Year\"];\n });\n\n}",
"function sortFilterArrays()\n\t {\n\t\t \tyearsArray.sort(function(a, b) {return b - a});\n\t \t\tauthorsArray.sort(function(a, b) {return b[1] - a[1]});\n\n\t\t\tif (NUMBER_OF_TIMES_IN_FILTER <= yearsArray.length)\n\t\t\t\tOLDER_TEXT = \"< \" + yearsArray[NUMBER_OF_TIMES_IN_FILTER - 1]\n\t }",
"function showFrcTeamsByYear(frcInfo, currentYear, visible) {\n\n if ( visible == false ) {\n // if told to hide teams, just hide all the teams regardless of year\n showFrcTeams(frcInfo, false);\n } else {\n\n // otherwise, show all the teams that are competing this year\n\n // display all the teams that have started competing this year\n var teams = frcInfo.getTeamListByYear(currentYear);\n for ( var i=0; i<teams.length; i++ ) {\n teamInfo = frcInfo.getTeam(teams[i]);\n if ( teamInfo.marker )\n teamInfo.marker.setVisible(true);\n }\n\n // and hide any teams that stopped competing this year, do this by looking up the\n // list of teams that competed for the last time in the previous year\n if ( currentYear > frcInfo.firstYear ) {\n teams = frcInfo.getTeamEndListByYear(currentYear-1);\n for ( var i=0; i<teams.length; i++ ) {\n teamInfo = frcInfo.getTeam(teams[i]);\n if ( teamInfo.marker )\n teamInfo.marker.setVisible(false);\n }\n }\n }\n}",
"function filterBySeason(seasonNum, data) {\n // making sure that it is an int to compare\n seasonNum = parseInt(seasonNum, 10)\n return data.filter((current) => current.season == seasonNum)\n}",
"getWeightsYear(){\n let temp = [];\n let today = new Date();\n let progress = 0;\n for(var i=0; i< this.weightLog.length; i++){\n let then= this.weightLog[i].date;\n if(then.getFullYear() == today.getFullYear()){\n temp.push(this.weightLog[i]);\n }\n }\n if(temp.length >= 2){\n progress = temp[temp.length - 1].weight - temp[0].weight;\n }\n return {weights: temp, progress: progress}; \n }",
"function yearPercentagesRekenen(){\n YearPercentageGewerkteUren = YearGewerktUren/YearTotaalUren;\n YearPercentageOver100Uren = YearOver100Uren/YearTotaalUren;\n YearPercentageOver125Uren = YearOver125Uren/YearTotaalUren;\n YearPercentageVerlofUren = YearVerlofUren/YearTotaalUren;\n YearPercentageZiekteUren = YearZiekteUren/YearTotaalUren;\n\n \n}",
"function getYears(cbFinals) {\n const finalYears = [];\n const years = cbFinals(fifaData).map(function(element){\n finalYears.push(element.Year);\n })\n return finalYears;\n}",
"function filterByAwardxCountry(awardwon, countryname) {\n let list = [];\n players.filter(details => {\n details.awards.forEach(val => {\n if (val.name === awardwon && details.country === countryname) {\n list.push(details);\n }\n });\n });\n return list;\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The number of cells in a given ring in a radial layout | function getNumCellsinRing(ringNumber) {
if(ringNumber === 0) {
return 1;
} else if(ringNumber === 1) {
return 6;
}
return getNumCellsinRing(ringNumber - 1) + 6;
} | [
"function getTotalCellsInRadialLayout(numRings) {\n let total = 0;\n let currRing = 0;\n do {\n total += getNumCellsinRing(currRing);\n currRing++;\n } while(currRing < numRings);\n return total;\n }",
"static countCells(prop) {\n let n = prop.range;\n n = (n & 0x15555)+(n>>1 & 0x15555);\n n = (n & 0x3333) +(n>>2 & 0x3333);\n n = (n & 0xf0f) +(n>>4 & 0xf0f);\n return (n & 0xff)+(n>>8 & 0xff);\n }",
"function howManyStickers(n) {\n\treturn 6 * n * n;\n}",
"gridCellSize() {\n return (gridCellSizePercent * canvasWidth) / 100;\n }",
"nTiles(params) {\n return Object.keys(params.style.sources).map(source => {\n return getTiles(params.bounds, params.minZoom, ((params.style.sources[source].tileSize < 512) ? (params.maxZoom + 1) : params.maxZoom)).length\n }).reduce((a, b) => { return a + b }, 0)\n }",
"function setMinesNegsCount(board) {\r\n var currSize = gLevels[gChosenLevelIdx].SIZE;\r\n for (var i = 0; i < currSize; i++) {\r\n for (var j = 0; j < currSize; j++) {\r\n var cell = board[i][j];\r\n var count = calculateNegs(board, i, j)\r\n cell.minesAroundCount = count;\r\n }\r\n }\r\n\r\n\r\n}",
"function getCellsInRadius(cell, radius, resolution) {\n let centerCell;\n\n if (!resolution) {\n // Transform passed cell to default resolution\n centerCell = transformCellToResolution(cell, DEFAULT_RESOLUTION);\n } else {\n // Transform passed cell to passed resolution\n centerCell = transformCellToResolution(cell, resolution);\n }\n\n const edges = h3.getH3UnidirectionalEdgesFromHexagon(centerCell);\n const totalEdgeLength = edges\n .map((edge) => h3js.exactEdgeLength(edge, 'm')) // Method not in h3-node\n .reduce((totalLength, edgeLength) => {\n return new Decimal(totalLength).add(edgeLength);\n });\n const centerCellRadius = totalEdgeLength.div(edges.length);\n\n if (centerCellRadius.greaterThan(radius)) {\n throw new RadiusError();\n }\n\n const ringSize = new Decimal(radius)\n .div(centerCellRadius)\n .ceil()\n .toNumber();\n\n return h3.kRing(centerCell, ringSize);\n}",
"function determineDiameter() {\n var height = square_div_array[0].clientHeight;\n var width = square_div_array[0].clientWidth;\n // how to return most correct size circle?\n return (lessThan(height, width)-5)+'px';\n}",
"function snail(column, day, night) {\n let result = 0;\n let i = 0;\n\n while (result < column) {\n result = result + day;\n if (result < column) {\n result = result - night;\n }\n i++;\n }\n return i;\n}",
"function countStars() {\n return starsContainer.childNodes.length;\n}",
"function perimeter(n) {\n let total = 0;\n let first = 1;\n let second = 1;\n let third;\n for (let i = 0; i <= n; i++) {\n third = first + second;\n total += first;\n\n first = second;\n second = third;\n \n }\n return (total) * 4;\n}",
"function memoryGetCardCountWidth(pairCount) {\n var cardCount = pairCount * 2;\n var temp = Math.round(Math.sqrt(cardCount));\n var found = ((cardCount % temp) == 0);\n \n var down = temp - 1;\n var up = temp + 1;\n \n while (!found) {\n if ((cardCount % up) == 0)\n temp = up;\n else if ((cardCount % down) == 0)\n temp = down;\n \n up--;\n down--;\n \n found = ((cardCount % temp) == 0);\n }\n\n return temp;\n}",
"function getSizes(nodes) {\n return nodes.map(function (layer) {\n return layer.length;\n })\n }",
"function calcNumRows(){\n \tvar map = document.getElementById('map');\n \tif(map != null){\n \t\tvar height = map.naturalHeight; //calculate the height of the map\n \t\n \t//height -= 16;\n \theight = height / 16;\n \tvar temp = [];\n \t\n \tfor(var i = 0; i < height; i++)\n \t\ttemp.push(i+1);\n \t\n \tif(temp.length != 0){\n \t\t$interval.cancel(rowTimer); //cancel $interval timer\n \t\t$scope.rows = temp;\n \t}\n \t}\n }",
"function weightCells(grid, row, col) {\n var cellWeight;\n\n\n if (grid[row][col].state == 1) {\n cellWeight = 2000;\n return cellWeight;\n }\n\n if(row == 0 || col == 0 || row == Constants.numberOfRows - 1 ||\n col == Constants.numberOfColumns - 1) {\n cellWeight = 0;\n return cellWeight;\n }\nif(row < Constants.numberOfRows/2) {\n rowDistance = row * 2;\n }\n else {\n rowDistance = (Constants.numberOfRows - row) * 2;\n }\n if(col < Constants.numberOfColumns/2) {\n colDistance = col * 2;\n }\n else {\n colDistance = (Constants.numberOfColumns - col) * 2;\n }\n return countLiveNeighbors(grid, row, col) + rowDistance + colDistance;\n}",
"function getSizes() {\n\n //if height is greater than width, count to height\n if (height > width) {\n for (let i = 0; i <= height; i++) {\n if (height % i === 0 && width % i === 0) {\n sizeArray.push(i);\n }\n }\n }\n\n //if width is greater than height, count to width\n if (height < width) {\n for (let i = 0; i <= width; i++) {\n if (height % i === 0 && width % i === 0) {\n sizeArray.push(i);\n }\n }\n }\n print(sizeArray);\n}",
"getNbBlockOfColor(researchedColor) {\n var nbBlocksFound = 0;\n // for each row on the map\n this._map.forEach((row) => {\n // For each block on the row\n row.forEach((block) => {\n if (block == researchedColor)\n nbBlocksFound++;\n });\n });\n return (nbBlocksFound);\n }",
"rowhSize() {\n return this.nodes.rowHolder.childElementCount - (this.displayedInfo.renderedEndRow !== null ? 1 : 0);\n }",
"function calculateNumColors(level) {\n return level * 3;\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a binary tree, how do you get its mirrored tree? | function mirror(node) {
if(!node){
return ;
}
let root = node;
let temp = root.left;
root.left = root.right;
root.right = temp;
mirror(node.left);
mirror(node.right);
} | [
"function reconstruct(preorder, inorder) {\n const preorderLength = preorder.length;\n const inorderLength = inorder.length;\n if (preorderLength === 0 && inorderLength === 0) {\n return null;\n }\n\n if (preorderLength === 1 && inorderLength === 1) {\n return new Node(preorder[0]);\n }\n\n const root = new Node(preorder[0]);\n const root_i = inorder.findIndex(elem => elem === root.data);\n root.left = reconstruct(preorder.slice(1, (1 + root_i)), inorder.slice(0, root_i));\n root.right = reconstruct(preorder.slice(1 + root_i), inorder.slice(root_i + 1));\n return root;\n}",
"promote (node) {\r\n if (!node) {\r\n return\r\n }\r\n\r\n const parent = node.parent\r\n\r\n if (!parent) {\r\n return\r\n }\r\n\r\n const grandparent = parent.parent\r\n\r\n // set the node to the proper grandparent side\r\n if (grandparent && parent === grandparent.left) {\r\n grandparent.left = node\r\n } else if (grandparent) {\r\n grandparent.right = node\r\n } else {\r\n this.root = node\r\n }\r\n node.parent = grandparent\r\n\r\n if (parent.left === node) {\r\n parent.left = null\r\n } else {\r\n parent.right = null\r\n }\r\n\r\n parent.parent = null\r\n\r\n // parent would still have the leftover subtree of the side that did not get promoted\r\n return parent\r\n }",
"function rotate (x) {\n let p = x.parent;\n let g = p.parent;\n let isRootP = isRoot(p);\n let leftChildX = (x === p.right);\n\n connect(leftChildX ? x.left : x.right, p, leftChildX);\n connect(p, x, !leftChildX);\n\n if (!isRootP) connect(x, g, p == g.right);\n else x.parent = g;\n}",
"function adjustTree(indexMapLeft,root){\n if(root.hasOwnProperty('children')){\n //console.log(root.data.name)\n var cL=root.children[0];\n var cR=root.children[1];\n //console.log(leavesL,leavesR)\n //console.log(bias0,bias1)\n\n var cross_result=optimizationFun_cross(cL,cR,indexMapLeft);\n if (cross_result<0){\n swapChildren(root);\n }\n else if(cross_result==0){\n if(optimizationFun_order(cL,cR,indexMapLeft)<0)\n swapChildren(root);\n }\n\n adjustTree(indexMapLeft,cL);\n adjustTree(indexMapLeft,cR);\n }\n }",
"tree(tree) {\n if (tree) {\n this._tree = tree;\n }\n return this._tree;\n }",
"function buildBalancedTree(array) {\n if (array.length == 0) { return null; }\n\n var mid = Math.floor((array.length)/2);\n var n = new treeNode(null, array[mid], null);\n\n var arrayOnLeft = array.slice(0, mid);\n n.left = buildBalancedTree(arrayOnLeft);\n\n var arrayOnRight= array.slice(mid+1);\n n.right = buildBalancedTree(arrayOnRight);\n\n return n;\n }",
"function swapChildren(root){\n var cR=root.children[0];\n var cL=root.children[1];\n root.children[0]=cL\n root.children[1]=cR;\n increaseSequence(cL,-cR.value);\n increaseSequence(cR,cL.value);\n }",
"constructor(value){\n this.value = value;\n this.left = null;\n this.right = null;\n }",
"function preorder(root){\n if(root===null) return;\n root.draw();\n preorder(root.lchild);\n preorder(root.rchild);\n}",
"function traverseDeserialize(data) {\n if(index > data.length || data[index] === \"#\") {\n return null;\n }\n var node = new TreeNode(parseInt(data[index]));\n index++;\n node.left = traverseDeserialize(data);\n index++;\n node.right = traverseDeserialize(data);\n return node;\n }",
"function mirror(arr) {\n\tconst a = arr;\n\tfor (let i = arr.length - 2; i >= 0; i--) {\n\t\ta.push(arr[i]);\n\t}\n\treturn a;\n}",
"mirror(v) {\n return v.translate(v.split(this).perp.scale(2).inv);\n }",
"get tree() {\n return this.buffer ? null : this._tree._tree\n }",
"rightAncestor (node) {\r\n let parent = node.parent\r\n let currNode = node\r\n while (parent && parent.key < currNode.key) {\r\n parent = parent.parent\r\n currNode = currNode.parent\r\n }\r\n return parent\r\n }",
"function pruneBackToLevel1OutboundOnly() {\n// currentTopLevel = 1;\n var rootObjectId = objectId;\n var rootNode = nodes.get(rootObjectId);\n var nodesToKeep = [];\n var linksToDelete = [];\n \n nodesToKeep.push(rootNode);\n \n var linkIds = edges.getIds();\n \n for (var i = 0; i < linkIds.length; i++) {\n var linkId = linkIds[i];\n var link = edges.get(linkId);\n if (link.from === rootObjectId) {\n var nodeToKeep = nodes.get(link.to);\n nodesToKeep.push(nodeToKeep);\n } else {\n linksToDelete.push(link);\n }\n }\n \n var nodesToDelete = [];\n \n var nodeIds = nodes.getIds();\n for (var n = 0; n < nodeIds.length; n++) {\n var nodeId = nodeIds[n];\n var node = nodes.get(nodeId);\n if (!isKeepNode(node, nodesToKeep)) {\n nodesToDelete.push(node);\n }\n }\n \n removeNodes(nodesToDelete);\n removeLinks(linksToDelete); \n }",
"previous() {\n let tmp = this.currentNode.previous();\n if (!tmp.done) {\n this.currentNode = tmp.value;\n this.currentNode.clearChildren();\n //this.currentNode.children.forEach((child) => child.clearChildren());\n console.log(\" ================ PREV ================ \");\n this.ptree();\n }\n return tmp;\n }",
"function copyNodeWithoutNeighbors(node) {\n // commonmark uses classes so it takes a bit of work to copy them\n const copy = new Node();\n\n for (const key in node) {\n if (!node.hasOwnProperty(key)) {\n continue;\n }\n\n copy[key] = node[key];\n }\n\n copy._parent = null;\n copy._firstChild = null;\n copy._lastChild = null;\n copy._prev = null;\n copy._next = null;\n\n // Deep copy list data since it's an object\n copy._listData = {...node._listData};\n\n return copy;\n}",
"function create_right_sibling(node)\n{\n if (node === null) \n {\n return;\n }\n \n var numberOfChildren = node.children.length;\n \n var queue = [];\n for (var i=0; i < numberOfChildren ; i++)\n {\n if (node.children[i].right === null && node.children[i+1])\n {\n node.children[i].right = node.children[i+1];\n queue.push(node.children[i]);\n }\n }\n \n for (var j=0; j < queue.length; j++)\n {\n create_right_sibling(queue[j]); \n }\n}",
"traverseLevelOrder() {\n const root = this._root;\n const queue = [];\n\n if (!root) {\n return;\n }\n queue.push(root);\n\n while (queue.length) {\n const temp = queue.shift();\n console.log(temp.value);\n if (temp.left) {\n queue.push(temp.left);\n }\n if (temp.right) {\n queue.push(temp.right);\n }\n }\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
===================== DEFINITION OF CLASSES ===================== Purpose: Contains a list of Riddles and their answers | function Riddles()
{
//Private member variables
var riddle = [];
var answer = [];
//Sets content and its correct answer
this.Fill = function(content, solution)
{
//Answer and riddle should be on the same position when later getting both
riddle.push(content);
answer.push(solution);
}
//Get content from a specific position.
/*
Parameter:
fromPosition -> an integer number for the specific position which will be accessed
riddle_or_answer -> "answer" for the riddles answer or "riddle" for the riddle itself
*/
this.GetInfo = function(fromPosition, riddle_or_answer)
{
if ( (riddle[fromPosition] === undefined) )
{
console.log("Wrong array position!")
}
else if(riddle_or_answer === "riddle")
{
return riddle[fromPosition];
}
else if(riddle_or_answer === "answer")
{
return answer[fromPosition];
}
}
} | [
"function getRightAnswers() {\n}",
"function showRiddle()\n{\n\tvar riddle = document.getElementById('riddle');\n\t\n\t//Between 0 and 9\n\tvar diced = Dice.start();\n\t\n\triddle.innerHTML = MyRiddles.GetInfo(diced, \"riddle\");\n}",
"function AddableExamResultSet(){\n this.examNumbers = [];\n}",
"function ClinicianAnswer(container, id, name, yesLabel, noLabel, unsureLabel) {\n\tvar li = $('<li/>');\n\tli.append($('<span class=\"label\"></span>').text(name));\n\tthis._radioYes = this._createRadio(li, id, 'yes', yesLabel, false);\n\tthis._radioNo = this._createRadio(li, id, 'no', noLabel, false);\n\tthis._radioUnsure = this._createRadio(li, id, 'unsure', unsureLabel, true);\n\tcontainer.append(li);\n}",
"static getAll() {\n return db.any(`\n SELECT * FROM results`\n )\n .then(resultArray => {\n const instanceArray = resultArray.map(resultObj => {\n return new Result(resultObj.id, resultObj.id_resultset, resultObj.id_question, resultObj.correct);\n });\n return instanceArray;\n });\n }",
"function Question() {\n this.answerCanvas = [];\n this.questionCanvas = [];\n this.rotationCanvas = [];\n}",
"function Runner(first,last,lapone,laptwo){\r\n this.firstName = first;\r\n this.lastName = last;\r\n this.lapOne = lapone;\r\n this.lapTwo = laptwo;\r\n this.fullDetails = () => {return this.firstName + \" \" + this.lastName + \" \" + this.lapOne + \" \" + this.lapTwo;}\r\n }",
"function TimeBasedRecommendor() {\n\n\t/* Private Member Variables */\n\n // setup some maps so that we can store all the data in memory and then update properly\n // Basically the concern is that can't add a rating to a candidate that doesn't exist yet\n // So we store everything, then create the candidates, then add the ratings\n\t\n var candidates = {}; // a map of all candidates (with key equal to its name)\n var leafVector = []; // a vector of all candidates with no children\n var ratings = []; // a vector of all ratings\n var participations = []; // a vector of all partipations\n var predictionLinks = {}; // the set of all prediction links\n var latestDate = new DateTime(); // the latest date for which we have data about something\n \n var ratingsFilename = \"bluejay_ratings.txt\";\n var inheritancesFilename = \"bluejay_inheritances.txt\";\n\n\t/* Public Methods */\n \n /* function prototypes */\n\t\n // functions to add data\n // read the usual files and put their data into the recommendor\n this.readFiles = readFiles;\n // read a file and put its data into the recommendor\n this.readFile = readFile;\n // add a Candidate for the engine to track\n this.addCandidate = addCandidate;\n // add any necessary links between Candidates\n this.updateLinks = updateLinks;\n // give the previously unseen rating to the engine\n this.addRating = addRating;\n // restore the previously seen rating and don't write it to a file\n this.putRatingInMemory = putRatingInMemory;\n // save this rating to a text file\n this.writeRating = writeRating;\n // give the previously unseen participation to the engine and write it to a file\n this.addParticipation = addParticipation;\n // restore the previously seen participation and don't write it to a file\n this.putParticipationInMemory = putParticipationInMemory;\n // save this participation to a text file\n this.writeParticipation = writeParticipation;\n // give this rating to all the Candidates that need it \n this.cascadeRating = cascadeRating;\n // give this participation to all the Candidates that need it\n this.cascadeParticipation = cascadeParticipation;\n // create a PredictionLink to predict one Candidate from another\n this.linkCandidates = linkCandidates;\n // create a PredictionLink to predict a RatingMovingAverage from a RatingMovingAverage\n this.linkAverages = linkAverages;\n // inform each Candidate of each of its children and parents\n this.updateChildPointers = updateChildPointers;\n // create some PredictionLinks to predict some Candidates from others\n this.addSomeTestLinks = addSomeTestLinks;\n this.updatePredictions = updatePredictions;\n // create the necessary files on disk\n this.createFiles = createFiles;\n // save the given participation to disk\n this.writeParticipation = writeParticipation;\n\t\n // search functions\n // returns this Candidate and all its ancestors\n this.findAllSuperCategoriesOf = findAllSuperCategoriesOf;\n // get the Candidate given the name\n this.getCandidateWithName = getCandidateWithName;\n // get the link between two MovingAverages\n this.getLinkFromMovingAverages = getLinkFromMovingAverages;\n // estimate what rating this Candidate would get if it were played at this time\n this.rateCandidate = rateCandidate;\n // choose the name of the next song to play\n this.makeRecommendation = makeRecommendation;\n this.addDistributions = addDistributions;\n this.averageDistributions = averageDistributions;\n \n // print functions\n this.printCandidate = printCandidate;\n this.printRating = printRating;\n this.printDistribution = printDistribution;\n this.printParticipation = printParticipation;\n this.message = message;\n // functions for testing that it all works\n this.test = test;\n\n // updates the structure of the Candidates\n // This informs each Candidate of each of children and parents, and\n // creates PredictionLinks between some of them\n function updateLinks() {\n alert(\"recommendor updating child pointers\");\n this.updateChildPointers();\n alert(\"recommendor adding test links\");\n\t\tthis.addSomeTestLinks();\n //alert(\"recommendor updating predictions\");\n\t\t//this.updatePredictions();\n }\n // function definitions\n // reads all the necessary files and updates the TimeBasedRecommendor accordingly\n function readFiles() {\n //alert(\"recommendor reading files\");\n //this.readFile(inheritancesFilename);\n this.createFiles();\n this.readFile(ratingsFilename);\n\t\tthis.updateLinks();\n\t\tthis.updatePredictions();\n\t\tmessage(\"recommendor done reading files\\r\\n\");\n\t\talert(\"recommendor done reading files\");\n }\n // reads one file and put its data into the TimeBasedRecommendor\n function readFile(fileName) {\n //alert(\"recommendor reading file\");\n \n \n message(\"opening file \" + fileName + \"\\r\\n\");\n\n // display a message\n var fileContents = FileIO.readFile(fileName);\n \n //message(\"initializing temporary variables\");\n\n\t var currentChar;\n\t var startTag = new Name();\n\t var endTag = new Name();\n\t var stackCount = 0;\n\t var readingStartTag = false;\n\t var readingValue = false;\n\t var readingEndTag = false;\n //message(\"initializing local candidate\");\n\t var candidate = new Candidate();\n //message(\"initializing local name\");\n\t var value = new Name();\n\t var objectName = new Name();\n //message(\"initializing local rating\");\n\t var rating = new Rating();\n\t var activityType = new Name();\n //message(\"initializing local participation\");\n\t var participation = new Participation();\n \t\n\t // setup some strings to search for in the file\n\t var candidateIndicator = new Name(\"Candidate\");\n\t var nameIndicator = new Name(\"Name\");\n\t var parentIndicator = new Name(\"Parent\");\n\t var discoveryDateIndicator = new Name(\"DiscoveryDate\");\n\n //message(\"done initializing some temporary variables\");\n \n\t var ratingIndicator = new Name(\"Rating\");\n\t var ratingActivityIndicator = new Name(\"Activity\");\n\t var ratingDateIndicator = new Name(\"Date\");\n\t var ratingValueIndicator = new Name(\"Score\");\n\n\t var participationIndicator = new Name(\"Participation\");\n\t var participationActivityIndicator = new Name(\"Activity\");\n\t var participationStartDateIndicator = new Name(\"StartDate\");\n\t var participationEndDateIndicator = new Name(\"EndDate\");\n\n\t var currentDate = new DateTime();\n\t var characterIndex;\n\t alert(\"starting to parse file text\");\n\t // read until the file is finished\n\t for (characterIndex = -1; characterIndex < fileContents.length; ) {\n\t\t // Check if this is a new starttag or endtag\n\t\t characterIndex++;\n\t\t currentChar = fileContents[characterIndex];\n\t\t \n\t\t //message(currentChar);\n\t\t // Check if this is the end of a tag\n\t\t if (currentChar == '>') {\n\t\t //message(value.getName());\n\t\t\t //message(\">\\r\\n\");\n\t\t\t characterIndex++;\n\t\t\t currentChar = fileContents[characterIndex];\n\t\t\t if (readingStartTag) {\n\t\t\t\t if (stackCount == 1) {\n\t\t\t\t\t // If we get here, then we just read the type of the object that is about to follow\n\t\t\t\t\t objectName = startTag.makeCopy();\n\t\t\t\t }\n\t\t\t\t //message(\"start tag = \");\n\t\t\t\t //message(startTag.getName() + \">\");\n\t\t\t\t value.clear();\n\t\t\t\t readingValue = true;\n\t\t\t }\n\t\t\t if (readingEndTag) {\n\t\t\t\t //message(\"end tag = \");\n\t\t\t\t //message(endTag.getName() + \">\\r\\n\");\n\t\t\t\t if (stackCount == 2) {\n\t\t\t\t\t // If we get here, then we just read an attribute of the object\n\n\t\t\t\t\t // If any of these trigger, then we just read an attribute of a candidate (which is a song, artist, genre or whatever)\n\t\t\t\t\t if (endTag.equalTo(nameIndicator))\n\t\t\t\t\t\t candidate.setName(value);\n\t\t\t\t\t if (endTag.equalTo(parentIndicator))\n\t\t\t\t\t\t candidate.addParentName(value.makeCopy());\n\t\t\t\t\t //if (endTag.equalTo(discoveryDateIndicator))\n\t\t\t\t\t\t// candidate.setDiscoveryDate(new DateTime(value.getName()));\n\n\n\t\t\t\t\t // If any of these trigger, then we just read an attribute of a rating\n\t\t\t\t\t // Tags associated with ratings\n\t\t\t\t\t if (endTag.equalTo(ratingActivityIndicator))\n\t\t\t\t\t\t rating.setActivity(value);\n\t\t\t\t\t if (endTag.equalTo(ratingDateIndicator)) {\n\t\t\t\t\t\t // keep track of the latest date ever encountered\n\t\t\t\t\t\t //message(\"assigning date to rating\\r\\n\");\n\t\t\t\t\t\t currentDate = new DateTime(value.getName());\n\t\t\t\t\t\t if (strictlyChronologicallyOrdered(latestDate, currentDate))\n\t\t\t\t\t\t\t latestDate = currentDate;\n\t\t\t\t\t\t rating.setDate(currentDate);\n\t\t\t\t\t\t //message(\"done assigning date to rating\\r\\n\");\n\t\t\t\t\t }\n\t\t\t\t\t\n\t\t\t\t\t if (endTag.equalTo(ratingValueIndicator)) {\n\t\t\t\t\t\t rating.setScore(parseFloat(value.getName()));\n\t\t\t\t\t }\n\t\t\t\t\t \n\n\t\t\t\t\t // If any of these trigger, then we just read an attribute of a participation (an instance of listening)\n\t\t\t\t\t if (endTag.equalTo(participationStartDateIndicator)) {\n\t\t\t\t\t\t // keep track of the latest date ever encountered\n\t\t\t\t\t\t currentDate = new DateTime(value.getName());\n\t\t\t\t\t\t if (strictlyChronologicallyOrdered(latestDate, currentDate))\n\t\t\t\t\t\t\t latestDate = currentDate;\n\t\t\t\t\t\t participation.setStartTime(currentDate);\n\t\t\t\t\t }\n\t\t\t\t\t if (endTag.equalTo(participationEndDateIndicator)) {\n\t\t\t\t\t\t // keep track of the latest date ever encountered\n\t\t\t\t\t\t currentDate = new DateTime(value.getName());\n\t\t\t\t\t\t if (strictlyChronologicallyOrdered(latestDate, currentDate))\n\t\t\t\t\t\t\t latestDate = currentDate;\n\t\t\t\t\t\t participation.setEndTime(currentDate);\n\t\t\t\t\t }\n\t\t\t\t\t if (endTag.equalTo(participationActivityIndicator))\n\t\t\t\t\t\t participation.setActivityName(value.makeCopy());\n\t\t\t\t }\n\t\t\t\t if (stackCount == 1) {\n //alert(\"probably read a candidate\");\n //message(\"object name = \" + objectName.getName());\n\t\t\t\t\t // If we get here then we just finished reading an object\n\t\t\t\t\t if (objectName.equalTo(candidateIndicator)) {\n\t\t\t\t\t\t // If we get here then we just finished reading a candidate (which is a song, artist, genre or whatever)\n\t\t\t\t\t\t // add the candidate to the inheritance hierarchy\n\t\t\t\t\t\t //alert(\"adding candidate\");\n\t\t\t\t\t\t this.addCandidate(candidate);\n\t\t\t\t\t\t candidate = new Candidate();\n\t\t\t\t\t }\n\t\t\t\t\t if (objectName.equalTo(ratingIndicator)) {\n\t\t\t\t\t\t // If we get here then we just finished reading a rating\n\t\t\t\t\t\t // add the rating to the rating set\n\t\t\t\t\t\t this.putRatingInMemory(rating);\n\t\t\t\t\t\t\n\t\t\t\t\t\t rating = new Rating();\n\t\t\t\t\t }\n\t\t\t\t\t if (objectName.equalTo(participationIndicator)) {\n\t\t\t\t\t\t // If we get here then we just finished reading a rating\n\t\t\t\t\t\t this.putParticipationInMemory(participation);\n\t\t\t\t\t\t participation = new Participation();\n\t\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t stackCount--;\n\t\t\t }\n\t\t\t readingStartTag = false;\n\t\t\t readingEndTag = false;\n\t\t }\n\t\t if (currentChar == '<') {\n\t\t\t readingValue = false;\n\t\t\t characterIndex++;\n\t\t\t currentChar = fileContents[characterIndex];\n\t\t\t if (currentChar != '/') {\n\t\t\t //message(\"<\");\n\t\t\t\t // If we get here, then it's a start tag\n\t\t\t\t startTag.clear();\n\t\t\t\t stackCount++;\n\t\t\t\t //message(\"stackCount = \" + stackCount);\n\t\t\t\t readingStartTag = true;\n\t\t\t } else {\n\t\t\t //message(value.getName() + \"</\");\n\t\t\t\t // If we get here, then it's an end tag\n\t\t\t\t endTag.clear();\n\t\t\t\t readingEndTag = true;\n\t\t\t characterIndex++;\n\t\t\t currentChar = fileContents[characterIndex];\n\t\t\t }\n\t\t }\n\t\t //message(\"start tag = \");\n\t\t //message(startTag.getName());\n\t\t // update names accordingly\n\t\t if (readingStartTag) {\n\t\t\t startTag.appendChar(currentChar);\n\t\t }\n\t\t if (readingValue) {\n\t\t\t value.appendChar(currentChar);\n\t\t }\n\t\t if (readingEndTag) {\n\t\t\t endTag.appendChar(currentChar);\n\t\t }\n\t }\n\t alert(\"done reading file \" + fileName + \"\\r\\n\");\n }\n // adds a candidate (also known as a song, genre, or category)\n function addCandidate(newCandidate) {\n var name = newCandidate.getName().getName();\n message(\"adding candidate named \");\n printCandidate(newCandidate);\n //message(\"done printing candidate\");\n candidates[name] = newCandidate;\n //message(\"done adding candidate\\r\\n\");\n }\n // adds a rating to the list of ratings\n function addRating(newRating) {\n writeRating(newRating);\n putRatingInMemory(newRating);\n }\n // saves the rating to the text file\n function writeRating(newRating) {\n var text = newRating.stringVersion();\n message(\"saving rating \" + text);\n FileIO.writeFile(ratingsFilename, text + \"\\r\\n\", 1);\n }\n function putRatingInMemory(newRating) {\n message(\"adding rating \");\n printRating(newRating);\n message(\"\\r\\n\");\n ratings.length += 1;\n ratings[ratings.length - 1] = newRating;\n }\n // adds a rating to the list of participation\n function addParticipation(newParticipation) {\n writeParticipation(newParticipation);\n putParticipationInMemory(newParticipation);\n }\n // saves the rating to the text file\n function writeParticipation(newParticipation) {\n var text = newParticipation.stringVersion();\n message(\"saving participation \" + text);\n FileIO.writeFile(ratingsFilename, text + \"\\r\\n\", 1);\n }\n function putParticipationInMemory(newParticipation) {\n message(\"adding participation\");\n printParticipation(newParticipation);\n participations.length += 1;\n participations[participations.length - 1] = newParticipation;\n }\n // adds the participation to the necessary candidate and all its parents\n function cascadeParticipation(newParticipation) {\n\t message(\"cascading participation \" + newParticipation.getActivityName().getName() + \"\\r\\n\");\n\t var candidate = getCandidateWithName(newParticipation.getActivityName());\n\t if (candidate) {\n\t var candidatesToUpdate = findAllSuperCategoriesOf(candidate);\n\t var i;\n\t for (i = 0; candidatesToUpdate[i]; i++) {\n\t\t candidatesToUpdate[i].giveParticipation(newParticipation);\n\t }\n }\n }\n // adds the rating to the necessary candidate and all its parents\n function cascadeRating(newRating) {\n\t var candidate = getCandidateWithName(newRating.getActivity());\n\t if (candidate) {\n\t var candidatesToUpdate = findAllSuperCategoriesOf(candidate);\n\t var i, j;\n\t for (i = 0; candidatesToUpdate[i]; i++) {\n\t var currentCandidate = candidatesToUpdate[i];\n\t message(\"giving rating to candidate \" + currentCandidate.getName().getName() + \"\\r\\n\");\n\t\t currentCandidate.giveRating(newRating);\n\t }\n }\n }\n // create the necessary PredictionLink to predict each candidate from the other\n function linkCandidates(predictor, predictee) {\n message(\"linking candidates \" + predictor.getName().getName() + \" and \" + predictee.getName().getName() + \"\\r\\n\");\n\t var frequencyCountA = predictor.getNumFrequencyEstimators();\n\t var ratingCountA = predictor.getNumRatingEstimators();\n\t var frequencyCountB = predictee.getNumFrequencyEstimators();\n\t var ratingCountB = predictee.getNumRatingEstimators();\n\t var i, j;\n\t // using the frequency of A, try to predict the rating for B\n\t for (i = 0; i < frequencyCountA; i++) {\n \t message(\"getting frequency estimator\\r\\n\");\n\t var predictorAverage = predictor.getFrequencyEstimatorAtIndex(i);\n \t message(\"getting actual rating history\\r\\n\");\n\t var predicteeAverage = predictee.getActualRatingHistory();\n message(\"linking averages\\r\\n\");\n\t\t this.linkAverages(predictorAverage, predicteeAverage);\n\t }\n\t // using the frequency of B, try to predict the rating for A\n\t /*for (j = 0; j < frequencyCountB; j++) {\n\t\t this.linkAverages(predictee.getFrequencyEstimatorAtIndex(j), predictor.getActualRatingHistory());\n\t }*/\n\t // using the rating for A, try to predict the rating for B\n\t for (i = 0; i < ratingCountA; i++) {\n\t\t this.linkAverages(predictor.getRatingEstimatorAtIndex(i), predictee.getActualRatingHistory());\n\t }\n\t // using the rating for B, try to predict the rating for A\n\t /*for (j = 0; j < ratingCountB; j++) {\n\t\t this.linkAverages(predictee.getRatingEstimatorAtIndex(j), predictor.getActualRatingHistory());\n\t }*/\n }\n // create the necessary PredictionLink to predict the predictee from the predictor\n function linkAverages(predictor, predictee) {\n message(\"linking averages \");\n message(predictor.getName().getName());\n message(\" and \");\n message(predictee.getName().getName() + \"\\r\\n\");\n var predicteeName = predictee.getName().getName();\n //message(\"doing dictionary lookup\\r\\n\");\n var links = predictionLinks[predicteeName];\n //message(\"checking for undefined value\\r\\n\");\n if (links == undefined) {\n //message(\"links was undefined\\r\\n\");\n\t links = {};\n }\n //message(\"making new link\");\n\t var newLink = new PredictionLink(predictor, predictee);\n //message(\"putting new link in map\");\n\t links[predictor.getName().getName()] = newLink;\n predictionLinks[predicteeName] = links;\n }\n // inform each candidate of the categories it directly inherits from\n // and the categories that directly inherit from it\n function updateChildPointers() {\n message(\"updating child pointers\");\n\t // iterate over each candidate\n\t var candidateIterator = Iterator(candidates, true);\n\t var currentCandidate;\n\t var parent;\n\t var i;\n\t for (candidateName in candidateIterator) {\n\t message(\"candidateName = \" + candidateName);\n\t\t currentCandidate = candidates[candidateName];\n\t\t message(\"current candidate = \");\n\t\t //message(currentCandidate);\n\t\t message(\"current candidate is named\" + currentCandidate.getName().getName());\n\t\t //message(\"checking if update is needed\\r\\n\");\n\t\t if (currentCandidate.needToUpdateParentPointers()) {\n \t\t message(\"update is required\\r\\n\");\n\t\t\t // if we get here then this candidate was added recently and its parents need their child pointers updated\n\t\t\t var parentNames = currentCandidate.getParentNames();\n\t\t\t for (i = 0; parentNames[i]; i++) {\n\t\t message(\"parent name = \" + parentNames[i].getName() + \"\\r\\n\");\n\t\t\t\t parent = getCandidateWithName(parentNames[i]);\n\t\t\t\t message(\"parent is named \" + parent.getName().getName() + \"\\r\\n\");\n\t\t\t\t message(\"adding parent\\r\\n\");\n\t\t\t\t currentCandidate.addParent(parent);\n\t\t\t\t message(\"adding child\\r\\n\");\n\t\t\t\t parent.addChild(currentCandidate);\n\t\t\t\t message(\"done adding child\\r\\n\");\n\t\t\t }\n\t\t } else {\n\t\t message(\"update was not required\\r\\n\");\n\t\t }\n\t }\n\t // keep track of all candidates that have no children\n\t leafVector.length = 0;\n\t candidateIterator = Iterator(candidates);\n\t for ([candidateName, currentCandidate] in candidateIterator) {\n\t if (currentCandidate.getChildren().length == 0) {\n\t leafVector.push(currentCandidate);\n\t }\n\t }\n }\n \n // creates a bunch of PredictionLinks to predict the ratings of some Candidates from others\n function addSomeTestLinks() {\n \tmessage(\"adding some test links\\r\\n\");\n\t var iterator1 = Iterator(candidates);\n\t var name1;\n\t var name2;\n\t var candidate1;\n\t var candidate2;\n\t // currently we add all combinations of links\n\t /*for ([name1, candidate1] in iterator1) {\n \t var iterator2 = Iterator(candidates);\n\t\t for ([name2, candidate2] in iterator2) {\n\t\t message(\"name1 = \" + name1 + \" name2 = \" + name2 + \"\\r\\n\");\n\t\t // to prevent double-counting, make sure candidate1 <= candidate2\n\t\t if (!candidate1.getName().lessThan(candidate2.getName())) {\n\t\t message(\"linking candidates\\r\\n\");\n\t\t this.linkCandidates(candidate1, candidate2);\n\t\t }\n\t\t }\n\t }*/\n\t // to make the algorithm run quickly, we currently only predict a song based on itself and supercategories\n\t var parents;\n\t var i;\n\t var currentParent;\n\t for ([name1, candidate1] in iterator1) {\n\t // for speed, only compare against oneself and one's immediate parents\n this.linkCandidates(candidate1, candidate1);\n\t parents = candidate1.getParents();\n\t //parents = this.findAllSuperCategoriesOf(candidate1);\n\t for (i = 0; i < parents.length; i++) {\n\t // try to predict the rating of the parent from data about the child\n\t // this.linkCandidates(candidate1, parents[i]);\n\t // try to predict the rating of this candidate from data about the parents\n\t this.linkCandidates(parents[i], candidate1);\n\t }\n\t }\n }\n // inform everything of any new data that was added recently that it needs to know about \n function updatePredictions() {\n //alert(\"Updating predictions. Please wait.\\r\\n\");\n message(\"giving ratings to activities\\r\\n\");\n // inform each candidate of the ratings given to it\n var ratingIterator = Iterator(ratings, true);\n var rating;\n var activityName;\n var i;\n for (i = 0; i < ratings.length; i++) {\n this.cascadeRating(ratings[i]);\n }\n ratings.length = 0;\n \n\t message(\"giving participations to activities\\r\\n\");\n for (i = 0; i < participations.length; i++) {\n this.cascadeParticipation(participations[i]);\n }\n participations.length = 0;\n \n\n\n \tmessage(\"updating PredictionLinks\");\n \t// have each PredictionLink update itself with the changes to the appropriate MovingAverage \t\n \tvar mapIterator = Iterator(predictionLinks);\n \tvar currentMap;\n \tvar currentKey;\n \tvar currentPredictionKey;\n \tvar currentLink;\n \tvar predictionIterator;\n \tvar numUpdates = 0;\n \t\n \t// for each candidate, get the map of predictions links that have it as the predictor\n \tfor ([currentKey, currentMap] in mapIterator) {\n \t message(\"making iterator out of map \" + currentKey + \"\\r\\n\");\n \t predictionIterator = Iterator(currentMap);\n \t // iterate over each PredictionLink that shares the predictor\n \t for ([currentPredictionKey, currentLink] in predictionIterator) {\n \t message(\"updating a PredictionLink \" + currentPredictionKey + \"\\r\\n\");\n \t currentLink.update(); // update the prediction link within the map\n \t numUpdates++;\n \t }\n \t}\n \tmessage(\"num PredictionLinks updated = \" + numUpdates + \"\\r\\n\");\n }\n function createFiles() {\n FileIO.writeFile(ratingsFilename, \"\", 1); \n //FileIO.writeFile(inheritancesFilename, \"\", 0); \n }\n \n////////////////////////////////// search functions /////////////////////////////////////\n function findAllSuperCategoriesOf(candidate) {\n message(\"finding supercategories of \" + candidate.getName().getName() + \"\\r\\n\");\n // setup a set to check for duplicates\n var setToUpdate = {};\n // setup an array for sequential access\n var vectorToUpdate = [];\n // initialize the one leaf node\n var currentCandidate = candidate;\n //message(\"putting first entry into set\\r\\n\");\n setToUpdate[candidate.getName().getName()] = currentCandidate;\n //message(\"putting first entry into vector\\r\\n\");\n vectorToUpdate.push(currentCandidate);\n // compute the set of all supercategories of this candidate\n var busy = true;\n var currentParent;\n var setIterator;\n var parents;\n var i, j;\n //message(\"starting loop\\r\\n\");\n for (i = 0; i < vectorToUpdate.length; i++) {\n currentCandidate = vectorToUpdate[i];\n parents = currentCandidate.getParents();\n for (j = 0; j < parents.length; j++) {\n currentParent = parents[j];\n // check whether this candidate is already in the set\n if (!setToUpdate[currentParent.getName().getName()]) {\n message(\"adding parent named \" + currentParent.getName().getName() + \"\\r\\n\");\n // if we get here then we found another candidate to add\n setToUpdate[currentParent.getName().getName()] = currentParent;\n vectorToUpdate.push(currentParent);\n }\n }\n }\n //message(\"done find supercategories\\r\\n\");\n return vectorToUpdate;\n }\n // dictionary lookup\n function getCandidateWithName(name) {\n return candidates[name.getName()];\n }\n // given two moving averages, returns the PredictionLink that predicts the predictee from the predictor\n function getLinkFromMovingAverages(predictor, predictee) {\n var links = predictionLinks[predictee.getName().getName()];\n return links[predictor.getName().getName()]; \n }\n \n////////////////////////////////// Prediction functions ///////////////////////////////////////\n // calculate a rating for the given candidate\n function rateCandidate(candidate, when) {\n \n message(\"rating candidate with name: \" + candidate.getName().getName());\n printCandidate(candidate);\n var parents = candidate.getParents();\n var guesses = [];\n var currentDistribution;\n var i;\n var currentParent;\n // make sure that all of the parents are rated first\n for (i = parents.length - 1; i >= 0; i--) {\n currentParent = parents[i];\n // figure out if the parent was rated recently enough\n if (strictlyChronologicallyOrdered(currentParent.getLatestRatingDate(), when)) {\n // if we get here then the parent rating needs updating\n this.rateCandidate(currentParent, when);\n }\n }\n // Now get the prediction from each relevant link\n var shortTermAverageName = candidate.getActualRatingHistory().getName().getName();\n var links = predictionLinks[shortTermAverageName];\n var mapIterator = Iterator(links);\n\t var predictorName;\n\t var currentLink;\n\t var currentGuess;\n\t var predicteeName = candidate.getName().getName();\n\t // iterate over all relevant prediction links\n\t var childWeight = 0;\n for ([predictorName, currentLink] in mapIterator) {\n currentLink.update();\n message(\"Predicting \" + predicteeName + \" from \" + predictorName, 0);\n currentGuess = currentLink.guess(when);\n message(\" score: \" + currentGuess.getMean() + \"\\r\\n\", 0);\n //printDistribution(currentGuess);\n guesses.push(currentGuess);\n childWeight += currentGuess.getWeight();\n }\n var parentScale;\n if (childWeight < 1)\n parentScale = 1;\n else\n parentScale = 1 / childWeight;\n for (i = 0; i < parents.length; i++) {\n currentGuess = parents[i].getCurrentRating();\n guesses.push(new Distribution(currentGuess.getMean(), currentGuess.getStdDev(), currentGuess.getWeight() * parentScale));\n }\n \n \n // In addition to all of the above factors that may use lots of data to predict the rating\n // of the song, we should also use some other factors.\n // We want to:\n // Never forget a song completely\n // Avoid playing a song twice in a row without explicit reason to do so\n // Believe the user's recent ratings\n \n \n // We don't want to ever completely forget about a song. So, move it slowly closer to perfection\n // Whenever they give it a rating or listen to it, this resets\n var remembererDuration = candidate.getIdleDuration(when);\n if (remembererDuration < 1)\n\t\t remembererDuration = 1;\n\t\t \n\t\t// The goal is to make d = sqrt(t) where d is the duration between listenings and t = num seconds\n\t // Then n = sqrt(t) where n is the number of ratings\n\t // If the user reliably rates a song down, then for calculated distributions, stddev = 1 / n = 1 / sqrt(t) and weight = n = sqrt(t)\n\t // Then it is about ideal for the rememberer to have stddev = 1 / n and weight = d\n\t // If the user only usually rates a song down, then for calculated distributions, stddev = k and weight = n\n\t // Then it is about ideal for the rememberer to have stddev = k and weight = d\n\t // This is mostly equivalent to stddev = d^(-1/3), weight = d^(2/3)\n\t // So we could even make the rememberer stronger than the current stddev = d^(-1/3), weight = d^(1/3)\n\t //double squareRoot = sqrt(remembererDuration);\n\t var cubeRoot = Math.pow(remembererDuration, 1.0/3.0);\n\t //message(\"building rememberer\");\n\t var rememberer = new Distribution(1, 1.0 / cubeRoot, cubeRoot);\n\t guesses.push(rememberer);\n\t \n\t // We should also suspect that they don't want to hear the song twice in a row\n\t var spacerDuration = candidate.getDurationSinceLastPlayed(when);\n\t // if they just heard it then they we're pretty sure they don't want to hear it again\n\t // If it's been 10 hours then it's probably okay to play it again\n\t // The spacer has a max weight so it can be overpowered by learned data\n\t var spacerWeight = 20 * (1 - spacerDuration / 36000);\n\t if (spacerWeight > 0) {\n\t guesses.push(new Distribution(0, .05, spacerWeight));\n\t }\n\n // finally, combine all the distributions and return\n //message(\"averaging distributions\");\n var childRating = this.averageDistributions(guesses);\n candidate.setCurrentRating(childRating, when);\n message(\"name: \" + candidate.getName().getName() + \" score: \" + childRating.getMean() + \"\\r\\n\", 1);\n return childRating;\n }\n \n // calculate a rating for the candidate with the given name\n function rateCandidateWithName(name, when) {\n return this.rateCandidate(getCandidateWithName(name), when);\n }\n \n // determines which candidate has the best expected score at the given time\n function makeRecommendation(when) {\n // default to the current date\n if (!when) {\n // get the current date\n when = new DateTime();\n when.setNow();\n }\n message(\"\\r\\nmaking recommendation for date:\" + when.stringVersion() + \"\\r\\n\", 1);\n var candidateIterator = Iterator(candidates);\n\t // make sure that there is at least one candidate to choose from\n\t // setup a map to sort by expected rating\n\t var guesses = [];\n\t var scoreValid = false;\n\t var candidateKey;\n\t var currentCandidate;\n\t var bestScore = -1;\n\t var currentScore = -1;\n\t var bestName = new Name(\"[no data]\");\n\t //for ([candidateKey, currentCandidate] in candidateIterator) {\n\t var i, index;\n\t for (i = 0; i < 8; i++) {\n\t // choose a random candidate\n\t index = Math.floor(Math.random() * leafVector.length);\n\t currentCandidate = leafVector[index];\n\t message(\"considering candidate\" + currentCandidate.getName().getName());\n\t // only bother to rate the candidates that are not categories\n\t if (currentCandidate.getNumChildren() == 0) {\n\t this.rateCandidate(currentCandidate, when);\n\t currentScore = currentCandidate.getCurrentRating().getMean();\n\t message(\"candidate name = \" + currentCandidate.getName().getName());\n\t message(\"expected rating = \" + currentScore + \"\\r\\n\");\n\t guesses.push(currentCandidate);\n\t if ((currentScore > bestScore) || !scoreValid) {\n\t bestScore = currentScore;\n\t bestName = currentCandidate.getName();\n \t scoreValid = true;\n \t }\n\t }\n\t }\n\t var i;\n\t for (i = 0; i < guesses.length; i++) {\n\t currentCandidate = guesses[i];\n\t message(\"candidate name = \" + currentCandidate.getName().getName());\n\t message(\" expected rating = \" + currentCandidate.getCurrentRating().getMean() + \"\\r\\n\");\n\t }\n\t /* // print the distributions in order\n\t var distributionIterator = Iterator(guesses, true);\n\t var currentScore;\n\t var currentName;\n\t for ([currentScore, currentName] in distributionIterator) {\n\t message(\"in the home stretch\\r\\n\");\n\t //currentName = distributionIterator[currentScore];\n\t message(\"candidate name = \" + currentName.getName());\n\t message(\" expected rating = \" + currentScore);\n\t }\n\t */\n\t message(\"best candidate name = \" + bestName.getName() + \" expected rating = \" + bestScore + \"\\r\\n\", 1);\n\t flushMessage();\n\t //alert(\"done making recommendation. Best song name = \" + bestName.getName());\n\t return bestName;\n }\n // compute the distribution that is formed by combining the given distributions\n function addDistributions(distributions, average) {\n return this.averageDistributions(distributions);\n }\n // compute the distribution that is formed by combining the given distributions\n function averageDistributions(distributions) {\n // initialization\n var sumY = 0.0;\n var sumY2 = 0.0;\n var sumWeight = 0.0; // the sum of the weights that we calculate, which we use to normalize\n \tvar stdDevIsZero = false;\n var sumVariance = 0.0;\t// variance is another name for standard deviation squared\n\t var outputWeight = 0.0;// the sum of the given weights, which we use to assign a weight to our guess\n\t var count = 0.0;\t// the number of distributions being used\n\t var weight;\n\t var y;\n\t var stdDev;\n\t message(\"averaging distributions \\r\\n\");\t \n\t var i;\n\t var currentDistribution;\n \t// iterate over each distribution and weight them according to their given weights and standard deviations\n\t for (i = 0; i < distributions.length; i++) {\n\t currentDistribution = distributions[i];\n\t message(\"mean = \" + currentDistribution.getMean() + \" stdDev = \" + currentDistribution.getStdDev() + \" weight = \" + currentDistribution.getWeight() + \"\\r\\n\");\n\t stdDev = currentDistribution.getStdDev();\n\t // only consider nonempty distributions\n\t if (currentDistribution.getWeight() > 0) {\n \t\t\t// If the standard deviation of any distribution is zero, then compute the average of only distributions with zero standard deviation\n \t\t\tif (stdDev == 0) {\n \t\t\t if (!stdDevIsZero) {\n \t\t\t stdDevIsZero = true;\n \t\t\t sumVariance = 0.0;\n \t\t\t sumY = sumY2 = 0.0;\n \t\t\t outputWeight = count = sumWeight = 0.0;\n \t\t\t }\n \t\t\t}\n \t\t\t// Figure out whether we care about this distribution or not\n\t\t\t if ((stdDev == 0) || (!stdDevIsZero)) {\n\t\t\t\t // get the values from the distribution\n\t\t\t\t y = currentDistribution.getMean();\n\t\t\t\t if (stdDev == 0.0) {\n\t\t\t\t\t // If stddev is zero, then just use the given weight\n\t\t\t\t\t weight = currentDistribution.getWeight();\n\t\t\t\t } else {\n\t\t\t\t\t // If stddev is nonzero then weight based on both the stddev and the given weight\n\t\t\t\t\t weight = currentDistribution.getWeight() / stdDev;\n\t\t\t\t }\n\t\t\t\t // add to the running totals\n\t\t\t\t sumY += y * weight;\n\t\t\t\t sumY2 += y * y * weight;\n\t\t\t\t sumWeight += weight;\n\t\t\t\t sumVariance += stdDev * stdDev * weight;\n\t\t\t\t outputWeight += currentDistribution.getWeight();\n\t\t\t\t count += 1.0;\n\t\t\t }\n\t }\n\t }\n\t var result;\n\t if (sumWeight == 0) {\n\t result = new Distribution(0, 0, 0);\n\t }\n\t else{\n\t\t // If we did have a distribution to predict from then we can calculate the average and standard deviations\n\t\t var newAverage = sumY / sumWeight;\n\t\t var variance1 = (sumY2 - sumY * sumY / sumWeight) / sumWeight;\n\t\t message(\"variance1 = \");\n\t\t message(variance1);\n\t\t message(\"\\r\\n\");\n\t\t var variance2 = sumVariance / sumWeight;\n\t\t message(\"variance2 = \");\n\t\t message(variance2);\n\t\t message(\"\\r\\n\");\n\t\t //stdDev = Math.sqrt(variance1 + variance2);\n\t\t stdDev = Math.sqrt(variance2);\n\t\t result = new Distribution(newAverage, stdDev, outputWeight);\n\t }\n\t \n\t message(\"resultant distribution = \");\n\t printDistribution(result);\n\t message(\"\\r\\n average of all distributions:\" + (sumY / sumWeight) + \"\\r\\n\");\n \treturn result;\n }\n // print functions\n function printCandidate(candidate) {\n //message(\"printing candidate named \" + candidate.getName().getName());\n message(candidate.getName().getName() + \"\\r\\n\");\n var parentNames = candidate.getParentNames();\n message(\"numParents = \" + candidate.getParents().length + \"\\r\\n\");\n message(\"parent names:\\r\\n\");\n var i;\n for (i = 0; i < parentNames.length; i++) {\n message(parentNames[i].getName() + \"\\r\\n\");\n }\n message(\"\\r\\n\"); \n }\n function printRating(rating) {\n message(\"name:\" + rating.getActivity().getName() + \"\\r\\n\");\n message(\"date:\" + rating.getDate().stringVersion() + \"\\r\\n\");\n message(\"score:\" + rating.getScore() + \"\\r\\n\");\n var now = new DateTime();\n now.setNow();\n var duration = rating.getDate().timeUntil(now);\n message(\"time since now = \" + duration);\n }\n function printDistribution(distribution) {\n message(\"mean:\" + distribution.getMean());\n message(\" stdDev:\" + distribution.getStdDev());\n message(\" weight:\" + distribution.getWeight() + \"\\r\\n\");\n }\n function printParticipation(participation) {\n message(\"song name = \" + participation.getActivityName().getName() + \"\\r\\n\");\n message(\"start time = \" + participation.getStartTime().stringVersion() + \"\\r\\n\");\n message(\"end time = \" + participation.getEndTime().stringVersion() + \"\\r\\n\");\n message(\"intensity = \" + participation.getIntensity() + \"\\r\\n\");\n }\n\n function test() {\n //alert(\"testing\");\n //this.readFiles();\n //message(\"hi\\r\\n\");\n //FileIO.writeFile(\"appendedFile.txt\", \"appended data\", 1);\n /*\n var r1 = new Rating();\n r1.setActivity(\"Holding on for a hero\");\n alert(r1.getActivity());\n var dt = new DateTime();\n alert(\"setting date\");\n r1.setDate(dt);\n alert(\"setting score\");\n r1.setScore(0);\n this.addRating(r1);\n */\n /*\n var c1 = new Candidate(new Name(\"name1\"));\n alert(\"adding candidate\");\n this.addCandidate(c1);\n */\n\n /*var m1 = new MovingAverage();\n //m1.superFunction();\n alert(\"creating ParticipationMovingAverage\");\n var p1 = new ParticipationMovingAverage();\n alert(\"p1.superFunction();\");\n p1.superFunction();\n alert(\"creating RatingMovingAverage\");\n var r1 = new RatingMovingAverage();\n alert(\"r1.superFunction();\");\n r1.superFunction();\n */\n /*\n if (m1.isAParticipationMovingAverage()) {\n alert(\"m1 stores participations\");\n } else {\n alert(\"m1 does not store participations\");\n }\n message(\"done creating p1\");\n \n if (p1.isAParticipationMovingAverage()) {\n alert(\"p1 stores participations\");\n } else {\n alert(\"p1 does not store participations\");\n }\n alert(\"m1 name = \" + m1.stringVersion());\n alert(\"p1 name = \" + p1.stringVersion());\n */\n \n //var candidate1 = new Candidate(new Name(\"Sell Me Candy\"));\n //var candidate1 = new Candidate;\n //alert(\"adding candidate\");\n //addCandidate(candidate1);\n //candidate1.setName(\"name1\");\n //message(candidate1.getName().getName());\n }\n\n /*function message(text) {\n // append the text to the end of the output file\n FileIO.writeFile(\"output.txt\", text, 1);\n \n // don't bother showing a blank message\n //if (text != \"\\r\\n\")\n // alert(text);\n }*/\n// recommend function\n function recommend() {\n var songName = \"Come on Eileen\";\n alert(\"selecting song named \" + songName);\n const properties = Cc[\"@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1\"].createInstance(Ci.sbIMutablePropertyArray);\n //properties.appendProperty(SBProperties.artistName, \"Dexys Midnight Runners\");\n properties.appendProperty(SBProperties.trackName, songName);\n var tracks = LibraryUtils.mainLibrary.getItemsByProperties(properties);\n //var tracks = LibraryUtils.mainLibrary.getItemsByProperty(SBProperties.artistName, \"Dexys Midnight Runners\");\n var gMM = Components.classes[\"@songbirdnest.com/Songbird/Mediacore/Manager;1\"].getService(Components.interfaces.sbIMediacoreManager);\n gMM.sequencer.playView(gMM.sequencer.view,gMM.sequencer.view.getIndexForItem(tracks.enumerate().getNext())); \n alert(\"done selecting song\");\n } \n\n\t/* Private Methods */\n\n\n}",
"function ADLSeqUtilities() \r\n{\r\n\tthis.satisfied = new Object();\r\n\tthis.measure = new Object();\r\n\tthis.status = new Object();\r\n\tthis.score_raw = new Object();\r\n\tthis.score_min = new Object();\r\n\tthis.score_max = new Object();\r\n\tthis.completion_status = new Object();\r\n\tthis.progress_measure = new Object();\r\n\t\r\n}",
"function getQuestion() {\n \n \n }",
"function appendMethods_EProof__SID__ () {\n //#################################################################\n\t//# Nested: getAllJustIDs()\n\t//#################################################################\n this.getAllJustIDs = function () {\n \tvar vJustString = \"\";\n \tvar k=0;\n \tvar vTypeID = new Array(\"JUSTIFICATION\",\"PRECONDITION\");\n \tvar vComma = \"\";\n\t\twhile (k != vTypeID.length) {\n \t\tvJustString += vComma + this.aID4StepType[vTypeID[k]].join(\",\");\n\t\t\tif (vJustString != \"\") vComma = \",\";\n\t\t\tk++;\n\t\t};\n\t\treturn vJustString;\n };\n //#################################################################\n\t//# Nested: getAllIDs4Type(pType) read form DOM\n\t//#################################################################\n this.getAllIDs4Type = function (pType) {\n \tvar vJustString = \"\";\n \tvar i=0;\n\t\tvar vComma = \"\";\n\t\tvar vJustIDs = this.getElementsByClassName(\"ID_\"+pType+\"LIST\"+this.aQID);\n\t\twhile (i !=vJustIDs.length) {\n\t\t\tvJustString += vComma + vJustIDs[i].value;\n\t\t\tvComma =\",\";\n\t\t\ti++;\n\t\t};\n\t\treturn vJustString;\n };\n\t//#################################################################\n\t//# Nested: getAllSteps()\n\t//#################################################################\n\tthis.getAllSteps = function (pSCAN) {\n\t\tif ((!this.aAllSteps) || (pSCAN)) {\n\t\t\tthis.aUsedSteps = this.getUsedSteps(\"SCAN\");\n\t\t\tthis.aUnusedSteps = this.getUnusedSteps(\"SCAN\");\n\t\t\t//alert(\"Used=\"+this.aUsedSteps.length+\" Unused=\"+this.aUnusedSteps.length+\" \");\n\t\t\tif (pSCAN) {\n\t\t\t\tvar vAll = new Array();\n\t\t\t\tvar vAppend = this.aUsedSteps;\n\t\t\t\tvar i=0;\n\t\t\t\twhile (i != vAppend.length) {\n\t\t\t\t\tvAll.push(vAppend[i]);\n\t\t\t\t\ti++;\n\t\t\t\t};\n\t\t\t\ti=0;\n\t\t\t\tvAppend = this.aUnusedSteps;\n\t\t\t\twhile (i != vAppend.length) {\n\t\t\t\t\tvAll.push(vAppend[i]);\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\tthis.aAllSteps = vAll;\n\t\t\t};\n\t\t\t//alert(\"All=\"+vAll.length+\" Used=\"+this.aUsedSteps.length+\" Unused=\"+this.aUnusedSteps.length+\" \");\n\t\t\tthis.createStep2SA();\n\t\t};\n\t\treturn this.aAllSteps;\n\t};\n //#################################################################\n\t//# Nested: getDateString()\n\t//#################################################################\n\tthis.getDateString = function () {\n\t\tvar vNow = new Date();\n\t\tvar vMonth = vNow.getMonth()+1;\n\t\treturn vNow.getDate()+\".\"+vMonth+\".\"+vNow.getFullYear();\n\t};\n //#################################################################\n\t//# Nested: getStringNumber()\n\t//#################################################################\n\tthis.getStringNumber = function (pNumber) {\n\t\tfunction ord(x) { return x.charCodeAt(0) }\n\t\tvar vRes = \"\";\n\t\tvZ = ord(\"Z\");\n\t\twhile (this.greater(pNumber,vZ-1)) {\n\t\t\tvRes += \"Z\";\n\t\t\t//alert(vRes);\n\t\t\tpNumber -= vZ;\n\t\t};\n\t\tvar vChar = String.fromCharCode(pNumber+ord(\"A\"));\n\t\t//alert(vRes + vChar);\n\t\treturn vRes + vChar;\n\t};\n\t//#################################################################\n\t//# Nested: getStringQID()\n\t//#################################################################\n\tthis.getStringQID = function (pQID) {\n\t\tfunction ord(x) { return x.charCodeAt(0) }\n\t\tfunction chr(x) {\n\t\t\tvar n = parseInt(x+\"\");\n\t\t\tn = n % 25;\n\t\t\treturn String.fromCharCode(n+ord(\"A\"))\n\t\t};\n\t\tif (pQID == \"\") {\n\t\t\tvar vNow = new Date();\n\t\t\t//var vMonth = vNow.getMonth()+1;\n\t\t\t//pQID = \"Y\"+vNow.getFullYear()+\"M\"+vMonth+\"D\"+vNow.getDate()+\"h\"+vNow.getHours()+\"m\"+vNow.getMinutes();\n\t\t\tpQID = chr(Math.round(Math.random()*25));\n\t\t\tpQID = chr(vNow.getFullYear());\n\t\t\tpQID += chr(vNow.getMonth());\n\t\t\tpQID += chr(vNow.getDate());\n\t\t\tpQID += chr(vNow.getHours());\n\t\t\tpQID += chr(vNow.getMinutes());\n\t\t\tpQID += chr(vNow.getSeconds());\n\t\t\t//pQID = this.vigenere(pQID,\"ABCD\",\"encode\");\n\t\t};\n\t\treturn pQID;\n\t};\n\t//#################################################################\n\t//# Nested: getEProofHTML()\n\t//#################################################################\n\t//this.getEProofHTML = function(pLibPath,pMathJaxPath,pMathJaxConfig) {\n\tthis.getEProofHTML = function(pLibPath,pMathJaxPath,pMathJaxConfig) {\n\t\tvar vLibPath = pLibPath || \"library/\";\n\t\tvar vMathJaxPath = pMathJaxPath || \"../MathJax/\";\n\t\t//var vMathJaxPath = pMathJaxPath || \"../MathJax/\";\n\t\t//var vOut = this.getWeeblyEProof(pLibPath,pMathJaxPath,pMathJaxConfig);\n\t\treturn this.getWrappedHTML(vOut);\n\t};\n\t//#################################################################\n\t//# Nested: getEProofIMath()\n\t//#################################################################\n\tthis.getEProofIMath = function() {\n\t\t//----used in saveEProofIMath2Form()----\n\t\tvar vSID = this.getElementById(\"tSID\"+this.aQID).value;\n\t\tvar vQID = this.getElementById(\"tQID\"+this.aQID).value;\n\t\tvar cln = this.getIMathEProofClone();\n\t\tcln = this.getIMathEProofAnswerBox(cln);\n\t\tcln = this.getIMathEProofClearSteps(cln);\n\t\treturn this.getIMathEProofInnerHTML(cln,vQID,this.DO+\"thisq\",vSID);\n\t};\n\t//#################################################################\n\t//# Nested: getExportTemplate(pTPLname)\n\t//#################################################################\n\tthis.getExportTemplate = function (pTPLname) {\n\t\tvar vTPL = this.getChildById(this.aRootDOM,pTPLname).value;\n\t\tvTPL = this.replaceString(vTPL,\"__do__\",this.DO);\n\t\treturn vTPL\n\t};\n\t//#################################################################\n\t//# Nested: getIMathById(pFormID)\n\t//#################################################################\n\tthis.getIMathById = function (pFormID) {\n\t\tvar vFormID = \"imath\"+pFormID;\n\t\tif (pFormID == \"STORAGE\") {\n\t\t\t//alert(\"ThisQ=\"+this.aThisQ+\" Offline=\"+this.aOffline);\n\t\t\t//if (this.aOffline == \"1\") {\n\t\t\t//\talert(\"Offline\");\n\t\t\t//}\n\t\t\tvFormID = \"qn\"+this.aThisQ+\"000\";\n\t\t};\n\t\treturn this.getChildById(this.aRootDOM,vFormID);\n\t};\n\t//#################################################################\n\t//# Nested: getIMathEProofClone()\n\t//#################################################################\n\tthis.getIMathEProofClone = function(pLoadXML,pRootID) {\n\t\t// clone e-Proof\n\t\tvar vRootID = pRootID || \"EMULATIONiMathAS\";\n\t\tvar vIMathRoot = document.getElementById(vRootID);\n\t\tvar cln = vIMathRoot.cloneNode(true);\n\t\tvar vLoadXML = this.getChildById(cln,\"tLOAD\"+this.aQID);\n\t\tvLoadXML.innerHTML = pLoadXML || \"\";\n\t\tvLoadXML.value = \"\";\n\t\t//alert(this.getChildById(cln,\"tLOAD\"+this.aQID).value);\n\t\tthis.getChildById(cln,\"USEDSTEPS\"+this.aQID).innerHTML = \"\";\n\t\tthis.getChildById(cln,\"UNUSEDSTEPS\"+this.aQID).innerHTML = \"\";\n\t\tthis.getChildById(cln,\"SOURCESTEPS\"+this.aQID).innerHTML = this.DO+\"SourceSteps\";\n\t\tthis.getChildById(cln,\"ulCONNECTIONLIST\"+this.aQID).innerHTML = this.createSelectConnection4JS();\n\t\treturn cln;\n\t};\n\t//#################################################################\n\t//# Nested: getIMathEProofAnswerBox(cln)\n\t//#################################################################\n\tthis.getIMathEProofAnswerBox = function(cln) {\n\t\t//----Create answerboxes for IMathAS-----\n\t\tvar vValue = \"\"+this.CR;\n\t\tvar i=0;\n\t\t//var vMax = this.aIMathArray.length;\n\t\tvar vMax = 1;\n\t\twhile (i != vMax) {\n\t\t\tvValue += this.DO+\"answerbox[\"+i+\"]\"+this.CR;\n\t\t\ti++;\n\t\t}\n\t\tvar vStorage = this.getChildById(cln,\"imathSTORAGE\");\n\t\tif (vStorage) {\n\t\t\tvStorage.innerHTML = vValue;\n\t\t} else {\n\t\t\talert(\"this.getIMathEProofAnswerBox()-Call Error 'imathSTORAGE'\");\n\t\t};\n\t\tvar vListID = new Array(\"imathDISPLAYOPTION\",\"imathSTEPCOUNT\");\n\t\ti=0;\n\t\tvValue = \"\";\n\t\twhile (i != vListID.length) {\n\t\t\tvValue += this.CR+\" \"+this.LT+\"input type='text' id='\"+vListID[i]+\"' value='\"+this.DO+vListID[i]+\"'/\"+this.GT;\n\t\t\ti++;\n\t\t};\n\t\tthis.getChildById(cln,\"imathDISPLAYOPTIONandSTEPCOUNT\").innerHTML =vValue;\n\t\t//this.aIMathArray = new Array(\"DISPLAYOPTION\",\"STEPCOUNT\",\"STUDENTANSWER\",\"PRECONDITION\",\"CONCLUSION\",\"JUSTIFICATION\",\"PROOFSTEP\",\"SOLUTION\",\"ENCRYPTED\");\n\t\tvListID = this.aIMathArray;\n\t\ti=0;\n\t\twhile (i != vListID.length) {\n\t\t\t//this.getChildById(cln,\"imath\"+vListID[i]).innerHTML = \"\";\n\t\t\tthis.getChildById(cln,\"imath\"+vListID[i]).innerHTML = this.DO+\"imath\"+vListID[i];\n\t\t\ti++;\n\t\t};\n\t\treturn cln;\n\t};\n\t//#################################################################\n\t//# Nested: getIMathEProofClearSteps(cln)\n\t//#################################################################\n\tthis.getIMathEProofClearSteps = function(cln) {\n\t\t//---vListID = new Array(\"PRECONDITION\",\"CONCLUSION\",\"JUSTIFICATION\",\"PROOFSTEP\");\n\t\tvar vListID = this.aIMathID;\n\t\tvar i=0;\n\t\twhile (i != vListID.length) {\n\t\t\tthis.getChildById(cln,vListID[i]+\"LIST\"+this.aQID).innerHTML = \"\";\n\t\t\ti++;\n\t\t};\n\t\treturn cln;\n\t};\n\t//#################################################################\n\t//# Nested: getIMathEProofInnerHTML()\n\t//#################################################################\n\tthis.getIMathEProofInnerHTML = function(cln,pQID,pThisQ,pSID,pMode) {\n\t\t//------------------------------\n\t\t//---OPERATION on innerHTML-----\n\t\t//------------------------------\n\t\tvar vMode = \"DEFAULT\";\n\t\tif (pMode) {\n\t\t\t// e.g. pMode = \"AUTHORING\" or \"DEBUG\";\n\t\t\tvMode = pMode;\n\t\t};\n\t\tvar vControl = this.getChildById(cln,\"PROOFCONTROL\"+this.aQID);\n\t\tthis.hideNode(vControl);\n\t\tvControl = this.getChildById(cln,\"MAINCONTROL\"+this.aQID);\n\t\tthis.hideNode(vControl);\n\t\t//------------------------------\n\t\tvar vSID = pSID || \"_SID\";\n\t\tvar vQID = pQID || \"_QID\"+this.DO+\"thisq_\";\n\t\tvar vThisQ = pThisQ || this.DO+\"thisq\";\n\t\tvar vOut = cln.innerHTML;\n\t\t//---Replace $vQID and $thisq----\n\t\tvOut = this.replaceString(vOut,\"__SID__\",vSID);\n\t\tvOut = this.replaceString(vOut,\"__QID__\",vQID);\n\t\tvOut = this.replaceString(vOut,\"__THISQ__\",vThisQ);\n\t\tvOut = this.replaceString(vOut,\"vRootID,'AUTHORING'\",\"vRootID,'DEFAULT'\");\n\t\t//vOut = this.replaceString(vOut,\"\\t\",\" \");\n\t\tvOut = this.replaceString(vOut,\"\\t\",\"\");\n\t\t//---Remove HTML Comments-------\n\t\t//alert(encodeURI(\"vOut = vOut.replace(/<!--(.*?)-->/gm, \\\"\\\")\"));\n\t\teval(decodeURI(\"vOut%20=%20vOut.replace(/%3C!--(.*?)--%3E/gm,%20%22%22)\"));\n\t\treturn vOut;\n\t};\n //#################################################################\n\t//# Nested: getPossiblePrevNext()\n\t//#################################################################\n\tthis.getPossiblePrevNext = function(pID,pPrevNext) {\n\t\tvar vArr = null;\n\t\tvar vText = vLanguage[\"Option\"]+\" in [\"+this.aMappedID[pID]+\"] \" + vLanguage[\"for\"]+\" \";\n\t\tif (pPrevNext==\"NEXT\") {\n\t\t\tvArr = this.findConnectedSteps([pID],\"NEXT\");\n\t\t\tvText += vLanguage[\"next_n\"];\n\t\t} else {\n\t\t\tvArr = this.findConnectedSteps([pID],\"PREV\");\n\t\t\tvText += vLanguage[\"previous_n\"]\n\t\t};\n\t\tvArr = this.array2mapped(vArr);\n\t\tvText += \" \"+vLanguage[\"Step\"]+\": \";\n\t\tif (vArr.length == 0) {\n\t\t\tvText += vLanguage[\"impossible\"];\n\t\t} else {\n\t\t\tvText +=\"[\"+vArr.join(\",\")+\"] \";\n\t\t};\n\t\t//alert(\"getPossiblePrevNext(\"+pID+\",\"+pPrevNext+\") vText=\"+vText);\n\t\treturn vText;\n\t};\n\t//#################################################################\n\t//# Nested: getUsedCounter(pName)\n\t//#################################################################\n this.getUsedCounter = function (pName,pStep) {\n \tvar vUsed = this.getElementById(pName+this.aQID+pStep);\n\t\treturn parseInt(vUsed.value);\n \t//var vAssUsed = this.getElementById(\"inASSESSMENTUSED\"+this.aQID+vStep);\n\t\t//var vCount = parseInt(vAssUsed.value);\n };\n //#################################################################\n\t//# Nested: getIMathDisplayOption()\n\t//#################################################################\n this.getIMathDisplayOption = function () {\n\t\t//var vDispOpt = this.getElementById(\"imathDISPLAYOPTION\"+this.aQID);\n\t\tvar vDispOpt = this.getIMathById(\"DISPLAYOPTION\");\n\t\treturn vDispOpt.value;\n\t};\n\t//#################################################################\n\t//# Nested: getIMathStepCount()\n\t//#################################################################\n this.getIMathStepCount = function () {\n\t\t//var vStepCount = this.getElementById(\"imathSTEPCOUNT\"+this.aQID);\n\t\tvar vStepCount = this.getIMathById(\"STEPCOUNT\");\n\t\treturn vStepCount.value;\n\t};\n\t//#################################################################\n\t//# Nested: getStepCount()\n\t//#################################################################\n this.getStepCount = function () {\n\t\tvar vStepCount = this.getElementById(\"sSTEPCOUNT\"+this.aQID);\n\t\t//var vStepCount = this.getElementById(\"imathSTEPCOUNT\");\n\t\treturn parseInt(vStepCount.value+\"\");\n\t};\n\t//#################################################################\n\t//# Nested: getIndex4ID(pID)\n\t//#################################################################\n this.getID4Step = function (pStep) {\n \tvar i = this.aStep2Index[pStep];\n \tvar vReturn = \"UNDEF\";\n \tif (i) {\n \t\tvReturn = this.aIndex2ID[i];\n \t};\n \treturn vReturn;\n };\n //#################################################################\n\t//# Nested: getIndex4ID(pID)\n\t//#################################################################\n this.getIndex4ID = function (pID) {\n \tvar vReturn = this.aID2Index[vID];\n \tif (!vReturn) {\n \t\t//alert(\"getIndex4ID() -eproofmeth1.js:317 - search necessary\")\n \t\tvReturn = this.getIndex4IDsearch(vID)-1;\n \t};\n \treturn vReturn;\n };\n //#################################################################\n\t//# Nested: getIndex4IDsearch(pID)\n\t//#################################################################\n this.getIndex4IDsearch = function (pID) {\n \tvar vSA = this.getAllSteps(\"SCAN\");\n \tvar i = 0;\n\t\tvar vReturn = -1;\n\t\t//alert(\"getIndex4ID('\"+pID+\"') Step=\"+vStep+\" for ID=\"+pID);\n\t\tif (pID == \" \") {\n\t\t\tvReturn = 0;\n\t\t} else while (i != vSA.length) {\n\t\t\tvar vNode = this.getChildByClassName(vSA[i],\"inSTEPID\"+this.aQID);\n\t\t\tif (vNode) {\n\t\t\t\tif (vNode.value == pID) vReturn = i+1;\n\t\t\t} else {\n\t\t\t\talert(\"getIndex4ID() - inSTEPID for \"+vSA[i].id+\" not defined\");\n\t\t\t};\n\t\t\ti++;\n\t\t}\n\t\tif (vReturn == -1) {\n\t\t\talert(\"ERROR: getIndex4ID(\"+pID+\") - no step found for ID=[\"+this.aMappedID[pID]+\"]\");\n\t\t};\n\t\treturn vReturn;\n\t};\n\t//#################################################################\n\t//# Nested: getIndex4Step(pStep)\n\t//#################################################################\n this.getIndex4Step = function (pStep) {\n\t\t// this.aStep2SA\t \t = new Array(); // Hash with Step Number to StudentAnswer\n\t\t// this.aIndex2Step \t = new Array();\n\t\t// this.aStep2Index \t = new Array();\n\t\t// this.aIndex2ID = new Array();\n\t\t// this.aID2Index = new Array();\n\t\treturn this.aStep2Index[pStep];\n\t};\n\t//#################################################################\n\t//# Nested: getIndex4StepSearch(pStep)\n\t//#################################################################\n this.getIndex4StepSearch = function (pStep) {\n \tvar vPosNode = this.getElementById(\"oldPOSITION\"+this.aQID+pStep);\n\t\tvar vIndex = -1;\n\t\tif (vPosNode) {\n\t\t\tvIndex = vPosNode.value;\n\t\t} else if (pStep==0) {\n\t\t\tvIndex = 0;\n\t\t} else {\n\t\t\talert(\"getIndex4Step() oldPOSITION for \"+pStep+\" undefined\");\n\t\t};\n \t\treturn vIndex;\n };\n\t//#################################################################\n\t//# Nested: getKeys4Array(pAssArray)\n\t//#################################################################\n\tthis.getKeys4Array = function(pAssArray) {\n\t\tvar vKeyArray = new Array();\n\t\tfor (key in pAssArray) {\n\t\t\tvKeyArray.push(key)\n\t\t};\n\t\treturn vKeyArray;\n\t};\n\t//#################################################################\n\t//# Nested: getQueryHash()\n\t//#################################################################\n\tthis.getQueryHash = function () {\n\t\tvar vQuery = new Array();\n\t\tvar query = window.location.search.substring(1);\n\t\t//alert(\"getQueryHash()\"+this.CR+query);\n\t\tvar vars = query.split(\"&\");\n\t\tvar i=0;\n\t\twhile(this.lower(i,vars.length)) {\n\t\t\t//split var name and assigned values at \"=\"\n\t\t\tvar pair = vars[i].split(\"=\");\n\t\t\tvQuery[pair[0]] = decodeURIComponent(pair[1]);\n\t\t\ti++;\n\t\t};\n\t\treturn vQuery;\n\t};\n //#################################################################\n\t//# Nested: getQuery2Settings()\n\t//#################################################################\n\tthis.getQuery2Settings = function (pSettings) {\n\t\t// This function is anonymous, is executed immediately and\n\t\t// the return value is assigned to QueryString!\n\t\tvar vQueryString = this.getQueryHash();\n\t\tfor (var key in vQueryString) {\n\t\t\tpSettings[key] = vQueryString[key]+\"\";\n\t\t};\n\t};\n //#################################################################\n\t//# Nested: getStep(pChildSA)\n\t//#################################################################\n\tthis.getStep = function (pChildSA) {\n\t\t//alert(\"getStep()-Call: pChildSA.id=\"+pChildSA.id);\n\t\treturn pChildSA.getAttribute(\"step\");\n\t};\n\t//#################################################################\n\t//# Nested: getStep4ID(pID)\n\t//#################################################################\n this.getStep4ID = function (pID) {\n\t\t// this.aStep2SA\t \t = new Array(); // Hash with Step Number to StudentAnswer\n\t\t// this.aIndex2Step \t = new Array();\n\t\t// this.aStep2Index \t = new Array();\n\t\t// this.aIndex2ID = new Array();\n\t\t// this.aID2Index = new Array();\n\t var i = this.aID2Index[pID];\n\t return this.aIndex2Step[i];\n };\n //#################################################################\n\t//# Nested: getStep4IDsearch(pID)\n\t//#################################################################\n this.getStep4IDsearch = function (pID) {\n \t\tvar vSA = this.getAllSteps();\n \tvar i = 0;\n\t\tvar vReturn = -1;\n\t\tif (pID == \" \") {\n\t\t\t//alert(\"getIndex4ID('\"+pID+\"') Step=\"+vStep+\" for ID=\"+pID);\n\t\t\tvReturn = 0;\n\t\t} else while (i != vSA.length) {\n\t\t\tvar vNode = this.getChildByClassName(vSA[i],\"inSTEPID\"+this.aQID);\n\t\t\tif (vNode) {\n\t\t\t\tif (vNode.value == pID) vReturn = vNode.getAttribute(\"step\");\n\t\t\t} else {\n\t\t\t\talert(\"getIndex4ID() - inSTEPID for \"+vSA[i].id+\" not defined\");\n\t\t\t};\n\t\t\ti++;\n\t\t}\n\t\tif (vReturn == -1) alert(\"ERROR: getStep4ID('\"+pID+\"') Step for ID not found!\");\n \t\treturn vReturn;\n };\n\t//#################################################################\n\t//# Nested: getStep4Index(pIndex)\n\t//#################################################################\n\tthis.getStep4Index = function (pIndex) {\n\t\t// this.aStep2SA\t \t = new Array(); // Hash with Step Number to StudentAnswer\n\t\t// this.aIndex2Step \t = new Array();\n\t\t// this.aStep2Index \t = new Array();\n\t\t// this.aIndex2ID = new Array();\n\t\t// this.aID2Index = new Array();\n\t\treturn this.aIndex2Step[pIndex];\n\t};\n\t//#################################################################\n\t//# Nested: getStep4IndexSearch(pIndex)\n\t//#################################################################\n\tthis.getStep4IndexSearch = function (pIndex) {\n\t\t//alert(\"getStep4Index()-Call: pIndex=\"+pIndex);\n\t\tvar vStepList = this.getElementsByClassName(\"STEPNR\"+this.aQID);\n\t\tvar vStep = -1;\n\t\tif (vStepList[pIndex]) {\n\t\t\tvStep = vStepList[pIndex].value;\n\t\t} else {\n\t\t\talert(\"getStep4Index()-Call: pIndex=\"+pIndex+\" STEPNR was undefined\");\n\t\t};\n\t\treturn vStep;\n\t};\n\t//#################################################################\n\t//# Nested: getStep4Indexsearch(pIndex)\n\t//#################################################################\n\tthis.getStep4Index = function (pIndex) {\n\t\t//alert(\"getStep4Index()-Call: pIndex=\"+pIndex);\n\t\tvar vStepList = this.getElementsByClassName(\"STEPNR\"+this.aQID);\n\t\tvar vStep = -1;\n\t\tif (vStepList[pIndex]) {\n\t\t\tvStep = vStepList[pIndex].value;\n\t\t} else {\n\t\t\talert(\"getStep4Index()-Call: pIndex=\"+pIndex+\" STEPNR was undefined\");\n\t\t};\n\t\treturn vStep;\n\t};\n\t//#################################################################\n\t//# Nested: getSugCon(pID)\n\t//#################################################################\n\tthis.getSugCon = function (pID) {\n\t\tvar vReturn = \"\";\n\t\tif (this.aID2Solutions) {\n\t\t\tvar Arr = new Array();\n\t\t\t// PrevID | ID | Con | JustArray | OptJustArray\n\t\t\t//alert(\"getSugCon(pID) [\"+pID+\"]\");\n\t\t\tvar aID = new Array();\n\t\t\tif (this.aID2Solutions[pID]) {\n\t\t\t\taID = this.aID2Solutions[pID][\"NEXT_REC\"];\n\t\t\t} else {\n\t\t\t\t//alert(\"getSugCon(pID) no records in this.aID2Solutions for [\"+pID+\"]\");\n\t\t\t};\n\t\t\tvar k=0;\n\t\t\tvar i=0;\n\t\t\tvar vCon = \"\";\n\t\t\t//alert(\"getSugCon('\"+pID+\"') - this.aSolution.length=\"+this.aSolution.length);\n\t\t\t//alert(\"getSugCon('\"+pID+\"') - Length of Solution Records for [\"+pID+\"] is aID.length=\"+aID.length);\n\t\t\twhile (k != aID.length) {\n\t\t\t\ti = aID[k];\n\t\t\t\tvCon = this.aSolution[i][2];\n\t\t\t\t//alert(\"Connection found in Solution with vCon=\"+vCon);\n\t\t\t\tvCon = this.vConnectionArray[vCon];\n\t\t\t\tArr[vCon] = vCon;\n\t\t\t\tk++;\n\t\t\t};\n\t\t\tvReturn = this.hash2list(Arr);\n\t\t} else {\n\t\t\talert(\"getSugCon('\"+pID+\"')-Call aID2Solutions not defined\");\n\t\t};\n\t\treturn vReturn;\n\t};\n\t//#################################################################\n\t//# Nested: getSugID(pID)\n\t//#################################################################\n\tthis.getSugID = function (pID) {\n\t\tvar vReturn = \"\";\n\t\tif (this.aID2Solutions) {\n\t\t\tvar Arr = new Array();\n\t\t\t// PrevID | ID | Con | JustArray | OptJustArray\n\t\t\t//this.aID2Solutions[pID][\"PREV\"].push(new Array(vPrevID,i));\n\t\t\t//alert(\"getSugID(pID) [\"+pID+\"]\");\n\t\t\tvar aID = new Array();\n\t\t\tif (this.aID2Solutions[pID]) {\n\t\t\t\taID = this.aID2Solutions[pID][\"NEXT\"];\n\t\t\t};\n\t\t\tvReturn = aID.join(\",\")\n\t\t} else {\n\t\t\talert(\"getSugID('\"+pID+\"')-Call aID2Solutions not defined\");\n\t\t};\n\t\treturn vReturn;\n\t};\n\t//#################################################################\n\t//# Nested: getSugJust(pID)\n\t//#################################################################\n\tthis.getSugJust = function (pID) {\n\t\tvar vReturn = \"\";\n\t\tif (this.aSolution) {\n\t\t\tvar Arr = new Array();\n\t\t\t// PrevID | ID | Con | JustArray | OptJustArray\n\t\t\tvar aID = new Array();\n\t\t\tvar i=0;\n\t\t\tvar vCon = \"\";\n\t\t\twhile (i != this.aSolution.length) {\n\t\t\t\tif (this.aSolution[i][1] == pID) {\n\t\t\t\t\tvJust = this.aSolution[i][3];\n\t\t\t\t\t//alert(\"vJust.length=\"+vJust.length);\n\t\t\t\t\tArr = this.unionarrays(vJust,Arr);\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t\t};\n\t\t\tvReturn = Arr.join(\",\");\n\t\t} else {\n\t\t\talert(\"getSugJust('\"+pID+\"')-Call aSolution not defined\");\n\t\t};\n\t\treturn vReturn;\n\t};\n\t//#################################################################\n\t//# Nested: getSugNextJust(pID)\n\t//#################################################################\n\tthis.getSugNextJust = function (pID) {\n\t\tvar vReturn = \"\";\n\t\tif (this.aID2Solutions) {\n\t\t\tvar Arr = new Array();\n\t\t\t// [0 ]PrevID | [1] ID | [2] Con | [3] JustArray | [4] OptJustArray\n\t\t\t//this.aID2Solutions[pID][\"PREV\"].push(new Array(vPrevID,i));\n\t\t\t//this.aID2Solutions[vPrevID][\"NEXT\"].push(new Array(vID,i));\n\t\t\t//alert(\"getSugCon(pID) [\"+pID+\"]\");\n\t\t\tvar aID = new Array();\n\t\t\tif (this.aID2Solutions[pID]) {\n\t\t\t\taID = this.aID2Solutions[pID][\"NEXT_REC\"];\n\t\t\t};\n\t\t\tvar k=0;\n\t\t\tvar i=0;\n\t\t\tvar vCon = \"\";\n\t\t\twhile (k != aID.length) {\n\t\t\t\ti = aID[k];\n\t\t\t\tvJust = this.aSolution[i][3];\n\t\t\t\t//alert(\"vJust.length=\"+vJust.length);\n\t\t\t\tArr = this.unionarrays(vJust,Arr);\n\t\t\t\tk++;\n\t\t\t};\n\t\t\tvReturn = Arr.join(\",\");\n\t\t} else {\n\t\t\talert(\"getSugJust('\"+pID+\"')-Call aID2Solutions not defined\");\n\t\t};\n\t\treturn vReturn;\n\t};\n\t//#################################################################\n\t//# Nested: getTemplateDOM()\n\t//#################################################################\n\tthis.getTemplateDOM = function () {\n\t\t//var vUsedList = this.getChildrenByClassName(this.aUsedDOM,\"inSTEPID\"+this.aQID);\n\t\tvar vRes = this.aTemplateDOM;\n\t\tif (!vRes) {\n\t\t\tvRes = document.getElementById(this.aTemplateID);\n\t\t\tif (vRes) {\n\t\t\t\talert(\"this.getTemplateDOM() Template found with ID=\"+vRes.id);\n\t\t\t\tthis.aTemplateDOM = vRes;\n\t\t\t} else {\n\t\t\t\talert(\"loading Template with this.getTemplateDOM() was not sucessful!\");\n\t\t\t};\n\t\t}\n\t\treturn vRes;\n\t};\n\t//#################################################################\n\t//# Nested: getUsedIDs()\n\t//#################################################################\n\tthis.getUsedIDs = function () {\n\t\t//var vUsedList = this.getChildrenByClassName(this.aUsedDOM,\"inSTEPID\"+this.aQID);\n\t\tvar vUsedList =this.getUsed4DOM(\"inSTEPID\");\n\t\tvar k=0;\n\t\tvar vUsedIDs = new Array();\n\t\tvar vID = \"\";\n\t\twhile (k != vUsedList.length) {\n\t\t\tvID = vUsedList[k].value;\n\t\t\tvUsedIDs.push(vID);\n\t\t\tk++;\n\t\t}\n\t\treturn vUsedIDs;\n\t};\n\t//#################################################################\n\t//# Nested: getUsedSteps()\n\t//#################################################################\n\tthis.getUsedSteps = function (pSCAN) {\n\t\tif ((!this.aUsedSteps) || (pSCAN)) {\n\t \t\tthis.aUsedDOM = this.getElementById(\"USEDSTEPS\"+this.aQID);\n\t\t\tthis.aUsedSteps = this.getChildrenByClassName(this.aUsedDOM,\"STUDENTANSWER\"+this.aQID);\n\t\t};\n\t\treturn this.aUsedSteps;\n\t\t//this.getChildrenByClassName(this.aUsedDOM,\"STUDENTANSWER\"+this.aQID);\n\t};\n\t//#################################################################\n\t//# Nested: getUnusedSteps()\n\t//#################################################################\n\tthis.getUnusedSteps = function (pSCAN) {\n\t\tif ((!this.aUnusedSteps) || (pSCAN)) {\n\t\t\tthis.aUnusedDOM = this.getElementById(\"UNUSEDSTEPS\"+this.aQID);\n\t\t\tthis.aUnusedSteps = this.getChildrenByClassName(this.aUnusedDOM,\"STUDENTANSWER\"+this.aQID);\n\t\t\t//alert(\"getUnusedSteps() length=\"+this.aUnusedSteps.length);\n\n\t\t}\n\t\treturn this.aUnusedSteps;\n\t\t//this.getChildrenByClassName(this.aUnusedDOM,\"STUDENTANSWER\"+this.aQID);\n\t};\n\t//#################################################################\n\t//# Nested: getUsed4DOM(pName)\n\t//#################################################################\n\tthis.getUsed4DOM = function (pName) {\n\t\treturn this.getChildrenByClassName(this.aUsedDOM,pName+this.aQID);\n\t};\n\t//#################################################################\n\t//# Nested: getUsedCount(pStep,pName)\n\t//#################################################################\n\tthis.getUsedCount = function (pStep,pName) {\n\t\tvar vNode = this.getElementById(pName+this.aQID+pStep);\n\t\t//alert(pName +\"=\"+vNode.value)\n\t\tvar vCount = parseInt(vNode.value);\n\t\treturn vCount;\n\t};\n\t//#################################################################\n\t//# Nested: getWeeblyEProof()\n\t//#################################################################\n\tthis.getWeeblyEProof = function(pLibPath,pMathJaxPath,pMathJaxConfig,pQID,pThisQ,pSID,pAuthoring,pRootID) {\n\t\tvar vInsertLibs = true;\n\t\tif (pRootID) {\n\t\t\tvInsertLibs = false;\n\t\t};\n\t\tvar vQID = pQID || \"__QID__\";\n\t\tvar vThisQ = pThisQ || \"__THISQ__\";\n\t\tvar vSID = pSID || \"__SID__\";\n\t\tvar vAuthoring = pAuthoring || \"DEFAULT\";\n\t\tvar vLoadXML = this.getChildById(this.aRootDOM,\"tLOAD\"+this.aQID);\n\t\t//var vLibPath = pLibPath || \"http://math.uni-landau.de/javascript/eProofJS/library/\";\n\t\t// In Weebly local theme files are referenced\n\t\t//<script type=\"text/javascript\" src=\"/files/theme/plugin.js\" ></script>\n\t\t//<script type=\"text/javascript\" src=\"/files/theme/mobile.js\" ></script>\n\t\t//<script type=\"text/javascript\" src=\"/files/theme/custom.js\" ></script>\n\t\tvar vLibPath = pLibPath || \"/files/theme/\";\n\t\tvar vMathJaxPath = pMathJaxPath || \"http://cdn.mathjax.org/mathjax/latest/\";\n\t\tvar vMathJaxConfig = pMathJaxConfig || \"AM_HTMLorMML\";\n\t\tif (pMathJaxConfig.toUpperCase() == \"LATEX\") {\n\t\t\t// LaTeX-Config: TeX-AMS-MML_HTMLorMML\n\t\t\tvMathJaxConfig = \"TeX-AMS-MML_HTMLorMML\";\n\t\t} else if (pMathJaxConfig.toUpperCase() == \"ASCIIMATH\") {\n\t\t\t// ASCII-Math Config: AM_HTMLorMML\n\t\t\tvMathJaxConfig = \"AM_HTMLorMML\";\n\t\t};\n\t\tvar cln = this.getIMathEProofClone(vLoadXML.value,pRootID);\n\t\t//this.getIMathEProofAnswerBox(cln);\n\t\tcln = this.getIMathEProofClearSteps(cln);\n\t\tvar vReturn = \"\";\n\t\tif (vInsertLibs) {\n\t\t\tvar vStartJS = this.LT+\"script type=\\\"text/javascript\\\" src=\\\"\";\n\t\t\tvar vEndJS = \"\\\"\"+this.GT+this.LT+\"/script\"+this.GT+this.CR;\n\t\t\tvReturn += vStartJS + vLibPath +\"language.js\" + vEndJS;\n\t\t\tvReturn += vStartJS + vLibPath +\"eproofmain.js\" + vEndJS;\n\t\t\tvReturn += vStartJS + vLibPath +\"eproofmeth1.js\" + vEndJS;\n\t\t\tvReturn += vStartJS + vLibPath +\"eproofmeth2.js\" + vEndJS;\n\t\t\t//Path: \"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=AM_HTMLorMML\"\n\t\t\tvReturn += vStartJS + vMathJaxPath + \"MathJax.js?config=\" + vMathJaxConfig + vEndJS;\n\t\t\t//vReturn += this.LT+\"script src=\\\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=AM_HTMLorMML\\\"\"+this.GT+\"\"+this.LT+\"/script\"+this.GT+this.CR;\n\t\t\t//vReturn += this.getIMathEProofInnerHTML(cln,\"_WEB\",\"__THISQ__\",\"_SID\");\n\t\t} else {\n\t\t\tvReturn += this.LT + \"html id='HTMLROOT'\"+ this.GT;\n\t\t};\n\t\tvReturn += this.getIMathEProofInnerHTML(cln,vQID,vThisQ,vSID,vAuthoring);\n\t\tif (!vInsertLibs) {\n\t\t\tvReturn += this.LT + \"/html\"+ this.GT;\n\t\t};\n\t\treturn vReturn;\n\t};\n\t//#################################################################\n\t//# Nested: getWrappedHTML(pString)\n\t//#################################################################\n\tthis.getWrappedHTML = function(pString)\n\t{\n\t\tvar vDate = new Date().toLocaleString();\n\t\t//pString = pString.replace(/__DATE__/g,vDate);\n\t\tvar vHTML = this.LT+\"HTML\"+this.GT+this.CR;\n\t\tvHTML += \" \"+this.LT+\"HEAD\"+this.GT+this.CR;\n\t\tvHTML += \" \"+this.LT+\"META http-equiv='Content-Type' content='text/html\"+this.CO+\" charset=UTF-8'\"+this.GT+this.CR;\n\t\tvHTML += \" \"+this.LT+\"META name='eproof-create-date' content='\"+vDate+\"'\"+this.GT+this.CR;\n\t\tvHTML += \" \"+this.LT+\"/HEAD\"+this.GT+this.CR;\n\t\tvHTML += \" \"+this.LT+\"BODY\"+this.GT+this.CR;\n\t\tvHTML += pString;\n\t\tvHTML += \" \"+this.LT+\"/BODY\"+this.GT+this.CR;\n\t\tvHTML += this.LT+\"/HTML\"+this.GT;\n\t\treturn vHTML;\n\t};\n\n\t//#################################################################\n\t//# Nested: hash2list(pHash)\n\t//#################################################################\n\tthis.hash2list = function (pHash) {\n\t\tvar vReturn = \"\";\n\t\tvar vComma=\"\";\n\t\tfor (var iID in pHash) {\n\t\t\tvReturn += vComma+pHash[iID];\n\t\t\tvComma=\",\";\n\t\t}\n\t\treturn vReturn;\n\t};\n\t//#################################################################\n\t//# Nested: initCharCounter()\n\t//#################################################################\n\tthis.initCharCounter = function () {\n\t\t//this.aCharCounter = Hash for Leader Chars e.g. \"P\" CharCounter=4 creates \"P4\"\n\t\tfor (var iChar in this.aCharCounter) {\n\t\t\tthis.aCharCounter[iChar] = 0;\n\t\t};\n\t};\n\t//#################################################################\n\t//# Nested: initExportHashSA(pHash)\n\t//#################################################################\n\tthis.initExportHashSA = function (pHash) {\n\t\tvar i = 0;\n\t\tvar vSAF = this.aStudAnsFormat;\n\t\twhile (this.lower(i,vSAF.length)) {\n\t\t\tpHash[vSAF[i]] = \"\";\n\t\t\ti++;\n\t\t};\n\t\tpHash[\"SUGUSED\"] = \"0\";\n\t\tpHash[\"ASSUSED\"] = \"0\";\n\t};\n\t//#################################################################\n\t//# Nested: iMathForm_loaded()\n\t//#################################################################\n\tthis.iMathForm_loaded = function () {\n\t\tvar vRet = false;\n \tif (this.aOffline == \"0\") {\n \t\tvRet = true;\n\t\t};\n\t\treturn vRet;\n\t};\n\t//#################################################################\n\t//# Nested: iMathForm_loaded()\n\t//#################################################################\n\tthis.X_iMathForm_loaded = function () {\n\t\tvar vRet = false;\n \tvar vPreconNode = this.getChildById(this.aRootDOM,\"imathPRECONDITION\");\n \tif (vPreconNode) {\n \t\tvar vPreconIMathAS = vPreconNode.value;\n\t\t\tvPreconIMathAS = vPreconIMathAS.replace(/\\s/g,\"\");\n\t\t\tif (this.greater(vPreconIMathAS.lastIndexOf(this.aSeparator),0)) {\n\t\t\t\tvRet = true;\n\t\t\t};\n\t\t};\n\t\treturn vRet;\n\t};\n\t//#################################################################\n\t//# Nested: intersectionarrays\n\t//# intersectarrays(array,array): Finds the intersection of two arrays\n\t//#################################################################\n\tthis.intersectionarrays = function (x,y) {\n\t\tvar reshash=[], res=[];\n\t\tvar i=0;\n\t\twhile (i != x.length) {\n\t\t\treshash[x[i]]=true;\n\t\t\ti++;\n\t\t};\n\t\ti=0;\n\t\twhile (i != y.length) {\n\t\t\tif(reshash[y[i]]) res.push(y[i]);\n\t\t\ti++;\n\t\t};\n\t\treturn res;\n\t};\n\t//#################################################################\n\t//# Nested: isSettingExportID(piID)\n\t//#################################################################\n\tthis.isSettingExportID = function (piID) {\n\t\tvar vReturn = true;\n\t\tif (piID == \"randomize_done\") {\n\t\t\tvReturn = false\n\t\t} else if (piID == \"ThisQ\") {\n\t\t\tvReturn = false\n\t\t};\n\t\treturn vReturn;\n\t};\n\t//#################################################################\n\t//# Nested: list2mapped(pList)\n\t//#################################################################\n\tthis.list2mapped = function (pList) {\n\t\tvar vRes = [];\n\t\tif (pList) vRes = pList.split(\",\");\n\t\tvRes = this.array2mapped(vRes);\n\t\treturn vRes.join(\",\");\n\t};\n\t//#################################################################\n\t//# Nested: list2original(pList)\n\t//#################################################################\n\tthis.list2original = function (pList) {\n\t\tvar vRes = [];\n\t\tif (pList) vRes = pList.split(\",\");\n\t\tvRes = this.array2original(vRes);\n\t\treturn vRes.join(\",\");\n\t};\n\t//#################################################################\n\t//# Method: list2IMathAS(pList)\n\t//#################################################################\n\tthis.list2IMathAS = function (pList) {\n\t\tif (pList != \"\") pList = (pList.split(\",\")).join(this.aComma);\n\t\treturn pList;\n\t};\n\t//#################################################################\n\t//# Method:loadSettingsVar(pName,pValue)\n\t//#################################################################\n\tthis.loadSettingsVar = function (pName,pValue) {\n\t\tpName = pName.toUpperCase();\n\t\tif (pName == \"TITLE\") pName = \"THEOREM_TITLE\";\n\t\tfor (var iName in this.aSettings) {\n\t\t\tif (iName.toUpperCase() == pName) {\n\t\t\t\tthis.aSettings[iName] = pValue;\n\t\t\t}\n\t\t}\n\t};\n\t//#################################################################\n\t//# Method:loadDisplayOption()\n\t//#################################################################\n\tthis.loadDisplayOption = function () {\n\t\tthis.getElementById(\"sDISPLAYOPTION\"+this.aQID).value = this.getElementById(\"imathDISPLAYOPTION\").value;\n\t};\n\t//#################################################################\n\t//# Nested: loadStepInnerHTML(pID,pStepDefRaw)\n\t//#################################################################\n\tthis.loadStepInnerHTML = function (pStepRoot,pID,pStepDefRaw) {\n\t\tvar vName = \"SOURCE\"+this.aQID+\"-\"+pID;\n\t\tvar vSourceNode = this.getChildById(pStepRoot,\"SOURCE\"+this.aQID+\"-\"+pID);\n\t\t//var vSourceNode = null;\n\t\t//alert(\"loadStepInnerHTML() pStepRoot.id=\"+pStepRoot.id);\n\t\tvar vReturn = \"\";\n\t\tif (vSourceNode) {\n\t\t\t//alert(\"load InnerHTML form SOURCE\"+this.aQID+\"-\"+pID+this.CR+vSourceNode.innerHTML);\n\t\t\tvReturn = vSourceNode.innerHTML;\n\t\t} else {\n\t\t\tpStepDefRaw = this.decodeTextarea(pStepDefRaw);\n\t\t\t//alert(pStepRoot.id);\n\t\t\t//alert(\"loadStepInnerHTML() create DIV for SOURCE\"+this.aQID+\"-\"+pID+this.CR+pStepDefRaw);\n\t\t\tvar vIDNode = document.createElement(\"DIV\");\n\t\t\tvIDNode.id = vName;\n\t\t\tvar t = document.createTextNode(pStepDefRaw); // Create a text node\n\t\t\tvIDNode.appendChild(t); // Append the text to <DIV>\n\t\t\tpStepRoot.appendChild(vIDNode);\n\t\t\tif (this.onLoadAMprocess) {\n\t\t\t\tthis.processMathNode(vIDNode);\n\t\t\t};\n\t\t\tvReturn = vIDNode.innerHTML;\n\t\t\tthis.aAllID2Node[pID] = vIDNode;\n\t\t\t//vReturn = this.decodeTextarea(pStepDefRaw);\n\t\t};\n\t\treturn vReturn\n\t};\n\t//#################################################################\n\t//# Nested: newCharCounter(pChar)\n\t//#################################################################\n\tthis.newCharCounter = function (pChar) {\n\t\tif (this.aCharCounter[pChar]) {\n\t\t\tthis.aCharCounter[pChar]++;\n\t\t} else {\n\t\t\tthis.aCharCounter[pChar] = 1;\n\t\t};\n\t\treturn this.aCharCounter[pChar];\n\t};\n\t//#################################################################\n\t//# Nested: renameCharCounter1()\n\t//#################################################################\n\tthis.renameCharCounter1 = function () {\n\t\t//this.aCharCounter = Hash for Leader Chars e.g. \"P\" CharCounter=4 creates \"P4\"\n\t\tvar vOrgID = \"\";\n\t\tfor (var iChar in this.aCharCounter) {\n\t\t\tif (this.aCharCounter[iChar] == 1) {\n\t\t\t\t//--- if aCharCounter is 1 max rename AG1 to AG ----\n\t\t\t\tvOrgID = this.renameMappedID(iChar+\"1\",iChar);\n\t\t\t};\n\t\t};\n\n\t};\n\t//#################################################################\n\t//# Nested: renameMappedID(pOldID,pNewID)\n\t//#################################################################\n\tthis.renameMappedID = function (pOldID,pNewID) {\n\t\t//alert(\"Rename Mapped ID=[\"+pOldID+\"] to [\"+pNewID+\"]\");\n\t\tvar vOrgID = this.renameCheckMappedID(pOldID,pNewID);\n\t\tif (vOrgID != \"\") {\n\t\t\tthis.redefinedMappedID(vOrgID,pNewID);\n\t\t}\n\t};\n\t//#################################################################\n\t//# Nested: renameCheckMappedID(pOldID,pNewID)\n\t//#################################################################\n\tthis.renameCheckMappedID = function (pOldID,pNewID) {\n\t\tvar vOrgID = \"\";\n\t\tvar vNewID_exists = false;\n\t\tvar vNo_OldID = true;\n\t\tfor (var iID in this.aMappedID) {\n\t\t\tif (pOldID == this.aMappedID[iID]) {\n\t\t\t\tvOrgID = iID;\n\t\t\t\tvNo_OldID = false;\n\t\t\t};\n\t\t\tif (pNewID == this.aMappedID[iID]) {\n\t\t\t\tvNewID_exists = true;\n\t\t\t};\n\t\t};\n\t\tif (vNewID_exists) {\n\t\t\talert(\"renameMappedID('\"+pOldID+\"','\"+pNewID+\"') was not sucessful, because [\"+pNewID+\"] exists as ID\");\n\t\t} else if (vNo_OldID) {\n\t\t\talert(\"renameMappedID('\"+pOldID+\"','\"+pNewID+\"') was not sucessful, because [\"+pOldID+\"] does not exist!\");\n\t\t};\n\t\treturn vOrgID;\n\t};\n //#################################################################\n\t//# Nested: renameCharID(pID,pNewChar)\n\t//#################################################################\n\tthis.renameCharID = function (pID,pNewChar) {\n\t\talert(\"Rename CharID ID=[\"+pID+\"] with MappedID=[\"+this.aMappedID[pID]+\"] to ID with Char=\"+pNewChar);\n\t\tvChar = this.createChar4ID(pID);\n\t\tif (vChar != pNewChar) {\n\t\t\talert(\"perform renameCharID() for pNewChar='\"+pNewChar+\"'\");\n\t\t};\n\t\t//vMappedID = vChar+this.newCharCounter(vChar);\n\t\t//this.aMappedID[vID] = vMappedID;\n\t\t//this.aOriginalID[vMappedID] = vID;\n\t};\n\t//#################################################################\n\t//# Nested: parseScore(pString)\n\t//#################################################################\n\tthis.parseScore = function(pString) {\n\t\tvar x = parseFloat(pString);\n\t\treturn Math.round(x*100)/100;\n\t};\n //#################################################################\n\t//# Nested: parseSettingsString()\n\t//#################################################################\n\tthis.parseSettingsString = function (pString) {\n\t\t//alert(\"parseSettingsString()-Call\");\n\t\t//this.aSettings = new Array();\n\t\t//this.init_settings();\n\t\tvar k = 0;\n\t\tvar vListArray = pString.split(this.CR);\n\t\twhile (k != vListArray.length) {\n\t\t\tif (this.greater(vListArray[k].indexOf(this.aSeparator) , 0)) {\n\t\t\t\tvar vRec = vListArray[k].split(this.aSeparator);\n\t\t\t\tthis.aSettings[vRec[0]] = vRec[1];\n\t\t\t};\n\t\t\tk++;\n\t\t}\n\t};\n\t//#################################################################\n\t//# Nested: parseSettings()\n\t//#################################################################\n\tthis.parseSettings = function () {\n\t\t//alert(\"parseSettings()-Call\");\n\t\tvar vInput = this.getIMathById(\"SETTINGS\").value;\n\t\tif (vInput) {\n\t\t\tthis.parseSettingsString(vInput);\n\t\t};\n\t};\n\t//#################################################################\n\t//# Nested: parseSolution()\n\t//#################################################################\n\tthis.parseSolution = function () {\n\t\t//alert(\"parseSolution()-Call\");\n\t\tvar vInput = this.getIMathById(\"SOLUTION\").value;\n\t\tvar i = 0;\n\t\tif (vInput) {\n\t\t\tvar vListArray = vInput.split(this.CR);\n\t\t\tvar k=0;\n\t\t\tthis.checkSolStep(\" \");\n\t\t\twhile (k != vListArray.length) {\n\t\t\t\tif (this.greater(vListArray[k].indexOf(this.aSeparator) , 0)) {\n\t\t\t\t\tvar vSolStep = new Array();\n\t\t\t\t\tvar vSplitRec = vListArray[k].split(this.aSeparator);\n\t\t\t\t\tif (this.lower(vSplitRec.length,4)) {\n\t\t\t\t\t\talert(\"Length Warning Solution Step: \"+vListArray[k]);\n\t\t\t\t\t};\n\t\t\t\t\tvSplitRec[2] = this.vConnection2Index[vSplitRec[2]];\n\t\t\t\t\tvSplitRec[3] = vSplitRec[3].split(this.aComma);\n\t\t\t\t\tvSplitRec[4] = vSplitRec[4].split(this.aComma);\n\t\t\t\t\tif (!vSplitRec[4]) {\n\t\t\t\t\t\tvSplitRec[4] = new Array();\n\t\t\t\t\t};\n\t\t\t\t\tvSplitRec.push(this.unionarrays(vSplitRec[3],vSplitRec[4]));\n\t\t\t\t\t//----Solution Structure of SplitRec----------------------------------------\n\t\t\t\t\t// [0] PrevID -|- [1] ID -|- [2] Con -|- [3] JustArray -|- [4] OptJustArray [5] JustOK = unionarray of [3] and [4]\n\t\t\t\t\tthis.aSolution.push(vSplitRec);\n\t\t\t\t\tvar vPrevID = vSplitRec[0];\n\t\t\t\t\tvar vID = vSplitRec[1];\n\t\t\t\t\tthis.checkSolStep(vID);\n\t\t\t\t\tthis.checkSolStep(vPrevID);\n\t\t\t\t\tthis.aID2Solutions[vID][\"ASSESS\"].push(i);\n\t\t\t\t\tthis.aID2Solutions[vID][\"PREV\"].push(vPrevID);\n\t\t\t\t\tthis.aID2Solutions[vID][\"PREV_REC\"].push(i);\n\t\t\t\t\tthis.aID2Solutions[vPrevID][\"NEXT\"].push(vID);\n\t\t\t\t\tthis.aID2Solutions[vPrevID][\"NEXT_REC\"].push(i);\n\t\t\t\t\t//--------------------------------------------------------------------------\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\tk++;\n\t\t\t};\n\t\t} else {\n\t\t\talert(\"parseSolution() - No Solution Defined!\");\n\t\t};\n\t\tvar vProofKeys = this.getKeys4Array(this.aID2Solutions);\n\t\tthis.getElementById(\"PROOFIDS\"+this.aQID).value = vProofKeys.join(\",\");\n\t\tthis.getElementById(\"PROOFCOUNT\"+this.aQID).value = vProofKeys.length;\n\t};\n\t//#################################################################\n\t//# Method: parseXML\n\t//# used in Class: XMLparser\n\t//#\n\t//# Comment: if this.aTAG=\"BODY\" then this.aText contains the block\n\t//# between <BODY> and </BODY>. Parsing append all\n\t//# Children to this.aChilden. aTAG=\"\" means block is\n\t//# a string without XML-Tags.\n\t//# created 22.10.2014\n\t//# last modifications 22.10.2014\n\t//#################################################################\n\n\tthis.parseXML = function (pXMLstring) {\n\t\t//----Debugging------------------------------------------\n\t\t// The following alert-Command is useful for debugging\n\t\t//alert(\"XMLparser:1939 parseXML()-Call\")\n\t\t//-------------------------------------------------------\n\t\t//alert(\"parseXML:1941 - pXMLstring=\"+pXMLstring+\"\");\n\t\tif (pXMLstring) {\n\t\t\tthis.aText = pXMLstring;\n\t\t};\n\t\tif (window.DOMParser) {\n\t\t\tparser=new DOMParser();\n\t\t\tthis.aTreeXML = parser.parseFromString(this.aText,\"text/xml\");\n\t\t} else {\n\t\t// Internet Explorer\n\t\t\tthis.aTreeXML = new ActiveXObject(\"Microsoft.XMLDOM\");\n\t\t\tthis.aTreeXML.async=false;\n\t\t\tthis.aTreeXML.loadXML(this.aText);\n\t\t}\n\t};\n\t//----End of Method parse Definition\n\t//#################################################################\n\t//# Nested: randomizeStepOrder()\n\t//#################################################################\n\tthis.randomizeStepOrder = function () {\n\t\t//var vUnusedList = this.getChildrenByClassName(this.aUnusedDOM,\"STUDENTANSWER\"+this.aQID);\n\t\tvar vUnusedList = this.getUnusedSteps();\n\t\t//alert(\"randomizeStepOrder() Unused=\"+vUnusedList.length);\n\t\tvar vPosArr = new Array();\n\t\tvar k=0;\n\t\twhile (k != this.aCount) {\n\t\t\tk++;\n\t\t\tvPosArr.push(k);\n\t\t};\n\t\t//alert(vPosArr.join(\",\"));\n\t\tvPosArr = this.shuffle(vPosArr);\n\t\t//alert(vPosArr.join(\",\"));\n\t\tvar k=0;\n\t\tvar vOldNode = null;\n\t\twhile (k != this.aCount) {\n\t\t\tvOldNode = this.getElementById(\"STUDENTANSWER\"+this.aQID+vPosArr[k]);\n\t\t\tvar vOldParentNode = vOldNode.parentNode;\n \t\t\t//alert(\"vOldNode.id=\"+vOldNode.id+\" vOldPos=\"+vOldPos+\": vOldParentNode.id=\"+vOldParentNode.id);\n\t\t\tvar vRemovedChild = vOldParentNode.removeChild(vOldNode);\n\t \tthis.aUnusedDOM.appendChild(vRemovedChild);\n\t \tk++;\n\t\t};\n\t\t//vUnusedList = this.shuffle(vUnusedList);\n\t};\n\t//#################################################################\n\t//# Nested: rerenderMath()\n\t//#################################################################\n\tthis.rerenderMath = function (pNodeID) {\n\t\tvar vNodeID = \"EPROOF\"+this.aQID;\n\t\tif (pNodeID) vNodeID = pNodeID;\n\t\tif (this.aUseMathJax == \"1\") {\n\t\t\t//MathJax.Hub.Queue([\"Typeset\",MathJax.Hub,vNodeID]);\n\t\t\t//MathJax.Hub.Queue([\"Rerender\",MathJax.Hub,vNodeID]);\n\t\t\t//MathJax.Hub.Queue([\"needsUpdate(\",MathJax.Hub,vNodeID]);\n\t\t};\n\t};\n\t//#################################################################\n\t//# Nested: redefineMappedID(pID,pMappedID)\n\t//#################################################################\n\tthis.redefineMappedID = function (pID,pMappedID) {\n\t\tif (pID) {\n\t\t\tif (this.aMappedID[pID]) {\n\t\t\t\tthis.aMappedID[pID] = pMappedID;\n\t\t\t\tthis.getElementById(\"MAPID-\"+this.aQID+\"-\"+pID).value = pMappedID;\n\t\t\t\tthis.aOriginalID[pMappedID] = pID;\n\t\t\t\tthis.getElementById(\"LIST-ID-\"+this.aQID+\"-\"+pID).innerHTML = \"[\"+pMappedID+\"]\";\n\t\t\t} else {\n\t\t\t\talert(\"redefineMappedID('\"+pID+\"','\"+pMappedID+\"') failed! MappedID for [\"+pID+\"] undefined\");\n\t\t\t}\n\t\t} else {\n\t\t\talert(\"Error: redefineMappedID(pID,'\"+pMappedID+\"') pID was undefined - OrgID=[\"+this.aOriginalID[pMappedID]+\"] eproofmain.js:1020\");\n\t\t};\n\t};\n\t//#################################################################\n\t//# Nested: resetProof(pButtonDOM)\n\t//#################################################################\n\tthis.resetProof = function (pButtonDOM) {\n\t\t//Check = confirm(\"(\"+vLanguage[\"Delete\"].toUpperCase()+\") \"+ vLanguage[\"Reset_Prompt\"] + this.CR + vLanguage[\"Proof\"]+\": \"+this.aSettings[\"Theorem_Title\"]+\"'?\"+this.CR+\"resetProof():1104\");\n\t\tCheck = confirm(\"(\"+vLanguage[\"Delete\"].toUpperCase()+\") \"+ vLanguage[\"Reset_Prompt\"] + this.CR + vLanguage[\"Proof\"]+\": \"+this.aSettings[\"Theorem_Title\"]+\"'?\");\n\t\tif (Check) {\n\t\t\t//alert(vLanguage[\"ProofStep\"]+\" [\"+vNode4ID.value+\"] \"+vLanguage[\"Deleted\"]);\n\t\t\tthis.randomizeStepOrder();\n\t\t\tthis.clearProofInput();\n\t\t\tthis.updateStepCount(0);\n\t\t\tthis.setStepCount(0);\n //this.clear_LocalStorage();\n localStorage.removeItem(\"imathEPROOF\");\n\t\t} else {\n\t\t\talert(vLanguage[\"Cancel\"].toUpperCase()+\": \"+ vLanguage[\"Delete\"] +\"-Operation.\");\n\t\t}\n };\n\t//#################################################\n\t//# Encode Solution\n\t//#################################################\n\tthis.getEncodedSol = function () {\n\t\tvar vInNode = this.getIMathById(\"SOLUTION\");\n\t\treturn this.rotEncode(vInNode.value);\n\t};\n\t//#################################################\n\t//# Encode Score\n\t//#################################################\n\tthis.encodeScore = function (pScore) {\n\t\tfunction ord(x) { return x.charCodeAt(0) }\n\t\tfunction chr(x) { return String.fromCharCode(x) }\n\t\tvar vKey = this.aSettings[\"cryptkey\"];\n\t\tvar vScore = pScore.toFixed(6)+\"\";\n\t\tvar i=0;\n\t\tvar vMax = vScore.length;\n\t\tvar vOut = \"\";\n\t\twhile (i != vMax) {\n\t\t\tvar c = vScore.charCodeAt(i);\n\t\t\tif (chr(c)==\".\") {\n\t\t\t\tvOut += \"A\";\n\t\t\t} else {\n\t\t\t\tvOut += chr(c-ord(\"0\")+ord(\"B\"));\n\t\t\t};\n\t\t\ti++;\n\t\t}\n\t\t//var vInteger = Math.round(pScore*1000);\n\t\t//alert(\"vScore*1000=\"+vInteger);\n\t\t//alert (\"vScore=\"+vScore+\" vOut=\"+vOut+\" Encoded=\"+this.rotEncode(vOut));\n\t\treturn vOut;\n\t};\n\t//#################################################\n\t//# Encode Solution\n\t//#################################################\n\tthis.encodeSol = function () {\n\t\tvar vInNode = this.getIMathById(\"SOLUTION\");\n\t\tvar vOutNode = this.getIMathById(\"ENCRYPTED\");\n\t\tif ((vInNode.value).replace(/\\s/g,\"\")!=\"\") {\n\t\t//if ((vOutNode.value).replace(/\\s/g,\"\")==\"\") {\n\t\t\t//alert(\"Solution Encode: \"+vInNode.value);\n\t\t\tvOutNode.value = this.rotEncode(vInNode.value);\n\t\t};\n\t};\n\t//#################################################\n\t//# Decode Solution\n\t//#################################################\n\tthis.decodeSol = function () {\n\t\tvar vInNode = this.getIMathById(\"ENCRYPTED\");\n\t\tvar vOutNode = this.getIMathById(\"SOLUTION\");\n\t\tif ((vOutNode.value).replace(/\\s/g,\"\")==\"\") {\n\t\t\t//alert(\"Solution Decode: \"+vInNode.value);\n\t\t\tvOutNode.value = this.rotDecode(vInNode.value);\n\t\t};\n\t};\n\t//#################################################\n\t//# Encode Rotation\n\t//#################################################\n\tthis.rotEncode = function (pString) {\n\t\t//pString = \"XY #_AA_#BB #__co__#MY1#__co__#TYP#__co__#CK#_co_#DU#__co__#AK#_co_#P2\";\n\t\t//pString =\" #__co__#MY1#__co__#TYP#__co__#CK#_co_#DU#__co__#AK#_co_#P2\";\n\t\t//pString = \"AAZZ123\";\n\t\tvar vKey = this.aSettings[\"cryptkey\"];\n\t\t//var vReturn = this.vigenere(pString,\"ABC\",\"encode\");\n\t\tvar vReturn = this.vigenere(pString,vKey,\"encode\");\n\t\t//alert(\"Encoded=\"+vReturn + \"\\nDecode=\"+this.vigenere(vReturn,vKey,\"decode\"));\n\t\treturn vReturn;\n\t};\n\t//#################################################\n\t//# Decode Rotation\n\t//#################################################\n\tthis.rotDecode = function (pString) {\n\t\tvar vCharShift = parseInt(this.aSettings[\"rotcount\"]);\n\t\t//return this.rot(pString,-vCharShift)\n\t\tvar vKey = this.aSettings[\"cryptkey\"];\n\t\tvar vReturn = this.vigenere(pString,vKey,\"decode\");\n\t\tvReturn = decodeURI(vReturn);\n\t\treturn vReturn;\n\t};\n\t//#################################################\n\t//# Rot-Encode and Decode of Strings\n\t//# Decode with -pCharShift\n\t//#################################################\n\tthis.rot = function (pString,pCharShift) {\n\t\tvar s = [];\n\t\tvar vMinCode = 32;\n\t\tvar vMaxCode = 126;\n\t\tvar vMod = vMaxCode-vMinCode+1;\n\t\tvar i = 0;\n\t\tvar j = 0;\n\t\twhile (i != pString.length) {\n\t\t\tj = pString.charCodeAt(i);\n\t\t\t//alert(\"(A\"+i+\") pCharShift=\"+pCharShift+\" vSign=\"+vSign+\" pString='\"+pString+\"' Char='\"+j+\"' [\"+s.join('')+\"]\");\n\t\t\tif ((this.greater(j+1,vMinCode)) && (this.lower(j,vMaxCode+1))) {\n\t\t\t\tj = vMinCode + ((j-vMinCode +pCharShift) % vMod);\n\t\t\t};\n\t\t\ts[i] = String.fromCharCode(j);\n\t\t\t//alert(\"(B\"+i+\") Shift=\"+pCharShift+\" pString='\"+pString+\"' Char='\"+j+\"' [\"+s.join('')+\"]\")\n\t\t\ti++;\n\t\t};\n\t\t//alert(\"Decoded=\"+this.rot(s.join(''),-pCharShift));\n\t\treturn s.join('');\n\t};\n\t//#################################################################\n\t//# Nested: saveEProofIMath2Form()\n\t//#################################################################\n\tthis.saveEProofIMath2Form = function() {\n\t\tthis.getElementById(\"tSAVEIMATH\"+this.aQID).value = this.getEProofIMath();\n\t};\n\t//#################################################################\n\t//# Nested: saveStep(pChildSA)\n\t//#################################################################\n\tthis.saveStep = function (pButtonDOM) {\n\t\t//alert(\"saveStep()-Call: pChildSA.id=\"+pChildSA.id+\" Offline=\"+this.aOffline);\n\t\t//this.aStepType4ID = new Array(); //Hash maps ID to StepType PRECONDITION, PROOFSTEP, CONCLUSION, JUSTIFICATION\n\t\t//this.aStep2SA\t \t= new Array(); // Hash with Step Number to StudentAnswer\n\t\t//this.aIndex2Step = new Array();\n\t\t//this.aStep2Index = new Array();\n\t\t//this.aIndex2ID = new Array();\n\t\t//this.aID2Index = new Array();\n\t\tvar vStep = this.getStep(pButtonDOM);\n\t\tthis.saveStepCheck(vStudentAnswerNode,vStep);\n\t\t//var vStudentAnswerNode = this.getParentStudentAnswer(pButtonDOM);\n\t\tvar vStudentAnswerNode = this.aStep2SA[vStep];\n\t\tvar vID = this.aIndex2ID[this.aStep2Index[vStep]];\n\t\tvar vName = \"STEPEDITOR\"+this.aQID;\n\t\tvar vListSE = this.getChildByClassName(vStudentAnswerNode,vName);\n\t\tif (vListSE) {\n\t\t\tthis.toggleNode(vListSE);\n\t\t\t//this.save(pButtonDOM);\n\t\t\tthis.updateIMathById(this.aStepType4ID[vID]);\n\t\t\tvar vOut = this.saveEProof2Form();\n\t\t} else {\n\t\t\talert(\"Error: saveStep()-Call - vListSE undefined\");\n\t\t};\n\t};\n\t//#################################################################\n\t//# Nested: saveStepCheck(pSA,pStep)\n\t//#################################################################\n\tthis.saveStepCheck = function (pSA,pStep) {\n\t\tvar vName = \"taSTEPEDITOR\"+this.aQID+pStep;\n\t\tvar vEditNode = this.getChildById(pSA,vName);\n\t\tif (this.aSettings[\"MathFormat\"] == \"AM_HTMLorMML\") {\n\t\t\tif (vEditNode) {\n\t\t\t\tvar vMathDelimiters = (vEditNode.value).replace(/[^`]/g,\"\");\n\t\t\t\t//alert(\"Mathdelimiter=\"+vMathDelimiters);\n\t\t\t\tif (this.greater((vMathDelimiters.length % 2),0)) {\n\t\t\t\t\talert(\"ERROR in ASCII-Math: Number of Math-Delimiters ` are not even!\");\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\talert(\"ERROR saveStepCheck():1211 EditNode does not exist \");\n\t\t\t};\n\t\t};\n\t};\n\t//#################################################################\n\t//# Nested: selectCheck(pSelectID)\n\t//#################################################################\n\tthis.selectCheck = function (pSelectID) {\n\t\tvar vSelect = this.getElementsByClassName(pSelectID);\n\t\tvar k=0;\n\t\tvar vReturn = \"\";\n\t\tif (vSelect.length != 0) {\n\t\t\twhile (k != vSelect.length ) {\n\t\t\t\tif (vSelect[k].checked) {\n\t\t\t\t\tvReturn =vSelect[k].value;\n\t\t\t\t};\n\t\t\t\tk++;\n\t\t\t};\n\t\t} else {\n\t\t\talert(\"WARNING: selectCheck() - No Select Items available for \"+pSelectID);\n\t\t};\n\t\treturn vReturn;\n\t};\n\t//#################################################################\n\t//# Nested: selectSuggestion(pStep)\n\t//#################################################################\n\tthis.selectSuggestion = function (pStep) {\n\t\tvar vCon = this.getElementById(\"inCONSUGGESTION\"+this.aQID+pStep).value;\n\t\tvar vID = this.getElementById(\"inIDSUGGESTION\"+this.aQID+pStep).value;\n\t\tvar vNextID = this.getElementById(\"NEXT\"+this.aQID+pStep).value;\n\t\tvar vMoveNode = true;\n\t\tif (vID == vNextID) {\n\t\t\tvMoveNode = false;\n\t\t\talert(\"MOVING not necessary in selectSuggestion():1351\");\n\t\t};\n\t\tif (vID == \"\") {\n\t\t\talert(\"WARNING: No Step ID was selected!\"+this.CR+\"selectSuggestion()\");\n\t\t} else if (vCon == \"\") {\n\t\t\talert (\"WARNING: No Connection was selected!\"+this.CR+\"selectSuggestion()\");\n\t\t} else {\n\t\t\t//alert(\"selectSuggestion():1342 find SelNode for vID=[\"+vID+\"]\");\n\t\t\tvar vListSA = document.getElementsByClassName(\"STUDENTANSWER\"+this.aQID);\n\t\t\tvar vSelIndex = 0;\n\t\t\tvar vFound = false;\n\t\t\tvar vSelNode = null;\n\t\t\twhile ((!vFound) && (vSelIndex != vListSA.length)) {\n\t\t\t\tvSelNode = vListSA[vSelIndex];\n\t\t\t\tvar vCheckID = this.getChildByClassName(vSelNode,\"inSTEPID\"+this.aQID).value;\n\t\t\t\tif (vCheckID == vID) {\n\t\t\t\t\tvFound = true;\n\t\t\t\t} else {\n\t\t\t\t\tvSelIndex++\n\t\t\t\t};\n\t\t\t};\n\t\t\t//alert(\"selectSuggestion():1371 SelNode for vID=[\"+vID+\"] vMapID=[\"+this.aMappedID[vID]+\"] found at index=\"+vSelIndex);\n\t\t\t//----END search SelNode -- does not work as subroutine-Call-----\n\t\t\t//var vSelStep = vSelNode.getAttribute(\"step\"); //does not work Offline\n\t\t\tvar vSelStep = this.getChildByClassName(vSelNode,\"STEPNR\"+this.aQID).value;\n\t\t\t//alert(\"selectSuggestion():1375 vSelStep=\"+vSelStep);\n\t\t\tvar vConNode = this.getChildById(vSelNode,\"sCONNECTION\"+this.aQID+vSelStep);\n\t\t\tvar vPosNode = this.getChildById(vSelNode,\"sPOSITION\"+this.aQID+vSelStep);\n\t\t\t//alert(\"vCon=\"+vCon+\" ID=[\"+vCheckID+\"] selectSuggestion(\"+pStep+\") vNewStep=\"+vSelStep);\n\t\t\tif (!vSelNode) {\n\t\t\t\talert(\"vSelNode undefined - selectSuggestion():1357\");\n\t\t\t};\n\t\t\tif (vConNode) {\n\t\t\t\tvConNode.value = vCon;\n\t\t\t} else {\n\t\t\t\talert(\"vConNode undefined - selectSuggestion():1362\");\n\t\t\t\tvCon=1;\n\t\t\t};\n\t\t\tthis.updateConnection(vConNode);\n\t\t\t//---Move selected Node to follwing new Index-----------\n\t\t\tvar vSugNodeIndex = this.getElementById(\"oldPOSITION\"+this.aQID+pStep).value;\n\t\t\tvar vNewIndex = parseInt(vSugNodeIndex+\"\") + 1;\n\t\t\tvar vNewStep = pStep; //this.aIndex2Step[vNewIndex];\n\t\t\t//alert(\"selectSuggestion(\"+pStep+\") vID=[\"+vID+\"] vSelIndex=\"+vSelIndex+\" vNewIndex=\"+vNewIndex);\n\t\t\tvar vIDm = this.aMappedID[vID];\n\t\t\tif (this.lower(vSelIndex,vNewIndex)) {\n\t\t\t\tif (vSelIndex != 0)\t{\n\t\t\t\t\tvar vNew = vNewIndex-1;\n\t\t\t\t\talert(\"WARNING: Step [\"+vIDm+\"] already used at position \"+vSelIndex+\". Step will be moved to positon \"+vNew+\".\");\n\t\t\t\t};\n\t\t\t};\n\t\t\t//--------------------------------------------------------------------\n\t\t\t//---Provide User Feedback for Selected Step--------------------------\n\t\t\t//--------------------------------------------------------------------\n\t\t\talert(vLanguage[\"Suggestion\"]+\" (\"+vNewIndex+\"): \"+this.vConnectionArray[vCon]+\" [\"+vIDm+\"] \");\n\t\t\t//--------------------------------------------------------------------\n\t\t\t//---Now we can move the selected step to the appropriate position----\n\t\t\tvar vUsedList = this.getUsedSteps();\n\t\t\t//alert(\"vSelIndex=\"+vSelIndex+\" vNewIndex=\"+vNewIndex+\" vUsedList.length=\"+vUsedList.length+\" selectSuggestion():1379\");\n\t\t\tif (this.greater(vNewIndex,vUsedList.length) ) {\n\t\t\t\t//alert(\"Append Selected Step [\"+vIDm+\"]\");\n\t\t\t\tvNewIndex = 0;\n\t\t\t};\n\t\t\t//alert(\"selectSuggestion():1384 vCon=\"+vCon+\" vMappedID=\"+this.aMappedID[vID]+\" vSelIndex=\"+vSelIndex+\" vNew=\"+vNewIndex+\" vNewStep=\"+vNewStep);\n\t\t\tif (vMoveNode) {\n\t\t\t\tthis.moveStep(vSelIndex,vNewIndex);\n\t\t\t};\n\t\t\tthis.hide(\"SUGGESTIONS\"+this.aQID+pStep);\n\t\t};\n\t};\n\t//#################################################################\n\t//# Nested: setJustifications(pStep)\n\t//#################################################################\n\tthis.setJustifications = function (pStep) {\n\t\t//---displayJUSTIFICATIONS----\n\t\tvar vID = this.getElementById(\"inSTEPID\"+this.aQID+pStep).value;\n\t\tvar vInJust = this.getElementById(\"inJUSTIFICATION\"+this.aQID+pStep).value;\n\t\t//alert(\"setJustifications(\"+pStep+\") vInJust=\"+vInJust+\" DISPLAY: createJustifications()-Call\");\n\t\tvar vContent = this.createDisplayJustifications(vInJust,this.aMappedID[vID]);\n\t\tthis.getElementById(\"displayJUSTIFICATIONS\"+this.aQID+pStep).innerHTML = vContent;\n\t\tvar vSelJust = this.getElementById(\"selectJUSTIFICATION\"+this.aQID+pStep).value;\n\t\tvar vAppend_Just = this.getElementById(\"appendJUSTIFICATION\"+this.aQID+pStep).value;\n\t\tvar vSelectFromJust = this.concatList(vSelJust,vAppend_Just);\n\t\t//---editJUSTIFICATIONS----\n\t\t//alert(\"setJustifications(\"+pStep+\") vInJust=\"+vInJust+\" CHECKBOX: createJustifications()-Call\");\n\t\tvContent = this.createJustifications(vInJust,vSelectFromJust,vAppend_Just,true,this.aMappedID[vID]);\n\t\tthis.getElementById(\"editJUSTIFICATIONS\"+this.aQID+pStep).innerHTML = vContent;\n\t};\n\t//#################################################################\n\t//# Nested: setAllJustifications()\n\t//#################################################################\n\tthis.setAllJustifications = function () {\n\t\t//alert(\"setAllJustifications()\");\n\t\tvar vStep=1;\n\t\twhile (vStep != (this.aCount+1)) {\n\t\t\tthis.setJustifications(vStep);\n\t\t\tvStep++;\n\t\t};\n\t};\n\t//#################################################################\n\t//# Nested: setAllSuggestions()\n\t//#################################################################\n\tthis.setAllSuggestions = function () {\n\t\t//alert(\"setAllSuggestions()\");\n\t\tvar vStep=0;\n\t\twhile (vStep != (this.aCount+1)) {\n\t\t\tthis.addCorrectSuggestionStep(vStep);\n\t\t\tthis.addFalseSuggestionStep(vStep);\n\t\t\t//this.createSuggestionStep(vStep);\n\t\t\tvStep++;\n\t\t};\n\t\t// Suggestions determine the selection of Justifications\n\t\tthis.setAllJustifications();\n\t};\n\t//#################################################################\n\t//# Nested: setConnectionSize()\n\t//#################################################################\n\tthis.setConnectionSize = function () {\n\t\t//alert(\"setConnectionSize()\");\n\t\tvar vStep=1;\n\t\twhile (vStep != (this.aCount+1)) {\n\t\t\tthis.setConnectionSizeStep(vStep);\n\t\t\tvStep++;\n\t\t};\n\t};\n\t//#################################################################\n\t//# Nested: setConnectionSizeStep()\n\t//#################################################################\n\tthis.setConnectionSizeStep = function (pStep) {\n\t\t//alert(\"setConnectionSizeStep(\"+pStep+\")\");\n\t\tvar vConValue = this.getElementById(\"sCONNECTION\"+this.aQID+pStep).value;\n\t\tvar vOutNode = this.getElementById(\"outCONNECTION\"+this.aQID+pStep);\n\t\tthis.updateConnectionWidth(vOutNode,vConValue);\n\t};\n\t//#################################################################\n\t//# Nested: setConnection2Index()\n\t//#################################################################\n\tthis.setConnection2Index = function () {\n\t\tvar vNr = 0;\n\t\tthis.vConnectionName.push(vLanguage[\"Connection\"] + \"?\");\n\t\tthis.vConnection2Index[\"???\"] = vNr;\n\t\tvNr++;\n\t\tthis.vConnection2Index[\" \"] = vNr; //START: Beweissequenz\n\t\tthis.vConnectionName.push(\"START: \"+vLanguage[\"ProofSequence\"]);\n\t\tvNr++;\n\t\tthis.vConnection2Index[\"=\"+this.GT] = vNr;\n\t\tthis.vConnectionName.push(vLanguage[\"Implication\"]);\n\t\tvNr++;\n\t\tthis.vConnection2Index['='] = vNr;\n\t\tthis.vConnectionName.push(vLanguage[\"Equality\"]);\n\t\tvNr++;\n\t\tthis.vConnection2Index[this.LT+\"=\"] = vNr;\n\t\tthis.vConnectionName.push(vLanguage[\"lower_equal\"]);\n\t\tvNr++;\n\t\tthis.vConnection2Index[this.LT] = vNr;\n\t\tthis.vConnectionName.push(vLanguage[\"lower\"]);\n\t\tvNr++;\n\t\tthis.vConnection2Index[this.GT+'='] = vNr;\n\t\tthis.vConnectionName.push(vLanguage[\"greater_equal\"]);\n\t\tvNr++;\n\t\tthis.vConnection2Index[this.GT] = vNr;\n\t\tthis.vConnectionName.push(vLanguage[\"greater\"]);\n\t\tvNr++;\n\t\tthis.vConnection2Index['subseteq'] = vNr;\n\t\tthis.vConnectionName.push(vLanguage[\"Subset\"]);\n\t\tvNr++;\n\t\tthis.vConnection2Index['DEF'] = vNr;\n\t\tthis.vConnectionName.push(\"Definition \" + vLanguage[\"of\"] + \" \"+ vLanguage[\"Variables\"]);\n\t\tvNr++;\n\t\tthis.vConnection2Index['TEXT'] = vNr;\n\t\tthis.vConnectionName.push(\"Text \"+vLanguage[\"or\"] + \" \"+ vLanguage[\"Comment\"]);\n\t\tvNr++;\n\t\tthis.vConnection2Index[\"TYP\"] = vNr;\n\t\tthis.vConnectionName.push(vLanguage[\"Type\"]);\n\t\tvNr++;\n\t\tthis.vConnection2Index['q.e.d.'] = vNr;\n\t\tthis.vConnectionName.push('q.e.d.');\n\t};\n\t//#################################################################\n\t//# Nested: setIMathDisplayOption(pOption)\n\t//#################################################################\n this.setIMathDisplayOption = function (pOption) {\n\t\t//var vDispOpt = this.getIMathById(\"DISPLAYOPTION\"+this.aQID);\n\t\tvar vDispOpt = this.getIMathById(\"DISPLAYOPTION\");\n\t\tvDispOpt.value = pOption;\n\t};\n\t//#################################################################\n\t//# Nested: setIMathById(pFormID,pValue)\n\t//#################################################################\n\tthis.setIMathById = function (pFormID,pValue) {\n\t\tvar vOutNode = null;\n\t\tif (this.aIMATH[pFormID]) {\n\t\t\t//alert(\"getIMathById('\"+this.aIMATH[pFormID]+\"')\");\n\t\t\tvOutNode = this.getChildById(this.aRootDOM,this.aIMATH[pFormID]);\n\t\t\t//if (vOutNode) {\n\t\t\t//\talert(\"ssetIMathById('\"+this.aIMATH[pFormID]+\"',pValue) exists OK!\");\n\t\t\t//} else {\n\t\t\t//\talert(\"ERROR: setIMathById('\"+this.aIMATH[pFormID]+\"',pValue) does not exist!\");\n\t\t\t//}\n\t\t\tvOutNode.value = pValue;\n\t\t}\n\t};\n\t//#################################################################\n\t//# Nested: setIMathStepCount(pCount)\n\t//#################################################################\n this.setIMathStepCount = function (pCount) {\n\t\t//var vStepCount = this.getIMathById(\"STEPCOUNT\"+this.aQID);\n\t\tvar vStepCount = this.getIMathById(\"STEPCOUNT\");\n\t\tvStepCount.value = pCount;\n\t};\n\t//#################################################################\n\t//# Nested: setJustAssValue (pStep,pAssRoot,pSA,pNodeID)\n\t//#################################################################\n\tthis.setJustAssValue = function (pStep,pAssRoot,pSA,pNodeID) {\n\t\tvar vOutRow = this.getChildById(pAssRoot,\"out\"+pNodeID+this.aQID+pStep);\n\t\tvar vIDs = this.getChildById(pSA,\"ass\"+pNodeID+this.aQID+pStep).value;\n\t\tvar vValue = \"\";\n\t\tvar vText = \"[\"+this.list2mapped(vIDs)+\"] \"+vLanguage[\"WRONG\"];\n\t\tif (vIDs == \"\") {\n\t\t\ts = 0;\n\t\t\tvValue = \"-0%\";\n\t\t\tvOutRow.style.color = \"green\";\n\t\t\tvText = vLanguage[\"None\"]+\" - \"+ vLanguage[\"RIGHT\"];\n\t\t} else {\n\t\t\tvOutRow.style.color = \"red\";\n\t\t\ts = vIDs.split(\",\").length;\n\t\t\tvar perc = this.aErrorDefault; //parseInt(this.aSettings[\"Per_Error_Minus_Percent\"])/100;\n\t\t\tvValue = \"-\"+this.createPercent(s * perc);\n\t\t};\n\t\tthis.setStepAssValue(pStep,pAssRoot,\"out\"+pNodeID,vText,vValue);\n\t};\n\t//#################################################################\n\t//# Nested: setStepCount(pCount)\n\t//#################################################################\n this.setStepCount = function (pCount) {\n\t\tvar vStepCount = this.getElementById(\"sSTEPCOUNT\"+this.aQID);\n\t\t//var vStepCount = this.getIMathById(\"STEPCOUNT\");\n\t\tvStepCount.value = pCount;\n\t\tthis.updateIMathById(\"STEPCOUNT\");\n\t\tvar vOut = this.saveEProof2Form();\n\t\t//alert(\"setStepCount(\"+pCount+\"):2487 vStepCount=\"+vStepCount.value);\n\t\t//var vAllStep = this.getAllSteps(\"SCAN\");\n\t\t//this.updateUsedIDs();\n\t};\n\t//#################################################################\n\t//# Nested: setStepAssPrevNext (pStep,pAssRoot,pSA,pNodeID,pNextCon,pID,pPrevNextID)\n\t//#################################################################\n\tthis.setStepAssPrevNext = function (pStep,pAssRoot,pSA,pNodeID,pNextCon,pMapID,pPrevNextID,pPrevNext,pText) {\n\t\tvar vName = \"out\"+pNodeID+this.aQID+pStep;\n\t\t//alert(\"pAssRoot.id=\"+pAssRoot.id+\" vName=\"+vName);\n\t\tvar vOutRow = this.getChildById(pAssRoot,vName);\n\t\tvar vMapPrevNext = \"Start\";\n\t\tif (pPrevNextID != \" \") vMapPrevNext=this.aMappedID[pPrevNextID];\n\t\tvar vCountStr = this.getChildById(pSA,pNodeID+this.aQID+pStep).value;\n\t\tvar vCount = parseInt(vCountStr);\n\t\tvar vValue = \"\";\n\t\tvar vText = \"\";\n\t\tvar vID = this.aOriginalID[pMapID];\n\t\tif (!pPrevNextID) pPrevNextID = \"?\";\n\t\t//alert(pPrevNext+\": pPrevNextID=[\"+pPrevNextID+\"] - setStepAssPrevNext()-Call:1326\");\n\t\tvOutRow.style.color = \"red\";\n\t\tif (vCountStr == \"-1\") {\n\t\t\tvText += \"[\"+pMapID+\"] \"+vLanguage[\"logically\"] +\" \"+ vLanguage[\"not\"]+\" \"+vLanguage[\"connected\"] +\" \";\n\t\t\tif (!pPrevNextID) vText += vLanguage[\"with\"]+\" [\"+vMapPrevNext+\"] \";\n\t\t\tvText += vLanguage[\"WRONG\"];\n\t\t\tvText += pText;\n\t\t\tvValue = \"-\"+this.createPercent(0.5);\n\t\t} else if (vCount == 0) {\n\t\t\tvValue = \"-0%\";\n\t\t\tvOutRow.style.color = \"green\";\n\t\t\tvText = vLanguage[\"ProofStep\"] +\" [\"+vMapPrevNext+\"] \";\n\t\t\tvar vStartDist = this.calcStepDistance(\" \",vID);\n\t\t\tif ((vStartDist == 1) && (pPrevNext == \"PREV\")) {\n\t\t\t\t//alert(\"setStepAssPrevNext():2159 - No Dependency of [\"+vID+\"] to previous step\");\n\t\t\t\tvText = vLanguage[\"no_dependency\"]+\" \"+vLanguage[\"for\"]+\" [\"+pMapID+\"] \";\n\t\t\t};\n\t\t\tif ((this.aStepType4ID[vID] == \"CONCLUSION\") && (pPrevNext == \"NEXT\")) {\n\t\t\t\t//alert(\"setStepAssPrevNext():2159 - CONCLUSION No Dependency of [\"+vID+\"] to next step\");\n\t\t\t\tvText = vLanguage[\"End_of\"]+\" \"+vLanguage[\"ProofSequence\"]+\" - \"+ vLanguage[\"no_dependency\"]+\" \"+vLanguage[\"for\"]+\" [\"+pMapID+\"] \";\n\t\t\t};\n\t\t\tvText+= vLanguage[\"RIGHT\"];\n\t\t\tif (!pPrevNextID) vText = \"---\";\n\t\t} else {\n\t\t\tvar perc = this.aErrorDefault; //parseInt(this.aSettings[\"Per_Error_Minus_Percent\"])/100;\n\t\t\tvar reduc = vCount * perc;\n\t\t\tif (this.greater(reduc,0.5)) reduc=0.5;\n\t\t\tthis.aErrorStep[\"STEP\"+pStep] -= reduc;\n\t\t\tvValue = \"-\"+this.createPercent(reduc);\n\t\t\tif (vCount == 1) {\n\t\t\t\tvText = vCount+\" \" + vLanguage[\"ProofStep\"]+\" \"+vLanguage[\"is_missing\"];\n\t\t\t} else {\n\t\t\t\tvText = vCount+\" \"+vLanguage[\"ProofSteps\"] + \" \" + vLanguage[\"missing\"];\n\t\t\t};\n\t\t\tvText += \" \"+vLanguage[\"between\"]+\" [\"+pMapID+\"] \"+vLanguage[\"and\"] +\" [\"+vMapPrevNext+\"] \"+vLanguage[\"WRONG\"] + pText;\n\t\t};\n\t\t//this.setStepAssValue(pStep,pAssRoot,\"out\"+pNodeID,vText,vValue);\n\t\treturn new Array(vText,vValue);\n\t};\n\t//#################################################################\n\t//# Nested: setStepAssValue (pStep,pAssRoot,pNodeID,pText,pValue)\n\t//#################################################################\n\tthis.setStepAssValue = function (pStep,pAssRoot,pNodeID,pText,pValue) {\n\t\tvar vTextNode = this.getChildById(pAssRoot,pNodeID+\"TEXT\"+this.aQID+pStep);\n\t\tvar vValueNode = this.getChildById(pAssRoot,pNodeID+\"SCORE\"+this.aQID+pStep);\n\t\tif (vTextNode) {\n\t\t\tvTextNode.innerHTML = pText;\n\t\t} else {\n\t\t \talert(\"pNodeID='\"+pNodeID+\"TEXT\"+this.aQID+pStep+\"' undefined. setStepAssValue():1946\");\n\t\t}\n\t\tif (vValueNode) {\n\t\t\tvValueNode.innerHTML = pValue;\n\t\t} else {\n\t\t \talert(\"pNodeID='\"+pNodeID+\"SCORE\"+this.aQID+pStep+\"' undefined. setStepAssValue():1951\")\n\t\t}\n\n\t};\n\t//#################################################################\n\t//# Nested: setUnused4Step(pStep)\n\t//#################################################################\n\tthis.setUnused4Step = function (pStep) {\n\t\t//alert(\"[+] visible\");\n\t\tthis.hide(\"outMYSTEPASSESS\"+this.aQID+pStep);\n\t\tthis.hideElement(\"bDelete\"+this.aQID+pStep);\n\t\tthis.hideElement(\"bJustifications\"+this.aQID+pStep);\n\t\tthis.hideElement(\"outJUSTIFICATIONID\"+this.aQID+pStep);\n\t\tthis.hide(\"optJUSTIFICATION\"+this.aQID+pStep);\n\t\tthis.hide(\"labelOPTJUSTIFICATION\"+this.aQID+pStep);\n\t\tthis.hideElement(\"sCONNECTION\"+this.aQID+pStep);\n\t\tthis.hideElement(\"sSTEPID\"+this.aQID+pStep);\n\t\tthis.hideElement(\"bEdit\"+this.aQID+pStep);\n\t\tthis.hideElement(\"bAssessStep\"+this.aQID+pStep);\n\t\tthis.hide(\"mapPREVIOUSLINK\"+this.aQID+pStep);\n\t\tthis.hide(\"bSuggestion\"+this.aQID+pStep);\n\t\tthis.hide(\"assessSTUDENTANSWER\"+this.aQID+pStep);\n\t\tthis.hide(\"SUGGESTIONS\"+this.aQID+pStep);\n\t\tthis.show(\"bUseStep\"+this.aQID+pStep);\n\t};\n\t//#################################################################\n\t//# Nested: setAssessSugButton4Step(pStep)\n\t//#################################################################\n\tthis.setAssessSugButton4Step = function (pStep) {\n\t\tif (this.aSettings[\"show_suggestions\"] != \"0\") {\n\t\t\t// [Suggestion]\n\t\t\tthis.show(\"bSuggestion\"+this.aQID+pStep,\"block\");\n\t\t} else {\n\t\t\t// [Suggestion]\n\t\t\tthis.hide(\"bSuggestion\"+this.aQID+pStep);\n\t\t};\n\t\tif (this.aSettings[\"show_assessment\"] != \"0\") {\n\t\t\t// [Assessment]\n\t\t\tthis.show(\"bAssessStep\"+this.aQID+pStep,\"block\");\n\t\t} else {\n\t\t\t// [Assessment]\n\t\t\tthis.hide(\"bAssessStep\"+this.aQID+pStep);\n\t\t};\n\t};\n\t//#################################################################\n\t//# Nested: setVisibility4Proof()\n\t//#################################################################\n\tthis.setVisibility4Proof = function (pDisplay) {\n\t\tthis.aDisplay = pDisplay || this.getElementById(\"sDISPLAYOPTION\"+this.aQID).value;\n\t\t//alert(\"setVisibility4Proof() this.aDisplay=\"+this.aDisplay+\" show_suggestions=\"+this.aSettings[\"show_suggestions\"]);\n\t\tvar vListNode = this.updateStudentAnswer();\n\t\tif (this.aDisplay == \"Hide\") {\n\t\t\tthis.hide(\"STUDENTANSWERLIST\"+this.aQID);\n\t\t} else {\n\t\t\tthis.show(\"STUDENTANSWERLIST\"+this.aQID);\n\t\t\tif (this.aDisplay == \"EDITComplete\") {\n\t\t\t\tif (this.aSettings[\"show_suggestions\"] == \"1\") {\n\t\t\t\t\t//this.show(\"FIRSTSSUGGESTION\"+this.aQID);\n\t\t\t\t\tthis.show(\"bSuggestionFirst\"+this.aQID);\n\t\t\t\t} else {\n\t\t\t\t\t//this.hide(\"FIRSTSSUGGESTION\"+this.aQID);\n\t\t\t\t\tthis.hide(\"bSuggestionFirst\"+this.aQID);\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\t//this.hide(\"FIRSTSSUGGESTION\"+this.aQID);\n\t\t\t\tthis.hide(\"bSuggestionFirst\"+this.aQID);\n\t\t\t};\n\t\t\tvar k=0;\n\t\t\twhile (k != vListNode.length) {\n\t\t\t\tthis.setVisibility4Step(vListNode[k],k);\n\t\t\t\tk++;\n\t\t\t};\n\t\t};\n\t\tthis.updateIMathById(\"DISPLAYOPTION\");\n\t\tvar vOut = this.saveEProof2Form();\n\t};\n\t//#################################################################\n\t//# Nested: setVisibility4Step(pStep)\n\t//#################################################################\n\tthis.setVisibility4Step = function (pSA,pIndex) {\n\t\tvar vStep;\n\t\tvar vID = \"?\";\n\t\tif (!pIndex) {\n\t\t\tvar vIDNode = this.getChildByClassName(pSA,\"inSTEPID\"+this.aQID);\n\t\t\tvID = vIDNode.value;\n\t\t\tvStep = vIDNode.getAttribute(\"step\");\n\t\t} else {\n\t\t\tvID = this.aIndex2ID[pIndex];\n\t\t\tvStep = this.aIndex2Step[pIndex];\n\t\t}\n\t\t//alert(\"pSA.step=\"+vStep);\n\t\t//alert(\"setVisibility4Step -- ID=\"+pSA.id+\" pSA.parentNode.id=\"+pSA.parentNode.id);\n\t\tif (pSA.parentNode.id == \"UNUSEDSTEPS\"+this.aQID) {\n\t\t\t//alert(\"setVisibility4Step():2138 Unused Step\");\n\t\t\tthis.setUnused4Step(vStep);\n\t\t} else {\n\t\t\t//alert(\"[+] not visible [X] visible\");\n\t\t\tthis.showHideBoolean(\"outMYSTEPASSESS\"+this.aQID+vStep,this.aSettings[\"AssessmentMode\"]);\n\t\t\tthis.showSA(pSA,\"bDelete\"+this.aQID+vStep);\n\t\t\tthis.showSA(pSA,\"sCONNECTION\"+this.aQID+vStep);\n\t\t\tthis.showSA(pSA,\"sSTEPID\"+this.aQID+vStep);\n\t\t\tthis.showSA(pSA,\"bJustifications\"+this.aQID+vStep);\n\t\t\tthis.showSA(pSA,\"outJUSTIFICATIONID\"+this.aQID+vStep);\n\t\t\tif ((vID.indexOf(\"MY\")==0) || (this.aSettings[\"AuthoringMode\"] != \"0\")) {\n\t\t\t\tthis.showSA(pSA,\"bEdit\"+this.aQID+vStep);\n\t\t\t} else {\n\t\t\t\tthis.hideElement(\"bEdit\"+this.aQID+vStep);\n\t\t\t};\n\t\t\tif (this.aSettings[\"AuthoringMode\"] == \"0\") {\n\t\t\t\tthis.hideSA(pSA,\"mapPREVIOUSLINK\"+this.aQID+vStep);\n\t\t\t\tthis.hideSA(pSA,\"optJUSTIFICATION\"+this.aQID+vStep);\n\t\t\t\tthis.hideSA(pSA,\"labelOPTJUSTIFICATION\"+this.aQID+vStep);\n\t\t\t} else {\n\t\t\t\tthis.showSA(pSA,\"mapPREVIOUSLINK\"+this.aQID+vStep);\n\t\t\t\tthis.showSA(pSA,\"optJUSTIFICATION\"+this.aQID+vStep);\n\t\t\t\tthis.showSA(pSA,\"labelOPTJUSTIFICATION\"+this.aQID+vStep);\n\t\t\t};\n\t\t\tthis.hideSA(pSA,\"bUseStep\"+this.aQID+vStep);\n\t\t\tif (this.aDisplay == \"EDITComplete\") {\n\t\t\t\tthis.setAssessSugButton4Step(vStep);\n\t\t\t\tthis.showSA(pSA,\"editSTUDENTANSWER\"+this.aQID+vStep);\n\t\t\t\tthis.showSA(pSA,\"divJUSTIFICATIONS\"+this.aQID+vStep);\n\t\t\t\tthis.showSA(pSA,\"divEDITJUSTIFICATIONS\"+this.aQID+vStep);\n\t\t\t\t//this.updateStep(vStep);\n\t\t\t} else if (this.aDisplay == \"EDITShort\") {\n\t\t\t\tthis.setAssessSugButton4Step(vStep);\n\t\t\t\tthis.showSA(pSA,\"editSTUDENTANSWER\"+this.aQID+vStep);\n\t\t\t\tthis.hideSA(pSA,\"divJUSTIFICATIONS\"+this.aQID+vStep);\n\t\t\t\tthis.showSA(pSA,\"divEDITJUSTIFICATIONS\"+this.aQID+vStep);\n\t\t\t\t//this.hideElement(\"bJustifications\"+this.aQID+vStep);\n\t\t\t\t//this.hideElement(\"outJUSTIFICATIONID\"+this.aQID+vStep);\n\t\t\t} else if (this.aDisplay == \"Complete\") {\n\t\t\t\tthis.showSA(pSA,\"divJUSTIFICATIONS\"+this.aQID+vStep);\n\t\t\t\tthis.hideSA(pSA,\"divEDITJUSTIFICATIONS\"+this.aQID+vStep);\n\t\t\t\tthis.hideSA(pSA,\"editSTUDENTANSWER\"+this.aQID+vStep);\n\t\t\t\tthis.hideSA(pSA,\"assessSTUDENTANSWER\"+this.aQID+vStep);\n\t\t\t\tthis.hideSA(pSA,\"SUGGESTIONS\"+this.aQID+vStep);\n\t\t\t} else { //if (this.aDisplay == \"Short\") {\n\t\t\t\tthis.hideSA(pSA,\"divJUSTIFICATIONS\"+this.aQID+vStep);\n\t\t\t\tthis.hideSA(pSA,\"divEDITJUSTIFICATIONS\"+this.aQID+vStep);\n\t\t\t\tthis.hideSA(pSA,\"editSTUDENTANSWER\"+this.aQID+vStep);\n\t\t\t\tthis.hideSA(pSA,\"assessSTUDENTANSWER\"+this.aQID+vStep);\n\t\t\t\tthis.hideSA(pSA,\"SUGGESTIONS\"+this.aQID+vStep);\n\t\t\t};\n\t\t};\n\t\tthis.checkUnusedCount();\n\t};\n\t//#################################################################\n\t//# Nested: shuffle(pArray)\n\t//#################################################################\n\tthis.shuffle = function (pArray){\n\t\tvar m = pArray.length;\n\t\tvar vElem;\n\t\tvar i=0;\n\t\t// While there remain elements to shuffle…\n \t\twhile (m) {\n\t\t\t// Pick a remaining element…\n\t\t i = Math.floor(Math.random() * m--);\n \t\t\t// And swap it with the current element.\n\t\t\tvElem = pArray[m];\n\t\t\tpArray[m] = pArray[i];\n\t\t pArray[i] = vElem;\n\t\t}\n\t\treturn pArray;\n \t};\n\t//#################################################################\n\t//# Nested: selectElementsFromArray(pArray,pCount)\n\t//#################################################################\n\tthis.selectElementsFromArray = function (pArray,pCount) {\n\t\tvar vArray = pArray.slice();\n\t\tvArray = this.shuffle(vArray);\n\t\tvar vResArr = new Array();\n\t\tvar m = vArray.length;\n\t\tif (this.greater(pCount,m)) {\n\t\t\talert(\"ERROR: Select \"+pCount+\" Elements from Array with lenght=\"+m+\" is not possible!\");\n\t\t\tpCount = m;\n\t\t};\n\t\tvar vElem;\n\t\tvar i=0;\n\t\t// While there remain elements to shuffle…\n \t\twhile (pCount) {\n\t\t\t// Pick a remaining element…\n\t\t i = Math.floor(Math.random() * m--);\n\t\t // Save random Element\n\t\t vResArr.push(vArray[i]);\n\t\t pCount--;\n \t\t\t// And swap it with the current element.\n\t\t\tvElem = vArray[m];\n\t\t\tvArray[m] = vArray[i];\n\t\t vArray[i] = vElem;\n\t\t}\n \t\treturn vResArr;\n \t};\n\t//#################################################################\n\t//# Nested: storeCorrectSuggestions()\n\t//#################################################################\n\tthis.storeCorrectSuggestions = function () {\n\t\t//alert(\"store correct Suggestions according to Solution\");\n\t\tthis.clearSuggestions();\n\t\tvar vStep=0;\n\t\tvar vID = \"\";\n\t\twhile (vStep != (this.aCount+1)) {\n\t\t\tvID = this.getElementById(\"inSTEPID\"+this.aQID+vStep).value;\n\t\t\t//alert(\"vID=[\"+vID+\"] Step=\"+vStep);\n\t\t\tthis.getElementById(\"selectCONNECTION\"+this.aQID+vStep).value = this.getSugCon(vID);\n\t\t\tthis.getElementById(\"selectSTEPID\"+this.aQID+vStep).value = this.getSugID(vID);\n\t\t\tthis.getElementById(\"selectJUSTIFICATION\"+this.aQID+vStep).value = this.getSugJust(vID);\n\t\t\tvStep++;\n\t\t};\n\n\t};\n\t//#################################################################\n\t//# Nested: toggleEdit(pButtonEDIT)\n\t//#################################################################\n\tthis.toggleEdit = function (pButtonEDIT) {\n\t\t//parentNode= editSTUDENTANSWER\n\t\t//parentNode.parentNode= STUDENTANSWER\n\t\t//parentNode.parentNode.parentNode= STUDENTANSWERLIST or UNUSEDSTEPS\n\t\tvar vStudentAnswerNode = this.getParentStudentAnswer(pButtonEDIT);\n\t\tvar vStep = pButtonEDIT.getAttribute(\"step\");\n\t\tvar vID = this.getElementById(\"inSTEPID\"+this.aQID+vStep).value;\n\t\t//alert(\"eproofmain.js - toggleEdit():3298 vStep=\"+vStep);\n\t\tvar vNode = this.getElementById(\"STEPEDITOR\"+this.aQID+vStep);\n\t\tif (vNode) {\n\t\t\tif (vNode.style.display==\"none\") {\n\t\t\t\tvar vEditNode = this.getElementById(\"taSTEPEDITOR\"+this.aQID+vStep);\n\t\t\t\tvar vSourceNode = this.getElementById(\"EDITSTEP-\"+this.aQID+\"-\"+vID);\n\t\t\t\tvEditNode.value = this.decodeTextarea(vSourceNode.value);\n\t\t\t};\n\t\t\tthis.toggleNode(vNode);\n\t\t} else {\n\t\t\talert(\"Error: toggleEdit()-Call - STEPEDITOR for Step=\"+vStep+\" is undefined!\");\n\t\t}\n\t};\n\t//#################################################################\n\t//# Nested: setminusarrays\n\t//#################################################################\n\tthis.setminusarrays = function (x, y) {\n\t\tvar res = [];\n\t\tvar i = 0;\n\t\twhile (i != x.length) {\n\t\t\tif (this.findarray(x[i],y) == -1) {\n\t\t\t\tres.push(x[i]);\n\t\t\t};\n\t\t\ti++;\n\t\t};\n\t\treturn res;\n\t};\n\t//#################################################################\n\t//# Nested: unionarrays\n\t//# unionarrays(array,array): Unions two arrays, preventing duplicates, into a new array\n\t//#################################################################\n\tthis.unionarrays = function (x, y) {\n\t\tvar res = [];\n\t\tif (x.length == 0) {\n\t\t\tres = y;\n\t\t} else if (y.length == 0) {\n\t\t\tres = x;\n\t\t} else {\n\t\t\t//var obj = {};\n\t\t\tvar obj = new Array();\n\t\t\tvar i = 0;\n\t\t\twhile (i != x.length) {\n\t\t\t\tobj[x[i]] = x[i];\n\t\t\t\ti++;\n\t\t\t};\n\t\t\ti = 0;\n\t\t\twhile (i != y.length) {\n\t\t\t\tobj[y[i]] = y[i];\n\t\t\t\ti++;\n\t\t\t};\n\t\t\tfor (var k in obj) {\n\t\t\t\tif (obj.hasOwnProperty(k)) {\n\t\t\t\t\tres.push(obj[k]);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t//alert(\"x=[\"+x.join(\",\")+\"] y=[\"+y.join(\",\")+\"] union=[\"+res.join(\",\")+\"]\");\n\t\treturn res;\n\t};\n\t//#################################################################\n\t//# Nested: sortArrayID(pArray)\n\t//#################################################################\n\tthis.sortArrayID = function (pArray) {\n\t\tvar k=0;\n\t\tvar vMapArr = new Array();\n\t\twhile (k != pArray.length) {\n\t\t\tvMapArr.push(this.aMappedID[pArray[k]]);\n\t\t\tk++;\n\t\t};\n\t\tvMapArr.sort();\n\t\tk=0;\n\t\twhile (k != pArray.length) {\n\t\t\tpArray[k] = this.aOriginalID[vMapArr[k]];\n\t\t\tk++;\n\t\t};\n\t\t//return pArray\n\t};\n\t//#################################################################\n\t//# Nested: uniquearray\n\t//# uniquearray(array): preventing duplicates, save into a new array\n\t//#################################################################\n\tthis.uniquearray = function (x) {\n\t\tvar obj = [];\n\t\tvar i = 0;\n\t\twhile (i != x.length) {\n\t\t\tobj[x[i]] = x[i];\n\t\t\ti++;\n\t\t};\n\t\tvar res = [];\n\t\tfor (var k in obj) {\n\t\t\tif (obj.hasOwnProperty(k)) {\n\t\t\t\tres.push(obj[k]);\n\t\t\t};\n\t\t};\n\t\treturn res;\n\t};\n\t//#################################################################\n\t//# Nested: updateConnection(pChildSA)\n\t//#################################################################\n\tthis.updateConnection = function (pChildSA) {\n\t\t//var vAnswerList = this.getChildrenByClassName(this.aRootDOM,\"STUDENTANSWER\"+this.aQID);\n\t\t//var vAnswerList = this.getAllSteps();\n\t\tvar vSA = this.getParentStudentAnswer(pChildSA);\n\t\tvar vStep = pChildSA.getAttribute(\"step\");\n\t\tvar vPrevID = this.getElementById(\"PREVIOUS\"+this.aQID+vStep).value;\n\t\t//alert(\"updateConnection():2496 - vPrevID=\"+vPrevID);\n\t\tvar vPreStep = 0;\n\t\tif (vPrevID != \" \") {\n\t\t\tvPreStep = this.getStep4ID(vPrevID);\n\t\t};\n\t\t//alert(\"updateConnection():2498 vPreStep=\"+vPreStep);\n\t\tthis.getElementById(\"NEXTCON\"+this.aQID+vPreStep).value = pChildSA.value;\n\t\tvar vOutConNode = this.getElementById(\"outCONNECTION\"+this.aQID+vStep);\n\t\tvOutConNode.innerHTML = this.vConnection2Node[pChildSA.value].innerHTML;\n\t\t//alert(\"updateStep(\"+pChildSA.id+\") vStep=\"+vStep+ \" vAnswerList.length=\"+this.aCount);\n\t\tthis.updateConnectionWidth(vOutConNode,pChildSA.value);\n\t\tthis.updateIMathById(\"STUDENTANSWER\");\n\t\tvar vOut = this.saveEProof2Form();\n };\n\t//#################################################################\n\t//# Nested: updateConnectionWidth(pChildSA)\n\t//#################################################################\n\tthis.updateConnectionWidth = function (pConNode,pConValue) {\n\t\tif (this.vConnectionArray[pConValue] == \" \") {\n\t\t\tpConNode.setAttribute(\"width\",\"0ex\");\n\t\t} else {\n\t\t\tpConNode.setAttribute(\"width\",\"35ex\");\n\t\t}\n };\n\t//#################################################################\n\t//# Nested: updateEditJustifications(pChildSA)\n\t//#################################################################\n\tthis.updateEditJustifications = function (pChildSA) {\n\t\tvar vSA = this.getParentStudentAnswer(pChildSA);\n\t\tvar vOutputList = this.getChildrenByClassName(vSA,\"displayJUSTIFICATIONS\"+this.aQID);\n\t\tvar vInputIDs = this.getChildrenByClassName(vSA,\"inJUSTIFICATION\"+this.aQID);\n\t};\n\t//#################################################################\n\t//# Nested: updateAuthoringMappedIDs()\n\t//#################################################################\n\tthis.updateAuthoringMappedIDs = function () {\n\t\t//alert(\"updateAuthoringMappedIDs()-Call\");\n\t\t// update DOM Input Values\n\t\tvar vFound = -1;\n\t\tvar vID = \"\";\n\t\tvar vChar = \"\";\n\t\tvar vOrgID = \"\";\n\t\tvar k=0;\n\t\t//alert(\"this.aAllID.length=\"+this.aAllID.length);\n\t\twhile (k!= this.aAllID.length) {\n\t\t\tif (this.aAllID[k]) {\n\t\t\t\tvOrgID = this.aAllID[k];\n\t\t\t\tvFound = vOrgID.indexOf(\"_F\");\n\t\t\t\t//alert(\"vOrgID=\"+vOrgID+\" Found=\"+vFound);\n\t\t\t\tif (this.greater(vFound,0)) {\n\t\t\t\t\t//alert(\"False ID [\"+vOrgID+\"] found. updateMappedIDs():1938\");\n\t\t\t\t\tvID = vOrgID.substr(0,vFound);\n\t\t\t\t\tif (this.aMappedID[vID]) {\n\t\t\t\t\t\tvChar = this.aMappedID[vID] + \"_F\"; //this.createChar4ID(vID);\n\t\t\t\t\t\tvMappedID = vChar+this.newCharCounter(vChar);\n\t\t\t\t\t\tthis.redefineMappedID(vOrgID,vMappedID);\n\t\t\t\t\t} else {\n\t\t\t\t\t\talert(\"updateMappedID() for vID=[\"+vOrgID+\"] failed! MappedID for [\"+vID+\"] does not exist!\");\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\talert(\"Error: this.aAllID.length=\"+this.aAllID.length+\" this.aAllID[\"+k+\"] is not defined! - updateAuthoringMappedIDs():3464\");\n\t\t\t};\n\t\t\tk++;\n\t\t};\n\t\t// update DOM Output Value of ID\n\t\t//vContent +=\"\"+this.LT+\"INPUT type='text' size='3' value='\"+pID+\"' class='ID_\"+pTextareaID+this.aQID+\"' id='EDITID-\"+this.aQID+\"-\"+pID+\"' onchange=\\\"vEProof\"+this.aQID+\".updateSourceIDs()\\\"\"+this.GT;\n\t\t//vContent +=\"\"+this.LT+\"INPUT type='text' size='1' value='\"+pChar+\"' class='CHAR_\"+pTextareaID+this.aQID+\"' id='CHAR-\"+this.aQID+\"-\"+pID+\"' onchange=\\\"vEProof\"+this.aQID+\".updateCharIDs() \\\"\"+this.GT;\n\t\t//vContent +=\"\"+this.LT+\"INPUT type='text' size='3' value='\"+pMappedID+\"' class='MAPID_\"+pTextareaID+this.aQID+\"' id='MAPID-\"+this.aQID+\"-\"+pID+\"' onchange=\\\"vEProof\"+this.aQID+\".updateMappedIDs() \\\"\"+this.GT;\n\t};\n\t//#################################################################\n\t//# Nested: updateMappedIDs()\n\t//#################################################################\n\tthis.updateMappedIDs = function () {\n\t\tvar vOrgID = \"\";\n\t\talert(\"updateMappedIDs()-Call\");\n\t\tvar k=0;\n\t\t//alert(\"this.aAllID.length=\"+this.aAllID.length);\n\t\twhile (k!= this.aAllID.length) {\n\t\t\tvOrgID = this.aAllID[k];\n\t\t\tvMappedID = this.getElementById(\"MAPID-\"+this.aQID+\"-\"+vOrgID).value;\n\t\t\tthis.redefineMappedID(vOrgID,vMappedID);\n\t\t\tk++;\n\t\t};\n\t\t//update DOM Input Values\n\t\t//update ID in Solutions\n\t\t//vContent +=\"\"+this.LT+\"INPUT type='text' size='3' value='\"+pID+\"' class='ID_\"+pTextareaID+this.aQID+\"' id='EDITID-\"+this.aQID+\"-\"+pID+\"' onchange=\\\"vEProof\"+this.aQID+\".updateSourceIDs()\\\"\"+this.GT;\n\t\t//vContent +=\"\"+this.LT+\"INPUT type='text' size='1' value='\"+pChar+\"' class='CHAR_\"+pTextareaID+this.aQID+\"' id='CHAR-\"+this.aQID+\"-\"+pID+\"' onchange=\\\"vEProof\"+this.aQID+\".updateCharIDs() \\\"\"+this.GT;\n\t\t//vContent +=\"\"+this.LT+\"INPUT type='text' size='3' value='\"+pMappedID+\"' class='MAPID_\"+pTextareaID+this.aQID+\"' id='MAPID-\"+this.aQID+\"-\"+pID+\"' onchange=\\\"vEProof\"+this.aQID+\".updateMappedIDs() \\\"\"+this.GT;\n\t};\n\t//#################################################################\n\t//# Nested: updatePreviousLink(pStep)\n\t//#################################################################\n\tthis.updatePreviousLink = function (pDOM) {\n\t\tvar vStep = pDOM.getAttribute('step');\n\t\tvar vMapID = pDOM.value;\n\t\tvar vPrevID = this.getElementById(\"PREVIOUS\"+this.aQID+vStep).value;\n\t\tvPrevID = this.aMappedID[vPrevID] || \"Start\";\n\t\tvar vOrgNode = this.getElementById(\"PREVIOUSLINK\"+this.aQID+vStep);\n\t\t//var vMapNode = this.getElementById(\"mapPREVIOUSLINK\"+this.aQID+vStep);\n\t\tvar vMapNode = pDOM;\n\t\tif (vMapID != \"\") {\n\t\t\tif (this.aOriginalID[vMapID]) {\n\t\t\t\tvOrgNode.value = this.aOriginalID[vMapID];\n\t\t\t\talert(\"Replace previous ID=[\"+vPrevID+\"] by a linked previous ID=[\"+vMapID+\"]\");\n\t\t\t} else {\n\t\t\t\talert(\"Error Step \"+vStep+\" [\"+vMapID+\"] is undefined! - updatePreviousLink():3508\");\n\t\t\t\tif (vOrgNode.value == \"\") {\n\t\t\t\t\tvMapNode.value = \"\";\n\t\t\t\t} else {\n\t\t\t\t\tvMapNode.value = this.aMappedID[vOrgNode.value];\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t//alert(\"updatePreviousLink(\"+vStep+\"):3502 - eproofmain.js\");\n\t};\n\t//#################################################################\n\t//# Nested: updateSourceIDs()\n\t//#################################################################\n\tthis.updateSourceIDs = function () {\n\t\talert(\"updateSourceIDs()-Call\");\n\t\t//update DOM Input Values\n\t\t//update ID in Solutions\n\t\t//vContent +=\"\"+this.LT+\"INPUT type='text' size='3' value='\"+pID+\"' class='ID_\"+pTextareaID+this.aQID+\"' id='EDITID-\"+this.aQID+\"-\"+pID+\"' onchange=\\\"vEProof\"+this.aQID+\".updateSourceIDs()\\\"\"+this.GT;\n\t\t//vContent +=\"\"+this.LT+\"INPUT type='text' size='1' value='\"+pChar+\"' class='CHAR_\"+pTextareaID+this.aQID+\"' id='CHAR-\"+this.aQID+\"-\"+pID+\"' onchange=\\\"vEProof\"+this.aQID+\".updateCharIDs() \\\"\"+this.GT;\n\t\t//vContent +=\"\"+this.LT+\"INPUT type='text' size='3' value='\"+pMappedID+\"' class='MAPID_\"+pTextareaID+this.aQID+\"' id='MAPID-\"+this.aQID+\"-\"+pID+\"' onchange=\\\"vEProof\"+this.aQID+\".updateMappedIDs() \\\"\"+this.GT;\n\t};\n\t//#################################################################\n\t//# Nested: updateStudentAnswer()\n\t//#################################################################\n\tthis.updateStudentAnswer = function () {\n\t\tthis.aStudentAnswerList = this.aAllSteps;\n\t\tthis.aCount = this.aStudentAnswerList.length;\n\t\treturn this.aStudentAnswerList;\n\t};\n\t//#################################################################\n\t//# Nested: updateUsedIDs()\n\t//#################################################################\n\tthis.updateUsedIDs = function () {\n\t\t//alert(\"updateUsedIDs()\");\n\t\tvar vUsedArray = this.getUsedIDs();\n\t\tvar vProofC= parseInt(this.getElementById(\"PROOFCOUNT\"+this.aQID).value);\n\t\tvar vLLE = this.calcLogicLinkError(vUsedArray.length,vProofC);\n\t\tthis.getElementById(\"LLE\"+this.aQID).value = vLLE.toFixed(2);\n\t\tthis.getElementById(\"USEDIDS\"+this.aQID).value = vUsedArray.join(\",\");\n\t};\n\t//#################################################################\n\t//# Nested: updateStepDef(pID,pTextareaID)\n\t//#################################################################\n\tthis.updateStepDef = function (pID,pTextareaID,pValue) {\n\t\t//this.aStudentAnswerList = this.getElementsByClassName(\"STUDENTANSWER\"+this.aQID);\n\t\tthis.aStudentAnswerList = this.getAllSteps();\n\t\t//alert(\"updateStepDef('\"+pID+\"','\"+pTextareaID+\"','\"+pValue+\"')\");\n\t\t//if TextareaID is not JUSTIFICATION then it is necessary to update two DOMs\n\t\tif (pTextareaID != \"JUSTIFICATION\") {\n\t\t\tvar vIndex = this.getIndex4ID(pID);\n\t\t\tvar vSA = this.aStudentAnswerList[vIndex];\n\t\t\t//Update StepEditor and StepDef Display\n\t\t};\n\t\t//----Update AllID2RAW------------\n\t\tif (this.aAllID2RAW[pID]) {\n\t\t\tthis.aAllID2RAW[pID] = pValue;\n\t\t};\n\t\t//-----update Display above the StepDefinition Input Line\n\t\tvar vOutNode = this.getElementById(\"ID-\"+this.aQID+\"-\"+pID);\n\t\tvOutNode.innerHTML = pValue;\n\t\tthis.processMathNode(vOutNode);\n\t\tvar vStep = this.getStep4ID(pID);\n\t\tif (this.greater(vStep,0)) {\n\t\t\tthis.writeInnerHTML4Math(\"outSTEPDEF\"+this.aQID+vStep,pValue)\n\t\t};\n\t\tthis.updateIMathById(pTextareaID);\n\t\tthis.updateAllJustifications();\n\t\tvar vOut = this.saveEProof2Form();\n\t};\n\t//#################################################################\n\t//# Nested: updateStepCount(pCount)\n\t//#################################################################\n\tthis.updateStepCount = function (pCount) {\n\t\tvar vListNode = this.updateStudentAnswer();\n\t\t//alert(\"vListNode.length=\"+vListNode.length);\n\t\tvar vUsedNodes = this.getUsedSteps(); //this.getChildrenByClassName(this.aUsedDOM,\"STUDENTANSWER\"+this.aQID);\n\t\tvar vUnusedNodes = this.getUnusedSteps(); //ChildrenByClassName(this.aUnusedDOM,\"STUDENTANSWER\"+this.aQID);\n \t\tvar vProof = this.aUsedDOM;\n\t\tvar vUnused = this.aUnusedDOM;\n\t\tvar vDelPos = vUsedNodes.length - 1;\n\t\tvar vParent = null;\n\t\t//alert(\"Set Number of Proof Steps=\"+pCount+\" All=\"+this.aCount+\" vUsedNodes=\"+vUsedNodes.length+\" Unused=\"+vUnusedNodes.length+\")\");\n\t\tif (this.lower(pCount,vUsedNodes.length)) {\n\t\t\t//---vProof [0,1,2,3,4,5] vUnused [6,7,8,9] pCount=3\n\t\t\t//alert(\"Reduce Number of Steps form \"+vUsedNodes.length +\" to \"+pCount);\n\t\t\t//var vParentNode = vListNode[pCount-1].parentNode;\n\t\t\tvDelPos = vUsedNodes.length-1;\n\t\t\twhile (pCount != vUsedNodes.length) {\n\t\t\t\t//alert(\"vUsedNodes[vDelPos].id=\"+vUsedNodes[vDelPos].id);\n\t\t\t\tvParent = vUsedNodes[vDelPos].parentNode;\n\t\t\t\tvRemovedChild = vParent.removeChild(vUsedNodes[vDelPos]);\n\t\t\t\tvUnused.insertBefore(vRemovedChild,vUnused.firstChild);\n\t\t\t\t//vUnused.appendChild(vRemovedChild);\n\t\t\t\tvDelPos--;\n\t\t\t\tpCount++;\n\t\t\t}\n\t\t} else if (this.greater(pCount , vUsedNodes.length)) {\n\t\t\t//---Proof [0,1,2,3,4] Unused [5,6,7,8,9] pCount=6\n\t\t\t//alert(\"Increase Number of Steps form \"+vUsedNodes.length +\" to \"+pCount);\n\t\t\tvDelPos = 0;\n\t\t\twhile (this.lower(vUsedNodes.length,pCount)) {\n\t\t\t\t//alert(\"vUnusedNodes[vDelPos].id=\"+vUnusedNodes[vDelPos].id+\" vUnusedNodes.length=\"+vUnusedNodes.length);\n\t\t\t\tvParent = vUnusedNodes[vDelPos].parentNode;\n\t\t\t\tvRemovedChild = vParent.removeChild(vUnusedNodes[vDelPos]);\n\t\t\t\tvProof.appendChild(vRemovedChild);\n\t\t\t\tvDelPos++;\n\t\t\t\tpCount--;\n\t\t\t}\n\t\t};\n\t\t//alert(\"updateStepCount() - 1.1\");\n\t\tthis.checkUnusedCount();\n\t\t//alert(\"updateStepCount() - 1.2\");\n\t\tthis.setVisibility4Proof();\n\t\t//alert(\"updateStepCount() - 1.3\");\n\t\tthis.updateInput();\n\t\t//alert(\"updateStepCount() - 1.4\");\n\t\t//this.setStepCount(pCount); not necessary because Selector is changed by User\n\t\tvar vAllStep = this.getAllSteps(\"SCAN\");\n\t};\n\t//#################################################\n\t//# Vigenere-Encode and Decode of Strings\n\t//# pDecode true false\n\t//#################################################\n\tthis.vigenere = function (pString,pKeyword,pEncode) {\n\t\tvar CR = this.CR;\n\t\tfunction ord(x) { return x.charCodeAt(0) }\n\t\tfunction chr(x) { return String.fromCharCode(x) }\n\t\tfunction rot(a, b, decode) {\n\t\t\tvar vMinChar = \"0\";\n\t\t\tvar vMaxChar = \"Z\";\n\t\t\tvar vMod = ord(vMaxChar)-ord(vMinChar)+1;\n\t\t\t//var vMod = ord(\"z\")-32+1;\n\t\t\t//alert(\"vMod=\"+vMod);\n\t\t\treturn decode\t? chr((vMod + ord(a) - ord(b)) % vMod + ord(vMinChar))\n\t\t\t\t\t: chr((vMod + ord(a) + ord(b) - ord(vMinChar) * 2) % vMod + ord(vMinChar))\n\t\t}\n\t\tfunction transEnc(msg, key) {\n\t\t\t//alert(\"Encode\");\n\t\t\tvar i = 0;\n\t\t\tkey = key.toUpperCase().replace(/[^A-Z]/g, '');\n\t\t\tvar cc=0;\n\t\t\tvar k=0;\n\t\t\tvar vMaxChar = 35;\n\t\t\tvar vOut = \"\";\n\t\t\tvar c1,c2;\n\t\t\twhile (i != msg.length) {\n\t\t\t\tcc = msg.charCodeAt(i);\n\t\t\t\tk = key.charCodeAt(i % key.length) - ord(\"A\");\n\t\t\t\tcc += k;\n\t\t\t\tcc = cc % 256;\n\t\t\t\tc1 = chr(Math.floor(cc / 16) + ord(\"A\"));\n\t\t\t\tc2 = chr((cc % 16)+ ord(\"A\"));\n\t\t\t\t//alert(\"Enc(\"+i+\")=\"+cc);\n\t\t\t\tvOut +=c1+c2;\n\t\t\t\ti++;\n\t\t\t\tif ((i % vMaxChar) == 0) vOut += CR;\n\t\t\t};\n\t\t\treturn vOut;\n\t\t};\n\t\tfunction transDec(msg, key) {\n\t\t\t//alert(\"Decode\");\n\t\t\tvar vArr = msg.split(CR);\n\t\t\tmsg = vArr.join(\"\");\n\t\t\tkey = key.toUpperCase().replace(/[^A-Z]/g, '');\n\t\t\tvar cc=0;\n\t\t\tvar i = 0;\n\t\t\tvar k=0;\n\t\t\tvar vOut = \"\";\n\t\t\tvar vSplit = \"\";\n\t\t\tvar c1,c2;\n\t\t\tvar vMax = Math.floor(msg.length/2);\n\t\t\twhile (i != vMax) {\n\t\t\t\tc1= msg.charCodeAt(2*i)-ord(\"A\");\n\t\t\t\tc2= msg.charCodeAt(2*i+1)-ord(\"A\");\n\t\t\t\tcc = c1*16+c2;\n\t\t\t\tk = key.charCodeAt(i % key.length) - ord(\"A\");\n\t\t\t\tcc = (cc - k) % 256;\n\t\t\t\t//alert(\"Dec(\"+i+\"/k=\"+k+\")=\"+cc);\n\t\t\t\tvOut += chr(cc);\n\t\t\t\ti++;\n\t\t\t};\n\t\t\treturn vOut;\n\t\t};\n\n\t\tif (pEncode == \"encode\") {\n\t\t\treturn transEnc(pString,pKeyword);\n\t\t} else {\n\t\t\treturn transDec(pString,pKeyword);\n\t\t}\n\t};\n\t//#################################################################\n\t//# Nested: visibleManualAssess()\n\t//#################################################################\n\tthis.visibleManualAssess = function () {\n\t\tvar ManAssNodes = this.getElementsByClassName(\"outMYSTEPASSESS\"+this.aQID);\n\t\tvar i=0;\n\t\tif (this.aSettings[\"AssessmentMode\"] == \"1\") {\n\t\t\t//alert(\"Show Manual Assessment Box for Steps - visibleManualAssess(\"+this.aSettings[\"AssessmentMode\"]+\"):3052\");\n\t\t\twhile (i != ManAssNodes.length) {\n\t\t\t\tthis.show(ManAssNodes[i].id);\n\t\t\t\ti++;\n\t\t\t};\n\t\t} else {\n\t\t\t//alert(\"Hide Manual Assessment Box for Steps length=\"+ManAssNodes.length+\" - visibleManualAssess(\"+this.aSettings[\"AssessmentMode\"]+\"):3130\");\n\t\t\twhile (i != ManAssNodes.length) {\n\t\t\t\t//this.hideNode(ManAssNodes[i]);\n\t\t\t\tthis.hide(ManAssNodes[i].id);\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t};\n\t//#################################################################\n\t//# Nested: writeHash2Value\n\t//#################################################################\n\tthis.writeHash2Value = function (pParent,pHash,pPostfix) {\n\t\tif (!pPostfix) pPostfix = \"\";\n\t\tfor (var iID in pHash) {\n\t\t\tthis.writeParentValue(pParent,iID+this.aQID+pPostfix,pHash[iID]);\n\t\t};\n\t};\n\t//#################################################################\n\t//# Nested: writeHash2InnerHTML\n\t//#################################################################\n\tthis.writeHash2InnerHTML = function (pParent,pHash,pPostfix) {\n\t\tif (!pPostfix) pPostfix = \"\";\n\t\tfor (var iID in pHash) {\n\t\t\tthis.writeParentInnerHTML(pParent,iID+this.aQID+pPostfix,pHash[iID]);\n\t\t};\n\t};\n\t//#################################################################\n\t//# Nested: writeInnerHTML\n\t//#################################################################\n\tthis.writeInnerHTML = function (pID,pContent) {\n\t\tthis.writeParentInnerHTML(this.aRootDOM,pID,pContent);\n\t};\n\t//#################################################################\n\t//# Nested: writeParentInnerHTML\n\t//#################################################################\n\tthis.writeParentInnerHTML = function (pParent,pID,pContent) {\n\t\tvar vOutNode = this.getChildById(pParent,pID);\n\t\tif (vOutNode) {\n\t\t\tvOutNode.innerHTML = pContent;\n\t\t} else {\n\t\t\tthis.alertDOM(\"For ID=\"+pID+\" is writeParentInnerHTML() not defined\");\n\t\t}\n\t};\n\t//#################################################################\n\t//# Nested: writeParentValue\n\t//#################################################################\n\tthis.writeParentValue = function (pParent,pID,pContent) {\n\t\tvar vOutNode = this.getChildById(pParent,pID);\n\t\tif (vOutNode) {\n\t\t\tvOutNode.value = pContent;\n\t\t} else {\n\t\t\tthis.alertDOM(\"For ParentID=\"+pParent.id+\" and ID=\"+pID+\" in writeParentValue() not defined\");\n\t\t}\n\t};\n\t//#################################################################\n\t//# Nested: writeInnerHTML4Math\n\t//#################################################################\n\tthis.writeInnerHTML4Math = function (pNodeID,pContent) {\n\t\tvar vOutNode = this.getElementById(pNodeID);\n\t\tif (vOutNode) {\n\t\t\tvOutNode.innerHTML = pContent;\n\t\t\tthis.processMathNode(vOutNode);\n\t\t} else {\n\t\t\talert(\"writeInnerHTML4Math()-Error: pNodeID='\"+pNodeID+\"' not found!\");\n\t\t}\n\t};\n\t//#################################################################\n\t//# Nested: writeInnerHTML4Step\n\t//#################################################################\n\tthis.writeInnerHTML4Step = function (pStep,pClassID,pContent) {\n\t\tvar vRootNode = this.getElementById(\"STUDENTANSWER\"+this.aQID+pStep);\n\t\tthis.writeInnerHTML4Root(vRootNode,pClassID,pContent);\n\t};\n\t//#################################################################\n\t//# Nested: writeSelectionClick\n\t//#################################################################\n\tthis.writeSelectionClick = function (pStep,pClassID,pValue) {\n\t\t//alert(\"writeSelectionClick():2402 - Value=\"+pValue+\" writeDOM to \"+pClassID+this.aQID+pStep);\n\t\tvar vNode = this.getElementById(pClassID+this.aQID+pStep);\n\t\tvNode.value = pValue;\n\t};\n\t//#################################################################\n\t//# Nested: writeValue4Step\n\t//#################################################################\n\tthis.writeValue4Step = function (pStep,pClassID,pValue) {\n\t\tvar vNode = this.getElementById(pClassID+this.aQID+pStep);\n\t\tvNode.value = pValue;\n\t};\n\t//#################################################################\n\t//# Nested: writeInnerHTML4Root\n\t//#################################################################\n\tthis.writeInnerHTML4Root = function (pRootDOM,pClassID,pContent) {\n\t\t//var vOutNode = document.getElementById(pID);\n\t\t//var vOutNode = this.getChildById(this.aRootDOM,pID);\n\t\tif (pRootDOM) {\n\t\t\t//alert(\"writeInnerHTML4Root()-Call pRootDOM.id=\"+pRootDOM.id+\" exists\");\n\t\t\tvar vOutList = this.getChildrenByClassName(pRootDOM,pClassID);\n\t\t\tif (vOutList.length == 0) {\n\t\t\t\tthis.alertDOM(\"vOutList with ID=\"+pClassID+\" in writeInnerHTML4Root() not defined\");\n\t\t\t} else {\n\t\t\t\tvar k=0;\n\t\t\t\twhile (k !=vOutList.length) {\n\t\t\t\t\tvOutList[k].innerHTML = pContent;\n\t\t\t\t\tk++;\n\t\t\t\t};\n\t\t\t}\n\t\t} else {\n\t\t\tthis.alertDOM(\"pRootDOM for Search-ID=\"+pClassID+\" in writeInnerHTML4Root() not defined\");\n\t\t}\n\t};\n\t//#################################################################\n\t//# Nested: writeSolution2SA()\n\t//#################################################################\n\tthis.writeSolution2SA = function () {\n\t\t//alert(\"writeSolution2SA:2343\");\n\t\tvar vOut = \"\";\n\t\tvar vCR = \"\";\n\t\tvar vPrevious = \" \";\n\t\tvar vPrevID = \"\";\n\t\tvar vInput = this.getIMathById(\"SOLUTION\").value;\n\t\tvar vHash = new Array();\n\t\tthis.initExportHashSA(vHash);\n\t\tvar vID = \"\";\n\t\tvar vStepCount = 0;\n\t\tif (vInput) {\n\t\t\tvar vListArray = vInput.split(this.CR);\n\t\t\tvar k=0;\n\t\t\tthis.checkSolStep(\" \");\n\t\t\twhile (k != vListArray.length) {\n\t\t\t\tif (this.greater(vListArray[k].indexOf(this.aSeparator) , 0)) {\n\t\t\t\t\tvar vSolStep = new Array();\n\t\t\t\t\tvar vSplitRec = vListArray[k].split(this.aSeparator);\n\t\t\t\t\t//-----HASH FORMAT----------------------------------------------\n\t\t\t\t\t//this.aStudAnsFormat = new Array(\"PREVIOUS\",\"CONNECTION\",\"ID\",\"JUST\",\"OPTJUST\",\"MANSCORE\",\"SUGUSED\",\"ASSUSED\",\"SELCON\",\"SELID\",\"SELJUST\",\"VALUE\");\n\t\t\t\t\t//----Solution Structure of SplitRec----------------------------------------\n\t\t\t\t\t// [0] PrevID -|- [1] ID -|- [2] Con -|- [3] JustArray -|- [4] OptJustArray [5] JustOK = unionarray of [3] and [4]\n\t\t\t\t\tif (this.lower(vSplitRec.length,4)) {\n\t\t\t\t\t\talert(\"Length Warning Solution Step: \"+vListArray[k]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvStepCount++;\n\t\t\t\t\t\tvID = vSplitRec[1];\n\t\t\t\t\t\tvHash[\"VALUE\"] = vStepCount;\n\t\t\t\t\t\t//---------------------\n\t\t\t\t\t\t//--- \"PREVIOUS\"-------\n\t\t\t\t\t\tvPrevID = vSplitRec[0];\n\t\t\t\t\t\tif (vPrevious != vPrevID) {\n\t\t\t\t\t\t\tvHash[\"PREVIOUS\"]=vPrevID;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tvHash[\"PREVIOUS\"]=\"\";\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvHash[\"ID\"] = vID;\n\t\t\t\t\t\tvHash[\"CONNECTION\"] = vSplitRec[2];\n\t\t\t\t\t\tvHash[\"JUST\"] = vSplitRec[3];\n\t\t\t\t\t\tvHash[\"OPTJUST\"] = vSplitRec[4];\n\t\t\t\t\t\t//---------------------\n\t\t\t\t\t\tvOut += vCR + this.exportHashSA2Form(vHash);\n\t\t\t\t\t\tvCR = this.CR;\n\t\t\t\t\t\tvPrevious = vID;\n\t\t\t\t\t\tthis.aSolUsedID[vID] = vID;\n\t\t\t\t\t};\n\t\t\t\t\t//--------------------------------------------------------------------------\n\t\t\t\t}\n\t\t\t\tk++;\n\t\t\t};\n\t\t} else {\n\t\t\talert(\"writeSolution2SA() - No Solution Defined!\");\n\t\t};\n\t\tvar vIMathSA = this.getIMathById(\"STUDENTANSWER\");\n\t\t//alert(\"BEFORE:\"+vIMathSA.value);\n\t\tvIMathSA.value = vOut;\n\t\t//alert(\"AFTER:\"+vIMathSA.value);\n\t\tthis.setIMathStepCount(vStepCount);\n\t};\n\t//#################################################################\n\t//# Nested: greater(a,b)\n\t//#################################################################\n\tthis.greater = function (a,b) {\n\t //var vReturn = (a greater b);\n\t eval(decodeURI(\"var vReturn%20=%20(a%3Eb)\"));\n\t return vReturn;\n\t};\n\t//#################################################################\n\t//# Nested: lower(a,b)\n\t//#################################################################\n\tthis.lower = function (a,b) {\n\t //var vReturn = (a lower b);\n\t eval(decodeURI(\"vReturn%20=%20(a%3Cb)\"));\n\t return vReturn;\n\t};\n\t//#################################################################\n\t//# Method: debugValue()\n\t//#################################################################\n\tthis.debugValue = function (pLabel) {\n\t\tvar vDOM = \"imathSTUDENTANSWER\";\n\t\tvar vValue = this.getElementById(vDOM).value;\n\t\talert(\"debugValue(\"+pLabel+\"):3696 \"+vDOM+\"='\"+vValue+\"'\");\n\t\t//var vMsg = \"\";\n\t\t//for (var iID in vAnswerHash) {\n\t\t//\tvMsg +=iID+\"=\"+vAnswerHash[iID]+this.CR;\n\t\t//};\n\t\t//alert(vMsg);\n\n\t};\n\t//#################################################################\n\t//# Nested: decodeValue\n\t//#################################################################\n\tthis.decodeValue = function (pValue) {\n\t\tvar vRet = \"undefined decodeValue()\";\n\t\tif (pValue) {\n\t\t\tpValue = pValue.replace(/__qu__/g,this.QU);\n\t\t\tvRet = this.decodeValueNoQuotes(pValue);\n\t\t}\n\t\treturn vRet;\n\t};\n\t//#################################################################\n\t//# Nested: decodeValueNoQuotes\n\t//#################################################################\n\tthis.decodeValueNoQuotes = function (pValue) {\n\t\tif (pValue) {\n\t\t\tpValue = pValue.replace(/__math__/g,this.AP);\n\t\t\tpValue = pValue.replace(/__eq__/g,\"=\");\n\t\t\teval(decodeURI(\"pValue=pValue.replace(/__gt__/g,%22%3E%22)\"));\n\t\t\teval(decodeURI(\"pValue=pValue.replace(/__lt__/g,%22%3C%22)\"));\n\t\t\tpValue = pValue.replace(/__CO__/g,\",\");\n\t\t\tpValue = pValue.replace(/__co__/g,\",\");\n\t\t\tpValue = pValue.replace(/__ae__/g,\"ä\");\n\t\t\tpValue = pValue.replace(/__oe__/g,\"ö\");\n\t\t\tpValue = pValue.replace(/__ue__/g,\"ü\");\n\t\t\tpValue = pValue.replace(/__AE__/g,\"Ä\");\n\t\t\tpValue = pValue.replace(/__OE__/g,\"Ö\");\n\t\t\teval(decodeURI(\"pValue=pValue.replace(/__OE__/g,%22%EF%BF%BD%22)\"));\n\t\t\tpValue = pValue.replace(/__UE__/g,\"Ü\");\n\t\t\tpValue = pValue.replace(/__sz__/g,\"ß\");\n\t\t\treturn pValue;\n\t\t} else {\n\t\t\treturn \"\";\n\t\t}\n\t};\n\t//#################################################################\n\t//# Nested: encodeCR\n\t//#################################################################\n\tthis.encodeCR = function (pValue) {\n\t\t// __n__ eval(decodeURI(\"pValue=pValue.replace(/%5C%5Cn/g,%22__n__%22)\"));\n\t\teval(decodeURI(\"pValue=pValue.replace(/%5Cn/g,%22,%22)\"));\n\t\treturn pValue;\n\t};\n\t//#################################################################\n\t//# Nested: encodeCommaForm\n\t//#################################################################\n\tthis.encodeCommaForm = function (pValue) {\n\t\tpValue = pValue.replace(/,/g,this.aComma);\n\t\treturn pValue;\n\t};\n\t//#################################################################\n\t//# Nested: decodeCommaForm\n\t//#################################################################\n\tthis.decodeCommaForm = function (pValue) {\n\t\teval(\"pValue=pValue.replace(/\"+this.aComma+\"/g,',')\");\n\t\treturn pValue;\n\t};\n\t//#################################################################\n\t//# Nested: decodeCR\n\t//#################################################################\n\tthis.decodeCR = function (pValue) {\n\t\t//pValue = pValue.replace(/__n__/g,this.CR);\n\t\tpValue = pValue.replace(/,/g,this.CR);\n\t\treturn pValue;\n\t};\n\t//#################################################################\n\t//# Nested: decodeTextarea\n\t//#################################################################\n\tthis.decodeTextarea = function (pValue) {\n\t pValue = this.decodeValue(pValue);\n\t pValue = pValue.replace(/__n__/g,this.CR);\n\t //eval(decodeURI(\"pValue%20=%20pValue.replace(/__n__/g,%22%5Cn%22)\"));\n\t return pValue;\n\t};\n\t//#################################################################\n\t//# Nested: encodeTextarea\n\t//#################################################################\n\tthis.encodeTextarea = function (pValue) {\n\t pValue = this.encodeValue(pValue);\n\t pValue = this.encodeTextareaCR(pValue);\n\t //pValue = pValue.replace(/__n__/g,this.CR);\n\t //eval(decodeURI(\"pValue%20=%20pValue.replace(/%5Cn/g,%22__n__%22)\"));\n\t return pValue;\n\t};\n\t//#################################################################\n\t//# Nested: encodeTextareaCR\n\t//#################################################################\n\tthis.encodeTextareaCR = function (pValue) {\n\t eval(decodeURI(\"pValue=pValue.replace(/%5Cn/g,%22__n__%22)\"));\n\t return pValue;\n\t};\n\t//#################################################################\n\t//# Nested: encodeValue\n\t//#################################################################\n\tthis.encodeValue = function (pValue) {\n\t\tif (pValue) {\n\t\t\teval(\"pValue = pValue.replace(/\"+this.AP+\"/g,\"+this.QU+\"__math__\"+this.QU+\")\");\n\t\t\teval(\"pValue = pValue.replace(/\"+this.LT+\"/g,\"+this.QU+\"__lt__\"+this.QU+\")\");\n\t\t\teval(\"pValue = pValue.replace(/\"+this.GT+\"/g,\"+this.QU+\"__gt__\"+this.QU+\")\");\n\t\t\tpValue = pValue.replace(/,/g,\"__co__\");\n\t\t\tpValue = pValue.replace(/=/g,\"__eq__\");\n\t\t\tpValue = pValue.replace(/\"/g,\"__qu__\");\n\t\t\tpValue = pValue.replace(/ä/g,\"__ae__\");\n\t\t\tpValue = pValue.replace(/ö/g,\"__oe__\");\n\t\t\tpValue = pValue.replace(/ü/g,\"__ue__\");\n\t\t\tpValue = pValue.replace(/Ä/g,\"__AE__\");\n\t\t\t//pValue = pValue.replace(/Ö/g,\"__OE__\");\n\t\t\teval(decodeURI(\"pValue%20=%20pValue.replace(/%EF%BF%BD/g,%22__OE__%22)\"));\n\t\t\tpValue = pValue.replace(/Ü/g,\"__UE__\");\n\t\t\tpValue = pValue.replace(/ß/g,\"__sz__\");\n\t\t\treturn pValue;\n\t\t} else {\n\t\t\treturn \"\";\n\t\t};\n\t};\n\t//#################################################################\n}",
"function initialise (quizz){\n if (quizz === \"kaamelott\") {\n kaamelott.forEach(item => {\n questionArray.push(new Question(item[0], item[1], item[2], item[3], item[4], item[item[5]]));\n });\n } else if (quizz === \"manga\") {\n manga.forEach(item => {\n questionArray.push(new Question(item[0], item[1], item[2], item[3], item[4], item[item[5]]));\n });\n }\n addQuestion(questionArray[ind]);\n}",
"function Dice(sides){\n\tthis.sides = sides;\n}",
"function getElectionsResults() {\n \t return electionsResults;\n } // getElectionsResults",
"function solveClasses() {\n class Developer {\n constructor ( firstName, lastName ) {\n this.firstName = firstName; \n this.lastName = lastName; \n this.baseSalary = 1000; \n this.tasks = []; \n this.experience = 0; \n }\n addTask ( id, name, priority ) {\n let obj = {id, name, priority};\n if(priority == 'high') this.tasks.unshift(obj);\n else this.tasks.push(obj);\n return Task id ${id}, with ${priority}",
"constructor(mongoose) {\n // This is the schema we need to store kittens in MongoDB\n const questionSchema = new mongoose.Schema({\n question: String,\n answers: [{ answer: String, votes: Number }]\n });\n\n // This model is used in the methods of this class to access kittens\n this.questionModel = mongoose.model('question', questionSchema);\n }",
"function Restaurant(name, type, stars) {\n this.name = name;\n\tthis.type = type;\n this.stars = stars;\n \n this.addStars = function (num) {\n this.stars += num;\n return this.stars;\n };\n}",
"function buildTestAnswers(questionid) {\n\tvar answer1 = new newAnswer(\"other\", \"Yes it does.\");\n\tvar answer2 = new newAnswer(\"other\", \"No it doesn't.\");\n\tallPosts[questionid].answers.push(answer1);\n\tallPosts[questionid].answers.push(answer2);\n}",
"static init(diagnoses = []) {\n const self = new DoctorRegistrar();\n self.diagnoses = diagnoses; // diagnoses.forEach(diagnosis => self.diagnoses.push(diagnosis));\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Expand the next token only once (if possible), and return the resulting top token on the stack (without removing anything from the stack). Similar in behavior to TeX's `\expandafter\futurelet`. Equivalent to expandOnce() followed by future(). | expandAfterFuture() {
this.expandOnce();
return this.future();
} | [
"expandMacro(name) {\n if (!this.macros.get(name)) {\n return undefined;\n }\n\n const output = [];\n const oldStackLength = this.stack.length;\n this.pushToken(new Token(name));\n\n while (this.stack.length > oldStackLength) {\n const expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded.\n\n if (expanded instanceof Token) {\n output.push(this.stack.pop());\n }\n }\n\n return output;\n }",
"future() {\n if (this.stack.length === 0) {\n this.pushToken(this.lexer.lex());\n }\n\n return this.stack[this.stack.length - 1];\n }",
"function once$1() {\n let first = true;\n return async () => {\n if (first) {\n first = false;\n return true;\n }\n return false;\n };\n}",
"function getNextToken(){\n currentToken = tokens[0];\n tokens.shift();\n}",
"_getExpansion(name) {\n const definition = this.macros.get(name);\n\n if (definition == null) {\n // mainly checking for undefined here\n return definition;\n }\n\n const expansion = typeof definition === \"function\" ? definition(this) : definition;\n\n if (typeof expansion === \"string\") {\n let numArgs = 0;\n\n if (expansion.indexOf(\"#\") !== -1) {\n const stripped = expansion.replace(/##/g, \"\");\n\n while (stripped.indexOf(\"#\" + (numArgs + 1)) !== -1) {\n ++numArgs;\n }\n }\n\n const bodyLexer = new Lexer(expansion, this.settings);\n const tokens = [];\n let tok = bodyLexer.lex();\n\n while (tok.text !== \"EOF\") {\n tokens.push(tok);\n tok = bodyLexer.lex();\n }\n\n tokens.reverse(); // to fit in with stack using push and pop\n\n const expanded = {\n tokens,\n numArgs\n };\n return expanded;\n }\n\n return expansion;\n }",
"advanceStack(stack, stacks, split) {\n let start = stack.pos,\n { parser } = this\n let base = verbose ? this.stackID(stack) + ' -> ' : ''\n if (this.stoppedAt != null && start > this.stoppedAt)\n return stack.forceReduce() ? stack : null\n if (this.fragments) {\n let strictCx = stack.curContext && stack.curContext.tracker.strict,\n cxHash = strictCx ? stack.curContext.hash : 0\n for (let cached = this.fragments.nodeAt(start); cached; ) {\n let match =\n this.parser.nodeSet.types[cached.type.id] == cached.type\n ? parser.getGoto(stack.state, cached.type.id)\n : -1\n if (\n match > -1 &&\n cached.length &&\n (!strictCx ||\n (cached.prop(dist_NodeProp.contextHash) || 0) == cxHash)\n ) {\n stack.useNode(cached, match)\n if (verbose)\n console.log(\n base +\n this.stackID(stack) +\n ` (via reuse of ${parser.getName(cached.type.id)})`\n )\n return true\n }\n if (\n !(cached instanceof dist_Tree) ||\n cached.children.length == 0 ||\n cached.positions[0] > 0\n )\n break\n let inner = cached.children[0]\n if (inner instanceof dist_Tree && cached.positions[0] == 0)\n cached = inner\n else break\n }\n }\n let defaultReduce = parser.stateSlot(\n stack.state,\n 4 /* ParseState.DefaultReduce */\n )\n if (defaultReduce > 0) {\n stack.reduce(defaultReduce)\n if (verbose)\n console.log(\n base +\n this.stackID(stack) +\n ` (via always-reduce ${parser.getName(\n defaultReduce & 65535 /* Action.ValueMask */\n )})`\n )\n return true\n }\n if (stack.stack.length >= 15000 /* Rec.CutDepth */) {\n while (\n stack.stack.length > 9000 /* Rec.CutTo */ &&\n stack.forceReduce()\n ) {}\n }\n let actions = this.tokens.getActions(stack)\n for (let i = 0; i < actions.length; ) {\n let action = actions[i++],\n term = actions[i++],\n end = actions[i++]\n let last = i == actions.length || !split\n let localStack = last ? stack : stack.split()\n localStack.apply(action, term, end)\n if (verbose)\n console.log(\n base +\n this.stackID(localStack) +\n ` (via ${\n (action & 65536) /* Action.ReduceFlag */ == 0\n ? 'shift'\n : `reduce of ${parser.getName(\n action & 65535 /* Action.ValueMask */\n )}`\n } for ${parser.getName(term)} @ ${start}${\n localStack == stack ? '' : ', split'\n })`\n )\n if (last) return true\n else if (localStack.pos > start) stacks.push(localStack)\n else split.push(localStack)\n }\n return false\n }",
"next() {\n let tmp = this.currentNode.next();\n\n if (!tmp.done) {\n this.currentNode = tmp.value;\n this.ptree();\n }\n\n return tmp;\n }",
"function once(callback) {\n let count = 0;\n let result;\n\n function innerFunc(num){\n if(count === 0){\n result = callback(num); // 6\n count++ // count = 1\n return result // 6\n } else {\n return result //6\n }\n \n }\n return innerFunc\n}",
"function getSetImmediate() {\n /* istanbul ignore else */\n if (typeof setImmediate === 'function') {\n return setImmediate;\n } else {\n return function (fn) {\n return setTimeout(fn, 0);\n };\n }\n}",
"function peek() {\n return tokens[position];\n }",
"function addg(first){\n\tfunction more(next){\n\t\tif (next === undefined){\n\t\t\treturn first;\n\t\t}\n\t\tfirst += next;\n\t\treturn more;\n\t}\n\tif (first !== undefined){\n\t\treturn more;\n\t}\n}",
"function ALift(async_f) {\n var f = function() {\n if (arguments[0] == ONI_FEXP_TO_OEN_TOKEN) {\n return new OAN_ALift(async_f);\n }\n else {\n var exps = slice_args(arguments, 0);\n exps.unshift(new OAN_ALift(async_f));\n return Apply.apply(this, exps);\n }\n };\n f._type = ONI_FEXP_TOKEN;\n return f;\n}",
"next(enter = true) {\n return this.move(1, enter)\n }",
"finishRepeat() {\n const instruction = this.state.pattern[this.state.instrIndex];\n let i = this.state.tokIndex;\n do {\n i++\n } while (instruction[i].type !== TokenType.CLS_PAREN);\n i++\n\n // instruction[i] is token directly after ')'. move on to next token/instruction and pop repeat stack.\n if (!instruction[i]) {\n // need to move on to next instruction\n this.setState({\n instrIndex: this.state.instrIndex + 1,\n tokIndex: 0,\n repeats: [],\n }, () => {\n if (instruction[this.state.instrIndex].type !== TokenType.STR) this.next(); // leave us off at next string\n })\n } else {\n this.setState({\n tokIndex: i,\n repeats: JSON.parse(JSON.stringify(this.state.repeats.slice(0, -1))),\n }, () => {\n if (instruction[i].type !== TokenType.STR) this.next(); // leave us off at next string\n })\n }\n }",
"findForcedReduction() {\n let { parser } = this.p,\n seen = []\n let explore = (state, depth) => {\n if (seen.includes(state)) return\n seen.push(state)\n return parser.allActions(state, (action) => {\n if (\n action &\n (262144 /* Action.StayFlag */ | 131072) /* Action.GotoFlag */\n );\n else if (action & 65536 /* Action.ReduceFlag */) {\n let rDepth = (action >> 19) /* Action.ReduceDepthShift */ - depth\n if (rDepth > 1) {\n let term = action & 65535 /* Action.ValueMask */,\n target = this.stack.length - rDepth * 3\n if (\n target >= 0 &&\n parser.getGoto(this.stack[target], term, false) >= 0\n )\n return (\n (rDepth << 19) /* Action.ReduceDepthShift */ |\n 65536 /* Action.ReduceFlag */ |\n term\n )\n }\n } else {\n let found = explore(action, depth + 1)\n if (found != null) return found\n }\n })\n }\n return explore(this.state, 0)\n }",
"function advance(transState) {\n let {pattern, instrIndex, tokIndex, finished} = transState;\n let repeats = transState.repeats.slice();\n\n if (pattern[instrIndex][tokIndex].type === TokenType.OPN_PAREN) {\n // '(': create new repeat\n repeats.push({index: tokIndex, numRepeats: 0});\n tokIndex++;\n } else if (pattern[instrIndex][tokIndex].type === TokenType.CLS_PAREN) {\n // ')' do we continue or repeat?\n if (needToRepeat(pattern[instrIndex], tokIndex, repeats[repeats.length - 1].numRepeats)){\n // go back to beginning of repeat\n tokIndex = repeats[repeats.length-1].index + 1;\n repeats[repeats.length - 1].numRepeats++;\n } else {\n // finish repeat\n repeats.pop();\n tokIndex++;\n }\n\n } else {\n tokIndex++;\n }\n\n if (!pattern[instrIndex][tokIndex]) {\n // need to move on to next instruction\n if(instrIndex >= pattern.length - 1) {\n // already on last instruction\n tokIndex = transState.tokIndex;\n repeats = transState.repeats.slice();\n finished = true;\n } else {\n instrIndex++;\n tokIndex = 0;\n }\n }\n\n transState.pattern = pattern;\n transState.instrIndex = instrIndex;\n transState.tokIndex = tokIndex;\n transState.repeats = repeats;\n transState.finished = finished;\n\n}",
"function next () {\n var a = actions.shift()\n if ( a ) {\n a( function ( err ) {\n if ( err ) throw err\n // setTimeout( next, ACTION_INTERVAL )\n } )\n } else {\n setTimeout( finish, ACTION_INTERVAL )\n }\n }",
"function nextEmail() {\n if (!promiseQueue.length) makePromise()\n return promiseQueue.shift()\n}",
"function doExpand() {\n _result = expand(_specs);\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the keyword for the selected value in the hkTypeForm UI element | function getHkTypeFromForm() {
return document.getElementById("hkTypeForm").value;
} | [
"_getSelectionItemType()\n {\n var keys = this.getSelectedItemKeys();\n var itemType = null;\n var urls = [];\n for (var index in keys)\n {\n var item = this.getSelectedItem(keys[index]);\n if (itemType === null)\n {\n itemType = item.constructor;\n }\n }\n return itemType;\n }",
"function getTypeTerm() {\n switch ($(\"#school-type\").val()) {\n case null:\n return [\"Primary\", \"Secondary\", \"Combined\", \"Special\"];\n default:\n return [$(\"#school-type\").val()];\n }\n}",
"setOptionValueType (event) {\n let selectedIndex = this.valueTypeRef.selectedIndex\n let selected = this.valueTypeRef.options[selectedIndex]\n this.setState({\n 'optionType': selected.value\n })\n }",
"function brand()\r\n{\r\n selBrand= def.options[def.selectedIndex].text;\r\n}",
"get select_value() {\n return (this.select == undefined) ? this.select_config.default : this.select.selectedOption;\n }",
"function getElementValue(element) {\n switch (element.tagName) {\n case 'SELECT':\n var value = element.options[element.selectedIndex].value;\n if (value.indexOf(';') == 1)\n return value.substr(2);\n return value;\n case 'INPUT':\n return element.value;\n }\n\n return undefined;\n}",
"function getTransactionType(element){\n\t\n\t\treturn element.options[element.selectedIndex].value;\t\t\n\t}",
"function GetOptionSetTextValue(executionContext) {\n try {\n //Get the form context\n var formContext = executionContext.getFormContext();\n //Get text value of the option set field here, Give field logical name here\n var optionSetTextValue = formContext.getAttribute(\"new_gender\").getText();\n Xrm.Utility.alertDialog(optionSetTextValue);\n }\n catch (e) {\n Xrm.Utility.alertDialog(e.message);\n }\n}",
"function getValuesBrowseDisplayLabel(result) {\n if (result.type == 'Ontology') {\n return result.name.trim();\n } else if (result.type == 'ValueSet') {\n return result.prefLabel.trim();\n }\n }",
"function getFont(){ \n\tvar fontForm = document.getElementById(\"fonts\");\n\tif(fontForm.selectedIndex == 0){\n\t\treturn \"Ubuntu\";\n\t}\n\tvar fontSelection = fontForm.options[fontForm.selectedIndex].value;\n\treturn fontSelection;\n}",
"function getVenueType(name) {\n var venueType = 0;\n var theForm = document.forms[\"totalCost\"];\n var selectedVenue = theForm.elements[name + \"Venue\"];\n venueType = typeVenue[selectedVenue.value];\n return venueType;\n}",
"function ShowSelectedFieldInputForm(field_title, field_type, field_id){\n \n}",
"function getParcoursLabel(){\n return $(parcours_filter+\" option:selected\").html();\n}",
"function getLabelFromElement(element) {\n // We use innerText here instead of textContent because we want the rendered\n // text. If, e.g., a text node includes a span with `display: none`,\n // textContent would include that hidden text, but innerText would leave it\n // out -- which is what we want here.\n if (\"selectedText\" in element) {\n // Element (most likely Elix) with selectedText property\n return element.selectedText;\n } else if (\"value\" in element && \"options\" in element) {\n // select or select-like element\n const value = element.value;\n const option = element.options.find((option) => option.value === value);\n return option ? option.innerText : \"\";\n } else if (\"value\" in element) {\n // Other input element\n return element.value;\n } else {\n // Other\n return element.innerText;\n }\n}",
"function acHighlightedText() {\n return Selector(\".autocomplete-item.highlighted\").textContent;\n}",
"function getValue(comboid) {\n return $('#' + comboid + ' option:selected').val();\n}",
"get fieldValue(){}",
"function orksClanName() {\r\n return document.getElementById('orks-addendum-select').value;\r\n}",
"function formField(type, key, val, units) \n{\n if(type == 'chooseOne') return chooseOneField(key, val);\n else return inputField(key, val, units);\n}",
"function getLabelValue(option) {\n\n //Null value?\n if (option === null || typeof option === 'undefined') {\n return '';\n }\n\n //Non object? Use its value\n if (!angular.isObject(option)) {\n return option;\n }\n\n //Must have label property\n if (!labelBy) {\n $log.warn('Missing label-by property for type ahead');\n return '';\n }\n\n //Validate property\n if (typeof option[labelBy] === 'undefined') {\n $log.warn('Unknown property `' + labelBy + '` for type ahead label');\n return '';\n }\n\n //Return the property\n return option[labelBy];\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
onEditPagePasswordType is invoked when password type selection is changed. | function onEditPagePasswordType(page, typeSelect) {
let disablePasswords = true;
if (typeSelect.value == "") {
disablePasswords = false;
}
// Toggle enabled/disabled flag on the password fields.
var pass = page.getElementsByClassName("edit-page-password")[0];
pass.disabled = disablePasswords;
var repeat = page.getElementsByClassName("edit-page-repeat-password")[0];
repeat.disabled = disablePasswords;
if (disablePasswords) {
generateEditPagePassword(page);
} else {
setEditPagePassword(page, "", "");
}
autoEditPageDoneButton(page);
autoEditPageUndoButton(page);
autoEditPageCopyButton(page);
autoEditPagePasswordSize(page);
autoEditPageGenerateButton(page);
} | [
"function updatePwLength() {\n let targetType = event.target.type;\n pwLength = event.target.value;\n\n if (targetType == \"range\") {\n document.getElementById(\"pw-length-textbox\").value = pwLength;\n } else {\n document.getElementById(\"pw-length-range\").value = pwLength;\n }\n\n displayPasswordToTextArea();\n}",
"function onConfirmPasswordChange(p) {\n let val = p.target.value;\n setConfirmPassword(val);\n setEnabled(password.length > 0 && name.length > 0 && email.length > 0 && val.length > 0 && number.length==10);\n }",
"function showPass() {\n const password = document.getElementById('password');\n const rePassword = document.getElementById('masterRePassword');\n if (password.type === 'password') {\n password.type = 'text';\n rePassword.type = 'text';\n logMe(\"User\", \"Toggle-Password\", \"Create ByPass account\", \"ON - Password Confirm Input : \" + password.value);\n } else {\n password.type = 'password';\n rePassword.type = 'password';\n logMe(\"User\", \"Toggle-Password\", \"Create ByPass account\", \"OFF - Password Confirm Input : \" + password.value);\n }\n} // show password function",
"function togglePasswordVisibility() {\n let x = document.getElementById(\"login-password\");\n if (x.type === \"password\") {\n x.type = \"text\";\n } else {\n x.type = \"password\";\n }\n}",
"function onCheckPasswordChange(newModel) {\n vm.userCopy.passwordMismatch = vm.userCopy.newPassword != newModel;\n }",
"_handleChangePasswordSuccess(response)\n {\n Radio.channel('rodan').trigger(RODAN_EVENTS.EVENT__USER_CHANGED_PASSWORD);\n }",
"handleOldpassStringChange(e) {\n this.setState({\n oldPassword: e.target.value,\n });\n }",
"function onSelectFieldType( type ) {\n\n\n \n /** \n\n switch( type ) {\n\n case 'new':\n\n apiFetch( { path: '/dev/wp-json/wp/v2/posts' } ).then( posts => {\n console.log( 'new', posts );\n } );\n\n break;\n\n case 'existing':\n\n apiFetch( { path: '/dev/wp-json/wp/v2/posts' } ).then( posts => {\n console.log( 'existing', posts );\n } );\n\n \n break;\n }\n\n */\n\n\n setAttributes( { fieldType: type } )\n\n\n }",
"function changePasswordLength(){\n\tconst len = this.value;\n\tgebi('passLengthView').innerHTML = someThing(len, 'символ', 'символа', 'символов');\n\tlet className = '';\n\tif(len > 20){\n\t\tclassName += 'alert-info';\n\t}else if (len<8){\n\t\tclassName += 'alert-warning';\n\t}\n\tgebi('passwordStrength').className = className;\n}",
"function notifyPasswordNotSupported () {\n console.warn('room passwords not supported');\n APP.UI.messageHandler.showError(\n \"dialog.warning\", \"dialog.passwordNotSupported\");\n}",
"function passwordEvent(){\n //Find out if password is valid \n if(isPasswordValid()) {\n //Hide hint if valid\n $password.next().hide();\n } else {\n //else show hint\n let msgLen = validLength(8,100, $password, 'password').msg;\n let msgReg = regexCheck($password, 'password').msg;\n let eleLen = `<span>${msgLen}</span>`;\n let eleReg = `<span>${msgReg}</span>`;\n let ele = msgLen?msgReg?eleLen+eleReg:eleLen:eleReg\n\n $('#passwordMsg').html(ele).show();\n }\n}",
"function postUpdatePassword(req, res) {\r\n\tif (req.session.uid) {\r\n\t\tvar query = \"UPDATE Users SET password=? WHERE uid=?\";\r\n\t\tdatabase.query(req, res, query, [req.body.password, req.session.uid], ajaxSimplePostCbFcn);\r\n\t}\r\n}",
"handlePasswordToCheck(e) {\n this.setState({\n // this gets the password from the form. \n passwordToCheck: e.target.value\n })\n }",
"function SEC_onEditControlKeyDown(event){SpinEditControl.onEditControlKeyDown(event);}",
"function handleUserResetPwdOnSuccess(user_reset_pwd_obj) {\n\tresetPswd = true;\n $(\"#LogingetPwd\").hide();\n $(\"#securityQuestionArea\").hide();\n $(\"#forcedPwd\").hide();\n $(\"#login_txt\").val(user_auth_obj.userName);/* Getting user name from USER_AUTH response object and setting it to user name field*/\n $(\"#password_txt\").val($('#re_new_pwd').val());\n showGeneralSuccessMsg(messages['login.resetPwdMsg']);\n}",
"function SEC_onEditControlKeyUp(event){SpinEditControl.onEditControlKeyUp(event);}",
"async _changeSheetType(event, html) {\n event.preventDefault();\n console.log(\"Loot Sheet | Sheet Type changed\", event);\n\n let currentActor = this.actor;\n\n let selectedIndex = event.target.selectedIndex;\n\n let selectedItem = event.target[selectedIndex].value;\n\n await currentActor.setFlag(\"lootsheetnpcpf2e\", \"lootsheettype\", selectedItem);\n \n }",
"function changePassword(id) {\n window.location.href = base_url + '/customer/change-password/' + id;\n}",
"setOptionValueType (event) {\n let selectedIndex = this.valueTypeRef.selectedIndex\n let selected = this.valueTypeRef.options[selectedIndex]\n this.setState({\n 'optionType': selected.value\n })\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to convert an object map to a list | function mapToList(map, id_name) {
var list = [];
for (var key of Object.keys(map)) {
var obj = {};
obj[id_name] = key;
for (var field of Object.keys(map[key])) {
obj[field] = map[key][field];
}
list.push(obj);
}
return list;
} | [
"function mapToJson(map) {\n let arr = [];\n var loopTrough = (value, key, map) => {\n arr.push([key, value]);\n }\n listing.forEach(loopTrough);\n return JSON.stringify(arr);\n}",
"function convertMapsToObjects(arg) {\n if (arg instanceof Map) arg = Object.fromEntries(arg);\n\n if (typeof arg === 'object' && arg !== null) {\n for (const key of Object.keys(arg)) {\n const value = arg[key];\n\n if (typeof value === 'object' && value !== null) {\n arg[key] = convertMapsToObjects(value);\n }\n }\n }\n\n return arg;\n}",
"function getEntries (obj) {\n return Object.keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n}",
"values (obj) {\n\t\tlet values = [];\n\t\tfor (let key in obj) {\n\t\t\tvalues.push(obj[key]);\n\t\t}\n\t\treturn values;\n\t}",
"function convertObjectToArrayAndRetainKeys(convertableObject) {\n\tvar convertedArray = [];\n\t\n\tfor (var key in convertableObject) {\n\t\tconvertedArray.push(Object.assign(convertableObject[key], {name: key}));\n\t}\n\t\n\treturn convertedArray;\n}",
"function convert_my_data( dict_of_dicts) {\n var array_of_dicts = [];\n for (i in dict_of_dicts) {\n obj = dict_of_dicts[i];\n obj['id'] = i; // - add in a unique id/name\n array_of_dicts.push( obj);\n }\n return array_of_dicts;\n }",
"function collectionsMappingAsArray () {\n return objectToArray(COLLECTIONS_MAPPING)\n .filter(function (collection) {\n return !isPseudoCollection(collection.id) && \n (typeof collection.category_id === 'undefined' || collection.category_id === null) &&\n (typeof collection.original_id === 'undefined' || collection.original_id === null);\n });\n }",
"function sc_string2list(s) {\n return sc_jsstring2list(s.val);\n}",
"function collectStrings(obj) {\n let newArr = [];\n\n for (let key in obj) {\n let value = obj[key];\n if (typeof value === \"string\") {\n newArr.push(value);\n } else if (typeof value === \"object\" && !Array.isArray(value)) {\n // console.log(\"1️⃣\", newArr);\n newArr = newArr.concat(collectStrings(value)); // newArr = (3) [\"foo\", \"bar\", \"baz\"]\n // console.log(\"2️⃣\", newArr);\n }\n }\n return newArr;\n}",
"get listExperienceMap() {\n const result = [];\n for (let experience in ListExperience_1.ListExperience) {\n if (typeof ListExperience_1.ListExperience[experience] === 'number') {\n result.push(experience);\n }\n }\n return result;\n }",
"function objectToMap(o) {\n if (o !== undefined && o !== null) {\n return new Map(objectEntries(o));\n }\n return new Map();\n }",
"objectValues(obj) {\n if (obj instanceof Object) {\n return (function*() {\n for (let key in obj) {\n yield obj[key];\n }\n })();\n } else {\n return [];\n }\n }",
"function sortMapValues(o) {\n return Object.values(o).sort((aa, bb) => {\n let a = typeof aa === 'string' ? parseInt(aa, 10) : aa\n let b = typeof bb === 'string' ? parseInt(bb, 10) : bb\n return a === b ? 0 : a < b ? -1 : 1\n })\n}",
"processObjToArray(obj) {\n let tasksArray = [];\n for (let key in obj) {\n tasksArray.push(obj[key]);\n }\n return tasksArray;\n }",
"function asMap(obj) {\n return Object.assign(new Map(), obj);\n}",
"function objToArrayList(graphPoints) {\n var tempPoints=[];\n for (var i=0;i< graphPoints.length; i++)\n {\n if(graphPoints[i].x) {\n tempPoints.push([graphPoints[i].x,graphPoints[i].y]);\n } else {\n tempPoints.push(graphPoints[i]);\n }\n }\n return tempPoints;\n}",
"function getValues(hm){\n\t//initialize resulting array\n\tvar res = [];\n\t//loop thru keys of associative array\n\tfor( var tmpKey in hm ){\n\t\t//get value\n\t\tvar tmpVal = hm[tmpKey];\n\t\t//make sure that acquired value is not a function\n\t\tif( typeof tmpVal != \"function\" ){\n\t\t\t//add value to resulting array of hashmap values\n\t\t\tres.push(tmpVal);\n\t\t}\t//end if value is not a function\n\t}\t//end loop thru keys of associative array\n\treturn res;\n}",
"function mapScalars(f, pojo) {\n assert(isPOJO(pojo));\n if (isScalar(pojo)) {\n return f(pojo);\n } else if (pojo instanceof Array) {\n return pojo.map(subpojo => mapScalars(f, subpojo));\n } else {\n // pojo is a plain object, depending on the assumption that it is a POJO\n var result = {};\n for (let key in pojo) {\n result[key] = mapScalars(f, pojo[key]);\n }\n return result;\n }\n}",
"function Map_Object (variable) { \n var id = variable['syc-object-id'];\n\n // Reset the mapping\n object_map[id] = [];\n\n for (var property in variable) { \n Map_Property(variable, property);\n }\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setExchange sets the exchange for which the fee is being paid. | setExchange (xc) {
this.xc = xc
} | [
"UPDATE_EXCHANGE_TARGET (_state, _exchangeTarget) {\n _state.exchangeTarget = _exchangeTarget\n }",
"UPDATE_EXCHANGE_SOURCE (_state, _exchangeSource) {\n _state.exchangeSource = _exchangeSource\n }",
"triggerOrder(order) {\n if (!(order instanceof ExchangeOrder)) {\n throw 'Invalid order given'\n }\n\n // dont overwrite state closed order\n if (order.id in this.orders && ['done', 'canceled'].includes(this.orders[order.id].status)) {\n return\n }\n\n this.orders[order.id] = order\n }",
"set sellIn(value) {\n if (typeof this.sellIn === 'undefined'){\n this._sellIn = value;\n }\n }",
"function setCenterDesign()\n{\n\tvm.design.centerDesign = _orderCenterDesignField.value;\n}",
"_configureEmail (gatekeeper) {\n if (gatekeeper.email === false) {\n return;\n }\n\n let opts = merge (this.defaultEmailOptions, gatekeeper.email, {\n views: {\n root: path.resolve (__dirname, '../resources/email')\n },\n });\n\n this._email = new Email (opts);\n }",
"switchCurrencies() {\n [this.selectedFromCurrency, this.selectedToCurrency] = [\n this.selectedToCurrency,\n this.selectedFromCurrency,\n ];\n shake(\"#exchange-calculator\");\n }",
"function krnSetQuantum(quantum)\n{\n // If the quantum is a valid number and the scheduler has a quantum set the quantum.\n if(_Scheduler.setQuantum)\n {\n _Scheduler.setQuantum(quantum);\n }\n else\n {\n _StdIn.putText(\"The scheduler doesn't have a quantum.\");\n }\n}",
"set price(value) {\n this._price = 80;\n }",
"setIssue(issue) {\n this.issue = issue;\n }",
"async approveCurrencyForAmount(currency, amount) {\n var { options } = this.props\n \n let market_address = options.contracts.Market.address\n\n if(currency in options.contracts) {\n var contract = options.contracts[currency]\n await contract.approve(market_address, amount)\n }\n }",
"function stateSetApprover() {\n var FlowState = w2ui.propertyForm.record.FlowState;\n var si = getCurrentStateInfo();\n var uid = 0;\n\n if (si == null) {\n console.log('Could not determine the current stateInfo object');\n return;\n }\n if (typeof w2ui.stateChangeForm.record.ApproverName == \"object\" && w2ui.stateChangeForm.record.ApproverName != null) {\n if (w2ui.stateChangeForm.record.ApproverName.length > 0) {\n uid = w2ui.stateChangeForm.record.ApproverName[0].UID;\n }\n }\n if (uid == 0) {\n w2ui.stateChangeForm.error('ERROR: You must select a valid user');\n return;\n }\n si.ApproverUID = uid;\n si.Reason = \"\";\n var x = document.getElementById(\"smApproverReason\");\n if (x != null) {\n si.Reason = x.value;\n }\n if (si.Reason.length < 2) {\n w2ui.stateChangeForm.error('ERROR: You must supply a reason');\n return;\n }\n finishStateChange(si,\"setapprover\");\n}",
"setPaymentProcess(state, bol) {\n state.paymentProcess = bol;\n }",
"setPath(basDerivationPath) {\n this._baseDerivationPath = basDerivationPath;\n }",
"approveCurrency(currency) {\n this.approveCurrencyForAmount(currency, MAX_VAL)\n }",
"function setSelectedCurrency(currency) {\n\tselectedCurrency = currency;\n\tvar currencyOpt = document.getElementById(currency);\n\tif (currencyOpt) {\n\t\tcurrencyOpt.selected = \"selected\";\n\t}\n}",
"setProvider(provider) {\n this.provider = provider;\n }",
"toggleApproval(currency, current_approval) {\n let new_approval = !current_approval\n if(new_approval) {\n this.approveCurrency(currency)\n } else {\n this.unapproveCurrency(currency)\n }\n }",
"setSide (side) {\n this.reversed = (side === 'b')\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the class name is the same as, or inherits from the anotherClassName class. Throws an exception if fullClassName is not registered. | function inheritsFrom (fullClassName, anotherClassName) {
var def = getDefinition(fullClassName);
if ( !def ) {
_scriptFileMissing(fullClassName);
}
return def.inst.instanceOf(anotherClassName);
} | [
"function hasSomeParentTheClass(element, classname) {\n element = element.target;\n if (element.className.split(' ').indexOf(classname)>=0) return true;\n return element.parentNode && hasSomeParentTheClass(element.parentNode, classname);\n}",
"function isMember(element, classname)\r\n\t{\r\n\t\tvar classes = element.className; // Get a list of the classes\r\n\t\t\r\n\t\tif (!classes) \r\n\t\t\treturn false;\r\n\t\tif ( classes == classname )\r\n\t\t\treturn true;\r\n\t\t\t\r\n\t\t// We didn't match exactly, so if there is no whitespace, then\r\n\t\t// this element is not a member of the class.\r\n\t\tvar whitespace = /\\s+/;\r\n\t\tif (!whitespace.test(classes))\r\n\t\t\treturn false;\r\n\t\t\t\r\n\t\t// If we get here, the element is a member of more than one class and\r\n\t\t// we've got to check them individually.\r\n\t\tvar c = classes.split(whitespace); // Split with whitespace delimiter.\r\n\t\tfor( var i=0; i < c.length; i++ )\r\n\t\t{\r\n\t\t\tif ( c[i] == classname )\r\n\t\t\t\treturn true; \r\n\t\t}\r\n\t\treturn false; // None of the classes matched.\r\n\t}",
"function importsIncludes(imports, fullyQualifiedClass) {\n for (const imp of imports) {\n if (imp === fullyQualifiedClass) {\n return true;\n }\n if (denamespace(imp) === '*') {\n // This is a wildcard import. Check if package is the same.\n if (packagify(fullyQualifiedClass) === packagify(imp)) {\n return true;\n }\n }\n }\n return false;\n}",
"function classReplacement(full_name) {\n for (key in cfg_classifications) {\n if (cfg_classifications.hasOwnProperty(key)) {\n if (cfg_classifications[key] == full_name) {\n return ucfirst(key.replace('_', ' '));\n }\n }\n \n }\n}",
"function hasMultipleInstancesOfName( name ){\n\treturn usedNames[ name ] > 1;\n}",
"function instanceOf(obj, base) {\n while (obj !== null) {\n if (obj === base.prototype)\n return true;\n if ((typeof obj) === 'xml') { // Sonderfall mit Selbstbezug\n return (base.prototype === XML.prototype);\n }\n obj = Object.getPrototypeOf(obj);\n }\n\n return false;\n}",
"function isClass(target) {\n return isES6Class(target)\n || target.prototype\n && !(target.prototype instanceof Function)\n && !compareSetValues(\n Object.getOwnPropertyNames(target.prototype), noopProtoKeys)\n}",
"function ensureHasClass(element, statedClass) {\n if (!element.classList.contains(statedClass)) {\n throw new Error(`Element does not have ${statedClass} class`);\n }\n}",
"function isDescendantOf(a, b){\n\tif (a === b) return true\n\tif (descendantsLookup[b]) {\n\t\tif (descendantsLookup[b].indexOf(a) >= 0) return true;\n\t}\n\treturn false;\n}",
"is(name) {\n if (typeof name == 'string') {\n if (this.name == name) return true\n let group = this.prop(dist_NodeProp.group)\n return group ? group.indexOf(name) > -1 : false\n }\n return this.id == name\n }",
"isDescendant(path, another) {\n return path.length > another.length && Path.compare(path, another) === 0;\n }",
"processNamedClass() {\n if (!this.tokens.matches2(tt._class, tt.name)) {\n throw new Error(\"Expected identifier for exported class name.\");\n }\n const name = this.tokens.identifierNameAtIndex(this.tokens.currentIndex() + 1);\n this.processClass();\n return name;\n }",
"hasInheritance(node) {\n let inherits = false;\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n if (match_1.default(child, 'extends', 'implements')) {\n inherits = true;\n }\n }\n return inherits;\n }",
"__getClassStartingWith(node, prefix) {\n return _.filter(\n $(node)\n .attr('class')\n .split(' '),\n className => _.startsWith(className, prefix)\n )[0];\n }",
"function isExistingName(mO, fO, sO, name) {\r\n\r\n return (isExistingModuleOrLibName(name) ||\r\n isExistingFuncName(mO, name) ||\r\n isExistingGridNameInFunc(fO, name) ||\r\n isExistingLetNameInStep(sO, name) ||\r\n isExistingIndexVarNameInStep(sO, name) ||\r\n isKeyword(name));\r\n\r\n}",
"function classFilter(owner) {\r\n\t const name = getDisplayName(owner);\r\n\t return (name !== null && !!(filter.includes(name) ^ excluding));\r\n\t }",
"function isSelf(candidate) {\r\n\treturn (self == candidate);\r\n}",
"function fn_CheckLoginName ( strLogin )\n\t{\n\t\tstrLogin = trimString( strLogin ) ;\n\n\t\tvar checkOK = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._@\";\n\t\tvar checkStr = strLogin ;\n\t\tvar allValid = true;\n\t\tfor (i = 0; i < checkStr.length; i++)\n\t\t{\n\t\t\tch = checkStr.charAt(i);\n\t\t\tfor (j = 0; j < checkOK.length; j++)\n\t\t\t if (ch == checkOK.charAt(j))\n\t\t\t\tbreak;\n\t\t\tif (j == checkOK.length)\n\t\t\t{\n\t\t\t allValid = false;\n\t\t\t break;\n\t\t\t}\n\t\t}\n\t\tif ( ! allValid )\n\t\t{\n\t\t\treturn (false);\n\t\t}\n\n\t\tif ( checkStr.charAt(0) == '-' || checkStr.charAt(0) == '.' || checkStr.charAt(0) == '_' )\n\t\t{\n\t\t\treturn (false);\n\t\t}\n\n\t\treturn (true);\n\t}",
"function walkIfUnique( start, end, Paths, Ancestors ){\n\tvar index;\n\n\tif( Paths.indexOf( path.normalize(path.resolve(start + '/' + end)) ) >= 0 ){\n\t\treturn false;\n\t}\n\t\n\tindex = Ancestors.Starts.indexOf( start );\n\tif( index === -1 ){\n\t\tAncestors.Starts.push( start );\n\t\tAncestors.Ends.push( [end] );\n\t}\n\telse{\n\t\tif( Ancestors.Ends[index].indexOf( end ) >= 0 ){\n\t\t\treturn false;\n\t\t}\n\t\tAncestors.Ends[index].push( end );\n\t}\n\t\n\t//Store the start string as the 'Base' if there is not already a base\n\tif( !Ancestors.Base ) Ancestors.Base = start;\n\t\n\treturn true;\n}",
"function checkName(str) {\n for (var i=0; i < trains.length; i++) {\n if (trains[i]===str) {\n return false;\n }\n }\n return true;\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the type URL for this JPF, reading the header (URL and metadata) if necessary. | get typeURL() {
return this._content[0];
} | [
"function getUrlType() {\n let url = document.location.href\n\n if(url.match(/http(s)?:\\/\\/open\\.spotify\\.com\\/playlist\\/.+/) != null)\n return 'playlist'\n\n if(url.match(/http(s)?:\\/\\/open\\.spotify\\.com\\/album\\/.+/) != null)\n return 'album'\n\n if(url.match(/http(s)?:\\/\\/open\\.spotify\\.com\\/collection\\/tracks/) != null)\n return 'collection'\n\n return 'other' // = Nothing of the above\n}",
"get protocolType() {\n return this.getStringAttribute('protocol_type');\n }",
"lookupDescriptor(any) {\n return this.root.lookupType(AnySupport.stripHostName(any.type_url));\n }",
"getType(){\n const { type } = this.props\n if (type) return type\n return \"posts\"\n }",
"getType() {\n return this.type\n }",
"function mapTypeToSchema(p) {\n\tvar output;\n\tswitch (p) {\n\tcase \"Place\":\n\t\toutput = \"http://schema.org/Place\";\n\tbreak;\n\tcase \"Organization\":\n\t\toutput = \"http://schema.org/Organization\";\n\tbreak;\n\tcase \"Person\":\n\t\toutput = \"http://schema.org/Person\";\n\tbreak;\t\n\tdefault:\n\t\toutput = null;\n\t}\n\treturn output;\n}",
"getType () {\n\t\tlet type = this.definition.type;\n\n\t\t// if it's not a relationship or fetched property, it's an attribute\n\t\t// NOTE: Probably need to separate this out into different classes\n\t\ttype !== 'relationship' && type !== 'fetched' && (type = 'attribute');\n\n\t\treturn type;\n\t}",
"function pkgFromType(type) {\n const parts = type.split(\":\");\n if (parts.length === 3) {\n return parts[0];\n }\n return undefined;\n}",
"static get __resourceType() {\n\t\treturn 'GraphDefinitionLink';\n\t}",
"function getSearchType() {\n if ('/search/quick.url' === $(location).attr('pathname')) return 'Quick';\n else if ('/search/expert.url' === $(location).attr('pathname')) return 'Expert';\n else if ('/search/thesHome.url' === $(location).attr('pathname')) return 'Thes';\n }",
"_getSelectionItemType()\n {\n var keys = this.getSelectedItemKeys();\n var itemType = null;\n var urls = [];\n for (var index in keys)\n {\n var item = this.getSelectedItem(keys[index]);\n if (itemType === null)\n {\n itemType = item.constructor;\n }\n }\n return itemType;\n }",
"getFetcherName () {\n\t\tconst definition = this.definition;\n\t\tlet fetcherName;\n\n\t\tfetcherName = definition.fetcher;\n\n\t\tif (!fetcherName) {\n\t\t\tconst name = definition.name;\n\t\t\tconst Name = (name.substr(0, 1).toUpperCase() + name.substr(1));\n\n\t\t\tfetcherName = ('fetch' + Name);\n\t\t}\n\n\t\treturn fetcherName;\n\t}",
"get contentType() {\n this._logService.debug(\"gsDiggThumbnailDTO.contentType[get]\");\n return this._contentType;\n }",
"get imageURL() {\n this._logger.debug(\"imageURL[get]\");\n return this._imageURL;\n }",
"parse(_stUrl) {\n Url.parse(_stUrl, true);\n }",
"get url() {\n return this._serverRequest.url;\n }",
"getDefaultUrlFields() {\n return [\n 'type',\n 'slug'\n ];\n }",
"getURL() {\n return EHUrls.getDegree(this._code, this._school);\n }",
"getOutputType() {\n if (this.outputType !== null && (typeof (this.outputType) !== null) && this.outputType !== undefined) { return this.outputType; }\n return null;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
true if currentBounds contains targetBounds, false otherwise | function boundsContain(currentBounds, targetBounds) {
if (
targetBounds[0] >= currentBounds[0] &&
targetBounds[2] <= currentBounds[2] &&
targetBounds[1] >= currentBounds[1] &&
targetBounds[3] <= currentBounds[3]
) {
return true;
}
return false;
} | [
"includes(range, target) {\n if (Range.isRange(target)) {\n if (Range.includes(range, target.anchor) || Range.includes(range, target.focus)) {\n return true;\n }\n\n var [rs, re] = Range.edges(range);\n var [ts, te] = Range.edges(target);\n return Point.isBefore(rs, ts) && Point.isAfter(re, te);\n }\n\n var [start, end] = Range.edges(range);\n var isAfterStart = false;\n var isBeforeEnd = false;\n\n if (Point.isPoint(target)) {\n isAfterStart = Point.compare(target, start) >= 0;\n isBeforeEnd = Point.compare(target, end) <= 0;\n } else {\n isAfterStart = Path.compare(target, start.path) >= 0;\n isBeforeEnd = Path.compare(target, end.path) <= 0;\n }\n\n return isAfterStart && isBeforeEnd;\n }",
"isInBounds(x, y) {\n if(x <= 0 || x >= this.mapWidth || y <= 0 || y >= this.mapHeight) {\n return false;\n }\n return true;\n }",
"contains(x, y) {\r\n if (!this.isEnabled()) return false;\r\n if (x < this.at().x || x > (this.at().x + this.width())) return false;\r\n if (y < this.at().y || y > (this.at().y + this.height())) return false;\r\n return true;\r\n }",
"function inBounds(p) {\n // check bounds of display\n if((p[0]-2*bcr) <= width * 0.1 || //left\n (p[0]+2*bcr) >= width - (width * 0.1) || //right\n (p[1]-2*bcr) <= height * 0.1 ||\n (p[1]+2*bcr) >= height - (height * 0.1)) {\n return false;\n }\n return true;\n}",
"outOfBounds() {\n const aboveTop = this.y < 0;\n const belowBottom = this.y + CONST.CAPY_HEIGHT > this.dimensions.height;\n return aboveTop || belowBottom;\n }",
"reachedTargetPosition() {\n if (this.target !== undefined) {\n let targetCenter = this.getTargetCenter();\n let ownCenter = this.getCenter();\n // console.log(ownCenter);\n // console.log(targetCenter);\n var distance = Phaser.Math.Distance.Between(\n ownCenter.x,\n ownCenter.y,\n targetCenter.x,\n targetCenter.y\n );\n if (distance < 10) {\n return true;\n }\n // console.log(distance);\n }\n return false;\n }",
"function checkInBoundsAndScale(container, event) {\n\tbounds = container.getBoundingClientRect();\n\tlet x = event.clientX;\n\tlet y = event.clientY;\n\t//in this case, the mouseX and mouseY are in bounds of one of the table sections\n\tif (x > bounds.left && x < bounds.right && y > bounds.top && y < bounds.bottom) {\n\t\tcontainer.style.transform = 'scale(1.06)';\n\t\treturn true;\n\t}\n\telse {\n\t\tcontainer.style.transform = 'scale(1)';\n\t\treturn false;\n\t}\n}",
"function checkForOverlap(currentDropArea , leftPos,width) {\n\t\tvar children = currentDropArea.children;\n\t\tfor(var i = 0; i < children.length; i++) {\n\t\t\tvar currentChild = children[i].getBoundingClientRect();\n\t\t\tif((leftPos <= currentChild.right && leftPos >= currentChild.left) || (leftPos + width <= currentChild.right && leftPos + width >= currentChild.left)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}",
"function checkInsideBoundingBox(bound, pt)\n{\n\tif (pt.x < bound.lower_bound.x || pt.x > bound.higher_bound.x) {\n\t\treturn false;\n\t}\n\tif (pt.y < bound.lower_bound.y || pt.y > bound.higher_bound.y) {\n\t\treturn false;\n\t}\n\tif (pt.z < bound.lower_bound.z || pt.z > bound.higher_bound.z) {\n\t\treturn false;\n\t} \n\treturn true;\n}",
"function includes(b, p) {\n return p.x >= b.x && p.x <= b.x + b.width && p.y >= b.y && p.y <= b.y + b.height;\n}",
"function insideSelector(event) {\n var offset = $qsBody.position();\n offset.right = offset.left + $qsBody.outerWidth();\n offset.bottom = offset.top + $qsBody.outerHeight();\n \n return event.pageY < offset.bottom &&\n event.pageY > offset.top &&\n event.pageX < offset.right &&\n event.pageX > offset.left;\n }",
"function isOnButton(x, y, btn) {\n var inXBounds = (x >= btn.rect[0]) && (x <= btn.rect[0] + btn.rect[2]);\n var inYBounds = (y >= btn.rect[1]) && (y <= btn.rect[1] + btn.rect[3]);\n return inXBounds && inYBounds;\n}",
"function isInBounds(point) {\n\t\tif (point >= bounds.sw && point <= bounds.nw) {\n\t\t\tconsole.log(\"point in bounds\");\n\t\t}\n\t}",
"collide(other) {\n // Don't collide if inactive\n if (!this.active || !other.active) {\n return false;\n }\n\n // Standard rectangular overlap check\n if (this.x + this.width > other.x && this.x < other.x + other.width) {\n if (this.y + this.height > other.y && this.y < other.y + other.height) {\n return true;\n }\n }\n return false;\n }",
"function isInBound(x,y){\n\treturn x>-1&&x<9&&y>-1&&y<9;\n}",
"function contains(target, child) {\n let head = child.parentNode;\n\n while(head != null) {\n if (head == target) return true;\n head = head.parentNode;\n }\n\n return false;\n }",
"function overlaps(a, b) {\n if (a.x1 >= b.xMax || a.y1 >= b.yMax || a.x2 <= b.xMin || a.y2 <= b.yMin) {\n return false\n } else {\n return true\n }\n }",
"function IsMouseHoveringRect(r_min, r_max, clip = true) {\r\n return bind.IsMouseHoveringRect(r_min, r_max, clip);\r\n }",
"getOverlap(topLeft1, bottomRight1, topLeft2, bottomRight2) {\n\t\tif (topLeft1.x > bottomRight2.x || topLeft2.x > bottomRight1.x) {\n\t\t\t// rectangles are to the left/right of eachother \n\t\t\treturn false;\n\t\t}\n\t\telse if (topLeft1.y > bottomRight2.y || topLeft2.y > bottomRight1.y) {\n\t\t\t// rectangles are above/below each other\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}",
"function isContiguous(nums, target) {\r\n // find all combinations of the list\r\n // https://stackoverflow.com/questions/5752002/find-all-possible-subset-combos-in-an-array\r\n // https://codereview.stackexchange.com/questions/7001/generating-all-combinations-of-an-array\r\n \r\n const combos = new Array(1 << nums.length)\r\n .fill()\r\n .map((e1, i) => {\r\n const combo = nums.filter((e2, j) => i & 1 << j);\r\n return combo;\r\n });\r\n\r\n // check each combo if they sum to target\r\n for (const l of combos) {\r\n let sum = l.reduce((a, b) => a + b, 0);\r\n if (sum === target) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tell if this is a blocker frame | is_blocker() {
return false;
} | [
"is_blocker() {\n return true;\n }",
"tracking_block(type) { return this.blocks[type] !== undefined; }",
"function adBlockNotDetected() {\n }",
"has_block(type) { return (this.tracking_block(type)) ? this.blocks[type] : false; }",
"function isDamagedFrame(frame) {\n // In real life, re-generate CRC and compare against the sender's CRC\n\n // Adding below code for simulation purpose only\n if (frame.attr(\"class\").indexOf(\"damagedFrame\") != -1) {\n return true;\n }\n\n return false;\n\n}",
"function _blockClick()\n{\n\tif (clickBlockCount > 0)\n\t\tthrow new Error(\"Click over blocked\");\n\tclickBlockCount += 1;\n}",
"function blockContent()\n{\n\t// show stop button\n\tdocument.getElementById('next_link').style.display = \"none\";\n\tdocument.getElementById('submit_link').style.display = \"none\";\n\tdocument.getElementById('exit_link').style.display = \"\";\n\tonLastScreen();\n\t\n\t// set progress bar to 100%\n\tdocument.getElementById('progress_bar').style.width = '100%';\n\n\t// load the screen with the information that content is blocked\n\tframes['myFrame'].location.href = getContentFolderName() + '/blocked.htm';\n}",
"function breakBlock (state) {\n var block = state.player.lookAtBlock\n if (!block) return\n\n var loc = block.location\n var neighbors = [\n state.world.getVox(loc.x + 1, loc.y, loc.z),\n state.world.getVox(loc.x, loc.y + 1, loc.z),\n state.world.getVox(loc.x - 1, loc.y, loc.z),\n state.world.getVox(loc.x, loc.y - 1, loc.z),\n state.world.getVox(loc.x, loc.y, loc.z + 1)\n ]\n var v = neighbors.includes(vox.INDEX.WATER) ? vox.INDEX.WATER : vox.INDEX.AIR\n\n return setBlock(state, loc.x, loc.y, loc.z, v)\n}",
"function atTopLevel() {\n return Object.is(topBlock,currentBlock);\n }",
"standingBlock() {\n\t\tthis.updateState(KEN_SPRITE_POSITION.standingBlock, KEN_IDLE_ANIMATION_TIME, false);\n\t}",
"function in_iframe () {\r\n try {\r\n return window.self !== window.top;\r\n } catch (e) {\r\n return true;\r\n }\r\n }",
"function checkForBlocking(p1Action, p2Action) {\n\t// Since the player with the most stamina will set the current actionCount we\n\t// need to see which ones has less or if they're equal. If one has less stamina then\n\t// we'll set up which block they chose. (i.e. punch-blocking, low-lick-blocking, high-kick-blocking)\n\tif(player1.liveStamina < actionCount) {\n\t\tsetBlocks(\"player1\", p1Action, p2Action);\n\t}\n\telse if(player2.liveStamina < actionCount) {\n\t\tsetBlocks(\"player2\", p1Action, p2Action);\n\t}\n\telse {\n\t\tcalculateAttack(p1Action, p2Action);\n\t}\n}",
"flipBlock(){\n if(!this.started) return false;\n if(this.active.flip(this.grid)) postMessage(this.state);\n else console.log(\"couldn't flip\");\n }",
"function isIpBlocked( )\n{\n //global config;\n result = false;\n ipaddress = _SERVER.REMOTE_ADDR; \n //foreach (config.BLOCKED_IPS as ip)\n //{\n // if (preg_match( \"/\"+ip+\"/\", ipaddress ))\n // {\n // error( \"Your ip address has been blocked from making changes!\" );\n // result = true;\n // break;\n // } \n //}\n return result;\n}",
"function isBlockType(name) {\n return !!blockTypes[name];\n }",
"function manuallyDetectBlock() {\n var timeToWaitBetweenChecks = buttonPressInterval / 2; //Dividing the minimum time between button presses by 2 guarentees that if something pops up between presses we'll catch it.\n //xpath technology is witchcraft. But it's also probably the fastest way to check for what we want to check.\n //This currently checks for any instance of 'unwelcome', 'block', or 'misuse' that appears in any element that is not a script or a stylesheet\n var xpath = \"//*[not(self::script or self::style) and contains(text(),'block') or contains(text(), 'unwelcome') or contains(text(), 'misuse')]\";\n //This next conditional checks if the xpath query yields any elements in the document. If so, then we stop all button pressing and throw an alert to the user, just in case.\n if (document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue != null) {\n alert('Possible account block detected!');\n stopAllButtonPressing();\n }\n}",
"function checkIfFramed()\n{\n var anchors, i;\n\n if (window.parent != window) { // Only if we're not the top document\n anchors = document.getElementsByTagName('a');\n for (i = 0; i < anchors.length; i++)\n if (!anchors[i].hasAttribute('target'))\n\tanchors[i].setAttribute('target', '_parent');\n document.body.classList.add('framed'); // Allow the style to do things\n }\n}",
"holdBlock(e){\n const event = new CustomEvent('TetrisNewHoldBlock', {detail: {holdBlock: this.blocks.currentBlock}});\n\n document.dispatchEvent(event);\n\n if(!e.detail.holdBlock){\n this.newBlockFromBag()\n }else{\n this.blocks.currentBlock = e.detail.holdBlock;\n this.blocks.currentBlock.x = 3;\n this.blocks.currentBlock.y = 0;\n this.updateGhostBlock();\n }\n }",
"function bypassCommentBlock(){\n\tisCommenting=true; // set flag true if leave pg was a commenting action\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Call to send a message array to a bot. If this method returns true, `sendMessage` won't be called | sendMessages () {
return false
} | [
"static async bulkSendMessages ([conversation, messages, opts]) {\n const channelType = conversation.channel.type\n\n for (const message of messages) {\n let err = null\n\n // Try 3 times to send the message\n for (let i = 0; i < 3; i++) {\n try {\n await invoke(channelType, 'sendMessage', [conversation, message, opts])\n break\n } catch (ex) {\n await MessagesController.sleep(2000)\n err = ex\n }\n }\n\n if (err) {\n throw new ConnectorError(`Unable to send message to channel: ${err}`)\n }\n }\n\n return ([conversation, messages, opts])\n }",
"async sendMessages({ text, chat_id }) {\n // text, chat_id) {\n try {\n const url = `https://api.telegram.org/bot${this.key}/sendMessage`;\n let send = await Robo.request({\n url: url,\n method: \"POST\",\n data: {\n chat_id: chat_id,\n text: text,\n },\n });\n return send.result;\n } catch (e) {\n // console.log(e);\n }\n }",
"function sendMessageToOpponents(text) {\n\tsendPrivateChat(myOpponent(true), text);\n\tsendPrivateChat(myOpponent(false), text);\n}",
"function sendToAllSenders(message) {\n if (window.castMB && senders.length > 0) {\n window.castMB.broadcast(message);\n }\n }",
"function broadcast(...args) {\n // XXX(Kagami): Better to use `for...of` but it seems to generate\n // inefficient code in babel currently.\n [...connected.values()].forEach(transport => transport.send(...args));\n}",
"function sendMessage (target, context, message) {\r\n if (context['message-type'] === 'whisper') {\r\n client.whisper(target, message)\r\n } else {\r\n client.say(target, message)\r\n }\r\n}",
"function sendToDevice(id,message) {\n //get in mirrored array a connection with selected key\n if(connections[id]!=null){\n connections[id].sendText(message);\n console.log(message);\n }\n \n}",
"function sendNoSuchCommandFound(){\n\tsendSMS('No such command found. Type \\'commands\\' for a list of commands.');\n}",
"sendMessage(text) {\n\t\tthis.setTextToInput(text);\n\t\tthis.sendBtn.click();\n\t\tbrowser.waitUntil(function() {\n\t\t\tbrowser.waitForVisible('.message:last-child .body', 5000);\n\t\t\treturn browser.getText('.message:last-child .body') === text;\n\t\t}, 5000);\n\t}",
"send(...args) {\n this._send_handler(...args)\n }",
"function sendToChannel(msg) {\n bot.channels.get(curryBotChannel).send(msg);\n}",
"goOnlineToSendMessages(aMsgWindow) {\n let goOnlineToSendMsgs = Services.prompt.confirm(\n window,\n this.offlineBundle.GetStringFromName(\"sendMessagesOfflineWindowTitle1\"),\n this.offlineBundle.GetStringFromName(\"sendMessagesOfflineLabel1\")\n );\n\n if (goOnlineToSendMsgs) {\n this.offlineManager.goOnline(\n true /* send unsent messages*/,\n false,\n aMsgWindow\n );\n }\n }",
"sendOrSplit(msg) {\n if(msg.toString().length < MAX_UDP_SIZE) {\n this.send(msg);\n }\n else {\n this.sendSplitMsgs(msg);\n }\n }",
"function sendMessageToAll(message) {\n chrome.tabs.query({\n url: '*://' + config.domainTo + '/*'\n }, function(tabs) {\n if (tabs && tabs.length) {\n tabs.forEach(function(tab) {\n chrome.tabs.sendMessage(tab.id, message);\n });\n }\n });\n}",
"function sendMessageToActiveContact(message) {\n if (message !== '') {\n $('#typing-area').val('');\n var messageLine = '<li><b>Me</b> : ' + message + '</li>';\n $('#message-list').append(messageLine);\n activeChats[activeContact.getId()].push(messageLine); //save message\n\n //Actually send message to active contact\n activeContact.sendMessage(message)\n .then(function() {\n //Message successfully sent!\n })\n .catch(function(err) {\n //An error occured...\n $('#message-list').append('<li><i>* Could not send message to contact : \"' + message + '\", ' + err.error.message + ' *</i></li>');\n });\n }\n }",
"function sendMessage(message) {\n port.postMessage(message);\n}",
"sendToAllConnectedPeers(data) {\n for (let peer_id in this.peers) {\n if (this.peers[peer_id] && this.peers[peer_id].isConnected) {\n // Call it in an async way so any failure does not effect sending to other peers\n setTimeout(() => {\n let peer = this.peers[peer_id];\n if (peer.isPeerConnected()) {\n peer.send(data);\n } else {\n delete this.peers[peer_id];\n }\n }, 0);\n }\n }\n }",
"async messagingThreadSetBotEnabled (socket, data, reply) {\n\n\t\t// Make sure the client passed in safe values.\n\t\tconst itemId = String(data.itemId);\n\t\tconst botDisabled = Boolean(!data.enabled);\n\n\t\tawait this.database.update(`User`, itemId, {\n\t\t\t'bot.disabled': botDisabled,\n\t\t});\n\n\t\treturn reply({ success: true });\n\n\t}",
"function send() {\n // Create a new message object\n var message = {\n text: vm.body\n };\n\n var Message = MessageService.message();\n var item = new Message({\n body: vm.body,\n channelId: vm.channel\n });\n\n item.$save(function (response) {\n // Emit a 'chatMessage' message event\n Socket.emit('message', {channel: vm.channel, item: item});\n // Clear the message text\n vm.body = '';\n }, function (errorResponse) {\n console.log(errorResponse);\n vm.error = errorResponse.data.message;\n });\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fibonacci Heap implementation, used interally for Matrix math. | function FibonacciHeap() {
if (!(this instanceof FibonacciHeap))
throw new SyntaxError('Constructor must be called with the new operator');
// initialize fields
this._minimum = null;
this._size = 0;
} | [
"function fibb() {\n var list = [0,1];\n for( i = 2; i < 100; i++) {\n\tlist[i] = list[i-1] + list[i-2];\n }\n return list;\n}",
"function genfib() {\n let arr = [];\n\n return function fib() {\n if (arr.length === 0) {\n arr.push(0);\n } else if (arr.length === 1) {\n arr.push(1);\n } else {\n arr.push(arr[arr.length - 2] + arr[arr.length - 1]);\n }\n\n return arr[arr.length - 1];\n }\n}",
"function fibonacciSequence() {\n\tlet arr = [0, 1];\n\tfor(let i = 2; ; i++){\n\t\tlet item = arr[i-1] + arr[i-2];\n\t\tif (item < 255){\n\t\t\tarr.push(item);\n\t\t}else{\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn arr;\n}",
"function fibArrayWithFibIterator(inputIteration){\n for(var i = 1; i <= inputIteration; i ++){\n var pushMe = fibIterator(i);\n fibArray.push(pushMe);\n }\n return fibArray;\n}",
"function Heap(size) {\n \tthis.last = 1;\n \tthis.max = size;\n \tthis.table = new Array(size + 1); \n\n \t/**\n \t Add a cell to the heap\n \t Note this function sets the done flag of the cell. This not only prevents heap overflow, but helps in various cases: no cell can be inserted more than once.\n\n \t*/\n \tthis.addCell = function(cell) {\n\n \t\t\t\tif((this.last >= this.max) || (cell.done)) // overflow shield\n \t\t\t return;\n \t\t\t\n \t\t\t\tlet i = this.last;\n \t\t\t\tthis.last++;\n \t\t\t\n \t\t\t\twhile(i > 1)\n \t\t\t\t{\n \t\t\t\t\tlet j = Math.floor(i / 2); // searching father of this element\n \t\t\t\t\tif( this.table[j].key <= cell.key)\n \t\t\t\t\t\tbreak; // insert is finished\n \t\t\t\n \t\t\t\t\tthis.table[i] = this.table[j];\n \t\t\t\t\ti = j;\n \t\t\t\t}\n \t\t\t\tthis.table[i] = cell;\n \t\t\t cell.done = true;\n \t\t\t}\n\n \t/**\n \t Pick (and extract) first cell from the heap\n\n \t <- the cell\n \t*/\n \tthis.pickCell = function() {\n\n \t\t\t if( this.table == undefined || this.last == 1 )\n \t\t\t\t return undefined;\n\n \t\t let res = this.table[1];\n\n \t\t\t this.last--;\n \t\t let h = this.table[this.last];\n \t\t\t let i = 1;\n \t\t\t let j = 2;\n\n \t\t\t while( j < this.last ) {\n \t\t\t\t // select the correct son\n \t\t\t\t let k = j + 1;\n \t\t\t\t if( (k < this.last) && ( this.table[j].key > this.table[k].key) )\n \t\t\t\t\t j = k;\n \t\t\t\t if(h.key <= this.table[j].key) break;\n \t\t\t\t this.table[i] = this.table[j];\n \t\t\t\t i = j; j *= 2;\n \t\t\t }\n \t\t\t this.table[i] = h;\n \t\t\t return res;\n \t\t\t}\n\n \t/**\n \t Update all keys values\n \t (of course, this don't invalidate sort)\n \t -> the value to add to all keys\n \t*/\n \tthis.updateKeys = function(val = 0) {\n\n \t\t\t for(let i = 1; i < this.last; i++)\n \t\t\t \tthis.table[i].key += val;\n \t\t\t}\n\n \t/**\n \t Returns the first cell key value\n \t <- key value\n \t*/\n \tthis.testCell = function() {\n \t\t\t if(this.last > 1)\n \t\t\t \treturn this.table[1].key;\n \t\t\t else\n \t\t\t return -1;\n \t\t\t}\n\n \t/**\n \t Clear all members 'done' flag and reset the heap itself\n \t*/\n \tthis.clearHeap = function() {\n \t\t\t for(let i = 1; i < this.last; i++)\n \t\t\t this.table[i].done = false;\n \t\t\t this.last = 1;\n \t\t\t}\n\n \t/**\n \t Reset the heap\n \t*/\n \tthis.resetHeap = function() {\n \t\t\t this.last = 1;\n \t\t\t}\n\n \t/**\n \t Reads the content size\n \t*/\n \tthis.getSize = function() {\n \t\t\t return (this.last - 1);\n \t\t\t}\n }",
"function displayFibonacciArray(fibCount){\n\tgetFibonacciArray(fibCount);\n}",
"function fibbonacci(n) {\n var uitkomst = [];\n\n // the magic starts here...\n\n\n\n return uitkomst;\n}",
"function isFibonacci(num) {\n var fibonacci = [0, 1];\n var sum = 0;\n while (sum < num) {\n sum = fibonacci[fibonacci.length-1] + fibonacci[fibonacci.length-2];\n fibonacci.push(sum);\n }\n return num === sum;\n}",
"bfs() {\n // initialize empty QUEUE \n let queue = [] \n // initialize visited nodes \n let visited = [] \n // initialize currentNode as root \n let currentNode = this.root \n // add root to the QUEUE \n queue.push(currentNode) \n\n // implement a while loop: while a queue exists... \n while(queue.length) {\n // shift from the queue\n currentNode = queue.shift() \n // push node's val to visited \n visited.push(currentNode.val) \n if(currentNode.left) {\n queue.push(currentNode.left) \n }\n if(currentNode.right) {\n queue.push(currentNode.right) \n }\n }\n // returns the visited nodes array \n return visited; \n }",
"function rFib(num){\n if(num == 0){ //there is no 0 in fibonacci\n return 0\n }\n else if(num == 1){ //base case\n return 1\n }\n else if(num == 2){ //second base case\n return 1\n }\n else if(num % 1 > 0){\n return rFib(Math.floor(num)) //floor any non whole number\n }\n else{\n return rFib(num - 1) + rFib(num - 2) //start the call stack until base cases are reached\n }\n}",
"breadthFirstTraversal() {\n let queue = [];\n queue.push(this.root);\n while (queue.length){\n let node = queue.shift();\n console.log(node.val);\n if (node.left){queue.push(node.left);}\n if (node.right){queue.push(node.right)};\n }\n }",
"function breadthFirstArray(root) {\n\n}",
"traverseBreadth(){\n let queue = new Queue();\n let arr = [];\n let current = this.root;\n\n queue.enqueue( current );\n\n while( queue.size > 0 ){\n\n current = queue.dequeue().val;\n arr.push( current.value );\n\n if( current.left !== null ) queue.enqueue( current.left );\n if( current.right !== null ) queue.enqueue( current.right );\n }\n\n return arr;\n }",
"function fib(index) {\n var r;\n for (r of fibGen(index))\n ;\n return r;\n}",
"function nearestFibonacci(num)\n{\n // Base Case\n if (num == 0) {\n return;\n }\n \n // Initialize the first & second\n // terms of the Fibonacci series\n let first = 0, second = 1;\n \n // Store the third term\n let third = first + second;\n \n // Iterate until the third term\n // is less than or equal to num\n while (third <= num) {\n \n // Update the first\n first = second;\n \n // Update the second\n second = third;\n \n // Update the third\n third = first + second;\n }\n \n // Store the Fibonacci number\n // having smaller difference with N\n let ans = (Math.abs(third - num)\n >= Math.abs(second - num))\n ? second\n : third;\n \n // Print the result\n console.log(ans)\n}",
"function recursiveNthFib(n) {\n // initialization a cache array with a lenght of n\n const cache = Array(n); // cache.length returns n\n\n // define a recursive helper function\n function recursiveHelper(n) {\n // try to access the answer from the cache\n let answer = cache(n);\n\n if (!answer) {\n answer = naiveNthFib(n);\n // save this answer in our cache\n cache(n) = answer;\n }\n\n return answer;\n }\n // don't foget to call the recursiveHelper\n}",
"function heapUpdate(i, w) {\n var a = heap[i]\n if(weights[a] === w) {\n return i\n }\n weights[a] = -Infinity\n heapUp(i)\n heapPop()\n weights[a] = w\n heapCount += 1\n return heapUp(heapCount-1)\n }",
"function MedianHeap(){\n\tvar greater=new MinHeap;\n\tvar lesser=new MaxHeap;\n\tthis.add=function(val){\n\t\tif(val>this.median()){\n\t\t\tgreater.insert(val);\n\t\t\tif(greater.size()-lesser.size()>1){\n\t\t\t\tlesser.insert(greater.extract());\n\t\t\t}\n\t\t}else{\n\t\t\tlesser.insert(val);\n\t\t\tif(lesser.size()-greater.size()>1){\n\t\t\t\tgreater.insert(lesser.extract());\n\t\t\t}\n\t\t}\n\t}\n\tthis.top=function(){\n\t\tif(greater.size()>lesser.size()){\n\t\t\treturn greater.top();\n\t\t}else if(lesser.size()>greater.size()>1){\n\t\t\treturn lesser.top();\n\t\t}else{\n\t\t\treturn (greater.top()+lesser.top())/2;\n\t\t}\n\t}\n}",
"function chebab(a,b,n)\n{\n var xnodes=linspace(1/(2*n+2)*Math.PI,(2*n+1)/(2*n+2)*Math.PI,n+1);\n// disp(xnodes)\n var abnodes=zeros(n+1,1);\n for(var i=0;i<=n;i++)\n {\n\tabnodes[n-i]= (Math.cos(xnodes[i])+1)/2*(b-a)+a;\n }\n return(abnodes)\n\n}",
"insert(element) {\n this.heap.push(element);\n for (let i = this.size() - 1; i > 0; i--) {\n let parent = (i - 1) / 2;\n if (this.heap[parent] > this.heap[i]) {\n let temp = this.heap[i];\n this.heap[i] = this.heap[parent];\n this.heap[parent] = temp;\n }\n }\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Automatically generated. Tests for the `Eq` constructor of the `:order` type. | function eq_ques_(order0) /* (order : order) -> bool */ {
return (order0 === 2);
} | [
"makeEq(field, target) {\n var match;\n if ( typeof target === 'string' ) {\n match = (v) => {\n return ( v === target);\n };\n } else {\n match = (v) => {\n return v.match(target);\n };\n }\n return ( item ) => {\n if( typeof item === 'string') {\n return match(item);\n }\n if( field in item ) {\n const value = item[field];\n if( Array.isArray(value) ) {\n return _.some(value, match);\n } else {\n return match(value);\n }\n }\n return false;\n }\n }",
"addOrder(order) {\n\t\tlet found = false;\n\t\tthis.pool.forEach((o) => {\n\t\t\tif (o.id == order.id)\n\t\t\t\tfound = true;\n\t\t});\n\t\tif (!found)\n\t\t\tthis.pool.push(order);\n\t\treturn !found;\n\t}",
"function orderedListRule(nodeType) {\n return wrappingInputRule(/^(\\d+)\\.\\s$/, nodeType, match => ({order: +match[1]}),\n (match, node) => node.childCount + node.attrs.order == +match[1])\n }",
"equalTo(other) {\n other = new Complex(other);\n return this.re == other.re && this.im == other.im;\n }",
"function equality(){\n negation();\n if (globalTP < tokens.length && (tokens[globalTP] == \"eqOp\" || tokens[globalTP] == \"notEqOp\")){\n globalTP+=1;\n negation();\n }\n}",
"EqualityExpression() {\n return this._BinaryExpression(\"RelationExpression\", \"EQUALITY_OPERATOR\");\n }",
"findBestMatch(order) {\n\t\tvar matches = [];\n\n\t\tthis.pool.forEach((o) => {\n\t\t\t// if (o.id == order.id)\n\t\t\t// \treturn;\n\t\t\t// if (o.exchangeContractAddress != order.exchangeContractAddress)\n\t\t\t// \treturn;\n\t\t\t// if (o.makerTokenAddress != order.takerTokenAddress)\n\t\t\t// \treturn;\n\t\t\t// if (o.takerTokenAddress != order.makerTokenAddress)\n\t\t\t// \treturn;\n\t\t\t// if (o.makerTokenAmount == 0 || o.takerTokenAmount == 0)\n\t\t\t// \treturn;\n\t\t\t// if (order.makerTokenAmount == 0 || order.takerTokenAmount == 0)\n\t\t\t// \treturn;\n\t\t\t// if (o.takerTokenAmount / o.makerTokenAmount < order.makerTokenAmount / order.takerTokenAmount)\n\t\t\t// \treturn;\n\t\t\tmatches.push({\n\t\t\t\torderA: order,\n\t\t\t\torderB: o,\n\t\t\t\tpriority: [o.makerFee + o.takerFee + order.makerFee + order.takerFee,\n\t\t\t\t\t\tBigNumber.min(o.expirationUnixTimestampSec, order.expirationUnixTimestampSec)],\n\t\t\t});\n\t\t});\n\n\t\t// matches.sort((a, b) => {\n\t\t// \tif (a.priority == b.priority)\n\t\t// \t\treturn 0;\n\t\t// \treturn a.priority > b.priority ? 1 : -1;\n\t\t// })\n\t\tif (matches.length == 0) {\n\t\t\tconsole.log('found match');\n\t\t\tconsole.log('Sending to ZRX exchangeContract')\n\t\t\treturn null;\n\t\t} else {\n\t\t\tlet bestMatch = matches[matches.length - 1];\n\t\t\treturn {\n\t\t\t\torderA: bestMatch.orderA,\n\t\t\t\torderB: bestMatch.orderB,\n\t\t\t};\n\t\t}\n\t}",
"function testHeaderContainer(order) {\r\n var headerString;\r\n\r\n headerText.length = 0;\r\n\r\n // Gather header texts.\r\n Ext.Array.each(grid.getVisibleColumnManager().getColumns(), function (c) {\r\n headerText.push(c.text);\r\n });\r\n\r\n // Prepend 'Field' to each number to match the header string.\r\n headerString = order.replace(/(\\d+,?)/g, function (a, $1) {\r\n return 'Field' + $1;\r\n });\r\n\r\n // Check reordering has been done and that the top HeaderContainer has refreshed its cache.\r\n expect(headerText.join(',')).toEqual(headerString);\r\n }",
"function orderFactory() {\n\tvar order = {\n\t\tid: -1,\n\t\tdate: undefined,\n\t\tcustomer: undefined,\n\t\tpayment: undefined,\n\t\titems: [],\n\t\tsetId: function () {\n\t\t\tif (this.id < 1) {\n\t\t\t\tthis.id = ++lastOrderId;\n\t\t\t\tthis.date = new Date();\n\t\t\t\treturn this.id;\n\t\t\t}\n\t\t\treturn this.id;\n\t\t},\n\t\tget turnaround() {\n\t\t\tvar totalTurnaround = BASE_TURNAROUND;\n\t\t\tfor (var i = 0; i < this.items.length; i++) {\n\t\t\t\ttotalTurnaround += this.items[i].turnaround;\n\t\t\t}\n\t\t\treturn totalTurnaround;\n\t\t},\n\t\tget price() {\n\t\t\tvar totalPrice = 0;\n\t\t\tfor (var i = 0; i < this.items.length; i++) {\n\t\t\t\ttotalPrice += this.items[i].price;\n\t\t\t}\n\t\t\treturn totalPrice;\n\t\t},\n\t\tisValid: function () {\n\t\t\tvar valid = false;\n\t\t\tif (this.id > 0 && this.items.length > 0 && customer !== undefined && payment !== undefined) {\n\t\t\t\tvalid = true;\n\t\t\t}\n\t\t\treturn valid;\n\t\t},\n\t\tload: function (that) {\n\t\t\tthis.date = new Date(that.date);\n\t\t\tdelete that.date;\n\t\t\tdelete that.turnaround;\n\t\t\tdelete that.price;\n\t\t\tfor (var prop in that) {\n\t\t\t\tthis[prop] = that[prop];\n\t\t\t}\n\t\t}\n\t}\n\treturn order;\n}",
"function inOrder(e, S) {\n for (var s in S)\n if (e < s)\n return false;\n return true;\n }",
"static pseudo_compares_as_obj(a) {\n return a['$reql_type$'] === 'GEOMETRY';\n }",
"function testView(order) {\r\n rowText.length = 0;\r\n\r\n if (!locked) {\r\n Ext.Array.each(view.getRow(view.all.item(0)).childNodes, function (n) {\r\n rowText.push(n.textContent || n.innerText);\r\n });\r\n } else {\r\n // For locked grids, we must loop over both views of the locking partners, lockedView first.\r\n Ext.Array.each(view.getRow(view.lockedView.all.item(0)).childNodes, function (n) {\r\n rowText.push(n.textContent || n.innerText);\r\n });\r\n\r\n Ext.Array.each(view.getRow(view.normalView.all.item(0)).childNodes, function (n) {\r\n rowText.push(n.textContent || n.innerText);\r\n });\r\n }\r\n\r\n // Check reordering has been done on the data and that the top HeaderContainer has refreshed its cache.\r\n expect(rowText.join(',')).toEqual(order);\r\n }",
"function Order(custName,carModel,carPrice,carImage){\n this.custName = custName;\n this.carModel = carModel;\n this.carPrice = carPrice;\n this.carImage = carImage;\n all_orders.push(this);\n}",
"function ordChoice(){var args=arguments\n return function(s,p){var i,l\n for(i=0,l=args.length;i<l;i++)\n if(args[i](s,p))return true\n return false}}",
"function typeComparator(auto1, auto2)\n{\n /************************************************************************************\n * orderType *\n * This function takes an automobile object as a parameter and then checks the type *\n * of automobile by matching the name, then returns a number based on the type. *\n ************************************************************************************/\n var orderType = function(auto)\n {\n // Roadster\n if (auto.type.toLowerCase() == \"roadster\")\n {\n return 1;\n }\n // Pickup\n if (auto.type.toLowerCase() == \"pickup\")\n {\n return 2;\n }\n // SUV\n if (auto.type.toLowerCase() == \"suv\")\n {\n return 3;\n }\n // Wagon\n if (auto.type.toLowerCase() == \"wagon\")\n {\n return 4;\n }\n else // Car type is a sedan, or something else not listed.\n {\n return 5;\n }\n }\n\n // Compare the types based on the returned number in order to sort them properly.\n if (orderType(auto1) < orderType(auto2))\n {\n return true;\n \n }\n else if (orderType(auto1) == orderType(auto2))\n {\n return yearComparator(auto1, auto2);\n }\n else\n {\n return false;\n }\n}",
"parse_order(order) {\n if (order instanceof this.classes.order) {\n return order;\n }\n const symbol = order.symbol;\n const market = this.data.markets_by_symbol[symbol];\n const id = order.id;\n const timestamp = order.timestamp;\n const direction = order.side;\n const trigger = (order.info.trailValue != undefined ? order.info.trailValue : (order.info.triggerPrice != undefined ? order.info.triggerPrice : null));\n const market_price = (direction == 'buy' ? market.ask : market.bid);\n const price = (order.info.orderPrice != null ? order.info.orderPrice : (order.price != null ? order.price : (trigger != null ? trigger : (type == 'market' ? market_price : null))));\n const size_base = order.amount;\n const size_quote = order.amount * price;\n const filled_base = order.filled;\n const filled_quote = order.filled * price;\n var type = order.type.toLowerCase();\n switch (type) {\n case 'stop' : type = (price != trigger ? 'stop_limit' : 'stop_market');\n break;\n case 'take_profit' : type = (price != trigger ? 'takeprofit_limit' : 'takeprofit_market');\n break;\n }\n const status = order.status.replace('CANCELED', 'cancelled'); // Fix spelling error\n const raw = order.info;\n return new this.classes.order(market, id, timestamp, type, direction, price, trigger, size_base, size_quote, filled_base, filled_quote, status, raw);\n }",
"function dynamicsort(property,order) {\n var sort_order = 1;\n if(order === \"desc\"){\n sort_order = -1;\n }\n return function (a, b){\n // a should come before b in the sorted order\n if(a[property] < b[property]){\n return -1 * sort_order;\n // a should come after b in the sorted order\n }else if(a[property] > b[property]){\n return 1 * sort_order;\n // a and b are the same\n }else{\n return 0 * sort_order;\n }\n }\n }",
"function OrderStatus() {\n _classCallCheck(this, OrderStatus);\n\n OrderStatus.initialize(this);\n }",
"function makeComparator(auto1, auto2)\n{\n if (auto1.make.toLowerCase() < auto2.make.toLowerCase())\n {\n return true;\n }\n else\n {\n return false;\n }\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
to save the tasks into the file | function storeTasks(file,tasks){
fs.write(file,JSON.stringify(tasks),(err)=>{
if (err) throw err
console.log("Saved")})
} | [
"async function buildArray(task) {\n let tasksList = await checkTasksList();\n tasksList.tasks.push(task);\n fs.writeFile(todoPath, JSON.stringify(tasksList));\n console.log('Task engadida');\n}",
"save() {\n\n let files = new Visitor(\n this.fullName,\n this.age,\n this.visitDate,\n this.visitTime,\n this.comments,\n this.assistedBy\n );\n let fileData = JSON.stringify(files)\n const fs = require('fs');\n\n id++;\n\n fs.writeFile(`visitor${id}.json`, fileData, err => {\n if (err) {\n throw (Error + 'Cannot save file');\n } else {\n console.log('File was saved');\n\n }\n });\n\n return 'File was saved';\n }",
"async saveNotesToFile() {\n return await fs.writeFile(\n path.join(__dirname, \"../db/db.json\"),\n JSON.stringify(this.notes)\n );\n }",
"_store (tasks) {\n this.onListChanged(tasks);\n localStorage.setItem('tasks', JSON.stringify(tasks));\n }",
"outputTask(task){\r\n console.log(`Task ID: ${task.id} | Text: ${task.text} | Schedule: ${task.schedule} | Label: ${task.label} | Priority: ${task.priority}`);\r\n }",
"function saveState(){\n writeToFile(userFile, users);\n writeToFile(campusFile, campus);\n}",
"_writeAllCompletedTasks() {\n for (const stream of this._streams) {\n if (stream && stream.state === StreamState.ClosedUnwritten) {\n this._writeTaskBuffer(stream);\n stream.state = StreamState.Written;\n }\n }\n }",
"function save_data() {\n\t\n\t// rename old data file to backup file\n\tfs.rename(data_file, backup_data_file, function(err) {\n\t\tif (err) {\n\t\t\tconsole.log(err);\n\t\t\tconsole.log('Failed to backup data');\n\t\t}\n\t\t\n\t\t// write new data to file\n\t\tfs.writeFile(data_file, pprint(tms_data), function(err) {\n\t\t\tif (err) {\n\t\t\t\tconsole.log(err);\n\t\t\t\tconsole.log('Failed to generate new data');\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\t// write to the log file\n\t\t\t\tlast = Date.now();\n\t\t\t\tfs.appendFile(log_file, '\\n' + last, function(err) {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\tconsole.log(err);\n\t\t\t\t\t\tconsole.log('Failed to write to log file');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tconsole.log('New data has been generated');\n\t\t\t}\n\t\t});\n\t});\n}",
"function saveToDos() {\r\n localStorage.setItem(TODOS_LS, JSON.stringify(toDos))\r\n}",
"writeVictory() {\n\t\t// prettier-ignore\n\t\tfs.writeFileSync(`${VICTORIES_DIR}/${this.victories}.txt`, JSON.stringify(this.table.moves));\n\t}",
"async function postTask(req, res){\n\n let task = new Task()\n\n task.project = req.body.project\n task.name = req.body.name\n task.nickname = req.body.nickname\n task.date = req.body.date //mmm mejor que la pasen ellos, porque el año pasado creaba horas random\n task.description = req.body.description\n task.associated_message = req.body.associates_message\n task.subtasks = req.body.subtasks //lo deberian pasar ellos? //necesitan saber los ids\n task.expiration_date = req.body.expiration_date\n task.color = req.body.color\n task.priority = req.body.priority\n task.state = req.body.state\n task.teammember = req.body.teammember\n task.id_previous = null //porque esta creando una\n task.actual = true //porque esta creando una\n\n task.save((err, taskSaved) => {\n if(err) res.status(500).send({message: `Error al salvar en la base de datos: ${err}`})\n res.status(200).json({taskSaved})\n })\n}",
"function settasks() {\n\tvar nodeactivetasks = document.getElementById(\"main_middle_activetasks\");\n\tvar nodecompletedtasks = document.getElementById(\"main_middle_completedtasks\");\n\tremovechildren(nodeactivetasks);\n\tremovechildren(nodecompletedtasks);\n\n\tlistactivetasks.forEach(function(element) {\n\t\tnodeactivetasks.appendChild(element);\t\n\t})\n\n\tlistcompletedtasks.forEach(function(element) {\n\t\tnodecompletedtasks.appendChild(element);\n\t})\n\n\n}",
"async function checkTasksList() {\n try {\n if (!fs.existsSync(todoPath)) {\n const tasksList = { tasks: [], update: new Date() };\n fs.writeFile(todoPath, JSON.stringify(tasksList));\n return tasksList;\n } else {\n const tasksList = require('./.tasks.json');\n return tasksList;\n }\n } catch (error) {\n console.log(error);\n }\n}",
"function addTask() {\n let taskToSend = {\n task: $('#taskIn').val(),\n };\n\n saveTask(taskToSend);\n clearInputs();\n}",
"saveData() {\n let jsonData = {\n lastTicket: this.lastTicket,\n today: this.today,\n tickets: this.tickets,\n lastFour: this.lastFour\n }\n\n let jsonDataString = JSON.stringify(jsonData);\n \n fs.writeFileSync('./server/data/data.json', jsonDataString);\n }",
"save(statsFile = Statistics.defaultLocation) {\n fs.writeFileSync(statsFile, JSON.stringify(this));\n }",
"function BtnTaskApplyClick(){\n SaveTask(); \n}",
"function save_all() {\n\tvar type = $('#type_list').find(\":selected\").val();\n\t// if it's for a new cue, we fetch everything from the UI\n\tif (cue_id == 'xx') {\t\n\t\tvar channel = Number($(\"#channel\").val());\n\t\tvar delay = Number($(\"#delay\").val());\n\t\tvar options = {};\n\t\tvar name = $('#cue_name').val();\n\t\tvar cue = create_cue(type, channel, delay, name, options);\n\t\tcue_id = add_cue(event_obj.cue_list, cue);\n\t\tdocument.getElementById(\"cue_id\").innerHTML = \", Cue n°\"+cue_id;\n\t}\n\t// updates the cue (command == edit_cue)\n\telse{\n\t\tsave_delay();\n\t\tsave_type();\n\t\tsave_channel();\n\t\tsave_name();\n\t}\n\tsave_options();\n\n\tfs.writeFileSync(data_file, JSON.stringify(project, null, 2));\n}",
"function agregarTaskLocalStorage(task){\n let tasks;\n tasks = obtenerTaskLocalStorage();\n\n //Anadir tarea nueva. Añade al final de un arreglo\n tasks.push(task);\n\n //Agregar a localStorage\n //JSON.stringify convierte el array obtenido en una cadena o string\n localStorage.setItem('tasks', JSON.stringify(tasks));\n \n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process kids until we are left with just page objects | async processKids(objNum, pages = []) {
return new Promise(async resolve => {
const kidsMatch = /\/Kids\s*\[\s*\n*(.*)\s*\n*\]/gs // match /Kids[]
const kidObjMatch = /(\d+\s+(?=0\s+R))/gs // match object reference numbers in the Kids array
const obj = this.getObjectAt(objNum) // get the object
const pageKids = obj.match(kidsMatch)
const kids = pageKids ? pageKids[0].match(kidObjMatch) : null // match kids object numbers
if (kids) {
// this is a parent page object. go through all of the kids and process those.
let i = 0
for (const kid of kids) {
const num = kid.trim()
pages = await this.processKids(num, pages)
i += 1
if (i === kids.length) {
// we've processed all of the kids for this page
resolve(pages)
}
}
} else {
// this is an actual page object. we can save the page
pages.push({ obj, objNum })
resolve(pages)
}
})
} | [
"async determinePages() {\n return new Promise(async (resolve, reject) => {\n try {\n const pageRegex = /(?:\\/Pages\\s*)(\\d+)/g // match /Type /Pages\n const pageKey = this.catalogObj.match(pageRegex)[0] // get the object reference of the /Pages object from catalog\n const pagesObjNum = pageKey.match(/\\d+/g)[0] // extract just the number of the /Pages object\n\n const pages = await this.processKids(pagesObjNum)\n let i = 0\n for (const pagesObj of pages) {\n const pageObj = PDF.removeEmptyNewlines(PDF.cleanUpDictionary(pagesObj.obj))\n\n const page = {\n objNum: pagesObj.objNum,\n gen: this.objTable[pagesObj.objNum].gen,\n obj: pageObj,\n annots: null\n }\n\n const hasAnnots = pageObj.match(/\\/Annots/g)\n\n if (hasAnnots) {\n page.annots = {\n objNum: null,\n isArray: false,\n isObj: false,\n gen: 0,\n objs: []\n }\n const isArr = pageObj.match(/\\/Annots\\s*\\[/g)\n if (isArr) {\n page.annots.isArray = true\n page.annots.objs = pageObj.match(/\\/Annots\\s*\\[(.*)\\]/gs)[0].match(/(\\d+\\s+0\\s+R)/g)\n } else {\n page.annots.isObj = true\n page.annots.objNum = pageObj.match(/\\/Annots\\s+(\\d+\\s+0\\s+R)/g)[0].match(/\\d+(?!\\s+R)/g)[0]\n page.annots.gen = this.objTable[page.annots.objNum].gen\n page.annots.objs = this.getObjectAt(page.annots.objNum).match(/(\\d+\\s+0\\s+R)/g)\n }\n }\n\n this.pages.push(page)\n i += 1\n if (i === pages.length) {\n resolve()\n }\n }\n } catch (err) {\n reject(err)\n }\n })\n }",
"function needSplitPageForPlan()//page 5 split page base on rider\n{\n \n \n isNeedSplit = \"NO\";//split data\n appendPage('page5','PDS/pds2HTML/PDSTwo_ENG_Page5.html');\n isNeedSplit = \"YES\";\n appendPage('page5b','PDS/pds2HTML/PDSTwo_ENG_Page5b.html');\n loadInterfacePage();//to check to hide some division\n \n \n}",
"function preparePage() {\n links = [];\n\n $(\".js-scroll-indicator\").each(function(index, link) {\n prepareIndicator( $(link) );\n });\n }",
"function isPotentiallyBadPage() {\n\tif (potentiallyBadPageHasRun)\n\t\treturn;\n\tpotentiallyBadPageHasRun = true;\n\t\n\tconsole.log(\"Potentially bad page, removing elements.\");\n\t\n\tremoveUnsafeElementsOnPage();\n\tsetInterval(removeUnsafeElementsOnPage, 500);\n\t//Create a MutationObserver to check for changes on the page.\n\tvar mutationObserver = new MutationObserver( function(mutations) {\n\t\tfor(var i = 0; i < mutations.length; i++) {\n\t\t\tvar mut = mutations[i];\n\t\t\tfor(var j=0; j < mut.addedNodes.length; ++j){\n\t\t\t\t//console.log(mut.addedNodes[j].className + \" ::: \" + mut.addedNodes[j].nodeName);\n\t\t\t\tif(mut.addedNodes[j].className === undefined) continue;\n\t\t\t\telse \n\t\t\t\t\tremoveUnsafeElementsOnPage();\n\t\t\t}\n\t\t}\n\t} );\n\tmutationObserver.observe(document, { subtree: true, childList: true });\n\t\n\taddNotification(\"Potentially Bad Page:\", \"Image and video elements have been removed.\");\n\t\n\tpercentageMatureWords();\n}",
"dividePostIds(postIds, posts, numDivs, hasNext) {\n if(numDivs <= 0) {\n return [];\n }\n\n let oldPostIds = clone(postIds);\n let portraitPostIds = [];\n let dividedPostIds = createFixedArray([], numDivs);\n let heights = createFixedArray(0, numDivs);\n let needPush = createFixedArray(true, numDivs);\n let curIndex = 0;\n let heightest = 0;\n\n // Find all portrait posts.\n oldPostIds.forEach((id) => {\n if(this.isPortrait(posts[id])) {\n portraitPostIds.push(id);\n }\n });\n // Handling for there is a \"single\" portrait post.\n if(portraitPostIds.length % 2 === 1) {\n // If there are still posts to load, do not show it at this time;\n // otherwise, place it at the last position.\n const lastPortraitPostId = portraitPostIds.pop();\n oldPostIds.splice(oldPostIds.indexOf(lastPortraitPostId), 1);\n if(!hasNext) {\n oldPostIds.push(lastPortraitPostId);\n portraitPostIds.push(lastPortraitPostId);\n }\n }\n\n // Start to divide post IDs.\n while(oldPostIds.length > 0) {\n if(needPush[curIndex]) {\n const postId = oldPostIds.shift();\n if(!this.isPortrait(posts[postId])) {\n // For landscape post, just push it to current division.\n dividedPostIds[curIndex].push(postId);\n heights[curIndex] += 1;\n } else {\n portraitPostIds.shift();\n if(portraitPostIds.length > 0) {\n // For portrait post, push it and next portrait post (if existed) as peer to current division.\n const peerPostId = portraitPostIds.shift();\n oldPostIds.splice(oldPostIds.indexOf(peerPostId), 1);\n dividedPostIds[curIndex].push(postId);\n dividedPostIds[curIndex].push(peerPostId);\n heights[curIndex] += 2;\n } else {\n if(!hasNext) {\n // If no peer portrait post and no next posts to load,\n // the single portrait post will be at last position,\n // just push it.\n dividedPostIds[curIndex].push(postId);\n }\n }\n }\n // Update heightest.\n heightest = (heightest < heights[curIndex]) ? heights[curIndex] : heightest;\n }\n\n if(curIndex < numDivs - 1) {\n // Not the end of a loop, just increase index.\n curIndex++;\n } else {\n // The end of a loop, update \"needPush\" array and reset index, heightest.\n let allHeightsEqual = true;\n for(let i = 0; i < numDivs - 1;i++) {\n if(heights[i] != heights[i + 1]) {\n allHeightsEqual = false;\n break;\n }\n }\n if(allHeightsEqual) {\n needPush = createFixedArray(true, numDivs);\n } else {\n needPush = heights.map((height) => {\n return (height === heightest) ? false : true;\n });\n }\n curIndex = 0;\n heightest = 0;\n }\n }\n\n return dividedPostIds;\n }",
"function generatePageList ()\n{\n\tvar result = doAction ('DATA_GETHEADERS', 'GetRow', true, 'ObjectName', gSITE_ED_FILE);\n\tresult = result.split('\\t');\n\tvar out = new Array ();\n\tvar validPageObjArray = new Array();\n\tvar inValidPageObjArray = new Array();\n\tvar bCommerce = (IsCommerceEnabled() && IsCommerceWizComplete());\n\tvar bService = (IsServiceEnabled() && IsServiceWizComplete());\n\t\n\tfor (var n = 0; n < result.length; n++)\n\t{\n\t\tif (result[n].length > 0 && result[n] != gBASE_PAGE && result[n] != gCURRENT_PAGE)\n\t\t{\n\t\t\tvar tmpObj = generateSEObjects (result[n]);\n\t\t\tvar licenseFor = tmpObj.pageObjArray[result[n]][gLICENSE_FOR];\n\t\t\tvar bValid = false;\n\t\t\t// filter the list for licensed pages\n\t\t\tif (licenseFor)\n\t\t\t{\n\t\t\t\tif (licenseFor.toLowerCase() == \"all\" ||\n\t\t\t\t\t(licenseFor.toLowerCase() == \"powercommerce\" && bCommerce) ||\n\t\t\t\t\t(licenseFor.toLowerCase() == \"powerservice\" && bService))\n\t\t\t\t\tbValid = true;\n\t\t\t}\n\t\t\tif (bValid)\n\t\t\t{\n\t\t\t\tout.push (result[n]);\n\t\t\t\tvalidPageObjArray.push(tmpObj);\n\t\t\t}\n\t\t\telse\n\t\t\t\tinValidPageObjArray.push(tmpObj);\n\t\t}\n\t}\n\tvar nOrder = resetButtonOrders (validPageObjArray, 1);\n\tresetButtonOrders (inValidPageObjArray, nOrder);\n\t\t\t\n\treturn (out);\n}",
"function infiniScroll(pageNumber) {\n \n $.ajax({\n url: \"rest/getMoreImages/\"+pageNumber+\"/\"+uploadCount,\n type:'GET',\n success: function(imageJSON){\n \n var imageResults = $.parseJSON(imageJSON);\n for(var i=0;i<6;i++) { \n if(imageResults.images[i].userID !== \"\") {\n \n getGPlusName(imageResults.images[i].userID);\n \n $(\"#contentList\").append(\n '<li class=\"polaroid\">'+\n '<a href=\"javascript:void(0)\" title=\"'+plusName+'\">'+\n '<img src=\"uploads/'+imageResults.images[i].filename+'\" alt=\"'+plusName+'\" />'+\n '</a>'+\n '</li>');\n } else {\n streamOK = false;\n }\n }\n \n }\n });\n}",
"loadMoreHomestays(event) {\n let pageCount = Session.get('homestayCount')\n if(pageCount) {\n pageCount = pageCount+1;\n Session.set('homestayCount', pageCount)\n } \n }",
"function checkEndOfPage(firstFill){\r\n\tfirstFill = firstFill || 0;\r\n\tvar endOfPage = document.getElementById('photoGallery').clientHeight;\r\n var lastDiv = document.querySelector(\"#photoBlock > div:last-child\");\r\n var lastDivOffset = lastDiv.offsetTop + lastDiv.clientHeight;\r\n var pageOffset = window.pageYOffset + window.innerHeight;\r\n if(firstFill == 0){\t\r\n\t \tif(Math.round(pageOffset) >= endOfPage){\r\n\t \t\tshowLoading();\r\n\t \t\tgetPhotos(per_page = 5, page = 1, function(data){createNewPhotoBlock(data)});\r\n\t \t}\r\n }\r\n \telse if(lastDivOffset < window.innerHeight){\r\n \tpage++;\r\n\t \tshowLoading();\r\n \t\tgetPhotos(per_page = 5, page, function(data){ createNewPhotoBlock(data, firstFill = 1) });\r\n \t}\r\n\t// \"page++\" variable page here makes the scroll down shows older images, with \"page = 1\" in the function getPhotos, \r\n\t// scroll down shows the newest images in flickr. \r\n\t//The method \"getRecents\" dont verify if the images are duplicated\r\n}",
"function resetPagesIfOffScreen() {\n if (!pages)\n return;\n\n for (var p in pages) {\n if (!$('#pageContainer' + (pages[p].pageIndex + 1)).isOnScreen())\n PDFViewerApplication.pdfViewer.getPageView(pages[p].pageIndex).reset();\n }\n}",
"function checkPhantomStatus() {\n if (phantomChildren.length < maxInstances) {\n return true;\n }\n return false;\n}",
"function showPageObjects() {\n db.allDocs({ include_docs: true, descending: true }, function(err, doc) {\n redrawPageObjectsUI(doc.rows)\n })\n }",
"async function snipe(msg,args){ \n let base_url = 'https://api.hypixel.net/skyblock/auctions?key=' + api_key + '&page='; //add page num at the end\n /*\n \"Implosion\": 76000000,\n \"Wither Shield\": 75600000,\n \"Shadow Warp\": 75600000,\n \"Necron's Handle\": 342000000,\n */\n //\"Implosion\",\"Wither Shield\",\"Shadow Warp\",\"Necron's Handle\",\n let watchList = [ \"Wither Chestplate 5star\", \"Aspect of the Dragons 3star\", \"Zombie Commander Chestplate 1star\"];\n //watchList supports ✪\n let max_price = {\n \"Wither Chestplate 5star\": 200000000, //for max price, do not include the ✪\n \"Aspect of the Dragons 3star\": 10000000,\n \"Zombie Commander Chestplate 1star\": 4000000\n };\n //additionally check to make sure it's looking at EVERYTHING in the AH\n while(true){\n let initialResponse = await fetch(base_url + \"1\");\n if(initialResponse.ok){\n const json = await initialResponse.json();\n let totalPages = json.totalPages\n for(let i = 0;i<totalPages;i++){\n let currPage = base_url + i;\n const response = await fetch(currPage);\n if(response.ok){\n let pageData = await response.json();\n totalPages = pageData.totalPages;\n processSnipeArray(max_price,pageData.auctions,watchList,msg,args); //Called on each page of the auction house\n }\n console.log(i);\n }\n }\n await new Promise(r => setTimeout(r, 35000));\n } \n}",
"function trkDisplayPagesNeeded() {\n for(i = 0; i < (trkPagination.length); i++) {\n var loopCurrentPageValue = trkPagination[i].attributes.value.value;\n if(loopCurrentPageValue <= trkNumberOfPagesNeeded) {\n trkPagination[i].style.display = \"flex\";\n } else {\n trkPagination[i].style.display = \"none\";\n }\n }\n}",
"collectHeadingsAndKeywords(pageContent) {\n this.collectHeadingsAndKeywordsInContent(pageContent, null, false, []);\n }",
"function splitBy40Pages(lastBampoN, text) {\n var lastBampoInfo = lastBampoN.match(/(\\d+[a-z])\\.(\\d+)/);\n var bampoObjs = objsBy40pages(lastBampoInfo[1], lastBampoInfo[2], text);\n var lastBampoN = bampoObjs[bampoObjs.length - 1].bampoN;\n\n return {'bampoObjs': bampoObjs, 'lastBampoN': lastBampoN};\n}",
"function loadObjectsAfterWaitingForScripts(){\n\t\tlet waitingTime = 1000;\n\t\tsetTimeout(function () {\n\t\t\tloadDataObjects();\n\t\t\tactionNamespace.actionDrawStartPage();\t\n\t\t}, waitingTime);\n\t}",
"function fetchItems(roomId) {\n //List to hold item ids in a given room\n var itemsInRoom = [];\n\n //List to hold the item objects of a given room\n var finalItemsList = [];\n\n //Iterate through rooms to identify the room based on roomId passed\n for(var i=0; i< room.length; i++){\n //Get the room matching the roomId\n if(room[i].roomId === roomId){\n //item ids in the room selected\n itemsInRoom = room[i].itemId;\n }\n }\n\n //Iterate through items to fetch the item objects based on item ids\n for(var i=0; i< items.length; i++){\n //Get the item based on itemids\n if(itemsInRoom.includes(items[i].itemId)) {\n //Item object added to final item list\n finalItemsList.push(items[i]);\n }\n };\n\n //Clear the content\n document.body.innerHTML = \"\";\n\n //Create the items page for the given room\n document.body.appendChild(createItemsPage(finalItemsList));\n}",
"function putS3JobPage(response) {\n var promises = [];\n var job_ms = 0;\n var max_job_ms = 0;\n var page_ms = 0;\n var job_id = \"\";\n const job_paged_set = new Set();\n log(\"getS3Objects: \" + JSON.stringify(response));\n\n if (response.IsTruncated) {\n //params.ContinuationToken = response.NextContinuationToken;\n log(\"s3 list keys is truncated\");\n throw new Error(\"s3 list keys is truncated breaking results algorithm\")\n }\n\n for (var index = 0; index < response.Contents.length; ++index) {\n var key = response.Contents[index].Key;\n if (key.includes('/page/')) {\n //byron/session/21c0971a-b25b-40ac-ba07-bd1b487a2d6b/page/milliseconds/1588077775166.json\n if (key.includes('/page/number/')) {\n //page_ms = Math.max(page_ms, parseInt(key.split('/')[5]));\n //log(`key: ${key}`);\n //log(`page_ms: ${page_ms} ${parseInt(key.split('/')[5])}`)\n next_page_number +=1\n }\n continue;\n }\n if (key.includes('/paged/')) {\n if (key.includes('/paged/job/')) {\n job_id = key.split('/')[5];\n log(`paged job: ${job_id}`);\n job_paged_set.add(job_id);\n }\n continue;\n }\n }\n for (var index = 0; index < response.Contents.length; ++index) {\n var key = response.Contents[index].Key;\n log(\"KEY: \" + key);\n var params = {\n Bucket: s3_bucket_name,\n Key: key,\n };\n // byron/session/{session_id}/finished/{milliseconds}/success/{job_id}.json\n if (key.includes('/finished/')) {\n //job_ms = parseInt(key.split('/')[4]);\n //log(`job_ms ${job_ms}`);\n //if (job_ms > page_ms) {\n //log(`promise: get ${key}`)\n //max_job_ms = Math.max(max_job_ms, job_ms);\n\n job_id = key.split('/')[6].split('.')[0];\n if (!job_paged_set.has(job_id)) {\n log(`page job: ${job_id}`)\n let promise = s3.getObject(params).promise();\n promises.push(promise);\n } else {\n log(`job already paged: ${job_id}`)\n }\n }\n }\n // Put All S3 Objects in Page\n var page = [];\n Promise.all(promises).then(function(values) {\n for (var i=0 ; i < values.length; i++ ) {\n var data = values[i];\n var obj = JSON.parse(data.Body.toString('ascii'));\n page.push(obj);\n // ledger of paged jobs\n var key = `${user_name}/session/${session_id}/paged/job/${obj.Id}`;\n var requestx = s3.putObject({Bucket: s3_bucket_name, Key: key, Body: JSON.stringify(obj)});\n requestx.promise();\n }\n log(`pagelen: ${page.length}`);\n if (page.length == 0) {\n // There were no new Finished jobs, return latest result page\n // number\n next_page_number = next_page_number - 1;\n handleDone();\n return;\n }\n //var key = `${user_name}/session/${session_id}/page/milliseconds/${max_job_ms}.json`;\n var content = JSON.stringify(page);\n var request = s3.putObject({Bucket: s3_bucket_name, Key: key, Body: content});\n var key = `${user_name}/session/${session_id}/page/number/${next_page_number}.json`;\n var request2 = s3.putObject({Bucket: s3_bucket_name, Key: key, Body: content});\n\n request2.promise();\n request.promise().then(handleDone).catch(handleError);\n });\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
addToWatchDb adds symbol and price to the database, symbol is the parent and price is the child | function addToWatchDb(sym, price) {
var dbPath = "watchlist/" + sym;
currentWatchRow.currentPrice = price;
database.ref(dbPath).update({"stockPrice": price});
} | [
"function addToWatchDb(sym, price) {\n var dbPath = \"/watchlist/\" + sym;\n\n currentWatchRow.currentPrice = price;\n console.log(\"in addToWatchDb() appUser.authenticated = \" + appUser.authenticated);\n if (appUser.authenticated) {\n appUser.addToWatch(sym);\n }\n database.ref(dbPath).update({\"stockPrice\": price});\n }",
"function addRestInfoWatchDb(sym, previousPrice) {\n var dbPath = \"watchlist/\" + sym,\n change,\n pctChange;\n\n console.log(\"in addRestInfoWatchDb()\");\n\n // get current stock price from database and calculate change in price\n database.ref(dbPath).on(\"value\", (snapshot) => {\n change = snapshot.val().stockPrice - previousPrice;\n console.log(\"change in addRestInfoWatchDB: \" + change);\n }, (errorObject) => {\n console.log(\"Errors handled: \" + JSON.stringify(errorObject));\n });\n pctChange = change / previousPrice;\n currentWatchRow.pctChange = pctChange;\n currentWatchRow.previousPrice = previousPrice;\n currentWatchRow.change = change;\n\n console.log(\"current watch row: \" + JSON.stringify(currentWatchRow));\n\n database.ref(dbPath).update({\n previousPrice,\n change,\n pctChange\n }, (errorObject) => {\n console.log(\"Errors handled: \" + JSON.stringify(errorObject));\n });\n }",
"function addRestInfoWatchDb(sym, previousPrice) {\n var dbPath = \"/watchlist/\" + sym,\n change,\n pctChange;\n\n console.log(\"in addRestInfoWatchDb() dbPath: \" + dbPath);\n\n // get current stock price from database and calculate change in price\n database.ref(dbPath).on(\"value\", (snapshot) => {\n change = snapshot.val().stockPrice - previousPrice;\n console.log(\"change in addRestInfoWatchDB: \" + change);\n }, (errorObject) => {\n console.log(\"Errors handled: \" + JSON.stringify(errorObject));\n });\n pctChange = change / previousPrice;\n currentWatchRow.pctChange = pctChange;\n currentWatchRow.previousPrice = previousPrice;\n currentWatchRow.change = change;\n\n console.log(\"current watch row: \" + JSON.stringify(currentWatchRow));\n\n database.ref(dbPath).update({\n previousPrice,\n change,\n pctChange\n }, (errorObject) => {\n console.log(\"Errors handled: \" + JSON.stringify(errorObject));\n });\n }",
"function addLevelDBData(key, value) {\n //console.log(\"Current key value is \" + key)\n db.put(key, JSON.stringify(value), function(err) {\n if (err) return console.log('Block ' + key + ' submission failed', err);\n });\n}",
"addLevelDBData(key, value) {\n let self = this;\n return new Promise(function(resolve, reject) {\n // Add your code here, remember in Promises you need to resolve() or reject()\n // Add to the LevelDB database using the level put() function\n self.db.put(key, value, function(err) {\n if (err) {\n console.log('Block ' + key + ' submission failed', err);\n reject(err);\n }\n resolve(value);\n });\n });\n }",
"function addToWatchList(event) {\n var stockSymbol = $(this).attr(\"stock-id\");\n\n event.preventDefault();\n // empty out stock-ticker content\n $(\"#stock-ticker-content\").empty();\n\n console.log(\"in addToWatchList() \");\n console.log(\"stock symbol: \" + stockSymbol);\n // $(\"#financial-text\").empty();\n // get current price of stock symbol\n buildBatchURL(stockSymbol, \"watch\");\n\n // get yesterday's close price of stock symbol\n buildTimeSeriesURL(stockSymbol);\n\n // add row to watchListTable\n renderWatchTable(stockSymbol);\n }",
"function addFragranceToCartData(id, price) {\n // in this if-else block, we populate shoppingCart object\n if (shoppingCart[id] == undefined) { // if shoppingCart does not contain this fragrance, create the nested fragrance object\n shoppingCart[id] = {};\n shoppingCart[id].qty = 1;\n shoppingCart[id].unitCost = price;\n shoppingCart[id].subTotal = price;\n } else { // nested fragrance already exists in shopping cart, do not create a nested fragrance object. Update existing nested object instead\n shoppingCart[id].qty = shoppingCart[id].qty + 1;\n shoppingCart[id].subTotal = shoppingCart[id].qty * price;\n }\n\n // now render to screen\n renderShoppingCartToScreen();\n}",
"function addToWatchList(event) {\n var stockSymbol = $(this).attr(\"stock-id\");\n\n console.log(\"in addToWatchList, currentUser: \" + appUser.email);\n\n event.preventDefault();\n // empty out stock-ticker content\n $(\"#stock-ticker-content\").empty();\n $(\"#my-watch-table\").show();\n\n console.log(\"in addToWatchList() \");\n console.log(\"stock symbol: \" + stockSymbol);\n\n // get current price of stock symbol\n buildBatchURL(stockSymbol, \"watch\");\n\n // get yesterday's close price of stock symbol\n buildTimeSeriesURL(stockSymbol);\n\n // add row to watchListTable\n renderWatchTable(stockSymbol);\n }",
"function add(key, value) {\n storeObject.table.push({'key': key, 'value': value});\n writeStore();\n }",
"function submitArtInfo(){\n\n if(i == null){\n i = -1;\n }\n i++;\n\n refArtName.child(i).set(artName.value);\n refOwners.child(i).set(owner.value);\n refPricePM.child(i).set(pricePM.value);\n refIncrement.set(i);\n\n}",
"function storeTrainInfo() {\n database.ref(\"/trainData\").push({\n trainName: trainName\n ,destination: destination\n ,firstTrain: firstTrain\n ,frequency: freq\n })\n}",
"function renderWatchTable(sym) {\n var tRow = $(\"<tr>\"),\n tCellSym = $(\"<td>\"),\n tCellPrice = $(\"<td>\"),\n tCellChange = $(\"<td>\"),\n tCellPct = $(\"<td>\"),\n tCellRmv = $(\"<td>\"),\n delBtn = $(\"<button>\"),\n dbPath = \"watchlist/\" + sym,\n price, changeInPrice, pctCh,\n dbVal;\n\n // read current stock price from database\n database.ref(dbPath).on(\"value\", (snapshot) => {\n dbVal = snapshot.val();\n console.log(\"dbVal: \" + JSON.stringify(dbVal));\n console.log(\"price: \" + dbVal.stockPrice);\n price = dbVal.stockPrice;\n changeInPrice = dbVal.change;\n pctCh = dbVal.pctChange;\n\n console.log(\"in renderWatchTable: \" + price);\n // console.log(\"converted price: \" + numeral(cprice).format(\"$0,0.00\"));\n tCellSym.text(sym);\n tCellPrice.html(numeral(price).format(\"$0,0.00\"));\n tCellChange.html(numeral(changeInPrice).format(\"+0,0.00\"));\n tCellPct.html(numeral(pctCh).format(\"0.00%\"));\n delBtn.attr(\"id\", \"btn-\" + sym).\n attr(\"data-name\", sym).\n addClass(\"custom-remove remove-from-watchlist\").\n text(\"x\");\n tCellRmv.append(delBtn);\n tRow.attr(\"id\", \"wrow-\" + sym).\n attr(\"stock-sym\", sym);\n // empty out row so as to not repeat stock symbol on watchlist\n $(\"#wrow-\" + sym).empty();\n tRow = $(\"#wrow-\" + sym).append(tCellSym, tCellPrice, tCellChange, tCellPct, tCellRmv);\n }, (errorObject) => {\n console.log(\"Errors handled: \" + errorObject.code);\n });\n $(\"#watchlist-caption\").show();\n $(\"#watch-table-header\").show();\n $(\"#watch-table\").prepend(tRow);\n }",
"function addProduct({ name, price, qt, url }) {\n let newProduct = {\n id: lastID,\n name: name,\n price: price,\n qt: qt,\n url: url,\n };\n ref.push(newProduct);\n}",
"function saveApis(data) {\n \n defineDBSchema(2);\n firstDBShemaVersion(1);\n db.open();\n\n /* data.forEach(function(item) {\n db.apis.put(item);\n console.log('saved api', item.apiName);\n });\n */\n\n db.transaction('rw', db.apis, function() {\n data.forEach(function(item) {\n db.apis.put(item);\n console.log('added api from txn', item.apiName);\n });\n }).catch(function(error) {\n console.error('error', error);\n });\n \n\n // .finally(function() {\n // db.close(); \n // });\n }",
"function renderWatchTable(sym) {\n var tRow = $(\"<tr>\"),\n tCellSym = $(\"<td>\"),\n tCellPrice = $(\"<td>\"),\n tCellChange = $(\"<td>\"),\n tCellPct = $(\"<td>\"),\n tCellRmv = $(\"<td>\"),\n delBtn = $(\"<button>\"),\n dbPath = \"/watchlist/\" + sym,\n price, changeInPrice, pctCh,\n dbVal;\n\n // read current stock price from database\n database.ref(dbPath).on(\"value\", (snapshot) => {\n dbVal = snapshot.val();\n console.log(\"in renderWatchTable dbVal: \" + JSON.stringify(dbVal));\n price = dbVal.stockPrice;\n changeInPrice = dbVal.change;\n pctCh = dbVal.pctChange;\n\n console.log(\"in renderWatchTable: \" + price);\n // console.log(\"converted price: \" + numeral(cprice).format(\"$0,0.00\"));\n tCellSym.text(sym);\n tCellPrice.html(numeral(price).format(\"$0,0.00\"));\n tCellChange.html(numeral(changeInPrice).format(\"+0,0.00\"));\n tCellPct.html(numeral(pctCh).format(\"0.00%\"));\n delBtn.attr(\"id\", \"btn-\" + sym).\n attr(\"data-name\", sym).\n addClass(\"custom-remove remove-from-watchlist\").\n text(\"x\");\n tCellRmv.append(delBtn);\n tRow.attr(\"id\", \"wrow-\" + sym).\n attr(\"stock-sym\", sym);\n // empty out row so as to not repeat stock symbol on watchlist\n $(\"#wrow-\" + sym).empty();\n tRow = $(\"#wrow-\" + sym).append(tCellSym, tCellPrice, tCellChange, tCellPct, tCellRmv);\n }, (errorObject) => {\n console.log(\"Errors handled: \" + errorObject.code);\n });\n $(\"#watchlist-caption\").show();\n $(\"#watch-table-header\").show();\n $(\"#watch-table\").prepend(tRow);\n }",
"function addSub(id, coin) {\n init();\n return new Promise(function (resolve, reject) {\n // Get a Database Object\n var db = admin.firestore();\n // Create a temporary object to store the future value\n var updateObj = {\n subs: {}\n };\n updateObj[\"subs\"][coin] = true;\n // Tell database to update the object\n db.collection('users').doc(id).set(updateObj, { merge: true }).then(function () {\n resolve();\n }).catch(function (error) {\n reject(error);\n });\n });\n}",
"function createItem(url, name = \"\", note = \"\", price = 0, callback = () => {}) {\n chrome.storage.sync.get(['firebase-auth-uid'], function(result){\n var uid = result['firebase-auth-uid'];\n var wishlistRef = database.ref(\"users/\" + uid + \"/wishlist\");\n var itemsRef = database.ref(\"items/\");\n var newItemRef = itemsRef.push({\n gifter : false,\n name : name,\n note : note,\n price : price,\n requester : uid,\n url : url,\n });\n wishlistRef.child(newItemRef.key).set(true).then(function() {\n callback();\n });\n });\n}",
"function addArtist() {\n // remove what is in the database\n database.ref().remove();\n\n // grab the artist in the input box\n var artistName = $(\"#band-input\").val().trim();\n\n database.ref().push({\n artistName: artistName\n });\n}",
"function storeTrains() {\n // Create database-friendly trains array of objects without functions or calculated values\n var trainsData = [];\n trains.forEach(function(train) {\n var trainData = {\n name: train.name,\n destination: train.destination,\n firstTrainTime: train.firstTrainTime,\n frequency: train.frequency\n }\n trainsData.push(trainData);\n });\n // Store new array in database\n database.ref().set({\n trains: trainsData\n });\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
addToRecentDocuments : String > String Given a filepath Add it to native recent documents list (Windows & macOS) Add it to Home screen documents list | async function addToRecentDocuments(filepath) {
try {
await docList.addFileToDocList(filepath);
await docList.setOpened(filepath);
app.addRecentDocument(filepath);
} catch (err) {
await dialog.showMessageBox(
errorAlert(
"Recent Documents Error",
`Couldn't add ${filepath} to recent documents list`,
err
)
);
return;
}
} | [
"updateRecentFiles(paths=[], dontWrite=false){\n // new paths array\n let recentFilePaths = [...paths, ...this.recentFilePaths];\n\n // remove any duplicates \n recentFilePaths = recentFilePaths.filter((val, i) => recentFilePaths.indexOf(val) === i);\n\n // 10 most recent \n if(recentFilePaths.length > 10){\n recentFilePaths = recentFilePaths.slice(0, 10);\n }\n\n // update \n this._recentFilePaths = recentFilePaths;\n\n // optional update json file \n return dontWrite ? Promise.resolve() : this.update();\n }",
"function addToFavorite()\n{\n\t//Add to favourite the page\n\twindow.external.AddFavorite(location.href, document.title);\n}",
"function addStoredSearch(search){\n var storedSearchesArray = getStoredSearches(); //get stored searches from localStorage\n //push new item to local array\n storedSearchesArray.push(search);\n //set localStorage to updated array\n localStorage.setItem(\"storedSearches\", JSON.stringify(storedSearchesArray));\n //now add button to search history\n var storedSearch = $(document.createElement(\"button\"));\n storedSearch.text(search);\n storedSearch.addClass('btn btn-info btn-block history-button');\n storedSearch.on('click', function(){\n getBreweryData(this.innerHTML);\n getWikiPage(this.innerHTML);\n });\n $('#search').append(storedSearch);\n}",
"function newFilesToShareInNewFolder() {\n var ss = SpreadsheetApp.getActiveSpreadsheet(),\n rootFolder = DriveApp.getRootFolder(),\n newFolder = \n DriveApp.createFolder('ToShareWithMick'),\n sh = SpreadsheetApp.create('mysheet'),\n shId = sh.getId(),\n shFile =\n DriveApp.getFileById(shId),\n doc = DocumentApp.create('mydocument'),\n docId = doc.getId(),\n docFile = DriveApp.getFileById(docId);\n newFolder.addFile(shFile);\n newFolder.addFile(docFile);\n rootFolder.removeFile(shFile);\n rootFolder.removeFile(docFile);\n}",
"function logFile() {\n\tuserInput = userInput.join(' '); // join the array with spaces\n\tvar logEntry = userCommand + ' ' + userInput + '\\n'; // append new command and input into log\n\tfs.appendFile('log.txt', logEntry, function(err) {\n\t\tif (err) {\n\t\t\tconsole.log(err);\n\t\t} else {\n\t\t\tconsole.log('log was updated');\n\t\t}\n\t})\n}",
"function newDoc() {\n docCounter++;\n const newDoc = {\n id: 'doc-' + docCounter,\n title: 'Untitled ' + docCounter,\n newPlayerCount: 0,\n newTextCount: 0,\n newRectCount: 0,\n newCircleCount: 0,\n newLineCount: 0,\n selectedObject: null,\n stage: null,\n objects: new Konva.Layer({ id: 'objects', name: 'Objekte' }),\n background: new Konva.Layer({ id: 'bg', name: 'Hintergrund', listening: 'false' }),\n author: '',\n wasLoaded: false,\n };\n appData.documents.push(newDoc);\n appData.active = newDoc.id;\n}",
"function addIfUnique( filePath, Paths ){\n\tif( Paths.indexOf( filePath ) === -1 ){\n\t\tPaths.push( filePath );\n\t}\n}",
"function saveDoc() {\n const currDoc = appData.currDoc();\n if (currDoc.filePath) {\n saveToFile(currDoc.filePath);\n return;\n }\n saveDocAs();\n}",
"function saveLib(){\n chrome.storage.local.set({'library': raw_notes}, function(){\n console.log(\"Library successfully saved.\");\n });\n}",
"function addToLocalStorage(note) {\n // Get Notes From Local Storage\n const notes = getNotesFromLocalStorage();\n\n // Add new note to the notes array\n notes.push(note);\n\n // Add New Note To Local Storage\n localStorage.setItem(\"notes\", JSON.stringify(notes));\n}",
"get recentFilePaths(){\n return this._recentFilePaths;\n }",
"function addToFavorite(emoji){\n\tfavoriteEmojis.unshift(emoji);\n\tconsole.log(favoriteEmojis);\n\tfavoriteEmojis = favoriteEmojis.filter((emoji, index) => {\n\t\treturn favoriteEmojis.indexOf(emoji) == index;\n\t});\n\t//saving favoriteEmojis array to localstorage\n\tlocalStorage.setItem(\"favoriteEmojis\", JSON.stringify(favoriteEmojis));\n\trenderHTML(favoriteEmojis, ulFavoriteList);\n}",
"function addTailToHistoryList(tail) {\n $(\"ul#tails_list\").append($(\"<li></li>\").text(\"\" + tail));\n if ( $('#tails_list').hasClass('ui-listview')) {\n $('#tails_list').listview('refresh');\n } \n}",
"function overwrite(doc,docPath){\n\t\n\t//keep the location of the old FLA\n\toldPath = String(doc.pathURI);\n\t\n\t//save the new postfix FLA\n\tfl.saveDocument(doc, docPath);\n\tfl.trace(\"Saved...\" + doc.name);\n}",
"function addToFavorites(event) {\n event.preventDefault()\n let favorites = JSON.parse(localStorage.getItem(\"favorites\"))\n let id = getId(this)\n if (favorites.indexOf(id) < 0) {\n favorites.push(id)\n }\n localStorage.setItem(\"favorites\", JSON.stringify(favorites))\n changeTextIfFavorite(this)\n animateHeart(event.x, event.y)\n}",
"function addFile(file) {\n files.set(file._template, file);\n fileView.appendChild(file.getTemplate());\n}",
"function addNote(e) {\n let addTxt = document.getElementById(\"addTxt\");\n let addTitle = document.getElementById(\"addTitle\");\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObject = [];\n } else {\n notesObject = JSON.parse(notes);\n }\n let myObj = {\n title: addTitle.value,\n text: addTxt.value\n }\n notesObject.push(myObj);\n localStorage.setItem(\"notes\", JSON.stringify(notesObject));\n addTxt.value = \"\";\n addTitle.value = \"\";\n showNotes();\n}",
"function pushVideosToWatchedList(title_content, image_url, video_url) {\n recently_watched_videos.push({ title: title_content, image: image_url, video: video_url });\n localStorage.setItem('watchedVideosArray', JSON.stringify(recently_watched_videos));\n}",
"function addToFavorites() {\n let title = \"GameStore-Tu mundo Digital\";\n let url = \"http://shop-gamestore.somee.com\";\n //para firefox\n if (window.sidebar)\n window.sidebar.addPanel(title, url, \"\");\n //para Internet Explorer\n else if (window.external)\n window.external.AddFavorite(url, title)\n // Opera Hotlist\n else if (window.opera && window.print) {\n return true;\n };\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This will cancel the current Future, the current transformation, and all stacked hot actions. | function Sequence$cancel(){
cancel();
transformation && transformation.cancel();
while(it = nextHot()) it.cancel();
} | [
"function Sequence$cancel(){\n\t cancel();\n\t action && action.cancel();\n\t while(it = nextHot()) it.cancel();\n\t }",
"cancel() {\n\t\tthis.reconciling = false;\n\t}",
"cancel() {\n if (this.raf) {\n cancelAnimationFrame(this.raf);\n }\n }",
"function unsafe_cancel_exn() /* () -> exception */ {\n return exception(\"computation is canceled\", Cancel);\n}",
"function cancel() {\n history.goBack();\n }",
"function cancelled() {\n fire(\"refresh-cancelled\");\n finish();\n }",
"cancel(__preserveTimer) {\n if (this.nextSignal) clearTimeout(this.nextSignal);\n\n if (!this.overrideKickedIn) {\n clearTimeout(this.overrideTrigger);\n if (!__preserveTimer) {\n if (this.signalHandler) this.signalHandler(this.totalSignalCount-1);\n TaskTimer.__forget__(this);\n }\n }\n }",
"function cancel(ev) {\n // Set that we should cancel the tap\n cancelled = true;\n // Remove selection on the target item\n $item.removeClass(options.klass);\n // We do not need cancel callbacks anymore\n $el.unbind('drag.tss hold.tss');\n }",
"cancel() {\n console.log('Canceling the transaction')\n return this.replace({\n from: this.manager.address,\n to: this.manager.address,\n value: 0,\n })\n }",
"handleCancel(event) {\n console.log('inside handleCancel');\n this.displayMode = 'View';\n }",
"abort() { \n this.reset = true;\n }",
"function errorCancel() {\n vm.onErrorCancel();\n }",
"cancel(time) {\n time = (0, _Defaults.defaultArg)(time, -Infinity);\n const ticks = this.toTicks(time);\n\n this._state.forEachFrom(ticks, event => {\n this.context.transport.clear(event.id);\n });\n\n this._state.cancel(ticks);\n\n return this;\n }",
"cancelScan() {\n if (this.scanCancelled_) {\n return;\n }\n this.scanCancelled_ = true;\n if (this.scanner_) {\n this.scanner_.cancel();\n }\n\n this.onScanFinished_();\n\n this.processNewEntriesQueue_.cancel();\n dispatchSimpleEvent(this, 'scan-cancelled');\n }",
"function cancel() {\n if (parentPort) {\n parentPort.postMessage('Email analytics fetch-latest job cancelled before completion');\n parentPort.postMessage('cancelled');\n } else {\n setTimeout(() => {\n process.exit(0);\n }, 1000);\n }\n}",
"cancel() {\n let parser = this._parser;\n if (parser) {\n this._parser = null;\n // This will call back to onUpdateCheckError with a CANCELLED error\n parser.cancel();\n }\n }",
"cancel() {\n switch (this.state) {\n case AddonManager.STATE_AVAILABLE:\n case AddonManager.STATE_DOWNLOADED:\n logger.debug(\"Cancelling download of \" + this.sourceURI.spec);\n this.state = AddonManager.STATE_CANCELLED;\n XPIInstall.installs.delete(this);\n this._callInstallListeners(\"onDownloadCancelled\");\n this.removeTemporaryFile();\n break;\n case AddonManager.STATE_INSTALLED:\n logger.debug(\"Cancelling install of \" + this.addon.id);\n let xpi = getFile(`${this.addon.id}.xpi`, this.location.installer.getStagingDir());\n flushJarCache(xpi);\n this.location.installer.cleanStagingDir([`${this.addon.id}.xpi`]);\n this.state = AddonManager.STATE_CANCELLED;\n XPIInstall.installs.delete(this);\n\n if (this.existingAddon) {\n delete this.existingAddon.pendingUpgrade;\n this.existingAddon.pendingUpgrade = null;\n }\n\n AddonManagerPrivate.callAddonListeners(\"onOperationCancelled\", this.addon.wrapper);\n\n this._callInstallListeners(\"onInstallCancelled\");\n break;\n case AddonManager.STATE_POSTPONED:\n logger.debug(`Cancelling postponed install of ${this.addon.id}`);\n this.state = AddonManager.STATE_CANCELLED;\n XPIInstall.installs.delete(this);\n this._callInstallListeners(\"onInstallCancelled\");\n this.removeTemporaryFile();\n\n let stagingDir = this.location.installer.getStagingDir();\n let stagedAddon = stagingDir.clone();\n\n this.unstageInstall(stagedAddon);\n default:\n throw new Error(\"Cannot cancel install of \" + this.sourceURI.spec +\n \" from this state (\" + this.state + \")\");\n }\n }",
"cancelFadeAll() {\n\t\tconst _fades = this._fades;\n\t\twhile (_fades.length > 0) {\n\t\t\tconst fade = _fades.shift();\n\t\t\tclearInterval(fade);\n\t\t}\n\t}",
"undoAction() {\n this.element.executeOppositeAction(this.details);\n }",
"cancelFade(fade) {\n\t\tconst _fades = this._fades;\n\t\tconst index = _fades.indexOf(fade);\n\t\tif (index !== -1) {\n\t\t\t_fades.splice(index, 1);\n\t\t}\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Active les clusterers (car, moto, collection) avec leurs options | function enableClusterers() {
clusters.moto = {
gridSize: 50,
styles: [
{textColor: 'white', url: '/media/ui/img/map/cluster-blue.png', height: 33, width: 33},
{textColor: 'white', url: '/media/ui/img/map/cluster-blue.png', height: 33, width: 33},
{textColor: 'white', url: '/media/ui/img/map/cluster-blue.png', height: 33, width: 33}
]
}
clusters.auto = {
gridSize: 50,
styles: [
{textColor: 'white', url: '/media/ui/img/map/cluster-red.png', height: 33, width: 33},
{textColor: 'white', url: '/media/ui/img/map/cluster-red.png', height: 33, width: 33},
{textColor: 'white', url: '/media/ui/img/map/cluster-red.png', height: 33, width: 33}
]
}
clusters.collection = {
gridSize: 50,
styles: [
{textColor: 'white', url: '/media/ui/img/map/cluster-yellow.png', height: 33, width: 33},
{textColor: 'white', url: '/media/ui/img/map/cluster-yellow.png', height: 33, width: 33},
{textColor: 'white', url: '/media/ui/img/map/cluster-yellow.png', height: 33, width: 33}
]
}
clusters.moto = new MarkerClusterer($kapmap.map, [], clusters.moto);
clusters.auto = new MarkerClusterer($kapmap.map, [], clusters.auto);
clusters.collection = new MarkerClusterer($kapmap.map, [], clusters.collection);
} | [
"function ClusterToolGetClusterMethod(objclusmethSelect) { \n \n var cmId = \"kmeans\"; \n var cmName = \"kmeans\"; \n objclusmethSelect.add(new Option(cmName, cmId)); \n cmId = \"dbscan\"; \n cmName = \"dbscan\"; \n objclusmethSelect.add(new Option(cmName, cmId)); \n \n}",
"function enableCluster() {\n $(\"#radio\").buttonset({\n disabled: false\n });\n}",
"function getVolcanos(){\n\tvolcanoMarkerCluster = L.markerClusterGroup({\n\t\ticonCreateFunction: function(cluster) {\n\t\t\tvar zahl = cluster.getChildCount() \n\t\t\tvar stringzahl = zahl.toString();\n\t\t\tvar ziffern = stringzahl.length;\n\t\t\tif (ziffern == 1){\n\t\t\t\tvar html = \"<div class='cluster_text' style='margin-left: 21px;'>\"+cluster.getChildCount()+\"</div> <img src='marker/volcano.png' height='50px' width='50px'/>\";\n\t\t\t}\n\t\t\tif (ziffern == 2){\n\t\t\t\tvar html = \"<div class='cluster_text' style='margin-left: 18px;'>\"+cluster.getChildCount()+\"</div> <img src='marker/volcano.png' height='50px' width='50px'/>\";\n\t\t\t}\n\t\t\tif (ziffern == 3){\n\t\t\t\tvar html = \"<div class='cluster_text' style='margin-left: 16px;'>\"+cluster.getChildCount()+\"</div> <img src='marker/volcano .png' height='50px' width='50px'/>\";\n\t\t\t}\t\t\t\t\t\t\t\t\t\n\t\t\treturn L.divIcon({\n\t\t\t\thtml: html, \n\t\t\t\ticonAnchor: [25, 25],\n\t\t\t\tclassName: 'mycluster' \n\t\t\t\t});\n\t\t}\n\t});\n\t// Festlegung des Volcano-Icons\n\tvar volcanoIcon = L.icon({\n\t\ticonUrl: 'marker/volcano.png',\n\t\ticonSize: [30, 30],\n\t\ticonAnchor: [15, 15],\t\n\t});\n\tfor (var volcano in volcanoArray.features){\n\t\tvar popupText = \"<b>Name: </b>\" + volcanoArray.features[volcano].properties.name;\n\t\tvar volcanoMarker = new L.marker([volcanoArray.features[volcano].geometry.coordinates[1], volcanoArray.features[volcano].geometry.coordinates[0]],{icon: volcanoIcon}).bindPopup(popupText).on('click', volcanoMarkerOnClick);\n\t\tvolcanoMarkerCluster.addLayer(volcanoMarker);\n\t}\n\tmap.addLayer(volcanoMarkerCluster);\n}",
"function getClusteringTool(datasetSelectId, clustermethod, numclusters) { \n \n var url = \"http://terranode-239/geocloud/newofflinejob.aspx?method=\" + clustermethod + \"&datasetid=\" + datasetSelectId + \"&noclusters=\" + numclusters; \n var xhr = makeCORSRequest(url, \"GET\", function (err, res) { \n if (err) { \n console.error(\"[getClusteringTool] \" + err.message); \n return; \n } \n handleClusteringTool(res.responseText); \n }); \n xhr.send(); \n}",
"function clusterGraphByType() {\n\t\tlogControl ? console.log('clusterGraphByType() -> ') : '';\n\n\t\tvar ArrayType = [ 'licensing', 'resolved' ];\n\t\tnetwork.setData(graphData);\n\t\tvar clusterOptionsByData;\n\t\tfor (var i = 0; i < ArrayType.length; i++) {\n\n\t\t\tvar type = ArrayType[i];\n\t\t\tclusterOptionsByData = {\n\t\t\t\tjoinCondition : function(childOptions) {\n\t\t\t\t\treturn childOptions.type == type;\n\t\t\t\t},\n\t\t\t\tprocessProperties : function(clusterOptions, childNodes,\n\t\t\t\t\t\tchildEdges) {\n\t\t\t\t\tvar totalMass = 0;\n\t\t\t\t\tfor (var i = 0; i < childNodes.length; i++) {\n\t\t\t\t\t\ttotalMass += childNodes[i].mass;\n\t\t\t\t\t}\n\t\t\t\t\tclusterOptions.mass = totalMass;\n\t\t\t\t\treturn clusterOptions;\n\t\t\t\t},\n\t\t\t\tclusterNodeProperties : {\n\t\t\t\t\tid : 'cluster:' + type,\n\t\t\t\t\tborderWidth : 3,\n\t\t\t\t\tgroup : 'Cluster' + type,\n\t\t\t\t\tlabel : type\n\t\t\t\t}\n\t\t\t};\n\t\t\tnetwork.cluster(clusterOptionsByData);\n\t\t}\n\t}",
"function Clusterer(id, internalClusterer) {\n this.id = function() {\n return id;\n };\n this.filter = function(f) {\n internalClusterer.filter(f);\n };\n this.enable = function() {\n internalClusterer.enable(true);\n };\n this.disable = function() {\n internalClusterer.enable(false);\n };\n this.add = function(marker, todo, lock) {\n if (!lock) {\n internalClusterer.beginUpdate();\n }\n internalClusterer.addMarker(marker, todo);\n if (!lock) {\n internalClusterer.endUpdate();\n }\n };\n this.getById = function(id) {\n return internalClusterer.getById(id);\n };\n this.clearById = function(id, lock) {\n var result;\n if (!lock) {\n internalClusterer.beginUpdate();\n }\n result = internalClusterer.clearById(id);\n if (!lock) {\n internalClusterer.endUpdate();\n }\n return result;\n };\n this.clear = function(last, first, tag, lock) {\n if (!lock) {\n internalClusterer.beginUpdate();\n }\n internalClusterer.clear(last, first, tag);\n if (!lock) {\n internalClusterer.endUpdate();\n }\n };\n }",
"function reCluster() {\n console.log(cluster);\n for (var i = 0; i < cluster.length; i++) {\n if (cluster[i].checked === false) {\n findMatch(cluster[i].row, cluster[i].col);\n }\n }\n}",
"clusterstatus(params) {\n this.options.qs = Object.assign({\n action: 'CLUSTERSTATUS',\n }, params);\n\n return this.request(this.options);\n }",
"function Scene_Workman_Options() {\n this.initialize.apply(this, arguments);\n}",
"function toggle(filterc) {\n var markers = [];\n for (var i = 0; i < clusterMarkers.length; i++) {\n if (filterc == '0') {\n markers.push(clusterMarkers[i]);\n clusterMarkers[i].setVisible(true);\n }\n else if (clusterMarkers[i].Filter == filterc) {\n markers.push(clusterMarkers[i]);\n clusterMarkers[i].setVisible(true);\n }\n }\n if (markers.length) {\n clusters.removeMarkers(clusterMarkers);\n clusters.addMarkers(markers);\n }\n }",
"static init() {\n\t\tconst oThis = this;\n\t\t// looping over all databases\n\t\tfor (let dbName in mysqlConfig['databases']) {\n\t\t\tlet dbClusters = mysqlConfig['databases'][dbName];\n\t\t\t// looping over all clusters for the database\n\t\t\tfor (let i = 0; i < dbClusters.length; i++) {\n\t\t\t\tlet cName = dbClusters[i],\n\t\t\t\t\tcConfig = mysqlConfig['clusters'][cName];\n\n\t\t\t\t// creating pool cluster object in poolClusters map\n\t\t\t\toThis.generateCluster(cName, dbName, cConfig);\n\t\t\t}\n\t\t}\n\t}",
"initDefaultSelectInfo() {\n const {\n type: chartType,\n selectLabel,\n selectSeries,\n } = this.options;\n\n if (selectLabel.use) {\n let targetAxis = null;\n if (chartType === 'heatMap' && selectLabel?.useBothAxis) {\n targetAxis = this.defaultSelectInfo?.targetAxis;\n }\n\n this.defaultSelectInfo = !this.defaultSelectInfo?.dataIndex\n ? { dataIndex: [], label: [], data: [] }\n : this.getSelectedLabelInfoWithLabelData(this.defaultSelectInfo.dataIndex, targetAxis);\n }\n\n if (selectSeries.use && !this.defaultSelectInfo) {\n this.defaultSelectInfo = { seriesId: [] };\n }\n }",
"function refreshMissionOptions(options, activity) {\n options.find(\"button\").each( (j, e) => {\n if(j == 0) {\n $(e).toggleClass(\"active\", activity.mission_index == null);\n } else {\n $(e).toggleClass(\"active\", (j - 1) == activity.mission_index);\n }\n });\n}",
"static getDefault(opts) {\n if (!defaultCluster) {\n defaultCluster = new Cluster(\"default-cluster\", {}, opts);\n }\n return defaultCluster;\n }",
"function disableCluster() {\n $(\"#radio\").buttonset({\n disabled: true\n });\n}",
"function enableChartView() {\n for (let element of defaultViewElements) element.style.display = \"none\";\n for (let element of chartViewElements) element.style.display = \"block\";\n }",
"clusterprop(params) {\n this.options.qs = Object.assign({\n action: 'CLUSTERPROP',\n }, params);\n\n return this.request(this.options);\n }",
"function useSelectedAlgorithm(startNode, targetNode, adjacencyListGlobal){\n\n\tvar algorithmType = $('.algorithm.active').attr('value');\n\n\t// make sure something is selected\n\tif(algorithmType==null){return [null, false];}\n\n\tif(algorithmType==DfsClassName){\n\t\treturn DFS(startNode, targetNode, adjacencyListGlobal);\n\n\t}else if(algorithmType==DijkstraClassName){\n\t\talert('Not implemented yet, using DFS on the meantime');\n\t\treturn DFS(startNode, targetNode, adjacencyListGlobal);\n\t}\n}",
"showComponentSelection() {\r\n // show single piece settings\r\n let label = (this.selectedComponents[0].label === '') \r\n ? 'no label' \r\n : this.selectedComponents[0].label;\r\n this.toggleComponentSettings(true);\r\n $('#component-name').val(label);\r\n this.selectedComponents[0].loadSettings($('#component-control-loader'));\r\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::IAM::Group.Policy` resource | function cfnGroupPolicyPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnGroup_PolicyPropertyValidator(properties).assertSuccess();
return {
PolicyDocument: cdk.objectToCloudFormation(properties.policyDocument),
PolicyName: cdk.stringToCloudFormation(properties.policyName),
};
} | [
"function cfnMultiRegionAccessPointPolicyPropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnMultiRegionAccessPointPolicyPropsValidator(properties).assertSuccess();\n return {\n MrapName: cdk.stringToCloudFormation(properties.mrapName),\n Policy: cdk.objectToCloudFormation(properties.policy),\n };\n}",
"function cfnMultiRegionAccessPointPolicyPolicyStatusPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnMultiRegionAccessPointPolicy_PolicyStatusPropertyValidator(properties).assertSuccess();\n return {\n IsPublic: cdk.stringToCloudFormation(properties.isPublic),\n };\n}",
"function propertyBadge(value) {\n const denied = value.startsWith(\"~\");\n const info = denied ? {\n \"propName\": value.slice(1),\n \"userPropClass\": \"userprop-denied\",\n \"spanTitle\": \"Granted, aber dann denied\",\n } : {\n \"propName\": value,\n \"userPropClass\": \"userprop-granted\",\n \"spanTitle\": \"Granted\",\n };\n return `\n <span class=\"badge userprop ${info.userPropClass}\"\n data-property-name=\"${info.propName}\">\n <span title=\"${info.spanTitle}\">${info.propName}</span>\n </span>\n `;\n}",
"function ResourceGroup(props) {\n return __assign({ Type: 'AWS::Inspector::ResourceGroup' }, props);\n }",
"function cfnAccessPointPolicyStatusPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnAccessPoint_PolicyStatusPropertyValidator(properties).assertSuccess();\n return {\n IsPublic: cdk.stringToCloudFormation(properties.isPublic),\n };\n}",
"function cfnAccessPointPolicyStatusPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnAccessPoint_PolicyStatusPropertyValidator(properties).assertSuccess();\n return {\n IsPublic: cdk.booleanToCloudFormation(properties.isPublic),\n };\n}",
"function cfnVirtualGatewayVirtualGatewayClientPolicyPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualGateway_VirtualGatewayClientPolicyPropertyValidator(properties).assertSuccess();\n return {\n TLS: cfnVirtualGatewayVirtualGatewayClientPolicyTlsPropertyToCloudFormation(properties.tls),\n };\n}",
"function cfnMultiRegionAccessPointRegionPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnMultiRegionAccessPoint_RegionPropertyValidator(properties).assertSuccess();\n return {\n Bucket: cdk.stringToCloudFormation(properties.bucket),\n BucketAccountId: cdk.stringToCloudFormation(properties.bucketAccountId),\n };\n}",
"function cfnAccessPointPolicyPropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnAccessPointPolicyPropsValidator(properties).assertSuccess();\n return {\n ObjectLambdaAccessPoint: cdk.stringToCloudFormation(properties.objectLambdaAccessPoint),\n PolicyDocument: cdk.objectToCloudFormation(properties.policyDocument),\n };\n}",
"function cfnStorageLensAdvancedDataProtectionMetricsPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnStorageLens_AdvancedDataProtectionMetricsPropertyValidator(properties).assertSuccess();\n return {\n IsEnabled: cdk.booleanToCloudFormation(properties.isEnabled),\n };\n}",
"function cfnMultiRegionAccessPointPropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnMultiRegionAccessPointPropsValidator(properties).assertSuccess();\n return {\n Regions: cdk.listMapper(cfnMultiRegionAccessPointRegionPropertyToCloudFormation)(properties.regions),\n Name: cdk.stringToCloudFormation(properties.name),\n PublicAccessBlockConfiguration: cfnMultiRegionAccessPointPublicAccessBlockConfigurationPropertyToCloudFormation(properties.publicAccessBlockConfiguration),\n };\n}",
"function cfnVirtualGatewayVirtualGatewayClientPolicyTlsPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualGateway_VirtualGatewayClientPolicyTlsPropertyValidator(properties).assertSuccess();\n return {\n Certificate: cfnVirtualGatewayVirtualGatewayClientTlsCertificatePropertyToCloudFormation(properties.certificate),\n Enforce: cdk.booleanToCloudFormation(properties.enforce),\n Ports: cdk.listMapper(cdk.numberToCloudFormation)(properties.ports),\n Validation: cfnVirtualGatewayVirtualGatewayTlsValidationContextPropertyToCloudFormation(properties.validation),\n };\n}",
"function cfnVirtualGatewayVirtualGatewayHealthCheckPolicyPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualGateway_VirtualGatewayHealthCheckPolicyPropertyValidator(properties).assertSuccess();\n return {\n HealthyThreshold: cdk.numberToCloudFormation(properties.healthyThreshold),\n IntervalMillis: cdk.numberToCloudFormation(properties.intervalMillis),\n Path: cdk.stringToCloudFormation(properties.path),\n Port: cdk.numberToCloudFormation(properties.port),\n Protocol: cdk.stringToCloudFormation(properties.protocol),\n TimeoutMillis: cdk.numberToCloudFormation(properties.timeoutMillis),\n UnhealthyThreshold: cdk.numberToCloudFormation(properties.unhealthyThreshold),\n };\n}",
"function cfnStorageLensAwsOrgPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnStorageLens_AwsOrgPropertyValidator(properties).assertSuccess();\n return {\n Arn: cdk.stringToCloudFormation(properties.arn),\n };\n}",
"function generateSASSignature(sasProps, accessPolicy) {\n let str = \"\";\n for (const key in sasProps) {\n if (sasProps.hasOwnProperty(key)) {\n str += accessPolicy[sasProps[key]] === undefined ? `\\n` : `${accessPolicy[sasProps[key]]}\\n`;\n }\n }\n const sig = crypto\n .createHmac(\"sha256\", Keys.DecodedAccessKey)\n .update(str, \"utf8\")\n .digest(\"base64\");\n return sig;\n}",
"function cfnAccessPointPropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnAccessPointPropsValidator(properties).assertSuccess();\n return {\n Bucket: cdk.stringToCloudFormation(properties.bucket),\n BucketAccountId: cdk.stringToCloudFormation(properties.bucketAccountId),\n Name: cdk.stringToCloudFormation(properties.name),\n Policy: cdk.objectToCloudFormation(properties.policy),\n PolicyStatus: cdk.objectToCloudFormation(properties.policyStatus),\n PublicAccessBlockConfiguration: cfnAccessPointPublicAccessBlockConfigurationPropertyToCloudFormation(properties.publicAccessBlockConfiguration),\n VpcConfiguration: cfnAccessPointVpcConfigurationPropertyToCloudFormation(properties.vpcConfiguration),\n };\n}",
"function Policy(props) {\n return __assign({ Type: 'AWS::IAM::Policy' }, props);\n }",
"formatUser() {\n\t\tconst user = this.currentUser();\n\t\treturn `\nName (Client Email): ${user.name}\nKey (Client ID): ${user.key}\nAPI Key ID: ${user.api_key_id}\nAPI Secret: ${user.api_secret}\nPublic Key: ${user.public_key}\nPrivate Key: ${user.private_key}\nPublic Signing Key: ${user.public_signing_key}\nPrivate Signing Key: ${user.private_signing_key}\n`;\n\t}",
"function cfnVirtualGatewayVirtualGatewayGrpcConnectionPoolPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualGateway_VirtualGatewayGrpcConnectionPoolPropertyValidator(properties).assertSuccess();\n return {\n MaxRequests: cdk.numberToCloudFormation(properties.maxRequests),\n };\n}",
"function cfnMultiRegionAccessPointPublicAccessBlockConfigurationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnMultiRegionAccessPoint_PublicAccessBlockConfigurationPropertyValidator(properties).assertSuccess();\n return {\n BlockPublicAcls: cdk.booleanToCloudFormation(properties.blockPublicAcls),\n BlockPublicPolicy: cdk.booleanToCloudFormation(properties.blockPublicPolicy),\n IgnorePublicAcls: cdk.booleanToCloudFormation(properties.ignorePublicAcls),\n RestrictPublicBuckets: cdk.booleanToCloudFormation(properties.restrictPublicBuckets),\n };\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks to see if the current browser is capable of running visualizations. If the AudioContext is available, then the browser can play the visualization. Public Accessor: Amplitude.visualizationCapable() | function publicVisualizationCapable(){
if ( !window.AudioContext ) {
return false;
}else{
return true;
}
} | [
"function supportsDisplay() {\n var hasDisplay =\n this.event.context &&\n this.event.context.System &&\n this.event.context.System.device &&\n this.event.context.System.device.supportedInterfaces &&\n this.event.context.System.device.supportedInterfaces.Display\n\n return hasDisplay;\n}",
"static isDisplaySupported(requestEnvelope) {\n return requestEnvelope.context.System.device.supportedInterfaces.Display !== undefined;\n }",
"function privateCheckSongVisualization(){\n\t\tvar changed = false;\n\n\t\t/*\n\t\t\tChecks to see if the song actually has a specific visualization\n\t\t\tdefined.\n\t\t*/\n\t\tif( config.active_metadata.visualization ){\n\t\t\t\n\t\t\t/*\n\t\t\t\tIf the visualization is different and there is an active\n\t\t\t\tvisualization. We must stop the active visualization\n\t\t\t\tbefore setting the new one.\n\t\t\t*/\n\t\t\tif( config.active_metadata.visualization != config.active_visualization && config.active_visualization != '' ){\n\t\t\t\tprivateStopVisualization();\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t\tSet the visualization changed to true\n\t\t\t\t\tso we return the status change.\n\t\t\t\t*/\n\t\t\t\tchanged = true;\n\n\t\t\t\t/*\n\t\t\t\t\tSets the active visualization to the new\n\t\t\t\t\tvisualization that the song uses.\n\t\t\t\t*/\n\t\t\t\tconfig.active_visualization = config.active_metadata.visualization;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t\tReturns the status of the new song visualization.\n\t\t\tIf there is a change it returns true and we will\n\t\t\thave to start the the visualization.\n\t\t*/\n\t\treturn changed;\n\t}",
"haveRenderer() {\n return this._defaultRenderQueue.length > 0;\n }",
"function useVideoJs() {\n return !(typeof videojs === \"undefined\");\n }",
"function checkStatus() {\n if (supportsAvif !== null && supportsWebp !== null) {\n showOverlay();\n return;\n }\n }",
"function isMediaDevicesSuported(){return hasNavigator()&&!!navigator.mediaDevices;}",
"function isYoastAnalyticsObjectAvailable() {\n if (typeof __gaTracker !== 'undefined') {\n return true;\n }\n return false;\n}",
"function isUniversalAnalyticsObjectAvailable() {\n if (typeof ga !== 'undefined') {\n return true;\n }\n return false;\n}",
"function enableChartView() {\n for (let element of defaultViewElements) element.style.display = \"none\";\n for (let element of chartViewElements) element.style.display = \"block\";\n }",
"static isSupported(gl) {\n assertWebGLRenderingContext(gl);\n return (\n gl instanceof WebGL2RenderingContext ||\n gl.getExtension('OES_vertex_array_object')\n );\n }",
"function visualize() {\n\n visualizer.updatePitchChart(audioProcessor.getPitches(), audioProcessor.getTimestamps());\n visualizer.updateRateChart(audioProcessor.getVibratoRates(), audioProcessor.getTimestamps());\n visualizer.updateWidthChart(audioProcessor.getVibratoWidths(), audioProcessor.getTimestamps());\n calcPitch();\n}",
"function chartsLoaded() {\n chartLibraryLoaded = true; // Global var which can be checked before attempting to draw chart\n drawChart() // try to draw chart\n}",
"function checkForWinAmpAPI()\n{\n\tif (window.external &&\n\t\t\"Enqueue\" in window.external &&\n\t\t\"GetClassicColor\" in window.external &&\n\t\t\"font\" in window.external &&\n\t\t\"fontsize\" in window.external &&\n\t\t\"IsRegisteredExtension\" in window.external &&\n\t\t\"GetMetadata\" in window.external)\t// Can't be bothered yet to work out how to pass objects back from C++.\n\t{\n\t\twinAmpAPI = true;\n\t}\n\telse\n\t{\n\t\talert(\"The hosting container does not expose the redcaza JavaScript API, e.g.: window.external.Method.\\n You will not be able to listen to or view media.\");\n }\n}",
"function isGecko() {\n\t\tconst w = window\n\t\t// Based on research in September 2020\n\t\treturn (\n\t\t\tcountTruthy([\n\t\t\t\t'buildID' in navigator,\n\t\t\t\t'MozAppearance' in (document.documentElement?.style ?? {}),\n\t\t\t\t'onmozfullscreenchange' in w,\n\t\t\t\t'mozInnerScreenX' in w,\n\t\t\t\t'CSSMozDocumentRule' in w,\n\t\t\t\t'CanvasCaptureMediaStream' in w,\n\t\t\t]) >= 4\n\t\t)\n\t}",
"function in_theater_mode() {\n return (document.getElementById(\"player-theater-container\") &&\n document.getElementById(\"player-theater-container\").childElementCount > 0 &&\n !document.fullscreenElement)\n}",
"function detectBrowserFeatures() {\r\n _browserFeatures = {\r\n // Safari has a bug: elements positioned above the canvas are not redrawn without forcing them to do it\r\n // Disable this in other browsers for speed acceleration\r\n redrawBug: navigator.userAgent.indexOf(\"Safari\") != -1,\r\n // Firefox cannot rotate canvas directly: it renders jagged edges (because of empty subpixels outside?)\r\n // Other browsers antialias edges and perform canvas rotation faster than converting to dataimg and transforming it\r\n directCanvasRotate: navigator.userAgent.indexOf(\"Firefox\") == -1,\r\n borderRadius: \"borderRadius\" in document.body.style,\r\n touch: \"ontouchstart\" in document\r\n };\r\n }",
"function pluginInstalledIE(){\n\t\ttry{\n\t\t\tvar o = new ActiveXObject(\"npwidevinemediaoptimizer.WidevineMediaTransformerPlugin\");\n\t\t\to = null;\n\t\t\treturn true;\n\t\t}catch(e){\n\t\t\treturn false;\n\t\t}\n\t}",
"isOnServer() {\n return !(typeof window !== 'undefined' && window.document);\n }",
"function isCanvas() {\n return !isHome();\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
On component unmount, unregister scroll and resize handlers | componentWillUnmount() {
window.addEventListener('scroll', this.handleScroll);
window.removeEventListener('resize', this.handleWindowSizeChange);
} | [
"destroy() {\n this.viewport.options.divWheel.removeEventListener('wheel', this.wheelFunction);\n }",
"function unregisterEventHandlers() {\n if (oOrientationSensor != null) {\n oOrientationSensor.removeEventListener(\"orientationchanged\", orientationSensor_orientationChanged);\n }\n}",
"componentWillUnmount() {\n if (!this.diagramRef.current) return;\n const diagram = this.diagramRef.current.getDiagram();\n if (diagram) {\n diagram.removeDiagramListener('ChangedSelection', this.props.onDiagramEvent);\n diagram.removeDiagramListener('ObjectDoubleClicked', this.props.onDiagramDoubleClicked);\n }\n }",
"function removeBelowfoldListeners() {\n removeEvent(win, SCROLL, scrollListener); \n removeEvent(win, RESIZE, resizeListener);\n\n // Is orientationchange event supported? If so, remove the listener \n orientationSupported && removeEvent(win, ORIENTATIONCHANGE, orientationchangeListener);\n }",
"function removeTouchHandler(){if(isTouchDevice||isTouch){// normalScrollElements requires it off #2691\nif(options.autoScrolling){$body.removeEventListener(events.touchmove,touchMoveHandler,{passive:false});$body.removeEventListener(events.touchmove,preventBouncing,{passive:false});}var touchWrapper=options.touchWrapper;touchWrapper.removeEventListener(events.touchstart,touchStartHandler);touchWrapper.removeEventListener(events.touchmove,touchMoveHandler,{passive:false});}}",
"componentWillUnmount() {\n this.observer.disconnect();\n }",
"componentWillUnmount() {\n\t\tif (this.props.cleanStylesOnUnmount) {\n\t\t\tthis.fontManager.removeCustomStyle();\n\t\t}\n\t}",
"function unregisterInnerHotkeys() {\n $document.unbind(\"keyup\", innerHotkeysListener);\n }",
"componentWillUnmount() {\n if (this.state.isBeingDragged) {\n this.handleDragEnd();\n }\n }",
"dispose() {\n this.context = null;\n\n // remove all global event listeners when component gets destroyed\n window.removeEventListener('message', this.sendUpdateTripSectionsEvent);\n }",
"resetResize() {\n\t\tconst {\n\t \tisResizing\n\t } = resizeState;\n\n\t if (isResizing) {\n\t \tassign(resizeState, resizeDefaults);\n\t\t removeClass(this.container, RESIZE_CLASS);\n\t\t removeListener(document, 'mousemove', resizeState.listener);\n\t }\n\t \n\t}",
"untrackWindow() {\n if (!this.window) {\n return;\n }\n this.window.removeListener('move', this._movedHandler);\n this.window.removeListener('resize', this._resizedHandler);\n this.window = undefined;\n }",
"function destroy() {\n parent.removeEventListener(\"mousedown\", onDown);\n document.querySelector(\"body\").removeEventListener(\"mouseup\", onUp);\n parent.removeEventListener(\"mousemove\", onMove);\n console.log(\" ======== draggables destryed =========\");\n }",
"_unbindLayoutAnimationEndEvent() {\n const menu = this.getMenu()\n\n if (this._transitionCallbackTimeout) {\n clearTimeout(this._transitionCallbackTimeout)\n this._transitionCallbackTimeout = null\n }\n\n if (menu && this._transitionCallback) {\n TRANS_EVENTS.forEach(e => {\n menu.removeEventListener(e, this._transitionCallback, false)\n })\n }\n\n if (this._transitionCallback) {\n this._transitionCallback = null\n }\n }",
"beforeUnmount() {\n this.observer.disconnect(), this.flatpickrInstance && this.flatpickrInstance.destroy();\n }",
"componentWillUnmount() {\n if (this._popper) {\n this._popper.destroy();\n }\n }",
"destroy() {\n this.map.off('dragging', this.listenDragging, this);\n this.map.off('dragend', this.listenDragEnd, this);\n this.customLayer.setMap(null);\n }",
"function useHandleEditorUnmount(editorSharedConfigRef) {\n React.useEffect(function () {\n // Need to keep this reference in order to make \"react-hooks/exhaustive-deps\" eslint rule happy\n var editorSharedConfig = editorSharedConfigRef;\n // Will unmount\n return function () {\n if (!editorSharedConfig.current) {\n return;\n }\n var _a = editorSharedConfig.current, eventDispatcher = _a.eventDispatcher, editorView = _a.editorView;\n if (eventDispatcher) {\n eventDispatcher.destroy();\n }\n if (editorView) {\n // Prevent any transactions from coming through when unmounting\n editorView.setProps({\n dispatchTransaction: function (_tr) { },\n });\n // Destroy the state if the Editor is being unmounted\n var editorState_1 = editorView.state;\n editorState_1.plugins.forEach(function (plugin) {\n var state = plugin.getState(editorState_1);\n if (state && state.destroy) {\n state.destroy();\n }\n });\n editorView.destroy();\n }\n };\n }, [editorSharedConfigRef]);\n}",
"function removeEventHandlers()\r\n {\r\n // remove keyboard events\r\n if (keyHandler != null)\r\n {\r\n $(document).unbind(\"keydown keyup\", keyHandler);\r\n }\r\n\r\n // remove mouse wheel events\r\n if (mouseWheelHandler != null)\r\n {\r\n $qtip.unbind(\"mousewheel\", mouseWheelHandler);\r\n $label.unbind(\"mousewheel\", mouseWheelHandler);\r\n }\r\n\r\n keyHandler = null;\r\n mouseWheelHandler = null;\r\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the max console height for all rooms. | static getMaxHeight() {
var result = Math.max(MainUtil.findAllRooms().map(room => (room.memory.console && room.memory.console.height)));
return result || 10;
} | [
"function getHeight() {\n return maxy + 1;\n }",
"getGameHeight() {\n return this.scene.sys.game.config.height;\n }",
"get maxHeight() {\n\t\tlet maxHeight = 0, height;\n\n\t\tfor (let i = 0; i < this.count; i++) {\n\t\t\tif (this.cache[i]) {\n\t\t\t\theight = this.cache[i];\n\t\t\t} else {\n\t\t\t\theight = this.traverse(i);\n\t\t\t\t\n\t\t\t\tthis.cache[i] = height;\n\t\t\t\tthis.cache[this.tree[i]] = height - 1;\n\t\t\t}\n\n\t\t\tmaxHeight = Math.max(maxHeight, height);\n\t\t}\n\n\t\treturn maxHeight;\n\t}",
"function getHighestTextArea() {\r\n var textAreaHeight = 0;\r\n sAccTextArea.each(function () {\r\n if ($(this).height() > textAreaHeight) {\r\n textAreaHeight = $(this).outerHeight();\r\n }\r\n });\r\n return textAreaHeight;\r\n }",
"get maxLines() {}",
"function calculateHeight() {\n\t\treturn (val / capacity) * bottleHeight;\n\t}",
"get inputMaxHeight(){\n var {footer, header, maxHeight} = this.props;\n var inputMaxHeight = maxHeight;\n if(footer) inputMaxHeight-=1;\n if(header) inputMaxHeight-=1;\n return inputMaxHeight;\n }",
"function height() {\n return gl.drawingBufferHeight / scale();\n }",
"function getHeight() {\n return 2;\n }",
"function findMaxArea(heights) {\n //0, 1, \n let max = 0;\n \n for (let i = 0; i <= heights.length; i++){//x=0 \n for (let j = i; j < heights.length; j++){\n let height = height[j] < height[i] ? height[j] :height[i] ;//8 \n \n let width = Math.abs(j - i); //1\n \n \n if (max < height * width){ \n max = height * width;//8\n }\n \n }\n }\n \n return max;\n \n }",
"function get_max_height_divs(elements)\n{\n return Math.max.apply(null, elements.map(function ()\n {\n //~ alert($(this).attr(\"id\") + \" \" + $(this).height());\n return $(this).height();\n }).get());\n}",
"getMaxRect(x, y, aspect) {\n return Rect.getMax(Math.abs(this.locked[0] - x), Math.abs(this.locked[1] - y), aspect)\n }",
"_calculateHeight() {\n\t\tif (this.options.height) {\n\t\t\treturn this.jumper.evaluate(this.options.height, { '%': this.jumper.getAvailableHeight() });\n\t\t}\n\n\t\treturn this.naturalHeight() + (this.hasScrollBarX() ? 1 : 0);\n\t}",
"get height() {\n if ( !this.el ) return;\n\n return ~~this.parent.style.height.replace( 'px', '' );\n }",
"get stepHeight() {\n return Math.floor(this.height / this.gridStep) + 1;\n }",
"function setMenuMaxHeight() {\n \tvar outerHeight = $(pDiv+jq(config.CSS.IDs.divBottomWrapper)).outerHeight(true);\n \tvar docHeight = $(pDiv+ jq(\"divMainJsmol\")).height();//TODO fix\n \t$(pDiv+ jq(config.CSS.IDs.divMenu)).css('max-height',docHeight - outerHeight );\n\t}",
"getMaxY(){ return this.y + this.height }",
"get height() {\n // spec says it is a string\n return this.getAttribute('height') || '';\n }",
"@computed\n get maxDistancePx() {\n return Math.sqrt(\n Math.pow(this.windowDimensions.width / 2, 2) +\n Math.pow(this.windowDimensions.height / 2, 2),\n );\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new RawTexture3D | function RawTexture3D(data,width,height,depth,/** Gets or sets the texture format to use */format,scene,generateMipMaps,invertY,samplingMode,textureType){if(generateMipMaps===void 0){generateMipMaps=true;}if(invertY===void 0){invertY=false;}if(samplingMode===void 0){samplingMode=BABYLON.Texture.TRILINEAR_SAMPLINGMODE;}if(textureType===void 0){textureType=BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT;}var _this=_super.call(this,null,scene,!generateMipMaps,invertY)||this;_this.format=format;_this._engine=scene.getEngine();_this._texture=scene.getEngine().createRawTexture3D(data,width,height,depth,format,generateMipMaps,invertY,samplingMode,undefined,textureType);_this.is3D=true;return _this;} | [
"function RawTexture(data,width,height,/**\n * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\n */format,scene,generateMipMaps,invertY,samplingMode,type){if(generateMipMaps===void 0){generateMipMaps=true;}if(invertY===void 0){invertY=false;}if(samplingMode===void 0){samplingMode=BABYLON.Texture.TRILINEAR_SAMPLINGMODE;}if(type===void 0){type=BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT;}var _this=_super.call(this,null,scene,!generateMipMaps,invertY)||this;_this.format=format;_this._engine=scene.getEngine();_this._texture=scene.getEngine().createRawTexture(data,width,height,format,generateMipMaps,invertY,samplingMode,null,type);_this.wrapU=BABYLON.Texture.CLAMP_ADDRESSMODE;_this.wrapV=BABYLON.Texture.CLAMP_ADDRESSMODE;return _this;}",
"upload3DTexture () {\n\n }",
"function RawCubeTexture(scene,data,size,format,type,generateMipMaps,invertY,samplingMode,compression){if(format===void 0){format=BABYLON.Engine.TEXTUREFORMAT_RGBA;}if(type===void 0){type=BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT;}if(generateMipMaps===void 0){generateMipMaps=false;}if(invertY===void 0){invertY=false;}if(samplingMode===void 0){samplingMode=BABYLON.Texture.TRILINEAR_SAMPLINGMODE;}if(compression===void 0){compression=null;}var _this=_super.call(this,\"\",scene)||this;_this._texture=scene.getEngine().createRawCubeTexture(data,size,format,type,generateMipMaps,invertY,samplingMode,compression);return _this;}",
"function create3DTarget(target) {\n let loader = new THREE.TextureLoader();\n let planetSize = .5;\n loader.load(`./assets/img/targets/${target.name}.jpg`, (texture) => {\n let geom = new THREE.SphereGeometry(planetSize, 30, 30);\n let mat = (target.name == 'Sun') ? new THREE.MeshBasicMaterial({map: texture}) : new THREE.MeshLambertMaterial({map: texture});\n let planet = new THREE.Mesh(geom, mat);\n planet.name = target.name; planet.targetIndex = targets.indexOf(target);\n // Positioning\n let targetCartesian = Math.cartesian(target.az, target.el, gridRadius);\n planet.position.x = -targetCartesian.x;\n planet.position.z = -targetCartesian.z;\n planet.position.y = targetCartesian.y;\n planet.lookAt(0, 0, 0); planet.rotateY(Math.radians(target.az));\n // Target specific features\n if (planet.name == 'Saturn') {\n loader.load(`./assets/img/targets/SaturnRing.png`, (texture) => {\n geom = new THREE.RingGeometry(planetSize * 1.116086235489221, planetSize * 2.326699834162521, 84, 1);\n for(var yi = 0; yi < geom.parameters.phiSegments; yi++) {\n var u0 = yi / geom.parameters.phiSegments;\n var u1=(yi + 1) / geom.parameters.phiSegments;\n for(var xi = 0; xi < geom.parameters.thetaSegments; xi++) {\n \t\tvar fi = 2 * (xi + geom.parameters.thetaSegments * yi);\n var v0 = xi / geom.parameters.thetaSegments;\n var v1 = (xi + 1) / geom.parameters.thetaSegments;\n geom.faceVertexUvs[0][fi][0].x = u0; geom.faceVertexUvs[0][fi][0].y = v0;\n geom.faceVertexUvs[0][fi][1].x = u1; geom.faceVertexUvs[0][fi][1].y = v0;\n geom.faceVertexUvs[0][fi][2].x = u0; geom.faceVertexUvs[0][fi][2].y = v1;\n fi++;\n geom.faceVertexUvs[0][fi][0].x = u1; geom.faceVertexUvs[0][fi][0].y = v0;\n geom.faceVertexUvs[0][fi][1].x = u1; geom.faceVertexUvs[0][fi][1].y = v1;\n geom.faceVertexUvs[0][fi][2].x = u0; geom.faceVertexUvs[0][fi][2].y = v1;\n }\n }\n mat = new THREE.MeshLambertMaterial( { map: texture, side: THREE.DoubleSide, transparent: true } );\n let ring = new THREE.Mesh(geom, mat);\n ring.rotateX(27);\n planet.add(ring);\n });\n } else if (target.name == 'Sun') {\n const light = new THREE.PointLight('#d4caba', 1, 500, 0 );\n let lightCartesian = Math.cartesian(target.az, target.el, gridRadius - .5);\n light.position.x = -lightCartesian.x;\n light.position.y = lightCartesian.y;\n light.position.z = -lightCartesian.z;\n scene.add(light);\n }\n // planet.add(new THREE.AxesHelper(5));\n scene.add(planet);\n });\n}",
"function show_texture() {\n let index = this.getAttribute(\"data-index\");\n empty_all();\n\n let height = data_editor.dom.config.offsetHeight - 10;\n let texture_container = DOM.cdiv(data_editor.dom.config, null, \"texture_container\");\n let texture_path = \"/3dshapes/\" + shapegroup_key + \"/\" + data_editor.definition.textures[index];\n let img = DOM.cimg(texture_container, texture_path, null, \"texture\");\n img.style.width = \"\" + height + \"px\";\n img.style.height = \"\" + height + \"px\";\n let coords_position = DOM.cdiv(texture_container);\n img.addEventListener(\"mousemove\", (ev) => {\n DOM.removeChilds(coords_position, true);\n DOM.cdiv(coords_position, null, null, \"U: \" + (Math.floor(10000 * ev.offsetX / height) / 10000 ));\n DOM.cdiv(coords_position, null, null, \"V: \" + (Math.floor(10000 * (1-(ev.offsetY / height))) / 10000 ));\n });\n img.addEventListener(\"mouseout\", () => { DOM.removeChilds(coords_position, true); });\n\n // Show the texture on the 3D view as a cube\n let geometry = new THREE.BoxGeometry( 1, 1, 1 );\n let texture = loadTexture(texture_path);\n let material = WGL_createDeviceMaterial({map: texture, mycolor: 0x888888});\n let mesh = new THREE.Mesh( geometry, material );\n data_editor.scene.add(mesh);\n requestDraw();\n data_editor.active_3dshape = mesh;\n}",
"updateTexture() {\n let width = 1;\n let height = 1;\n let depth = 1;\n if(this.props.activations){\n this.activations = this.props.activations\n const [b, w, h, c] = this.props.activationShape;\n\n width = w;//sqrtW;\n height = h;//sqrtW;\n depth = c;\n } else{\n this.activations = this.defatultActivations;\n }\n\n //this.activationTexture = new RawTexture(this.activations, width, height,\n // Engine.TEXTUREFORMAT_RED, this.scene, false, false,\n // Texture.BILINEAR_SAMPLINGMODE, Engine.TEXTURETYPE_FLOAT);\n\n let sz;\n let sizeMatches = false;\n if(this.activationTexture) {\n sz = this.activationTexture.getSize();\n sizeMatches = (sz.width === width && sz.height === height\n && this.lastDepth === depth);\n }\n if(!this.activationTexture || !sizeMatches) {\n if(this.activationTexture){\n this.activationTexture.dispose();\n }\n this.activationTexture = new RawTexture3D(this.activations, width, height,\n depth, Engine.TEXTUREFORMAT_RED, this.scene, false, false,\n Texture.NEAREST_SAMPLINGMODE, Engine.TEXTURETYPE_FLOAT);\n } else {\n this.activationTexture.update(this.activations);\n }\n\n this.shaderMaterial.setTexture('textureSampler', this.activationTexture);\n this.lastDepth = depth;\n }",
"compressedTexImage3D(ctx, funcName, args) {\n const [target, level, internalFormat, width, height, depth] = args;\n const info = getTextureInfo(target);\n updateMipLevel(info, target, level, internalFormat, width, height, depth, UNSIGNED_BYTE);\n }",
"texImage3D(ctx, funcName, args) {\n let [target, level, internalFormat, width, height, depth, border, format, type] = args;\n const info = getTextureInfo(target);\n updateMipLevel(info, target, level, internalFormat, width, height, depth, type);\n }",
"function initTextures() {\n floorTexture = gl.createTexture();\n floorTexture.image = new Image();\n floorTexture.image.onload = function () {\n handleTextureLoaded(floorTexture)\n }\n floorTexture.image.src = \"./assets/grass1.jpg\";\n\n cubeTexture = gl.createTexture();\n cubeTexture.image = new Image();\n cubeTexture.image.onload = function() {\n handleTextureLoaded(cubeTexture);\n }; // async loading\n cubeTexture.image.src = \"./assets/gifft.jpg\";\n}",
"function mTexture() {\n texture(...[...arguments]);\n}",
"function BaseTexture(scene){this._hasAlpha=false;/**\n * Defines if the alpha value should be determined via the rgb values.\n * If true the luminance of the pixel might be used to find the corresponding alpha value.\n */this.getAlphaFromRGB=false;/**\n * Intensity or strength of the texture.\n * It is commonly used by materials to fine tune the intensity of the texture\n */this.level=1;/**\n * Define the UV chanel to use starting from 0 and defaulting to 0.\n * This is part of the texture as textures usually maps to one uv set.\n */this.coordinatesIndex=0;this._coordinatesMode=BABYLON.Texture.EXPLICIT_MODE;/**\n * | Value | Type | Description |\n * | ----- | ------------------ | ----------- |\n * | 0 | CLAMP_ADDRESSMODE | |\n * | 1 | WRAP_ADDRESSMODE | |\n * | 2 | MIRROR_ADDRESSMODE | |\n */this.wrapU=BABYLON.Texture.WRAP_ADDRESSMODE;/**\n * | Value | Type | Description |\n * | ----- | ------------------ | ----------- |\n * | 0 | CLAMP_ADDRESSMODE | |\n * | 1 | WRAP_ADDRESSMODE | |\n * | 2 | MIRROR_ADDRESSMODE | |\n */this.wrapV=BABYLON.Texture.WRAP_ADDRESSMODE;/**\n * | Value | Type | Description |\n * | ----- | ------------------ | ----------- |\n * | 0 | CLAMP_ADDRESSMODE | |\n * | 1 | WRAP_ADDRESSMODE | |\n * | 2 | MIRROR_ADDRESSMODE | |\n */this.wrapR=BABYLON.Texture.WRAP_ADDRESSMODE;/**\n * With compliant hardware and browser (supporting anisotropic filtering)\n * this defines the level of anisotropic filtering in the texture.\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\n */this.anisotropicFilteringLevel=BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;/**\n * Define if the texture is a cube texture or if false a 2d texture.\n */this.isCube=false;/**\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\n */this.is3D=false;/**\n * Define if the texture contains data in gamma space (most of the png/jpg aside bump).\n * HDR texture are usually stored in linear space.\n * This only impacts the PBR and Background materials\n */this.gammaSpace=true;/**\n * Is Z inverted in the texture (useful in a cube texture).\n */this.invertZ=false;/**\n * @hidden\n */this.lodLevelInAlpha=false;/**\n * Define if the texture is a render target.\n */this.isRenderTarget=false;/**\n * Define the list of animation attached to the texture.\n */this.animations=new Array();/**\n * An event triggered when the texture is disposed.\n */this.onDisposeObservable=new BABYLON.Observable();/**\n * Define the current state of the loading sequence when in delayed load mode.\n */this.delayLoadState=BABYLON.Engine.DELAYLOADSTATE_NONE;this._cachedSize=BABYLON.Size.Zero();this._scene=scene||BABYLON.Engine.LastCreatedScene;if(this._scene){this._scene.textures.push(this);this._scene.onNewTextureAddedObservable.notifyObservers(this);}this._uid=null;}",
"function CustomProceduralTexture(name,texturePath,size,scene,fallbackTexture,generateMipMaps){var _this=_super.call(this,name,size,null,scene,fallbackTexture,generateMipMaps)||this;_this._animate=true;_this._time=0;_this._texturePath=texturePath;//Try to load json\n_this._loadJson(texturePath);_this.refreshRate=1;return _this;}",
"function createSkybox(textureNumber) {\r\n document.getElementById(\"bttn\").focus(); // to prevent key presses from going to the radio buttons\r\n if (skybox)\r\n scene.remove(skybox);\r\n var textureURLs = [];\r\n textureURLs.push(skyboxTextureFolder[textureNumber] + \"/posx.jpg\" );\r\n textureURLs.push(skyboxTextureFolder[textureNumber] + \"/negx.jpg\" );\r\n textureURLs.push(skyboxTextureFolder[textureNumber] + \"/posy.jpg\" );\r\n textureURLs.push(skyboxTextureFolder[textureNumber] + \"/negy.jpg\" );\r\n textureURLs.push(skyboxTextureFolder[textureNumber] + \"/posz.jpg\" );\r\n textureURLs.push(skyboxTextureFolder[textureNumber] + \"/negz.jpg\" );\r\n skyboxTexture = THREE.ImageUtils.loadTextureCube( textureURLs, undefined, render );\r\n var shader = THREE.ShaderLib[ \"cube\" ]; // contains the required shaders\r\n shader.uniforms[ \"tCube\" ].value = skyboxTexture; // data for the shaders\r\n var material = new THREE.ShaderMaterial( {\r\n // A ShaderMaterial uses custom vertex and fragment shaders.\r\n fragmentShader: shader.fragmentShader,\r\n vertexShader: shader.vertexShader,\r\n uniforms: shader.uniforms, // the texture is part of this object\r\n depthWrite: false,\r\n side: THREE.BackSide\r\n } );\r\n skybox = new THREE.Mesh( new THREE.CubeGeometry( 100, 100, 100 ), material );\r\n scene.add(skybox);\r\n if (model) {\r\n if (model.material) { // it's a basic geometry model\r\n model.material = makeReflectionMaterial();\r\n model.material.needsUpdate = true;\r\n }\r\n else { // it's a JSON model and the actual model object is model.children[0]\r\n model.children[0].material = makeReflectionMaterial();\r\n model.children[0].needsUpdate = true;\r\n }\r\n }\r\n render();\r\n}",
"function makeBase(terrainWidth,terrainHeight,material){\n var geometry = new THREE.PlaneGeometry(terrainWidth*2,terrainHeight*2,1,1);\n var plane = new THREE.Mesh(geometry, material);\n scene.add(plane);\n plane.rotation.x = -Math.PI / 2;\n plane.position.y=-1;\n}",
"function ProceduralTexture(name,size,fragment,scene,fallbackTexture,generateMipMaps,isCube){if(fallbackTexture===void 0){fallbackTexture=null;}if(generateMipMaps===void 0){generateMipMaps=true;}if(isCube===void 0){isCube=false;}var _this=_super.call(this,null,scene,!generateMipMaps)||this;_this.isCube=isCube;/**\n * Define if the texture is enabled or not (disabled texture will not render)\n */_this.isEnabled=true;/**\n * Define if the texture must be cleared before rendering (default is true)\n */_this.autoClear=true;/**\n * Event raised when the texture is generated\n */_this.onGeneratedObservable=new BABYLON.Observable();/** @hidden */_this._textures={};_this._currentRefreshId=-1;_this._refreshRate=1;_this._vertexBuffers={};_this._uniforms=new Array();_this._samplers=new Array();_this._floats={};_this._ints={};_this._floatsArrays={};_this._colors3={};_this._colors4={};_this._vectors2={};_this._vectors3={};_this._matrices={};_this._fallbackTextureUsed=false;_this._cachedDefines=\"\";_this._contentUpdateId=-1;scene=_this.getScene();var component=scene._getComponent(BABYLON.SceneComponentConstants.NAME_PROCEDURALTEXTURE);if(!component){component=new BABYLON.ProceduralTextureSceneComponent(scene);scene._addComponent(component);}scene.proceduralTextures.push(_this);_this._engine=scene.getEngine();_this.name=name;_this.isRenderTarget=true;_this._size=size;_this._generateMipMaps=generateMipMaps;_this.setFragment(fragment);_this._fallbackTexture=fallbackTexture;if(isCube){_this._texture=_this._engine.createRenderTargetCubeTexture(size,{generateMipMaps:generateMipMaps,generateDepthBuffer:false,generateStencilBuffer:false});_this.setFloat(\"face\",0);}else{_this._texture=_this._engine.createRenderTargetTexture(size,{generateMipMaps:generateMipMaps,generateDepthBuffer:false,generateStencilBuffer:false});}// VBO\nvar vertices=[];vertices.push(1,1);vertices.push(-1,1);vertices.push(-1,-1);vertices.push(1,-1);_this._vertexBuffers[BABYLON.VertexBuffer.PositionKind]=new BABYLON.VertexBuffer(_this._engine,vertices,BABYLON.VertexBuffer.PositionKind,false,false,2);_this._createIndexBuffer();return _this;}",
"function HDRCubeTexture(url,scene,size,noMipmap,generateHarmonics,gammaSpace,reserved,onLoad,onError){if(noMipmap===void 0){noMipmap=false;}if(generateHarmonics===void 0){generateHarmonics=true;}if(gammaSpace===void 0){gammaSpace=false;}if(reserved===void 0){reserved=false;}if(onLoad===void 0){onLoad=null;}if(onError===void 0){onError=null;}var _this=_super.call(this,scene)||this;_this._generateHarmonics=true;_this._onLoad=null;_this._onError=null;/**\n * The texture coordinates mode. As this texture is stored in a cube format, please modify carefully.\n */_this.coordinatesMode=BABYLON.Texture.CUBIC_MODE;_this._isBlocking=true;_this._rotationY=0;/**\n * Gets or sets the center of the bounding box associated with the cube texture\n * It must define where the camera used to render the texture was set\n */_this.boundingBoxPosition=BABYLON.Vector3.Zero();if(!url){return _this;}_this.name=url;_this.url=url;_this.hasAlpha=false;_this.isCube=true;_this._textureMatrix=BABYLON.Matrix.Identity();_this._onLoad=onLoad;_this._onError=onError;_this.gammaSpace=gammaSpace;_this._noMipmap=noMipmap;_this._size=size;_this._texture=_this._getFromCache(url,_this._noMipmap);if(!_this._texture){if(!scene.useDelayedTextureLoading){_this.loadTexture();}else{_this.delayLoadState=BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;}}return _this;}",
"function loadFocusTexture() {\n PRIVATE.focusTexture = THREE.ImageUtils.loadTexture('img/focus.png');\n}",
"function textureHelper(obj, texUrl) {\n setTexture(obj.name, texUrl);\n}",
"function createDataTexture(gl, floatArray) {\n var width = floatArray.length / 4, // R,G,B,A\n height = 1,\n texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texImage2D(gl.TEXTURE_2D,\n 0, gl.RGBA, width, height, 0, gl.RGBA, gl.FLOAT, floatArray);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\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 return texture;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the logo with a "home" url based on the root link from the navigation | function setHomeLink(navigationSelector, logoSelector) {
var $nav = $(navigationSelector),
$logo = $(logoSelector);
//Expect to update only a single logo
if($nav !== undefined &&
$nav.length === 1 &&
$logo !== undefined &&
$logo.length === 1 &&
!$($logo)[0].hasAttribute(DATA_PROCESSED)) {
//set the logo href attribute based on the root navigation target
$($logo).attr('href', $($nav).attr('href'));
}
} | [
"get homeLink() {\n // if we are on the homepage then load the first item in the manifest and set it active\n if (this.manifest) {\n const firstItem = this.manifest.items.find(\n (i) => typeof i.id !== \"undefined\"\n );\n if (firstItem) {\n return firstItem.slug;\n }\n }\n return \"/\";\n }",
"function addLogoToMenu(logoContent){\r\n var menu_item_number = jQuery(\".menu-with-logo > .main-menu > li\").length;\r\n var middle = Math.round(menu_item_number / 2);\r\n jQuery(\".menu-with-logo > .main-menu > li:nth-child(\" + middle + \")\").after(jQuery('<li class=\"menu-logo\">'+logoContent+'</li>'));\r\n if (typeof logoContent !== 'undefined') {\r\n jQuery(\".ts-sticky-menu .main-menu > li:nth-child(\" + middle + \")\").after(jQuery('<li class=\"menu-logo\">'+logoContent+'</li>'));\r\n }\r\n}",
"function isHome() {\n return \"home\" == gadgets.views.getCurrentView().name_;\n}",
"function atomLogo(s, logo) {\n logo.setPropertyAsAString(\"url\", s.trim());\n}",
"function homeContent() {\n\t$('#main-nav li').removeClass('current');\n\t$('#home-btn').parent().addClass('current');\n\tperformGetRequest(serviceRootUrl + 'page' + pageNO() + videoLibraryCount(), onVideoLibrariesPerPageLoadSuccess, videoLibrariesErrorMessage);\n}",
"function homepageCheck(boolean) {\n if (boolean === true) {\n // show homepage\n $('body').css('background-color', 'black');\n $('body').css('background-image', 'url(\"./assets/images/bg-view.jpeg\")');\n // $('#header-container').css('background-color', 'rgba(53, 59, 72, 0.5)');\n }\n if (boolean === false) {\n // don't render homepage background image\n $('body').css('background-image', 'none');\n $('body').css('background-color', '#0d0d0d');\n $('.cd-intro').css('display', 'none');\n $('#header-container').css('background-color', '#0d0d0d');\n $('.nav-link').css('color', 'white');\n $('.logo-font, .logo-font-with-color').css('color', 'white');\n }\n}",
"function clearHomepage() {\n //TODO Change the homepage from empty context to user defined\n data.getPage(space.homepage.id, function (response) {\n let oldPage = JSON.parse(response);\n\n let updatePage = {\n version: {\n number: oldPage.version.number + 1\n },\n type: \"page\",\n title: oldPage.title,\n body: {\n storage: {\n value: \"\",\n representation: \"storage\"\n }\n }\n };\n data.updatePage(space.homepage.id, updatePage)\n })\n }",
"function clone_logo_header1_res() {\r\n if ($('.item-logo').length) {\r\n var logo_clone = $('header .item-logo span.logo').html();\r\n $('.header-action-res .logo a').append('' + logo_clone + '');\r\n }\r\n }",
"function addMainDashboardLogo(){\n var wrapContainer = jQuery('.wrap');\n wrapContainer = wrapContainer[0];\n var imgDiv = document.createElement(\"DIV\");\n imgDiv.id = 'dashboard_splashHeaderImg';\n wrapContainer.prepend(imgDiv);\n }",
"function getSiteLogoBanda(b) {\n var banda = docXML.getElementsByTagName(\"banda\")[b].getElementsByTagName(\"links\")[0];\n return \"img/\" + banda.getElementsByTagName(\"link\")[2].getAttribute(\"logo\");\n}",
"function renderNavBar()\n{\n\tvar nav = '<li class=\"nav-item\"><a id=\"homeLink\" class=\"nav-link\" href=\"#\">Home</a></li>';\n\n\tif (window.localStorage.apiKey)\n\t{\n\t\tnav += '<li class=\"nav-item\"><a id=\"dashboardLink\" class=\"nav-link\" href=\"#dashboard\">Dashboard</a></li>';\n\t\tnav += '<li class=\"nav-item\"><a id=\"recommendationsLink\" class=\"nav-link\" href=\"#recommendations\">Recommendations</a></li>';\n\t\tnav += '<li class=\"nav-item\"><a id=\"idleInstancesLink\" class=\"nav-link\" href=\"#idleInstances\">Idle instances</a></li>';\n\t\tnav += '<li class=\"nav-item\"><a id=\"allInstancesLink\" class=\"nav-link\" href=\"#allInstances\">All instances</a></li>';\t\t\n\t\tnav += '<li class=\"nav-item\"><a id=\"logoutLink\" class=\"nav-link\" onclick=\"javascript:logout();\">Log out</a></li>';\n\t}\n\telse\n\t{\n\t\tnav += '<li class=\"nav-item\"><a id=\"loginLink\" class=\"nav-link\" href=\"#login\">Log in</a></li>';\n\t}\n\n\tdocument.getElementById('navBar').innerHTML = nav;\n}",
"function OHIFLogo() {\n return (\n <div>\n {/* <Icon name=\"ohif-logo\" className=\"header-logo-image\" /> */}\n\n <img className=\"header-logo-image\" src={process.env.PUBLIC_URL + 'assets/uom.png'} />\n </div>\n );\n}",
"setSiteLogo(logoProperties) {\n return spPost(SPQueryable([this, extractWebUrl(this.toUrl())], \"_api/siteiconmanager/setsitelogo\"), request_builders_body(logoProperties));\n }",
"function setNavigationEndpoints () {\n const previous = document.querySelector('.navbar__link--previous')\n const next = document.querySelector('.navbar__link--next')\n const resume = document.querySelector('.resume__action')\n const go = {}\n\n if (next !== null) {\n go.next = next.href\n } else if (resume && resume.href) {\n go.next = resume.href\n } else {\n go.next = '/introduction/'\n }\n\n if (previous !== null) {\n go.previous = previous.href\n } else if (resume && resume.href) {\n go.previous = resume.href\n } else {\n go.previous = '/introduction/'\n }\n\n go.home = () => {\n window.location.href = '/'\n }\n go.search = () => document.querySelector('.search__input').focus()\n\n return go\n}",
"function load_bind_logo(query, protein) {\n\tvar query = query;\n\n\tvar prot_name = protein;\n\t\n\t$('#binding-site-seq-logos').append(\"<hr>\");\n$('#binding-site-seq-logos').append(\"<h2>\" + prot_name + \" Binding Site Motifs</h2>\");\n\t$.getJSON(web_services_url +'regulation/logos/'+query)\n\t.done(function(data) {\n\t\t\tif ($.isEmptyObject(data)) {\n\t\t//\t//\tconsole.log(\"Empty logo obj\");\n\t\t//\t\thide_nav('binding-site-seq-logos');\n\t\t\t $('#binding-site-seq-logos').append(\"<div><h5>No Binding site logos available.</h5></div>\");\n\n\t\t\t} else {\n\n\t\t\t $('#binding-site-seq-logos').append(\"<div><em> \\\n\tClick on a motif to view <a href='http://yetfasco.ccbr.utoronto.ca' target='_blank'>YeTFaSCo</a> record</em></div>\");\n\t \n\t\t$.each(data, function(index, row) {\n\t\t\tvar img_name = $.trim(row);\n\n\t\t\tvar filename_array = img_name.split(\".\");\n\t\t\tvar link = filename_array[0].split(\"_\");\n\t\t\t\t\n\t\t\tvar url = 'http://yetfasco.ccbr.utoronto.ca/MotViewLong.php?PME_sys_qf2='+ link[1];\n\n//\t\t//\tconsole.log(row + \"* NEW URL: \" + url );\n\t\t\n\t\t\t$('#binding-site-seq-logos').append('<a href=\"' + url + '\" target=\"blank\"><img class=\"yetfasco\" src=\"/regulation/static//imgs/YeTFaSCo_Logos/' + row + '\" alt=\"Binding Site Sequence Logo\"></a>');\n\t\t});\n\t\t\n\t\t$('#binding-site-seq-logos').append(\"<div id='expt-binding-sites'></div>\");\n\n\t\n\t\t$('span#binding-sites-nav').replaceWith(\"<li id='binding-site-seq-logos-li'><a href='#binding-site-seq-logos'>Binding Site Motifs</a></li>\");\n\t } // end else\n\n\t\t\t// console.log(\"check gbrowse: \");\n\t\t\t// $.get(gbrowse_url + display_name + \"_*&enable=SGD PMW motifs\")\n\t\t\t//\t .always(function(data) {\n\t\t\t//\t\t var page_title = data;\n\t \n\t\t\t//\t\t $.each(data, function(key, value) {\n\t\t\t//\t\t\t console.log(\"checking gbrowse: \" + key + \":\" + value);\n\t\t\t//\t })\n\t \n\t\t // var has_gbrowse = _check_gbrowse(display_name);\n\t \n\t\t // console.log(\"has: \");\n\n\t\t //if (_check_gbrowse(display_name) == 1) {\n\t\t\n\t\t $(\"#expt-binding-sites\").append(\"<h4>View predicted binding sites in the <a href='\" + gbrowse_url + display_name + \"_*&enable=SGD PMW motifs' target='_blank'>Genome Browser</a>.</h4>\");\n\t\t // \t}\n\t\t //\t });\n\n\trefresh_scrollspy();\n\t});\n}",
"listenAdminHomeLink() {\n editor.clearMenus();\n editor.showPrimaryMenu();\n event.preventDefault();\n }",
"function ELEMENT_LOGO_BOX$static_(){FavoritesToolbar.ELEMENT_LOGO_BOX=( FavoritesToolbar.BLOCK.createElement(\"logo-box\"));}",
"function updateBuildingPath() {\n\n // clean DOM\n var $breadCrumb = $(\".breadcrumb\").empty();\n\n for (var i = 0; i < navbar.length - 1; i++) {\n $breadCrumb.append(\"<li><a class=\\\"nave\\\" name=\\\"\" + navbar[i] + \"\\\" style=\\\"cursor : pointer;\\\">\" + navbar[i] + \"</a></li>\");\n }\n}",
"getUserLogo() {\n return !_.isEmpty(this.props.auth.getLogo())\n ? this.props.auth.getLogo()\n : defultuser;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
index first by attribute, then by vertex, then by frame | function getIndex(vertex, uv) {
const attributeIndex = floor(frame / 2);
const vertexIndex = vertex;
const frameIndex = frame % 2;
const uvIndex = uv;
return attributeIndex * FRAME_UV_ATTRIBUTE_SIZE_PER_FRAME + vertexIndex * FRAME_UVS_PER_ATTRIBUTE * 2 + frameIndex * FRAME_UVS_PER_ATTRIBUTE + uvIndex;
} | [
"visitIndex_attributes(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function attachVertexHelper(idx)\n{\n\t//var idx = labels.indexOf(INTERSECTED);\n\tvar vertices = planes[idx].geometry.vertices;\n\tfor (var i=0; i<vertices.length; i++){\n\t\t// get the global position\n\t\tvar position = {x: 0, y: 0, z: 0}; \n\t\tposition.x = vertices[i].x + planes[idx].position.x; \n\t\tposition.y = vertices[i].y + planes[idx].position.y; \n\t\tposition.z = vertices[i].z + planes[idx].position.z; \n\n\t\t// create vertexHelpers\n\t\tvertexHelpers.push(addVertexHelper(position));\n\t}\n\n}",
"getIndex(attributeName) {\n const arg = this.args[attributeName];\n return arg ? arg.idx : null;\n }",
"visitBitmap_join_index_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitOid_index_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"get index_attrs(){\n\t\treturn [...module.iter(this)] }",
"_findInIndex(index0, key0, key1, key2, name0, name1, name2, graph, callback, array) {\n let tmp, index1, index2; // Depending on the number of variables, keys or reverse index are faster\n\n const varCount = !key0 + !key1 + !key2,\n entityKeys = varCount > 1 ? Object.keys(this._ids) : this._entities; // If a key is specified, use only that part of index 0.\n\n if (key0) (tmp = index0, index0 = {})[key0] = tmp[key0];\n\n for (const value0 in index0) {\n const entity0 = entityKeys[value0];\n\n if (index1 = index0[value0]) {\n // If a key is specified, use only that part of index 1.\n if (key1) (tmp = index1, index1 = {})[key1] = tmp[key1];\n\n for (const value1 in index1) {\n const entity1 = entityKeys[value1];\n\n if (index2 = index1[value1]) {\n // If a key is specified, use only that part of index 2, if it exists.\n const values = key2 ? key2 in index2 ? [key2] : [] : Object.keys(index2); // Create quads for all items found in index 2.\n\n for (let l = 0; l < values.length; l++) {\n const parts = {\n subject: null,\n predicate: null,\n object: null\n };\n parts[name0] = (0, _N3DataFactory.termFromId)(entity0, this._factory);\n parts[name1] = (0, _N3DataFactory.termFromId)(entity1, this._factory);\n parts[name2] = (0, _N3DataFactory.termFromId)(entityKeys[values[l]], this._factory);\n\n const quad = this._factory.quad(parts.subject, parts.predicate, parts.object, (0, _N3DataFactory.termFromId)(graph, this._factory));\n\n if (array) array.push(quad);else if (callback(quad)) return true;\n }\n }\n }\n }\n }\n\n return array;\n }",
"function getAllSelectedData() {\n const out_vertex_arr = [];\n const out_edge_indexes = [];\n const out_face_indexes = [];\n const selected_data = {\n vertex_arr: out_vertex_arr,\n edge_indexes: out_edge_indexes,\n face_indexes: out_face_indexes\n };\n const select_map = Object.create(null);\n const len = selected_indexes.length;\n for (let i = 0; i < len; ++i) {\n const v_uid = selected_indexes[i];\n const v = working_mesh.getVertex(v_uid);\n select_map[v_uid] = true;\n out_vertex_arr.push({\n uid: v_uid,\n rx: v.rx,\n ry: v.ry,\n dx: v.dx,\n dy: v.dy,\n });\n }\n\n const mesh_details = working_mesh.getCurrentMeshDetails();\n const { edge_indexes, face_indexes } = mesh_details;\n\n for (let i = 0; i < edge_indexes.length; i += 2) {\n const es1 = edge_indexes[i];\n const es2 = edge_indexes[i + 1];\n if (select_map[es1] !== undefined && select_map[es2] !== undefined) {\n out_edge_indexes.push(es1);\n out_edge_indexes.push(es2);\n }\n }\n for (let i = 0; i < face_indexes.length; ++i) {\n const f = face_indexes[i];\n if ( select_map[f.a] !== undefined &&\n select_map[f.b] !== undefined &&\n select_map[f.c] !== undefined ) {\n out_face_indexes.push({\n a: f.a, b: f.b, c: f.c\n });\n }\n }\n\n return selected_data;\n\n }",
"function mapByPolygonVertexToByVertex( data, indices, stride ) {\n\n var tmp = {};\n var res = [];\n var max = 0;\n\n for ( var i = 0; i < indices.length; ++ i ) {\n\n if ( indices[ i ] in tmp ) {\n\n continue;\n\n }\n\n tmp[ indices[ i ] ] = {};\n\n for ( var j = 0; j < stride; ++ j ) {\n\n tmp[ indices[ i ] ][ j ] = data[ i * stride + j ];\n\n }\n\n max = max < indices[ i ] ? indices[ i ] : max;\n\n }\n\n try {\n\n for ( i = 0; i <= max; i ++ ) {\n\n for ( var s = 0; s < stride; s ++ ) {\n\n res.push( tmp[ i ][ s ] );\n\n }\n\n }\n\n } catch ( e ) {\n //console.log( max );\n //console.log( tmp );\n //console.log( i );\n //console.log( e );\n }\n\n return res;\n\n}",
"computeFaces () {\n\n let vertexArr = this.vertexArr;\n\n let indexArr = this.indexArr;\n\n let len = indexArr.length;\n\n // Create the Edge and Face (triangle) arrays\n\n let faceArr = this.faceArr;\n\n // Loop through the indexArr, defining Edges and Faces, hashing back to Vertices.\n\n for ( let i = 0; i < len; i += 3 ) {\n\n const i0 = indexArr[ i ];\n\n const i1 = indexArr[ i + 1 ];\n\n const i2 = indexArr[ i + 2 ];\n\n const fi = i / 3;\n\n // Add 3 computed Edges to a Face, with Edges adding themselves to component Vertices\n\n let face = new Face(\n\n this.computeEdge( i0, i1, i2, fi ),\n\n this.computeEdge( i1, i2, i0, fi ),\n\n this.computeEdge( i2, i0, i1, fi ),\n\n fi\n\n );\n\n // NOTE TO SELF - computeEdge returns the index of the edge in the Edge array\n // Need to connect Face specifically to surrounds\n\n faceArr.push( face ); \n\n }\n\n }",
"visitTable_index_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"IndexIs(vertices, vertex) {\n let index = 0;\n\n while (!(vertex == vertices[index])) index++;\n return index;\n }",
"visitTable_indexed_by_part(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"get index() {\n\n // Check if the face is bound to a mesh and if not throw an error\n if (!this.mesh) throw new Error(`Cannot compute the index - the face is not bound to a Mesh`);\n\n // Return the index of the face in the faces\n return Number(this.mesh.faces.findIndex(face => face.equals(this)));\n }",
"function getPointsInCubeSparse(index, object, grid){\n\t// var points = {\n\t// \tindex : [],\n\t// \tgridIndex: [],\n\t// };\n\tvar points_index = [];\n\tvar vertices = plyParticles.geometry.vertices;\n\tvar bbox = object.geometry.boundingBox;\n\tvar numVertice;\n\n\t// for debugging\n\tlabel_color_list = new Array(vertices.length);\n\n\t// neglect points near the ground\n\tvar z_offset = 0.15;\n\n\t// if not pre-computed subset is given, then iterate through all points\n\tif (!index){\n\t\tnumVertice = vertices.length;\n\t}else{\n\t\tnumVertice = index.length;\n\t}\n\tfor( var v = 0, vl = numVertice; v < vl; v++ ) {\n\t\tvar vind;\n\t\tif (!index){\n\t\t\tvind = v;\n\t\t}else{\n\t\t\tvind = index[v];\n\t\t}\n\t\tvar local_pos = object.worldToLocal(vertices[vind]); \n\n\t\tif (local_pos.x<bbox.max.x && local_pos.x>bbox.min.x &&\n\t\tlocal_pos.y<bbox.max.y && local_pos.y>bbox.min.y &&\n\t\tlocal_pos.z<bbox.max.z && local_pos.z>bbox.min.z + z_offset){\n\t\t\tpoints_index.push(vind);\n\t\t\tlabel_color_list[vind] = new THREE.Color(0.9, 0.1, 0.1);\n\t\t\t// if (!grid) {\n\t\t\t// \tpoints.index.push(vind);\n\t\t\t// \tgridIndex = posToIndex(bbox, local_pos, gridSize);\n\t\t\t// \tpoints.gridIndex.push(gridIndex);\n\t\t\t// }\n\t\t\t// else{\n\t\t\t// \tgridIndex = posToIndex(bbox, local_pos, gridSize);\n\t\t\t// \tif (grid[gridIndex]==1){\n\t\t\t// \t\tpoints.index.push(vind);\n\t\t\t// \t\tpoints.gridIndex.push(gridIndex);\n\t\t\t// \t}\n\t\t\t// }\n\n\t\t}\n\t\telse{\n\t\t\tlabel_color_list[vind] = new THREE.Color(1.0, 1.0, 1.0);\n\t\t}\n\t\t\n\t\tobject.localToWorld(vertices[vind]);\n\t}\n\n\t// shaderMaterial.attributes.cartoonColor.value = label_color_list;\n\t// shaderMaterial.attributes.cartoonColor.needsUpdate = true;\n\n\treturn points_index;\n}",
"function parseVertex(gl, vertexJSON) {\n checkParameter(\"parseVertex\", gl, \"gl\");\n checkParameter(\"parseVertex\", vertexJSON, \"vertexJSON\");\n var shaderProgram = gl.getParameter(gl.CURRENT_PROGRAM);\n if (shaderProgram === null) {\n throw \"Applying vertex attributes with no shader program\";\n }\n var maxAttribute = 0;\n\n for (attribute in vertexJSON) {\n var attributeIndex = maxAttribute++;\n gl.bindAttribLocation(shaderProgram, attributeIndex, attribute);\n var attributeInfo = vertexJSON[attribute];\n var enabled = attributeInfo[\"enabled\"];\n checkParameter(\"parseVertex\", enabled, \"vertexJSON[\" + attribute + \"][enabled]\");\n if (enabled == \"false\") {\n // For disabled, it is the same as uniforms.\n var func = attributeInfo[\"func\"];\n checkParameter(\"parseVertex\", func, \"vertexJSON[\" + attribute + \"][func]\");\n var args = attributeInfo[\"args\"];\n checkParameter(\"parseVertex\", args, \"vertexJSON[\" + attribute + \"][args]\");\n // Find function name and reflect.\n if (func === \"glVertexAttrib1f\") {\n gl.vertexAttrib1f(attributeIndex, args[0]);\n } else if (func === \"glVertexAttrib2f\") {\n gl.vertexAttrib2f(attributeIndex, args[0], args[1]);\n } else if (func === \"glVertexAttrib3f\") {\n gl.vertexAttrib3f(attributeIndex, args[0], args[1], args[2]);\n } else if (func === \"glVertexAttrib4f\") {\n gl.vertexAttrib4f(attributeIndex, args[0], args[1], args[2], args[3]);\n } else if (func === \"glVertexAttrib1fv\") {\n gl.vertexAttrib1fv(attributeIndex, args);\n } else if (func === \"glVertexAttrib2fv\") {\n gl.vertexAttrib2fv(attributeIndex, args);\n } else if (func === \"glVertexAttrib3fv\") {\n gl.vertexAttrib3fv(attributeIndex, args);\n } else if (func === \"glVertexAttrib4fv\") {\n gl.vertexAttrib4fv(attributeIndex, args);\n } else {\n console.log(\"Do not know how to set attribute via function \" + func + \" and args \" + args);\n }\n } else {\n // Otherwise the input comes form the bound buffer.\n var size = attributeInfo[\"size\"];\n checkParameter(\"parseVertex\", size, \"vertexJSON[\" + attribute + \"][size]\");\n var stride = attributeInfo[\"stride\"];\n checkParameter(\"parseVertex\", stride, \"vertexJSON[\" + attribute + \"][stride]\");\n var offset = attributeInfo[\"offset\"];\n checkParameter(\"parseVertex\", offset, \"vertexJSON[\" + attribute + \"][offset]\");\n gl.vertexAttribPointer(attributeIndex, size, gl.FLOAT, false, stride, offset);\n gl.enableVertexAttribArray(attributeIndex);\n }\n }\n}",
"getFrameLayerOrder(frameIndex) {\r\n return [1, 0];\r\n }",
"FindIndexOfFace(color){\n let faceIndex = -1;\n this.faces.forEach((face, index) => {\n if (face.color == color){\n faceIndex = index;\n }\n })\n return faceIndex;\n }",
"visitIndex_expr(ctx) {\n\t return this.visitChildren(ctx);\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clears the edit form. Must call before loading data to form. | clearEditForm() {
let editTitle = document.getElementById('editTitle'),
wysiwyg = h.getEditorWysiwyg();
// Set the edit fields blank
editTitle.value = '';
editContent.value = '';
// Remove the wysiwyg editor
if (!_.isNull(wysiwyg)) {
wysiwyg.remove();
}
} | [
"function clearForm() {\n form.reset();\n }",
"function clear_form(){\n $(form_fields.all).val('');\n }",
"function clearEditFormFields() {\n $(\".edit-form #card-id\").val(\"\");\n $(\".edit-form #card-title\").val(\"\");\n $(\".edit-form #card-body\").val(\"\");\n $(\".edit-form #status\").val($(\".edit-form #status option:first\").val());\n $(\".edit-form #card-assigned\").val(\"\");\n $(\"#card-title-edit\").characterCounter();\n}",
"cleanUpDetailForm(detailEditor) {\n detailEditor.html('');\n }",
"function clearForm(){\n $('#cduForm')[0].reset();\n $( \"#uiuTable tr:gt(0)\").remove();\n uiu=[];\n}",
"function clearDataForm() {\r\r\n $(\"#datInputDateTime\").val(\"\");\r\r\n $(\"#numTotalPeople\").val(\"\");\r\r\n}",
"function cleanForm() {\n\t\t\tvm.srchInputName = \"\";\n\t\t\tvm.srchInputPhone = \"\";\n\t\t\tvm.srchInputAddress = \"\";\n\t\t\tgetContacts();\n\t\t}",
"function resetForm() {\n $leaveComment\n .attr('rows', '1')\n .val('');\n $cancelComment\n .closest('.create-comment')\n .removeClass('focused');\n }",
"function clearFormFields() {\n newTaskNameInput.value = \"\";\n newTaskDescription.value = \"\";\n newTaskAssignedTo.value = \"\";\n newTaskDueDate.value = \"\";\n newTaskStatus.value = \"\";\n}",
"clearValidations() {\n this.validateField(null);\n setProperties(this, {\n '_edited': false,\n 'validationErrorMessages': [],\n validationStateVisible: false\n });\n }",
"function clearOrderForm(){\n $(\"#oi3PriceId\").val(\"\");\n $(\"#oi3SP\").val(\"\");\n $(\"#oi3Price\").html(\"\");\n $(\"#oi3Qty\").val(\"1\");\n $(\"#oi3Cus\").html(\"\");\n $(\"#oi3Remark\").val(\"\");\n $(\"#oi3Total\").html(\"\");\n}",
"clearInputs() {\r\n titleBook.value = '';\r\n authorBook.value = '';\r\n isbnBook.value = ''; \r\n}",
"function clearAndHideForm() {\n clearForm();\n hideForm();\n}",
"function clearModalFields() {\n $(\"#memberNameEdit\").val(\"\");\n $(\"#memberAgeEdit\").val(\"\");\n $(\"#memberGenderEdit\").val(\"\");\n $(\"#memberSkillsEdit\").val(\"\");\n $(\"#editFamilyMemberComplete\").addClass(\"disabled\");\n}",
"function resetForm() {\n setInputs(initial);\n }",
"function clearUserForm() {\n setErrorMessages([])\n setUserData(emptyUserFormData)\n }",
"function f_resetAll(){\n fdoc.find('.spEdit').removeAttr('contenteditable').removeClass('spEdit');\n fdoc.find('.targetOutline').removeAttr('contenteditable').removeClass('targetOutline');\n fdoc.find('#ipkMenu').hide();\n fdoc.find('.ipkMenuCopyAnime').removeClass('ipkMenuCopyAnime');\n $('.sp-show-edit-only-place').css('opacity','0.2');\n f_resetHiddenBox();\n }",
"_onClearButtonClick() {\n this.value = '';\n this._inputValue = '';\n this.validate();\n this.dispatchEvent(new CustomEvent('change', { bubbles: true }));\n }",
"function clear() {\n clearCalculation();\n clearEntry();\n resetVariables();\n operation = null;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the course names of the OUs the user gave | function filterOUs(course) {
if (actionOUs.map(setStrings).indexOf(course.split('-')[0]) != -1) {
actionCourses.push(course);
}
} | [
"getMentorsByCourseTitle(courseName) {\n let mentorsName = [];\n let mentors = this.getMentorList();\n mentors.forEach(mentor => {\n if (mentor.courses.indexOf(courseName) > -1)\n mentorsName.push(mentor.name)\n });\n return mentorsName;\n }",
"static async findCourse(string){\n const result=await pool.query('SELECT *,LOWER(coursename),INSTR(LOWER(coursename),?) FROM course WHERE INSTR(LOWER(coursename),?)>0 ORDER BY INSTR(LOWER(coursename),?);',[string,string,string]);\n return result;\n }",
"function getAllCourses(callback) {\n var url = createUrl(\"core_enrol_get_users_courses\", {\"userid\": getCookieByName(USERID)});\n if (url != null) {\n $.get(url, function (data, status) {\n var courses = [];\n data.forEach(function (item) {\n var course = new Course(item.id, item.fullname);\n courses.push(course);\n // sorts course name alphabetically\n courses.sort(function (a, b) {\n return (a.name > b.name) ? 1 : ((b.name > a.name) ? -1 : 0);\n });\n });\n callback(courses);\n }).fail(function () {\n callback(new Error(\"network error\"));\n });\n }\n else\n callback(new Error(\"invalid session error\"));\n}",
"findStudentCourses(courseArray){\r\n \tlet studentCourseList = [];\r\n \tfor(let courseName of courseArray){\r\n studentCourseList.push(this.courses.get(courseName));\r\n\t\t}\r\n\t\treturn studentCourseList;\r\n\t}",
"function listCourses() {\n gapi.client.classroom.courses.list({\n pageSize: 10\n }).then(function(response) {\n var courses = response.result.courses;\n appendPre('Courses:');\n\n if (courses.length > 0) {\n for (i = 0; i < courses.length; i++) {\n var course = courses[i];\n appendPre(course.name)\n }\n } else {\n appendPre('No courses found.');\n }\n });\n}",
"static async findCollege(string){\n const result=await pool.query('SELECT *,LOWER(collegename),INSTR(LOWER(collegename),?) FROM college WHERE INSTR(LOWER(collegename),?)>0 ORDER BY INSTR(LOWER(collegename),?)',[string,string,string]);\n return result;\n }",
"function createUserNames(accs) {\n accs.forEach(function (acc) {\n acc.username = acc.owner\n .toLocaleLowerCase()\n .split(\" \")\n .map((word) => word[0])\n .join(\"\");\n });\n}",
"list(languageId) {\r\n const path = `courses/${languageId}`;\r\n return this._call(\"get\", path, undefined);\r\n }",
"static async findAvailableCourses(collegeCode){\n const result=await pool.query('SELECT course.coursecode,coursename,coursetag,coursedescription,has.available FROM has,course WHERE has.collegecode=? AND has.coursecode=course.coursecode',collegeCode);\n return result;\n }",
"static async allRemainingCourses(collegeCode){\n const result=await pool.query('SELECT course.coursecode,coursename,coursetag,coursedescription FROM course WHERE course.coursecode NOT IN (SELECT coursecode FROM has WHERE collegecode=?);',collegeCode);\n return result;\n }",
"getCourseIDs(studentID) {\n const courseInstanceDocs = CourseInstances.find({ studentID }).fetch();\n const courseIDs = courseInstanceDocs.map((doc) => doc.courseID);\n return _.uniq(courseIDs);\n }",
"static async findCollegesString(courseCode){\n const result=await pool.query('SELECT college_details(?) AS college_string',courseCode);\n return result[0].college_string;\n }",
"function getFullNames(runners) {\n /* CODE HERE */\n let name = [];\n runners.forEach((index) => {\n name.push(index.last_name + \", \" + index.first_name);\n })\n return name;\n}",
"function getInstructors() {\n\n var elements = document.getElementsByClassName(\"ls-instructors fspmedium\");\n\n for (let item of elements) {\n\n // Finds course title for respective professors\n var courseTitle = item.parentNode.querySelector('.ls-course-title').innerHTML;\n var simpleCourseTitle = courseTitle.toLowerCase().replace(new RegExp(\"\\\\s+\", \"g\"), \"\");\n \n // Finds course section name for respective professors\n var courseSectionName = item.parentNode.querySelector('.ls-section-name').innerHTML.trim().split(\" \");\n var courseAbbr = courseSectionName[0];\n\n //Checks if courseAbbr is a special case\n if (SPECIAL_CASES_ABBR.hasOwnProperty(courseAbbr)) {\n courseAbbr = SPECIAL_CASES_ABBR[courseAbbr];\n }\n\n var courseNum = courseSectionName[1];\n //Checks if courseAbbr is a special case\n if (SPECIAL_CASES_NUMBER.hasOwnProperty(courseNum)) {\n courseAbbr = SPECIAL_CASES_NUMBER[courseNum];\n }\n\n var courseKey = courseAbbr + courseNum + simpleCourseTitle;\n\n // Parses instructor description into multiple professors if possible \n var instructors = $(item).text().trim().replace(new RegExp(\"\\\\s+\", \"g\"), \" \").split(\",\");\n \n for(let name of instructors) {\n \n // Parses professor name into first and last. \n name = name.trim().split(\" \");\n var firstName = name[0];\n var lastName = name[name.length - 1];\n\n // New section for ratings \n $(item).append(\"<div></div>\");\n var children = $(item).children(\"div\");\n var additional = children[children.length - 1];\n\n lookUpInstructor(firstName, lastName, additional, courseKey);\n }\n }\n}",
"function getHaclist4User(user){\n\tvar sql = \"SELECT ih.* FROM info_user iu, info_hac ih, inter_user_hac iuh \" +\n\t\t\"WHERE iu.user_id = iuh.info_user_user_id and ih.hac_id = iuh.info_hac_hac_id \" +\n\t\t\"and ih.state = 1 and ih.activation_code is not NULL and iu.user_name = ?\";\n\tvar hacs = [];\n\texecuteSql(sql, user, \n\t\tfunction(rows){\n\t\t\tif(rows) hacs.push(rows);\n\t\t}, \n\t\tfunction(err){\n\t\t\tconsole.log(\"Error: failed when get HAC list for user \" + user + \", \" + err);\n\t\t}\n\t);\n\treturn hacs;\n}",
"function getTakenCourses() {\n var courseNodes = document.getElementById(\"alreadyTaken\").children;\n var courses = new Array;\n for ( i = 0; i < courseNodes.length; i++) {\n //courses[courseNodes[i].id]=courseNodes[i].innerText;\n courses.push(courseNodes[i].id);\n }\n return courses;\n}",
"function getCollegeNames(){\n return new Promise ((resolve, reject) => {\n //parse colleges.txt\n fs.readFile('./data/college/colleges.txt',{encoding: 'utf8'}, (err,data) => {\n //creates map \n colleges = new Map();\n //obtain college name separated by newlnes\n //college_names contains the name of each college\n college_names = data.split('\\n');\n //for each college name assign it name as key and\n //return college object with name property assigned\n college_names.forEach(name => {\n colleges.set(name, new College(name));\n })\n //resolve or return college map as result\n resolve(colleges)\n })\n })\n}",
"function getUserRooms(user) {\n return users.filter(user => user.usermame === user);\n}",
"async getOuRoot() {\n const d2 = this.props.d2;\n const api = d2.Api.getApi();\n try{\n //get OU tree rootUnit\n let rootLevel = await d2.models.organisationUnits.list({ paging: false, level: 1, fields: 'id,displayName,children::isNotEmpty' });\n if (rootLevel){\n return rootLevel.toArray()[0];\n }\n }\n catch(e){\n console.error('Could not access userGroups from API');\n }\n return undefined;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
addMarker function adds numbered markers on the map with respective to the restaurant found! | function addMarker(rest_add,count){
var address = rest_add;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld='+ (count+1) +'|e74c3c|000000'
});
markers.push(marker);
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
} | [
"static addMarkerForRestaurant(restaurant, map) {\n const marker = new google.maps.Marker({\n position: restaurant.latlng,\n title: restaurant.name,\n url: DBHelper.getRestaurantURL(restaurant),\n map: map,\n animation: google.maps.Animation.DROP}\n );\n return marker;\n }",
"function addRouteMarkers() {\n\n // Add start location\n map.addMarker({\n lat: startLocation[0],\n lng: startLocation[1],\n title: \"Start Location: \" + startLocation[2],\n icon: \"images/start.png\"\n });\n\n // Add end location\n if (endLocation != startLocation) {\n map.addMarker({\n lat: endLocation[0],\n lng: endLocation[1],\n title: \"End Location: \" + endLocation[2],\n icon: \"images/end.png\"\n });\n }\n\n // Add all path markers\n for (var i = 0; i < path.length; i++) {\n map.addMarker({\n lat: path[i][0],\n lng: path[i][1],\n title: path[i][2],\n icon: markers[i],\n infoWindow: {\n content: \"<p>\" + path[i][2] + \"</p><p><input onclick='search([\" + path[i][0] + \",\" + path[i][1] + \"], \\\"\\\")'\" + \" type='button' value='Search Nearby'></p>\" + \n \"<span id='marker' class='delete' onclick='cancelStopMarker(\\\"\" + path[i][2] + \"\\\")'><img src='images/cancel.png' alt='cancel' /></span>\"\n }\n });\n }\n\n fitMap();\n}",
"function addMarker(payload, map) {\n var location = {lat: payload.lat*1, lng: payload.lng*1};\n // Add the marker at the clicked location, and add the next-available label\n // from the array of alphabetical characters.\n var marker;\n var name = payload.name;\n var id = payload.id;\n var autoGen = payload.autoGen;\n\n if (!(id in cars)) {\n cars[id] = {};\n if (autoGen == 0)\n {\n cars[id][\"name\"] = name;\n marker = new MarkerWithLabel({\n map: map,\n draggable: false,\n raiseOnDrag: false,\n labelContent: (autoGen == 1) ? \"\" : name,\n labelAnchor: new google.maps.Point(60, -10),\n labelClass: \"labels\", // the CSS class for the label\n labelStyle: {opacity: 0.8},\n optimized: false,\n });\n }\n else\n {\n marker = new google.maps.Marker({\n position: location,\n map: map,\n title: 'Robo car'\n });\n }\n cars[id][\"marker\"] = marker;\n if (autoGen == 1)\n cars[id][\"marker\"].setIcon(autoCarIcon);\n else\n cars[id][\"marker\"].setIcon(humanCarIcon);\n\n // create an info window, and associate with this marker\n cars[id][\"info\"] = new google.maps.InfoWindow();\n google.maps.event.addListener(marker, 'click', function() {\n cars[id][\"info\"].open(map,marker);\n });\n marker.setAnimation(google.maps.Animation.DROP);\n\n } else {\n marker = cars[id][\"marker\"];\n //marker.setAnimation(google.maps.Animation.BOUNCE);\n }\n // already exists... update it!\n marker.setZIndex(curZIndex++);\n marker.setPosition(location);\n if (marker.getOpacity() == 0) { // i.e. had faded out\n marker.setMap(map);\n }\n // make sure it's fully opaque, and update the timestamp\n marker.setOpacity(1.0);\n cars[id][\"timestamp\"] = Date.now();\n\n // NEW: update teh marker based on fault status\n if (payload.fault == \"OK\") {\n if (autoGen == 1)\n cars[id][\"marker\"].setIcon(autoCarIcon);\n else\n cars[id][\"marker\"].setIcon(humanCarIcon);\n }\n else if (payload.fault == \"Flat Front Tire\" || payload.fault == \"Flat Rear Tire\")\n cars[id][\"marker\"].setIcon(tireFaultIcon);\n else if (payload.fault == \"Light Burnt Out\")\n cars[id][\"marker\"].setIcon(lightFaultIcon);\n else // Engine Trouble\n {\n if (name ==\"TonyZ\") {\n cars[id][\"marker\"].setIcon(tz_engineFaultIcon);\n } else {\n cars[id][\"marker\"].setIcon(engineFaultIcon);\n }\n }\n\n cars[id].fault = payload.fault;\n\n // this builds an HTML string for the popup info window when you click on the marker\n var infoContent = '<p><b>Name:</b> '+name+'<br/>';\n infoContent += '<b>ID:</b> '+id+'<br/>';\n infoContent += '<b>Position:</b> '+location[\"lat\"].toFixed(6)+', '+location[\"lng\"].toFixed(6)+'<br/>';\n // add any other fields in the payload besides name, lat, lng\n for (var key in payload) {\n // skip loop if the property is from prototype\n if (!payload.hasOwnProperty(key)) continue;\n if (key == 'name' || key == 'id' || key == 'lat' || key == 'lng') continue; // skip if one of these\n infoContent += '<b>'+key+':</b> '+payload[key]+'<br/>';\n }\n infoContent += '</p>';\n cars[id][\"info\"].setContent(infoContent);\n\n return marker;\n }",
"function addStadiums() {\n\n var stadiumMarkers = stadiums.map(function(stadium, i){\n \n // Add marker for each stadium\n var marker = new google.maps.Marker({\n map: stadiumMap,\n draggable: false,\n animation: google.maps.Animation.DROP,\n position: stadium.location,\n title: stadium.name,\n icon: 'assets/images/rugby_ball.png'\n });\n\n // Add info bubble\n var infowindow = new google.maps.InfoWindow({\n content: stadium.info,\n maxWidth: 200\n });\n\n // When user clicks on the marker, show info bubble and update hotel map\n marker.addListener('click', function () {\n closeOtherInfo();\n \n // Show the Stadium name bubble\n infowindow.open(stadiumMap, marker);\n otherInfo[0] = infowindow;\n\n // Perform hotel search for this stadium\n updateHotelsMap(i);\n });\n\n return marker;\n });\n\n // Add the markers\n var stadiumMarkerCluster = new MarkerClusterer(stadiumMap, stadiumMarkers,{imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});\n}",
"function addMarkers(map) {\n // create AJAX request\n var xhttp = new XMLHttpRequest();\n\n // define behaviour for a response\n xhttp.onreadystatechange = function() {\n if(this.readyState == 4 && this.status == 200) {\n hotels = JSON.parse(xhttp.responseText);\n for(i=0; i<hotels.length; i++) {\n // convert parts of the hotels address variables and concatenate them\n var address = hotels[i].number + \" \" + hotels[i].street + \", \" + hotels[i].suburb + \", \" + hotels[i].city + \", \" + hotels[i].state + \", \" + hotels[i].country;\n var markerTitle = \"Hotel Name: \" + hotels[i].hotelName + \"\\nPrice: \" + hotels[i].price;\n\n // geocode address variable\n var geocoder = new google.maps.Geocoder();\n geocoder.geocode({\"address\":address}, function(results,status) {\n // if valid location\n if(status = \"OK\") {\n var marker = new google.maps.Marker({\n position: results[0].geometry.location,\n title: markerTitle\n });\n marker.setMap(map)\n }\n });\n }\n } \n }\n\n // initiate connection\n xhttp.open(\"GET\", \"hotels.json\", true);\n\n // send request\n xhttp.send();\n}",
"function add_markers(img_id, lat, lng){\n\t\tvar marker = new google.maps.Marker({\n\t\t\ttitle: \"car\",\n\t\t\ticon: images[img_id]\n\t\t});\n\n\t\tvar latlng = new google.maps.LatLng(lat, lng);\n\t\tmarker.setPosition(latlng);\n\t\tmarker.setMap($scope.map);\n\n\t\tmarkers.push(marker);\t\t\t\n\t}",
"function createPokemonMarkers(pokemon){\n pokemon.forEach((element)=>{\n let position = generateRandomLatLng(displayMap)\n let pokemonIcon = L.icon({\n iconUrl: `https://pokeres.bastionbot.org/images/pokemon/${element.id}.png`,\n iconSize: [40, 60],\n iconAnchor: [22, 94],\n popupAnchor: [12,90]\n }) \n let m = L.marker(position,{ icon: pokemonIcon }).bindPopup(`<div class=\"pokemon-details bg-dark\" style=\"display:flex;flex-direction:row;\" >\n <div class=\"pokemon-image col-sm-6\">\n <img src='https://pokeres.bastionbot.org/images/pokemon/${element.id}.png' style=\"display:flex;justify-content:center;width:100%;height:80%;max-width:100%;\">\n </div>\n <div class=\"text-details text-light col-sm-6\" style=\"display:flex;flex-direction:column;\">\n <h5>Name: ${element.name}</h5>\n <h5>ID: ${element.id}</h5>\n <h5>Type: ${element.type}</h5>\n <h5>Abilities: ${element.abilities}</h5>\n </div>\n </div>`);\n m.pokemon = element;\n m.addTo(displayMap);\n pokemonMarkers.push(m);\n });\n }",
"function addMarker(map, data) {\n //get the stop data from JSON file\n var infowindow = new google.maps.InfoWindow({});\n //*\n //*\n for (var i = 0, length = data.length; i < length; i++) {\n // var routedata = routedata[i]\n var busdata = data[i];\n // {#Console.log(busdata);#}\n var myLatLng = {lat: parseFloat(busdata.latitude), lng: parseFloat(busdata.longitude)};\n\n\n // console.log(route_data[busdata.actual_stop_id]);\n let serviceRoute = add_service_route(route_data[busdata.actual_stop_id]);\n var icon = {\n url: '../static/img/iconsmarker1.png', // url\n scaledSize: new google.maps.Size(40, 40), // scaled size\n origin: new google.maps.Point(0, 0), // origin\n anchor: new google.maps.Point(0, 0) // anchor\n };\n\n // Creating markers and putting it on the map\n var marker = new google.maps.Marker({\n position: myLatLng,\n map: map,\n icon: icon,\n title: busdata.actual_stop_id + \"\\n\" + busdata.stop_name,\n // content is the stop info\n content: '<div id=\"content' + busdata.actual_stop_id + '\" >' +\n '<div id=stop' + busdata.actual_stop_id + '>' +\n \"<div><img src='../static/img/bus-blue-icon.png' alt='bus-blue-icon' width='12%' height='12%'>\" +\n '<h6 style=\"margin-left: 15%; font-family:Tangerine; font-size:15px;\">Stop ID: ' + busdata.actual_stop_id + '</h6></div>' +\n '<h style=\"margin-left: 15%; font-family:Tangerine; font-size:15px;\"><b>Stop name:</b><br>' + '<p style=\"margin-left: 8%\">' + busdata.stop_name + '</p></h>' +\n\n '<h style=\"margin-left: 15%; font-family:Tangerine; font-size:12px;\"><b>Serving route:</b><br>' + '<ul id=\"myList\">' + serviceRoute + '</ul>' + '</p></div>' +\n\n '<button id=\"realtime\" onclick=\"get_real_time_data(' + busdata.actual_stop_id + ')\">' +\n '<p id=\"realtime_p\" style=\"font-family:Tangerine; font-size:12px;\">Real Time Info</p>' +\n '</button>' +\n '</div>'\n\n\n });\n google.maps.event.addListener(marker, 'click', function () {\n infowindow.setContent('<div class=\"infowin\">' + this.content + '</div>');\n infowindow.open(map, this);\n\n });\n marker.setMap(map);\n }\n\n}",
"function addSingleMaker(){\n\tmarker = new google.maps.Marker({\n\t\tposition:{\n\t\t\tlat: -41.295005,\n\t\t\tlng: 174.78362\n\t\t},\n\t\tmap: map,\n\t\tanimation: google.maps.Animation.DROP,\n\t\ticon: \"images/icon.png\",\n\t\ttitle : \"Yoobee School of Design\",\n\t\tdescription: \"Description for Yoobee School of Design\"\n\t})\n}",
"function addQuakeMarkers(quakes, map) {\n //loop over the quakes array and add a marker for each quake\n var quake;\n\n for (var i = 0; i < quakes.length; i++) {\n quake = quakes[i];\n quake.mapMarker = new google.maps.Marker({\n map : map,\n position : new google.maps.LatLng(quake.location.latitude, quake.location.longitude)\n });\n\n google.maps.event.addListener(quake.mapMarker, \"click\", function() {\n // Automatically close\n if (gov.usgs.iw) {\n gov.usgs.iw.close();\n }\n\n //create an info window with the quake info\n gov.usgs.iw = new google.maps.InfoWindow({\n content : new Date(quake.datetime).toLocaleString() + \": magnitude \" + quake.magnitude + \" at depth of \" + quake.depth + \" meters\"\n });\n\n //open the info window\n gov.usgs.iw.open(map, this);\n });\n }\n}",
"function updateMarkers(jsonData) {\n // For DEMO purpose, randomly generates base employee number for each office\n // let boston = (Math.floor(Math.random() * 10) + 1);\n // let sanfran = (Math.floor(Math.random() * 10) + 1);\n // let orlando = (Math.floor(Math.random() * 10) + 1);\n // let chicago = (Math.floor(Math.random() * 10) + 1);\n\n let boston = 0;\n let sanfran = 0;\n let orlando = 0;\n let chicago = 0;\n\n let marker;\n const labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n let labelIndex = 0;\n\n // Count each office location's number of employees\n jsonData.forEach((employee) => {\n (employee.location === 'Boston') ? boston++ : null;\n (employee.location === 'San Francisco') ? sanfran++ : null;\n (employee.location === 'Chicago') ? chicago++ : null;\n (employee.location === 'Orlando') ? orlando++ : null;\n });\n\n // Markers array\n let markers = [\n ['Boston', boston, 42.3135417, -71.1975856],\n ['Chicago', chicago, 41.8339026, -88.0130316],\n ['SanFrancisco', sanfran, 37.7578149, -122.507812],\n ['Orlando', orlando, 28.4813986, -81.5091802]\n ];\n \n // Place each marker\n for (let i = 0; markers.length > i; i++) {\n let position = new google.maps.LatLng(markers[i][2], markers[i][3]);\n bounds.extend(position);\n\n // Setting each marker location\n marker = new google.maps.Marker({\n position,\n map,\n title: markers[i][0],\n label: labels[labelIndex++ % labels.length]\n }); \n \n // Display employee numbers\n $(`#num-emp-${markers[i][0]}`).text(markers[i][1]); \n\n //Automatically center the map fitting all markers on the screen on resizing window\n $(window).resize(function(){\n map.fitBounds(bounds);\n });\n }\n}",
"function createMarkers(result) {\n // console.log(result); \n for (var i=0; i < result.length; i++) {\n\n var latLng = new google.maps.LatLng (result[i].lot_latitude, result[i].lot_longitude); \n\n var marker = new google.maps.Marker({\n position: myLatlng,\n title: result [i].lot_name,\n customInfo: {\n name: result[i].lot_name,\n address: result[i].lot_address,\n available: result[i].spot_id\n };\n });\n\n// To add the marker to the map, call setMap();\nmarker.setMap(map);\n\ncreateMarkers(result);\n };\n }",
"function placeMarkers() {\n\n //custom image for the marker\n var image = {\n url: 'place_marker.png',\n // This marker is 24 pixels wide by 24 pixels high.\n scaledSize: new google.maps.Size(24, 24),\n // The origin for this image is (0, 0).\n origin: new google.maps.Point(0, 0)\n };\n //Defines the clickable region of the icon (ie not the transparent outer part)\n var shape = {\n coords: [1, 1, 1, 20, 20, 20, 20, 1],\n type: 'poly'\n };\n\n //for each station create the marker on the map and add a listener\n for (var key in Stations) {\n marker = new google.maps.Marker({\n position: Stations[key].position,\n map: map,\n icon: image,\n shape: shape,\n title: Stations[key].name\n });\n marker.addListener('click', function() {\n displaySubwayStation(this);\n });\n\n };\n\n}",
"function addMarker(bus){\n\tvar icon = getIcon(bus);\n\tvar marker = new google.maps.Marker({\n\t position: {\n\t \tlat: bus.attributes.latitude, \n\t \tlng: bus.attributes.longitude\n\t },\n\t map: map,\n\t icon: icon,\n\t id: bus.id\n\t});\n\tmarkers.push(marker);\n}",
"function addMarker(location,array) {\r\n var marker = new google.maps.Marker({\r\n position: location,\r\n map: map\r\n });\r\n array.push(marker);\r\n }",
"newMarker(addressCoord, addressPretty){\n console.log(addressPretty)\n let contentString = `\n <div id=\"content>\n <div id=\"siteNotice\">\n </div>\n <h1 id=\"firstHeading\" class=\"firstHeading\">Current Location:</h1>\n <div id=\"bodyContent\">\n ${addressPretty}\n </div>\n </div>`;\n let infowindow = new google.maps.InfoWindow({\n content: contentString\n });\n this.markerList.push({\n address: addressPretty,\n location: addressCoord,\n infoWindow: infowindow\n });\n this.initMap();\n }",
"function markerMaker(point, icono, name) {\r\n\t\tvar om = L.marker([point.lat, point.lon], {\r\n\t\t\ticon: icono\r\n\t\t}).bindPopup(name);\r\n\r\n\t\treturn om;\r\n\r\n\t}",
"function createMapMarker(placeData) {\n\n\t\t\tplaceData.forEach(function(place) {\n\t\t\t\t// console.log(place);\n\t\t\t\t// The next lines save location data from the search result object to local variables\n\t\t\t\tvar lat = place.geometry.location.lat(); // latitude from the place service\n\t\t\t\tvar lon = place.geometry.location.lng(); // longitude from the place service\n\t\t\t\tvar name = place.name; // name of the place from the place service\n\t\t\t\tvar bounds = window.mapBounds; // current boundaries of the map window\n\t\t\t\t// marker is an object with additional data about the pin for a single location\n\t\t\t\tplace.marker = new google.maps.Marker({\n\t\t\t\t\tmap: map,\n\t\t\t\t\tposition: place.geometry.location,\n\t\t\t\t\ttitle: name\n\t\t\t\t});\n\t\t\t\t// infoWindows are the little helper windows that open when you click\n\t\t\t\t// or hover over a pin on a map. They usually contain more information\n\t\t\t\t// about a location.\n\t\t\t\tplace.infoWindow = new google.maps.InfoWindow({\n\t\t\t\t\tcontent: name\n\t\t\t\t});\n\t\t\t\t// bounds.extend() takes in a map location object\n\t\t\t\tbounds.extend(new google.maps.LatLng(lat, lon));\n\t\t\t\t// fit the map to the new marker\n\t\t\t\tmap.fitBounds(bounds);\n\t\t\t\t// center the map\n\t\t\t\tmap.setCenter(bounds.getCenter());\n\t\t\t});\n\n\t\t\tplaceData.forEach(function(place) {\n\t\t\t\t// add an info window to the markers\n\t\t\t\tgoogle.maps.event.addListener(place.marker, 'click', function() {\n\t\t\t\t\tconsole.log(placeData);\n\t\t\t\t\tplaceData.forEach(function(plc) {\n\t\t\t\t\t\tplc.infoWindow.close();\n\t\t\t\t\t});\n\t\t\t\t\tplace.infoWindow.open(map, place.marker);\n\t\t\t\t});\n\t\t\t});\n\n\t\t}",
"function placeGoodMarkers() {\n\tGOOD_listener = google.maps.event.addListener(map, 'click', function(event) {\n\t\tplaceGoodMarker(event.latLng);\n\t});\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This field contains a patient\'s most recent marital (civil) status. | get maritalStatus() {
return this.__maritalStatus;
} | [
"get maritalStatus () {\n\t\treturn this._maritalStatus;\n\t}",
"get status() {\n if (!this._cancerProgression.value) return null;\n return this._cancerProgression.value.coding[0].displayText.value;\n }",
"get status() {\n this._status = getValue(`cmi.objectives.${this.index}.status`);\n return this._status;\n }",
"get VisibilityMi() {\n return this.visibilityMi;\n }",
"function lastCity() {\n if(listItem[0]){\n let query = buildURL(listItem[0].search)\n searchFunction(query)\n } else {\n let query = buildURL(\"Detroit\");\n searchFunction(query);\n }\n }",
"function calculateTeamMotivation() {\n var i, sumMotivation = 0, activeResources = 0, moral,\n listResources = Variable.findByName(gm, 'resources'), worstMoralValue = 100,\n teamMotivation = Variable.findByName(gm, 'teamMotivation').getInstance(self);\n for (i = 0; i < listResources.items.size(); i++) {\n if (listResources.items.get(i).getInstance(self).getActive() == true) {\n moral = parseInt(listResources.items.get(i).getInstance(self).getMoral());\n sumMotivation += moral;\n activeResources++;\n if (moral < worstMoralValue)\n worstMoralValue = moral;\n }\n }\n teamMotivation.value = Math.round(((Math.round(sumMotivation / activeResources) + worstMoralValue) / 2));\n}",
"function getJiraClosedStatusName() {\n toolsService.fetchIntegrationOfTypeByName('TEST_CASE_MANAGEMENT')\n .then(rs => {\n if (rs.success) {\n const jira = rs.data.find((data) => data.name === 'JIRA');\n const setting = jira.settings.find((setting) => setting.param.name === 'JIRA_CLOSED_STATUS');\n\n if (setting) {\n vm.closedStatusName = setting.value ? setting.value.toUpperCase() : null;\n }\n } else {\n messageService.error(rs.message);\n }\n });\n }",
"function top_personal_balance() {\n var largest_balance = 0;\n for (var i in accounts) {\n if (accounts[i].type === \"personal\") {\n if (accounts[i].amount > largest_balance) {\n largest_balance = accounts[i].amount;\n richest = accounts[i].name;\n }\n }\n }\n console.log(\"Holder of biggest personal balance: \" + richest);\n}",
"get mostActiveUser() {\n let userNames = issues.map(obj => obj.user.login);\n let counters = {};\n userNames.forEach(id => {\n if (!counters.hasOwnProperty(id)) {\n counters[id] = 0;\n };\n counters[id]++;\n });\n let activeUserNames = Object.keys(counters);\n return activeUserNames.reduce((topUserName, userName) => topUserName =\n counters[userName] > counters[topUserName] ? userName : topUserName);\n }",
"function maxIndustryJobs(data) {\n return _.max(industryJobs(data), function (record) {return record.jobs;});\n}",
"get_last_complete_state() {\n //console.log('num states'+this.num_states);\n var last_complete=0;\n for (var idx=1; idx<=this.num_states; idx++) {\n if (this.is_incomplete(idx)) {\n return last_complete;\n }\n last_complete=idx;\n }\n return last_complete;\n }",
"get lastModifiedTime()\n\t{\n\t\t//dump(\"get lastModifiedTime: title:\"+this.title+\", value:\"+this._lastModifiedTime);\n\t\treturn this._lastModifiedTime;\n\t}",
"function getStatus() {\n return __state.activitySubmitted || __state.activityPariallySubmitted;\n }",
"function getMostRecentChiefComplaint(recordData) { \n\n\t\tvar documents = [];\n\t\tvar chiefComplaint;\n\n\t\t// cycle through each result\n\t\t$.each(recordData.RESULTS, function(k, result) {\n\t\t\t// cycle through each clinical event\n\t\t\t$.each(result.CLINICAL_EVENTS, function(k, clinicalEvent) {\n\n\t\t\t\t// cycle through each document\n\t\t\t\t$.each(clinicalEvent.DOCUMENTS, function(k, doc) {\n\t\t\t\t\tchiefComplaint = makeDocument(doc, recordData.PRSNL);\n\t\t\t\t\tif (chiefComplaint) {\n\t\t\t\t\t\tdocuments.push(chiefComplaint);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// cycle through each measurement\n\t\t\t\t$.each(clinicalEvent.MEASUREMENTS, function(k, measurement) {\n\t\t\t\t\tchiefComplaint = makeMeasurement(measurement, recordData.CODES, recordData.PRSNL);\n\t\t\t\t\tif(chiefComplaint) {\n\t\t\t\t\t\tdocuments.push(chiefComplaint);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tvar selectedDoc = false;\n\n\t\t// cycles through all the records, comparing their dates\n\t\t$.each(documents, function(index, doc) {\n\t\t\tif(!selectedDoc || doc.date > selectedDoc.date) {\n\t\t\t\tselectedDoc = doc;\n\t\t\t}\n\t\t});\n\n\t\treturn selectedDoc;\n\t}",
"get maxAge() {\n return this.getNumberAttribute('max_age');\n }",
"constructor() { \n \n LastStatusInfo.initialize(this);\n }",
"get temporalRangeMax() {\n return this.temporalRange[1];\n }",
"get alarmLastAck()\n\t{\n\t\t//dump(\"get alarmLastAck. this._alarmLastAck:\"+this._alarmLastAck+\"\\n\");\n\t\t//dump(\"get alarmLastAck: title:\"+this.title+\", alarmLastAck:\"+this._calEvent.alarmLastAck+\"\\n\");\n\t\treturn this._calEvent.alarmLastAck;\n\t}",
"_lastHeading() {\n const headings = this._allHeadings();\n return headings[headings.length - 1];\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assign a task 'sick' to resource wich have a duration egal to the given duration | function sickenResource(resourceDescriptor, duration) {
var i, resInstance, taskDescriptor,
listAbsences = Variable.findByName(gm, 'absences');
resInstance = resourceDescriptor.getInstance(self);
for (i = 0; i < listAbsences.items.size(); i++) {
if (listAbsences.items.get(i).getInstance(self).getDuration() == duration) {
taskDescriptor = listAbsences.items.get(i);
break;
}
}
if (resInstance) {
resInstance.assign(taskDescriptor.getInstance(self));
}
else {
println('unknow id of resourceDescriptor in function sickenResource');
}
} | [
"function impact(task){\r\n\r\n }",
"function task_cost_calculation(item, key_name, hourly_rate) {\n hourly_rate = hourly_rate || 15\n key_name = key_name || 'duration'\n minutes = parseFloat(item[key_name])\n cost = minutes * (hourly_rate / 60)\n return cost\n}",
"set task (value) {\n if (this._mem.work === undefined) {\n this._mem.work = {};\n }\n this._mem.work.task = value;\n }",
"increaseTime() {\r\n this.duration += 1;\r\n }",
"handleSitClick(e) {\n const newSitTime = this.props.SitTime;\n\n switch (e.target.id) {\n case \"Sit-increment\":\n newSitTime.add(1, 'minutes');\n break;\n case \"Sit-decrement\":\n newSitTime.subtract(1, 'minutes');\n break;\n default:\n break;\n }\n\n\n if (this.props.SitTime.get('minutes') < 0) {\n this.props.SitTime.add(1, 'minutes')\n }\n\n\n this.props.changeSitTime(newSitTime); \n }",
"function assignTaskToBox() {\n let urgency;\n let importance;\n for (i = 0; i < allTasks.length; i++) {\n if (allTasks[i].urgency == null ) urgency = checkUrgency(i);\n else urgency = allTasks[i].urgency;\n\n importance = allTasks[i].importance;\n if (urgency == \"High\" && importance == \"High\") compileTaskMatrixHTML(\"do-blue-box\", i + 1, i, \"Low\");\n else if (urgency == \"High\" && importance == \"Low\") compileTaskMatrixHTML(\"delegate-blue-box\", i + 1, i, \"High\");\n else if (urgency == \"Low\" && importance == \"High\") compileTaskMatrixHTML(\"schedule-blue-box\", i + 1, i, \"Low\");\n else if (urgency == \"Low\" && importance == \"Low\") compileTaskMatrixHTML(\"eliminate-blue-box\", i + 1, i, \"High\");\n assignCategory(allTasks[i].category, i + 1, i);\n }\n}",
"function createTask(task = {}) {\n\tif (task.promise) return task\n\ttask.promise = new Promise((resolve, reject) => {\n\t\ttask.resolvers = {resolve, reject};\n\t});\n\ttask.id = `${Date.now()}-${Math.floor(Math.random() * 100000)}`;\n\treturn task\n}",
"run (start, end, options={}) {\n\n let delay = options.delay || 0; // initial delay\n const duration = options.duration;\n let resolution = options.resolution || beat;\n const tonic = options.tonic || start;\n const mode = options.mode;\n const descending = end < start;\n const res = [];\n let allowableNotes = mode && getNotes(tonic, mode).filter((n) => descending ? n <= start && n >= end : n >= start && n <= end);\n const length = mode && allowableNotes.length || Math.abs(end - start) + 1;\n\n if (duration) {\n resolution = Math.floor(duration / length);\n }\n\n if (duration && resolution*length !== duration) {\n console.warn('Run: Your duration is not divisible by the resolution. Adjusting resolution accordingly');\n }\n\n if (!mode) { \n for (let i = start; descending ? i >= end : i <= end; descending ? i-- : i++) {\n\n res.push({ note: i, duration: resolution, delay });\n delay = 0;\n }\n }\n\n if (mode) { \n for (let i = 0; i < allowableNotes.length; i++) {\n\n res.push({ note: allowableNotes[descending ? length - 1 - i : i], duration: resolution, delay });\n delay = 0;\n }\n }\n\n // add any remainder to the duration of the last note\n if (duration % resolution) {\n res[res.length - 1].duration = res[res.length - 1].duration + duration % resolution;\n }\n\n\n // if there are existing notes. add the run to them!\n this.notes = this.notes.concat(res);\n return this;\n }",
"function duration_from_task_dictionary(item) {\n item_name = item.content\n item_has_time = item_name.indexOf(\"|\") != -1 && item_name.indexOf(\"[\") != -1 && item_name.indexOf(\"]\") != -1\n if (item_has_time) {\n var duration = parseInt(item_name.substring(item_name.lastIndexOf(\"|\") + 1, item_name.lastIndexOf(\"min\")));\n } else {\n duration = 0\n }\n return duration\n}",
"function assignTask(){\n var priority_sheet=SpreadsheetApp.getActiveSpreadsheet().getSheetByName(\"priority_queue\"); \n var all_priority_range = priority_sheet.getDataRange();\n var all_priority_data = all_priority_range.getValues();\n var eventCal=CalendarApp.getCalendarById(\"impanyu@gmail.com\");\n var currentTime=new Date();\n for(i=1;i<all_priority_range.getNumRows();i++){//read all tasks for processing\n var current_row=all_priority_data[i];\n var requested_starting_time=current_row[column_index[\"requested starting time\"]];\n var requested_ending_time=current_row[column_index[\"requested ending time\"]];\n var requested_starting_date=new Date(requested_starting_time);\n if(requested_ending_time && requested_starting_time && currentTime<requested_starting_date) {//find a task need to be registered into calendar\n var task_name=\"\";\n var link=current_row[column_index[\"link\"]];\n var task_info=\"info: \"+current_row[column_index[\"task info\"]];\n if(link) task_info+=\"\\nlink: \"+link;\n if(current_row[column_index[\"task group\"]]) task_name+=current_row[column_index[\"task group\"]]+\" \";\n task_name+=current_row[column_index[\"task name\"]];\n eventCal.createEvent(task_name, requested_starting_time, requested_ending_time,{description:task_info}); \n \n }\n }\n}",
"set duration(val) {\n this.timestamp.end = new Date(this.timestamp.start);\n this.timestamp.end.setHours(this.timestamp.end.getHours()+val);\n }",
"function assignTask(resourceDescriptorId, taskDescriptorId) {\n var i, j, resInstance, taskDescriptor,\n listResources = Variable.findByName(gm, 'resources'),\n listTasks = Variable.findByName(gm, 'tasks');\n //Search resource\n for (i = 0; i < listResources.items.size(); i++) {\n if (resourceDescriptorId == listResources.items.get(i).getId()) {\n resInstance = listResources.items.get(i).getInstance(self);\n }\n }\n if (!resInstance) {\n return;\n }\n //Search task\n for (i = 0; i < listTasks.items.size(); i++) {\n if (taskDescriptorId == listTasks.items.get(i).getId()) {\n taskDescriptor = listTasks.items.get(i);\n }\n //remove old previous assigned task\n for (j = 0; j < resInstance.getAssignments().size(); j++) {\n if (resInstance.getAssignments().get(j).getTaskDescriptorId() == listTasks.items.get(i).getId() && listTasks.items.get(i).getInstance(self).getActive() == true) {\n resInstance.getAssignments().remove(j);\n }\n }\n }\n if (!taskDescriptor) {\n return;\n }\n // assign task to resource\n resInstance.assign(taskDescriptor);\n}",
"updateTask(e) {\n const taskValue = e.target.value;\n const keyForTask = Math.round(Math.random() * Math.floor(999999));\n\n const updatedTask = {};\n \n updatedTask[keyForTask] = taskValue; \n\n this.setState({\n [e.target.name]: updatedTask\n });\n\n }",
"function addTask({ description }) {\n\tconst task = { id: id++, description, done: false };\n\ttasks.push(task);\n\treturn task;\n}",
"function Task (number, taskName, startDate, endDate, progress) {\n\t\tthis.number = number; \n\t\tthis.taskName = taskName; \n\t\tthis.startDate = startDate;\n\t\tthis.endDate = endDate;\n\t\tthis.progress = progress;\n\t\tthis.details = \"Task Details\" + \"\\n\" + \n\t\t\t \"Name: Lorem ipsum dolor sit amet\" + \"\\n\" + \n\t\t\t \"Requestor: consectetur adipiscing elit\" + \"\\n\" + \n\t\t\t \"PersonCommitted: Phasellus suscipit\"+ \"\\n\" + \n\t\t\t \"ResponsibleSubs: enim eu feugiat vulputate\";\n\t}",
"function randomAssigner(unassignedTasks) {\n let shuffledDesigners = shuffleArray(config.designers);\n let numDesigners = shuffledDesigners.length;\n // We will use an interval to control how quickly requests are sent\n // in order to avoid being rate limited. The interval uses the\n // const delay, which determines how long to wait between requests.\n let index = 0;\n let interval = setInterval(function() {\n assignTask(unassignedTasks[index].gid, shuffledDesigners[index % numDesigners]);\n index++;\n if (index >= unassignedTasks.length) {\n clearInterval(interval);\n console.log(\"You've assigned \" + unassignedTasks.length + \" new design requests\");\n }\n }, delay);\n}",
"function set_task_status(task_id, time_done){\n $('#'+task_id).attr('time_done', time_done)\n if (time_done > 0){\n $('#' + task_id).addClass('task-done');\n $('#rm_' + task_id).addClass('hidden');\n $('#checkbox_' + task_id).prop('checked', true)\n }\n else{\n $('#' + task_id).removeClass('task-done');\n $('#rm_' + task_id).removeClass('hidden');\n $('#checkbox_' + task_id).prop('checked', false)\n }\n}",
"function setTempo(newTempo) {\n tempo = newTempo;\n tic = (60 / tempo) / 4; // 16th\n}",
"function appendDuration(selectedTripInfo) {\n\tvar dateHolder = \"01/01/2000\";\n\tfor (trip in selectedTripInfo) {\n\t\tvar departure = dateHolder + selectedTripInfo[trip][\"departureTime\"],\n\t\t\t\tarrival = dateHolder + selectedTripInfo[trip][\"arrivalTime\"];\n\t\tvar duration = moment.utc(moment(arrival,\"DD/MM/YYYY HH:mm:ss\").diff(moment(departure,\"DD/MM/YYYY HH:mm:ss\"))).format(\"HH:mm:ss\");\n\n\t\tif (duration !== \"Invalid date\") {\n\t\t\tselectedTripInfo[trip][\"duration\"] = duration;\n\t\t} else {\n\t\t\tselectedTripInfo[trip][\"duration\"] = \"1:00:00\";\n\t\t}\n\t}\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Register an input with this datepicker. | _registerInput(input) {
if (this._datepickerInput && (typeof ngDevMode === 'undefined' || ngDevMode)) {
throw Error('A MatDatepicker can only be associated with a single input.');
}
this._inputStateChanges.unsubscribe();
this._datepickerInput = input;
this._inputStateChanges =
input.stateChanges.subscribe(() => this._stateChanges.next(undefined));
return this._model;
} | [
"function runDatePickerWidget() {\n var date_input=$('input[name=\"date\"]'); //our date input has the name \"date\"\n var container=$('.bootstrap-iso form').length>0 ? $('.bootstrap-iso form').parent() : \"body\";\n var options={\n format: 'dd/mm/yyyy',\n container: container,\n todayHighlight: true,\n autoclose: true,\n clearBtn: true\n };\n date_input.datepicker(options);\n}",
"set CustomProvidedInput(value) {}",
"function setCurrentDateAsInput() {\r\n var date = new Date();\r\n var month = date.getMonth() + 1;\r\n var day = date.getDate();\r\n var currentDate = (day < 10 ? '0' : '') + day + '.' +\r\n (month < 10 ? '0' : '') + month + '.' +\r\n date.getFullYear();\r\n $(\"#datetime\").val(currentDate);\r\n }",
"set onInputCreated(callback) {\n if (typeof(callback) == 'function') {\n this.callback_on_input_created = callback;\n } else {\n console.error(`${this.logprefix} Error setting onInputCreated callback => the argument is not a function`);\n }\n }",
"function onInput() {\n\t\t\t\tif ( typeof options.input === 'function' ) {\n\t\t\t\t\toptions.input.call( $input, function( params, callback ){\n\t\t\t\t\t\tbuild( params );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}",
"function setDateHandlers(field){\n \n $(field).on({\n \n // On focus...\n \n 'focus': function(event){\n \n // Remove validation\n \n $(this).removeClass('invalid');\n \n // Show date picker if not shown already\n \n if(!$(this).siblings('.date-picker').is(':visible')){\n \n showDatePicker(this);\n \n }\n \n },\n \n // On defocus, validate\n \n 'blur': function(event){\n \n // If valid date, format\n \n if(isValidDate($(this).val())){\n \n let date = new Date($(this).val());\n $(this).val(zeroPad(date.getMonth() + 1, 2) + '/' + zeroPad(date.getDate(), 2) + '/' + date.getFullYear());\n \n }\n \n // Otherwise, make invalid\n \n else if($(this).val().length > 0){\n \n $(this).addClass('invalid');\n \n }\n \n },\n \n // On tab, hide date picker\n \n 'keydown': function(event){\n \n if(event.which == 9){\n \n $(this).siblings('.date-picker').hide();\n \n }\n \n },\n \n // On typing...\n \n 'keyup': function(event){\n \n // Get current cursor position\n \n let cursorPosition = this.selectionStart;\n \n // Remove non-date characters\n \n let value = $(this).val();\n $(this).val(value.replace(/[^0-9\\/]/g, ''));\n \n // If if typed character was removed, adjust cursor position\n \n let startLength = value.length;\n let endLength = $(this).val().length;\n \n if(startLength > endLength){\n \n setCursorPosition(this, cursorPosition - 1);\n \n }\n \n // If valid date, adjust date picker\n \n if(isValidDate($(this).val())){\n \n showDatePicker(this);\n \n }\n \n }\n \n });\n \n}",
"function M_datepicker(dp_date_picker) {\n var dp_origen = document.getElementById(dp_date_picker); //Obtener datepicker.//\n //Obtiene un datepicker y lo inicializa.//\n M.Datepicker.init(dp_origen, opciones_fecha);\n}",
"function enableDatePicker () {\n $('input[data-field-type=date]').datepicker({\n autoclose: true, // close on loast focus\n orientation: 'top auto', // show above the fiels\n todayBtn: 'linked', // show button to return to 'today'\n todayHighlight: true, // highlight current day\n endDate: '+1y', // set max date to +1 year\n startDate: '0d', // set the minimum date to today\n maxViewMode: 'decade' // set maximum zoom out to decades view\n })\n}",
"function setUpInputField() {\n\t$(\"#task_input_field\").keypress(function(event) {\n\t\tif (event.which == 13) {\n\t\t\t$(\"#add_task_button\").click();\n\t\t\treturn false;\n\t\t}\n\t});\n}",
"function pgvar_dtpdfecha_inicial__init(){\n $('#pgvar_dtpdfecha_inicial').datepicker({\n language: \"es\",\n todayBtn: \"linked\",\n format: \"dd/mm/yyyy\",\n multidate: false,\n todayHighlight: true,\n autoclose: true,\n\n }).datepicker(\"setDate\", new Date());\n}",
"function mdl_dtpdguia_fecha_recepcion_editar__init(){\n $(\"#dtpdguia_fecha_recepcion_editar\").datepicker({\n language: \"es\",\n todayBtn: \"linked\",\n format: \"dd/mm/yyyy\",\n multidate: false,\n todayHighlight: true,\n autoclose: true,\n\n }).datepicker(\"setDate\", new Date());\n\n}",
"function addcalendarExtenderToDateInputs () {\n //get and loop all the input[type=date]s in the page that dont have \"haveCal\" class yet\n var dateInputs = document.querySelectorAll('input[type=date]:not(.haveCal)');\n [].forEach.call(dateInputs, function (dateInput) {\n //call calendarExtender function on the input\n new calendarExtender(dateInput);\n //mark that it have calendar\n dateInput.classList.add('haveCal');\n });\n}",
"focusInput() {\n if (this.nameInput) {\n this.nameInput.focus();\n }\n }",
"function setUserInput (gate, state, value) {\n state.inputs[gate.id] = value\n}",
"function updateChosenDate(inputDate){\n setChosenDate(inputDate);\n }",
"function mdl_dtpdguia_fecha_vencimiento_editar__init(){\n $(\"#dtpdguia_fecha_vencimiento_editar\").datepicker({\n language: \"es\",\n todayBtn: \"linked\",\n format: \"dd/mm/yyyy\",\n multidate: false,\n todayHighlight: true,\n autoclose: true,\n\n }).datepicker(\"setDate\", new Date());\n}",
"function dtpdmanifiesto_fecha_salida__init(){\n $('#pgmanifiesto_dtpdmanifiesto_fecha_salida2').datepicker({\n language: \"es\",\n todayBtn: \"linked\",\n format: \"dd/mm/yyyy\",\n multidate: false,\n todayHighlight: true,\n autoclose: true\n\n }).datepicker(\"setDate\", new Date());\n}",
"focusInput(){\n this.amountInput.focus();\n }",
"function changeDay(){\n $(date_picker).val($(this).data('day'));\n}",
"function createDatePicker(controlId, options) {\n var fieldId = jQuery(\"#\" + controlId).closest(\"div[data-role='InputField']\").attr(\"id\");\n jQuery(function () {\n var datePickerControl = jQuery(\"#\" + controlId);\n datePickerControl.datepicker(options);\n datePickerControl.datepicker('option', 'onClose',\n function () {\n getValidationData(jQuery(\"#\" + fieldId)).messagingEnabled = true;\n jQuery(this).trigger(\"focusout\");\n jQuery(this).trigger(\"focus\");\n });\n datePickerControl.datepicker('option', 'beforeShow',\n function () {\n getValidationData(jQuery(\"#\" + fieldId)).messagingEnabled = false;\n });\n\n //KULRICE-7310 can't change only month or year with picker (jquery limitation)\n datePickerControl.datepicker('option', 'onChangeMonthYear',\n function (y, m, i) {\n var d = i.selectedDay;\n jQuery(this).datepicker('setDate', new Date(y, m - 1, d));\n });\n\n //KULRICE-7261 fix date format passed back. jquery expecting mm-dd-yy\n if (options.dateFormat == \"mm-dd-yy\" && datePickerControl[0].getAttribute(\"value\").indexOf(\"/\") != -1) {\n datePickerControl.datepicker('setDate', new Date(datePickerControl[0].getAttribute(\"value\")));\n }\n });\n\n // in order to compensate for jQuery's \"Today\" functionality (which does not actually return the date to the input box), alter the functionality\n jQuery.datepicker._gotoToday = function (id) {\n var target = jQuery(id);\n var inst = this._getInst(target[0]);\n if (this._get(inst, 'gotoCurrent') && inst.currentDay) {\n inst.selectedDay = inst.currentDay;\n inst.drawMonth = inst.selectedMonth = inst.currentMonth;\n inst.drawYear = inst.selectedYear = inst.currentYear;\n }\n else {\n var date = new Date();\n inst.selectedDay = date.getDate();\n inst.drawMonth = inst.selectedMonth = date.getMonth();\n inst.drawYear = inst.selectedYear = date.getFullYear();\n }\n this._notifyChange(inst);\n this._adjustDate(target);\n\n // The following two lines are additions to the original jQuery code\n this._setDateDatepicker(target, new Date());\n this._selectDate(id, this._getDateDatepicker(target));\n }\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders a move on the board for the side that just moved | function renderMove(move, sideJustMoved) {
// extract row and column of move
var row = move.loc.row;
var col = move.loc.col;
// source of image file to show
var imgsrc;
// set image file source according to player that moved
switch (sideJustMoved) {
case board.playersEnum.N:
imgsrc = "blank.png";
break;
case board.playersEnum.X:
imgsrc = "x.png";
break;
case board.playersEnum.O:
imgsrc = "o.png";
break;
default:
alert("ERROR!");
}
// show image frpm source file accordingly
$("#" + row + col).attr("src", imgsrc);
} | [
"moving() {\n\n let divId = this.piece.id\n this.totalMoves++\n\n if (this.totalMoves > 1) {\n this.currentTile++\n }\n\n //If the token hasn't made a full round, do not allow it into a color zone\n if (this.currentTile > TILE_BEFORE_ROLLEROVER && this.totalMoves <= COMPLETE_ROUND_TILE_COUNT) {\n this.currentTile = 1\n }\n\n //If token moved 51 places, it can now enter it's colored zone\n if (this.totalMoves == TILE_BEFORE_ROLLEROVER) {\n this.currentTile = this.zoneTile\n }\n\n //If token reaches winning tile, put it in the center box and set win, if not, play normal\n if (this.currentTile == (this.endTile + 1)) {\n let classOfWin = this.piece.classList[0]\n this.piece.classList.add('win')\n $('#'+divId).detach().appendTo($('#'+classOfWin))\n this.inPlay = false\n message.textContent = 'You got a token to the end!'\n checkWin()\n } else {\n $('#'+divId).detach().appendTo($('.box[data-tile-number=\"'+ this.currentTile +'\"]'))\n }\n }",
"function putChess(e){\n console.log('draw a chess');\n var x = parseInt((e.pageX - cvs.offsetLeft) / GRID_SIZE);\n var y = parseInt((e.pageY - cvs.offsetTop) / GRID_SIZE);\n // only when game start can putchess, otherwise return\n if(checkerBoard[x][y].state){\n return;\n }\n socket.emit('putchess', roomId, x,y);\n console.log(x, y);\n // document.getElementById('tips').innerText = 'Now ' +( turn ==false? 'Black' : 'White') +' Turn!'\n}",
"function mouseAction(event) { \nif((isWhite && whitePly) || (isBlack && !whitePly)) { //check player\n\n if(gameOver) { return; }\n var mouseX = event.clientX / aspectRatio;\n var mouseY = event.clientY / aspectRatio;\n var x = Math.floor(mouseX / squareSize);\n\n var y = Math.floor(mouseY / squareSize);\n if (isBlack) {\n y = 7 - y; //black's board is inverted to have black pieces at the bottom.\n x = 7 - x; // and mirrored\n\n }\n if(event.button === 0) {\n\tif(selectedSquare[0] == -1 || !isPieceSelected || boardArray[y][x] != \" \") {\n\t\tvar piece = boardArray[y][x]\n\t if(piece != \" \" && isTurn(piece)) {\n\t \t\tisPieceSelected = true;\n\t \t\tconsole.log(x);\n\t\t\tconsole.log(y);\n\t\t\tselectedSquare = [y, x];\n\t\t\tdrawPosition();\n\t\t\tlegalMoves = [];\n\t\t\tlegalMoves = findLegalMoves(y, x, true);\n\t\t\t\n\t\t\tdrawPosition();\n\t\t\t\n\t } else {\n \tmoveHandler(x,y);\n \t\n \tisPieceSelected = false;\n \tdrawPosition();\n\t }\n\t\t \n\t \n\t} else {\n\t\tmoveHandler(x, y);\n\t\t\n\t\tisPieceSelected = false;\n\t\tdrawPosition();\n\t\t\n\t}\t\t\t\t\t\t\t \n }\n} else { drawPosition(); }\n}",
"function moveSomething(e) {\n\t\t\tfunction moveLeftRight(xVal){\n\t\t\t\tvar newX = xVal;\n\t\t\t\tboard.player.xPrev = board.player.x;\n\t\t\t\tboard.player.yPrev = board.player.y;\n\t\t\t\tboard.player.x = newX;\n\t\t\t\tboard.player.y = board.player.y;\n\t\t\t\tboard.position[newX][board.player.y] = 4;\n\t\t\t\tboard.position[board.player.xPrev][board.player.yPrev] = 0;\n\t\t\t\tboard.player.erasePrevious();\n\t\t\t\tboard.player.render();\n\t\t\t}\n\t\t\tfunction moveUpDown(yVal){\n\t\t\t\tvar newY = yVal;\n\t\t\t\tboard.player.xPrev = board.player.x;\n\t\t\t\tboard.player.yPrev = board.player.y;\n\t\t\t\tboard.player.x = board.player.x;\n\t\t\t\tboard.player.y = newY;\n\t\t\t\tboard.position[board.player.x][newY] = 4;\n\t\t\t\tboard.position[board.player.xPrev][board.player.yPrev] = 0;\n\t\t\t\tboard.player.erasePrevious();\n\t\t\t\tboard.player.render();\n\t\t\t}\n\t\t\tfunction enemiesMove(){\n\t\t\t\tif (!board.enemy1.enemyDead)\n\t\t\t\t\tenemy1Move.makeMove();\n\t\t\t\tif (!board.enemy2.enemyDead)\n\t\t\t\t\tenemy2Move.makeMove();\n\t\t\t\tif (!board.enemy3.enemyDead)\n\t\t\t\t\tenemy3Move.makeMove();\n\t\t\t}\n\t\t\tfunction checkForWin(){\n\t\t\t\tif (board.enemy1.enemyDead && board.enemy2.enemyDead && board.enemy3.enemyDead){\n\t\t\t\t\tconsole.log(\"You Win!!!!! *airhorn*\" )\n\t\t\t\t\tboard.player.eraseThis();\n\t\t\t\t\t//board.potion1.eraseThis();\n\t\t\t\t\t//board.potion2.eraseThis();\n\t\t\t\t\tctx.beginPath();\n\t\t\t\t\tctx.font = \"128px Georgia\";\n\t\t\t\t\tctx.fillStyle = \"#00F\";\n\t\t\t\t\tctx.fillText(\"You Win!!\", 40, 320);\n\t\t\t}\n\t\t\t}\n\t\t\tfunction restoreHealth(xVal,yVal){\n\t\t\t\tvar x = xVal;\n\t\t\t\tvar y = yVal;\n\t\t\t\tif (board.position[x][y] == 5){\n\t\t\t\t\tboard.player.restoreHealth();\n\t\t\t\t\tif(board.potion1.x == x && board.potion1.y == y)\n\t\t\t\t\t\tboard.potion1.eraseThis()\n\t\t\t\t\telse \n\t\t\t\t\t\tboard.potion2.eraseThis();\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(!board.player.playerDead || board.enemy1.enemyDead && board.enemy2.enemyDead && board.enemy3.enemyDead){\n\t\t\tswitch(e.keyCode) {\n\t\t\t\tcase 37:\n\t\t\t\t\t// left key pressed\n\t\t\t\t\tvar newX = board.player.x - 1;\n\t\t\t\t\tif(board.player.x == 0)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif(board.position[newX][board.player.y] == 0 || board.position[newX][board.player.y] == 5)\n\t\t\t\t\t{\n\t\t\t\t\t\tconsole.log(\"Left was pressed...\\n\");\n\t\t\t\t\t\trestoreHealth(newX,board.player.y);\n\t\t\t\t\t\tmoveLeftRight(newX);\n\t\t\t\t\t\tenemiesMove();\n\t\t\t\t\t}\n\t\t\t\t\telse if(board.position[newX][board.player.y] == 3){\n\t\t\t\t\t\tconsole.log(\"Enemy is taking damage...\");\n\t\t\t\t\t\tif(board.enemy1.x == newX && board.enemy1.y == board.player.y){\n\t\t\t\t\t\t\tboard.enemy1.takeDamage();\n\t\t\t\t\t\t\tif(board.enemy1.enemyDead)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmoveLeftRight(newX);\n\t\t\t\t\t\t\t\tcheckForWin();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(board.enemy2.x == newX && board.enemy2.y == board.player.y){\n\t\t\t\t\t\t\tboard.enemy2.takeDamage();\n\t\t\t\t\t\t\t\tif(board.enemy2.enemyDead)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmoveLeftRight(newX);\n\t\t\t\t\t\t\t\tcheckForWin();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(board.enemy3.x == newX && board.enemy3.y == board.player.y){\n\t\t\t\t\t\t\tboard.enemy3.takeDamage();\n\t\t\t\t\t\t\t\tif(board.enemy3.enemyDead)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmoveLeftRight(newX);\n\t\t\t\t\t\t\t\tcheckForWin();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenemiesMove();\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\tcase 38:\n\t\t\t\t\t// up key \n\t\t\t\t\tvar newY = board.player.y - 1;\n\t\t\t\t\tif(board.player.y == 0)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif(board.position[board.player.x][newY] == 0 || board.position[board.player.x][newY] == 5)\n\t\t\t\t\t{\n\t\t\t\t\t console.log(\"Up was pressed...\\n\");\n\t\t\t\t\t\trestoreHealth(board.player.x,newY);\n\t\t\t\t\t\tmoveUpDown(newY);\n\t\t\t\t\t\tenemiesMove();\n\t\t\t\t\t}\n\t\t\t\t\telse if(board.position[board.player.x][newY] == 3){\n\t\t\t\t\t\tconsole.log(\"Enemy is taking damage...\");\n\t\t\t\t\t\tif(board.enemy1.x == board.player.x && board.enemy1.y == newY){\n\t\t\t\t\t\t\tboard.enemy1.takeDamage();\n\t\t\t\t\t\t\tif(board.enemy1.enemyDead){\n\t\t\t\t\t\t\t\tmoveUpDown(newY);\n\t\t\t\t\t\t\t\tcheckForWin();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(board.enemy2.x == board.player.x && board.enemy2.y == newY){\n\t\t\t\t\t\t\tboard.enemy2.takeDamage();\n\t\t\t\t\t\t\tif(board.enemy2.enemyDead){\n\t\t\t\t\t\t\t\tmoveUpDown(newY);\n\t\t\t\t\t\t\t\tcheckForWin();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(board.enemy3.x == board.player.x && board.enemy3.y == newY){\n\t\t\t\t\t\t\tboard.enemy3.takeDamage();\n\t\t\t\t\t\t\tif(board.enemy3.enemyDead){\n\t\t\t\t\t\t\t\tmoveUpDown(newY);\n\t\t\t\t\t\t\t\tcheckForWin();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenemiesMove();\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 39:\n\t\t\t\t\t// right key pressed\n\t\t\t\t\tvar newX = board.player.x + 1;\n\t\t\t\t\tif(board.player.x == 9)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif(board.position[newX][board.player.y] == 0 || board.position[newX][board.player.y] == 5)\n\t\t\t\t\t{\n\t\t\t\t\t\tconsole.log(\"Right was pressed...\\n\");\n\t\t\t\t\t\trestoreHealth(newX,board.player.y);\n\t\t\t\t\t\tmoveLeftRight(newX);\n\t\t\t\t\t\tenemiesMove();\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\telse if(board.position[newX][board.player.y] == 3){\n\t\t\t\t\t\tconsole.log(\"Enemy is taking damage...\");\n\t\t\t\t\t\t\tif(board.enemy1.x == newX && board.enemy1.y == board.player.y){\n\t\t\t\t\t\t\tboard.enemy1.takeDamage();\n\t\t\t\t\t\t\tif(board.enemy1.enemyDead){\n\t\t\t\t\t\t\t\tmoveLeftRight(newX);\n\t\t\t\t\t\t\t\tcheckForWin();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(board.enemy2.x == newX && board.enemy2.y == board.player.y){\n\t\t\t\t\t\t\tboard.enemy2.takeDamage();\n\t\t\t\t\t\t\t\tif(board.enemy2.enemyDead){\n\t\t\t\t\t\t\t\tmoveLeftRight(newX);\n\t\t\t\t\t\t\t\tcheckForWin();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(board.enemy3.x == newX && board.enemy3.y == board.player.y){\n\t\t\t\t\t\t\tboard.enemy3.takeDamage();\n\t\t\t\t\t\t\t\tif(board.enemy3.enemyDead){\n\t\t\t\t\t\t\t\tmoveLeftRight(newX);\n\t\t\t\t\t\t\t\tcheckForWin();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenemiesMove();\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 40:\n\t\t\t\t\t// down key pressed\n\t\t\t\t\tvar newY = board.player.y + 1;\n\t\t\t\t\tif(board.player.y == 9)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif(board.position[board.player.x][newY] == 0 || board.position[board.player.x][newY] == 5)\n\t\t\t\t\t{\n\t\t\t\t\t\tconsole.log(\"Down was pressed...\\n\");\n\t\t\t\t\t\trestoreHealth(board.player.x,newY);\n\t\t\t\t\t\tmoveUpDown(newY);\n\t\t\t\t\t\tenemiesMove();\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\telse if(board.position[board.player.x][newY] == 3){\n\t\t\t\t\t\tconsole.log(\"Enemy is taking damage...\");\n\t\t\t\t\t\t\tif(board.enemy1.x == board.player.x && board.enemy1.y == newY){\n\t\t\t\t\t\t\tboard.enemy1.takeDamage();\n\t\t\t\t\t\t\tif(board.enemy1.enemyDead){\n\t\t\t\t\t\t\t\tmoveUpDown(newY);\n\t\t\t\t\t\t\t\tcheckForWin();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(board.enemy2.x == board.player.x && board.enemy2.y == newY){\n\t\t\t\t\t\t\tboard.enemy2.takeDamage();\n\t\t\t\t\t\t\tif(board.enemy2.enemyDead){\n\t\t\t\t\t\t\t\tmoveUpDown(newY);\n\t\t\t\t\t\t\t\tcheckForWin();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(board.enemy3.x == board.player.x && board.enemy3.y == newY){\n\t\t\t\t\t\t\tboard.enemy3.takeDamage();\n\t\t\t\t\t\t\tif(board.enemy3.enemyDead){\n\t\t\t\t\t\t\t\tmoveUpDown(newY);\n\t\t\t\t\t\t\t\tcheckForWin();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenemiesMove();\n\t\t\t\t\t}\n\t\t\t\t\tbreak; \n\t\t\t}\n\t\t\t//console.log(\"heres our current player position in moveSomething \"+board.player.x + board.player.y);\n\t\t\t}\t//console.log(\"heres our previous player position in moveSomething \"+board.player.xPrev + board.player.yPrev);\t\t\n\t\t}",
"function drawSquareSideHouse() {\n moveForward(50);\n turnRight(90);\n}",
"function moveRight(){\r\n unDraw();\r\n const isAtRightEdge = current.some(index => (currentPosition + index) % width === (width-1));\r\n if (!isAtRightEdge){\r\n currentPosition +=1;\r\n }\r\n\r\n if(current.some(index => squares[currentPosition + index].classList.contains('taken'))){\r\n currentPosition -=1;\r\n }\r\n draw();\r\n }",
"changeBoard(fromSpace, toSpace){\n let fromIndex; let toIndex\n if (this.direction === 1){\n fromIndex = this.getId(fromSpace); toIndex = this.getId(toSpace)\n } else {\n fromIndex = this.getId(toSpace); toIndex = this.getId(fromSpace)\n }\n let orig_copy = $(\"#\"+fromIndex).children()\n let temp = orig_copy.clone()\n temp.appendTo('body')\n temp.css(\"display\", \"inline-block\")\n if (!$(\"#\"+toIndex).children().is('span')){\n let img_src = $(\"#\"+toIndex).children().prop('src')\n img_src = \".\"+img_src.slice(img_src.length - 11, img_src.length)\n this.takenPieces.push([img_src, this.current, this.direction])\n }\n $(\"#\"+toIndex).empty()\n let new_copy = orig_copy.clone().appendTo(\"#\"+toIndex)\n new_copy.css(\"display\", \"inline-block\")\n let oldOffset = orig_copy.offset()\n $(\"#\"+fromIndex).empty().append(\"<span id='piece'></span>\")\n let newOffset = new_copy.offset()\n for (let i = 0; i < this.takenPieces.length; i++){\n if (this.takenPieces[i][1] === this.current && this.takenPieces[i][2] !== this.direction){\n $(\"#\"+fromIndex).empty().append(`<img id=\"piece\" src=${this.takenPieces[i][0]}></img>`)\n $(\"#\"+fromIndex).css(\"display\", \"inline-block\")\n }\n }\n for (let i = 0; i < this.highlights.length; i++){\n if (this.highlights[i]){\n this.highlights[i].attr(\"class\").includes(\"dark\") ? this.highlights[i].css(\"border\", \"solid medium darkgrey\") : this.highlights[i].css(\"border\", \"solid medium lightgrey\")\n }\n }\n this.highlights[1] = $(\"#\"+fromIndex); this.highlights[2] = $(\"#\"+toIndex)\n $(\"#\"+fromIndex).css(\"border\", \"medium solid green\")\n $(\"#\"+toIndex).css(\"border\", \"medium solid green\")\n if (this.moves[this.current][\"special_square\"]){\n let special_square = [this.moves[this.current][\"special_square\"][\"row\"], this.moves[this.current][\"special_square\"][\"col\"]]\n $(\"#\"+this.getId(special_square)).css(\"border\", \"medium solid red\")\n this.highlights[0] = $(\"#\"+this.getId(special_square))\n }\n temp\n .css('position', 'absolute')\n .css('left', oldOffset.left)\n .css('top', oldOffset.top)\n .css('zIndex', 1000)\n .css(\"display\", \"inline\")\n .css(\"width\", \"25px\")\n .css(\"height\", \"25px\")\n new_copy.css(\"display\", \"none\")\n temp.animate({'top': newOffset.top, 'left':newOffset.left}, this.delay, function(){\n new_copy.css(\"display\", \"inline-block\")\n temp.remove()\n })\n }",
"function moveForward(marsRover){ // moving depending on the position with x and y\n console.log(\"moveForward was called\");\n if (marsRover.x >= 0 && marsRover.x <= 9 && marsRover.y >=0 && marsRover.y <= 9) { // the grid in 10x10\n switch(marsRover.direction) {\n case \"N\":\n marsRover.y -= 1 \n console.log(\"The Rover is positioned at \" + marsRover.x + \" and \" + marsRover.y);\n break;\n case \"E\":\n marsRover.x += 1\n console.log(\"The Rover is positioned at \" + marsRover.x + \" and \" + marsRover.y);\n break;\n case \"S\":\n marsRover.y += 1\n console.log(\"The Rover is positioned at \" + marsRover.x + \" and \" + marsRover.y);\n break;\n case \"W\":\n marsRover.x -= 1\n console.log(\"The Rover is positioned at \" + marsRover.x + \" and \" + marsRover.y);\n break;\n }\n } else {\n console.log(\"Something is wrong!\");\n }\n}",
"move() {\n this.change = this.mouthGap == 0 ? -this.change : this.change;\n this.mouthGap = (this.mouthGap + this.change) % (Math.PI / 4) + Math.PI / 64;\n this.x += this.horizontalVelocity;\n this.y += this.verticalVelocity;\n }",
"moveAround() {\r\n\r\n\r\n }",
"function handleNewMove(data, socket) {\n let gameContainer = document.getElementById(\"enter-game\");\n let boardContainer = document.querySelector(\"section\");\n\n if (data.playerMove !== null) {\n let { xStart, yStart, xEnd, yEnd } = data.playerMove;\n let movedFrom = document.getElementById(`${xStart}${yStart}`);\n let hex = movedFrom.innerHTML;\n movedFrom.innerHTML = null;\n let movedTo = document.getElementById(`${xEnd}${yEnd}`);\n movedTo.innerHTML = hex;\n } else {\n gameContainer.remove();\n\n let app = document.getElementById(\"app\");\n let boardContainer = document.createElement(\"div\");\n boardContainer.setAttribute(\"id\", \"chessboard\");\n app.appendChild(boardContainer);\n\n drawBoard(data.board, boardContainer, getCoordinates);\n\n //render buttons to click to submit move\n handleMoveSubmit(submitMoveHandler);\n handleReset();\n\n function submitMoveHandler(e) {\n let check = document.querySelector(\"input\");\n check = check.checked;\n\n if (playerMove.xEnd && playerMove.yEnd) {\n socket.emit(\"playerMoved\", {\n playerMove: playerMove,\n player1: data.player1,\n player2: data.player2,\n gameId: data.gameId,\n check: check\n });\n playerMove.reset();\n resetPlayerData();\n }\n }\n }\n}",
"function moveDown (){\n\t\tunDraw();\n\t\tcurrentPosition += width;\n\t\tdraw();\n\t\tfreeze();\n\t}",
"function displayMovementSquares(row,column)\n{\n\t\n\tfor(var r = row-1; r < row+2; r++)\n\t{\n\t\tfor(var c = column-1; c < column+2; c++) //lol \"c++\"\n\t\t{\n\t\t\tvar tile = map[r][c];\n\t\t\tvar enemyObject = getEnemyAt(r,c);\n\t\t\tif(tile.type != \"mountains\" && tile.type != \"water\" && (r != row || c != column))\n\t\t\t{\n\t\t\t\tvar movementSquare = new createjs.Shape();\n\t\t\t\tif(enemyObject == null)\n\t\t\t\t{\n\t\t\t\t\tmovementSquare.graphics.beginStroke(\"blue\").drawRect(0, 0, 24, 24);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tmovementSquare.graphics.beginStroke(\"red\").drawRect(0, 0, 24, 24);\n\t\t\t\t}\n\t\t\t\tmovementSquare.x = 24*c;\n\t\t\t\tmovementSquare.y = 50 + 24*r;\n\t\t\t\tmovementSquare.row = r;\n\t\t\t\tmovementSquare.column = c;\n\t\t\t\tmovementSquare.name = \"movementSquare\"+movementSquares.length;\n\t\t\t\tstage.addChild(movementSquare);\n\t\t\t\tmovementSquares.push(movementSquare);\n\t\t\t}\n\t\t}\n\t}\n\tstage.update();\n}",
"function moveAndDraw() {\n\tif (levelScore < 500) {\n\t\tlevelScore = 500;\n\t} else if (levelScore > 500) {\n\t\tlevelScore -= 5;\n\t}\n\tmoveTraffic();\n\t// TODO move peds\n\tdrawNew();\n\tcheckCollisions();\n\tcheckSuccess();\n}",
"direction (width, height, futureLocation, addToCol, addToRow, moveFuture, moveCell, passCondition) {\n // variable of cell ahaid to check for movable cells\n const moveTypeFuture = this.board.getCell(moveFuture)\n\n // returns the location of movable cell\n const moveMoveCell = this.board.getCell(moveCell)\n\n // depending on the condition the move will not be executed\n // the purpose of the pass conditions is to not allow the player to go off the board\n // going off the board causes a hurd of errors\n if (passCondition) {\n // checking for blocked or breakable cells\n // if there are, the movement will not execute\n if (this.checkForBlock(futureLocation)) {\n return\n }\n\n // checks for breakable cells ahead\n // the cell is broken and a move is taken from the player\n if (this.checkForBreak(futureLocation)) {\n this.movesLeft--\n return\n }\n\n // checks for movable cells ahead\n if (this.checkForMove(futureLocation)) {\n // gets the cell id and changes the images on the board to walk\n const isMoveType = this.board.getCell(futureLocation)\n\n // ensures that the cell infront of the movable cell is free\n // if the cell ahead is not free, the movable cell cannot move\n if (moveTypeFuture.getType() === 'walk') {\n isMoveType.assignType('walk')\n isMoveType.createCell('walk')\n\n moveMoveCell.assignType('move')\n moveMoveCell.createCell('move')\n\n this.movesLeft--\n return\n } else {\n return\n }\n }\n\n // checking is the exit is reached and setting true accordingly\n if (this.checkForExit(futureLocation)) {\n this.isPlayerExit = true\n }\n\n // if the player touches a spike, an additional move will be lost\n if (this.checkForSpike(futureLocation)) {\n this.movesLeft--\n }\n\n // if key is aquired, attribute will be set to true\n // the key will disappear\n if (this.checkForKey(futureLocation)) {\n const isKeyType = this.board.getCell(this.gateLocation)\n isKeyType.assignType('walk')\n isKeyType.createCell('walk')\n }\n\n // if no other condition blocks the movement, character will move\n document.getElementById(this.cellName()).src = this.floorImage\n this.col += addToCol\n this.row += addToRow\n\n // changes the current player cell to the player's image\n document.getElementById(this.cellName()).src = this.characterImage\n\n // takes one move from total moves\n this.movesLeft--\n }\n }",
"animate(){\n\t\tthis.boardMatrix.forEach(row =>{\n\t\t\trow.forEach(tile =>{\n\t\t\t\tif(tile.sprite !== null){\n\t\t\t\t\tif(tile.x > tile.sprite.x) {tile.sprite.x += TILE_SIZE / 20; }\n\t\t\t\t\tif(tile.x < tile.sprite.x) {tile.sprite.x -= TILE_SIZE / 20; }\n\t\t\t\t\tif(tile.y > tile.sprite.y) {tile.sprite.y += TILE_SIZE / 20; }\n\t\t\t\t\tif(tile.y < tile.sprite.y) {tile.sprite.y -= TILE_SIZE / 20; }\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\t}",
"undoMove()\r\n {\r\n game.pastBoards.pop();\r\n let lastAnimation = game.pastAnimations.pop();\r\n\r\n\r\n //Restores board \r\n game.board = game.pastBoards[game.pastBoards.length-1];\r\n \r\n //Retrieves information from last move\r\n let pieceName = lastAnimation[0];\r\n let lastPieceMoved = Number(lastAnimation[0].substring(lastAnimation[0].length-1));\r\n let rowDiff = lastAnimation[2];\r\n let colDiff = lastAnimation[1];\r\n\r\n let time;\r\n\r\n if (colDiff != 0) \r\n time = Math.abs(colDiff);\r\n else\r\n time = Math.abs(rowDiff);\r\n\r\n scene.animationTime = time;\r\n\r\n //Creates inverted animation\r\n scene.graph.components[pieceName].animations[0] = new LinearAnimation(scene, time, [[0,0,0], [-colDiff * scene.movValues[0], 0, -rowDiff * scene.movValues[1]]]);\r\n scene.graph.components[pieceName].currentAnimation = 0;\r\n\r\n //Reverts position change from last move and changes player \r\n if (game.color == 'b') \r\n {\r\n let currentRow = game.whitePositions[lastPieceMoved - 1][0];\r\n let currentCol = game.whitePositions[lastPieceMoved - 1][1];\r\n\r\n game.whitePositions[lastPieceMoved - 1] = [currentRow - rowDiff, currentCol - colDiff];\r\n game.color = 'w';\r\n scene.graph.components['color'].textureId = 'whiteText';\r\n }\r\n \r\n else if (game.color == 'w') \r\n {\r\n let currentRow = game.blackPositions[lastPieceMoved - 1][0];\r\n let currentCol = game.blackPositions[lastPieceMoved - 1][1];\r\n\r\n game.blackPositions[lastPieceMoved - 1] = [currentRow - rowDiff, currentCol - colDiff];\r\n game.color = 'b';\r\n scene.graph.components['color'].textureId = 'blackText';\r\n }\r\n\r\n }",
"function render_editor()\n{\n\t// first get the piece to make show up\n\tvar piece = get_selected_piece();\n\n\t// get the pixel width and height to set the canvas\n\t// add space for the extra grid pixels\n\tvar canvas_width = tile_size * piece.width + grid_thickness;\n\tvar canvas_height = tile_size * piece.height + grid_thickness;\n\n\t// and set it, of course\n\teditor_view.width = canvas_width;\n\teditor_view.height = canvas_height;\n\n\t// and then render the dang piece :D\n\tfor (var y = 0; y < piece.height; y++)\n\t{\n\t\tfor (var x = 0; x < piece.width; x++)\n\t\t{\n\t\t\t// render that pixel\n\t\t\trender_pixel(x, y, piece, editor_context);\n\t\t}\t\n\t}\n\n\t// after all that u gotta rerender the selection and pivot to make sure its in front\n\trender_pivot(editor_context);\n\trender_select(editor_context);\n}",
"function show_current_panel() \n {\n var new_left = this.config.panel_config.w * this.curr_position_coor.x,\n new_top = this.config.panel_config.h * this.curr_position_coor.y;\n\n if(new_left > 0) {\n new_left = new_left * -1;\n }\n if(new_top > 0) {\n new_top = new_top * -1;\n }\n\n console.log(\"move to:\", new_left, new_top);\n this.panel_container.style.left = new_left + \"px\";\n this.panel_container.style.top = new_top + \"px\";\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that changes screen to zero | function zero() {
calcScreen.innerText = "0";
} | [
"function clearScreen(){ displayVal.textContent = null}",
"function clearScreen() {\n calculator.displayValue = '0';\n calculator.firstOperand = null;\n calculator.waitForNextOperand = false;\n calculator.operator = null;\n calculator.inBaseTen = true;\n}",
"resetPosition() {\n if (this.hasGoneOffScreen()) {\n this.x = this.canvas.width;\n }\n }",
"function winScreen() {\n\t\n\tPhaser.State.call(this);\n\t\n}",
"function clearScreenDithered() {\r\n //\r\n // set all the attribute values\r\n const attr = makeAttribute(my.ink, my.paper, false)\r\n displayColours.fill(attr)\r\n //\r\n // fill the display with an odd pixel pattern\r\n displayPixels.fill(0b01010101)\r\n //\r\n // fill every other line with an even pixel pattern;\r\n // it is necessary to do this even/odd alternation otherwise\r\n // the pixels will align into lines instead of a checkerboard\r\n for (let i = 0; i < (XMAX * YMAX); i += COLUMNS * 2)\r\n displayPixels.fill(0b10101010, i, i + COLUMNS)\r\n}",
"function setCurPageToZero() {\n document.getElementById('page-location').innerHTML = 0;\n}",
"_resetPosition() {\n this._monitor = this._getMonitor();\n\n this._updateSize();\n\n this._updateAppearancePreferences();\n this._updateBarrier();\n }",
"setFullScreenMode() {\n let viewPort = {};\n viewPort.x = 0;\n viewPort.y = 0;\n viewPort.width = global.screen_width;\n viewPort.height = global.screen_height;\n this.setViewPort(viewPort);\n\n this._screenPosition = GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN;\n }",
"setScreenAngle() {\n this.screenAngle = this.getScreenAngle();\n }",
"reset(){\n\t\tthis.x=1280 + (Math.floor(Math.random()*10)+1)*75;//Start off screen and a multiple of 75 pixels apart, to give different start points\n\t\tthis.y=60 + (Math.floor(Math.random()*10)*44);//Space out in 44 pixel intervals (I can't remember what fraction of the screen height this is)\n\t\tthis.direction=Math.floor(Math.random()*10);//Rotation direction (even clockwise/uneven anti-clockwise)\n\t\tthis.speed=Math.floor(Math.random()*4)+1;//Random speed between 1 and 4 pixels/frame\n\t\tthis.degrees=Math.floor(Math.random()*360);//Random rotation start point\n\t}",
"clear()\n {\n this.framebuffer.bind();\n this.framebuffer.clear();\n }",
"reset(){\n this.setSpeed();\n this.setStartPosition();\n }",
"function _hideEndScreen() {\r\n hideEndScreen();\r\n }",
"setTopHalf() {\n let viewPort = {};\n viewPort.x = 0;\n viewPort.y = 0;\n viewPort.width = global.screen_width;\n viewPort.height = global.screen_height / 2;\n this._setViewPort(viewPort);\n this._screenPosition = GDesktopEnums.MagnifierScreenPosition.TOP_HALF;\n }",
"function startGame() {\r\n startScreen0.style.display = 'none';\r\n startScreen1.style.display = 'none';\r\n startScreen2.style.display = 'none';\r\n startScreen3.style.display = 'none';\r\n startScreen4.style.display = 'none';\r\n startScreen5.style.display = 'none';\r\n singleClickElement.style.display = 'flex';\r\n doubleClickElement.style.display = 'flex';\r\n initialize();\r\n startTimer();\r\n}",
"function changeView() {\n $(\"#titleScreen\").empty();\n $(\"#gameScreen\").show();\n}",
"function updateZeroForcePosition() {\n var pusherY = 362 - visibleNode.height;\n var x = layoutWidth / 2 + (model.pusherPosition - model.position) * MotionConstants.POSITION_SCALE;\n\n //To save processor time, don't update the image if it is too far offscreen\n if ( x > -2000 && x < 2000 ) {\n visibleNode.translate( x - visibleNode.getCenterX(), pusherY - visibleNode.y, true );\n }\n }",
"function GameScreenAssistant() { }",
"onShow() {\n brightness.setValue({\n value: 255,\n });\n brightness.setKeepScreenOn({\n keepScreenOn: true,\n });\n clearInterval(this.testInterval);\n\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets the zoom scale/speed. | setZoomScale(scale_zoom){
this.scale_zoom = scale_zoom;
} | [
"setWheelScale(wheelScale) {\n this.scale_zoomwheel = wheelScale;\n }",
"function setCurrentScale() {\n\t\tFloorPlanService.currentScale = $(FloorPlanService.panzoomSelector).panzoom(\"getMatrix\")[0];\n\t}",
"set scale(newscale)\n\t{\n\t\tthis.myscale.x = newscale;\n\t\tthis.myscale.y = newscale;\n\n\t\tthis.container.style.transform = \"scale(\" + newscale + \",\" + newscale + \")\";\n \n\t\t//get width and height metrics\n\t\tthis.size.x = this.container.getBoundingClientRect().width;\n this.size.y = this.container.getBoundingClientRect().height;\n\n\t\t//adjust z order based on scale\n\t\tthis.container.style.zIndex = (100 * newscale).toString();\n\t}",
"function setZoomLevel(value) {\n if (value && (zoomLevel !== value)) {\n var centerPosition = getCenterPosition();\n \n zoomLevel = value;\n \n // update the rads per pixel to reflect the zoom level change\n radsPerPixel = T5.Geo.radsPerPixel(zoomLevel);\n \n // pan to the new position\n panToPosition(centerPosition);\n\n // trigger the zoom level change\n self.trigger('zoomLevelChange', zoomLevel);\n self.triggerAll('resync', self);\n } // if\n }",
"set zoom(delta) {\n // TODO: limit zoom\n\n if (delta < 0 && this.zoom < 0.05) {\n return null;\n }\n if (delta > 0 && this.zoom > 200) {\n return null;\n }\n\n if (!this.dragEnabled) {\n const oldZoom = this.zoomLevel;\n if (delta !== undefined) {\n this.zoomLevel += this.zoomLevel / (25 / delta);\n }\n\n let currentMousePos = createVector(\n mouseX / oldZoom - this.pos.x,\n mouseY / oldZoom - this.pos.y\n );\n\n let newMousePos = createVector(\n mouseX / this.zoom - this.pos.x,\n mouseY / this.zoom - this.pos.y\n );\n\n this.mouseDelta = currentMousePos.sub(newMousePos);\n\n this.pos = this.pos.sub(this.mouseDelta);\n }\n }",
"function setZoomLevel(value=0){\n map.setZoom(value);\n}",
"set minZoom(value) {\n this._minZoom = value;\n //Update visibility if necessary\n this.updateVisibility();\n }",
"function zoom(newscale, center) { // zoom around center\n\t\tif (newscale.toFixed > 2 && newscale.toFixed(2) < 0.25){\n\t\t\treturn;\n\t\t}\n\t\tvar caX = window['variable' + dynamicVar[pageCanvas]].getWidth()/2;\n\t\tvar caY = window['variable' + dynamicVar[pageCanvas]].getHeight()/2;\n\t\tzoomOrigin = window['variable'+dynamicZoomOrigin[pageCanvas]];\n\t\tlayerOffsetX = window['variable' + dynamiclayerScale[pageCanvas]];\n\t\tlayerScale = window['variable' + dynamiclayerScale[pageCanvas]];\n\t\tlayerOffsetY = window['variable' + dynamiclayerOffsetY[pageCanvas]];\n\t\tif(layerOffsetX!=\"\" && layerScale!=\"\" && newscale==\"\"){\n\t\t\twindow['variable' + dynamicLayer[pageCanvas]].setOffset(layerOffsetX, layerOffsetY);\n\t\t\twindow['variable' + dynamicLayer[pageCanvas]].setScale(layerScale);\n\t\t\treturn;\n\t\t}\t\n var mx = center.x - window['variable' + dynamicLayer[pageCanvas]].getX(),\n my = center.y - window['variable' + dynamicLayer[pageCanvas]].getY(),\n oldscale = window['variable' + dynamicLayer[pageCanvas]].getScaleX();\n\t\tif (newscale.toFixed(2) >0.25 && newscale.toFixed(2) < 2){\t\n\t\t\tzoomOrigin = makePos(mx / oldscale + zoomOrigin.x - mx / newscale, my / oldscale + zoomOrigin.y - my / newscale);\n\n\t\t\twindow['variable' + dynamiclayerScale[pageCanvas]] = newscale;\t// GLOBAL FOR RETURN ZOOM ON fcn drawImage function\n\t\t\twindow['variable' +dynamiclayerOffsetX[pageCanvas]] = zoomOrigin.x; // GLOBAL FOR RETURN ZOOM ON fcn drawImage function\n\t\t\twindow['variable' + dynamiclayerOffsetY[pageCanvas]] = zoomOrigin.y; // GLOBAL FOR RETURN ZOOM ON fcn drawImage function\n\n\t\t\twindow['variable' + dynamicLayer[pageCanvas]].setOffset(caX,caY);\t\n\t\t\twindow['variable' + dynamicLayer[pageCanvas]].setScale(newscale);\n\t\t\tdrawImage(\"zoom\",newscale);\n\t\t}else{ return;}\n }",
"setPanScale(scale_pan){\n this.scale_pan = scale_pan;\n }",
"function updateScale(increment) {\n var ctx = document.getElementById(\"canvas\").getContext(\"2d\");\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n //var viewportScale = document.getElementById(\"scale\").value;\n axes.scale += increment;\n draw();\n}",
"function set_zoom_to_window(video, zoom=true) {\n if(zoom) {\n set_zoom(video,\n window.innerWidth,\n window.innerHeight)\n } else {\n unzoom(video,\n window.innerWidth,\n window.innerHeight)\n }\n}",
"function zoom_on_or_off() {\n if(zoom_should_be_on()) {\n setTimeout(zoom_on, 200)\n } else {\n zoom_off()\n }\n}",
"function setZoomExtent(k) {\n var numOfPoints = currSeries[0].data.length;\n //choose the max among all the series\n for (var i = 1; i < currSeries.length; i++) {\n if (numOfPoints < currSeries[i].data.length) {\n numOfPoints = currSeries[i].data.length;\n }\n }\n if (!k || k > numOfPoints) k = 3;\n zoom.scaleExtent([1, numOfPoints / k]);\n maxScaleExtent = parseInt(numOfPoints / k);\n }",
"request(scale, duration, method, period) {\n let current = this.stage.scale.x;\n let target = scale * this.defaultZoom;\n this.active = {\n startScale: current,\n targetScale: target,\n elapsed: 0,\n duration: duration,\n period: period,\n method: method,\n };\n }",
"function resetScaleTransform() {\n Data.Edit.Transform.Scale = 1;\n updateTransform();\n}",
"function applyZoomStep(step) {\n // Use smaller step sizes when zoomed less than 100%\n if (Data.Zoom.Level < 100) {\n step = step / 4;\n } else if (Data.Zoom.Level === 100) {\n if (step < 0) {\n step = step / 4;\n }\n }\n\n Data.Zoom.Level += step;\n\n if (Data.Zoom.Level > 1000) Data.Zoom.Level = 1000;\n else if (Data.Zoom.Level < 10) Data.Zoom.Level = 10;\n\n Data.Zoom.Trigger = true;\n}",
"function scale_changed() {\n\n var s = document.getElementById(\"scale_input\");\n //alert(\"slider value \" + s.value);\n\n var range = s.value / 100; // .25 - 2\n\n g_config.scale_factor = range;\n\n if (g_enableInstrumentation) {\n alert(\"scale_factor \" + g_config.scale_factor);\n }\n\n updateScaleCSS(g_config.scale_factor);\n\n refreshMode();\n}",
"function gScale(sx,sy,sz) {\r\n modelViewMatrix = mult(modelViewMatrix,scale(sx,sy,sz)) ;\r\n}",
"function zoom() {\n airbnbNodeMap.zoom();\n mapLineGraph.wrangleData_borough();\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Optimize request then send it | _optimize(method, url, data = {}, options = {}) {
if (Is.object(url)) {
options = url;
if (!options.method) {
options.method = method;
}
} else {
options.data = data;
options.url = url;
options.method = method;
}
return this.send(options);
} | [
"sendRequest(request) {\n let requestId = \"R\" + this.nextRequestId++;\n this.responseQueue[requestId] = request;\n\n let query = request.query;\n query.extensions = {requestId: requestId};\n this.connection.sendUTF(JSON.stringify(query));\n }",
"_sendRequestFromQueue () {\n while (this[ _requestQueue ].length > 0) {\n const request = this[ _requestQueue ].shift()\n this._sendRequest(request)\n }\n }",
"addARequestToMempool(request){\r\n let self = this;\r\n\r\n //we use an array to hold the request index in mempool array based on the wallet address\r\n let indexToFind = this.walletList[request.walletAddress];\r\n let validInWalletList = this.validWalletList[request.walletAddress];\r\n\r\n //if user already validated the request sends an error\r\n if(validInWalletList){\r\n throw Boom.badRequest(\"There is a valid signature request already made and verified, you can now add star\");\r\n return;\r\n }\r\n\r\n //if this is the first request\r\n if(indexToFind == null){\r\n //calculates time left\r\n let timeElapse = this.getCurrentTimestamp()-request.requestTimeStamp;\r\n let timeLeft = (this.TimeoutRequestWindowTime/1000)-timeElapse;\r\n request.validationWindow = timeLeft;\r\n\r\n //add the request to the mempool\r\n indexToFind = this.mempool.push(request)-1;\r\n console.log(\"New index added: \"+indexToFind+\" - address: \"+request.walletAddress);\r\n this.walletList[request.walletAddress] = indexToFind;\r\n\r\n //sets a timeout of 5 minutes to remove the request\r\n this.timeoutRequests[request.walletAddress] = setTimeout(function (){self.removeValidationRequest(request.walletAddress)},self.TimeoutRequestWindowTime);\r\n return request; \r\n } else{ //if request is already in memory\r\n //gets the existent request\r\n let existentRequest = this.mempool[indexToFind];\r\n \r\n //calculates time left\r\n existentRequest.requestTimeStamp = this.mempool[indexToFind].requestTimeStamp;\r\n let timeElapse = (this.getCurrentTimestamp())-existentRequest.requestTimeStamp;\r\n let timeLeft = (this.TimeoutRequestWindowTime/1000) - timeElapse;\r\n existentRequest.validationWindow = timeLeft;\r\n\r\n return existentRequest;\r\n }\r\n }",
"function accumData(postData) {\n documents.push(postData)\n if(documents.length == 10000){\n // send array of JSON objects to solr server\n console.log('sending')\n sendData(documents)\n documents = []\n }\n}",
"function worklistrequest(url, sessionTokenID,maskstatus) {\r\n var httpRequest = new XMLHttpRequest();\r\n var _object = {\r\n \"Tid\": Math.floor(Math.random() * 9000) + 1000,\r\n \"SessionTokenId\": sessionTokenID\r\n };\r\n var object = {\r\n QueryWorklistPRReq: _object\r\n };\r\n \r\n\tif(maskstatus){\r\n console.log(maskstatus);\r\n Mask('Please Wait');\r\n\t}\r\n\r\n httpRequest.open('POST', url, true);\r\n httpRequest.setRequestHeader('Content-Type', 'application/json;charset=utf-8');\r\n httpRequest.setRequestHeader('Access-Control-Allow-Origin', '*');\r\n httpRequest.send(JSON.stringify(object));\r\n httpRequest.onreadystatechange = function () {\r\n _oonreadystatechange(httpRequest);\r\n }\r\n var _oonreadystatechange = function (httpRequest, optss) {\r\n if (httpRequest.readyState == '4') {\r\n if (httpRequest.status == '200') {\r\n var data = JSON.parse(httpRequest.responseText);\r\n if (data.QueryWorklistPRApprRes.Status.Code === '200') {\r\n for (var i = 0; i < data.QueryWorklistPRApprRes.PurchaseRequisition.length; i++) {\r\n \r\n var amountWithCurrencyCode = data.QueryWorklistPRApprRes.PurchaseRequisition[i].Amount+\" \"+data.QueryWorklistPRApprRes.PurchaseRequisition[i].CURRENCYCODE;\r\n insertWorklist(\r\n\t\t\t\t\t\ti,\r\n\t\t\t\t\t\tdata.QueryWorklistPRApprRes.PurchaseRequisition.length,\r\n data.QueryWorklistPRApprRes.Tid,\r\n data.QueryWorklistPRApprRes.PurchaseRequisition[i].REQUISITIONHEADERID,\r\n data.QueryWorklistPRApprRes.PurchaseRequisition[i].REQUESTOR,\r\n data.QueryWorklistPRApprRes.PurchaseRequisition[i].NOTIFICATIONID,\r\n data.QueryWorklistPRApprRes.PurchaseRequisition[i].DESCRIPTION,\r\n data.QueryWorklistPRApprRes.PurchaseRequisition[i].APPROVALREQUESTEDDATE,\r\n amountWithCurrencyCode,\r\n data.QueryWorklistPRApprRes.PurchaseRequisition[i].MESSAGENAME,\r\n data.QueryWorklistPRApprRes.PurchaseRequisition[i].APPROVALREQUESTEDBY,\r\n data.QueryWorklistPRApprRes.PurchaseRequisition[i].APPROVEREMPLOYEENUMBER,\r\n data.QueryWorklistPRApprRes.PurchaseRequisition[i].REQUISITIONNUMBER);\r\n }\r\n if(data.QueryWorklistPRApprRes.PurchaseRequisition.length==0){\r\n Unmask();\r\n }\r\n } else if (data.QueryWorklistPRApprRes.Status.Code == '401') //Invalid Session due to session timeout\r\n {\r\n loginService(nameValue, passwordValue, url);\r\n }\r\n }\r\n else{\r\n Ext.Msg.alert('No Connection', 'Please try again later', Ext.emptyFn);\r\n Unmask();\r\n \r\n }\r\n }\r\n };\r\n}",
"function funcionIntermedia(request, response, next){\n console.log('Ejecutado a las : ' +new Date());\n //netx ejecuta lo siguiente que hay en app.get('/concatenado.....')\n next(); //esta siempre es la ultima linea\n}",
"function shortenUrl() {\n var urldata = document.querySelector('#url-field').value;\n var xhr = new XMLHttpRequest();\n\n if(urldata != \"\") { \n toggleSpinner();\n xhr.open(\"POST\",\"/shorten\");\n xhr.send(JSON.stringify({\n url: urldata,\n }));\n xhr.onreadystatechange = function() {\n if(xhr.readyState === 4) {\n toggleSpinner();\n getShortUrl(xhr);\n }\n }\n }\n}",
"function send_the_transaction(tokenBuy,amountBuy,tokenSell,amountSell,address,nonce,expires,v,r,s,type) {\n if (type == \"bid\") {\n var file = 'order_hash_bid.json'\n }\n else if (type == \"ask\") {\n var file = 'order_hash_ask.json'\n }\n else {\n console2.log(\"Error: transaction type is neither bid nor ask\")\n }\n\n\n console2.log(\"Data being sent: \");\n console2.log(\"tokenBuy: \" + tokenBuy);\n console2.log(\"amountBuy: \" + amountBuy);\n console2.log(\"tokenSell: \" + tokenSell);\n console2.log(\"amountSell: \" + amountSell);\n console2.log(\"address: \" + address);\n\n\n\n request({\n method: 'POST',\n url: 'https://api.idex.market/order',\n json: {\n tokenBuy: tokenBuy,\n amountBuy: amountBuy,\n tokenSell: tokenSell,\n amountSell: amountSell,\n address: address,\n nonce: nonce,\n expires: expires,\n v: v,\n r: r,\n s: s\n }\n\n }, function (err, resp, body) {\n console2.log(body);\n if (body.orderHash != undefined) {\n fs.writeFileSync(file, body.orderHash, \"utf8\");\n console2.log(\"Saved hash: \" + body.orderHash);\n console2.log(\"Time: \" + timestamp.timestamp());\n }\n else {\n console2.log(\"Hash is undefined, not saved to hash file.\")\n };\n\n\n })\n\n}",
"function makeRequests () {\n // make a request with valid content\n var input = { \"number1\": 15, \"number2\": 24 };\n var validRequest = JSON.stringify (input);\n postRequest (\"Add 2 numbers\", validRequest);\n\n // make a request with invalid content\n input = { \"number1\": 15, \"number2\": true };\n var invalidRequest = JSON.stringify (input);\n postRequest (\"Add number and boolean\", invalidRequest);\n\n // make a request that will get an invalid result\n input = { \"number1\": 0, \"number2\": 0 };\n var invalidResult = JSON.stringify (input);\n postRequest (\"Add two zeros\", invalidResult);\n}",
"_sendBatch() {\n if (_.isEmpty(this.events)) return;\n\n const events = Object.assign([], this.events);\n const body = JSON.stringify(events);\n const options = {\n url: `${this.endpoint}/${this.dataSet}`,\n headers: {\n 'X-Honeycomb-Team': this.writeKey,\n },\n body,\n };\n request.post(options, (err, response) => {\n if (err) {\n console.log(err);\n }\n\n if (response) {\n console.log(`Received status ${response.statusCode}`);\n }\n });\n }",
"function sendObsels() {\n \n\tport.postMessage({mess:\"sendObseltoKTBs In \" +BaseURI+TraceName});\n port.postMessage({mess:\"sendObseltoKTBs\"+JSON.stringify(obselQueue)});\n obselXhr = new XMLHttpRequest();\n obselXhr.open('POST', BaseURI+TraceName,true);\n //obselXhr.withCredentials = true;\n obselXhr.setRequestHeader('content-type', 'application/json');\n // obselXhr.onerror = function () {\n // port.postMessage({mess:\"error posting obsels: no response\"});\n // obselXhr = null;\n // };\n\n\t\tobselXhr.onreadystatechange = function () {\n\t\t\tport.postMessage({mess:\"IN post:\"+obselXhr.status});\n\t\t\tif (obselXhr.readyState === 4) {\n\t\t\t\tif(obselXhr.status === 201) {\n\t\t\t\t\tport.postMessage({mess:\"ok post:\"+obselXhr.status});\n\t\t\t\t\t//port.postMessage({mess:\"sendObseltoKTBs\"});\n\t\t\t\t\tobselQueue = [];\n\t\t\t\t\tobselXhr = null;\n\n\t\t\t\t} else {\n\t\t\t\t\tport.postMessage({mess:\"error posting obsels to :\"+BaseURI+TraceName});\n\t\t\t\t\tport.postMessage({mess:\"error posting obsels:\"+obselXhr.status});\n\t\t\t\t\tobselXhr = null;\n\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tobselXhr.onerror = function(e) {\n\t\t\tport.postMessage({mess:\"Error Status: \" + e.target.status});\n\t\t};\n obselXhr.send(JSON.stringify(obselQueue));\n\n obselQueue = [];\n port.postMessage({mess:\"After sendObseltoKTBs\"+JSON.stringify(obselQueue)});\n}",
"function sendMobileRequests() {\n console.log('Sending Mobile Requests');\n letters.forEach((l, i) => {\n\n // Fake a random interval, looks more human\n const randomInterval = Math.floor(Math.random() * 2000) + 2000;\n const path = '/search?q=' + l;\n\n setTimeout(() => {\n options.path = path;\n options.headers['User-Agent'] = iPhoneUserAgent;\n https.get(options, (res) => handleRes(res, path));\n }, i * randomInterval);\n });\n}",
"function makePdfRequest(model){\n\nmodel.thyrocareReportUrl=\"https://www.thyrocare.com/APIs/order.svc/JJ0YYAYwNcmnq2vsbb3X6QF1ae@ZIVmdQA9WF1YThw1)S6eHx@lA1hwota9fIXMT/GETREPORTS/\"+model.data.thyrocareLeadId+\"/pdf/\"+model.data.mobile+\"/Myreport\"\n \n var requestParams = {\n url : model.thyrocareReportUrl,\n method : 'GET',\n headers : headers\n }\n \n request(requestParams, function (error, response, body){\n \n if(body){\n \n try{\n body=JSON.parse(body);\n if(!body.error){\n if(body.URL){\n model.thyrocarePdfUrl=body.URL; \n global.emit(\"awsApiSetup\",model)\n model.emit(\"awsService\",model)\n\n }\n else{\n model.info=\"REPORT URL NOT PRESENT\"\n commonVar.add()\n commonVar.check()\n }\n }\n else{\n commonVar.add()\n commonVar.check()\n model.info=body.error\n }\n }\n \n catch(err){\n commonVar.add()\n commonVar.check()\n model.info=err\n }\n }\n else if(error){\n model.info=error;\n commonVar.add()\n commonVar.check()\n }\n else{\n model.info=\"Error while scheduling report : Thyrocare API \"\n commonVar.add()\n commonVar.check()\n }\n if(model.info){\n model.fileName=path.basename(__filename)\n global.emit(\"errorLogsSetup\",model)\n model.emit(\"errorLogs\",model)\n }\n })\n \n \n}",
"function request(opts) { http.request(opts, function(res) { res.pipe(process.stdout) }).end(opts.body || '') }",
"static get TRADING_API_MAX_REQUESTS_PER_SECOND() { return 6 }",
"async getAllRequest (req, res) {\n try {\n const request = await Request.findAll({\n include: [{\n model: Customer,\n include: Table\n }]})\n\n res.send(request)\n } catch (err) {\n res.status(500).send({\n error: 'An error has occured during fetch'\n })\n }\n }",
"function get_tray_info(rid) {\n var url = 'http://foodbot.ordr.in:8000/TextSearch?rid='+rid+'&target=pizza pie';\n request({\n url: url,\n json: true\n }, function (error, response, body) {\n if (!error && response.statusCode === 200) {\n for(var i=0; i<body.length; i++){\n if(body[i].tray){\n tray = body[i].tray;\n price = body[i].price;\n place_pizza_order(rid,tray,price);\n break;\n }\n }\n }\n else{\n console.log(error);\n }\n });\n\n}",
"sendQueuedRequests() {\n this._startTimer();\n }",
"function sendServiceRequest(request,response)\n {\n\n // If the session is not active then\n // Send the api-status as false\n // and set msg as'login_error'\n if(!(request.session.userName))\n { \n var responseToSend={};\n responseToSend.apiStatus=false;\n responseToSend.msg='login_error';\n \n // Append the same to the log file\n fs.appendFile('log',\"\\nAPI:sendServiceRequest\\nOUTPUT:\\n\" ,function()\n {\n fs.appendFile('log',\"response:\"+JSON.stringify(responseToSend)+\"\\n------------------------------------------------------------------------------\",function(){console.log(\"OUTPUT from sendServiceRequest Written to log file\");\n\n // Send the response to the server\n response.send(responseToSend);}); \n });\n }\n else\n {\n // Inserting all the request details into inboxData table \n // Data before sending to the server\n fs.appendFile('log',\"\\n URL :/sendServiceRequest - API NAME :sendServiceRequest METHOD TYPE : POST\"+\"\\nINPUT:\\n\" ,function()\n {\n fs.appendFile('log',\"vendorList:\"+request.body.vendorList+\"\\ndate:\"+request.body.date+\"\\ntime:\"+request.body.time+\"\\nareaPinCode:\"+request.body.areaPinCode+\"\\naddress:\"+request.body.address+\"\\nservice:\"+request.body.service+\"\\narea:\"+request.body.area+\"\\nphoneNumber:\"+request.body.phoneNumber+\"\\naltPhoneNumber:\"+request.body.altPhoneNumber+\"\\ncity:\"+request.body.city+\"\\ndescription:\"+request.body.description,function()\n {\n\n var vendorListOld=[];\n var vendorListNew=[];\n var addressNew=[];\n \n // Prepare the new Address along with the pincode\n addressNew.push({address:request.body.address,areaPinCode:request.body.areaPinCode});\n \n vendorListOld= request.body.vendorList; \n console.log(vendorListOld);\n\n // Prepare the vendorList\n for (var i in vendorListOld)\n {\n // Update the new vendorList with estimatedCost being NULL and bookedByVendor as '0'\n vendorListNew.push({vendorId: vendorListOld[i], estimatedCost: null,bookedByVendor:0,docImage:null});\n }\n \n // Connect to the DB and insert the service request details details\n // Auto generating the transaction-id in mysql\n connection.query(\"INSERT INTO project.inboxData (customerId,service,date,time,status,vendorList,areaPinCode,address,area,phoneNumber,altPhoneNumber,city,description) VALUES ('\"+request.session.userName+\"','\"+request.body.service+\"','\"+request.body.date+\"','\"+request.body.time+\"','SHORT_LISTED','\"+JSON.stringify(vendorListNew)+\"','\"+request.body.areaPinCode+\"','\"+request.body.address+\"','\"+request.body.area+\"','\"+request.body.phoneNumber+\"','\"+request.body.altPhoneNumber+\"','\"+request.body.city+\"','\"+request.body.description+\"');\",function(err, rows,result)\n {\n if(err)\n {\n // If there is an error in DB connection then send false as API status\n console.log(err.message);\n // console.log(vendorList);\n\n // Once the API's details are logged now append the input and output information for the same file\n fs.appendFile('log',\"\\nOUTPUT:\\n\" ,function()\n {\n fs.appendFile('log',\"response:\"+new Boolean(0)+\"\\n------------------------------------------------------------------------------\",function(){console.log(\"OUTPUT from sendServiceRequest Written to log file\");}); \n response.send(new Boolean(0));\n });\n }\n else\n {\n // Update the customer's address\n connection.query(\"UPDATE project.customer SET address=CONCAT(address,'\\,','\"+ JSON.stringify(addressNew)+\"') WHERE mobilenumber='\"+request.session.userName+\"';\",function(err)\n {\n // If there is an error in inserting send false as the API status\n if(err)\n {\n // If there is an error in DB connection then send false as API status\n console.log(err.message);\n // Once the API's details are logged now append the input and output information for the same file\n fs.appendFile('log',\"\\nOUTPUT:\\n\" ,function()\n {\n fs.appendFile('log',\"response:\"+new Boolean(0)+\"\\n------------------------------------------------------------------------------\",function(){console.log(\"OUTPUT from sendServiceRequest Written to log file\");}); \n response.send(new Boolean(0));\n });\n }\n else\n {\n // Once the API's details are logged now append the input and output information for the same file\n fs.appendFile('log',\"\\nOUTPUT:\\n\" ,function()\n {\n fs.appendFile('log',\"response:\"+new Boolean(1)+\"\\n------------------------------------------------------------------------------\",function(){console.log(\"OUTPUT from sendServiceRequest Written to log file\");}); \n response.send(new Boolean(1));\n }); \n }\n });\n }\n });\n }); \n });\n }\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.