query
stringlengths
9
14.6k
document
stringlengths
8
5.39M
metadata
dict
negatives
listlengths
0
30
negative_scores
listlengths
0
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
The Constructor is returned by this Immutable function. Callers can then use it to create new instances of objects that they expect to meet the schema, set forth by this Immutable.
function Constructor (values) { var propName, // we return self - it will provide access to the getters and setters self = {}; values = values || {}; if ( // you can override initial validation by setting // `schema.__skipValidation: true` originalSchema.__skipValidation !== true && !Blueprint.validate(blueprint, values).result ) { var err = new InvalidArgumentException( new Error(locale.errors.initialValidationFailed), Blueprint.validate(blueprint, values).errors ); config.onError(err); return err; } try { // Enumerate the schema, and create immutable properties for (propName in schema) { if (!schema.hasOwnProperty(propName)) { continue; } else if (propName === '__blueprintId') { continue; } if (is.nullOrUndefined(values[propName])) { makeReadOnlyNullProperty(self, propName); continue; } makeImmutableProperty(self, schema, values, propName); } Object.freeze(self); } catch (e) { return new InvalidArgumentException(e); } return self; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Immutable (originalSchema) {\n var schema = {}, blueprint, prop, propCtor;\n\n if (!originalSchema) {\n return new InvalidArgumentException(new Error('A schema object, and values are required'));\n }\n\n // Convert any objects that aren't validatable by Blueprint into Immutables\n for (prop in originalSchema) {\n if (!originalSchema.hasOwnProperty(prop)) {\n continue;\n } else if (prop === '__skipValidation') {\n continue;\n } else if (prop === '__skipValdation') {\n schema.__skipValidation = originalSchema.skipValdation;\n }\n\n if (\n is.object(originalSchema[prop]) &&\n !Blueprint.isValidatableProperty(originalSchema[prop]) &&\n !originalSchema[prop].__immutableCtor\n ) {\n schema[prop] = new Immutable(originalSchema[prop]);\n } else {\n schema[prop] = originalSchema[prop];\n }\n\n if (schema[prop].__immutableCtor) {\n // Add access to the Immutable on the Parent Immutable\n propCtor = prop.substring(0,1).toUpperCase() + prop.substring(1);\n Constructor[propCtor] = schema[prop];\n }\n }\n\n // This is the blueprint that the Immutable will be validated against\n blueprint = new Blueprint(schema);\n\n /*\n // The Constructor is returned by this Immutable function. Callers can\n // then use it to create new instances of objects that they expect to\n // meet the schema, set forth by this Immutable.\n */\n function Constructor (values) {\n var propName,\n // we return self - it will provide access to the getters and setters\n self = {};\n\n values = values || {};\n\n if (\n // you can override initial validation by setting\n // `schema.__skipValidation: true`\n originalSchema.__skipValidation !== true &&\n !Blueprint.validate(blueprint, values).result\n ) {\n var err = new InvalidArgumentException(\n new Error(locale.errors.initialValidationFailed),\n Blueprint.validate(blueprint, values).errors\n );\n\n config.onError(err);\n\n return err;\n }\n\n try {\n // Enumerate the schema, and create immutable properties\n for (propName in schema) {\n if (!schema.hasOwnProperty(propName)) {\n continue;\n } else if (propName === '__blueprintId') {\n continue;\n }\n\n if (is.nullOrUndefined(values[propName])) {\n makeReadOnlyNullProperty(self, propName);\n continue;\n }\n\n makeImmutableProperty(self, schema, values, propName);\n }\n\n Object.freeze(self);\n } catch (e) {\n return new InvalidArgumentException(e);\n }\n\n return self;\n } // /Constructor\n\n /*\n // Makes a new Immutable from an existing Immutable, replacing\n // values with the properties in the mergeVals argument\n // @param from: The Immutable to copy\n // @param mergeVals: The new values to overwrite as we copy\n */\n setReadOnlyProp(Constructor, 'merge', function (from, mergeVals, callback) {\n if (typeof callback === 'function') {\n async.runAsync(function () {\n merge(Constructor, from, mergeVals, callback);\n });\n } else {\n var output;\n\n merge(Constructor, from, mergeVals, function (err, merged) {\n output = err || merged;\n });\n\n return output;\n }\n });\n\n /*\n // Copies the values of an Immutable to a plain JS Object\n // @param from: The Immutable to copy\n */\n setReadOnlyProp(Constructor, 'toObject', function (from, callback) {\n return objectHelper.cloneObject(from, true, callback);\n });\n\n /*\n // Validates an instance of an Immutable against it's schema\n // @param instance: The instance that is being validated\n */\n setReadOnlyProp(Constructor, 'validate', function (instance, callback) {\n return Blueprint.validate(blueprint, instance, callback);\n });\n\n /*\n // Validates an instance of an Immutable against it's schema\n // @param instance: The instance that is being validated\n */\n setReadOnlyProp(Constructor, 'validateProperty', function (instance, propertyName, callback) {\n if (!instance && is.function(callback)) {\n callback([locale.errors.validatePropertyInvalidArgs], false);\n } else if (!instance) {\n return {\n errors: [locale.errors.validatePropertyInvalidArgs],\n result: false\n };\n }\n\n return Blueprint.validateProperty(blueprint, propertyName, instance[propertyName], callback);\n });\n\n /*\n // Prints an immutable to the console, in a more readable way\n // @param instance: The Immutable to print\n */\n setReadOnlyProp(Constructor, 'log', function (instance) {\n if (!instance) {\n console.log(null);\n } else {\n console.log(Constructor.toObject(instance));\n }\n });\n\n /*\n // Returns a copy of the original schema\n */\n setReadOnlyProp(Constructor, 'getSchema', function (callback) {\n return objectHelper.cloneObject(originalSchema, true, callback);\n });\n\n /*\n // Returns a this Immutable's blueprint\n */\n setReadOnlyProp(Constructor, 'blueprint', blueprint);\n\n setReadOnlyProp(Constructor, '__immutableCtor', true);\n return Constructor;\n }", "constructor() {\n copy(this, create());\n }", "static create (input) {\n // SCHEMA: this is the ideal place to throw on schema failure\n // const input = this.validate(input, Message.create)\n\n const instance = new this()\n Object.assign(instance, input)\n return instance\n }", "create() {\n return this.new();\n }", "constructor() {\n\n _data.set( this, new Map() );\n _validity.set( this, new Map() );\n\n // Immutable object.\n Object.freeze( this );\n }", "new() {\n let newInstance = Object.create(this);\n\n newInstance.init(...arguments);\n\n return newInstance;\n }", "function Constructor() {}", "function Constructor() {}", "function Constructor() {}", "function makeImmutableProperty (self, schema, values, propName) {\n var Model, dateCopy;\n\n if (schema[propName].__immutableCtor && is.function(schema[propName])) {\n // this is a nested immutable\n Model = schema[propName];\n self[propName] = new Model(values[propName]);\n } else if (isDate(values[propName])) {\n dateCopy = new Date(values[propName]);\n\n Object.defineProperty(self, propName, {\n get: function () {\n return new Date(dateCopy);\n },\n enumerable: true,\n configurable: false\n });\n\n Object.freeze(self[propName]);\n } else {\n objectHelper.setReadOnlyProperty(\n self,\n propName,\n // TODO: is it really necessary to clone the value if it isn't an object?\n objectHelper.copyValue(values[propName]),\n // typeof values[propName] === 'object' ? objectHelper.copyValue(values[propName]) : values[propName],\n makeSetHandler(propName)\n );\n\n if (Array.isArray(values[propName])) {\n Object.freeze(self[propName]);\n }\n }\n }", "create (props) {\n const { clone, dynamic } = props || {}\n Schema.prototype.create.call(this, props)\n setKeyAndName(this, clone, dynamic)\n }", "static create(params) {\n return {type: `${this.prefix}${this.name}`, _instance: new this(params)}; //eslint-disable-line\n }", "constructur() {}", "static create () {}", "constructor() {\n this.initStore(this.constructor.fields());\n this.registerFields();\n }", "clone() {\n\t\tlet data = JSON.parse(JSON.stringify(this.Serialize()));\n\t\treturn new this.constructor(data);\n\t}", "function build() {\n var Constructor, Instance;\n\n Constructor = function() {\n // Initialize a new instance, which won't do nothing but\n // inheriting the prototype.\n var instance = new Instance();\n\n // Apply the initializer on the given instance.\n instance.initialize.apply(instance, arguments);\n\n return instance;\n };\n\n // Define the function that will be used to\n // initialize the instance.\n Instance = function() {};\n Instance.prototype = Constructor.prototype;\n\n // Save some typing and make an alias to the prototype.\n Constructor.fn = Constructor.prototype;\n\n // Define a noop initializer.\n Constructor.fn.initialize = function() {};\n\n return Constructor;\n }", "function build() {\n var Constructor, Instance;\n\n Constructor = function() {\n // Initialize a new instance, which won't do nothing but\n // inheriting the prototype.\n var instance = new Instance();\n\n // Apply the initializer on the given instance.\n instance.initialize.apply( instance, arguments );\n\n return instance;\n };\n\n // Define the function that will be used to\n // initialize the instance.\n Instance = function() {};\n Instance.prototype = Constructor.prototype;\n\n // Save some typing and make an alias to the prototype.\n Constructor.fn = Constructor.prototype;\n\n // Define a noop initializer.\n Constructor.fn.initialize = function() {};\n\n return Constructor;\n }", "function construct() { }", "function Constructor() {\n // All construction is actually done in the init method\n if ( this.initialize )\n this.initialize.apply(this, arguments);\n }", "function Builder() {}", "function Builder() {}", "function build() {\n // Start creating the body of the new Type constructor, first calling super()\n var _ret = buildIdentity.call(this);\n var typeId = _ret.typeId;\n var typeName = _ret.typeName;\n var body =\n '\\tvar opts = options ? options : {};\\n' +\n '\\tthis.constructor.util._extend(this, opts.props);\\n' +\n '\\tthis.constructor.super_.call(this, opts.buffer, opts.offset' +\n (typeId ? '' : ', true') +\n ');\\n';\n // Init fields\n body += _ret.body;\n buildFlags.call(this);\n body += buildSerialize.call(this);\n body += buildDeserialize.call(this);\n // Add to body all the read/write methods\n for (var i = 0; i < this._methods.length; i++) {\n body += this._methods[i];\n }\n if (logger.isDebugEnabled()) {\n logger.debug('Body for %s type constructor:', typeName);\n logger.debug('\\n' + body);\n }\n return createConstructor(body, typeId, typeName);\n}", "function makeImmutableObject(obj) {\n\t if (!globalConfig.use_static) {\n\t addPropertyTo(obj, \"merge\", merge);\n\t addPropertyTo(obj, \"replace\", objectReplace);\n\t addPropertyTo(obj, \"without\", without);\n\t addPropertyTo(obj, \"asMutable\", asMutableObject);\n\t addPropertyTo(obj, \"set\", objectSet);\n\t addPropertyTo(obj, \"setIn\", objectSetIn);\n\t addPropertyTo(obj, \"update\", update);\n\t addPropertyTo(obj, \"updateIn\", updateIn);\n\t addPropertyTo(obj, \"getIn\", getIn);\n\t }\n\n\t return makeImmutable(obj, mutatingObjectMethods);\n\t }", "function makeImmutableObject(obj) {\n\t if (!globalConfig.use_static) {\n\t addPropertyTo(obj, \"merge\", merge);\n\t addPropertyTo(obj, \"replace\", objectReplace);\n\t addPropertyTo(obj, \"without\", without);\n\t addPropertyTo(obj, \"asMutable\", asMutableObject);\n\t addPropertyTo(obj, \"set\", objectSet);\n\t addPropertyTo(obj, \"setIn\", objectSetIn);\n\t addPropertyTo(obj, \"update\", update);\n\t addPropertyTo(obj, \"updateIn\", updateIn);\n\t addPropertyTo(obj, \"getIn\", getIn);\n\t }\n\n\t return makeImmutable(obj, mutatingObjectMethods);\n\t }", "function makeImmutableObject(obj) {\n\t if (!globalConfig.use_static) {\n\t addPropertyTo(obj, \"merge\", merge);\n\t addPropertyTo(obj, \"replace\", objectReplace);\n\t addPropertyTo(obj, \"without\", without);\n\t addPropertyTo(obj, \"asMutable\", asMutableObject);\n\t addPropertyTo(obj, \"set\", objectSet);\n\t addPropertyTo(obj, \"setIn\", objectSetIn);\n\t addPropertyTo(obj, \"update\", update);\n\t addPropertyTo(obj, \"updateIn\", updateIn);\n\t addPropertyTo(obj, \"getIn\", getIn);\n\t }\n\t\n\t return makeImmutable(obj, mutatingObjectMethods);\n\t }", "clone() {\n return new this.constructor(this);\n }", "copy({ type = this.type, value = this.value } = {}) {\n const { id, lbp, rules, unknown, ignored } = this;\n return new this.constructor(id, {\n lbp,\n rules,\n unknown,\n ignored,\n type,\n value,\n original: this,\n });\n }", "function Ctor() {}", "constructor() {\n if (new.target === MatrixBase) {\n throw new TypeError('Cannot construct MatrixBase instances directly');\n }\n }" ]
[ "0.6791926", "0.6657413", "0.6598576", "0.63822585", "0.6093695", "0.60557866", "0.5974791", "0.5974791", "0.5974791", "0.5880356", "0.5854953", "0.58489996", "0.57926", "0.5789543", "0.57499486", "0.5741624", "0.5736388", "0.5665391", "0.5631423", "0.56235254", "0.56166756", "0.56166756", "0.56047165", "0.5564811", "0.5564811", "0.55611134", "0.55455977", "0.55314827", "0.5519729", "0.5516238" ]
0.67129695
1
Immutable / Creates a copy of the value, and creates a readonly property on `self`
function makeImmutableProperty (self, schema, values, propName) { var Model, dateCopy; if (schema[propName].__immutableCtor && is.function(schema[propName])) { // this is a nested immutable Model = schema[propName]; self[propName] = new Model(values[propName]); } else if (isDate(values[propName])) { dateCopy = new Date(values[propName]); Object.defineProperty(self, propName, { get: function () { return new Date(dateCopy); }, enumerable: true, configurable: false }); Object.freeze(self[propName]); } else { objectHelper.setReadOnlyProperty( self, propName, // TODO: is it really necessary to clone the value if it isn't an object? objectHelper.copyValue(values[propName]), // typeof values[propName] === 'object' ? objectHelper.copyValue(values[propName]) : values[propName], makeSetHandler(propName) ); if (Array.isArray(values[propName])) { Object.freeze(self[propName]); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "copyable(newValue = true) {\n this.value.copyable = newValue;\n return this;\n }", "set(value) {\n if (value === this._value) {\n return this;\n }\n\n return new ImmutableAccessor(value, this.path);\n }", "get shallowCopy() {\n return this.shallowCopy$();\n }", "copy() {\n return new this.constructor(\n this.power,\n this.value,\n (this.next != null) ? this.next.copy() : null,\n );\n }", "set(name, value) {\n return this.clone({\n name,\n value,\n op: 's'\n });\n }", "get readonly() { return this._readonly; }", "copy({ type = this.type, value = this.value } = {}) {\n const { id, lbp, rules, unknown, ignored } = this;\n return new this.constructor(id, {\n lbp,\n rules,\n unknown,\n ignored,\n type,\n value,\n original: this,\n });\n }", "copy() {\n return Object.assign(Object.create(this), JSON.parse(JSON.stringify(this)))\n }", "get deepCopy() {\n return this.deepCopy$();\n }", "set(name, value) {\n return this.clone({ name, value, op: 's' });\n }", "set(name, value) {\n return this.clone({ name, value, op: 's' });\n }", "set(name, value) {\n return this.clone({ name, value, op: 's' });\n }", "set(name, value) {\n return this.clone({ name, value, op: 's' });\n }", "set(name, value) {\n return this.clone({ name, value, op: 's' });\n }", "function immutableObjectTest(){\n\nlet test= {'name': 'vishal', 'age':27};\n//Object.freeze(test);\nlet test2= test;\n\ntest.age = 26;\nconsole.log(test);\nconsole.log(test2);\nconsole.log(test === test2);\n\n\n\n\n}", "set(value) {\n this.value = value\n if (this.autoUpdate) {\n this.update()\n }\n return this // chain me up baby\n }", "function Self(value){\n\t\tthis._value = value;\n\t}", "function castImmutable(value) {\n return value;\n}", "clone() {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }", "clone() {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }", "function boundCopy() {\n var args, val;\n args = Array.prototype.slice.call(arguments);\n val = this.valueOf(); // jshint ignore:line\n return copy(val);\n }", "function boundCopy() {\n var args, val;\n args = Array.prototype.slice.call(arguments);\n val = this.valueOf(); // jshint ignore:line\n return copy(val);\n }", "copy()\n\t{\n\t\treturn this.constructor.createNewInstance(this);\n\t}", "function overwritable(value) {\n return function (target, propertyName) {\n var newDescriptor = {\n //this prevents every writing access, even the constructor\n writable: value\n };\n return newDescriptor;\n };\n}", "clone() {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }", "evaluate () {\n this.value = this.get()\n this.dirty = false\n }", "build() {\n const state = Immutable.from(this.state);\n this.setState(state);\n return state.asMutable();\n }", "evaluate () {\n this.value = this.get();\n this.dirty = false;\n }", "mirror(val) {\n this._mirror = val;\n return this;\n }", "function toImmutable(arg) {\n\t\t return (isImmutable(arg))\n\t\t ? arg\n\t\t : Immutable.fromJS(arg)\n\t\t}" ]
[ "0.670268", "0.64647347", "0.619443", "0.61899436", "0.6068771", "0.60651004", "0.60070676", "0.5987902", "0.5985432", "0.5942874", "0.5942874", "0.5942874", "0.5942874", "0.5942874", "0.5887968", "0.58343893", "0.57599264", "0.5753789", "0.57491195", "0.57491195", "0.57408905", "0.57408905", "0.57277435", "0.5722222", "0.5711244", "0.567428", "0.5673136", "0.56577873", "0.5639052", "0.56362647" ]
0.6560574
1
makeImmutableProperty / make a readonly property that returns null
function makeReadOnlyNullProperty (self, propName) { objectHelper.setReadOnlyProperty(self, propName, null, makeSetHandler(propName)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function internalProperty(options) {\n return property({ attribute: false, hasChanged: options === null || options === void 0 ? void 0 : options.hasChanged });\n}", "function internalProperty(options){return property({attribute:false,hasChanged:options===null||options===void 0?void 0:options.hasChanged});}", "function makeImmutableProperty (self, schema, values, propName) {\n var Model, dateCopy;\n\n if (schema[propName].__immutableCtor && is.function(schema[propName])) {\n // this is a nested immutable\n Model = schema[propName];\n self[propName] = new Model(values[propName]);\n } else if (isDate(values[propName])) {\n dateCopy = new Date(values[propName]);\n\n Object.defineProperty(self, propName, {\n get: function () {\n return new Date(dateCopy);\n },\n enumerable: true,\n configurable: false\n });\n\n Object.freeze(self[propName]);\n } else {\n objectHelper.setReadOnlyProperty(\n self,\n propName,\n // TODO: is it really necessary to clone the value if it isn't an object?\n objectHelper.copyValue(values[propName]),\n // typeof values[propName] === 'object' ? objectHelper.copyValue(values[propName]) : values[propName],\n makeSetHandler(propName)\n );\n\n if (Array.isArray(values[propName])) {\n Object.freeze(self[propName]);\n }\n }\n }", "function propertyNull() {\n delete this[name];\n }", "function propertyNull() {\n delete this[name];\n }", "function makeImmutableObject(obj) {\n\t if (!globalConfig.use_static) {\n\t addPropertyTo(obj, \"merge\", merge);\n\t addPropertyTo(obj, \"replace\", objectReplace);\n\t addPropertyTo(obj, \"without\", without);\n\t addPropertyTo(obj, \"asMutable\", asMutableObject);\n\t addPropertyTo(obj, \"set\", objectSet);\n\t addPropertyTo(obj, \"setIn\", objectSetIn);\n\t addPropertyTo(obj, \"update\", update);\n\t addPropertyTo(obj, \"updateIn\", updateIn);\n\t addPropertyTo(obj, \"getIn\", getIn);\n\t }\n\t\n\t return makeImmutable(obj, mutatingObjectMethods);\n\t }", "function makeImmutableObject(obj) {\n if (!globalConfig.use_static) {\n addPropertyTo(obj, \"merge\", merge);\n addPropertyTo(obj, \"replace\", objectReplace);\n addPropertyTo(obj, \"without\", without);\n addPropertyTo(obj, \"asMutable\", asMutableObject);\n addPropertyTo(obj, \"set\", objectSet);\n addPropertyTo(obj, \"setIn\", objectSetIn);\n addPropertyTo(obj, \"update\", update);\n addPropertyTo(obj, \"updateIn\", updateIn);\n addPropertyTo(obj, \"getIn\", getIn);\n }\n\n return makeImmutable(obj, mutatingObjectMethods);\n }", "function makeImmutableObject(obj) {\n\t if (!globalConfig.use_static) {\n\t addPropertyTo(obj, \"merge\", merge);\n\t addPropertyTo(obj, \"replace\", objectReplace);\n\t addPropertyTo(obj, \"without\", without);\n\t addPropertyTo(obj, \"asMutable\", asMutableObject);\n\t addPropertyTo(obj, \"set\", objectSet);\n\t addPropertyTo(obj, \"setIn\", objectSetIn);\n\t addPropertyTo(obj, \"update\", update);\n\t addPropertyTo(obj, \"updateIn\", updateIn);\n\t addPropertyTo(obj, \"getIn\", getIn);\n\t }\n\n\t return makeImmutable(obj, mutatingObjectMethods);\n\t }", "function makeImmutableObject(obj) {\n\t if (!globalConfig.use_static) {\n\t addPropertyTo(obj, \"merge\", merge);\n\t addPropertyTo(obj, \"replace\", objectReplace);\n\t addPropertyTo(obj, \"without\", without);\n\t addPropertyTo(obj, \"asMutable\", asMutableObject);\n\t addPropertyTo(obj, \"set\", objectSet);\n\t addPropertyTo(obj, \"setIn\", objectSetIn);\n\t addPropertyTo(obj, \"update\", update);\n\t addPropertyTo(obj, \"updateIn\", updateIn);\n\t addPropertyTo(obj, \"getIn\", getIn);\n\t }\n\n\t return makeImmutable(obj, mutatingObjectMethods);\n\t }", "constructor() {\n\t\tproperties.set(this, Object.setPrototypeOf({}, null));\n\t}", "makeProp(prop, value) {\n\t\tObject.defineProperty(this, prop, {\n\t\t\tvalue,\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tconfigurable: true\n\t\t});\n\t}", "function readOnlyAttr (obj, name, value) {\n Object.defineProperty(obj, name, {\n value: value,\n writable: false\n })\n}", "function property(e){// tslint:disable-next-line:no-any decorator\nreturn(t,n)=>n===void 0?standardProperty(e,t):legacyProperty(e,t,n)}", "function propertyNull() {\n delete this[name];\n }", "set None(value) {}", "set None(value) {}", "set None(value) {}", "set None(value) {}", "function MakeRef() {\n return { value: false };\n}", "function MakeRef() {\n return { value: false };\n}", "function MakeRef() {\n return { value: false };\n}", "function MakeRef() {\n return { value: false };\n}", "function readOnlyEnumProp(value) {\n return {\n enumerable: true,\n configurable: false,\n writable: false,\n value: value\n };\n }", "computedProp() {\n\t\treturn null\n\t}", "get None() {}", "get None() {}", "get None() {}", "get None() {}", "function createNullWriter() {\n return freezeObject({\n startRender: noOp,\n endRender: noOp,\n startElement: noOp,\n selfCloseElement: noOp,\n endElement: noOp,\n comment: noOp,\n docType: noOp,\n content: noOp,\n rawContent: noOp\n });\n}", "function fixedProp(obj, name, value) {\n\t Object.defineProperty(obj, name, {\n\t configurable: true,\n\t enumerable: false,\n\t value: value,\n\t writable: false\n\t });\n\t}" ]
[ "0.6054209", "0.59780294", "0.5920431", "0.5707005", "0.5707005", "0.5630741", "0.562664", "0.5625052", "0.5625052", "0.56013256", "0.55963504", "0.5557508", "0.55510676", "0.55313903", "0.5501012", "0.5501012", "0.5501012", "0.5501012", "0.5448218", "0.5448218", "0.5448218", "0.5448218", "0.5444262", "0.5379232", "0.537009", "0.537009", "0.537009", "0.537009", "0.53672093", "0.5315163" ]
0.6763025
0
makeReadOnlyNullProperty / make a set handler that returns an exception
function makeSetHandler (propName) { return function () { var err = new Exception(locale.errorTypes.readOnlyViolation, new Error('Cannot set `' + propName + '`. This object is immutable')); config.onError(err); return err; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeReadOnlyNullProperty (self, propName) {\n objectHelper.setReadOnlyProperty(self, propName, null, makeSetHandler(propName));\n }", "function setter() {\n\t throw new Error('vuex getter properties are read-only.');\n\t }", "set booking(stuff){\n throw \"sorry you cannot do this\"\n }", "function setter() {\n throw new Error('vuex getter properties are read-only.');\n }", "function property(e){// tslint:disable-next-line:no-any decorator\nreturn(t,n)=>n===void 0?standardProperty(e,t):legacyProperty(e,t,n)}", "static set property(){}", "set FastButNoExceptions(value) {}", "function e(r) {\n return r ? r.__accessor__ ? r.__accessor__ : r.propertyInvalidated ? r : null : null;\n }", "function setterError() {\n console.error('[Litex][error] : Cannot mutate state property outside of a mutation');\n}", "set property(){}", "_set(key) {\n throw Error(\"Needs implementation\");\n }", "function safeSetStyle(el, property, value) {\n if (property in el.style) {\n el.style[property] = value;\n }\n else {\n // tslint:disable-next-line:no-console\n console.warn(new Error(`Trying to set non-existing style ` +\n `${property} = ${value} on a <${el.tagName.toLowerCase()}>.`));\n }\n}", "set None(value) {}", "set None(value) {}", "set None(value) {}", "set None(value) {}", "function wrapproperty(obj,prop,message){if(!obj||(typeof obj==='undefined'?'undefined':(0,_typeof3.default)(obj))!=='object'&&typeof obj!=='function'){throw new TypeError('argument obj must be object');}var descriptor=(0,_getOwnPropertyDescriptor2.default)(obj,prop);if(!descriptor){throw new TypeError('must call property on owner object');}if(!descriptor.configurable){throw new TypeError('property must be configurable');}}", "defineGetterPropertyValue(prop, instance, getterHandler) {\n if (prop && getterHandler) {\n if (prop.propertyName) {\n Object.defineProperty(instance, prop.propertyName, {\n get: () => { var _a; return getterHandler(prop.propertyName, (_a = prop.metadata) !== null && _a !== void 0 ? _a : {}, instance); },\n configurable: true,\n enumerable: true,\n });\n }\n }\n }", "function test() {\n var obj = {};\n Object.defineProperty(obj, 'prop', {\n get: Math.random,\n set: function() { throw Error('setter'); }\n });\n\n var val = obj.prop;\n if (typeof val === 'number') {\n print('val is a number');\n } else {\n print('val is not a number');\n }\n}", "set hotels(_) {\n throw new Error('You can not overwrite hotels!'); \n }", "function validMember (obj, key, validator, def) {\n Object.defineProperty(obj, key, (function () {\n var val = def;\n return {\n set : function (v) { val = validator(v); },\n get : function () { return val }\n };\n })());\n}", "function setup_property(obj, prop, opts, failsafe) {\n\ttry {\n\t\t_setup_property(obj, prop, opts);\n\t} catch (err) {\n\t\tobj[prop] = failsafe;\n\t}\n}", "_redefineProperty(propertyName) {\n const that = this;\n\n Object.defineProperty(that, propertyName, {\n get: function () {\n return that.properties[propertyName].value;\n },\n set(value) {\n function replacer(key, value) {\n if (value instanceof JQX.Utilities.BigNumber) {\n return value.toString();\n }\n\n return value;\n }\n\n const oldValue = that.properties[propertyName].value,\n stringifiedOldValue = JSON.stringify(oldValue, replacer),\n stringifiedValue = JSON.stringify(value, replacer);\n\n if (stringifiedOldValue === stringifiedValue) {\n return;\n }\n\n that.properties[propertyName].value = value;\n\n if (that.isReady && (!that.ownerElement || (that.ownerElement && that.ownerElement.isReady)) && that.context !== that) {\n const context = that.context;\n\n that.context = that;\n that.propertyChangedHandler(propertyName, oldValue, value);\n that.context = context;\n }\n }\n });\n }", "_upgradeProperty(prop) {\n // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n // https://developers.google.com/web/fundamentals/web-components/examples/howto-checkbox\n /* eslint no-prototype-builtins: 0 */\n if (this.hasOwnProperty(prop)) {\n const value = this[prop];\n // get rid of the property that might shadow a setter/getter\n delete this[prop];\n // this time if a setter was defined it will be properly called\n this[prop] = value;\n // if a getter was defined, it will be called from now on\n }\n }", "function no_set_attr(klass, attr){\n if(klass[attr] !== undefined){\n throw _b_.AttributeError.$factory(\"'\" + klass.__name__ +\n \"' object attribute '\" + attr + \"' is read-only\")\n }else{\n throw $B.attr_error(attr, klass)\n }\n}", "function _set(property, value) {\n var stringValue = value === null ? \"\" : value.toString();\n (0, _kolmafia.setProperty)(property, stringValue);\n}", "function wrapproperty(obj, prop, message) {\n\t if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {\n\t throw new TypeError('argument obj must be object')\n\t }\n\n\t var descriptor = Object.getOwnPropertyDescriptor(obj, prop)\n\n\t if (!descriptor) {\n\t throw new TypeError('must call property on owner object')\n\t }\n\n\t if (!descriptor.configurable) {\n\t throw new TypeError('property must be configurable')\n\t }\n\n\t return\n\t}", "function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}", "function defineProperty(key,handler,value){Object.defineProperty(ctrl,key,{get:function get(){return value;},set:function set(newValue){var oldValue=value;value=newValue;handler&&handler(newValue,oldValue);}});}", "get value() {\n throw new TypeError('`value` can’t be accessed in an abstract instance of Maybe.Just');\n }" ]
[ "0.66587955", "0.6356464", "0.6235886", "0.6208156", "0.5865558", "0.58342254", "0.57981133", "0.57048345", "0.56855756", "0.5644346", "0.5636067", "0.56044286", "0.548204", "0.548204", "0.548204", "0.548204", "0.5450891", "0.5335113", "0.5334958", "0.5333292", "0.53252125", "0.5325149", "0.5225863", "0.52219796", "0.52153695", "0.5167507", "0.51617664", "0.51296556", "0.5128882", "0.5122658" ]
0.7683469
0
Metodo para finalizar accion de mover
function finishMove(){ //Cambiar estado hotspot $(".hots"+id).find(".in").removeClass("move"); $(".hots"+id).find(".out").removeClass("moveOut"); $(".hotspotElement").removeClass('active'); $(".hotspotElement").css("pointer-events", "all"); //Volver a desactivar las acciones de doble click $("#pano").off( "dblclick"); //Quitar el cursor de tipo cell $("#pano").removeClass("cursorAddHotspot"); //Mostrar el menu inicial showMain(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "finMouvement() {\n\t\tthis.visuel.removeEventListener('transitionend', this.evt.visuel.transitionend);\n\t\tthis.file.shift();\n this.cellule.verifierObjet();\n\t\tthis.prochainMouvement();\n\t\t//this.vitesse = 0; //maintenant gere dans la fn prochainMouvement\n\t}", "function end(){\n this.previousRotation = this.previousRotation;\n this.mouseSphere0 = null;\n}", "function terminaMovimientoMarcador(e){\n\t\tvar nombreActual = obtenerNombreMarcador(this);\n\t\tconsole.log(\"hola\");\n\t\t//console.log(\"\");\n\t\tif(nombreActual){\n\t\t \t//actualizarlo en la tabla\n\t\t\tjQuery(jQuery(\"#ID-\" + nombreActual.replace(\" \", \"_\")).children()[2]).text(this.getLatLng().lat);\n\t\t \tjQuery(jQuery(\"#ID-\" + nombreActual.replace(\" \", \"_\")).children()[3]).text(this.getLatLng().lng);\n\t\t \t\t\n\t\t \tvar res = obtenerCoordenadaDesdeNombre(nombreActual);\n\t\t \tif(res){\n\t\t \t\tvar coordenadaActual = res[0];\n\t\t \t\tvar indiceActual = res[1];\n\t\t \t\tvar otraCoor = {\n\t\t\t\t nombre: nombreActual,\n\t\t\t\t x: this.getLatLng().lat,\n\t\t\t\t y: this.getLatLng().lng,\n\t\t\t\t h: 0,\n\t\t\t\t tipo: coordenadaActual['tipo']\n\t\t\t\t};\n\t\t \t\tobtenerAltura(this.getLatLng(), nombreActual, coordenadas, indiceActual, otraCoor);\n\t\t \t}\n\t\t}\n\t\tif((Object.keys(markers).length == 4 || (Object.keys(markers).length == 5 && puntoInicial)) && rectangulo){\n\t\t\tdibujarRectangulo();\n\t\t}\n\t}", "function finalize()\r\n {\r\n $(\".cell\").css('cursor', 'default');\r\n $(\".turn\").css('visibility', 'hidden');\r\n gameOver = true;\r\n }", "function endTurn()\n\t{\n\t\tunit.movePoints = type.move;\n\n\t\tupdate();\n\t}", "function end(event) {\n\t\t\t_moving = false;\n\t\t}", "end() {\n this.isOver = true;\n this.isRunning = false;\n\n if (typeof this.onGameOver === 'function') {\n this.onGameOver();\n }\n }", "function quitarCapaMesActual() {\n if (capaMesActual) {\n myMap.removeLayer(capaMesActual);\n capaMesActual = null;\n }\n if (leyendaMesActual) {\n myMap.removeControl(leyendaMesActual);\n leyendaMesActual = null;\n }\n}", "endUpdate() {\r\n\r\n }", "function endMove() {\n moveMode = 0;\n drawMethod();\n}", "function endMove(event) {\n current.win.style.opacity = 1;\n }", "mateEnd() {}", "finish() {\n this._ctx.restore();\n }", "function endMove() {\n window.removeEventListener(\"mousemove\", moveBubble);\n }", "function endRotation() {\r\n rot.inProgress = false;\r\n rotate(that.selection);\r\n redrawSelectedEndRotation();\r\n setIsFinal();\r\n if (that.isFinal) {\r\n grayOut();\r\n var statusImgNode = dojo.byId('statusImg');\r\n statusImgNode.src = '/images/done.gif';\r\n statusImgNode.alt = '';\r\n highlightTopPlayers();\r\n topPlayers.tryToInsertNew(rotations);\r\n }\r\n }", "end() {\n this.endZoomInMode();\n this.endHandMode();\n }", "function end() {\n \tcreditsLoopOn = false;\n \tcreditsAbort();\n }", "transitionCompleted() {\n // implement if needed\n }", "endTurn () {\n\t\tthis.turnToAct = (this.turnToAct === COLOR.BLACK) ? \n\t\t\tCOLOR.WHITE : COLOR.BLACK;\n\t}", "wait_GM_AnimationEnd(){\n if(this.check_Reset())\n return;\n if (this.view.currentMoviePiece.parabolic.end == true) {\n if(this.model.lastMoviePlay() == true)\n {\n this.scene.reset = false;\n this.scene.showGameMovie = false;\n this.model.currentMoviePlay = 0;\n this.state = 'GAME_OVER';\n }\n else\n {\n this.model.inc_currentMoviePlay();\n this.scene.update_CameraRotation();\n this.state = 'WAIT_GM_CAMERA_ANIMATION_END';\n }\n }\n }", "endTracking_() {\n this.tracking_ = false;\n this.dragging_ = false;\n this.totalMoveY_ = 0;\n this.totalMoveX_ = 0;\n }", "_complete() {\n this._resetCurrent(true);\n\n super._complete();\n }", "end() {\n if (this.mode !== mode.move) return;\n\n let bbox = this.bbox();\n let x = Box.snap(bbox.x);\n let y = Box.snap(bbox.y);\n this.setPosition(x, y);\n this.moveEndEvent.trigger();\n }", "function C012_AfterClass_Amanda_Untie() {\n\tActorUntie();\n\tC012_AfterClass_Amanda_CalcParams();\n\tCurrentTime = CurrentTime + 50000;\n}", "function fin() {\n //ponemos el contados y el tiempo final a 0\n contador = 0;\n tiempoFinal = 0;\n console.log('fin');\n\n //desbloqueamos el boton de finalizar para que puedan guardar el movimiento\n document.getElementById('siguiente').innerHTML = '<b>FINALIZAR</b>';\n document.getElementById('siguiente').disabled = false;\n document.getElementById('siguiente').style.backgroundColor = 'rgb(3, 119, 25)';\n}", "afterStep() {\n this.useItems();\n this.handleSlimeExplosion();\n this.handleBullets();\n this.checkHealth();\n this.cleanup();\n this.spawnMonster();\n this.comparePosition();\n this.checkProgress();\n }", "animationEnd() {\n if (this.movements.length !== 0) {\n this.nextMove()\n } else {\n this.orchestrator.camera.startAnimation(\"position\", 1.5, () => {\n this.orchestrator.changeState(new GameOverState(this.orchestrator))\n },\n [...this.orchestrator.camera.originalPosition],\n [\n this.orchestrator.gameboardProperties.x,\n this.orchestrator.gameboardProperties.y,\n this.orchestrator.gameboardProperties.z\n ])\n }\n\n }", "moveCompleted() {\n // Reset the from so we can\n this.from = null;\n\n if (this.gameOver) return;\n this.changeTurn();\n this.hideMessage();\n }", "function UnredoOperations () {\n\t\t\t\tthis.position = 0;\n\t\t\t\tthis.actions = new Array();\n\t\t\t\tvar me = this;\n\n\t\t\t\t/* Binding events of DOM elements related to UnredoOperations */\n\t\t\t\t//Undo-redo action fade when rollout bottom zone\n\t\t\t\t$(\"div.footer\").hover(\n\t\t\t\t\tfunction(ev) {},\n\t\t\t\t\tfunction(ev) {\n\t\t\t\t\t\t$(\"#action_info\").fadeTo(500,0);\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\t// Undo action.\n\t\t\t\t$('a.undo').click(function(){me.Undo();});\n\n\t\t\t\t// Redo action.\n\t\t\t\t$('a.redo').click(function() {me.Redo();});\n\t\t\t}", "function actualizarCantidadMovimientos() {\n limiteMovimientos -= 1;\n}" ]
[ "0.6835387", "0.62044543", "0.6173208", "0.6167339", "0.61224705", "0.61108464", "0.59987867", "0.5991849", "0.5975187", "0.5969416", "0.5935727", "0.5925944", "0.58890903", "0.5871062", "0.5811536", "0.5802742", "0.5782116", "0.5748354", "0.5741184", "0.5724469", "0.57241756", "0.5718426", "0.57171", "0.567839", "0.56778175", "0.56737965", "0.5657824", "0.5650647", "0.5642676", "0.562321" ]
0.63237244
1
Code as fast as you can! You need to double the integer and return it.
function doubleInteger(i) { // i will be an integer. Double it and return it. return i*2; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doubleInteger(i) {\n return i*2;\n}", "function doubleInteger(i) {\n // i will be an integer. Double it and return it.\n return i * 2;\n}", "function getInt(n){\n return Math.floor(get() * (n + 1));\n}", "function doubleIT(num){\n var result = num * 2;\n return result;\n}", "function double(num){\n retrun num * 2;\n}", "function double(number) {\n number *= 2;\n return number;\n}", "function double(num){\n return 2*num;\n }", "function double(n){\n return n*2;\n}", "function doubleIt(originalNum) {\n return originalNum * 2;\n // doubleIt2(originalNum);\n}", "function double(num) {\n return (num * 2);\n}", "function doubleNum(num) {\n return num * 2;\n}", "function doubleIt(num){\n var result = num*2;\n //console.log(result);\n return result;\n}", "function doubleNumber (number) {\n return number * number\n }", "function rInt(n){\r\n\r\n }", "function double(number) {\n return number *= 2;\n}", "function double(num) {\n return num * 2;\n}", "function doubleSingle(number) {\n return number*2;\n}", "function double(num) {\n return num * 2;\n }", "function i(n){return n}", "function double (num) {\n return num * 2;\n}", "function duble(n) {\n\treturn n * 2;\n}", "function integer(n) {\r\n return n % (0xffffffff + 1);\r\n}", "function findTwice(number){\n\treturn number * number;\n}", "function numberDubler(number){\n return number*2;\n}", "function double(x) {\r\n return x *= 2\r\n}", "function double(x) { return x*2 }", "function bnIntValue() {\nif(this.s < 0) {\n if(this.t == 1) return this.data[0]-this.DV;\n else if(this.t == 0) return -1;\n} else if(this.t == 1) return this.data[0];\nelse if(this.t == 0) return 0;\n// assumes 16 < DB < 32\nreturn ((this.data[1]&((1<<(32-this.DB))-1))<<this.DB)|this.data[0];\n}", "function bnIntValue() {\nif(this.s < 0) {\n if(this.t == 1) return this.data[0]-this.DV;\n else if(this.t == 0) return -1;\n} else if(this.t == 1) return this.data[0];\nelse if(this.t == 0) return 0;\n// assumes 16 < DB < 32\nreturn ((this.data[1]&((1<<(32-this.DB))-1))<<this.DB)|this.data[0];\n}", "function bnIntValue() {\nif(this.s < 0) {\n if(this.t == 1) return this.data[0]-this.DV;\n else if(this.t == 0) return -1;\n} else if(this.t == 1) return this.data[0];\nelse if(this.t == 0) return 0;\n// assumes 16 < DB < 32\nreturn ((this.data[1]&((1<<(32-this.DB))-1))<<this.DB)|this.data[0];\n}", "function bnIntValue() {\nif(this.s < 0) {\n if(this.t == 1) return this.data[0]-this.DV;\n else if(this.t == 0) return -1;\n} else if(this.t == 1) return this.data[0];\nelse if(this.t == 0) return 0;\n// assumes 16 < DB < 32\nreturn ((this.data[1]&((1<<(32-this.DB))-1))<<this.DB)|this.data[0];\n}" ]
[ "0.74438244", "0.74044526", "0.7052231", "0.69679093", "0.667166", "0.65629786", "0.6411179", "0.63856465", "0.6376736", "0.63684785", "0.6325474", "0.63242817", "0.63145906", "0.63068527", "0.628197", "0.6243972", "0.6173825", "0.61356324", "0.61268353", "0.6111958", "0.61006606", "0.60964227", "0.6064608", "0.60329497", "0.60276604", "0.5998202", "0.5912533", "0.5912533", "0.5912533", "0.5912533" ]
0.74575794
0
Function name: add module Author: Reccion, Jeremy Date Modified: 2018/04/02 Description: creates a new collection by the name inputted by the user. it is then registered to the "modules" collection. Parameter(s): Object. includes: name: required. string type fields: optional. Array type. initialized if not existing from input Return: Promise
function addModule(newModule){ //imitate angular promise. start by initializing this var deferred = Q.defer(); newModule.name = newModule.name.toLowerCase(); //check if there is an existing module db.modules.findOne({name: newModule.name}, function(err, aModule){ if(err){ deferred.reject(err); } //already exists else if(aModule){ deferred.reject(exists); } else{ //unique, so proceed //create table first before adding a new document to 'modules' collection (not necessary?) db.createCollection(newModule.name, function(err){ if(err){ deferred.reject(err); } else{ //initialize fields property as empty array if there are none in the input if(newModule.fields == undefined){ newModule.fields = []; } db.modules.insert(newModule, function(err){ if(err){ deferred.reject(err); } else{ deferred.resolve(); } }); } }); } }); //return the promise along with either resolve or reject return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addModuleDoc(moduleName, newDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].insert(newDoc, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function addModuleDoc(moduleName, newDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n service.findDuplicateDoc(moduleName, newDoc).then(function(){\n db.bind(moduleName);\n\n db[moduleName].insert(newDoc, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n db.modules.update({name: moduleName}, {$push: {fields: fieldObject}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n //the query searches for the module name that do not have the inputted field name\n //this is to avoid pushing same field names on the 'fields' array of the specified module\n //writeResult will determine if the update was successful or not (i.e. writeResult.result.nModified)\n db.modules.update({name: moduleName, fields: {$not: {$elemMatch: {name: fieldObject.name}}}}, {$push: {fields: fieldObject}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n //console.log(writeResult.result);\n //check the status of the update, if it failed, it means that there is an existing field name\n if(writeResult.result.nModified == 0){\n deferred.reject(exists);\n }\n else{\n deferred.resolve();\n }\n }\n });\n\n return deferred.promise;\n}", "async function createCollection(req, res) {\n\t\n\tlet data = req.body\n\n\tif (!data.projectId || !data.name) return res.status(400).send({ message: 'ERROR: projectId and name are required' })\n\n\ttry {\n\t\tlet newCollection = {\n\t\t\tid: generate(alphabet, 10),\n\t\t\tprojectId: data.projectId,\n\t\t\tname: data.name,\n\t\t\tmodel: data.model || []\n\t\t}\n\n\t\tconsole.log(newCollection)\n\n\t\t// let project = await Project.findOne({id: data.projectId})\n\t\t// project.collections.push(newCollection)\n\t\t// await project.update()\n\t\tlet collection = await Collection.create(newCollection)\n\n\t\treturn res.status(200).json(collection)\n\t}\n\tcatch(error) {\n\t\treturn res.status(500).send({ error: error.message })\n\t}\n}", "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n //check if the name of the selected module has not changed\n db.modules.findOne({_id: mongo.helper.toObjectID(updateModule._id)}, function(err, aModule){\n if(err){\n deferred.reject(err);\n }\n else if(aModule){\n //if names are different, renaming the collection must be executed, then proceed to update\n if(aModule.name != updateModule.name){\n db.bind(aModule.name);\n db[aModule.name].rename(updateModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n update();\n }\n });\n }\n }\n else{\n update();\n }\n });\n\n //updates the document in the 'modules' collection\n function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n\n return deferred.promise;\n}", "function addModuleToPipeline(moduleID, moduleName){\n\n var module_name = ''\n var documentation = ''\n var moduleSourceCode_settings = ''\n var moduleSourceCode_main = ''\n var moduleSourceCode_html = ''\n\n $.ajax({\n type: \"POST\",\n cache: false,\n url: \"/get_module_details\",\n data: 'p_module_key=' + moduleName,\n success: function (option) {\n\n module_name = option.module_name\n documentation = option.documentation\n moduleSourceCode_settings = option.moduleSourceCode_settings\n moduleSourceCode_main = option.moduleSourceCode_main\n moduleSourceCode_html = option.moduleSourceCode_html\n user_role = option.user_role\n\n user_role_based_edit = ''\n if (user_role == 'image_researcher') {\n user_role_based_edit = '| <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"btn_edit_code\"> Edit </a> | <a style=\"font-size:12px;color:#000000;\" href=\"#\" > Contact Author </a>';\n }\n\n\n\n\n //append new module to the pipeline...\n $(\"#img_processing_screen\").append(\n '<div style=\"background-color:#EEE;width:100%\" class=\"module\" id=\"module_id_'+ moduleID +'\">' +\n\n '<!-- Documentation -->' +\n '<div style=\"margin:10px;font-size:17px;color:#000000;\">' +\n ' ' + module_name + '<hr/>' +\n ' Documentation: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"documentation_show_hide\">(Show/Hide)</a>' +\n '<div class=\"documentation\" style=\"background-color:#888888;display:none;font-size:14px;\">' + documentation + '</div>' +\n '</div>' +\n\n\n '<!-- Settings -->' +\n '<div style=\"margin:10px;font-size:17px;color:#000000;\">' +\n ' Settings: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"settings_show_hide\">(Show/Hide)</a>' +\n ' <div class=\"settings\" style=\"background-color:#888888;display:none;font-size:14px;\">' + moduleSourceCode_html + '</div>' +\n '</div>' +\n\n\n '<div style=\"margin:10px;font-size:17px;color:#000000;\" class=\"setting_section\">' +\n ' Source Code: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"code_show_hide\">(Show/Hide)</a>' + user_role_based_edit +\n\n ' <div class=\"edit_code\" style=\"background-color:#888888;display:none;font-size:14px;\">' +\n ' <textarea rows=7 cols=180 class=\"code_settings\">' + moduleSourceCode_settings + '</textarea>' +\n ' <p style=\"color:#000000;\">Main Implementation: </p>' +\n ' <textarea rows=10 cols=180>' + moduleSourceCode_main + '</textarea>' +\n '</div>' +\n\n ' <pre style=\"background-color:#333333;width:100%;\" class=\"pre_highlighted_code\">' + '<code class=\"python highlighted_code\" style=\"display:none;\">' + moduleSourceCode_settings +\n ' ' +\n moduleSourceCode_main + '</code></pre>' +\n\n ' </div>' +\n\n '</div>'\n\n\n );//end of append\n\n if(isItMyFloor() == false)lockParamsSettings();\n\n $('pre code').each(function (i, block) {\n hljs.highlightBlock(block);\n });\n\n\n },\n error: function (xhr, status, error) {\n alert(xhr.responseText);\n }\n\n });//end of ajax\n\n\n}", "function addModuleToPipeline(moduleID, moduleName){\n\n var module_name = ''\n var documentation = ''\n var moduleSourceCode_settings = ''\n var moduleSourceCode_main = ''\n var moduleSourceCode_html = ''\n\n $.ajax({\n type: \"POST\",\n cache: false,\n url: \"/get_module_details\",\n data: 'p_module_key=' + moduleName,\n success: function (option) {\n //alert(\"@ success\");\n module_name = option.module_name\n documentation = option.documentation\n moduleSourceCode_settings = option.moduleSourceCode_settings\n moduleSourceCode_main = option.moduleSourceCode_main\n moduleSourceCode_html = option.moduleSourceCode_html\n user_role = option.user_role\n\n user_role_based_edit = ''\n if (user_role == 'image_researcher') {\n user_role_based_edit = '| <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"btn_edit_code\"> Edit </a> | <a style=\"font-size:12px;color:#000000;\" href=\"#\" > Contact Author </a>';\n }\n\n //Parse the givn XML for tool definition\n var xmlDoc = $.parseXML( moduleSourceCode_html );\n var $xml_tool_definition = $(xmlDoc);\n\n //the tool configuration.\n //TODO: add the input port info.\n var tool_configs = $xml_tool_definition.find(\"toolConfigurations\");\n tool_configs = tool_configs.html();\n\n\n\n var tool_documentation = $xml_tool_definition.find(\"toolDocumentation\");\n tool_documentation = tool_documentation.html();\n\n\n var ioInformation = '';\n\n var $toolInput = $xml_tool_definition.find(\"toolInput\");\n\n $toolInput.each(function(){\n\n var label = $(this).find('label').text(),\n dataFormat = $(this).find('dataFormat').text(),\n referenceVariable = $(this).find('referenceVariable').text();\n\n ioInformation += '<input type=\"text\" style=\"display:none;\" class=\"setting_param module_input '+ referenceVariable + '\" ' + ' size=\"45\"/>';\n\n\n });\n\n\n var $toolOutput = $xml_tool_definition.find(\"toolOutput\");\n\n $toolOutput.each(function(){\n\n var label = $(this).find('label').text(),\n dataFormat = $(this).find('dataFormat').text(),\n referenceVariable = $(this).find('referenceVariable').text();\n\n //var thisPortOutput = 'module_id_' + moduleID + '_' + referenceVariable+'.' + dataFormat;\n //var thisPortOutputPath = referenceVariable + '=\"' + thisPortOutput + '\"';\n\n ioInformation += '<input type=\"text\" style=\"display:none;\" class=\"setting_param module_output '+ referenceVariable + '\" size=\"45\"/>';\n\n\n });\n\n\n\n\n\n\n\n//Parse the givn XML\n//var xmlDoc = $.parseXML( xml );\n\n//var $xml = $(xmlDoc);\n\n // Find Person Tag\n//var $person = $xml.find(\"toolConfigurations\");\n\n\n //append new module to the pipeline...\n $(\"#img_processing_screen\").append(\n '<div style=\"background-color:#EEE;width:100%;display:none;\" class=\"module\" id=\"module_id_'+ moduleID +'\">' +\n\n '<!-- Documentation -->' +\n '<div style=\"margin:10px;font-size:17px;color:#000000;\">' +\n ' ' + module_name + ' (Module ' + moduleID + ')'+ '<hr/>' +\n ' Documentation: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"documentation_show_hide\">(Show/Hide)</a>' +\n '<div class=\"documentation\" style=\"background-color:#DDDDDD;display:none;font-size:14px;\">' + tool_documentation + '</div>' +\n '</div>' +\n\n\n '<!-- Settings -->' +\n '<div style=\"margin:10px;font-size:17px;color:#000000;\">' +\n ' Settings: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"settings_show_hide\">(Show/Hide)</a>' +\n ' <div class=\"settings\" style=\"background-color:#DDDDDD;font-size:14px;\">' + tool_configs + '<br/>' + ioInformation +\n '<input type=\"hidden\" class=\"setting_param \" size=\"45\" id=\"module_id_'+ moduleID +'_output_destination\"/>'+\n '</div>' +\n '</div>' +\n\n\n '<div style=\"margin:10px;font-size:17px;color:#000000;\" class=\"setting_section\">' +\n ' <a style=\"display:none;font-size:12px;color:#000000;\" href=\"#\" class=\"code_show_hide\">(Show/Hide)</a>' + user_role_based_edit +\n\n ' <div class=\"edit_code\" style=\"background-color:#888888;font-size:14px;display:none;\">' +\n ' <textarea rows=7 cols=150 class=\"code_settings\">' + moduleSourceCode_settings + '</textarea>' +\n ' <p style=\"color:#000000;\">Main Implementation: </p>' +\n ' <textarea rows=10 cols=150>' + moduleSourceCode_main + '</textarea>' +\n '</div>' +\n\n ' <pre style=\"background-color:#333333;width:100%;display:none;\" class=\"pre_highlighted_code\">' + '<code class=\"python highlighted_code\" style=\"display:none;\">' + moduleSourceCode_settings +\n ' ' +\n moduleSourceCode_main + '</code></pre>' +\n\n ' </div>' +\n\n '</div>'\n\n\n );//end of append\n\n\n\n\n\n\n\n\n $(\"#module_id_\"+ moduleID + \"_output_destination\").val(\"output_destination = '/home/ubuntu/Webpage/app_collaborative_sci_workflow/workflow_outputs/test_workflow/Module_\" + moduleID + \"'\").trigger('change');\n\n\n\n\n\n\n\n\n\n\n\n var listOfInputPorts = [];\n var listOfOutputPorts = [];\n\n\n\n //input port definition\n var $toolInput = $xml_tool_definition.find(\"toolInput\");\n\n $toolInput.each(function(){\n\n var label = $(this).find('label').text(),\n dataFormat = $(this).find('dataFormat').text(),\n referenceVariable = $(this).find('referenceVariable').text();\n\n //$(\"#ProfileList\" ).append('<li>' +label+ ' - ' +dataFormat+ ' - ' + idn +'</li>');\n\n var aNewInputPort = makePort(dataFormat,referenceVariable,true);\n listOfInputPorts.push(aNewInputPort);\n\n\n\n var thisPortInput = 'module_id_' + moduleID + '_NO_INPUT_SOURCE_SELECTED_.' + dataFormat;\n thisPortInput = referenceVariable + '=\"' + WORKFLOW_OUTPUTS_PATH + THIS_WORKFLOW_NAME + '/' +thisPortInput + '\"';\n\n $(\"#module_id_\"+moduleID + ' .' + referenceVariable).val(thisPortInput).trigger('change');\n\n });\n\n\n\n\n\n //output port definition\n var $toolOutput = $xml_tool_definition.find(\"toolOutput\");\n\n $toolOutput.each(function(){\n\n var label = $(this).find('label').text(),\n dataFormat = $(this).find('dataFormat').text(),\n referenceVariable = $(this).find('referenceVariable').text();\n\n //$(\"#ProfileList\" ).append('<li>' +label+ ' - ' +dataFormat+ ' - ' + idn +'</li>');\n\n var aNewOutputPort = makePort(dataFormat,referenceVariable,false);\n listOfOutputPorts.push(aNewOutputPort);\n\n\n var thisPortOutput = 'module_id_' + moduleID + '_' + referenceVariable+'.' + dataFormat;\n thisPortOutput = referenceVariable + '=\"' + WORKFLOW_OUTPUTS_PATH + THIS_WORKFLOW_NAME + '/' +thisPortOutput + '\"';\n\n $(\"#module_id_\"+moduleID + ' .' + referenceVariable).val(thisPortOutput).trigger('change');\n\n });\n\n\n\n\n\n makeTemplate(moduleName,\"images/55x55.png\", \"white\",\n listOfInputPorts,\n listOfOutputPorts);\n\n\n\n\n\n\n //Update the DAG\n //var newWorkflowModule = workflow.add(\"Module_\"+moduleID, \"Module_0\", workflow.traverseDF);\n //newWorkflowModule.nodeName = moduleName;\n //redrawWorkflowStructure();\n\n\n //alert(\"Add\");\n myDiagram.startTransaction(\"add node\");\n // have the Model add the node data\n var newnode = {\"key\":\"module_id_\" + moduleID, \"type\":moduleName, \"name\":moduleName, \"module_id\": \"Module \"+moduleID};\n myDiagram.model.addNodeData(newnode);\n // locate the node initially where the parent node is\n // diagram.findNodeForData(newnode).location = node.location;\n // and then add a link data connecting the original node with the new one\n //var newlink = { from: node.data.key, to: newnode.key };\n //diagram.model.addLinkData(newlink);\n // finish the transaction -- will automatically perform a layout\n myDiagram.commitTransaction(\"add node\");\n\n\n\n\n\n\n if(isItMyFloor() == false)lockParamsSettings();\n\n /*$('pre code').each(function (i, block) {\n hljs.highlightBlock(block);\n });*/\n\n\n },\n error: function (xhr, status, error) {\n alert(xhr.responseText);\n }\n\n });//end of ajax\n\n\n}", "function createModule(name) {\n var newModule = new Module(name);\n modules.push(newModule);\n return newModule;\n }", "function addModule() {\n $('<section>')\n .attr('id', 'rsw-discord')\n .addClass('rsw-custom-module rail-module')\n .append(\n $('<a>')\n .attr('href', ('https://discord.gg/s63bxtW'))\n .append(\n $('<img>')\n .attr('src', 'https://vignette.wikia.nocookie.net/vocaloid/images/2/2d/Discord-Logo-Color.png')\n ),\n $('<div>')\n .append(\n $('<p>')\n .append(\n 'Le Wiki VOCALOID a un serveur officiel de Discord ! Clique le bouton ci-dessous pour rejoindre et dialoguer avec les fans et des contributeurs en direct, ou clique ',\n $('<a>')\n .attr('href', mw.util.wikiGetlink('Wiki Vocaloid:Discord'))\n .text('ici'),\n ' pour lire les règles du tchat de ce serveur.'\n ),\n $('<a>')\n .attr('href', 'https://discord.gg/s63bxtW')\n .addClass('wds-button')\n .text('Recevoir une invitation')\n )\n )\n .insertBefore('#wikia-recent-activity');\n }", "function onAdd(ev){\n ev.preventDefault();\n\n if(lectureInput.value == '' || dataInput.value == '' \n || dataInput.value.includes('mm') || moduleInput.value == '' \n || moduleInput.value.includes('Select module')){\n return;\n }\n\n if(modules.textContent.includes(moduleInput.value.toUpperCase())){\n const ulModule = Array.from(document.querySelectorAll('div[class=modules] > div[class=module]'))\n .find(m => m.textContent.includes(moduleInput.value.toUpperCase()))\n .querySelector('ul');\n \n const li = document.createElement('li');\n li.setAttribute('class', 'flex');\n const header = document.createElement('h4');\n const date = dataInput.value.split('T');\n header.textContent = `${lectureInput.value} - ${date[0].split('-').join('/')} - ${date[1]}`;\n const delButton = document.createElement('button');\n delButton.setAttribute('class', 'red');\n delButton.textContent = 'Del';\n delButton.addEventListener('click', onDelete);\n\n li.appendChild(header);\n li.appendChild(delButton);\n\n ulModule.appendChild(li);\n\n const headers = Array.from(document.querySelectorAll('div[class=modules] > div[class=module] > ul li')).sort((a, b) => {\n const firstDate = a.children[0].textContent.split(' - ')[1];\n const secondDate = b.children[0].textContent.split(' - ')[1];\n\n return firstDate.localeCompare(secondDate);\n });\n ulModule.textContent = '';\n headers.forEach(h => ulModule.appendChild(h));\n }else{\n const module = document.createElement('div');\n module.setAttribute('class', 'module');\n\n const hModule = document.createElement('h3');\n hModule.textContent = moduleInput.value.toUpperCase() + '-MODULE';\n\n const ul = document.createElement('ul');\n const li = document.createElement('li');\n li.setAttribute('class', 'flex');\n\n const header = document.createElement('h4');\n const date = dataInput.value.split('T');\n header.textContent = `${lectureInput.value} - ${date[0].split('-').join('/')} - ${date[1]}`;\n const delButton = document.createElement('button');\n delButton.setAttribute('class', 'red');\n delButton.textContent = 'Del';\n delButton.addEventListener('click', onDelete);\n\n li.appendChild(header);\n li.appendChild(delButton);\n ul.appendChild(li);\n module.appendChild(hModule);\n module.appendChild(ul);\n\n modules.appendChild(module);\n }\n }", "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n db.modules.find({$or: [\n {_id: mongo.helper.toObjectID(updateModule._id)},\n {name: updateModule.name}\n ]}).toArray(function(err, modules){\n if(err){\n deferred.reject(err);\n }\n else if(modules.length == 0){\n deferred.reject(notFound);\n }\n //vali inputs, no other document have the same name\n else if(modules.length == 1){\n var oldModule = modules[0];\n \n //rename if old & new names are different\n if(oldModule.name != updateModule.name){\n db.bind(oldModule.name);\n db[oldModule.name].rename(updateModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n update();\n }\n });\n }\n //go straight to update\n else{\n update();\n }\n }\n //another module document with the same name exists\n else{\n deferred.reject(exists);\n }\n }); \n\n //updates the document in the 'modules' collection\n function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n\n return deferred.promise;\n}", "function addModule(module) {\n function addIndividualModule(module) {\n if (!mapNames[module.moduleName]) {\n mapNames[module.moduleName] = true;\n allModules.push(module);\n ModuleRegistry.register(module);\n }\n }\n addIndividualModule(module);\n if (module.dependantModules) {\n module.dependantModules.forEach(addModule);\n }\n }", "function addNewModule() {\n\tcountOfModules++;\n\tvar modulename = document.getElementById(\"module_name\").value;\n\tconsole.log(\"Created Module : \"+modulename);\n\tconsole.log(\"Number of existing modules \"+countOfModules);\n\tvar node = '<div class = \"module\" id=\"Module'+countOfModules+'\" onClick=openModuleDetails(\"'+modulename+'\")><div class=\"moduletitle\"><p id = \"ModuleP'+countOfModules+'\">'+modulename+'</p></div><div class=\"modulePrecentage\"><p>69%</p></div></div>';\n\tdocument.getElementById('module_elements').innerHTML += node;\n\n\t//Close popupup and save the modules\n\tclosepopup();\n\tsaveModules();\n\n}", "function addCollectiontoDB() {\n var name = $(\"#colName\").val();\n var owner = sessionStorage.getItem(\"collectionOwner\");\n var itemName = $(\"#item\").val();\n var itemDesc = $(\"#desc\").val();\n\n $.post(\"/newCollection\", {owner: owner, name: name, itemName: itemName, itemDesc: itemDesc}, function(data) {\n $(\"#addResults\").append(\"<h4>Collection \" + data.collection + \" Added!</h4>\");\n $(\"#collectionName\").append(\"<option>\" + data.collection + \"</option>\");\n });\n}", "function addModule(name, body) {\n\n try {\n availableModules[name] = body;\n\n if (loadingModules.hasOwnProperty(name)) {\n evaluateModule(name);\n }\n\n if (moduleConfig) {\n cacheModule(name, body);\n } else {\n pendingCacheables[name] = body;\n }\n } catch(exception) {\n failModule(name, exception);\n }\n }", "function addToCollection( newTitle, newArtist, newYearPublished, newTracks ){ \n// - Create a new object having the above properties\n let album = {\n title : newTitle,\n artist : newArtist,\n year : newYearPublished,\n tracks : newTracks\n } //end object literal\n// - Add the new object to the end of the `collection` array\nrecordCollection.push( album );\n// - Return the newly created object\nreturn console.log( 'New record added to the collection:', album );\n}", "addObject(name, collection, config) {\n\t\tthis.objectManager.addObject(name, collection, config);\n\t}", "function postGroup(req, res) {\n cors.setHeader(res);\n let moduleId = req.swagger.params.body.value.module_id;\n\n // Only allow people in the module to create groups.\n // Administrators have can_view set for every module.\n rightsModule.getModuleRights(req)\n .then(rights => {\n var moduleRights;\n for (var x in rights.modules_rights) {\n if (rights.modules_rights[x].id === moduleId) {\n moduleRights = rights.modules_rights[x];\n }\n }\n console.log(moduleRights);\n if (!(moduleRights && moduleRights.can_view)) {\n res.status(401).json({});\n return;\n }\n });\n\n // Refuse groups without module id.\n if (typeof moduleId === 'undefined') {\n res.status(405).json({});\n return;\n }\n\n (async () => {\n const client = await db.connect();\n try {\n // Create a new group in the database for the given module.\n const result = await client.query(sqlStatements.addGroup, [moduleId]);\n // Add the module id to the result to conform to API specification.\n result.rows[0].module_id = moduleId;\n // Add the current user to the newly created group.\n await client.query(sqlStatements.addUserToGroup, [result.rows[0].id, req.user.id]);\n\n res.status(201).json(result.rows[0]);\n } finally {\n client.release();\n }\n })().catch(e => {\n console.log(e.stack);\n res.status(500).json({});\n });\n}", "function saveForm() {\r\n let nameBox = document.getElementById(\"name_box\").value\r\n let numberBox =\r\n document.getElementById(\"number_box\").value\r\n let addressBox =\r\n document.getElementById(\"address_box\").value\r\n\r\n let savedContact = {\r\n name: nameBox,\r\n number: numberBox,\r\n address: addressBox\r\n }\r\n\r\n\r\n// the line below is calling the contactCollection function from contactCollection.js file and performing the addContact function while passing the argument savedContact. That will ulitimately post data to database.\r\n contactCollection.addContact(savedContact)\r\n}", "function addModule(module) {\n var newIndex = modules.push(module) - 1,\n $host;\n // add base functions and properties\n module._values = {};\n module.isRunning = false;\n module.val = function (name, newValue, source) {\n if (!source) source = module;\n if (newValue === undefined) return this._values[name];\n\n this._values[name] = newValue;\n $(module).trigger(\"valueChanged\", { name: name, value: newValue, source: source });\n return newValue;\n }\n\n module.getValues = function () {\n return this._values;\n }\n moduleIDIndex[module.id] = newIndex;\n\n // create ui\n $('#moduleContainer').append(\n $host =\n $('<div />', { id: module.id, 'class': 'moduleContent' })\n .css('display', 'none')\n );\n $('#changeModuleMenu .menuItemsPanel').append(\n $('<li>' + module.name + '</li>').click(function () {\n $(this).parent().hide();\n showModule.call(this, module);\n }));\n\n // add any saved values\n if (my.startupModuleValues[module.id]) {\n var modValues = my.startupModuleValues[module.id];\n for (var i in modValues) {\n // we don't want to trigger onValueChanged since the module isn't initialized.\n module._values[i] = modValues[i];\n }\n }\n \n module.init($host);\n }", "_onRestoreDB() {\n this.modulesCollection = this._db.getCollection(this.modulesCollectionName);\n if (!this.modulesCollection) {\n this.modulesCollection = this._db.addCollection(this.modulesCollectionName);\n this._dbInitialized = true;\n } else {\n\n const parseAndRegister = (m) => {\n if (typeof m === 'string') {\n m = JSON.parse(m);\n }\n return this.register(m);\n };\n\n Promise.all(this.modulesCollection.find().map(parseAndRegister))\n .then(() => {\n logger.debug(`Database loaded with, ${this.modulesCollection.count()} modules`);\n this._dbInitialized = true;\n });\n }\n }", "async save() {\n\t\tconst title = this.title;\n\n\t\tif (!title) {\n\t\t\twinston.error(`Error ingesting Collection ${this.repoLocal}`);\n\t\t\treturn null;\n\t\t}\n\n\t\tconsole.log(this.urn);\n\n\t\tconst collection = await Collection.create({\n\t\t\ttitle: title.slice(0, 250),\n\t\t\turn: this.urn,\n\t\t\trepository: this.repoRemote,\n\t\t});\n\n\t\tfor (let i = 0; i < this.textGroups.length; i += 1) {\n\t\t\tawait this.textGroups[i].generateInventory(collection); // eslint-disable-line\n\t\t}\n\t}", "function addProduct() {\n var currentHttpParameterMap = request.httpParameterMap;\n\n\n\n var Product = null;\n\n if (Product === null) {\n if (currentHttpParameterMap.pid.stringValue !== null) {\n var ProductID = currentHttpParameterMap.pid.stringValue;\n\n var GetProductResult = new Pipelet('GetProduct').execute({\n ProductID: ProductID\n });\n if (GetProductResult.result === PIPELET_ERROR) {\n return {\n error: true\n };\n }\n Product = GetProductResult.Product;\n }\n }\n\n\n var GetProductListsResult = new Pipelet('GetProductLists').execute({\n Customer: customer,\n Type: ProductList.TYPE_GIFT_REGISTRY\n });\n var ProductLists = GetProductListsResult.ProductLists;\n\n //var ProductList = null;\n\n if (typeof(ProductLists) !== 'undefined' && ProductLists !== null && !ProductLists.isEmpty()) {\n if (ProductLists.size() === 1) {\n ProductList = ProductLists.iterator().next();\n } else {\n selectOne();\n return;\n }\n } else {\n createOne();\n return;\n }\n\n\n //var UpdateProductOptionSelectionsResult = new Pipelet('UpdateProductOptionSelections').execute({\n // Product: Product\n //});\n\n\n //var ProductOptionModel = UpdateProductOptionSelectionsResult.ProductOptionModel;\n\n\n // var AddProductToProductListResult = new Pipelet('AddProductToProductList', {\n // DisallowRepeats: true\n // }).execute({\n // Product: Product,\n // ProductList: ProductList,\n // Quantity: currentHttpParameterMap.Quantity.getIntValue(),\n // ProductOptionModel: ProductOptionModel,\n // Priority: 2\n // });\n\n\n showRegistry({\n ProductList: ProductList\n });\n return;\n}", "function add(body) {\n return DB(\"resources\").insert(body);\n // .then(id => {\n // findById(id);\n // });\n}", "async function addRoutine(req, res) {\n const db = req.app.get(\"db\");\n\n const {\n userId,\n skinType,\n time,\n firstCleanser,\n secondCleanser,\n exfoliator,\n toner,\n essence,\n eyeSerum,\n eyeMoisturizer,\n faceSerum,\n faceMoisturizer,\n neckSerum,\n neckMoisturizer,\n mask,\n sunscreen,\n note\n } = req.body;\n\n const addedRoutine = await db.routines.addRoutine([\n userId,\n skinType,\n time,\n firstCleanser,\n secondCleanser,\n exfoliator,\n toner,\n essence,\n eyeSerum,\n eyeMoisturizer,\n faceSerum,\n faceMoisturizer,\n neckSerum,\n neckMoisturizer,\n mask,\n sunscreen,\n note\n ]);\n if (db) {\n res.status(200).json(addedRoutine);\n }\n}", "add(title, description = \"\", template = 100, enableContentTypes = false, additionalSettings = {}) {\r\n const addSettings = extend({\r\n \"AllowContentTypes\": enableContentTypes,\r\n \"BaseTemplate\": template,\r\n \"ContentTypesEnabled\": enableContentTypes,\r\n \"Description\": description,\r\n \"Title\": title,\r\n \"__metadata\": { \"type\": \"SP.List\" },\r\n }, additionalSettings);\r\n return this.postCore({ body: jsS(addSettings) }).then((data) => {\r\n return { data: data, list: this.getByTitle(addSettings.Title) };\r\n });\r\n }", "function addProject() {\n const inputname = document.querySelector('.project_name_input').value; //get input data from dom\n if (inputname == '')\n return;\n data.projects.push(new project(inputname, data.projects.length)) //add new project with name and id to list\n\n }", "function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }", "function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }" ]
[ "0.69070256", "0.6625662", "0.6408294", "0.6319275", "0.6271609", "0.5992774", "0.59464574", "0.58238715", "0.57643443", "0.5700712", "0.5631341", "0.56060815", "0.5589861", "0.5577479", "0.5543143", "0.54741263", "0.5458044", "0.54475826", "0.54274565", "0.54143834", "0.5408807", "0.53791624", "0.5370691", "0.53652924", "0.5351806", "0.5340384", "0.53248024", "0.530509", "0.5286065", "0.5286065" ]
0.72655445
1
Function name: update module Author: Reccion, Jeremy Date Modified: 2018/04/02 Description: updates the name of the module Parameter(s): Object. Includes: _id: required. string type name: required. string type Return: Promise
function updateModule(updateModule){ var deferred = Q.defer(); updateModule.name = updateModule.name.toLowerCase(); //fields array should not be editable when using this function. therefore, delete it from input delete updateModule.fields; db.modules.find({$or: [ {_id: mongo.helper.toObjectID(updateModule._id)}, {name: updateModule.name} ]}).toArray(function(err, modules){ if(err){ deferred.reject(err); } else if(modules.length == 0){ deferred.reject(notFound); } //vali inputs, no other document have the same name else if(modules.length == 1){ var oldModule = modules[0]; //rename if old & new names are different if(oldModule.name != updateModule.name){ db.bind(oldModule.name); db[oldModule.name].rename(updateModule.name, function(err){ if(err){ deferred.reject(err); } else{ update(); } }); } //go straight to update else{ update(); } } //another module document with the same name exists else{ deferred.reject(exists); } }); //updates the document in the 'modules' collection function update(){ //create another object and copy. then delete the '_id' property of the new copy var forUpdate = {}; Object.assign(forUpdate, updateModule); delete forUpdate._id; db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){ if(err){ deferred.reject(err); } else{ deferred.resolve(); } }); } return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n //check if the name of the selected module has not changed\n db.modules.findOne({_id: mongo.helper.toObjectID(updateModule._id)}, function(err, aModule){\n if(err){\n deferred.reject(err);\n }\n else if(aModule){\n //if names are different, renaming the collection must be executed, then proceed to update\n if(aModule.name != updateModule.name){\n db.bind(aModule.name);\n db[aModule.name].rename(updateModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n update();\n }\n });\n }\n }\n else{\n update();\n }\n });\n\n //updates the document in the 'modules' collection\n function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n\n return deferred.promise;\n}", "function changeModName() {\n //console.log('Modname' + modName);\n db.collection('modules')\n .doc(module.value)\n .update({\n 'module.name': modName,\n })\n .then(function () {\n console.log('modName updated successfully');\n history.push('/success');\n });\n }", "async update({request, response, params: {id}}) {\n\n const name = await nameService.findNameBy('id', id);\n\n if (name) {\n name.status = request.input('status')\n console.log(name)\n name.save()\n\n return response.status(200).send({\n status: 200,\n message: \"name updated\"\n })\n }\n else{\n return response.status(400).send({\n status: 400,\n message: \"invalid name id\"\n })\n }\n }", "function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }", "function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }", "static async update(req, res) {\n \n try {\n const { id } = req.params\n const { changeName } = req.body\n\n const updateStudent = await studentService.updateById(id,{\n name:changeName\n })\n\n // create response\n const response = {\n success: true,\n data: {\n student: updateStudent\n }\n }\n res.send(response)\n } catch(e) {\n res.send(e)\n }\n }", "function updateModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n fieldObject.id = new ObjectID(fieldObject.id);\n \n db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n console.log(fieldObject);\n\n service.getModuleByName(moduleName).then(function(aModule){ \n //use array.filter() to get the duplicate fields\n var duplicateFields = aModule.fields.filter(function(field){\n //lesson learned: use toString() in id\n return field.id.toString() == fieldObject.id.toString() || field.name == fieldObject.name;\n });\n \n if(duplicateFields.length == 0){\n deferred.reject(notFound);\n }\n //valid inputs\n else if(duplicateFields.length == 1){\n //this is to ensure that the field is inside the specific module (in case of improper input parameters)\n\n fieldObject.id = new ObjectID(fieldObject.id);\n\n if(duplicateFields[0].id.toString() == fieldObject.id.toString()){\n db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n console.log(writeResult.result);\n deferred.resolve();\n }\n });\n }\n //the only element has the same name but is different id, therefore, not inside the module document\n else{\n deferred.reject(notFound);\n }\n }\n else{\n deferred.reject(exists);\n }\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function updateModuleDoc(moduleName, updateDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateDoc);\n delete forUpdate._id;\n\n db[moduleName].update({_id: mongo.helper.toObjectID(updateDoc._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "async update({ params, request, response }) {\n }", "async update({ params, request, response }) {}", "async update ({ params, request, response }) {\n }", "async update ({ params, request, response }) {\n }", "async update ({ params, request, response }) {\n }", "async update ({ params, request, response }) {\n }", "async update ({ params, request, response }) {\n }", "async update ({ params, request, response }) {\n }", "async update ({ params, request, response }) {\n }", "async update({ params, request, response }) {\n }", "async function update(name, id) {\n try {\n // Arrange\n const query = \"UPDATE actors SET name = ? WHERE id = ?\";\n const template = `%s Updated: \"name\" to %s at \"index\" %s`;\n const question = [{\n type: \"confirm\",\n name: \"restart\",\n message: \"Would you like to update someone else?\"\n }];\n​\n // Action\n // Query to update the name of the selected actor\n const { message } = await queryAsync(query, [name,id]);\n // --start Confirms if the user wants to update another actor's name\n const { restart } = await inquirer.prompt(question);\n​\n if (restart) {\n // Restarts the app\n return init();\n } else {\n // Logs the most recently updated value and ends the app\n console.log(template, message, name, id);\n process.exit();\n }\n // --end Confirms if the user wants to update another actor's name\n } catch(err) {\n throw err;\n }\n}", "function updateModuleDoc(moduleName, updateDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n service.findDuplicateDoc(moduleName, updateDoc).then(function(){\n db.bind(moduleName);\n \n //convert '_id' to ObjectID\n updateDoc._id = new ObjectID(updateDoc._id);\n \n db[moduleName].update({_id: updateDoc._id}, {$set: updateDoc}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n if(writeResult.result.nModified == 0){\n deferred.reject(notFound);\n }\n else{\n deferred.resolve();\n }\n }\n });\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "static updateTaskName(taskId, name='') {\n var updateQueryClause = `UPDATE ${Task.tableName} SET name = ? WHERE id = ? `;\n const params = [name, taskId]\n return this.repository.databaseLayer.executeSql(updateQueryClause, params)\n }", "async function updatedTitle(id, updatedTitle){\n if(!id){\n throw 'You must provide an id'\n }\n let obj = ObjectId(id)\n // var objId = require('mongodb').ObjectID\n // if(!objId.isValid(obj)){\n // throw ` ${objId} is not a proper mongo id`\n // }\n \n if(!updatedTitle){\n throw 'You must provide a title'\n }\n if(typeof updatedTitle != 'string'){\n throw 'Title must be a string'\n }\n \n const recipeCollection = await recipes();\n \n await recipeCollection.updateOne({ _id: obj }, { $set: { title: updatedTitle } });\n return await module.exports.getRecipeById(id);\n\n}", "update(name, code) {\n }", "update_name(_name) {\n this.updateCommon(\"updateName\", { name: _name, weight: -1, target_id: -1, x: -1, y: -1 });\n this.props.updateApp();\n }", "async function updateProduct(productId, name, numUnit, date, lotNumber, sessionId, callback) {\n\tvar updatedProduct = packIntoJson(name, numUnit, date, lotNumber);\n\t//return await productActions.updateProduct(productId, sessionId, updatedProduct);\n\tproductActions.updateProduct(productId, sessionId, updatedProduct, function(res){\n callback(res);\n });\n}", "function updateData(id, newName) {\n const body = {\n 'name': newName\n };\n fetch('http://localhost:3000/events/' + id, {\n method: 'put',\n body: JSON.stringify(body),\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n }).then((json) => {\n // console.table(json);\n getEvent(id);\n });\n }", "updateParameterName(commandId, oldName, newName) {\n this.db\n .get(\"commands\")\n .getById(commandId)\n .get(\"parameters\")\n .find({ name: oldName })\n .assign({ name: newName })\n .write();\n builder.build();\n return this.getCommandForId(commandId);\n }", "renameComponent({ type, path, newId }, fetchParams) {\n const url = `/api/${type}/${path}/rename`;\n const postData = { newId };\n const errorMessage = `Error changing id of ${type} ${path}`;\n return this.post(url, postData, fetchParams, errorMessage)\n .then( response => response.json() );\n }", "editName(id, nameId, updatedName) {\n const horselist = this.getHorselist(id);// getting the correct horselist or racecourse based on the id that was passed into the function\n const horses = horselist.horses;// we getting the horses array from that horselist\n const index = horses.findIndex(name => name.id === nameId);//checking wheather the current name id matches with the name id that has \n //been passed into the editName function. then checks eac name in the array until it finds a match. returns the index of the matching array element\n \n horses[index].title = updatedName.title;// updating the properties of the name object\n horses[index].artist = updatedName.artist;\n horses[index].genre = updatedName.genre;\n horses[index].duration = updatedName.duration;\n }" ]
[ "0.7093112", "0.7071991", "0.68973994", "0.67273706", "0.67273706", "0.6495799", "0.6399463", "0.63616574", "0.6330262", "0.6246438", "0.62095666", "0.6175385", "0.6175385", "0.6175385", "0.6175385", "0.6175385", "0.6175385", "0.6175385", "0.61658496", "0.6108117", "0.61019385", "0.6100636", "0.6069959", "0.60698056", "0.6040906", "0.6035249", "0.6006061", "0.6003076", "0.59688085", "0.5964918" ]
0.7073509
1
Function name: delete module Author: Reccion, Jeremy Date Modified: 2018/04/23 Description: drops the specific collection then remove its document from the 'modules' collection Parameter(s): moduleName: string type Return: Promise
function deleteModule(moduleName){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); //drop the collection db.bind(moduleName); db[moduleName].drop(function(err){ if(err){ if(err.codeName == 'NamespaceNotFound'){ deferred.reject(notFound); } else{ deferred.reject(err); } } else{ //remove document from 'modules' collection db.modules.remove({name: moduleName}, function(err, writeResult){ if(err){ deferred.reject(err); } else{ //n is used to know if the document was removed if(writeResult.result.n == 0){ deferred.reject(notFound); } else{ deferred.resolve(); } } }); } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteModule(id, moduleName){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //drop the collection\n db.bind(moduleName);\n db[moduleName].drop();\n\n //remove document from 'modules' collection\n db.modules.remove({_id: mongo.helper.toObjectID(id)}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function deleteModuleDoc(moduleName, id){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].remove({_id: mongo.helper.toObjectID(id)}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function deleteModuleDoc(moduleName, id){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].remove({_id: mongo.helper.toObjectID(id)}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n //n is used to know if the document was removed\n if(writeResult.result.n == 0){\n deferred.reject(notFound);\n }\n else{\n deferred.resolve();\n }\n }\n });\n\n return deferred.promise;\n}", "function deleteMod() {\n // eslint-disable-next-line no-restricted-globals\n if (\n confirm(\n 'Are you sure you want to delete this module? This cannot be undone.',\n )\n ) {\n db.collection('modules')\n .doc(module.value)\n .delete()\n .then(function () {\n history.push('/success');\n console.log('doc deleted successfully');\n return true;\n });\n } else {\n return false;\n }\n }", "function deleteModuleField(moduleName, fieldID){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n \n db.modules.update({name: moduleName}, {$pull: {fields: {id: mongo.helper.toObjectID(fieldID)}}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function deleteModuleField(moduleName, fieldID){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n \n db.modules.update({name: moduleName}, {$pull: {fields: {id: mongo.helper.toObjectID(fieldID)}}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n if(writeResult.result.nModified == 0){\n deferred.reject(notFound);\n }\n else{\n deferred.resolve();\n }\n }\n });\n\n return deferred.promise;\n}", "_delete (moduleName){\n delete this._dynamicParentsMap[moduleName];\n // SystemJs doesn't do this?\n delete this._system.loads[moduleName];\n // Do regular delete\n return this._systemDelete.apply(this._system, arguments);\n }", "deleteModule(moduleId, passphrase) {\n return this.httpService({\n method: 'DELETE',\n url: `${this.rootURL}microAnalytics?microAnalyticsId=${moduleId}`,\n headers: {Authorization: `basic ${passphrase}`}\n });\n }", "removeModule() {\n this.props.firebase.database.ref('users')\n .child(this.props.firebase.auth.currentUser.uid)\n .child('appointments')\n .child('appointmentsArr')\n .once('value', snapshot => {\n snapshot.forEach(child => {\n console.log(child.val().title)\n if (child.val().title === this.props.module) {\n child.ref.remove();\n }\n })\n });\n this.props.firebase.database.ref('users')\n .child(this.props.firebase.auth.currentUser.uid)\n .child('appointments')\n .child('modsData')\n .child(this.props.module)\n .remove()\n }", "removeModule (path) {\n if (typeof path === 'string') path = [path]\n\n delete this.registeredModules[path.join('/')]\n\n if (_utils_shared_data__WEBPACK_IMPORTED_MODULE_1__[\"default\"].recordVuex) {\n this.addMutation(`Unregister module: ${path.join('/')}`, {\n path\n }, {\n unregisterModule: true\n })\n }\n }", "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n //check if the name of the selected module has not changed\n db.modules.findOne({_id: mongo.helper.toObjectID(updateModule._id)}, function(err, aModule){\n if(err){\n deferred.reject(err);\n }\n else if(aModule){\n //if names are different, renaming the collection must be executed, then proceed to update\n if(aModule.name != updateModule.name){\n db.bind(aModule.name);\n db[aModule.name].rename(updateModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n update();\n }\n });\n }\n }\n else{\n update();\n }\n });\n\n //updates the document in the 'modules' collection\n function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n\n return deferred.promise;\n}", "function uninstallModule(options, cli, next) {\n\n // Get the module name\n var moduleName = options[1];\n if (!moduleName) {\n next(new Error(\"You must specify a module name (@version is ignored).\"));\n return;\n }\n\n // Split module / version\n var moduleVersion = moduleName.split('@')[1] || \"\";\n var moduleName = moduleName.split('@')[0];\n\n // Locate the module\n var installedModule = calipso.modules[moduleName];\n var installed = installedModule ? true : false;\n\n // Assume that we want to re-install the dependencies via NPM\n if (installed) {\n\n if (installedModule.type === \"core\") {\n next(new Error(\"You should not delete core modules unless you really know what you are doing!\"));\n return;\n }\n\n // This can't be messed with, as it is populated based on pre-existing path type/name.\n var path = __dirname + \"/../modules/\" + installedModule.type + \"/\" + installedModule.name;\n\n confirm('This will remove the module completely from the site and cannot be undone, continue? '.red.bold, function (ok) {\n if (ok) {\n process.stdin.destroy();\n console.log(\"Removing \" + installedModule.name.green.bold + \", please wait ...\");\n exec('rm -rf ' + path, { timeout:5000, cwd:__dirname }, function (error, stdout, stderr) {\n\n var err = ((error ? error.message : '') || stderr);\n\n if (!err) {\n console.log(stdout + \"Module \" + installedModule.name.green.bold + \" uninstalled completely.\");\n next();\n } else {\n next(new Error(err));\n }\n });\n\n } else {\n next();\n }\n });\n\n } else {\n\n console.log(\"Module \" + moduleName.green.bold + \" is not installed.\");\n next();\n\n }\n\n}", "static async deleteCollection(req, res) {\n const { collection } = req.params;\n await deleteItem({ collection });\n return res.status(404).json({ message: `collection '${collection}' deleted` });\n }", "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n db.modules.find({$or: [\n {_id: mongo.helper.toObjectID(updateModule._id)},\n {name: updateModule.name}\n ]}).toArray(function(err, modules){\n if(err){\n deferred.reject(err);\n }\n else if(modules.length == 0){\n deferred.reject(notFound);\n }\n //vali inputs, no other document have the same name\n else if(modules.length == 1){\n var oldModule = modules[0];\n \n //rename if old & new names are different\n if(oldModule.name != updateModule.name){\n db.bind(oldModule.name);\n db[oldModule.name].rename(updateModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n update();\n }\n });\n }\n //go straight to update\n else{\n update();\n }\n }\n //another module document with the same name exists\n else{\n deferred.reject(exists);\n }\n }); \n\n //updates the document in the 'modules' collection\n function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n\n return deferred.promise;\n}", "async function removeReviewForFreelancer(db, freelancerId) {\n try {\n // let db = await MongoUtil.connect(mongoUrl, dbName);\n let result = await db.collection(collectionName).deleteMany({\n 'for': ObjectId(freelancerId)\n });\n return result\n } catch(e) {\n errorMsg = `\n Error encountered when removing data from DB.\n Collection: ${collectionName}, Freelancer Id: ${freelancerId}, Error: ${e}\n `\n console.error(errorMsg)\n throw new MongoUtil.DBError(errorMsg);\n }\n}", "function updateModuleDoc(moduleName, updateDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateDoc);\n delete forUpdate._id;\n\n db[moduleName].update({_id: mongo.helper.toObjectID(updateDoc._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "async function removeCourse(id) {\n // const result = await Course.deleteOne({ _id: id });\n // const result = await Course.deleteMany({ _id: id });\n const course = await Course.findByIdAndRemove(id);\n // console.log(result);\n console.log(course);\n}", "async function remove(db, nam, o) {\n var o = _.merge({}, OPTIONS, o), db = db||o.db;\n db = typeof db==='string'? await setup(db, o):db;\n var nam = nam||o.input||(await getUpload(db, o)).title;\n if(o.log) console.log('-remove:', nam);\n await db.run('DELETE FROM \"pages\" WHERE \"title\" = ?', nam);\n return nam;\n}", "_deleteDocument(req, res, next) {\n let documentId = req.params.id\n this.engine.deleteDocument(documentId, function(err, result) {\n if (err) return next(err)\n res.json(result)\n })\n }", "async deleteProduct(req, res, next) {\n console.log(\"inside delete function\");\n let document;\n try {\n document = await ProductDB.findOneAndDelete({ _id: req.params.id });\n // console.log(document.image);\n fs.unlink(document.image, (error) => {\n if (error) {\n return next(error);\n }\n });\n } catch (error) {\n return next(error);\n }\n res.json({ document });\n }", "function deleteData(req, res) {\n var p = config.getDB().then(function(db){\n db.collection(\"chartinsert\").remove({_id:ObjectID(req.params.id)},function(err,data){\n if(err) res.status(500).json({success:false,message:'something went wrong.'})\n else{\n // console.log(data)\n res.status(200).json({success:true, message:'deleted successfully'})\n }\n })\n })\n}", "async function removeCourse(id) {\n //return await Course.deleteOne({_id:id});\n\n //delete 1st one\n //Course.deleteOne({isPublish : false});\n //delete many\n //Course.deleteMany(id);\n const deletedCourse = await Course.findByIdAndRemove(id);\n return deletedCourse;\n //if specify delete id is not in db, it will return null, otherwise return the document b4 deleted.\n}", "deleteCollection(name) {\n return new Promise((resolve, reject) => {\n chrome.storage.sync.remove(name, () => {\n this.config.collections[this.database].splice(this.config.collections[this.database].indexOf(name), 1);\n resolve(true);\n });\n });\n }", "delete(req, res) {\n // delete only allowed for authorised user of their own documents or admin\n const isPermittedUser =\n req.decoded.role === 'Administrator' || req.decoded._id === req.params.id;\n\n if (!isPermittedUser) {\n return res.json(403, {\n message: 'Forbidden to delete this document.',\n });\n }\n\n return Document.findOneAndRemove({ _id: req.params.id })\n .then((document) => res.status(200).json({ message: document }))\n .catch((err) => res.status(500).json({ message: err }));\n }", "function deleteFromLiveMongo(request) {\n return new Promise(async function (resolve, reject) {\n try {\n var database = country_wise_database[request.country_code];\n var FP_ID = new ObjectId(request.fp_id);\n var local_database = await MongoClient.connect(liveDbUrl, { connectTimeoutMS: 90000, socketTimeoutMS: 90000 });\n\n let D_B = (request._index == 'dp_projects') ? MongoSettings.live.projects_database : MongoSettings.live.business_database;\n let collection = (request._type == 'projects') ? MongoSettings.live.projects_collection : MongoSettings.live.business_collection;\n\n var dbo = local_database.db(D_B);\n var query = { _id: FP_ID };\n\n var res = await dbo.collection(collection).remove(query);\n\n if (res.hasOwnProperty('result')) {\n //res.result.n\n let result = {\n type: \"LiveMongo\",\n status: 1,\n message: \"Delete listing from Live Mongo\"\n }\n resolve(result);\n\n } else {\n let result = {\n type: \"LiveMongo\",\n status: 0,\n message: \"Listing not deleted Live Mongo\"\n }\n resolve(result);\n }\n\n } catch (E) {\n let result = {\n type: \"LiveMongo\",\n status: 0,\n message: E.message\n }\n reject(result);\n }\n\n });\n}", "delModuleItem(state, idx) {\n const { imported } = state.info.basic\n // const tag = state.remains[imported[idx] - 1].tag\n // state.info[tag].forEach(v => (v.ref = false))\n imported.splice(idx, 1)\n }", "function deleteDocument(collectionName, id) {\n var collection = data[collectionName];\n if (!collection[id]) {\n throw new Error(`Collection ${collectionName} lacks an item with id ${id}!`);\n }\n delete collection[id];\n updated = true;\n}", "function deleteDocument(collectionName, id) {\n var collection = data[collectionName];\n if (!collection[id]) {\n throw new Error(`Collection ${collectionName} lacks an item with id ${id}!`);\n }\n delete collection[id];\n updated = true;\n}", "function deleteDocument(collectionName, id) {\n var collection = data[collectionName];\n if (!collection[id]) {\n throw new Error(`Collection ${collectionName} lacks an item with id ${id}!`);\n }\n delete collection[id];\n updated = true;\n}", "async deleteLesson(body){\n let gymId = body.gymId;\n let lesson_id = body.lesson_id;\n \n console.log(lesson_id)\n return Gym.findByIdAndUpdate(\n {_id: gymId},\n { $pull: { lessons: lesson_id } });\n }" ]
[ "0.84370935", "0.7958818", "0.79092586", "0.7097685", "0.6860468", "0.67647773", "0.662002", "0.6473157", "0.62492627", "0.58944094", "0.5845492", "0.5764855", "0.57641274", "0.573505", "0.57172936", "0.5634599", "0.5621253", "0.56094986", "0.55869454", "0.5581452", "0.55264115", "0.5516268", "0.55095196", "0.5491623", "0.5455897", "0.5441675", "0.5439528", "0.5439528", "0.5439528", "0.54263014" ]
0.87686384
0
Function name: add module field Author: Reccion, Jeremy Date Modified: 2018/04/20 Description: insert a new field object to the specific module's fields array Parameter(s): moduleName: required. string type fieldObject: required. object type. includes: name: required. string type unique: required. boolean type Return: Promise
function addModuleField(moduleName, fieldObject){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); //create a new objectID to used as query for updates and delete fieldObject.id = new ObjectID(); //the query searches for the module name that do not have the inputted field name //this is to avoid pushing same field names on the 'fields' array of the specified module //writeResult will determine if the update was successful or not (i.e. writeResult.result.nModified) db.modules.update({name: moduleName, fields: {$not: {$elemMatch: {name: fieldObject.name}}}}, {$push: {fields: fieldObject}}, function(err, writeResult){ if(err){ deferred.reject(err); } else{ //console.log(writeResult.result); //check the status of the update, if it failed, it means that there is an existing field name if(writeResult.result.nModified == 0){ deferred.reject(exists); } else{ deferred.resolve(); } } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n db.modules.update({name: moduleName}, {$push: {fields: fieldObject}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n console.log(fieldObject);\n\n service.getModuleByName(moduleName).then(function(aModule){ \n //use array.filter() to get the duplicate fields\n var duplicateFields = aModule.fields.filter(function(field){\n //lesson learned: use toString() in id\n return field.id.toString() == fieldObject.id.toString() || field.name == fieldObject.name;\n });\n \n if(duplicateFields.length == 0){\n deferred.reject(notFound);\n }\n //valid inputs\n else if(duplicateFields.length == 1){\n //this is to ensure that the field is inside the specific module (in case of improper input parameters)\n\n fieldObject.id = new ObjectID(fieldObject.id);\n\n if(duplicateFields[0].id.toString() == fieldObject.id.toString()){\n db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n console.log(writeResult.result);\n deferred.resolve();\n }\n });\n }\n //the only element has the same name but is different id, therefore, not inside the module document\n else{\n deferred.reject(notFound);\n }\n }\n else{\n deferred.reject(exists);\n }\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function addField(fieldIndex){\n if(!fieldIndex){\n return;\n }\n var fieldTypes = [\n //Single Line Text Field\n {\"label\": \"New Text Field\", \"type\": \"TEXT\", \"placeholder\": \"New Field\"},\n //Date Field\n {\"label\": \"New Date Field\", \"type\": \"DATE\"},\n //DropDownField\n {\"label\": \"New Dropdown\", \"type\": \"OPTIONS\", \"options\": [\n {\"label\": \"Option 1\", \"value\": \"OPTION_1\"},\n {\"label\": \"Option 2\", \"value\": \"OPTION_2\"},\n {\"label\": \"Option 3\", \"value\": \"OPTION_3\"}\n ]},\n //Checkboxes Field\n {\"label\": \"New Checkboxes\", \"type\": \"CHECKBOXES\", \"options\": [\n {\"label\": \"Option A\", \"value\": \"OPTION_A\"},\n {\"label\": \"Option B\", \"value\": \"OPTION_B\"},\n {\"label\": \"Option C\", \"value\": \"OPTION_C\"}\n ]},\n //Radio Buttons Field\n {\"label\": \"New Radio Buttons\", \"type\": \"RADIOS\", \"options\": [\n {\"label\": \"Option X\", \"value\": \"OPTION_X\"},\n {\"label\": \"Option Y\", \"value\": \"OPTION_Y\"},\n {\"label\": \"Option Z\", \"value\": \"OPTION_Z\"}\n ]},\n //Multi Line Text Field\n {\"label\": \"New Text Field\", \"type\": \"TEXTAREA\", \"placeholder\": \"New Field\"},\n //Email Text field\n {\"label\": \"New Email Field\", \"type\": \"EMAIL\", \"placeholder\": \"New Field\"},\n //Password field\n {\"label\": \"New Password Field\", \"type\": \"PASSWORD\", \"placeholder\": \"New Field\"}\n\n ];\n\n FieldService\n .createFieldForForm(vm.formId, fieldTypes[fieldIndex])\n .then(function (response) {\n vm.fields = response.data;\n },\n function (error) {\n console.log(error.statusText);\n });\n\n\n }", "function updateModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n fieldObject.id = new ObjectID(fieldObject.id);\n \n db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "add(fields) {\r\n\t\t\tconst addField = (path, options) => {\r\n\t\t\t\tif (obsidian.Field === options || obsidian.Field === options.type) {\r\n\t\t\t\t\tthrow new Error(\"The field type must be a child class of obsidian.Field\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Check if the options param is a Field\r\n\t\t\t\tif (obsidian.Field.isPrototypeOf(options)) {\r\n\t\t\t\t\toptions = {type: options};\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Make sure the type field is a Field\r\n\t\t\t\tif (!obsidian.Field.isPrototypeOf(options.type)) {\r\n\t\t\t\t\tthrow new Error(\"The type parameter must be an instance of the Field class\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.schemaFields[path] = new options.type(this, path, options);\r\n\t\t\t}\r\n\r\n\t\t\tconst processFieldDefinition = (definition, prefix = \"\") => {\r\n\t\t\t\tObject.keys(definition).forEach((key) => {\r\n\t\t\t\t\tconst obj = definition[key];\r\n\r\n\t\t\t\t\tif (!obj) {\r\n\t\t\t\t\t\tthrow new Error(`Invalid value for schema path ${prefix+key} in ${this.listName}`);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (isPlainObject(obj) && !obj.type && Object.keys(obj).length) {\r\n\t\t\t\t\t\t// obj is a nested field\r\n\t\t\t\t\t\tprocessFieldDefinition(obj, prefix + key + \".\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\taddField(prefix + key, obj);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t// Recursivly process the field definitions\r\n\t\t\tprocessFieldDefinition(fields);\r\n\t\t}", "function updateFieldArray(moduleName, fieldArray){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //need to convert each 'id' property to an ObjectID\n for(var i = 0; i < fieldArray.length; i++){\n fieldArray[i].id = new ObjectID(fieldArray[i].id);\n }\n \n\n db.modules.update({name: moduleName}, {$set: {fields: fieldArray}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateFieldArray(moduleName, fieldArray){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.modules.update({name: moduleName}, {$set: {fields: fieldArray}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function addModule(newModule){\n //imitate angular promise. start by initializing this\n var deferred = Q.defer();\n\n newModule.name = newModule.name.toLowerCase();\n\n //check if there is an existing module\n db.modules.findOne({name: newModule.name}, function(err, aModule){\n if(err){\n deferred.reject(err);\n }\n //already exists\n else if(aModule){\n deferred.reject(exists);\n }\n else{\n //unique, so proceed\n //create table first before adding a new document to 'modules' collection (not necessary?)\n db.createCollection(newModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n //initialize fields property as empty array if there are none in the input\n if(newModule.fields == undefined){\n newModule.fields = [];\n }\n\n db.modules.insert(newModule, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n });\n }\n \n });\n \n //return the promise along with either resolve or reject\n return deferred.promise;\n}", "function addModule(newModule){\n //imitate angular promise. start by initializing this\n var deferred = Q.defer();\n\n newModule.name = newModule.name.toLowerCase();\n\n //check if there is an existing module\n db.modules.findOne({name: newModule.name}, function(err, aModule){\n if(err){\n deferred.reject(err);\n }\n //already exists\n else if(aModule){\n deferred.reject(exists);\n }\n else{\n //unique, so proceed\n //create table first before adding a new document to 'modules' collection (not necessary?)\n db.createCollection(newModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n //initialize fields property as empty array if there are none in the input\n if(newModule.fields == undefined){\n newModule.fields = [];\n }\n\n db.modules.insert(newModule, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n });\n }\n \n });\n \n //return the promise along with either resolve or reject\n return deferred.promise;\n}", "function addModuleDoc(moduleName, newDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].insert(newDoc, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function addModuleDoc(moduleName, newDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n service.findDuplicateDoc(moduleName, newDoc).then(function(){\n db.bind(moduleName);\n\n db[moduleName].insert(newDoc, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function addField(fieldName,value) {\n\tenv.log(\"setting field: \"+fieldName+\" value: \"+value);\n\tenv.addField(fieldName,value);\n}", "add(title, fieldType, properties) {\r\n const postBody = jsS(Object.assign(metadata(fieldType), {\r\n \"Title\": title,\r\n }, properties));\r\n return this.clone(Fields_1, null).postCore({ body: postBody }).then((data) => {\r\n return {\r\n data: data,\r\n field: this.getById(data.Id),\r\n };\r\n });\r\n }", "static addFieldCo(paylod) {\n return {\n type: FieldAction.ADDFIELD,\n payload\n }\n }", "addField(classId, fieldId, data) {\n this.fields[fieldId] = new FieldData(data);\n this.classes[classId].addField(fieldId);\n }", "setModuleName(field, module) {\n field.moduleName = field.moduleName || (module && module.__meta.name);\n if ((field.type === 'array') || (field.type === 'object')) {\n _.each(field.schema || [], function(subfield) {\n self.setModuleName(subfield, module);\n });\n }\n }", "addFieldValue() {\n this.add = this.add + 1;\n this.fieldArray.push(this.newAttribute);\n this.newAttribute = {};\n console.log(this.fieldArray);\n }", "addField(name, value) {\n this.manifest[name] = value;\n }", "addField(fieldArgs) {\n const formGroup = document.createElement(\"div\");\n const field = document.createElement(fieldArgs.type);\n\n formGroup.className = \"ms-form-group\";\n formGroup.id = `${fieldArgs.id}-group`;\n field.id = fieldArgs.id;\n field.placeholder = fieldArgs.placeholder;\n if (fieldArgs.rows) field.rows = fieldArgs.rows;\n\n formGroup.appendChild(field);\n this.form.appendChild(formGroup);\n }", "function addModuleToPipeline(moduleID, moduleName){\n\n var module_name = ''\n var documentation = ''\n var moduleSourceCode_settings = ''\n var moduleSourceCode_main = ''\n var moduleSourceCode_html = ''\n\n $.ajax({\n type: \"POST\",\n cache: false,\n url: \"/get_module_details\",\n data: 'p_module_key=' + moduleName,\n success: function (option) {\n //alert(\"@ success\");\n module_name = option.module_name\n documentation = option.documentation\n moduleSourceCode_settings = option.moduleSourceCode_settings\n moduleSourceCode_main = option.moduleSourceCode_main\n moduleSourceCode_html = option.moduleSourceCode_html\n user_role = option.user_role\n\n user_role_based_edit = ''\n if (user_role == 'image_researcher') {\n user_role_based_edit = '| <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"btn_edit_code\"> Edit </a> | <a style=\"font-size:12px;color:#000000;\" href=\"#\" > Contact Author </a>';\n }\n\n //Parse the givn XML for tool definition\n var xmlDoc = $.parseXML( moduleSourceCode_html );\n var $xml_tool_definition = $(xmlDoc);\n\n //the tool configuration.\n //TODO: add the input port info.\n var tool_configs = $xml_tool_definition.find(\"toolConfigurations\");\n tool_configs = tool_configs.html();\n\n\n\n var tool_documentation = $xml_tool_definition.find(\"toolDocumentation\");\n tool_documentation = tool_documentation.html();\n\n\n var ioInformation = '';\n\n var $toolInput = $xml_tool_definition.find(\"toolInput\");\n\n $toolInput.each(function(){\n\n var label = $(this).find('label').text(),\n dataFormat = $(this).find('dataFormat').text(),\n referenceVariable = $(this).find('referenceVariable').text();\n\n ioInformation += '<input type=\"text\" style=\"display:none;\" class=\"setting_param module_input '+ referenceVariable + '\" ' + ' size=\"45\"/>';\n\n\n });\n\n\n var $toolOutput = $xml_tool_definition.find(\"toolOutput\");\n\n $toolOutput.each(function(){\n\n var label = $(this).find('label').text(),\n dataFormat = $(this).find('dataFormat').text(),\n referenceVariable = $(this).find('referenceVariable').text();\n\n //var thisPortOutput = 'module_id_' + moduleID + '_' + referenceVariable+'.' + dataFormat;\n //var thisPortOutputPath = referenceVariable + '=\"' + thisPortOutput + '\"';\n\n ioInformation += '<input type=\"text\" style=\"display:none;\" class=\"setting_param module_output '+ referenceVariable + '\" size=\"45\"/>';\n\n\n });\n\n\n\n\n\n\n\n//Parse the givn XML\n//var xmlDoc = $.parseXML( xml );\n\n//var $xml = $(xmlDoc);\n\n // Find Person Tag\n//var $person = $xml.find(\"toolConfigurations\");\n\n\n //append new module to the pipeline...\n $(\"#img_processing_screen\").append(\n '<div style=\"background-color:#EEE;width:100%;display:none;\" class=\"module\" id=\"module_id_'+ moduleID +'\">' +\n\n '<!-- Documentation -->' +\n '<div style=\"margin:10px;font-size:17px;color:#000000;\">' +\n ' ' + module_name + ' (Module ' + moduleID + ')'+ '<hr/>' +\n ' Documentation: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"documentation_show_hide\">(Show/Hide)</a>' +\n '<div class=\"documentation\" style=\"background-color:#DDDDDD;display:none;font-size:14px;\">' + tool_documentation + '</div>' +\n '</div>' +\n\n\n '<!-- Settings -->' +\n '<div style=\"margin:10px;font-size:17px;color:#000000;\">' +\n ' Settings: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"settings_show_hide\">(Show/Hide)</a>' +\n ' <div class=\"settings\" style=\"background-color:#DDDDDD;font-size:14px;\">' + tool_configs + '<br/>' + ioInformation +\n '<input type=\"hidden\" class=\"setting_param \" size=\"45\" id=\"module_id_'+ moduleID +'_output_destination\"/>'+\n '</div>' +\n '</div>' +\n\n\n '<div style=\"margin:10px;font-size:17px;color:#000000;\" class=\"setting_section\">' +\n ' <a style=\"display:none;font-size:12px;color:#000000;\" href=\"#\" class=\"code_show_hide\">(Show/Hide)</a>' + user_role_based_edit +\n\n ' <div class=\"edit_code\" style=\"background-color:#888888;font-size:14px;display:none;\">' +\n ' <textarea rows=7 cols=150 class=\"code_settings\">' + moduleSourceCode_settings + '</textarea>' +\n ' <p style=\"color:#000000;\">Main Implementation: </p>' +\n ' <textarea rows=10 cols=150>' + moduleSourceCode_main + '</textarea>' +\n '</div>' +\n\n ' <pre style=\"background-color:#333333;width:100%;display:none;\" class=\"pre_highlighted_code\">' + '<code class=\"python highlighted_code\" style=\"display:none;\">' + moduleSourceCode_settings +\n ' ' +\n moduleSourceCode_main + '</code></pre>' +\n\n ' </div>' +\n\n '</div>'\n\n\n );//end of append\n\n\n\n\n\n\n\n\n $(\"#module_id_\"+ moduleID + \"_output_destination\").val(\"output_destination = '/home/ubuntu/Webpage/app_collaborative_sci_workflow/workflow_outputs/test_workflow/Module_\" + moduleID + \"'\").trigger('change');\n\n\n\n\n\n\n\n\n\n\n\n var listOfInputPorts = [];\n var listOfOutputPorts = [];\n\n\n\n //input port definition\n var $toolInput = $xml_tool_definition.find(\"toolInput\");\n\n $toolInput.each(function(){\n\n var label = $(this).find('label').text(),\n dataFormat = $(this).find('dataFormat').text(),\n referenceVariable = $(this).find('referenceVariable').text();\n\n //$(\"#ProfileList\" ).append('<li>' +label+ ' - ' +dataFormat+ ' - ' + idn +'</li>');\n\n var aNewInputPort = makePort(dataFormat,referenceVariable,true);\n listOfInputPorts.push(aNewInputPort);\n\n\n\n var thisPortInput = 'module_id_' + moduleID + '_NO_INPUT_SOURCE_SELECTED_.' + dataFormat;\n thisPortInput = referenceVariable + '=\"' + WORKFLOW_OUTPUTS_PATH + THIS_WORKFLOW_NAME + '/' +thisPortInput + '\"';\n\n $(\"#module_id_\"+moduleID + ' .' + referenceVariable).val(thisPortInput).trigger('change');\n\n });\n\n\n\n\n\n //output port definition\n var $toolOutput = $xml_tool_definition.find(\"toolOutput\");\n\n $toolOutput.each(function(){\n\n var label = $(this).find('label').text(),\n dataFormat = $(this).find('dataFormat').text(),\n referenceVariable = $(this).find('referenceVariable').text();\n\n //$(\"#ProfileList\" ).append('<li>' +label+ ' - ' +dataFormat+ ' - ' + idn +'</li>');\n\n var aNewOutputPort = makePort(dataFormat,referenceVariable,false);\n listOfOutputPorts.push(aNewOutputPort);\n\n\n var thisPortOutput = 'module_id_' + moduleID + '_' + referenceVariable+'.' + dataFormat;\n thisPortOutput = referenceVariable + '=\"' + WORKFLOW_OUTPUTS_PATH + THIS_WORKFLOW_NAME + '/' +thisPortOutput + '\"';\n\n $(\"#module_id_\"+moduleID + ' .' + referenceVariable).val(thisPortOutput).trigger('change');\n\n });\n\n\n\n\n\n makeTemplate(moduleName,\"images/55x55.png\", \"white\",\n listOfInputPorts,\n listOfOutputPorts);\n\n\n\n\n\n\n //Update the DAG\n //var newWorkflowModule = workflow.add(\"Module_\"+moduleID, \"Module_0\", workflow.traverseDF);\n //newWorkflowModule.nodeName = moduleName;\n //redrawWorkflowStructure();\n\n\n //alert(\"Add\");\n myDiagram.startTransaction(\"add node\");\n // have the Model add the node data\n var newnode = {\"key\":\"module_id_\" + moduleID, \"type\":moduleName, \"name\":moduleName, \"module_id\": \"Module \"+moduleID};\n myDiagram.model.addNodeData(newnode);\n // locate the node initially where the parent node is\n // diagram.findNodeForData(newnode).location = node.location;\n // and then add a link data connecting the original node with the new one\n //var newlink = { from: node.data.key, to: newnode.key };\n //diagram.model.addLinkData(newlink);\n // finish the transaction -- will automatically perform a layout\n myDiagram.commitTransaction(\"add node\");\n\n\n\n\n\n\n if(isItMyFloor() == false)lockParamsSettings();\n\n /*$('pre code').each(function (i, block) {\n hljs.highlightBlock(block);\n });*/\n\n\n },\n error: function (xhr, status, error) {\n alert(xhr.responseText);\n }\n\n });//end of ajax\n\n\n}", "function addModuleToPipeline(moduleID, moduleName){\n\n var module_name = ''\n var documentation = ''\n var moduleSourceCode_settings = ''\n var moduleSourceCode_main = ''\n var moduleSourceCode_html = ''\n\n $.ajax({\n type: \"POST\",\n cache: false,\n url: \"/get_module_details\",\n data: 'p_module_key=' + moduleName,\n success: function (option) {\n\n module_name = option.module_name\n documentation = option.documentation\n moduleSourceCode_settings = option.moduleSourceCode_settings\n moduleSourceCode_main = option.moduleSourceCode_main\n moduleSourceCode_html = option.moduleSourceCode_html\n user_role = option.user_role\n\n user_role_based_edit = ''\n if (user_role == 'image_researcher') {\n user_role_based_edit = '| <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"btn_edit_code\"> Edit </a> | <a style=\"font-size:12px;color:#000000;\" href=\"#\" > Contact Author </a>';\n }\n\n\n\n\n //append new module to the pipeline...\n $(\"#img_processing_screen\").append(\n '<div style=\"background-color:#EEE;width:100%\" class=\"module\" id=\"module_id_'+ moduleID +'\">' +\n\n '<!-- Documentation -->' +\n '<div style=\"margin:10px;font-size:17px;color:#000000;\">' +\n ' ' + module_name + '<hr/>' +\n ' Documentation: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"documentation_show_hide\">(Show/Hide)</a>' +\n '<div class=\"documentation\" style=\"background-color:#888888;display:none;font-size:14px;\">' + documentation + '</div>' +\n '</div>' +\n\n\n '<!-- Settings -->' +\n '<div style=\"margin:10px;font-size:17px;color:#000000;\">' +\n ' Settings: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"settings_show_hide\">(Show/Hide)</a>' +\n ' <div class=\"settings\" style=\"background-color:#888888;display:none;font-size:14px;\">' + moduleSourceCode_html + '</div>' +\n '</div>' +\n\n\n '<div style=\"margin:10px;font-size:17px;color:#000000;\" class=\"setting_section\">' +\n ' Source Code: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"code_show_hide\">(Show/Hide)</a>' + user_role_based_edit +\n\n ' <div class=\"edit_code\" style=\"background-color:#888888;display:none;font-size:14px;\">' +\n ' <textarea rows=7 cols=180 class=\"code_settings\">' + moduleSourceCode_settings + '</textarea>' +\n ' <p style=\"color:#000000;\">Main Implementation: </p>' +\n ' <textarea rows=10 cols=180>' + moduleSourceCode_main + '</textarea>' +\n '</div>' +\n\n ' <pre style=\"background-color:#333333;width:100%;\" class=\"pre_highlighted_code\">' + '<code class=\"python highlighted_code\" style=\"display:none;\">' + moduleSourceCode_settings +\n ' ' +\n moduleSourceCode_main + '</code></pre>' +\n\n ' </div>' +\n\n '</div>'\n\n\n );//end of append\n\n if(isItMyFloor() == false)lockParamsSettings();\n\n $('pre code').each(function (i, block) {\n hljs.highlightBlock(block);\n });\n\n\n },\n error: function (xhr, status, error) {\n alert(xhr.responseText);\n }\n\n });//end of ajax\n\n\n}", "addField(fieldDef) {\n let fieldObject = null;\n switch (fieldDef.type.toUpperCase()) {\n case \"TEXT\":\n fieldObject = new Text(fieldDef);\n break;\n\n case \"EMAIL\":\n fieldObject = new Email(fieldDef);\n break;\n\n case \"TEXTAREA\":\n fieldObject = new Textarea(fieldDef);\n break;\n case \"BUTTON\":\n fieldObject = new Button(fieldDef);\n // Is the submit button ?\n if (\n fieldDef.hasOwnProperty(\"buttonType\") &&\n fieldDef.buttonType.toUpperCase() === \"SUBMIT\"\n ) {\n this.submitButton = fieldObject;\n }\n break;\n }\n if (fieldDef.hasOwnProperty(\"placeholder\")) {\n fieldObject.setPlaceholder(fieldDef.placeholder);\n }\n\n this._fieldCollection.addField(fieldDef.id, fieldObject);\n\n return this;\n }", "function addField(){\n let fieldName = prompt('Enter field name:');\n if(doesFieldExist(fieldName)){\n return;\n }\n\n if(fieldName){\n let inputEl = document.createElement('input');\n inputEl.className = 'input-field';\n\n let fieldContainer = document.createElement('div');\n fieldContainer.className = 'field-container';\n\n let removeButton = createRemoveButton();\n\n let fieldNameContainer = createFieldNameContainer(fieldName);\n\n fieldContainer.appendChild(fieldNameContainer);\n fieldContainer.appendChild(inputEl);\n fieldContainer.appendChild(removeButton);\n\n let container = document.getElementById('container');\n\n let submitButton = document.getElementById('submit-button');\n\n\n /* if submit button exists then add field before button \n otherwise add field at the end\n */\n if(submitButton){\n container.insertBefore(fieldContainer, submitButton);\n } else {\n container.appendChild(fieldContainer);\n }\n fieldsCounter++;\n\n /* if add button disabled add tooltip on hover with text*/\n if(shouldDisableAddFieldButton()){\n let addFieldButton = document.getElementById('add-field-button');\n addFieldButton.disabled = true;\n let tooltip = createTooltip();\n addFieldButton.appendChild(tooltip);\n }\n }\n /* if amount of fields more than 0 and submit button doesnt exist\n create submit button and insert it as a child into container */\n if(fieldsCounter > 0){\n if(!document.getElementById('submit-button')){\n let submitButton = createSubmitButton();\n let container = document.getElementById('container');\n container.appendChild(submitButton);\n }\n }\n}", "function addMoreFields(field) {\n var name = \"product[\"+field+\"][]\";\n if(field == 'images')\n name += '[img_path]'\n $(\"<input type='text' value='' />\")\n .attr(\"name\", name)\n .appendTo(\"#\"+field);\n}", "function UpdateAddableField(fieldType, fieldKey, fieldValue)\n{\n\t// fildKey is the key required to save the fieldType, ex. mobile: 01009091995, mobile is the key\n\tTi.API.info(\"UpdateAddableField: \" + fieldType + \", \" + fieldKey + \", \" + fieldValue);\n\t\n\t// TODO: Replace this with return statement\n\tif(contact == null) alert(\"Contact must be initialized ya beheema !\");\n\t\n\t// Add the new addable field to its array in contact\n\t// If contact[fieldType] is not empty, append to it, else create a new array\n\tvar fieldDictionary = contact[fieldType];\t// A workaround for iOS\n\ttry\n\t{\n\t\tfieldDictionary[fieldKey].push(fieldValue);\n\t}\n\tcatch(exp)\n\t{\n\t\tfieldDictionary[fieldKey] = [fieldValue];\n\t}\n\tcontact[fieldType] = fieldDictionary;\n\talert(contact[fieldType]);\n}", "addField(e) {\n const c = this\n let path = this.props.keys.replace(/\\./g, \"/\")\n\n let value\n if (Array.isArray(c.state.value)) {\n value = this.state.value\n } else if (typeof c.state.value === 'string') {\n value = [this.state.value]\n } else {\n value = [\"\"]\n }\n\n value.push(\"\")\n this.setState({ value })\n //TODO: handle if need to set up an association here\n //use firebase.push() instead\n\n firebaseActions( path, value)\n }", "function AddPropertyToField() {\n var obj = {\n 'id': 5,\n 'grower': 'Joe',\n 'farm': 'Dream Farm'\n };\n myField.objInfo = obj;\n}", "addSettingsModule(aId, aName, aSettingFieldName, aClass) {\n\t\t\n\t\tthis._settingModules[aId] = {\"name\": aName, \"fieldName\": aSettingFieldName, \"reactClass\": aClass};\n\t\t\n\t}", "function addFields(p, ...fields) {\n if (!p.state.fields) {\n p.state.fields = [...fields]\n } else {\n fields.filter(f => !p.state.fields.includes(f)).forEach(f => p.state.fields.push(f));\n }\n}", "function addFields(field, currFieldName, realIndex) {\n if (field.group) {\n var isGroupCreated = false, property;\n for (var i = 0; i < self.displayData.length; i++) {\n if (self.displayData[i].name === field.group && self.displayData[i].container === 'g') {\n isGroupCreated = true;\n property = { 'name': currFieldName, 'realFieldIndex': realIndex };\n property.extensionName = field.extensionName;\n self.displayData[i].fields.push(property);\n break;\n }\n }\n if (!isGroupCreated) {\n var groupDetails = getGroupDetails(field.group);\n var group = {\n container: 'g',\n fields: [],\n name: groupDetails.id,\n groupDetails: {\n 'id': groupDetails.id,\n 'heading': $translate.instant(groupDetails.heading),\n 'collapsible': groupDetails.collapsible\n }\n };\n property = { 'name': currFieldName, 'realFieldIndex': realIndex };\n property.extensionName = field.extensionName;\n group.fields.push(property);\n self.displayData.push(group);\n }\n } else {\n var fieldContainerCreated = false;\n var displayDataLength = self.displayData.length;\n if (displayDataLength && self.displayData[displayDataLength - 1].container === 'f') {\n fieldContainerCreated = true;\n property = { 'name': currFieldName, 'realFieldIndex': realIndex };\n self.displayData[displayDataLength - 1].fields.push(property);\n }\n\n if (!fieldContainerCreated) {\n property = { 'container': 'f', 'name': currFieldName, 'realFieldIndex': realIndex, 'fields': [] };\n property.fields.push({ 'name': currFieldName, 'realFieldIndex': realIndex });\n self.displayData.push(property);\n }\n\n }\n\n if (typeof field.type === \"object\") {\n Object.getOwnPropertyNames(field.type).forEach(function (propName) {\n addFields(field.type[propName], currFieldName + \".\" + propName);\n });\n }\n }" ]
[ "0.8235917", "0.679162", "0.67566025", "0.6683053", "0.6612175", "0.6491345", "0.64870906", "0.6423668", "0.6423668", "0.6410956", "0.62967265", "0.62095296", "0.6172234", "0.6075467", "0.60152245", "0.5900019", "0.58819133", "0.585371", "0.5834094", "0.5774164", "0.57685655", "0.57522565", "0.5675252", "0.5660639", "0.5617301", "0.557433", "0.55416346", "0.55227864", "0.5520854", "0.5508505" ]
0.8132459
1
Function name: update module field Author: Reccion, Jeremy Date Modified: 2018/04/24 Description: update a field object from the specific module's fields array Parameter(s): moduleName: required. string type fieldObject: required. object type Return: Promise
function updateModuleField(moduleName, fieldObject){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); console.log(fieldObject); service.getModuleByName(moduleName).then(function(aModule){ //use array.filter() to get the duplicate fields var duplicateFields = aModule.fields.filter(function(field){ //lesson learned: use toString() in id return field.id.toString() == fieldObject.id.toString() || field.name == fieldObject.name; }); if(duplicateFields.length == 0){ deferred.reject(notFound); } //valid inputs else if(duplicateFields.length == 1){ //this is to ensure that the field is inside the specific module (in case of improper input parameters) fieldObject.id = new ObjectID(fieldObject.id); if(duplicateFields[0].id.toString() == fieldObject.id.toString()){ db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err, writeResult){ if(err){ deferred.reject(err); } else{ console.log(writeResult.result); deferred.resolve(); } }); } //the only element has the same name but is different id, therefore, not inside the module document else{ deferred.reject(notFound); } } else{ deferred.reject(exists); } }).catch(function(err){ deferred.reject(err); }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n fieldObject.id = new ObjectID(fieldObject.id);\n \n db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateFieldArray(moduleName, fieldArray){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //need to convert each 'id' property to an ObjectID\n for(var i = 0; i < fieldArray.length; i++){\n fieldArray[i].id = new ObjectID(fieldArray[i].id);\n }\n \n\n db.modules.update({name: moduleName}, {$set: {fields: fieldArray}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateFieldArray(moduleName, fieldArray){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.modules.update({name: moduleName}, {$set: {fields: fieldArray}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n //the query searches for the module name that do not have the inputted field name\n //this is to avoid pushing same field names on the 'fields' array of the specified module\n //writeResult will determine if the update was successful or not (i.e. writeResult.result.nModified)\n db.modules.update({name: moduleName, fields: {$not: {$elemMatch: {name: fieldObject.name}}}}, {$push: {fields: fieldObject}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n //console.log(writeResult.result);\n //check the status of the update, if it failed, it means that there is an existing field name\n if(writeResult.result.nModified == 0){\n deferred.reject(exists);\n }\n else{\n deferred.resolve();\n }\n }\n });\n\n return deferred.promise;\n}", "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n db.modules.update({name: moduleName}, {$push: {fields: fieldObject}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n db.modules.find({$or: [\n {_id: mongo.helper.toObjectID(updateModule._id)},\n {name: updateModule.name}\n ]}).toArray(function(err, modules){\n if(err){\n deferred.reject(err);\n }\n else if(modules.length == 0){\n deferred.reject(notFound);\n }\n //vali inputs, no other document have the same name\n else if(modules.length == 1){\n var oldModule = modules[0];\n \n //rename if old & new names are different\n if(oldModule.name != updateModule.name){\n db.bind(oldModule.name);\n db[oldModule.name].rename(updateModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n update();\n }\n });\n }\n //go straight to update\n else{\n update();\n }\n }\n //another module document with the same name exists\n else{\n deferred.reject(exists);\n }\n }); \n\n //updates the document in the 'modules' collection\n function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n\n return deferred.promise;\n}", "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n //check if the name of the selected module has not changed\n db.modules.findOne({_id: mongo.helper.toObjectID(updateModule._id)}, function(err, aModule){\n if(err){\n deferred.reject(err);\n }\n else if(aModule){\n //if names are different, renaming the collection must be executed, then proceed to update\n if(aModule.name != updateModule.name){\n db.bind(aModule.name);\n db[aModule.name].rename(updateModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n update();\n }\n });\n }\n }\n else{\n update();\n }\n });\n\n //updates the document in the 'modules' collection\n function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n\n return deferred.promise;\n}", "function orgUpdateField(org_id, fieldName, fieldValue ) {\n\n // var member = globalMembers.find(function (member) { return member.id === member_id; }); //get the member object\n \n var ckanParameters = { id: org_id };\n ckanParameters[fieldName] = fieldValue;\n\n\n\n\n debugger;\n var client = new CKAN.Client(ckanServer, myAPIkey);\n\n client.action('organization_patch', ckanParameters,\n function (err, result) {\n if (err != null) { //some error - try figure out what\n mylog(mylogdiv, \"orgUpdateField ERROR: \" + JSON.stringify(err));\n console.log(\"orgUpdateField ERROR: \" + JSON.stringify(err));\n //return false;\n return 0;\n } else // we have managed to update. We are getting the full info for the org as the result\n {\n console.log(\"orgUpdateField RETURN: \" + JSON.stringify(result.result));\n //return true;\n return 1;\n // update the globalMembers array\n // update the screen\n\n }\n\n });\n\n\n}", "function updateModuleDoc(moduleName, updateDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateDoc);\n delete forUpdate._id;\n\n db[moduleName].update({_id: mongo.helper.toObjectID(updateDoc._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "setModuleName(field, module) {\n field.moduleName = field.moduleName || (module && module.__meta.name);\n if ((field.type === 'array') || (field.type === 'object')) {\n _.each(field.schema || [], function(subfield) {\n self.setModuleName(subfield, module);\n });\n }\n }", "function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }", "function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }", "function updateModuleDoc(moduleName, updateDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n service.findDuplicateDoc(moduleName, updateDoc).then(function(){\n db.bind(moduleName);\n \n //convert '_id' to ObjectID\n updateDoc._id = new ObjectID(updateDoc._id);\n \n db[moduleName].update({_id: updateDoc._id}, {$set: updateDoc}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n if(writeResult.result.nModified == 0){\n deferred.reject(notFound);\n }\n else{\n deferred.resolve();\n }\n }\n });\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function updateField(formId, fieldId, field)\n\t\t{\n\t\t\tvar deferred = $q.defer();\t\n\t\t\t// PUT the updated field information in the specified field in the\n\t\t\t// specified form\n\t\t\t$http.put(\"/api/assignment/form/\" + formId + \"/field/\" + fieldId, field)\n\t\t\t.success(function(response) \n\t\t\t{\n\t\t\t\tdeferred.resolve(response);\n\t\t\t});\n\n\t\t\treturn deferred.promise;\n\t\t}", "function deleteModuleField(moduleName, fieldID){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n \n db.modules.update({name: moduleName}, {$pull: {fields: {id: mongo.helper.toObjectID(fieldID)}}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n if(writeResult.result.nModified == 0){\n deferred.reject(notFound);\n }\n else{\n deferred.resolve();\n }\n }\n });\n\n return deferred.promise;\n}", "function updateField() {\r\n //update general text field\r\n for (var i = 0; i < glob_data.length; i++) {\r\n try {\r\n var this_node_key = glob_data[i].pk + '.' + glob_data[i].fields.node_name\r\n if (this_node_key == obj) {\r\n $('#node_details .description').text(glob_data[i].fields.node_description)\r\n $('#node_details .details').text(glob_data[i].fields.details)\r\n $('.node-name-details').text(glob_data[i].fields.node_name)\r\n $active_node_name = glob_data[i].fields.node_name\r\n }\r\n else { }\r\n }\r\n catch (err) {\r\n console.log(err)\r\n }\r\n }\r\n updatePicture()\r\n\r\n function updatePicture() { }\r\n // update picture set for slides\r\n var $target_slides = $('.slide img')\r\n\r\n for (var j = 0; j < $target_slides.length; j++) {\r\n $thisslide = $target_slides[j]\r\n $thisslide.src = \"\\\\static\\\\app\\\\content\\\\node_content\\\\\" + $active_node_name + \"images\\\\\" + (j + 1).toString() + \".jpg\"\r\n\r\n }\r\n }", "function deleteModuleField(moduleName, fieldID){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n \n db.modules.update({name: moduleName}, {$pull: {fields: {id: mongo.helper.toObjectID(fieldID)}}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateOneFieldTask(id, field, data){\n $cordovaSQLite.execute(db,\n 'UPDATE tasks SET '+ field +' = ? WHERE id = ?',\n [data, id])\n .then(function(result) {}, function(error) {\n console.error('updateOneFieldTask(): ' + error);\n });\n }", "function ex3_update_node(node_name, field_name, value) {\n get_node(node_name)[field_name] = value;\n // Update everything\n update_all();\n}", "function updateField(name, value) {\n const updatedEntity = Object.assign({}, entity, { [name]: value }); //create new object with the changes\n setEntity(updatedEntity); // update local entity\n debouncedUpdatedDraftEntity(updatedEntity, { URL, entityName }); // push to debounce to update\n }", "function updateDepModuleVersions () {\n return request.post({\n url: `http://${HOST}/api/DepModuleVersions/add`,\n followAllRedirects: true,\n headers: {\n \"Authorization\": TOKEN\n },\n body: {\n obj: obj\n },\n json: true // Automatically stringifies the body to JSON\n }, (err, res, body) => {\n licenseObj(body);\n check(err, res, body);\n });\n}", "function changeModName() {\n //console.log('Modname' + modName);\n db.collection('modules')\n .doc(module.value)\n .update({\n 'module.name': modName,\n })\n .then(function () {\n console.log('modName updated successfully');\n history.push('/success');\n });\n }", "function updateField(table, column, field, id, objectid, callback) {\n\tpg.connect(connectionString,\t\t\t\t\t\t\t\t\t\t\t\t// try to connect to the database\n\t\tfunction (error, database, done) {\n\t\t\tif (error) return callback(error);\t\t\t\t\t\t\t\t\t// if there was an error, return it\n\n\t\t\tvar querystring = updateWhere(\t\t\t\t\t\t\t\t\t\t// generate the update query string\n\t\t\t\ttable, [column], [field], map(id, objectid)\n\t\t\t);\n\t\t\tquery(database, done, querystring,\t\t\t\t\t\t\t\t\t// query the database\n\t\t\t\tfunction (error, result) {\n\t\t\t\t\tif (error) return callback(error);\t\t\t\t\t\t\t// if there was an error, return it\n\t\t\t\t\treturn callback(SUCCESS, result);\t\t\t\t\t\t\t// otherwise, return the object\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n}", "updateField(recordId: number, key: string, value: string|number) {\n // Retrieving the record that is requested to go over the field update \n let record = this.crudStore.getData().get(recordId);\n\n // Asserting record retrieved successfully\n if (record) {\n // Updating field of record\n record[key] = value;\n\n // Updating record\n this.updateRecord(recordId, record)\n }\n else {\n throw \"CRUDActions.updateField: record wasn't retrieved successfully\"\n }\n }", "updateFieldItems() {\n this.fieldItems = this.getFieldItems();\n this.fullQueryFields = this.getFullQueryFields();\n this.availableFieldItemsForFieldMapping = this.getAvailableFieldItemsForFieldMapping();\n this.availableFieldItemsForMocking = this.getAvailableFieldItemsForMocking();\n this.mockPatterns = this.getMockPatterns();\n }", "static update(fields, value) {\n if (typeof value === 'number') {\n fields.position = value;\n } else if (typeof value === 'string') {\n fields.insertString = value;\n } else if (typeof value === 'object' && value.d !== undefined) {\n fields.delNum = value.d;\n }\n }", "function inviteUpdate(project,email,username){\r\n var s=/*LibraryjsUtil.*/dbParse({verb:\"get\",project:project,className:\"invite\",query:{email:email}}).results[0]//;Logger.log(s),var x\r\n , t=/*LibraryjsUtil.*/dbParse({verb:\"put\",project:project,className:\"invite\",obid:s.objectId,ob:{username:username}})\r\n ;return t}//function test(){Logger.log(inviteUpdate(\"dealDigger\",\"[email protected]\",\"cooldude89\"))}//Sample call: var t=LibraryjsUtil.inviteUpdate(pname,ob.email,ob.username);", "async function updateField(roomid, field, newValue) {\n if(!db){\n initIDB();\n }\n\n if(db){\n try{\n let tx = await db.transaction(STORE_NAME, 'readwrite');\n let store = await tx.objectStore(STORE_NAME);\n let index = await store.index('rooms');\n\n //Change field\n const roomObj = await index.get(IDBKeyRange.only(roomid));\n roomObj[field] = newValue;\n\n //Update idb\n store.put(roomObj, roomid);\n await tx.complete;\n }\n catch (error){\n console.log(error);\n }\n }\n}", "async updatePlayerField(nickname, fieldName, value) {\n const fields = this.getSupportedFields();\n\n if (!fields.hasOwnProperty(fieldName))\n throw new Error(`${fieldName} is not a field known to me. Please check !supported.`);\n \n const field = fields[fieldName];\n switch (field.type) {\n case AccountDatabase.kTypeNumber:\n return this._updateNumericPlayerField(nickname, field.table, fieldName, value);\n case AccountDatabase.kTypeString:\n return this._updateStringPlayerField(nickname, field.table, fieldName, value);\n case AccountDatabase.kTypeCustom:\n return this._updateCustomPlayerField(nickname, field.table, fieldName, value);\n default:\n throw new Error(`${fieldName} has an invalid type defined in the code.`);\n }\n }", "update(field, value) {\n return new code.Update(field, value);\n }" ]
[ "0.8456608", "0.81074345", "0.805101", "0.7392945", "0.7392381", "0.70211095", "0.68865806", "0.66497767", "0.66221124", "0.647745", "0.6348413", "0.6348413", "0.63277465", "0.6174028", "0.60932803", "0.60513693", "0.6039068", "0.60181665", "0.5856864", "0.57826996", "0.57653105", "0.57377654", "0.5716924", "0.5714146", "0.5623827", "0.5613265", "0.5594846", "0.5576073", "0.55671453", "0.5498458" ]
0.8240337
1
Function name: delete module field Author: Reccion, Jeremy Date Modified: 2018/04/24 Description: delete a field object from the specific module's fields array Parameter(s): moduleName: required. string type fieldID: required. string type Return: Promise
function deleteModuleField(moduleName, fieldID){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); db.modules.update({name: moduleName}, {$pull: {fields: {id: mongo.helper.toObjectID(fieldID)}}}, function(err, writeResult){ if(err){ deferred.reject(err); } else{ if(writeResult.result.nModified == 0){ deferred.reject(notFound); } else{ deferred.resolve(); } } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteModuleField(moduleName, fieldID){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n \n db.modules.update({name: moduleName}, {$pull: {fields: {id: mongo.helper.toObjectID(fieldID)}}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "deleteField(field) {\n this.jsonStoreService.removeIn(this.getPathForChild(field));\n }", "function deleteModuleDoc(moduleName, id){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].remove({_id: mongo.helper.toObjectID(id)}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function deleteModule(id, moduleName){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //drop the collection\n db.bind(moduleName);\n db[moduleName].drop();\n\n //remove document from 'modules' collection\n db.modules.remove({_id: mongo.helper.toObjectID(id)}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function deleteFieldFromForm(formId, fieldId)\n\t\t{\n\t\t\tvar deferred = $q.defer();\n\t\t\t// DELETE the specified field from the specified form\n\t\t\t$http.delete(\"/api/assignment/form/\" + formId + \"/field/\" + fieldId)\n\t\t\t.success(function(response) \n\t\t\t{\n\t\t\t\tdeferred.resolve(response);\n\t\t\t});\n\n\t\t\treturn deferred.promise;\n\t\t}", "function deleteModuleDoc(moduleName, id){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].remove({_id: mongo.helper.toObjectID(id)}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n //n is used to know if the document was removed\n if(writeResult.result.n == 0){\n deferred.reject(notFound);\n }\n else{\n deferred.resolve();\n }\n }\n });\n\n return deferred.promise;\n}", "function deleteModule(moduleName){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //drop the collection\n db.bind(moduleName);\n db[moduleName].drop(function(err){\n if(err){\n if(err.codeName == 'NamespaceNotFound'){\n deferred.reject(notFound);\n }\n else{\n deferred.reject(err);\n }\n }\n else{\n //remove document from 'modules' collection\n db.modules.remove({name: moduleName}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n //n is used to know if the document was removed\n if(writeResult.result.n == 0){\n deferred.reject(notFound);\n }\n else{\n deferred.resolve();\n }\n }\n });\n }\n });\n\n return deferred.promise;\n}", "function updateModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n console.log(fieldObject);\n\n service.getModuleByName(moduleName).then(function(aModule){ \n //use array.filter() to get the duplicate fields\n var duplicateFields = aModule.fields.filter(function(field){\n //lesson learned: use toString() in id\n return field.id.toString() == fieldObject.id.toString() || field.name == fieldObject.name;\n });\n \n if(duplicateFields.length == 0){\n deferred.reject(notFound);\n }\n //valid inputs\n else if(duplicateFields.length == 1){\n //this is to ensure that the field is inside the specific module (in case of improper input parameters)\n\n fieldObject.id = new ObjectID(fieldObject.id);\n\n if(duplicateFields[0].id.toString() == fieldObject.id.toString()){\n db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n console.log(writeResult.result);\n deferred.resolve();\n }\n });\n }\n //the only element has the same name but is different id, therefore, not inside the module document\n else{\n deferred.reject(notFound);\n }\n }\n else{\n deferred.reject(exists);\n }\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n //the query searches for the module name that do not have the inputted field name\n //this is to avoid pushing same field names on the 'fields' array of the specified module\n //writeResult will determine if the update was successful or not (i.e. writeResult.result.nModified)\n db.modules.update({name: moduleName, fields: {$not: {$elemMatch: {name: fieldObject.name}}}}, {$push: {fields: fieldObject}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n //console.log(writeResult.result);\n //check the status of the update, if it failed, it means that there is an existing field name\n if(writeResult.result.nModified == 0){\n deferred.reject(exists);\n }\n else{\n deferred.resolve();\n }\n }\n });\n\n return deferred.promise;\n}", "removeField(id) {\n this.fieldDescriptor.delete(id);\n this.errors.delete(id);\n }", "deleteField(object, field) {\n delete object[field];\n console.warn(`\"${field}\" is removed from input json since it's not in the schema`);\n }", "function updateModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n fieldObject.id = new ObjectID(fieldObject.id);\n \n db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateFieldArray(moduleName, fieldArray){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //need to convert each 'id' property to an ObjectID\n for(var i = 0; i < fieldArray.length; i++){\n fieldArray[i].id = new ObjectID(fieldArray[i].id);\n }\n \n\n db.modules.update({name: moduleName}, {$set: {fields: fieldArray}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n db.modules.update({name: moduleName}, {$push: {fields: fieldObject}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateFieldArray(moduleName, fieldArray){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.modules.update({name: moduleName}, {$set: {fields: fieldArray}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "async deleteMetafield() {\n await axios({\n method: \"delete\",\n url: deleteMetafield(this.metaId),\n })\n .then((res) => console.log(res.data.metafields))\n .catch((err) => console.log(err));\n }", "function sc_deleteJsFieldBang(o, field) {\n delete o[field];\n}", "function pickDelete(module, fieldname, arr, replaceVal) {\n\tdocument.getElementById('status').style.display='inline';\n\tjQuery.ajax({\n\t\tmethod: 'POST',\n\t\turl: 'index.php?action=PickListAjax&module=PickList&mode=delete&file=PickListAction&fld_module='+encodeURIComponent(module)+'&fieldname='+encodeURIComponent(fieldname)+'&values='+JSON.stringify(arr)+'&replaceVal='+encodeURIComponent(replaceVal),\n\t}).done(function (response) {\n\t\tvar str = response;\n\t\tif (str == 'SUCCESS') {\n\t\t\tchangeModule();\n\t\t\tfnhide('actiondiv');\n\t\t} else {\n\t\t\talert(str);\n\t\t}\n\t\tdocument.getElementById('status').style.display='none';\n\t});\n}", "function deleteField(this_field,section_header) {\r\n\tif (section_header) {\r\n\t\tsimpleDialog(delSHMsg,delSHTitle,null,null,null,langCancel,\"deleteFieldDo('\"+this_field+\"',\"+section_header+\");\",langOD24);\r\n\t} else {\r\n\t\tsimpleDialog(delFieldMsg+' \"'+this_field+'\"'+langQuestionMark,delFieldTitle,null,null,null,langCancel,\"deleteFieldDo('\"+this_field+\"',\"+section_header+\");\",langOD24);\r\n\t}\r\n}", "removeModule() {\n this.props.firebase.database.ref('users')\n .child(this.props.firebase.auth.currentUser.uid)\n .child('appointments')\n .child('appointmentsArr')\n .once('value', snapshot => {\n snapshot.forEach(child => {\n console.log(child.val().title)\n if (child.val().title === this.props.module) {\n child.ref.remove();\n }\n })\n });\n this.props.firebase.database.ref('users')\n .child(this.props.firebase.auth.currentUser.uid)\n .child('appointments')\n .child('modsData')\n .child(this.props.module)\n .remove()\n }", "function deleteMod() {\n // eslint-disable-next-line no-restricted-globals\n if (\n confirm(\n 'Are you sure you want to delete this module? This cannot be undone.',\n )\n ) {\n db.collection('modules')\n .doc(module.value)\n .delete()\n .then(function () {\n history.push('/success');\n console.log('doc deleted successfully');\n return true;\n });\n } else {\n return false;\n }\n }", "deleteModule(moduleId, passphrase) {\n return this.httpService({\n method: 'DELETE',\n url: `${this.rootURL}microAnalytics?microAnalyticsId=${moduleId}`,\n headers: {Authorization: `basic ${passphrase}`}\n });\n }", "_delete (moduleName){\n delete this._dynamicParentsMap[moduleName];\n // SystemJs doesn't do this?\n delete this._system.loads[moduleName];\n // Do regular delete\n return this._systemDelete.apply(this._system, arguments);\n }", "function deleteFieldDo(this_field,section_header) {\r\n\t$.get(app_path_webroot+\"Design/delete_field.php\", { pid: pid, field_name: this_field, section_header: section_header, form_name: getParameterByName('page') },\r\n\t\tfunction(data) {\r\n\t\t\tvar chkFldInCalcBranching = true;\r\n\t\t\tif (data == \"1\") { // Successfully deleted\r\n\t\t\t\tif (section_header) {\r\n\t\t\t\t\thighlightTable('design-'+this_field+'-sh',1500);\r\n\t\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\t\t$('#'+this_field+'-sh-tr').remove();\r\n\t\t\t\t\t},1000);\r\n\t\t\t\t} else {\r\n\t\t\t\t\thighlightTable('design-'+this_field,1500);\r\n\t\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\t\t$('#'+this_field+'-tr').remove();\r\n\t\t\t\t\t},1000);\r\n\t\t\t\t}\r\n\t\t\t\tAddTableDrag();\r\n\t\t\t} else if (data == \"3\") { // Field is last on page and/or field has section header. Reload table.\r\n\t\t\t\treloadDesignTable(getParameterByName('page'));\r\n\t\t\t} else if (data == \"2\") { // All fields were deleted so redirect back to previous page\r\n\t\t\t\tsimpleDialog(langOD37,null,null,null,'window.location.href = app_path_webroot + \"Design/online_designer.php?pid=\" + pid;');\r\n\t\t\t} else if (data == \"4\") { // Table_pk was deleted, so inform user of this\r\n\t\t\t\thighlightTable('design-'+this_field,1500);\r\n\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\t$('#'+this_field+'-tr').remove();\r\n\t\t\t\t},1000);\r\n\t\t\t\tupdate_pk_msg(false,'field');\r\n\t\t\t} else if (data == \"5\") { // Field is last on page and has section header, which was then removed. Alert user of SH deletion and reload table.\r\n\t\t\t\tsimpleDialog(langOD39,null,null,null,\"reloadDesignTable(getParameterByName('page'))\");\r\n\t\t\t} else if (data == \"6\") { // Field is being used by randomization. So prevent deletion.\r\n\t\t\t\tsimpleDialog(langOD40);\r\n\t\t\t\tchkFldInCalcBranching = false;\r\n\t\t\t} else {\r\n\t\t\t\talert(woops);\r\n\t\t\t\tchkFldInCalcBranching = false;\r\n\t\t\t}\r\n\t\t\t// Send AJAX request to check if the deleted field was in any calc equations or branching logic\r\n\t\t\tif (chkFldInCalcBranching && !section_header) {\r\n\t\t\t\t$.post(app_path_webroot+\"Design/delete_field_check_calcbranch.php?pid=\"+pid, { field_name: this_field },function(data) {\r\n\t\t\t\t\tif (data != \"0\") {\r\n\t\t\t\t\t\tif (!$('#delFldChkCalcBranchPopup').length) $('body').append('<div id=\"delFldChkCalcBranchPopup\" style=\"display:none;\"></div>');\r\n\t\t\t\t\t\t$('#delFldChkCalcBranchPopup').html(data);\r\n\t\t\t\t\t\t$('#delFldChkCalcBranchPopup').dialog({ bgiframe: true, modal: true, width: 650, open: function(){fitDialog(this)}, \r\n\t\t\t\t\t\t\ttitle: langOD41,\r\n\t\t\t\t\t\t\tbuttons: {\r\n\t\t\t\t\t\t\t\tClose: function() { $(this).dialog('close'); }\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n}", "function deleteFieldSpecs(entity) {\n try {\n return baseSvc.removeEntity(serviceUrl, entity);\n } catch (e) {\n throw e;\n }\n }", "function removeFields(p, ...fields) {\n if (!p.state.fields) {\n return\n } else {\n fields.forEach(f => {\n let index = p.state.fields.indexOf(f);\n if (index > -1) {\n p.state.fields.splice(index, 1);\n }\n });\n }\n}", "deleteRow(id) {\n this.fieldArray.splice(id, 1);\n }", "function removeFormField(id, fieldid) {\n var deferred = q.defer();\n\n FormModel.findById(id, function(err, form) {\n if(err) {\n deferred.reject(err);\n } else {\n // iterate over form fields\n for(var i = 0; i < form.fields.length; i ++) {\n if(form.fields[i].id == fieldid) {\n form.fields.splice(i, 1);\n form.save(function(err, form) {\n if(err) {\n deferred.reject(err);\n } else {\n deferred.resolve(form);\n }\n });\n }\n }\n }\n });\n\n return deferred.promise;\n }", "function deleteItem(options) {\n\n var deferred = $q.defer();\n\n var defObject = {\n listName: false,\n fields: false,\n id: false,\n };\n\n var settings = $.extend({}, defObject, options);\n\n if ((!settings.listName) && (!settings.id) && (!settings.fields)) {\n deferred.reject();\n return deferred.promise;\n }\n\n var context = SP.ClientContext.get_current();\n\n var oList = context.get_web().get_lists().getByTitle(settings.listName);\n\n\n // query field by field name and value \n var oListItem = oList.getItemById(settings.id);\n oListItem.deleteObject();\n\n\n\n context.executeQueryAsync(success, fail);\n\n function success() {\n // load query details to json object\n var taskEntry = oListItem.get_fieldValues();\n deferred.resolve(helperService.parse(taskEntry, options.fields.mappingFromSP));\n }\n\n\n function fail(sender, args) {\n deferred.reject(args.get_message() + '\\n' + args.get_stackTrace());\n }\n\n\n return deferred.promise;\n\n\n\n }", "function deleteSchemaField() {\n var sleep_schema_v4 = {\n className: \"Sleep\",\n fields: {\n polyphasic: {\n \"__op\" : \"Delete\"\n }\n }\n };\n XHR.PUT(SERVER_URL+'/schemas' + \"/\" + sleep_schema_v4.className, sleep_schema_v4)\n}" ]
[ "0.8156747", "0.67469287", "0.66539174", "0.6590933", "0.65539515", "0.6496182", "0.6480931", "0.6474819", "0.6348002", "0.6331068", "0.62288254", "0.6219512", "0.6177473", "0.6077904", "0.6047087", "0.5973316", "0.59649444", "0.59559435", "0.59484595", "0.58134276", "0.58067805", "0.56874734", "0.56850034", "0.5600509", "0.5595539", "0.5585259", "0.557454", "0.55667555", "0.5552543", "0.5498065" ]
0.80614734
1
Function name: get a specific module Author: Reccion, Jeremy Date Modified: 2018/04/20 Description: retrieves a specific module by its name Parameter(s): moduleName: string type Return: Promise
function getModuleByName(moduleName){ var deferred= Q.defer(); moduleName = moduleName.toLowerCase(); db.modules.findOne({name: moduleName}, function(err, aModule){ if(err){ deferred.reject(err); } else if(aModule){ deferred.resolve(aModule); } else{ deferred.reject(notFound); } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getModuleByName(moduleName){\n var deferred= Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.modules.findOne({name: moduleName}, function(err, aModule){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve(aModule);\n }\n });\n\n return deferred.promise;\n}", "function getModule(name){\n\t\tfor (var i = 0; i < modules.length; i++) {\n\t\t\tif (modules[i].name === name){\n\t\t\t\treturn modules[i];\n\t\t\t}\n\t\t}\n\t}", "GetModule() {\n\n }", "function getPackageJSON(moduleName, cb) {\n console.time('getPackageJSON');\n var url = 'http://search.npmjs.org/api/' + moduleName;\n request(url, function (err, response, body) {\n if (!err && response.statusCode === 200) {\n console.timeEnd('getPackageJSON');\n cb(null, JSON.parse(body));\n } else {\n console.timeEnd('getPackageJSON');\n cb(err);\n }\n });\n}", "function requestModuleInformation(modId, cb) {\n $.get(\"/api/category/module\", {moduleId: modId}).done((data) => {\n if (data.error === \"NONE\") {\n cb(data.data);\n } else {\n alert(\"Invalid request to /api/category/module\");\n }\n });\n }", "async function func(uniqueModuleData) {\n try {\n console.log(\"uniqueModuleData\", uniqueModuleData)\n const foundModule = await prisma.module.findUnique({where: uniqueModuleData})\n console.log(\"foundModule\", foundModule)\n return foundModule\n } catch(e) {\n console.log(e)\n return\n }\n }", "getModules(){\n return this.#fetchAdvanced(this.#getModulesURL()).then((responseJSON) => {\n let moduleBOs = ModuleBO.fromJSON(responseJSON);\n // console.info(moduleBOs);\n return new Promise(function (resolve) {\n resolve(moduleBOs);\n })\n })\n\n }", "function getModuleById(moduleID) {\r\n fetch(`modules.json`)\r\n .then((res) => {\r\n return res.json();\r\n })\r\n .then((data) => {\r\n const moduleArr = data.filter((module) => {\r\n const regex = new RegExp(`^${moduleID}`, 'gi');\r\n\r\n return module.moduleCode.match(regex);\r\n });\r\n const module = moduleArr[0];\r\n\r\n addModuletoDOM(module);\r\n });\r\n}", "function require(name) {\n var mod = ModuleManager.get(name);\n if (!mod) {\n //Only firefox and synchronous, sorry\n var file = ModuleManager.file(name);\n var code = null,\n request = new XMLHttpRequest();\n request.open('GET', file, false); \n try {\n request.send(null);\n } catch (e) {\n throw new LoadError(file);\n }\n if(request.status != 200)\n throw new LoadError(file);\n //Tego el codigo, creo el modulo\n var code = '(function(){ ' + request.responseText + '});';\n mod = ModuleManager.create(name, file, code);\n }\n event.publish('module_loaded', [this, mod]);\n switch (arguments.length) {\n case 1:\n // Returns module\n var names = name.split('.');\n var last = names[names.length - 1];\n this[last] = mod;\n return mod;\n case 2:\n // If all contents were requested returns nothing\n if (arguments[1] == '*') {\n __extend__(false, this, mod);\n return;\n // second arguments is the symbol in the package\n } else {\n var n = arguments[1];\n this[n] = mod[n];\n return mod[n];\n }\n default:\n // every argyment but the first one are a symbol\n // returns nothing\n for (var i = 1, length = arguments.length; i < length; i++) {\n this[arguments[i]] = mod[arguments[i]];\n }\n return;\n }\n }", "function NSGetModule(compMgr, fileSpec) {\n return module;\n}", "function NSGetModule(compMgr, fileSpec) {\n return Module;\n}", "function getThisModule() {\n\tconst modules = MM.getModules();\n\tfor(let i = 0; i < modules.length; i++){\n\t\t//Log.log(modules[i].identifier);\n\t\tif(modules[i].name === \"MMM-PhotoSlideshow\"){\n\t\t\treturn modules[i];\n\t\t}\n\t}\n\treturn undefined;\n}", "static async getTasksByModule(module) {\n try {\n let res = await axios.get(`${url}/getByModule/${module}`);\n let data = res.data;\n if (data != 'No Tasks.') {\n return data;\n }\n }\n catch (err) {\n console.log(err);\n return [];\n }\n }", "async function getModules() {\n\n const pool = await db.dbConnection()\n\n const getQuery = `SELECT * FROM public.modules`;\n\n try {\n pool.query(getQuery, function (err, recordset) {\n\n if (err) {\n\n console.log('getModules', err)\n\n } else {\n\n // send records as a response\n return recordset.rows;\n }\n });\n }\n\n catch (error) {\n res.status(402).json('record insert failed with error: ' + parseError(error, getQuery))\n }\n}", "function getRevision (moduleName) {\n var cookie = cookies.get(COOKIE_NAME) || '',\n kvPairs = cookie ? cookie.split(COOKIE_PAIR_SEPARATOR) : [],\n modules = {};\n\n // Parse out modules.\n kvPairs.forEach(function (pair) {\n var parts = pair.split(COOKIE_REV_SEPARATOR),\n module = parts[0],\n revision = parts[1];\n\n modules[module] = revision;\n });\n\n if (moduleName) {\n return modules[moduleName];\n }\n\n return modules;\n}", "function queryModNames() {\n db.collection('modules')\n .get()\n .then((querySnapshot) => {\n querySnapshot.forEach((doc) => {\n let modNameObj = {};\n modNameObj.value = doc.id;\n modNameObj.label = doc.data().module.name;\n if (modNameObj.label !== 'Jumpshot Tutor') {\n allModules.push(modNameObj);\n }\n setModNamesIsLoading(false);\n });\n return allModules;\n });\n }", "async function fetchModule() {\n\t\t\t const module = await getUserModule(userId, instanceId);\n\t\t\t setModule(module);\n\n\t\t\t // Setting up audio message ref (if any audio message is present).\n\t\t\t if (module.audioMessageURL) {\n\t\t\t\t audioMessageRef.current = new Audio(module.audioMessageURL);\n\t\t\t }\n\n\t\t\t // Getting the module's author info\n\t\t\t const user = await getUserDocument(userId);\n\t\t\t setUser(user);\n\t\t}", "async function loadModule(moduleName, multiInject = false) {\n const modulesToLoad = [moduleName, ...modulesMetadata[moduleName].depsDeep]\n const loadedModules = await loadModules(modulesToLoad)\n return multiInject ? loadedModules[moduleName].instances : loadedModules[moduleName].instances[0]\n }", "static get moduleName() {\n return undefined;\n }", "function searchCache(moduleName, callback) {\n\t// Resolve the module identified by the specified name\n\tlet mod = require.resolve(moduleName);\n\n\t// Check if the module has been resolved and found within\n\t// the cache\n\tif (mod && ((mod = require.cache[mod]) !== undefined)) {\n\t\t// Recursively go over the results\n\t\t(function run(mod) {\n\t\t\t// Go over each of the module's children and\n\t\t\t// run over it\n\t\t\tmod.children.forEach(function (child) {\n\t\t\t\tif (child.id != mod.id) {\n\t\t\t\t\t// console.log(mod.id, child.id);\n\t\t\t\t\trun(child);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// Call the specified callback providing the\n\t\t\t// found module\n\t\t\tcallback(mod);\n\t\t})(mod);\n\t}\n}", "function makeTheCall(userName){\n\n fetch(gitHubURL + userName +\"/repos\")\n .then(response => response.json())\n .then(responseJson => listOnlyName(responseJson)); \n}", "function getAllModuleDocs(moduleName){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].find().toArray(function(err, moduleDocs){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve(moduleDocs);\n }\n });\n\n return deferred.promise;\n}", "function getAllModuleDocs(moduleName){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].find().toArray(function(err, moduleDocs){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve(moduleDocs);\n }\n });\n\n return deferred.promise;\n}", "function getModuleLicense(moduleName, callback)\n {\n getModuleLicenses(moduleName, callback);\n }", "function loadModule(moduleName) {\n var module = modules[moduleName];\n\n if (module !== undefined) {\n return module;\n }\n\n // This uses a switch for static require analysis\n switch (moduleName) {\n case 'charset':\n module = __nccwpck_require__(99296);\n break;\n case 'encoding':\n module = __nccwpck_require__(25297);\n break;\n case 'language':\n module = __nccwpck_require__(19722);\n break;\n case 'mediaType':\n module = __nccwpck_require__(62563);\n break;\n default:\n throw new Error('Cannot find module \\'' + moduleName + '\\'');\n }\n\n // Store to prevent invoking require()\n modules[moduleName] = module;\n\n return module;\n}", "async function getInformation() {\n try {\n const ids = await getRecipies();\n console.log(ids);\n const jor = await getRecipe(ids[0]);\n console.log(jor);\n const nextJor = await getAuthorRecipe(jor.author);\n console.log(nextJor);\n return nextJor.name;\n } catch (error) {\n console.log(\"Алдаа : \" + error);\n }\n}", "static describe (module) {\n\t\tconst description = GetRequest.describe(module);\n\t\tdescription.access = 'User must be a member of the team that owns this repo';\n\t\treturn description;\n\t}", "function loadModule(moduleName) {\n var module = modules[moduleName];\n\n if (module !== undefined) {\n return module;\n }\n\n // This uses a switch for static require analysis\n switch (moduleName) {\n case 'charset':\n module = charset;\n break;\n case 'encoding':\n module = encoding;\n break;\n case 'language':\n module = language;\n break;\n case 'mediaType':\n module = mediaType;\n break;\n default:\n throw new Error('Cannot find module \\'' + moduleName + '\\'');\n }\n\n // Store to prevent invoking require()\n modules[moduleName] = module;\n\n return module;\n}", "getModuleList() {\n return this.http.get(this.url + '/cesco/getmodule', this.httpOptions);\n }", "function getCoreNodeModule(moduleName) {\n try {\n return require(`${vscode.env.appRoot}/node_modules.asar/${moduleName}`);\n } catch (err) {}\n\n try {\n return require(`${vscode.env.appRoot}/node_modules/${moduleName}`);\n } catch (err) {}\n\n return null;\n}" ]
[ "0.7550319", "0.64568645", "0.6341758", "0.61982876", "0.6101905", "0.5989672", "0.59674895", "0.5937421", "0.5917052", "0.5729546", "0.56361324", "0.5632423", "0.5617168", "0.5553284", "0.55260795", "0.55196166", "0.5515729", "0.5500644", "0.54888695", "0.548056", "0.5458297", "0.5439356", "0.5439356", "0.54375446", "0.54367054", "0.54116267", "0.54109603", "0.5358582", "0.5352046", "0.5322723" ]
0.7540487
1
Function name: add document Author: Reccion, Jeremy Date Modified: 2018/04/24 Description: add a document in a specific collection Parameter(s): moduleName: string type newDoc: object type. //fields must be the specific module's 'fields' in 'modules' collection Return: Promise
function addModuleDoc(moduleName, newDoc){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); service.findDuplicateDoc(moduleName, newDoc).then(function(){ db.bind(moduleName); db[moduleName].insert(newDoc, function(err){ if(err){ deferred.reject(err); } else{ deferred.resolve(); } }); }).catch(function(err){ deferred.reject(err); }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addModuleDoc(moduleName, newDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].insert(newDoc, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function addModule(newModule){\n //imitate angular promise. start by initializing this\n var deferred = Q.defer();\n\n newModule.name = newModule.name.toLowerCase();\n\n //check if there is an existing module\n db.modules.findOne({name: newModule.name}, function(err, aModule){\n if(err){\n deferred.reject(err);\n }\n //already exists\n else if(aModule){\n deferred.reject(exists);\n }\n else{\n //unique, so proceed\n //create table first before adding a new document to 'modules' collection (not necessary?)\n db.createCollection(newModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n //initialize fields property as empty array if there are none in the input\n if(newModule.fields == undefined){\n newModule.fields = [];\n }\n\n db.modules.insert(newModule, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n });\n }\n \n });\n \n //return the promise along with either resolve or reject\n return deferred.promise;\n}", "function addModule(newModule){\n //imitate angular promise. start by initializing this\n var deferred = Q.defer();\n\n newModule.name = newModule.name.toLowerCase();\n\n //check if there is an existing module\n db.modules.findOne({name: newModule.name}, function(err, aModule){\n if(err){\n deferred.reject(err);\n }\n //already exists\n else if(aModule){\n deferred.reject(exists);\n }\n else{\n //unique, so proceed\n //create table first before adding a new document to 'modules' collection (not necessary?)\n db.createCollection(newModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n //initialize fields property as empty array if there are none in the input\n if(newModule.fields == undefined){\n newModule.fields = [];\n }\n\n db.modules.insert(newModule, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n });\n }\n \n });\n \n //return the promise along with either resolve or reject\n return deferred.promise;\n}", "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n db.modules.update({name: moduleName}, {$push: {fields: fieldObject}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateModuleDoc(moduleName, updateDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateDoc);\n delete forUpdate._id;\n\n db[moduleName].update({_id: mongo.helper.toObjectID(updateDoc._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n //the query searches for the module name that do not have the inputted field name\n //this is to avoid pushing same field names on the 'fields' array of the specified module\n //writeResult will determine if the update was successful or not (i.e. writeResult.result.nModified)\n db.modules.update({name: moduleName, fields: {$not: {$elemMatch: {name: fieldObject.name}}}}, {$push: {fields: fieldObject}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n //console.log(writeResult.result);\n //check the status of the update, if it failed, it means that there is an existing field name\n if(writeResult.result.nModified == 0){\n deferred.reject(exists);\n }\n else{\n deferred.resolve();\n }\n }\n });\n\n return deferred.promise;\n}", "function updateModuleDoc(moduleName, updateDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n service.findDuplicateDoc(moduleName, updateDoc).then(function(){\n db.bind(moduleName);\n \n //convert '_id' to ObjectID\n updateDoc._id = new ObjectID(updateDoc._id);\n \n db[moduleName].update({_id: updateDoc._id}, {$set: updateDoc}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n if(writeResult.result.nModified == 0){\n deferred.reject(notFound);\n }\n else{\n deferred.resolve();\n }\n }\n });\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function findDuplicateDoc(moduleName, moduleDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //get the fields of the specific module\n service.getModuleByName(moduleName).then(function(aModule){\n //initialize array & object for querying\n var uniqueFields = [];\n var tempObj;\n\n //push the value of the document when a field is unique\n aModule.fields.forEach(function(field){\n if(field.unique){\n tempObj = {};\n tempObj[field.name] = moduleDoc[field.name];\n uniqueFields.push(tempObj);\n }\n });\n\n if(uniqueFields.length == 0){\n deferred.resolve();\n }\n else{\n //use $or for checking each field for uniqueness, not their combination\n db[moduleName].findOne({$or: uniqueFields}, function(err, duplicateDoc){\n if(err){\n deferred.reject(err);\n }\n //a duplicate exists, but needs further checking\n else if(duplicateDoc){\n //updating a module document\n if(moduleDoc._id){\n //different module documents with similar unique values\n if(moduleDoc._id != duplicateDoc._id){\n deferred.reject(exists);\n }\n //since it is the same document, it is not duplicate\n else{\n deferred.resolve();\n }\n }\n //adding new module documennt\n else{\n deferred.reject(exists);\n }\n }\n //does not exist\n else{\n deferred.resolve();\n }\n });\n }\n\n \n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function findDuplicateDoc(moduleName, moduleDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //get the fields of the specific module\n service.getModuleByName(moduleName).then(function(aModule){\n //initialize array & object for querying\n var uniqueValues = [];\n var tempObj;\n\n //push the value of the document when a field is unique\n aModule.fields.forEach(function(field){\n if(field.unique){\n tempObj = {};\n tempObj[field.name] = moduleDoc[field.name];\n uniqueValues.push(tempObj);\n }\n });\n\n if(uniqueValues.length == 0){\n deferred.resolve();\n }\n else{\n db.bind(moduleName);\n\n //use $or for checking each field for uniqueness, not their combination\n db[moduleName].findOne({$or: uniqueValues}, function(err, duplicateDoc){\n if(err){\n deferred.reject(err);\n }\n //a duplicate exists, but needs further checking\n else if(duplicateDoc){\n //updating a module document\n if(moduleDoc._id){\n //different module documents with similar unique values\n if(moduleDoc._id != duplicateDoc._id){\n deferred.reject(exists);\n }\n //since it is the same document, it is not duplicate\n else{\n deferred.resolve();\n }\n }\n //adding new module documennt\n else{\n deferred.reject(exists);\n }\n }\n //does not exist - similar to notFound. but it is not rejected based on design\n else{\n deferred.resolve();\n }\n });\n }\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "async addDocument(_, { input: { doc, owner } }, { generalInfo }) {\n const document = { doc }\n const { insertedId } = await generalInfo.insertOne(document)\n document._id = insertedId\n\n return document\n }", "function doc(moduleName) {\n exports.modules.push(moduleName);\n}", "async add(collection, document) {\n console.log(\"adding collection\")\n console.log(collection) \n try {\n const docRef = await this.api\n .collection(collection)\n .add(document);\n return docRef.id;\n }\n catch (error) {\n return 'Error adding document: ' + error;\n }\n }", "function createDocument(req, res, next) {\n const Token = _getToken(req, res)\n Token\n .then((token) => {\n const params = {\n method: 'set_entry',\n custom: false,\n rest_data: {\n session: token,\n modulo: 'Documents',\n data: [\n {\n name: 'document_name',\n value: req.params.filename,\n },\n {\n name: 'revision',\n value: 1,\n },\n ],\n },\n }\n\n _requestCRM(params)\n .then((result)=>{\n res.end(result.id)\n })\n .catch((e) => {\n logger.error('Controller::DefensaConsumidor::createDocument::_RequestCRM::Catch')\n next(APIError({ status: 500, devMessage: e.message, }))\n })\n })\n}", "_createDocument(req, res, next) {\n const { documentId, change } = req.body\n this.engine.createDocument(documentId, change, function(err, version) {\n if (err) return next(err)\n res.json(version)\n })\n }", "function addDocument(collectionName, newDoc) {\n var collection = data[collectionName];\n var nextId = Object.keys(collection).length;\n if (newDoc.hasOwnProperty('_id')) {\n throw new Error(`You cannot add a document that already has an _id. addDocument is for new documents that do not have an ID yet.`);\n }\n while (collection[nextId]) {\n nextId++;\n }\n newDoc._id = nextId;\n writeDocument(collectionName, newDoc);\n return newDoc;\n}", "function addDocument(collectionName, newDoc) {\n var collection = data[collectionName];\n var nextId = Object.keys(collection).length;\n if (newDoc.hasOwnProperty('_id')) {\n throw new Error(`You cannot add a document that already has an _id. addDocument is for new documents that do not have an ID yet.`);\n }\n while (collection[nextId]) {\n nextId++;\n }\n newDoc._id = nextId;\n writeDocument(collectionName, newDoc);\n return newDoc;\n}", "function addDocument(collectionName, newDoc) {\n var collection = data[collectionName];\n var nextId = Object.keys(collection).length;\n if (newDoc.hasOwnProperty('_id')) {\n throw new Error(`You cannot add a document that already has an _id. addDocument is for new documents that do not have an ID yet.`);\n }\n while (collection[nextId]) {\n nextId++;\n }\n newDoc._id = nextId;\n writeDocument(collectionName, newDoc);\n return newDoc;\n}", "static async addANewDocument (document) {\n if (typeof document !== 'object') {\n throw new Error('Bad Parameter');\n }\n\n // Retrieve instance of Mongo\n const db = await Mongo.instance().getDb();\n const isValid = await Document.isDocument(document);\n if (isValid.valid) {\n // Create a new document\n return db.collection(Document.COLLECTION).insertOne({\n ...document,\n createdAt: moment().toDate(),\n updatedAt: moment().toDate()\n });\n } else {\n log.debug('Warning - couldn\\'t insert document \\n', document);\n return null;\n }\n }", "async function sendData() {\n let ref = doc(db, \"Student\", usn.value); //collection for two parameter , doc for 3 parameter\n const docref = await setDoc( //addDoc for two parametr ,setDoc for 3 parameter\n ref, {\n Name: name.value,\n Age: age.value,\n USN: usn.value\n }\n )\n .then(() => {\n alert(\"added data into db\");\n })\n .catch((err) => {\n alert(err);\n })\n}", "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n db.modules.find({$or: [\n {_id: mongo.helper.toObjectID(updateModule._id)},\n {name: updateModule.name}\n ]}).toArray(function(err, modules){\n if(err){\n deferred.reject(err);\n }\n else if(modules.length == 0){\n deferred.reject(notFound);\n }\n //vali inputs, no other document have the same name\n else if(modules.length == 1){\n var oldModule = modules[0];\n \n //rename if old & new names are different\n if(oldModule.name != updateModule.name){\n db.bind(oldModule.name);\n db[oldModule.name].rename(updateModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n update();\n }\n });\n }\n //go straight to update\n else{\n update();\n }\n }\n //another module document with the same name exists\n else{\n deferred.reject(exists);\n }\n }); \n\n //updates the document in the 'modules' collection\n function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n\n return deferred.promise;\n}", "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n //check if the name of the selected module has not changed\n db.modules.findOne({_id: mongo.helper.toObjectID(updateModule._id)}, function(err, aModule){\n if(err){\n deferred.reject(err);\n }\n else if(aModule){\n //if names are different, renaming the collection must be executed, then proceed to update\n if(aModule.name != updateModule.name){\n db.bind(aModule.name);\n db[aModule.name].rename(updateModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n update();\n }\n });\n }\n }\n else{\n update();\n }\n });\n\n //updates the document in the 'modules' collection\n function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n\n return deferred.promise;\n}", "add(doc){const idx=this.size();if(isString(doc)){this._addString(doc,idx);}else {this._addObject(doc,idx);}}", "function addModuleToPipeline(moduleID, moduleName){\n\n var module_name = ''\n var documentation = ''\n var moduleSourceCode_settings = ''\n var moduleSourceCode_main = ''\n var moduleSourceCode_html = ''\n\n $.ajax({\n type: \"POST\",\n cache: false,\n url: \"/get_module_details\",\n data: 'p_module_key=' + moduleName,\n success: function (option) {\n //alert(\"@ success\");\n module_name = option.module_name\n documentation = option.documentation\n moduleSourceCode_settings = option.moduleSourceCode_settings\n moduleSourceCode_main = option.moduleSourceCode_main\n moduleSourceCode_html = option.moduleSourceCode_html\n user_role = option.user_role\n\n user_role_based_edit = ''\n if (user_role == 'image_researcher') {\n user_role_based_edit = '| <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"btn_edit_code\"> Edit </a> | <a style=\"font-size:12px;color:#000000;\" href=\"#\" > Contact Author </a>';\n }\n\n //Parse the givn XML for tool definition\n var xmlDoc = $.parseXML( moduleSourceCode_html );\n var $xml_tool_definition = $(xmlDoc);\n\n //the tool configuration.\n //TODO: add the input port info.\n var tool_configs = $xml_tool_definition.find(\"toolConfigurations\");\n tool_configs = tool_configs.html();\n\n\n\n var tool_documentation = $xml_tool_definition.find(\"toolDocumentation\");\n tool_documentation = tool_documentation.html();\n\n\n var ioInformation = '';\n\n var $toolInput = $xml_tool_definition.find(\"toolInput\");\n\n $toolInput.each(function(){\n\n var label = $(this).find('label').text(),\n dataFormat = $(this).find('dataFormat').text(),\n referenceVariable = $(this).find('referenceVariable').text();\n\n ioInformation += '<input type=\"text\" style=\"display:none;\" class=\"setting_param module_input '+ referenceVariable + '\" ' + ' size=\"45\"/>';\n\n\n });\n\n\n var $toolOutput = $xml_tool_definition.find(\"toolOutput\");\n\n $toolOutput.each(function(){\n\n var label = $(this).find('label').text(),\n dataFormat = $(this).find('dataFormat').text(),\n referenceVariable = $(this).find('referenceVariable').text();\n\n //var thisPortOutput = 'module_id_' + moduleID + '_' + referenceVariable+'.' + dataFormat;\n //var thisPortOutputPath = referenceVariable + '=\"' + thisPortOutput + '\"';\n\n ioInformation += '<input type=\"text\" style=\"display:none;\" class=\"setting_param module_output '+ referenceVariable + '\" size=\"45\"/>';\n\n\n });\n\n\n\n\n\n\n\n//Parse the givn XML\n//var xmlDoc = $.parseXML( xml );\n\n//var $xml = $(xmlDoc);\n\n // Find Person Tag\n//var $person = $xml.find(\"toolConfigurations\");\n\n\n //append new module to the pipeline...\n $(\"#img_processing_screen\").append(\n '<div style=\"background-color:#EEE;width:100%;display:none;\" class=\"module\" id=\"module_id_'+ moduleID +'\">' +\n\n '<!-- Documentation -->' +\n '<div style=\"margin:10px;font-size:17px;color:#000000;\">' +\n ' ' + module_name + ' (Module ' + moduleID + ')'+ '<hr/>' +\n ' Documentation: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"documentation_show_hide\">(Show/Hide)</a>' +\n '<div class=\"documentation\" style=\"background-color:#DDDDDD;display:none;font-size:14px;\">' + tool_documentation + '</div>' +\n '</div>' +\n\n\n '<!-- Settings -->' +\n '<div style=\"margin:10px;font-size:17px;color:#000000;\">' +\n ' Settings: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"settings_show_hide\">(Show/Hide)</a>' +\n ' <div class=\"settings\" style=\"background-color:#DDDDDD;font-size:14px;\">' + tool_configs + '<br/>' + ioInformation +\n '<input type=\"hidden\" class=\"setting_param \" size=\"45\" id=\"module_id_'+ moduleID +'_output_destination\"/>'+\n '</div>' +\n '</div>' +\n\n\n '<div style=\"margin:10px;font-size:17px;color:#000000;\" class=\"setting_section\">' +\n ' <a style=\"display:none;font-size:12px;color:#000000;\" href=\"#\" class=\"code_show_hide\">(Show/Hide)</a>' + user_role_based_edit +\n\n ' <div class=\"edit_code\" style=\"background-color:#888888;font-size:14px;display:none;\">' +\n ' <textarea rows=7 cols=150 class=\"code_settings\">' + moduleSourceCode_settings + '</textarea>' +\n ' <p style=\"color:#000000;\">Main Implementation: </p>' +\n ' <textarea rows=10 cols=150>' + moduleSourceCode_main + '</textarea>' +\n '</div>' +\n\n ' <pre style=\"background-color:#333333;width:100%;display:none;\" class=\"pre_highlighted_code\">' + '<code class=\"python highlighted_code\" style=\"display:none;\">' + moduleSourceCode_settings +\n ' ' +\n moduleSourceCode_main + '</code></pre>' +\n\n ' </div>' +\n\n '</div>'\n\n\n );//end of append\n\n\n\n\n\n\n\n\n $(\"#module_id_\"+ moduleID + \"_output_destination\").val(\"output_destination = '/home/ubuntu/Webpage/app_collaborative_sci_workflow/workflow_outputs/test_workflow/Module_\" + moduleID + \"'\").trigger('change');\n\n\n\n\n\n\n\n\n\n\n\n var listOfInputPorts = [];\n var listOfOutputPorts = [];\n\n\n\n //input port definition\n var $toolInput = $xml_tool_definition.find(\"toolInput\");\n\n $toolInput.each(function(){\n\n var label = $(this).find('label').text(),\n dataFormat = $(this).find('dataFormat').text(),\n referenceVariable = $(this).find('referenceVariable').text();\n\n //$(\"#ProfileList\" ).append('<li>' +label+ ' - ' +dataFormat+ ' - ' + idn +'</li>');\n\n var aNewInputPort = makePort(dataFormat,referenceVariable,true);\n listOfInputPorts.push(aNewInputPort);\n\n\n\n var thisPortInput = 'module_id_' + moduleID + '_NO_INPUT_SOURCE_SELECTED_.' + dataFormat;\n thisPortInput = referenceVariable + '=\"' + WORKFLOW_OUTPUTS_PATH + THIS_WORKFLOW_NAME + '/' +thisPortInput + '\"';\n\n $(\"#module_id_\"+moduleID + ' .' + referenceVariable).val(thisPortInput).trigger('change');\n\n });\n\n\n\n\n\n //output port definition\n var $toolOutput = $xml_tool_definition.find(\"toolOutput\");\n\n $toolOutput.each(function(){\n\n var label = $(this).find('label').text(),\n dataFormat = $(this).find('dataFormat').text(),\n referenceVariable = $(this).find('referenceVariable').text();\n\n //$(\"#ProfileList\" ).append('<li>' +label+ ' - ' +dataFormat+ ' - ' + idn +'</li>');\n\n var aNewOutputPort = makePort(dataFormat,referenceVariable,false);\n listOfOutputPorts.push(aNewOutputPort);\n\n\n var thisPortOutput = 'module_id_' + moduleID + '_' + referenceVariable+'.' + dataFormat;\n thisPortOutput = referenceVariable + '=\"' + WORKFLOW_OUTPUTS_PATH + THIS_WORKFLOW_NAME + '/' +thisPortOutput + '\"';\n\n $(\"#module_id_\"+moduleID + ' .' + referenceVariable).val(thisPortOutput).trigger('change');\n\n });\n\n\n\n\n\n makeTemplate(moduleName,\"images/55x55.png\", \"white\",\n listOfInputPorts,\n listOfOutputPorts);\n\n\n\n\n\n\n //Update the DAG\n //var newWorkflowModule = workflow.add(\"Module_\"+moduleID, \"Module_0\", workflow.traverseDF);\n //newWorkflowModule.nodeName = moduleName;\n //redrawWorkflowStructure();\n\n\n //alert(\"Add\");\n myDiagram.startTransaction(\"add node\");\n // have the Model add the node data\n var newnode = {\"key\":\"module_id_\" + moduleID, \"type\":moduleName, \"name\":moduleName, \"module_id\": \"Module \"+moduleID};\n myDiagram.model.addNodeData(newnode);\n // locate the node initially where the parent node is\n // diagram.findNodeForData(newnode).location = node.location;\n // and then add a link data connecting the original node with the new one\n //var newlink = { from: node.data.key, to: newnode.key };\n //diagram.model.addLinkData(newlink);\n // finish the transaction -- will automatically perform a layout\n myDiagram.commitTransaction(\"add node\");\n\n\n\n\n\n\n if(isItMyFloor() == false)lockParamsSettings();\n\n /*$('pre code').each(function (i, block) {\n hljs.highlightBlock(block);\n });*/\n\n\n },\n error: function (xhr, status, error) {\n alert(xhr.responseText);\n }\n\n });//end of ajax\n\n\n}", "async function createCollection(req, res) {\n\t\n\tlet data = req.body\n\n\tif (!data.projectId || !data.name) return res.status(400).send({ message: 'ERROR: projectId and name are required' })\n\n\ttry {\n\t\tlet newCollection = {\n\t\t\tid: generate(alphabet, 10),\n\t\t\tprojectId: data.projectId,\n\t\t\tname: data.name,\n\t\t\tmodel: data.model || []\n\t\t}\n\n\t\tconsole.log(newCollection)\n\n\t\t// let project = await Project.findOne({id: data.projectId})\n\t\t// project.collections.push(newCollection)\n\t\t// await project.update()\n\t\tlet collection = await Collection.create(newCollection)\n\n\t\treturn res.status(200).json(collection)\n\t}\n\tcatch(error) {\n\t\treturn res.status(500).send({ error: error.message })\n\t}\n}", "function createProject(user, project_fields) {\n return db\n .collection(\"projects\")\n .add(project_fields).then((new_project) => {\n const {appID, adminKey } = algoliaConfig;\n const client = algoliasearch(appID, adminKey);\n const index = client.initIndex('projects')\n const {title, description, createdBy, owner} = project_fields\n const objectID = new_project.id;\n \n // add project to owner's list\n db\n .doc(`users/${user.uid}`)\n .collection('projects').doc(new_project.id)\n .set({\n favorited: false,\n pinned: true,\n });\n\n // attach owner to project\n db\n .doc(`projects/${new_project.id}`)\n .collection('admins').doc(user.uid)\n .set({\n date_added: project_fields.date_created,\n is_owner: true,\n });\n\n // add projects to algolia\n console.log('saving project...');\n console.log('index:')\n console.log(index.saveObject)\n index.saveObject({title,\n objectID,\n title,\n description,\n createdBy,\n owner,\n id:objectID\n }).then(({objectID}) => console.log);\n });\n \n}", "function escribir(){\n db\n .collection(\"users\")\n .add({\n first: \"Pepe\",\n last: \"Perez\",\n born: 1815\n })\n .then(function(docRef) {\n console.log(\"Document written with ID: \", docRef.id);\n })\n .catch(function(error) {\n console.error(\"Error adding document: \", error);\n });\n}", "function addModuleToPipeline(moduleID, moduleName){\n\n var module_name = ''\n var documentation = ''\n var moduleSourceCode_settings = ''\n var moduleSourceCode_main = ''\n var moduleSourceCode_html = ''\n\n $.ajax({\n type: \"POST\",\n cache: false,\n url: \"/get_module_details\",\n data: 'p_module_key=' + moduleName,\n success: function (option) {\n\n module_name = option.module_name\n documentation = option.documentation\n moduleSourceCode_settings = option.moduleSourceCode_settings\n moduleSourceCode_main = option.moduleSourceCode_main\n moduleSourceCode_html = option.moduleSourceCode_html\n user_role = option.user_role\n\n user_role_based_edit = ''\n if (user_role == 'image_researcher') {\n user_role_based_edit = '| <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"btn_edit_code\"> Edit </a> | <a style=\"font-size:12px;color:#000000;\" href=\"#\" > Contact Author </a>';\n }\n\n\n\n\n //append new module to the pipeline...\n $(\"#img_processing_screen\").append(\n '<div style=\"background-color:#EEE;width:100%\" class=\"module\" id=\"module_id_'+ moduleID +'\">' +\n\n '<!-- Documentation -->' +\n '<div style=\"margin:10px;font-size:17px;color:#000000;\">' +\n ' ' + module_name + '<hr/>' +\n ' Documentation: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"documentation_show_hide\">(Show/Hide)</a>' +\n '<div class=\"documentation\" style=\"background-color:#888888;display:none;font-size:14px;\">' + documentation + '</div>' +\n '</div>' +\n\n\n '<!-- Settings -->' +\n '<div style=\"margin:10px;font-size:17px;color:#000000;\">' +\n ' Settings: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"settings_show_hide\">(Show/Hide)</a>' +\n ' <div class=\"settings\" style=\"background-color:#888888;display:none;font-size:14px;\">' + moduleSourceCode_html + '</div>' +\n '</div>' +\n\n\n '<div style=\"margin:10px;font-size:17px;color:#000000;\" class=\"setting_section\">' +\n ' Source Code: <a style=\"font-size:12px;color:#000000;\" href=\"#\" class=\"code_show_hide\">(Show/Hide)</a>' + user_role_based_edit +\n\n ' <div class=\"edit_code\" style=\"background-color:#888888;display:none;font-size:14px;\">' +\n ' <textarea rows=7 cols=180 class=\"code_settings\">' + moduleSourceCode_settings + '</textarea>' +\n ' <p style=\"color:#000000;\">Main Implementation: </p>' +\n ' <textarea rows=10 cols=180>' + moduleSourceCode_main + '</textarea>' +\n '</div>' +\n\n ' <pre style=\"background-color:#333333;width:100%;\" class=\"pre_highlighted_code\">' + '<code class=\"python highlighted_code\" style=\"display:none;\">' + moduleSourceCode_settings +\n ' ' +\n moduleSourceCode_main + '</code></pre>' +\n\n ' </div>' +\n\n '</div>'\n\n\n );//end of append\n\n if(isItMyFloor() == false)lockParamsSettings();\n\n $('pre code').each(function (i, block) {\n hljs.highlightBlock(block);\n });\n\n\n },\n error: function (xhr, status, error) {\n alert(xhr.responseText);\n }\n\n });//end of ajax\n\n\n}", "function updateModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n console.log(fieldObject);\n\n service.getModuleByName(moduleName).then(function(aModule){ \n //use array.filter() to get the duplicate fields\n var duplicateFields = aModule.fields.filter(function(field){\n //lesson learned: use toString() in id\n return field.id.toString() == fieldObject.id.toString() || field.name == fieldObject.name;\n });\n \n if(duplicateFields.length == 0){\n deferred.reject(notFound);\n }\n //valid inputs\n else if(duplicateFields.length == 1){\n //this is to ensure that the field is inside the specific module (in case of improper input parameters)\n\n fieldObject.id = new ObjectID(fieldObject.id);\n\n if(duplicateFields[0].id.toString() == fieldObject.id.toString()){\n db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n console.log(writeResult.result);\n deferred.resolve();\n }\n });\n }\n //the only element has the same name but is different id, therefore, not inside the module document\n else{\n deferred.reject(notFound);\n }\n }\n else{\n deferred.reject(exists);\n }\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function addDocument(collection, document, callback){\n\tMongoClient.connect(url, function(err, db){\n\t\tif (err) throw err\n\t\t\n\t\tdb.collection(collection).insert(document, function(err, result) \t\t\t\t{\n \t\t\tconsole.log(result)\n \t \tassert.equal(err, null);\n \t \tassert.equal(1, result.result.n);\n \t \tassert.equal(1, result.ops.length);\n \t \tdb.close()\n \t \tcallback(result);\n \t\t})\n\t})\n}", "addDocument(_id, _docType, _payload) {\n client.index({\n index: this.indexName,\n type: _docType,\n id: _id,\n body: _payload\n }, function (err, resp) {\n if (err) {\n console.log(err);\n }\n else {\n console.log(\"added or updated\", resp);\n }\n })\n }" ]
[ "0.79263556", "0.66809034", "0.66809034", "0.65259874", "0.6474247", "0.6462474", "0.6386402", "0.62038225", "0.6137509", "0.60923326", "0.60543627", "0.60535026", "0.60426795", "0.60029393", "0.5956532", "0.5956532", "0.5956532", "0.58633536", "0.5832858", "0.57799244", "0.57723767", "0.5765995", "0.56954175", "0.56861633", "0.566296", "0.5620292", "0.5595708", "0.5572104", "0.55378985", "0.55028796" ]
0.78352207
1
Function name: get documents of a module Author: Reccion, Jeremy Date Modified: 2018/04/04 Description: get all documents of a specific module Parameter(s): moduleName: string type Return: Promise
function getAllModuleDocs(moduleName){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); db.bind(moduleName); db[moduleName].find().toArray(function(err, moduleDocs){ if(err){ deferred.reject(err); } else{ deferred.resolve(moduleDocs); } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function getDocument(req, res, next){\n\n document.findAll({ attributes: ['name'] })\n .then(document => {\n res.status(200).send(document)\n })\n .catch(err => {\n res.status(400).send(e);\n })\n}", "GetAllDocuments() {\n return this.Start().then(Cache.DB).then(db => new Promise((resolve, reject) => {\n db.all('SELECT id, rev, body FROM couchbasesync WHERE dbName = ?', this[sDbName], (err, rows) => {\n if (err) {\n return reject(err);\n }\n\n const docs = [];\n rows.forEach((row) => {\n let JSONData = {};\n try {\n JSONData = JSON.parse(row.body);\n } catch (e) {\n this.emit('error', `Failed to parse JSON object for document body: ${row.id}`);\n }\n\n docs.push({\n id: row.id,\n rev: row.rev,\n doc: JSONData,\n });\n });\n\n return resolve(docs);\n });\n }));\n }", "function getAllDocuments (req, res) {\n Documents.query().then(data => res.json(data));\n\n}", "_getDocument(req, res, next) {\n const documentId = req.params.id\n this.engine.getDocument(documentId, function(err, jsonDoc, version) {\n if (err) return next(err)\n res.json({\n data: jsonDoc,\n version: version\n })\n })\n }", "function getTutorialsOfModule(req, res) {\n\t// Get projectID from query parameters to fetch only project's tutorials\n\t// Create query to get tutorials by projectID\n\tconst tutorialModuleID = req.params.moduleID;\n\tconst query = Tutorial.find({tutorialModuleID});\n\n\t// Execute query and return all modules that have the same projectID\n\tquery.exec((err, tutorials) => {\n\t\tif (err) {\n\t\t\tres.status(400).json({message: `Following error was encountered: ${err}`});\n\t\t} else if (!tutorials) {\n\t\t\tres.status(404).send('No tutorials found.');\n\t\t} else {\n\t\t\tres.status(200).json(tutorials);\n\t\t}\n\t});\n}", "function _getDocumentByProjectId(req, res) {\n var findObj = {\n deleteFlag: false,\n projectID: req.id\n };\n Document.find(findObj, function(err, docs) {\n if (err) {\n resultObj.status = FAIL;\n resultObj.result = err;\n } else {\n resultObj.status = OK;\n resultObj.result = docs;\n }\n res.send(resultObj);\n });\n}", "function findDuplicateDoc(moduleName, moduleDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //get the fields of the specific module\n service.getModuleByName(moduleName).then(function(aModule){\n //initialize array & object for querying\n var uniqueFields = [];\n var tempObj;\n\n //push the value of the document when a field is unique\n aModule.fields.forEach(function(field){\n if(field.unique){\n tempObj = {};\n tempObj[field.name] = moduleDoc[field.name];\n uniqueFields.push(tempObj);\n }\n });\n\n if(uniqueFields.length == 0){\n deferred.resolve();\n }\n else{\n //use $or for checking each field for uniqueness, not their combination\n db[moduleName].findOne({$or: uniqueFields}, function(err, duplicateDoc){\n if(err){\n deferred.reject(err);\n }\n //a duplicate exists, but needs further checking\n else if(duplicateDoc){\n //updating a module document\n if(moduleDoc._id){\n //different module documents with similar unique values\n if(moduleDoc._id != duplicateDoc._id){\n deferred.reject(exists);\n }\n //since it is the same document, it is not duplicate\n else{\n deferred.resolve();\n }\n }\n //adding new module documennt\n else{\n deferred.reject(exists);\n }\n }\n //does not exist\n else{\n deferred.resolve();\n }\n });\n }\n\n \n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function queryModNames() {\n db.collection('modules')\n .get()\n .then((querySnapshot) => {\n querySnapshot.forEach((doc) => {\n let modNameObj = {};\n modNameObj.value = doc.id;\n modNameObj.label = doc.data().module.name;\n if (modNameObj.label !== 'Jumpshot Tutor') {\n allModules.push(modNameObj);\n }\n setModNamesIsLoading(false);\n });\n return allModules;\n });\n }", "getDocuments(collectionName, query, projection) {\n return new Promise((resolve, reject) => {\n this.find(collectionName, query, projection).then(resolve).catch(reject);\n });\n }", "get(req, res) {\n const { id } = req.params;\n\n return Document.find({ _id: id })\n .then((documents) => res.json(documents))\n .catch((err) => res.send(err));\n }", "getListBookDoc(docname){\n\t\t// console.log(catename);\n\t\t$.ajax({\n\t\t\turl: '/api/bookdoc/' + docname,\n\t\t\ttype: 'GET',\n\t\t})\n\t\t.done((data) => {\n\t\t\tthis.actions.getListBookDocSuccess(data);\n\t\t})\n\t\t.fail((jqXhr) => {\n\t\t\tthis.actions.getListBookDocFail(jqXhr.responseJSON.message);\n\t\t});\n\t}", "function findDuplicateDoc(moduleName, moduleDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //get the fields of the specific module\n service.getModuleByName(moduleName).then(function(aModule){\n //initialize array & object for querying\n var uniqueValues = [];\n var tempObj;\n\n //push the value of the document when a field is unique\n aModule.fields.forEach(function(field){\n if(field.unique){\n tempObj = {};\n tempObj[field.name] = moduleDoc[field.name];\n uniqueValues.push(tempObj);\n }\n });\n\n if(uniqueValues.length == 0){\n deferred.resolve();\n }\n else{\n db.bind(moduleName);\n\n //use $or for checking each field for uniqueness, not their combination\n db[moduleName].findOne({$or: uniqueValues}, function(err, duplicateDoc){\n if(err){\n deferred.reject(err);\n }\n //a duplicate exists, but needs further checking\n else if(duplicateDoc){\n //updating a module document\n if(moduleDoc._id){\n //different module documents with similar unique values\n if(moduleDoc._id != duplicateDoc._id){\n deferred.reject(exists);\n }\n //since it is the same document, it is not duplicate\n else{\n deferred.resolve();\n }\n }\n //adding new module documennt\n else{\n deferred.reject(exists);\n }\n }\n //does not exist - similar to notFound. but it is not rejected based on design\n else{\n deferred.resolve();\n }\n });\n }\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "async function getDocuments() {\n const snapshot = await collectionG1.get();\n\n if (snapshot.empty) {\n console.log(\"No documents found...\");\n return;\n } else {\n // List with data of documents\n var docsList = snapshot.docs.map((doc) => doc.data());\n // List with documents\n // var docsList = snapshot.docs.map((doc) => doc);\n return docsList;\n }\n}", "function getMovies() {\n MovieService.movies().then(res => {\nconsole.log(res.data.rows)\n let movies = res.data.rows;\n movies = movies.map((obj) => obj.doc);\n displayMovies(movies)\n })\n .catch((err) => {\n console.error(err);\n });\n\n}", "getDocumentByID(id, headers = null, params = null) {\n // Expose fields to promise\n let client = this.client;\n let selectDefault = this.selectDefault;\n\n id = StringHelpers.clean(id);\n\n // Initialize an empty document from type\n let documentType = this.documentType;\n\n return new Promise(\n // The resolver function is called with the ability to resolve or\n // reject the promise\n function(resolve, reject) {\n\n let defaultParams = {\n query: \n \"SELECT * FROM \" + documentType.prototype.entityTypeName + \" WHERE (ecm:uuid='\" + id + \"' AND \" + selectDefault + \")\"\n };\n\n let defaultHeaders = {};\n\n params = Object.assign(defaultParams, params);\n headers = Object.assign(defaultHeaders, headers);\n\n client.operation('Document.Query')\n .params(params)\n .execute(headers).then((response) => { \n if (response.entries.length > 0) {\n resolve(new documentType(response.entries[0]));\n } else {\n reject('No ' + documentType.prototype.entityTypeName +' found');\n }\n }).catch((error) => { throw error });\n });\n }", "async loadDocumentContent (documentPath) {\n const doc = await this.fetch(`/load_document?d=${documentPath}`) \n return this.parseDocument(doc);\n }", "function doc(moduleName) {\n exports.modules.push(moduleName);\n}", "function getParticularAppDoc(req, res) {\n var id = req.params.id\n dbconn.getAppointsForEachDoc(id, (err, result) => {\n if (err) {\n console.log(err)\n } else {\n if (result.length > 0) {\n console.log(result)\n res.send(result)\n } else {\n res.send(\"No Data Found\")\n }\n }\n })\n}", "async function getModules() {\n\n const pool = await db.dbConnection()\n\n const getQuery = `SELECT * FROM public.modules`;\n\n try {\n pool.query(getQuery, function (err, recordset) {\n\n if (err) {\n\n console.log('getModules', err)\n\n } else {\n\n // send records as a response\n return recordset.rows;\n }\n });\n }\n\n catch (error) {\n res.status(402).json('record insert failed with error: ' + parseError(error, getQuery))\n }\n}", "function search_documentation(query) {\n var doc_url = \"https://projectchrono.org\";\n var doc_search_url = \"/doxygen\";\n var page = \"0\";\n var number = \"40\";\n var callback = \"docshow\"\n var search_string = \"?q=\" + query +\"&n=\" + number + \"&p=\" + page + \"&cb=\" + callback;\n $.ajax({\n url: doc_url + doc_search_url + search_string,\n method: \"GET\",\n data: \"\",\n dataType:\"jsonp\",\n jsonpCallback: \"docshow\",\n success: function (response, status, xhr) {\n docshow(response);\n console.log(response);\n },\n error: function (xhr, status, error_code) {\n console.log(\"Error:\" + status + \": \" + error_code);\n }\n })\n }", "function getListItems() {\n var request = $http({\n method: \"get\",\n url: \"/api/documents\",\n params: {\n action: \"get\"\n }\n });\n\n return(request.then(handleSuccess, handleError));\n }", "function getDocument(court, caseNumber, docketSeq, docNumber) {\n const caseApi = new CourtApi.CaseApi();\n\n return new Promise((resolve, reject) => {\n caseApi.getDocketDocument(court, caseNumber, docketSeq, docNumber,\n handlers.promiseCallback(resolve, reject)\n );\n });\n}", "function getDocuments(page, callback) {\n var query = ALL_DOC_QUERY + '&limit=' + PER_PAGE + '&skip=' + (PER_PAGE * page);\n var url = buildQuery(query, DATABASE);\n Vue.http.get(url).then(function (res) {\n if (callback) callback(unpackAttribute(res.data.rows, 'doc'));\n }, function (res) {\n if (callback) callback(null, 'Could not fetch data from cloudant');\n });\n}", "getAll(req, res) {\n const { page, limit } = req.params;\n\n return Document.find({})\n .skip((page - 1) * limit)\n .limit(limit)\n .then((documents) => res.json(documents))\n .catch((err) => res.send(err));\n }", "getAllDocumentsByDate(req, res) {\n const { page, limit } = req.params;\n\n return Document.find({\n dateCreated: {\n $gt: moment().subtract(1, 'day'),\n $lt: moment().add(1, 'day'),\n },\n })\n .skip((page - 1) * limit)\n .limit(limit)\n .then((documents) => res.json(documents))\n .catch((err) => res.send(err));\n }", "function list() {\n return db.allDocs({\n /*This tells the server to get all docs that start with article*/\n startkey: 'article',\n endkey: 'article{}',\n inclusive_end: true,\n /*Include not just the key but all fields*/\n include_docs: true\n })\n .then(function(res) {\n console.log(res.rows);\n return res.rows.map(function(r) {\n return r.doc;\n });\n });\n }", "async function getIndex(req, res) {\n const key = req.headers['x-token']; // get token from header\n const userId = await redisClient.get(`auth_${key}`);\n\n let user = ''; // find and store user\n if (userId) user = await dbClient.client.collection('users').findOne({ _id: ObjectId(userId) });\n else res.status(401).json({ error: 'Unauthorized' });\n\n let docs = '';\n let documents = []; // to return\n\n // if parentId is passed as query string, filter by this id. Otherwise filter by userId\n if (req.query.parentId) {\n docs = await dbClient.client.collection('files').find({ parentId: req.query.parentId });\n } else docs = await dbClient.client.collection('files').find({ userId: ObjectId(user._id) });\n\n // if page is passed as query string, only get the 20 items of that page\n if (req.query.page) {\n const pagination = await dbClient.client.collection('files').aggregate([\n {\n $facet: {\n data: [{ $skip: (req.query.page * 2) }, { $limit: 2 }],\n },\n },\n ], docs);\n await pagination.forEach((data) => {\n documents = data.data;\n });\n } else await docs.forEach((d) => documents.push(d)); // without pagination\n\n if (documents) res.json(documents);\n else res.status(404).json({ error: 'Not Found' });\n}", "function getDocument(documentId) {\n\n return $http.get(\"component/getwithextradata\",{\n params: {\n documentId: documentId\n }\n });\n\n return request;\n }", "function fetchDocuments(_param, _callback){\n var data = {\n start : parseInt(_param.start,10) || 0,\n cat : _param.cat,\n num : parseInt(_param.num,10) || PAGESIZE\n };\n\n $.ajax({\n url: DOCUMENTS_URL + _param.cat + '/',\n data: data,\n success: function(_res){\n if(_callback){\n _callback(_res);\n }\n },\n error: function(){\n \n }\n });\n }", "function getAllModules(){\n var deferred = Q.defer();\n db.modules.find().toArray(function(err, modules){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve(modules);\n }\n });\n\n return deferred.promise;\n}" ]
[ "0.6185267", "0.5993622", "0.59846175", "0.59552914", "0.57914364", "0.5780547", "0.57780313", "0.57778186", "0.5751649", "0.57448214", "0.5715541", "0.5707072", "0.5701094", "0.5696588", "0.56830984", "0.56245357", "0.56133175", "0.55978113", "0.55827266", "0.5580734", "0.55675834", "0.5550082", "0.5536222", "0.55329823", "0.55166954", "0.5499953", "0.5486899", "0.54621136", "0.54202133", "0.53830093" ]
0.8136698
1
Function name: update a module document Author: Reccion, Jeremy Date Modified: 2018/04/04 Description: update a document of a specific module Parameter(s): moduleName: string type updateDoc: object type. includes: _id: required. string type //fields must be the specific module's 'fields' in 'modules' collection Return: Promise
function updateModuleDoc(moduleName, updateDoc){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); service.findDuplicateDoc(moduleName, updateDoc).then(function(){ db.bind(moduleName); //convert '_id' to ObjectID updateDoc._id = new ObjectID(updateDoc._id); db[moduleName].update({_id: updateDoc._id}, {$set: updateDoc}, function(err, writeResult){ if(err){ deferred.reject(err); } else{ if(writeResult.result.nModified == 0){ deferred.reject(notFound); } else{ deferred.resolve(); } } }); }).catch(function(err){ deferred.reject(err); }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateModuleDoc(moduleName, updateDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateDoc);\n delete forUpdate._id;\n\n db[moduleName].update({_id: mongo.helper.toObjectID(updateDoc._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n db.modules.find({$or: [\n {_id: mongo.helper.toObjectID(updateModule._id)},\n {name: updateModule.name}\n ]}).toArray(function(err, modules){\n if(err){\n deferred.reject(err);\n }\n else if(modules.length == 0){\n deferred.reject(notFound);\n }\n //vali inputs, no other document have the same name\n else if(modules.length == 1){\n var oldModule = modules[0];\n \n //rename if old & new names are different\n if(oldModule.name != updateModule.name){\n db.bind(oldModule.name);\n db[oldModule.name].rename(updateModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n update();\n }\n });\n }\n //go straight to update\n else{\n update();\n }\n }\n //another module document with the same name exists\n else{\n deferred.reject(exists);\n }\n }); \n\n //updates the document in the 'modules' collection\n function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n\n return deferred.promise;\n}", "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n //check if the name of the selected module has not changed\n db.modules.findOne({_id: mongo.helper.toObjectID(updateModule._id)}, function(err, aModule){\n if(err){\n deferred.reject(err);\n }\n else if(aModule){\n //if names are different, renaming the collection must be executed, then proceed to update\n if(aModule.name != updateModule.name){\n db.bind(aModule.name);\n db[aModule.name].rename(updateModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n update();\n }\n });\n }\n }\n else{\n update();\n }\n });\n\n //updates the document in the 'modules' collection\n function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n\n return deferred.promise;\n}", "function updateModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n fieldObject.id = new ObjectID(fieldObject.id);\n \n db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n console.log(fieldObject);\n\n service.getModuleByName(moduleName).then(function(aModule){ \n //use array.filter() to get the duplicate fields\n var duplicateFields = aModule.fields.filter(function(field){\n //lesson learned: use toString() in id\n return field.id.toString() == fieldObject.id.toString() || field.name == fieldObject.name;\n });\n \n if(duplicateFields.length == 0){\n deferred.reject(notFound);\n }\n //valid inputs\n else if(duplicateFields.length == 1){\n //this is to ensure that the field is inside the specific module (in case of improper input parameters)\n\n fieldObject.id = new ObjectID(fieldObject.id);\n\n if(duplicateFields[0].id.toString() == fieldObject.id.toString()){\n db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n console.log(writeResult.result);\n deferred.resolve();\n }\n });\n }\n //the only element has the same name but is different id, therefore, not inside the module document\n else{\n deferred.reject(notFound);\n }\n }\n else{\n deferred.reject(exists);\n }\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }", "function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }", "function updateFieldArray(moduleName, fieldArray){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //need to convert each 'id' property to an ObjectID\n for(var i = 0; i < fieldArray.length; i++){\n fieldArray[i].id = new ObjectID(fieldArray[i].id);\n }\n \n\n db.modules.update({name: moduleName}, {$set: {fields: fieldArray}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateFieldArray(moduleName, fieldArray){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.modules.update({name: moduleName}, {$set: {fields: fieldArray}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function findDuplicateDoc(moduleName, moduleDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //get the fields of the specific module\n service.getModuleByName(moduleName).then(function(aModule){\n //initialize array & object for querying\n var uniqueFields = [];\n var tempObj;\n\n //push the value of the document when a field is unique\n aModule.fields.forEach(function(field){\n if(field.unique){\n tempObj = {};\n tempObj[field.name] = moduleDoc[field.name];\n uniqueFields.push(tempObj);\n }\n });\n\n if(uniqueFields.length == 0){\n deferred.resolve();\n }\n else{\n //use $or for checking each field for uniqueness, not their combination\n db[moduleName].findOne({$or: uniqueFields}, function(err, duplicateDoc){\n if(err){\n deferred.reject(err);\n }\n //a duplicate exists, but needs further checking\n else if(duplicateDoc){\n //updating a module document\n if(moduleDoc._id){\n //different module documents with similar unique values\n if(moduleDoc._id != duplicateDoc._id){\n deferred.reject(exists);\n }\n //since it is the same document, it is not duplicate\n else{\n deferred.resolve();\n }\n }\n //adding new module documennt\n else{\n deferred.reject(exists);\n }\n }\n //does not exist\n else{\n deferred.resolve();\n }\n });\n }\n\n \n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function addModuleDoc(moduleName, newDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].insert(newDoc, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function addModuleDoc(moduleName, newDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n service.findDuplicateDoc(moduleName, newDoc).then(function(){\n db.bind(moduleName);\n\n db[moduleName].insert(newDoc, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function findDuplicateDoc(moduleName, moduleDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //get the fields of the specific module\n service.getModuleByName(moduleName).then(function(aModule){\n //initialize array & object for querying\n var uniqueValues = [];\n var tempObj;\n\n //push the value of the document when a field is unique\n aModule.fields.forEach(function(field){\n if(field.unique){\n tempObj = {};\n tempObj[field.name] = moduleDoc[field.name];\n uniqueValues.push(tempObj);\n }\n });\n\n if(uniqueValues.length == 0){\n deferred.resolve();\n }\n else{\n db.bind(moduleName);\n\n //use $or for checking each field for uniqueness, not their combination\n db[moduleName].findOne({$or: uniqueValues}, function(err, duplicateDoc){\n if(err){\n deferred.reject(err);\n }\n //a duplicate exists, but needs further checking\n else if(duplicateDoc){\n //updating a module document\n if(moduleDoc._id){\n //different module documents with similar unique values\n if(moduleDoc._id != duplicateDoc._id){\n deferred.reject(exists);\n }\n //since it is the same document, it is not duplicate\n else{\n deferred.resolve();\n }\n }\n //adding new module documennt\n else{\n deferred.reject(exists);\n }\n }\n //does not exist - similar to notFound. but it is not rejected based on design\n else{\n deferred.resolve();\n }\n });\n }\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n //the query searches for the module name that do not have the inputted field name\n //this is to avoid pushing same field names on the 'fields' array of the specified module\n //writeResult will determine if the update was successful or not (i.e. writeResult.result.nModified)\n db.modules.update({name: moduleName, fields: {$not: {$elemMatch: {name: fieldObject.name}}}}, {$push: {fields: fieldObject}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n //console.log(writeResult.result);\n //check the status of the update, if it failed, it means that there is an existing field name\n if(writeResult.result.nModified == 0){\n deferred.reject(exists);\n }\n else{\n deferred.resolve();\n }\n }\n });\n\n return deferred.promise;\n}", "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n db.modules.update({name: moduleName}, {$push: {fields: fieldObject}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function changeModName() {\n //console.log('Modname' + modName);\n db.collection('modules')\n .doc(module.value)\n .update({\n 'module.name': modName,\n })\n .then(function () {\n console.log('modName updated successfully');\n history.push('/success');\n });\n }", "function changeDoc(req, res) {\n var id = req.swagger.params.id.value;\n var data = JSON.parse(req.swagger.params.docname.value);\n var userId = req.decoded.user_id;\n var clientId = req.decoded.client_id;\n var name = data.docname;\n var autor = data.autor;\n var filename = data.filename\n var query = '';\n //console.log(name); \n if (data.docname) {\n query = `Update sadrzaj set \n name = '` + name + `', \n modified_by = ` + userId + `,\n modified_ts = NOW()\n\n where id =` + id + ` `;\n }\n if (data.autor) {\n query = `Update ri.dokumentacija set \n autor = '` + autor + `'\n where id =` + id + ` `;\n }\n if(data.filename)\n {\n query = `Update ri.dokumentacija set \n link = '` + filename + `' \n where id =` + id + ` `;\n }\n console.log(query);\n \n var client = new pg.Client(conString);\n client.connect(function(err) {\n if (err) {\n return console.error('could not connect to postgres', err);\n } else { \n client.query(query, function(err, result) {\n if (err) {\n return console.error('error running query', err);\n } else {\n\n res.json(\"Changed\");\n }\n })\n }\n })\n\n \n}", "function deleteModuleDoc(moduleName, id){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].remove({_id: mongo.helper.toObjectID(id)}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function deleteModuleDoc(moduleName, id){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].remove({_id: mongo.helper.toObjectID(id)}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n //n is used to know if the document was removed\n if(writeResult.result.n == 0){\n deferred.reject(notFound);\n }\n else{\n deferred.resolve();\n }\n }\n });\n\n return deferred.promise;\n}", "function orgUpdateField(org_id, fieldName, fieldValue ) {\n\n // var member = globalMembers.find(function (member) { return member.id === member_id; }); //get the member object\n \n var ckanParameters = { id: org_id };\n ckanParameters[fieldName] = fieldValue;\n\n\n\n\n debugger;\n var client = new CKAN.Client(ckanServer, myAPIkey);\n\n client.action('organization_patch', ckanParameters,\n function (err, result) {\n if (err != null) { //some error - try figure out what\n mylog(mylogdiv, \"orgUpdateField ERROR: \" + JSON.stringify(err));\n console.log(\"orgUpdateField ERROR: \" + JSON.stringify(err));\n //return false;\n return 0;\n } else // we have managed to update. We are getting the full info for the org as the result\n {\n console.log(\"orgUpdateField RETURN: \" + JSON.stringify(result.result));\n //return true;\n return 1;\n // update the globalMembers array\n // update the screen\n\n }\n\n });\n\n\n}", "function deleteModuleField(moduleName, fieldID){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n \n db.modules.update({name: moduleName}, {$pull: {fields: {id: mongo.helper.toObjectID(fieldID)}}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n if(writeResult.result.nModified == 0){\n deferred.reject(notFound);\n }\n else{\n deferred.resolve();\n }\n }\n });\n\n return deferred.promise;\n}", "function updateDocument(params) {\n var deferred = $q.defer();\n\n $http({\n method: 'POST',\n url: $rootScope.serverEndpoint + 'jsonServices/updateDocument',\n data: {\n 'tokenAuthentication': params.tokenAuthentication,\n 'documentID': params.documentID,\n 'fields': params.fields,\n 'resource': (params.resource) ? params.resource : undefined\n }\n })\n \n .then(function(response) {\n if(response.data.codRet == WS_SUC_COD_RET) {\n deferred.resolve(response.data);\n } else if (response.data.codRet == WS_EXP_COD_RET) {\n deferred.reject(response.data.msg);\n } else {\n deferred.reject(response.data.msg);\n }\n })\n .catch(function(errorResponse) {\n deferred.reject(errorResponse);\n });\n\n return deferred.promise;\n }", "update(req, res) {\n // update only allowed for authorised user of their own documents or admin\n const isPermittedUser =\n req.decoded.role === 'Administrator' || req.decoded._id === req.params.id;\n\n if (!isPermittedUser) {\n return res.json(403, {\n message: 'Forbidden to update this document.',\n });\n }\n\n return Document.findOneAndUpdate(\n { _id: req.params.id },\n {\n title: req.body.title,\n content: req.body.content,\n },\n )\n .then((document) =>\n res.status(200).json({\n document,\n success: true,\n message: 'Successfully updated Document!',\n }),\n )\n .catch((err) => res.status(500).send(err));\n }", "function deleteModuleField(moduleName, fieldID){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n \n db.modules.update({name: moduleName}, {$pull: {fields: {id: mongo.helper.toObjectID(fieldID)}}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "async function updateResourceHandler(request, response) {\n const { _id } = request.variablePath;\n console.log(_id);\n const { parsedBody, db } = response;\n console.log(parsedBody);\n \n // get the db isntance\n const collection = db.collection(__collectionName);\n\n // now that we have the parsed body, we set the update parameter in mongodb\n // filter parameter\n\n const query = {\n _id: ObjectID.createFromHexString(_id),\n }\n // udpate paramter\n const update = {\n $set: parsedBody,\n };\n // options parameter\n const options = {\n returnOriginal: false,\n };\n try {\n const resultCommand = await collection.findOneAndUpdate(\n query,\n update,\n options,\n );\n // get the updated document\n const { value: updatedDocument } = resultCommand;\n console.log(resultCommand);\n response.jsonify(envelop.dataEnvelop(updatedDocument));\n \n } catch (error) {\n console.log(error);\n if (error instanceof MongoError) {\n if (error.code === 11000) {\n // that means this duplicate error message\n response.badRequestError(envelop.duplicateValueError(parsedBody));\n } else {\n response.badRequestError(envelop.unknownError());\n }\n } else {\n response.badRequestError(envelop.unknownError());\n }\n }\n }", "update(req, res) {\n if (!req.body.title || req.body.title === ''\n || !req.body.content || req.body.content === '') {\n res.send({ message: 'Both fields are required' });\n } else {\n Document.findOne({ where: { id: req.params.id } })\n .then((document) => {\n if (!document) {\n res.status(404).send({ message: 'Document could not be found!' });\n } else if (document.userId !== req.decoded.id) {\n res.status(401).send({ message: 'You can only update documents you own!' });\n } else {\n document.updateAttributes({\n title: req.body.title || document.title,\n content: req.body.content || document.content,\n }).then(() => {\n res.status(200).send({ message: 'Your document was successfully updated!' });\n });\n }\n });\n }\n }", "function updateOpportunitySource(req, res) {\n if (!validator.isValid(req.body.sourceName)) {\n res.json({\n code: Constant.ERROR_CODE,\n message: Constant.FIELD_REQUIRED\n });\n }\n else {\n source.findOne({sourceName: {$regex: new RegExp('^' + req.body.sourceName + '$', \"i\")}, moduleType: req.body.moduleType, deleted: false, companyId: req.body.companyId}, function(err, statusData) {\n if (err) {\n res.json({code: Constant.ERROR_CODE, message: err});\n }\n else {\n if (statusData) {\n res.json({\n code: Constant.ERROR_CODE,\n message: Constant.CONTACT_STATUS_EXIST\n });\n }\n else {\n var sourceDataField = {\n sourceName: req.body.sourceName,\n companyId: req.body.companyId,\n userId: req.body.userId\n\n };\n source.findByIdAndUpdate(req.body.sourceId, sourceDataField, function(err, data) {\n if (err) {\n res.json({code: Constant.ERROR_CODE, message: err});\n } else {\n res.json({code: Constant.SUCCESS_CODE, data: data});\n }\n });\n }\n\n }\n });\n }\n\n\n}", "static async modifyDocument (id, document) {\n if (typeof document !== 'object') {\n throw new Error('Bad Parameter');\n }\n const db = await Mongo.instance().getDb();\n const isValid = await Document.isDocument(document);\n if (isValid.valid) {\n // Create a new document\n // Uploaded document with new informations.\n const res = await db.collection(Document.COLLECTION).updateOne(\n {\n _id: ObjectId(id)\n },\n {\n $set: {\n ...document,\n updatedAt: moment().toDate()\n }\n }\n );\n return res;\n } else {\n log.debug('Warning - couldn\\'t modify document \\n', document);\n return null;\n }\n }", "update(req,res,next){\n console.log(\"Update...\")\n //we check the req for an id\n if(!req.query.hasOwnProperty(\"id\")){\n return res.status(400).send(\"Missing ID Parameter.\");\n }\n let id = req.query.id;\n\n Contact.findByIdAndUpdate(id,req.body).exec()\n .then(doc=>{\n res.status(200).json(doc);\n })\n .catch(err=>{\n res.status(500).send(\"There was an error.\")\n })\n }", "async update({ request, response, auth }) {\n try {\n let body = request.only(fillable)\n const id = request.params.id\n const data = await StudyProgram.find(id)\n if (!data || data.length === 0) {\n return response.status(400).send(ResponseParser.apiNotFound())\n }\n const isUniversityExists = await CheckExist(\n body.university_id,\n \"University\"\n )\n if (!isUniversityExists) {\n return response\n .status(422)\n .send(ResponseParser.apiValidationFailed(\"University not fund\"))\n }\n\n const isStudyNameExists = await CheckExist(\n body.study_name_id,\n \"StudyName\"\n )\n if (!isStudyNameExists) {\n return response\n .status(422)\n .send(ResponseParser.apiValidationFailed(\"StudyName not fund\"))\n }\n await data.merge(body)\n await data.save()\n await RedisHelper.delete(\"StudyProgram_*\")\n await RedisHelper.delete(\"StudyYear_*\")\n await RedisHelper.delete(\"MarketingTarget_*\")\n await data.loadMany([\"university\", \"studyName\", \"years\"])\n const jsonData = data.toJSON()\n const activity = `Update StudyProgram \"${jsonData.studyName.name}\" in \"${\n jsonData.university.name\n }\" university`\n await ActivityTraits.saveActivity(request, auth, activity)\n let parsed = ResponseParser.apiUpdated(data.toJSON())\n return response.status(200).send(parsed)\n } catch (e) {\n ErrorLog(request, e)\n return response.status(500).send(ResponseParser.unknownError())\n }\n }" ]
[ "0.8221811", "0.7874364", "0.77189493", "0.738352", "0.72332454", "0.68794364", "0.68794364", "0.68435234", "0.6736119", "0.63068366", "0.6303614", "0.62880695", "0.62741476", "0.6246192", "0.61462486", "0.61180973", "0.60007644", "0.59134805", "0.59115833", "0.58952177", "0.5873493", "0.58626056", "0.5856888", "0.5749113", "0.5707836", "0.5691329", "0.55863655", "0.5579424", "0.54561806", "0.5444204" ]
0.80793613
1
Function name: delete a module document Author: Reccion, Jeremy Date Modified: 2018/04/04 Description: delete a document of a specific module Parameter(s): moduleName: string type id: string type. //id of the specific document Return: Promise
function deleteModuleDoc(moduleName, id){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); db.bind(moduleName); db[moduleName].remove({_id: mongo.helper.toObjectID(id)}, function(err, writeResult){ if(err){ deferred.reject(err); } else{ //n is used to know if the document was removed if(writeResult.result.n == 0){ deferred.reject(notFound); } else{ deferred.resolve(); } } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteModuleDoc(moduleName, id){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].remove({_id: mongo.helper.toObjectID(id)}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function deleteModule(moduleName){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //drop the collection\n db.bind(moduleName);\n db[moduleName].drop(function(err){\n if(err){\n if(err.codeName == 'NamespaceNotFound'){\n deferred.reject(notFound);\n }\n else{\n deferred.reject(err);\n }\n }\n else{\n //remove document from 'modules' collection\n db.modules.remove({name: moduleName}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n //n is used to know if the document was removed\n if(writeResult.result.n == 0){\n deferred.reject(notFound);\n }\n else{\n deferred.resolve();\n }\n }\n });\n }\n });\n\n return deferred.promise;\n}", "function deleteModule(id, moduleName){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //drop the collection\n db.bind(moduleName);\n db[moduleName].drop();\n\n //remove document from 'modules' collection\n db.modules.remove({_id: mongo.helper.toObjectID(id)}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function deleteMod() {\n // eslint-disable-next-line no-restricted-globals\n if (\n confirm(\n 'Are you sure you want to delete this module? This cannot be undone.',\n )\n ) {\n db.collection('modules')\n .doc(module.value)\n .delete()\n .then(function () {\n history.push('/success');\n console.log('doc deleted successfully');\n return true;\n });\n } else {\n return false;\n }\n }", "_deleteDocument(req, res, next) {\n let documentId = req.params.id\n this.engine.deleteDocument(documentId, function(err, result) {\n if (err) return next(err)\n res.json(result)\n })\n }", "function deleteModuleField(moduleName, fieldID){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n \n db.modules.update({name: moduleName}, {$pull: {fields: {id: mongo.helper.toObjectID(fieldID)}}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function deleteModuleField(moduleName, fieldID){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n \n db.modules.update({name: moduleName}, {$pull: {fields: {id: mongo.helper.toObjectID(fieldID)}}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n if(writeResult.result.nModified == 0){\n deferred.reject(notFound);\n }\n else{\n deferred.resolve();\n }\n }\n });\n\n return deferred.promise;\n}", "deleteModule(moduleId, passphrase) {\n return this.httpService({\n method: 'DELETE',\n url: `${this.rootURL}microAnalytics?microAnalyticsId=${moduleId}`,\n headers: {Authorization: `basic ${passphrase}`}\n });\n }", "async deleteProduct(req, res, next) {\n console.log(\"inside delete function\");\n let document;\n try {\n document = await ProductDB.findOneAndDelete({ _id: req.params.id });\n // console.log(document.image);\n fs.unlink(document.image, (error) => {\n if (error) {\n return next(error);\n }\n });\n } catch (error) {\n return next(error);\n }\n res.json({ document });\n }", "_delete (moduleName){\n delete this._dynamicParentsMap[moduleName];\n // SystemJs doesn't do this?\n delete this._system.loads[moduleName];\n // Do regular delete\n return this._systemDelete.apply(this._system, arguments);\n }", "static deleteDocument(pathOrUid = \"\", type, headers = {}, params = {}) {\n\n let properties = this.properties;\n\n return new Promise(\n function(resolve, reject) {\n properties.client\n .repository()\n .delete(pathOrUid, headers)\n .then((res) => {\n resolve(res);\n }).catch((error) => {\n\n if (error.hasOwnProperty('response')) {\n error.response.json().then(\n (jsonError) => {\n reject(StringHelpers.extractErrorMessage(jsonError));\n }\n );\n } else { \n return reject(error || 'Could not access server');\n }\n });\n });\n }", "async deleteDocument(ctx, documentId) {\n const exists = await this.documentExists(ctx, documentId);\n if (!exists) {\n throw new Error(`The document ${documentId} does not exist`);\n }\n await ctx.stub.deleteState(documentId);\n }", "removeDocument(_docId, event) {\n event.preventDefault();\n const { contractInst, account } = this.props;\n //condition for docid \n if (_docId) {\n contractInst.methods.removeNotarizedDocument(_docId).send({ from: account })\n .then(res => {\n //show toast message\n toast.success(\"Your document has been removed successfully !\");\n //update document list\n this.props.updateList(event);\n }).catch(err => {\n console.error(\"---Error while removing document---\".err);\n });\n }\n }", "delete(req, res) {\n // delete only allowed for authorised user of their own documents or admin\n const isPermittedUser =\n req.decoded.role === 'Administrator' || req.decoded._id === req.params.id;\n\n if (!isPermittedUser) {\n return res.json(403, {\n message: 'Forbidden to delete this document.',\n });\n }\n\n return Document.findOneAndRemove({ _id: req.params.id })\n .then((document) => res.status(200).json({ message: document }))\n .catch((err) => res.status(500).json({ message: err }));\n }", "deleteOne(req, res) {\n const user = req.decoded;\n Document.findById(req.params.id)\n .then((document) => {\n if (!document || document.length < 1) {\n res.status(404).send({ message: 'Document not found!' });\n } else if (user.title === 'admin' || document.userId === user.id) {\n Document.destroy({\n where: { id: req.params.id },\n cascade: true,\n restartIdentity: true,\n });\n res.send({ message: 'Document deleted!' });\n } else {\n res.status(401).send({ message: 'Cannot delete this document without owner\\'s permission!' });\n }\n });\n }", "async function eliminarDocumento(id){\n const result = await Curso.findByIdAndDelete(id);\n console.log('Documento eliminado', result); \n}", "async deleteDoc(target) {\n let collection = await this.collection()\n let id = ObjectId(target)\n\n await collection.deleteOne({_id: id})\n\n }", "async function eliminarDocumento(id){\n const result = await Curso.deleteOne({_id: id});\n console.log('Documento eliminado', result); \n}", "function deleteWithID(res, req){\n factoryStore.remove(req.params.id, function(err, factory){\n if (err){\n res.writeHeader(500, {'Content-Type':'text/html'});\n res.write(\"Error deleting file. Ensure that file with that ID exists.\");\n console.log(err);\n }\n res.writeHeader(200, {'Content-Type':'text/html'});\n res.write(\"Deleted\");\n res.end();\n });\n}", "supprimerParId(id) {\n console.log(id + \" <=id \");\n mongoose.model('Article').deleteOne({\"_id\" : id}).then((result)=>{\n console.log('ok deleted');\n }).catch((err)=>{\n console.log(err);\n });\n }", "static async deleteReview(reviewId, userId){\n\n try{\n const deleteResponse = await reviews.deleteeOne (\n // Information needed to delete a docd\n {\n _id: ObjectId(reviewId),\n user: userId,\n }\n \n\n )\n return deleteResponse\n\n }catch(e){\n console.log(\n `Unable to post review ${e}`\n )\n return{error: e}\n }\n\n}", "supprimerParId(id) {\n mongoose.model('Publicite').findByIdAndDelete({_id : id}, cb).then((result)=>{\n console.log(\"suppression effectuée\");\n }).catch((error)=>{\n console.log(\"erreur suppression\");\n });\n }", "async function deleteBookByID(req, res) {\n const book = await table().deleteOne({\n _id: mongoDB.ObjectId(req.params.id),\n });\n res.send(\"Record deleted\");\n}", "async delete(requisition, response){\n await Model.deleteOne({\"_id\": requisition.params.id}).then(resp =>{\n return response.status(200).json(resp);\n }).catch(error => {return response.status(500).json(error);});\n }", "function deleteCard(Id) { \n if (AdminGroup.has(globaluser.uid)) { \n db.collection(\".messages\").doc(Id).delete().then(() => {\n console.log(\"Document successfully deleted!\"); \n}).catch((error) => {\n console.error(\"Error removing document: \", error);\n});\n} \n}", "deleteRecord() {\n var docId = this.props.orderId\n db.collection(\"orders\").doc(docId).delete()\n .then(function() {\n console.log(\"Successfully deleted document id \" + docId)\n })\n .catch(function(error) {\n console.error(\"Error writing document: \" + error);\n });\n }", "async delete(id) {\n let collection = await this.collection();\n await collection.deleteOne({_id: ObjectId(id)});\n this.dbClient.close();\n return console.log('Item successfully deleted')\n }", "function _delete(req, res) {\n if (_adminCommonValidation(req, res, \"delete\")) {\n repository.deletePackageMetadata(req.params.name, req.user, function (err) {\n if (err) {\n var responseData = {\n errors: _toErrorMessageList(err),\n operation: \"delete\"\n };\n if (err.message === \"UNKNOWN_EXTENSION\") {\n res.status(404);\n _respond(req, res, \"adminFailed\", responseData);\n } else if (err.message === \"NOT_AUTHORIZED\") {\n _respondUnauthorized(req, res, \"adminFailed\", responseData);\n } else {\n res.status(400);\n _respond(req, res, \"adminFailed\", responseData);\n }\n } else {\n res.status(200);\n _respond(req, res, \"deleteSucceeded\", {\n name: req.params.name\n });\n }\n });\n }\n}", "function deleteComment(id) {\n return CommentModel.findOneAndRemove({_id : id}, function(err, docs) {\n if (err) {\n console.log(err);\n }\n });\n}", "async delete({request, response, params: {id}}) {\n\n const name = await nameService.findNameBy('id', id);\n\n if (name) {\n\n name.delete()\n\n return response.status(200).send({\n status: 200,\n message: \"name deleted\"\n })\n }\n else{\n return response.status(400).send({\n status: 400,\n message: \"invalid name id\"\n })\n }\n }" ]
[ "0.8478919", "0.8008632", "0.79626316", "0.7090099", "0.69446784", "0.6760206", "0.6703368", "0.6679069", "0.6499352", "0.648364", "0.6419483", "0.6418587", "0.63801485", "0.63159657", "0.6239152", "0.6212612", "0.6169452", "0.61594284", "0.61558723", "0.61168295", "0.61043197", "0.60533875", "0.60423076", "0.6038414", "0.6034389", "0.6033768", "0.5992024", "0.5987659", "0.5983495", "0.59788865" ]
0.8466946
1
Function name: find duplicate values Author: Reccion, Jeremy Date Modified: 2018/04/12 Description: check for duplicate values according to one or more unique fields Parameter(s): moduleName: required. string type moduleDoc: required. object type. includes: _id: optional. string type //if this exists, the document is being updated Return: Promise
function findDuplicateDoc(moduleName, moduleDoc){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); //get the fields of the specific module service.getModuleByName(moduleName).then(function(aModule){ //initialize array & object for querying var uniqueValues = []; var tempObj; //push the value of the document when a field is unique aModule.fields.forEach(function(field){ if(field.unique){ tempObj = {}; tempObj[field.name] = moduleDoc[field.name]; uniqueValues.push(tempObj); } }); if(uniqueValues.length == 0){ deferred.resolve(); } else{ db.bind(moduleName); //use $or for checking each field for uniqueness, not their combination db[moduleName].findOne({$or: uniqueValues}, function(err, duplicateDoc){ if(err){ deferred.reject(err); } //a duplicate exists, but needs further checking else if(duplicateDoc){ //updating a module document if(moduleDoc._id){ //different module documents with similar unique values if(moduleDoc._id != duplicateDoc._id){ deferred.reject(exists); } //since it is the same document, it is not duplicate else{ deferred.resolve(); } } //adding new module documennt else{ deferred.reject(exists); } } //does not exist - similar to notFound. but it is not rejected based on design else{ deferred.resolve(); } }); } }).catch(function(err){ deferred.reject(err); }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findDuplicateDoc(moduleName, moduleDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //get the fields of the specific module\n service.getModuleByName(moduleName).then(function(aModule){\n //initialize array & object for querying\n var uniqueFields = [];\n var tempObj;\n\n //push the value of the document when a field is unique\n aModule.fields.forEach(function(field){\n if(field.unique){\n tempObj = {};\n tempObj[field.name] = moduleDoc[field.name];\n uniqueFields.push(tempObj);\n }\n });\n\n if(uniqueFields.length == 0){\n deferred.resolve();\n }\n else{\n //use $or for checking each field for uniqueness, not their combination\n db[moduleName].findOne({$or: uniqueFields}, function(err, duplicateDoc){\n if(err){\n deferred.reject(err);\n }\n //a duplicate exists, but needs further checking\n else if(duplicateDoc){\n //updating a module document\n if(moduleDoc._id){\n //different module documents with similar unique values\n if(moduleDoc._id != duplicateDoc._id){\n deferred.reject(exists);\n }\n //since it is the same document, it is not duplicate\n else{\n deferred.resolve();\n }\n }\n //adding new module documennt\n else{\n deferred.reject(exists);\n }\n }\n //does not exist\n else{\n deferred.resolve();\n }\n });\n }\n\n \n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function updateModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n console.log(fieldObject);\n\n service.getModuleByName(moduleName).then(function(aModule){ \n //use array.filter() to get the duplicate fields\n var duplicateFields = aModule.fields.filter(function(field){\n //lesson learned: use toString() in id\n return field.id.toString() == fieldObject.id.toString() || field.name == fieldObject.name;\n });\n \n if(duplicateFields.length == 0){\n deferred.reject(notFound);\n }\n //valid inputs\n else if(duplicateFields.length == 1){\n //this is to ensure that the field is inside the specific module (in case of improper input parameters)\n\n fieldObject.id = new ObjectID(fieldObject.id);\n\n if(duplicateFields[0].id.toString() == fieldObject.id.toString()){\n db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n console.log(writeResult.result);\n deferred.resolve();\n }\n });\n }\n //the only element has the same name but is different id, therefore, not inside the module document\n else{\n deferred.reject(notFound);\n }\n }\n else{\n deferred.reject(exists);\n }\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "checkDuplicates(error) {\n if (error.name === \"MongoError\" && error.code === 11000) {\n // check if the error from Mongodb is duplication error\n // eslint-disable-next-line no-useless-escape\n const regex = /index\\:\\ (?:.*\\.)?\\$?(?:([_a-z0-9]*)(?:_\\d*)|([_a-z0-9]*))\\s*dup key/i;\n const match = error.message.match(regex);\n const fieldName = match[1] || match[2];\n return new APIError({\n message: `${fieldName} already exists`,\n status: httpStatus.CONFLICT,\n isPublic: true,\n stack: error.stack,\n });\n }\n return error;\n }", "function processDuplicates() {\r\n\tnlapiLogExecution('AUDIT','FLO Start','processDuplicates');\r\n\t\r\n\tvar context = nlapiGetContext();\r\n\tvar s = nlapiLoadSearch('customrecord_flo_customization', 'customsearch_flo_duplicate_cust_script');\r\n\tvar res = s.runSearch();\r\n\tvar set=res.getResults(0,1000);\r\n\tvar cols=res.getColumns();\r\n\tnlapiLogExecution('DEBUG','Records',set.length);\r\n\t/*\r\n\tName name\r\n\tScriptId \tcustrecord_flo_cust_id\r\n\tInternal Id\t \tcustrecord_flo_int_id\r\n\tFormula \tformulanumeric\r\n\tfor (var i=0;i<cols.length;i++){\r\n\t\tnlapiLogExecution('DEBUG','Column',cols[i].getName());\r\n\t}\r\n\t*/\r\n\tif (set!= null && set.length > 0) {\r\n\t\tfor (var i=0; i < set.length && set[i] != null; i++) {\r\n\t\t\t\r\n\t\t\t//USAGE CHECK / RESCHEDULE\r\n\t\t\tif (context.getRemainingUsage() < MAX_USAGE || new Date().getTime() - START_TIME > MAX_TIME) {\r\n\t\t\t\tvar status = nlapiScheduleScript(context.getScriptId(), context.getDeploymentId());\r\n\t\t\t\tnlapiLogExecution('AUDIT','Rescheduled Due to Usage','processDuplicates');\r\n\t\t\t\tif ( status == 'QUEUED' )\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar name=set[i].getValue(cols[0]);\r\n\t\t\tvar scriptId=set[i].getValue(cols[1]);\r\n\t\t\tif (scriptId == '- None -')\r\n\t\t\t\tscriptId = '';\r\n\t\t\tvar intId=set[i].getValue(cols[2]);\r\n\t\t\t\r\n\t\t\tif (name == '' || scriptId == '' || intId == '')\r\n\t\t\t\tcontinue;\r\n\t\t\t\r\n\t\t\t// search duplicate\r\n\t\t\tvar filters = [];\r\n\t\t\tfilters[0] = new nlobjSearchFilter('name', null, 'is', name );\r\n\t\t\tfilters[1] = new nlobjSearchFilter('custrecord_flo_cust_id', null, 'is', scriptId );\r\n\t\t\tfilters[2] = new nlobjSearchFilter('custrecord_flo_int_id', null, 'equalto', intId );\r\n\t\t\tfilters[3] = new nlobjSearchFilter('isinactive', null, 'is', 'F' );\r\n\r\n\t\t\tvar dupRes=nlapiSearchRecord('customrecord_flo_customization',null,filters);\r\n\t\t\tif (dupRes == null || dupRes.length < 2) {\r\n\t\t\t\tnlapiLogExecution('ERROR','Couldnt Find Duplicate',name+','+scriptId+','+intId);\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tvar dupId=dupRes[0].getId();\r\n\t\t\tvar id=dupRes[1].getId();\r\n\t\t\t\r\n\t\t\tif (parseInt(id) > parseInt(dupId)) {\r\n\t\t\t\t//swap variables\r\n\t\t\t\tvar temp=dupId;\r\n\t\t\t\tdupId=id;\r\n\t\t\t\tid=temp;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tnlapiLogExecution('DEBUG','id, dupId', id + ',' + dupId);\r\n\t\t\t\r\n\t\t\t//FLO Change Log\r\n\t\t\t//custrecord_flo_customization_record\r\n\t\t\tfilters = [];\r\n\t\t\tfilters[0] = new nlobjSearchFilter('custrecord_flo_customization_record', null, 'anyof', dupId );\r\n\t\t\tfilters[1] = new nlobjSearchFilter('isinactive', null, 'is', 'F' );\r\n\t\t\tvar clRes=nlapiSearchRecord('customrecord_flo_change_log',null,filters);\r\n\t\t\t\r\n\t\t\tif (clRes != null && clRes.length > 0) {\r\n\t\t\t\tfor (var ii = 0; ii < clRes.length && clRes[ii] != null; ii++) {\r\n\t\t\t\t\tvar clId=clRes[ii].getId();\r\n\t\t\t\t\tvar clRec = nlapiLoadRecord('customrecord_flo_change_log',clId);\r\n\t\t\t\t\tif (clRec == null)\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\tclRec.setFieldValue('custrecord_flo_customization_record',id);\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tnlapiSubmitRecord(clRec,false,true);\r\n\t\t\t\t\t\tnlapiLogExecution('AUDIT','Updated FLO Change Log',clId);\r\n\t\t\t\t\t} catch(e) {\r\n\t\t\t\t\t\tnlapiLogExecution('DEBUG','Error Submit',e);\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\tnlapiLogExecution('DEBUG','No Change Log',dupId);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//FLO Change Request customrecord_flo_change_request\r\n\t\t\t// custrecord_flo_cust_change\tmultiselect\r\n\t\t\t// custrecord_flo_customization_to_cleanup\tmultiselect\r\n\t\t\t// custrecord_flo_approve_customization\t\tmultiselect\r\n\t\t\tvar crFilterExpr=[[['custrecord_flo_cust_change','anyof',dupId]\r\n\t\t\t,'or',['custrecord_flo_customization_to_cleanup','anyof',dupId]\r\n\t\t\t,'or',['custrecord_flo_approve_customization','anyof',dupId]]\r\n\t\t\t,'and',['isinactive','is','F']];\r\n\t\t\t\r\n\t\t\tupdateRecord('FLO Change Request','customrecord_flo_change_request',null,['custrecord_flo_cust_change','custrecord_flo_customization_to_cleanup','custrecord_flo_approve_customization'],crFilterExpr,id,dupId);\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t//FLO Test Record customrecord_flo_test_report\r\n\t\t\t//custrecord_flo_customization_tested\r\n\t\t\t//custrecord_flo_data_input_fields\tmultiselect\r\n\t\t\t//custrecord_flo_data_input_form\tmultiselect\r\n\t\t\tvar trFilterExpr=[[['custrecord_flo_customization_tested','anyof',dupId]\r\n\t\t\t,'or',['custrecord_flo_data_input_fields','anyof',dupId]\r\n\t\t\t,'or',['custrecord_flo_data_input_form','anyof',dupId]]\r\n\t\t\t,'and',['isinactive','is','F']];\r\n\t\t\t\r\n\t\t\tupdateRecord('FLO Test Record','customrecord_flo_test_report',['custrecord_flo_customization_tested']\r\n\t\t\t\t,['custrecord_flo_data_input_fields','custrecord_flo_data_input_form'],trFilterExpr,id,dupId);\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t//FLO Process Issue customrecord_process_issue\r\n\t\t\t//custrecord_flo_issue_cust \tmultiselect\r\n\t\t\t//custrecord_flo_source_control\r\n\t\t\tvar piFilterExpr=[[['custrecord_flo_issue_cust','anyof',dupId]\r\n\t\t\t,'or',['custrecord_flo_source_control','anyof',dupId]]\r\n\t\t\t,'and',['isinactive','is','F']];\r\n\t\t\t\r\n\t\t\tupdateRecord('FLO Process Issue','customrecord_process_issue',['custrecord_flo_source_control']\r\n\t\t\t\t,['custrecord_flo_issue_cust'],piFilterExpr,id,dupId);\r\n\t\t\t\t\r\n\t\t\t//Set Duplicate to Inactive\r\n\t\t\t\r\n\t\t\tvar dupRec = nlapiLoadRecord('customrecord_flo_customization',dupId);\r\n\t\t\tif (dupRec != null) {\r\n\t\t\t\tdupRec.setFieldValue('isinactive','T');\r\n\t\t\t\ttry {\r\n\t\t\t\t\tnlapiSubmitRecord(dupRec,false,true);\r\n\t\t\t\t\tnlapiLogExecution('AUDIT','Duplicate Processed',dupId + ':' + name + ',' + scriptId + ',' + intId);\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tnlapiLogExecution('AUDIT','Error set to inactive',dupId + ':' + name + ',' + scriptId + ',' + intId);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\r\n\t\tif (set.length == 1000) {\r\n\t\t\tvar status = nlapiScheduleScript(context.getScriptId(), context.getDeploymentId());\r\n\t\t\tnlapiLogExecution('AUDIT','Rescheduled','processDuplicates');\r\n\t\t\tif ( status == 'QUEUED' )\r\n\t\t\t\treturn; \r\n\t\t\t//reschedule\r\n\t\t}\r\n\t\r\n\t} else {\r\n\t\tnlapiLogExecution('DEBUG','No Duplicates Found');\r\n\t}\r\n\r\n\tnlapiLogExecution('AUDIT','FLO End','processDuplicates');\r\n}", "function updateModuleDoc(moduleName, updateDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n service.findDuplicateDoc(moduleName, updateDoc).then(function(){\n db.bind(moduleName);\n \n //convert '_id' to ObjectID\n updateDoc._id = new ObjectID(updateDoc._id);\n \n db[moduleName].update({_id: updateDoc._id}, {$set: updateDoc}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n if(writeResult.result.nModified == 0){\n deferred.reject(notFound);\n }\n else{\n deferred.resolve();\n }\n }\n });\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function getDups() {\n return new Promise((resolve, reject) => {\n Event.aggregate([\n { $group: {\n // Group by fields to match on (a,b)\n _id: { title: \"$title\", timeValue: \"$timeValue\" },\n\n // Count number of matching docs for the group\n count: { $sum: 1 },\n\n // Save the _id for matching docs\n docs: { $push: \"$_id\" }\n }},\n\n // Limit results to duplicates (more than 1 match)\n { $match: {\n count: { $gt : 1 }\n }}\n ], function (err, result) {\n if (err) {\n console.log(err);\n reject(err)\n }\n resolve(result)\n });\n });\n}", "function checkForDuplicates(user, reminderContent, reminderTime) {\r\n const MongoClient = require(\"mongodb\").MongoClient;\r\n const url = mongoURL;\r\n\r\n MongoClient.connect(url, function(err, db) {\r\n if (err) throw err;\r\n const dbo = db.db(dbName);\r\n dbo.collection(user).findOne(\r\n {\r\n reminderContent: reminderContent,\r\n reminderTime: reminderTime\r\n },\r\n function(err, result) {\r\n if (err) throw err;\r\n if (result) {\r\n console.log(\"Such reminder already exists\");\r\n db.close();\r\n return true;\r\n } else {\r\n console.log(\"No duplicates found\");\r\n db.close();\r\n return false;\r\n }\r\n });\r\n });\r\n}", "function check_for_dups(){\n var ss = SpreadsheetApp.openById(BERTHA_ID)\n var backend_sh = SpreadsheetApp.openById(BACKEND_ID)\n\n var tracking_db = backend_sh.getSheetByName(\"Tracking Number DB\")\n var main_sheet = ss.getSheetByName(\"1 - Main Page\")\n var main_sheet_data = main_sheet.getDataRange().getValues()\n var db_data = tracking_db.getDataRange().getValues()\n \n var indexes = get_main_indexes()\n \n var index_facility = indexes.indexFacilityName\n var index_action = indexes.indexPend\n var index_shipped = indexes.indexShippedEmail\n var indexRowID = indexes.indexRowID\n var index_notes = indexes.indexActualIssues\n var indexColemanTracking = indexes.indexColemanTracking\n \n for(var i = 0; i < main_sheet_data.length; i++){\n if(main_sheet_data[i][index_shipped].toString().length == 0){ //if reused, then this would never fill\n var tracking_nums = main_sheet_data[i][indexColemanTracking].toString().split(\",\") //get all tracking nums\n if(tracking_nums.length > 0){\n for(var j = 0; j < db_data.length; j++){\n if(db_data[j][0].toString() == main_sheet_data[i].toString().trim()){ //find the row\n for(var n = 0; n < tracking_nums.length; n++){\n if(db_data[j][1].toString().split(\";\").indexOf(\"971424215\" + tracking_nums[n]) > -1){\n //then it's a duplicate\n debugEmail(\"DUPLICATE TRACKING NUMBER\", \"Found one:\\n\\n\" + tracking_nums[n] + \"\\n\\nRow ID: \" + main_sheet_data[i][indexRowID])\n }\n }\n\n }\n }\n }\n }\n }\n}", "function checkDupe(data,x){\n\n if(idArray.includes(data[x][0])){\n return false;\n } else { return true; }\n\n}", "async function func(uniqueModuleData) {\n try {\n console.log(\"uniqueModuleData\", uniqueModuleData)\n const foundModule = await prisma.module.findUnique({where: uniqueModuleData})\n console.log(\"foundModule\", foundModule)\n return foundModule\n } catch(e) {\n console.log(e)\n return\n }\n }", "function findDuplicate() {\n\n var modelsArray = [$scope.data.first, $scope.data.second, $scope.data.third, $scope.data.fourth];\n var filteringModelsArray = _.uniq(modelsArray);\n\n return filteringModelsArray.length === modelsArray.length;\n }", "_removeDuplicates(data, options) {\n let uniqueValue = [];\n let uniqueData = [];\n let objects = JP.query(data, options.object);\n\n objects.forEach((object, index) => {\n let value = JP.query(object, options.value)[0];\n if (uniqueValue.indexOf(value) === -1){\n uniqueValue.push(value);\n uniqueData.push(data[index]);\n }\n });\n\n return uniqueData;\n }", "async function modifyValidation(data, unique = true){\n var valid = UserUpdateSchema(data);\n if (!valid)\n return UserUpdateSchema.errors;\n\n if(unique === false)\n return true;\n\n data._id = ObjectId(data._id);\n var docs = await db.get().collection('users').findOne({_id: { $ne: data._id}, username:data.username});\n if(docs){\n return ([{'message':'Username is already existss'}]);\n }\n return true;\n}", "isUnique(emailOrmobile) {\n return new Promise((resolve, reject) => {\n let sql = sqlObj.otp.isExist;\n let sqlQuery = format(sql, emailOrmobile);\n\n db.doRead(sqlQuery).then(result => {\n resolve(result);\n })\n .catch(err => {\n reject(new Error(err));\n })\n })\n }", "unique(field) {\n const set = new Set();\n return (commit) => {\n const include = !set.has(commit[field]);\n set.add(commit[field]);\n return include;\n };\n }", "function sameNameOrNumber(req,res,next){\n //checking if same name\n User.find({name:req.body.name},function(err,sameName){\n if (err) console.log(err);\n else {\n if(sameName.length==0)\n {//if no user with same name exists, checking for user with same number\n User.find({number:req.body.number},function(err,sameNum){\n if (err) console.log(err);\n else {\n if(sameNum.length==0)//if user with same number also does not exist\n next();\n else\n res.send(\"User with same number exists.Create another user\");\n }\n })\n }\n else\n res.send(\"User with same name exists.Create another user\");\n }\n })\n}", "function checkDuplication(data, tele, sheet_id, mid, mname, admin_time) {\n\tvar doc = new GoogleSpreadsheet('1rFX49ARfLmBBqxwj-S3H_Mt6regZmUeheNfiPisIu_w');\n\tvar sheet;\n\tasync.series([\n\t\tfunction setAuth(step) {\n\t\t\t// see notes below for authentication instructions!\n\t\t\tvar creds = require('../2i studio-fd2ce7d288b9.json');\n\t\t\tdoc.useServiceAccountAuth(creds, step);\n\t\t},\n\t\tfunction getInfoAndWorksheets(step) {\n\t\t\tdoc.getInfo(function (err, info) {\n\t\t\t\tif (info !== undefined) {\n\t\t\t\t\tsheet = info.worksheets[0];\n\t\t\t\t}\n\t\t\t\tstep();\n\t\t\t});\n\t\t},\n\t\tfunction workingWithRows(step) {\n\t\t\t// google provides some query options\n\t\t\tif (sheet !== undefined) {\n\t\t\t\tsheet.getRows({\n\t\t\t\t\toffset: 1\n\t\t\t\t\t// orderby: 'col2'\n\t\t\t\t}, function (err, rows) {\n\t\t\t\t\tif (rows !== undefined && rows !== null) {\n\t\t\t\t\t\tif (rows.length > 0) {\n\t\t\t\t\t\t\tlet checkPhone = checkPhoneNumber(data.sốđiệnthoại);\n\t\t\t\t\t\t\tif (rows.contains(checkPhone) === true) {\n\t\t\t\t\t\t\t\tsaveDupData(data);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// insertOldStudent(data);\n\t\t\t\t\t\t\t\tinsertStudent(data, tele, sheet_id, mid, mname, admin_time);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tstep();\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t], function (err) {\n\t\tif (err) {\n\t\t\tconsole.log('Error: ' + err);\n\t\t}\n\t});\n}", "function CheckDuplicate(a)\n{\n if(a.firstName.includes(\"Rani\"))\n ++n;\nreturn n;\n}", "function checkDuplicateData(DATAJSONFILE, params) {\r\n const key = params['query'].toLowerCase();\r\n return getUserInfoByKey(DATAJSONFILE, key, params['value']) ? {[key] : 'true'} : {[key] : 'false'};\r\n\r\n}", "function checkingDuplicateRow(rowNum){\n\tvar error=\"true\";\n\tvar currentWO_MajorHead=$(\"#combobox\"+rowNum).val().split(\"$\")[0];\n\tvar currentWO_MinorHead=$(\"#comboboxsubProd\"+rowNum).val().split(\"$\")[0];\n\tvar currentWO_Desc=$(\"#comboboxsubSubProd\"+rowNum).val().split(\"$\")[0];\n\tvar currentUOM=$(\"#UOMId\"+rowNum).val().split(\"$\")[0];\n\n\t$(\".workorderrowcls\").each(function(){\n\t\tvar currentId=$(this).attr(\"id\").split(\"workorderrow\")[1];\n\t\tif(currentId!=rowNum){\n\t\t\tvar WO_MajorHead=$(\"#combobox\"+currentId).val().split(\"$\")[0];\n\t\t\tvar WO_MinorHead=$(\"#comboboxsubProd\"+currentId).val().split(\"$\")[0];\n\t\t\tvar WO_Desc=$(\"#comboboxsubSubProd\"+currentId).val().split(\"$\")[0];\n\t\t\tvar UOM=$(\"#UOMId\"+currentId).val().split(\"$\")[0];\n\t\t\n\t\t\tif(currentWO_MajorHead==WO_MajorHead && WO_MinorHead==currentWO_MinorHead && currentWO_Desc==WO_Desc && currentUOM==UOM){\n\t\t\t\talert(\"UOM already exist, Please choose different UOM.\");\n\t\t\t\treturn error=\"false\";\n\t\t\t}\n\t\t}\n\t});\n\n\treturn error;\n\t\n}", "function isDuplicate(user, data) {\n const v = user.find(itm => JSON.stringify(itm) === JSON.stringify(data))\n\n const exist = v? true : false;\n\n return exist;\n}", "function getDuplicates (slug) {\n if (!slug) {\n return Promise.resolve(false);\n }\n\n return api.space.getEntries({\n 'query': slug\n }).then(res => {\n\n let items = res.items.filter(item => {\n\n // If its not the current page, if the current region matches and if the item has a navigationName field\n if(item.sys.id != api.entry.getSys().id && (item.fields.region && currentRegion.getValue() == item.fields.region['sv-SE']) && (item.fields.navigationName && item.fields.navigationName['sv-SE'] == slug)){\n return item;\n }\n })\n\n return { hasDuplicates: items.length > 0, dupliactes: items };\n });\n }", "function checkIndivDupe() {\n var firstInstance = true;\n var dupeCount = 0;\n \n var validUserRows = validUserSheet.getLastRow() + 1;\n for (var row = 1; row < validUserRows; row++) {\n if (validUserSheet.getRange(row, 6).getValue() == userEmail) {\n if (firstInstance) {\n isIndivDupe = true;\n //get original batch ID\n origBatchId = validUserSheet.getRange(row, 2).getValue();\n origUID = validUserSheet.getRange(row, 3).getValue();\n origUserFirst = validUserSheet.getRange(row, 4).getValue();\n origUserLast = validUserSheet.getRange(row, 5).getValue();\n origUserEmail = validUserSheet.getRange(row, 6).getValue();\n origUserOrg = validUserSheet.getRange(row, 7).getValue();\n firstInstance = false;\n }\n //increment duplicate count\n dupeCount++;\n }\n }\n \n Logger.log('This a duplicate 1: ' + isIndivDupe);\n Logger.log('The original Batch ID is: ' + origBatchId);\n \n if (isIndivDupe) {\n //get info about original submission using original batch ID\n \n var logSheetRows = logSheet.getLastRow() + 1;\n for (var logRow = 1; logRow < logSheetRows; logRow++) {\n if (logSheet.getRange(logRow, 3).getValue() == origBatchId) {\n origRespFirst = logSheet.getRange(logRow, 4).getValue();\n origRespLast = logSheet.getRange(logRow, 5).getValue();\n origRespName = origRespFirst + ' ' + origRespLast;\n origRespEmail = logSheet.getRange(logRow, 6).getValue();\n origTime = logSheet.getRange(logRow, 1).getValue();\n origTime = Utilities.formatDate(origTime, ss.getSpreadsheetTimeZone(), \"M/d/yy 'at' h:mm a\");\n }\n }\n \n }\n \n }", "async function checkIfRefereeExistWithSameName(ref_first_name,ref_last_name){\n // check if match exist in matches db.\n let checkIfExist = await DButils.execQuery(`SELECT TOP 1 1 FROM dbo.Referees \n WHERE (first_name = '${ref_first_name}') AND (last_name = '${ref_last_name}')`);\n let match_id_array = [];\n checkIfExist.map((element) => match_id_array.push(element)); //extracting the match id into array for checking if exist\n if(match_id_array.length==0){\n return false;\n }\n return true;\n }", "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n db.modules.find({$or: [\n {_id: mongo.helper.toObjectID(updateModule._id)},\n {name: updateModule.name}\n ]}).toArray(function(err, modules){\n if(err){\n deferred.reject(err);\n }\n else if(modules.length == 0){\n deferred.reject(notFound);\n }\n //vali inputs, no other document have the same name\n else if(modules.length == 1){\n var oldModule = modules[0];\n \n //rename if old & new names are different\n if(oldModule.name != updateModule.name){\n db.bind(oldModule.name);\n db[oldModule.name].rename(updateModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n update();\n }\n });\n }\n //go straight to update\n else{\n update();\n }\n }\n //another module document with the same name exists\n else{\n deferred.reject(exists);\n }\n }); \n\n //updates the document in the 'modules' collection\n function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n\n return deferred.promise;\n}", "checkForDuplicates(state, indexDictionary) {\n const data = state.dictionaries[indexDictionary].content;\n\n data.forEach((value) => {\n state.dictionaries[indexDictionary].content = data.map((pair, index) => {\n // Make sure the object is not itself\n if (data.indexOf(pair) !== data.indexOf(value)) {\n if (pair.domain === value.domain && pair.range === value.range) {\n if (\n data[index].validity.status\n && data[index].validity.reason === ''\n ) {\n // Change validity of the pair to false and assign the reason why\n data[index].validity.status = false;\n data[index].validity.reason = reasonNotValid.duplicate;\n }\n }\n }\n return pair;\n });\n });\n }", "isDocumentExisted(documentName) {\n var checkExistedProcess = this.dbConnect.then((connection) => {\n return new Promise ((resolve, reject) => {\n connection.query('SELECT id FROM ' + dbDocumentInfo + ' WHERE documentName = ?', documentName, (err, results, fields) => {\n if (!err) {\n var docName = results\n var quantity = docName.length\n if(quantity === 1) {\n //connection.release()\n resolve(true)\n } else if (quantity === 0){\n // console.log('Inside dbDoc : ' + docName[0].id)\n //connection.release()\n resolve(false)\n } else {\n //connection.release()\n reject({err: {msg: 'There are two of them in Database - System ERR'}})\n }\n } else {\n reject(err)\n }\n })\n })\n }).catch((err) =>{\n return Promise.reject(err)\n })\n return checkExistedProcess\n }", "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n //the query searches for the module name that do not have the inputted field name\n //this is to avoid pushing same field names on the 'fields' array of the specified module\n //writeResult will determine if the update was successful or not (i.e. writeResult.result.nModified)\n db.modules.update({name: moduleName, fields: {$not: {$elemMatch: {name: fieldObject.name}}}}, {$push: {fields: fieldObject}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n //console.log(writeResult.result);\n //check the status of the update, if it failed, it means that there is an existing field name\n if(writeResult.result.nModified == 0){\n deferred.reject(exists);\n }\n else{\n deferred.resolve();\n }\n }\n });\n\n return deferred.promise;\n}", "checkExists(userId,contactId) {\r\n return this.findOne({\r\n $or :[\r\n {\r\n $and : [\r\n {\"userId\" :userId},\r\n {\"contactId\" : contactId}\r\n ]},\r\n {\r\n $and : [\r\n {\"userId\" :contactId},\r\n {\"contactId\" : userId}\r\n ]}\r\n ]\r\n }).exec();\r\n }", "function areThereDuplicates2() {\n let collection = {}\n for(let val in arguments){\n collection[arguments[val]] = (collection[arguments[val]] || 0) + 1\n }\n for(let key in collection){\n if(collection[key] > 1) return true\n }\n return false;\n }" ]
[ "0.7790472", "0.6359789", "0.6185164", "0.60583496", "0.59461486", "0.5890801", "0.57857865", "0.563223", "0.5565228", "0.55593705", "0.55330694", "0.5467956", "0.5450589", "0.5444566", "0.54175276", "0.53952575", "0.53873485", "0.5369162", "0.53616375", "0.53610873", "0.53426355", "0.53297454", "0.5317674", "0.53074825", "0.5294661", "0.52787745", "0.52586293", "0.5256129", "0.52255225", "0.5222504" ]
0.77881294
1
Function name: update fields array Author: Reccion, Jeremy Date Modified: 2018/04/12 Description: sets the 'fields' property of the specific module to the inputted array. Parameter(s): moduleName: required. string type fieldArray: required. array type. //this array is from angular's UISORTABLE Return: Promise
function updateFieldArray(moduleName, fieldArray){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); //need to convert each 'id' property to an ObjectID for(var i = 0; i < fieldArray.length; i++){ fieldArray[i].id = new ObjectID(fieldArray[i].id); } db.modules.update({name: moduleName}, {$set: {fields: fieldArray}}, function(err){ if(err){ deferred.reject(err); } else{ deferred.resolve(); } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateFieldArray(moduleName, fieldArray){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.modules.update({name: moduleName}, {$set: {fields: fieldArray}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n fieldObject.id = new ObjectID(fieldObject.id);\n \n db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function updateModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n console.log(fieldObject);\n\n service.getModuleByName(moduleName).then(function(aModule){ \n //use array.filter() to get the duplicate fields\n var duplicateFields = aModule.fields.filter(function(field){\n //lesson learned: use toString() in id\n return field.id.toString() == fieldObject.id.toString() || field.name == fieldObject.name;\n });\n \n if(duplicateFields.length == 0){\n deferred.reject(notFound);\n }\n //valid inputs\n else if(duplicateFields.length == 1){\n //this is to ensure that the field is inside the specific module (in case of improper input parameters)\n\n fieldObject.id = new ObjectID(fieldObject.id);\n\n if(duplicateFields[0].id.toString() == fieldObject.id.toString()){\n db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n console.log(writeResult.result);\n deferred.resolve();\n }\n });\n }\n //the only element has the same name but is different id, therefore, not inside the module document\n else{\n deferred.reject(notFound);\n }\n }\n else{\n deferred.reject(exists);\n }\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n db.modules.update({name: moduleName}, {$push: {fields: fieldObject}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n //the query searches for the module name that do not have the inputted field name\n //this is to avoid pushing same field names on the 'fields' array of the specified module\n //writeResult will determine if the update was successful or not (i.e. writeResult.result.nModified)\n db.modules.update({name: moduleName, fields: {$not: {$elemMatch: {name: fieldObject.name}}}}, {$push: {fields: fieldObject}}, function(err, writeResult){\n if(err){\n deferred.reject(err);\n }\n else{\n //console.log(writeResult.result);\n //check the status of the update, if it failed, it means that there is an existing field name\n if(writeResult.result.nModified == 0){\n deferred.reject(exists);\n }\n else{\n deferred.resolve();\n }\n }\n });\n\n return deferred.promise;\n}", "setModuleName(field, module) {\n field.moduleName = field.moduleName || (module && module.__meta.name);\n if ((field.type === 'array') || (field.type === 'object')) {\n _.each(field.schema || [], function(subfield) {\n self.setModuleName(subfield, module);\n });\n }\n }", "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n db.modules.find({$or: [\n {_id: mongo.helper.toObjectID(updateModule._id)},\n {name: updateModule.name}\n ]}).toArray(function(err, modules){\n if(err){\n deferred.reject(err);\n }\n else if(modules.length == 0){\n deferred.reject(notFound);\n }\n //vali inputs, no other document have the same name\n else if(modules.length == 1){\n var oldModule = modules[0];\n \n //rename if old & new names are different\n if(oldModule.name != updateModule.name){\n db.bind(oldModule.name);\n db[oldModule.name].rename(updateModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n update();\n }\n });\n }\n //go straight to update\n else{\n update();\n }\n }\n //another module document with the same name exists\n else{\n deferred.reject(exists);\n }\n }); \n\n //updates the document in the 'modules' collection\n function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n\n return deferred.promise;\n}", "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n //check if the name of the selected module has not changed\n db.modules.findOne({_id: mongo.helper.toObjectID(updateModule._id)}, function(err, aModule){\n if(err){\n deferred.reject(err);\n }\n else if(aModule){\n //if names are different, renaming the collection must be executed, then proceed to update\n if(aModule.name != updateModule.name){\n db.bind(aModule.name);\n db[aModule.name].rename(updateModule.name, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n update();\n }\n });\n }\n }\n else{\n update();\n }\n });\n\n //updates the document in the 'modules' collection\n function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }\n\n return deferred.promise;\n}", "updateFieldItems() {\n this.fieldItems = this.getFieldItems();\n this.fullQueryFields = this.getFullQueryFields();\n this.availableFieldItemsForFieldMapping = this.getAvailableFieldItemsForFieldMapping();\n this.availableFieldItemsForMocking = this.getAvailableFieldItemsForMocking();\n this.mockPatterns = this.getMockPatterns();\n }", "function processFieldArray(form, fields) {\n\n fields.forEach(function (field, key) {\n // Add it\n if (field.type) {\n form.fields.push(field);\n }\n // Remove it\n if (field.hide) {\n form = removeField(form, field.name);\n }\n });\n\n}", "function processFieldArray(form, fields) {\n\n fields.forEach(function(field, key) {\n // Add it\n if(field.type) {\n form.fields.push(field);\n }\n // Remove it\n if(field.hide) {\n form = removeField(form, field.name);\n }\n });\n\n}", "function orgUpdateField(org_id, fieldName, fieldValue ) {\n\n // var member = globalMembers.find(function (member) { return member.id === member_id; }); //get the member object\n \n var ckanParameters = { id: org_id };\n ckanParameters[fieldName] = fieldValue;\n\n\n\n\n debugger;\n var client = new CKAN.Client(ckanServer, myAPIkey);\n\n client.action('organization_patch', ckanParameters,\n function (err, result) {\n if (err != null) { //some error - try figure out what\n mylog(mylogdiv, \"orgUpdateField ERROR: \" + JSON.stringify(err));\n console.log(\"orgUpdateField ERROR: \" + JSON.stringify(err));\n //return false;\n return 0;\n } else // we have managed to update. We are getting the full info for the org as the result\n {\n console.log(\"orgUpdateField RETURN: \" + JSON.stringify(result.result));\n //return true;\n return 1;\n // update the globalMembers array\n // update the screen\n\n }\n\n });\n\n\n}", "_setFields (fields, valueOptions = {}) {\n if (typeof fields !== 'object') {\n throw new Error(\"Expected an object but got \" + typeof fields);\n }\n\n for (let field in fields) {\n this._set(field, fields[field], valueOptions);\n }\n }", "function updateModuleDoc(moduleName, updateDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateDoc);\n delete forUpdate._id;\n\n db[moduleName].update({_id: mongo.helper.toObjectID(updateDoc._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "updateFieldsStatus () {\n let service = dependencyService\n service.updateFieldsStatus(this.formParameters)\n }", "@wire(getListOfFields,{objectAPIName: '$value'})\n wiredFields({ error, data }) {\n if (data) { \n //first parse the data as entire map is stored as JSON string\n let objStr = JSON.parse(data); \n //now loop through based on keys\n for(i of Object.keys(objStr)){\n console.log('FieldAPIName=' +i + 'FieldLabel=' + objStr[i]);\n //spread function is used to stored data and it is reversed order\n this.fieldItems = [\n {FieldLabel: objStr[i], FieldAPIName: i},...this.fieldItems]; \n }\n this.tableData = this.fieldItems;\n this.error = undefined; \n } else if (error) {\n this.error = error;\n this.data = undefined;\n }\n }", "setFieldValues(fieldValues) {\n if (Array.isArray(fieldValues)) {\n fieldValues.forEach(this.setFieldValue);\n } else {\n for (const key of Object.keys(fieldValues)) {\n this.setFieldValue({ name: key, value: fieldValues[key] })\n }\n }\n }", "function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }", "function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }", "function updateDepModuleVersions () {\n return request.post({\n url: `http://${HOST}/api/DepModuleVersions/add`,\n followAllRedirects: true,\n headers: {\n \"Authorization\": TOKEN\n },\n body: {\n obj: obj\n },\n json: true // Automatically stringifies the body to JSON\n }, (err, res, body) => {\n licenseObj(body);\n check(err, res, body);\n });\n}", "function updateFieldsInRecords(fields, records, replacements) {\n // Use object-literal syntax (faster than alternative)\n var convertBody = 'return {' + fields.map(function(name) {\n var key = JSON.stringify(name);\n return key + ': ' + (replacements[name] ? 'replacements[' + key + '][i]' : 'rec[' + key + ']');\n }).join(', ') + '}';\n var convert = new Function('rec', 'replacements', 'i', convertBody);\n records.forEach(function(rec, i) {\n records[i] = convert(rec, replacements, i);\n });\n }", "connectedCallback() {\n let objectApiName = this.sfdcObjectApiName;\n let fieldSetName = this.fieldSetName;\n\n //make an implicit call to fetch fields from database\n getFieldsFromFieldSet({\n strObjectApiName: objectApiName,\n strfieldSetName: fieldSetName\n })\n .then((data) => {\n let items = []; //local array to hold the field api\n\n //get the entire map\n let objStr = JSON.parse(data);\n //get the list of fields, its a reverse order to extract from map\n let listOfFields = JSON.parse(Object.values(objStr)[1]);\n //get the object name\n this.lblobjectName = Object.values(objStr)[0];\n //prepare items array using field api names\n listOfFields.map((element) => items.push(element.fieldPath));\n\n this.inputFieldAPIs = items;\n console.log(\"inputFieldAPIs\", this.inputFieldAPIs);\n console.log(this.inputFieldAPIs);\n this.error = undefined;\n })\n .catch((error) => {\n this.error = error;\n console.log(\"error\", error);\n this.lblobjectName = objectApiName;\n });\n }", "function updateOneFieldTask(id, field, data){\n $cordovaSQLite.execute(db,\n 'UPDATE tasks SET '+ field +' = ? WHERE id = ?',\n [data, id])\n .then(function(result) {}, function(error) {\n console.error('updateOneFieldTask(): ' + error);\n });\n }", "function RefreshDatarowItem(page_tblName, field_setting, update_dict, data_dicts) {\n console.log(\" --- RefreshDatarowItem ---\");\n console.log(\" page_tblName\", page_tblName);\n console.log(\" update_dict\", update_dict);\n //console.log(\"field_setting\", field_setting);\n\n if(!isEmpty(update_dict)){\n const field_names = field_setting.field_names;\n\n const is_deleted = (!!update_dict.deleted);\n const is_created = (!!update_dict.created);\n //console.log(\"is_created\", is_created);\n\n // field_error_list is not in use (yet)\n let field_error_list = [];\n const error_list = get_dict_value(update_dict, [\"error\"], []);\n console.log(\" error_list\", error_list);\n\n if(error_list && error_list.length){\n // - show modal messages\n b_show_mod_message_dictlist(error_list);\n\n // - add fields with error in field_error_list, to put old value back in field\n for (let i = 0, msg_dict ; msg_dict = error_list[i]; i++) {\n if (\"field\" in msg_dict){field_error_list.push(msg_dict.field)};\n };\n //} else {\n // close modal MSJ when no error --- already done in modal\n //$(\"#id_mod_subject\").modal(\"hide\");\n }\n\n// NIU:\n// --- get list of hidden columns\n //const col_hidden = b_copy_array_to_new_noduplicates(mod_MCOL_dict.cols_hidden);\n\n// ++++ created ++++\n // PR2021-06-16 from https://stackoverflow.com/questions/586182/how-to-insert-an-item-into-an-array-at-a-specific-index-javascript\n //arr.splice(index, 0, item); will insert item into arr at the specified index\n // (deleting 0 items first, that is, it's just an insert).\n\n if(is_created){\n // --- first remove key 'created' from update_dict\n delete update_dict.created;\n\n // --- add new item to data_dicts\n data_dicts[update_dict.mapid] = update_dict;\n\n // --- create row in table., insert in alphabetical order\n const new_tblRow = CreateTblRow(page_tblName, field_setting, update_dict)\n\n // --- scrollIntoView,\n if(new_tblRow){\n new_tblRow.scrollIntoView({ block: 'center', behavior: 'smooth' })\n\n // --- make new row green for 2 seconds,\n ShowOkElement(new_tblRow);\n }\n } else {\n\n// --- get existing data_dict\n const map_id = update_dict.mapid;\n const data_dict = data_dicts[map_id];\n\n if(data_dict){\n // ++++ deleted ++++\n if(is_deleted){\n console.log(\" is_deleted\", is_deleted);\n // delete row from data_dicts\n delete data_dicts[map_id];\n //--- delete tblRow\n\n const tblRow_tobe_deleted = document.getElementById(map_id);\n //console.log(\"tblRow_tobe_deleted\", tblRow_tobe_deleted);\n if (tblRow_tobe_deleted ){tblRow_tobe_deleted.parentNode.removeChild(tblRow_tobe_deleted)};\n\n } else {\n\n console.log(\" updated\");\n // +++++++++++ updated row +++++++++++\n // --- check which fields are updated, add to list 'updated_columns'\n if(field_names){\n let updated_columns = [];\n\n // skip first column (is margin)\n // col_field is the name of the column on page, not the db_field\n for (let i = 1, col_field, old_value, new_value; col_field = field_names[i]; i++) {\n\n let has_changed = false;\n if (col_field.slice(0, 5) === \"group\") {\n // data_dict.usergroups example: \"anlz;auth1;auth2;auth3;auth4;edit;read\"\n const usergroup = col_field.slice(6);\n // usergroup_in_data_dict and usergroup_in_update_dict are necessary to catch empty usergroup field\n const usergroup_in_data_dict = (!!data_dict.usergroups && data_dict.usergroups.includes(usergroup));\n const usergroup_in_update_dict = (!!update_dict.usergroups && update_dict.usergroups.includes(usergroup));\n has_changed = usergroup_in_data_dict != usergroup_in_update_dict;\n } else {\n has_changed = (data_dict[col_field] !== update_dict[col_field] );\n };\n\n if (has_changed){\n // --- add field to updated_columns list\n updated_columns.push(col_field)\n };\n };\n // --- update fields in data_row\n for (const [key, new_value] of Object.entries(update_dict)) {\n if (key in data_dict){\n if (new_value !== data_dict[key]) {\n data_dict[key] = new_value;\n }}};\n\n // --- update field in tblRow\n // note: when updated_columns is empty, then updated_columns is still true.\n // Therefore don't use Use 'if !!updated_columns' but use 'if !!updated_columns.length' instead\n if(updated_columns.length || field_error_list.length){\n\n // --- get existing tblRow\n let tblRow = document.getElementById(data_dict.mapid);\n if(tblRow){\n // to make it perfect: move row when username have changed\n if (updated_columns.includes(\"username\")){\n //--- delete current tblRow\n tblRow.parentNode.removeChild(tblRow);\n //--- insert row new at new position\n tblRow = CreateTblRow(page_tblName, field_setting, update_dict)\n }\n\n // loop through cells of row\n for (let i = 1, el_fldName, el, td; td = tblRow.cells[i]; i++) {\n el = td.children[0];\n if (el){\n el_fldName = get_attr_from_el(el, \"data-field\")\n UpdateField(el, update_dict);\n\n // make field green when field name is in updated_columns\n if(updated_columns.includes(el_fldName)){\n ShowOkElement(el);\n };\n };\n }; // for (let i = 1, el_fldName, el; el = tblRow.cells[i]; i++) {\n }; // if(tblRow){\n }; // if(updated_columns.length){\n }; // if(!isEmpty(data_dict) && field_names){\n }; // if(is_deleted){\n };\n }; // if(is_created)\n }; // if(!isEmpty(update_dict)){\n }", "_setFieldsRows (fieldsRows, valueOptions = {}) {\n if (!_isArray(fieldsRows)) {\n throw new Error(\"Expected an array of objects but got \" + typeof fieldsRows);\n }\n\n // Reset the objects stored fields and values\n this._reset();\n\n // for each row\n for (let i = 0; fieldsRows.length > i; ++i) {\n let fieldRow = fieldsRows[i];\n\n // for each field\n for (let field in fieldRow) {\n let value = fieldRow[field];\n\n field = this._sanitizeField(field);\n value = this._sanitizeValue(value);\n\n let index = this._fields.indexOf(field);\n\n if (0 < i && -1 === index) {\n throw new Error('All fields in subsequent rows must match the fields in the first row');\n }\n\n // Add field only if it hasn't been added before\n if (-1 === index) {\n this._fields.push(field);\n index = this._fields.length - 1;\n }\n\n // The first value added needs to add the array\n if (!_isArray(this._values[i])) {\n this._values[i] = [];\n this._valueOptions[i] = [];\n }\n\n this._values[i][index] = value;\n this._valueOptions[i][index] = valueOptions;\n }\n }\n }", "assignFields(scope) {\n const fields = Object\n .keys(scope.source)\n .filter((field) => this.assignFilter(scope.source, field, scope));\n return Promise.all(\n fields.map((fieldName) => this.assignField(fieldName, scope)),\n );\n }", "fieldsInfo () {\n return [\n {\n text: this.$t('fields.id'),\n name: 'id',\n details: false,\n table: false,\n },\n\n {\n type: 'input',\n column: 'order_nr',\n text: 'order No.',\n name: 'order_nr',\n multiedit: false,\n required: true,\n disabled: true,\n create: false,\n },\n {\n type: 'input',\n column: 'name',\n text: 'person name',\n name: 'name',\n multiedit: false,\n required: false,\n edit: false,\n create: false,\n },\n\n {\n type: 'input',\n column: 'email',\n text: 'email',\n name: 'email',\n multiedit: false,\n required: false,\n edit: false,\n create: false,\n },\n\n {\n type: 'select',\n url: 'crm/people',\n list: {\n value: 'id',\n text: 'fullname',\n data: [],\n },\n column: 'user_id',\n text: this.$t('fields.person'),\n name: 'person',\n apiObject: {\n name: 'person.name',\n },\n table: false,\n },\n {\n type: 'input',\n column: 'package_points',\n text: 'package points',\n name: 'package_points',\n required: false,\n edit: false,\n create: false,\n },\n\n // package_points\n {\n type: 'select',\n url: 'crm/package',\n list: {\n value: 'id',\n text: 'full_name',\n data: [],\n },\n column: 'package_id',\n text: 'package name',\n name: 'package',\n apiObject: {\n name: 'package.package_name',\n },\n table: false,\n },\n {\n type: 'input',\n column: 'package_name',\n text: 'package name',\n name: 'package_name',\n multiedit: false,\n required: false,\n edit: false,\n create: false,\n },\n\n {\n type: 'input',\n column: 'package_price',\n text: 'package price',\n name: 'package_price',\n multiedit: false,\n required: false,\n edit: false,\n create: false,\n },\n\n {\n type: 'input',\n column: 'pur_date',\n text: 'purche date',\n name: 'pur_date',\n multiedit: false,\n required: false,\n edit: false,\n create: false,\n },\n ]\n }", "function updateHeaderFields() {\n data.fields.forEach(field => {\n let id = GatherComponent.idByGatherTeamField(gatherMakers, gatherMakers.team, field);\n field.attributes.name = elementById(id).value;\n });\n}", "function update_array()\n{\n array_size=inp_as.value;\n generate_array();\n}", "function deleteModuleField(moduleName, fieldID){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n \n db.modules.update({name: moduleName}, {$pull: {fields: {id: mongo.helper.toObjectID(fieldID)}}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}" ]
[ "0.8652673", "0.70994407", "0.69737965", "0.6589965", "0.6513358", "0.6509463", "0.59435564", "0.5773354", "0.5769816", "0.5576439", "0.55589837", "0.55294067", "0.54397786", "0.5399783", "0.5358418", "0.53507483", "0.530652", "0.5295252", "0.5295252", "0.5285423", "0.5277235", "0.525803", "0.52191067", "0.51791704", "0.51658857", "0.5165864", "0.51583374", "0.51289386", "0.5128533", "0.51214904" ]
0.84816843
1
Clears the query params
clearQueryParams() { this.queryParams = {}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeAllURLQueryString() {\n delete this.urlObj.search;\n }", "clearQs() {\n this.forwardQueryString = false;\n this.queryString = {};\n return this;\n }", "clearInitialSearch() {\n const params = this.params();\n delete params.q;\n\n m.route(app.route(this.searchRoute, params));\n }", "reset() {\n this.set('query', '');\n }", "clearQueryString () {\n window.history.replaceState({}, null, this._getPathFromUrl())\n }", "function clearUrlQuery() {\n if (window.location.search && window.history && window.history.pushState) {\n window.history.pushState({}, document.title, window.location.pathname);\n }\n}", "function clearQueryString() { // jshint ignore:line\n const newurl = window.location.protocol + \"//\" + window.location.host + window.location.pathname;\n window.history.pushState && window.history.pushState({\n path: newurl\n }, \"\", newurl);\n }", "reset() {\n if (this._queryStartKey) {\n this._queryStartKey = undefined;\n }\n if (this._querySkip) {\n this._querySkip = undefined;\n }\n if (this.isSearch) {\n this.isSearch = false;\n }\n if (this.querying) {\n this._querying = false;\n }\n if (this.requests) {\n this.requests = undefined;\n }\n }", "deleteURLQueryString(key) {\n const searchParams = new URL.URLSearchParams(this.urlObj.search);\n searchParams.delete(key);\n this.urlObj.search = searchParams.toString();\n }", "clear() { \n this.state.page=0;\n this.state.filters='';\n this.state.search='';\n document.getElementById('searchInput').value = '';\n for (var key in this.state.listFilters){\n document.getElementById(key).value='';\n this.state.listFilters[key]='';\n this.state.filters='';\n } \n this.loadData(''); \n }", "async clearSelectedFilters(lens) {\n if (lens) {\n await this.$store.dispatch('resetFilterState', { resourceName: this.resourceName, lens })\n } else {\n await this.$store.dispatch('resetFilterState', { resourceName: this.resourceName })\n }\n\n this.updateQueryString({\n [this.pageParameter]: 1,\n [this.filterParameter]: '',\n })\n }", "_clearFilterInput() {\r\n const that = this;\r\n\r\n that._filterInfo.query = '';\r\n delete that._filterInfo.inputFilters;\r\n that.$.filterInput.value = '';\r\n }", "clearQuery() {\n this.setState({\n query: '',\n value: 'none',\n })\n }", "_reset () {\n if (this._queryable || this.reset) {\n if (this.reset) {\n // If there's a reset method available, run that\n this.reset()\n } else {\n // If queryable, clear the query string\n window.history.replaceState({}, null, this._getPathFromUrl())\n // Reload the video\n window.location.reload()\n }\n }\n }", "clear() {\n this.queries.length = 0;\n }", "clearSearch() {\n this.props.Store.setQuery('');\n }", "function resetSearch(query) {\n\n if (query !== \"date\"){\n datesearch.property(\"value\", \"\");\n }\n if (query !== \"city\"){\n citysearch.property(\"value\", \"\");\n }\n if (query !== \"state\"){\n statesearch.property(\"value\", \"\");\n }\n if (query !== \"country\"){\n countrysearch.property(\"value\", \"\");\n }\n if (query !== \"shape\"){\n shapesearch.property(\"value\", \"\");\n }\n if (query !== \"comment\"){\n commentsearch.property(\"value\", \"\");\n }\n}", "clear() {\n window.location.href = this.collectionData.url + Utils.getQueryString();\n }", "function clearLastQuery()/*:void*/ {\n this.lastQuery = null;\n }", "function clearForm(){\r\n\t$('#param-values').empty();\r\n}", "function reset(){\n\t/* MAKE URL */\n\tselected.clear();\n\twindow.location.href = makeQueryString();\n}", "clearPrivateParams() {\n if (this.isDummy()) {\n return;\n }\n\n Object.keys(this.privateParams).forEach(name => {\n const param = this.privateParams[name];\n param.fill(0);\n delete this.privateParams[name];\n });\n this.privateParams = null;\n this.isEncrypted = true;\n }", "function resetFilters() {\n\n $('#title-search').val('');\n\t$('#categories').val('all');\n\t$('#countries').val('all');\n $('#years').val('all');\n\n send_data['title'] = '';\n\tsend_data['category'] = '';\n\tsend_data['country'] = '';\n send_data['year'] = '';\n\tsend_data['format'] = 'json';\n}", "deleteParams(filter){\n\n\t\tdelete this.attributes.params[filter];\n\n\t\tthis.sendParams();\n\n\t}", "function removeParamsFromUrl(paramKey) {\n\n\n var nextUrl = window.location.origin + window.location.pathname;\n\n var params = getUrlVars(); //Get all the query params as an ARRAY\n params[paramKey] = '';\n var size = Object.keys(params).length;\n var i = 0;\n if (size == 0) {\n window.location.href = window.location.origin + window.location.pathname;\n } else {\n nextUrl += '?'; // ? for started to attach the query string to url\n\n // This is for search,selection by any one of ways => BRAND or SEARCH Keyword\n if (paramKey == 'search' && params['brand'] != undefined) {\n params['brand'] = '';\n }\n if (paramKey == 'brand' && params['search'] != undefined) {\n params['search'] = '';\n }\n\n // Attach the query params to the nextURL \n $.each(params, function(key, value) {\n if (value != '') {\n if (i == size) {\n nextUrl += key + '=' + value;\n } else {\n nextUrl += key + '=' + value + '&';\n }\n }\n\n i++;\n });\n\n window.location.href = nextUrl;\n }\n}", "function clearFilter(){\n vm.search = '';\n }", "function reset_search()\n {\n $(rcmail.gui_objects.qsearchbox).val('');\n\n if (search_request) {\n search_request = search_query = null;\n fetch_notes();\n }\n }", "function clear_search()\r\n {\r\n $(\"#home_grid\").jqGrid('setGridParam', {\r\n datatype: 'json'\r\n }).trigger('reloadGrid');\r\n }", "static clearQueryData() {\n this.standardizeQueryData();\n queryData[this.className()] = {};\n }", "function resetAllSearchVals(){\n search_term = '';\n page = 1;\n classFilter = 'collection';\n typeFilter = 'All';\n groupFilter = 'All';\n subjectFilter = 'All';\n gcmdFilter='All';\n fortwoFilter='All';\n forfourFilter='All';\n forsixFilter='All';\n resultSort = 'score desc';\n temporal = 'All'; \n n = '';\n e = '';\n s='';\n w='';\n mapSearch=0;\n spatial_included_ids=''; \n }" ]
[ "0.7641261", "0.75850177", "0.7096127", "0.7081908", "0.7053546", "0.70035225", "0.6965717", "0.69373214", "0.67906666", "0.6681247", "0.6549215", "0.65451187", "0.64949024", "0.6426417", "0.64178604", "0.6417518", "0.63831586", "0.6334712", "0.63329154", "0.6330536", "0.6310441", "0.62950426", "0.6291418", "0.6245377", "0.6229312", "0.6192033", "0.61899996", "0.61670303", "0.6153861", "0.6148208" ]
0.8285499
0
Clones the query params
_cloneQueryParams() { var extend = function (object) { const scratch = {}; Object.keys(object).forEach((key) => { const value = object[key]; if (Array.isArray(value)) { scratch[key] = value.splice(0); } else if (typeof value === 'object') { scratch[key] = extend(value); } else { scratch[key] = value; } }, this); return scratch; }; return extend(this.queryParams); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clearQueryParams() {\n this.queryParams = {};\n }", "clearQs() {\n this.forwardQueryString = false;\n this.queryString = {};\n return this;\n }", "addQueryParams(additionalQueryParams) {\n for (const key in additionalQueryParams) {\n if (additionalQueryParams.hasOwnProperty(key)) {\n if (additionalQueryParams[key] !== this._queryParams[key]) {\n //changes detected.\n this._queryParams = _.assign({}, this._queryParams, additionalQueryParams);\n this._invalidateSettings();\n break;\n }\n }\n }\n }", "removeAllURLQueryString() {\n delete this.urlObj.search;\n }", "function set_url_params(query, init_query) {\n var base_url = script_vars.current_url;\n var base_url_depaged = script_vars.current_url_depaged;\n var url = '';\n\n Object.keys(query).forEach(function(key) {\n console.log(query[key])\n // Go through each query key and set/delete url param\n if (typeof query[key] != 'undefined') {\n if(url) {\n url += '&';\n }\n url+= key + '=' + query[key];\n }\n })\n\n if(url) {\n url = '?' + url;\n }\n\n // If query has changed navigate to depaged base url (reset the page)\n if (query !== init_query) {\n // TODO - determine whether we need to detect page has not changed\n base_url = base_url_depaged;\n }\n\n window.location = base_url + url;\n }", "function clearQueryString() { // jshint ignore:line\n const newurl = window.location.protocol + \"//\" + window.location.host + window.location.pathname;\n window.history.pushState && window.history.pushState({\n path: newurl\n }, \"\", newurl);\n }", "function queryParams() {\n const params = {};\n urlBase.searchParams.forEach((value, key) => {\n params[key] = value;\n });\n\n return params;\n }", "function queryParams() {\n const params = {};\n urlBase.searchParams.forEach((value, key) => {\n params[key] = value;\n });\n\n return params;\n }", "deleteURLQueryString(key) {\n const searchParams = new URL.URLSearchParams(this.urlObj.search);\n searchParams.delete(key);\n this.urlObj.search = searchParams.toString();\n }", "getQueryParameters(queryParameters, routeParams) {\n const urlSearchParams = new URLSearchParams(queryParameters);\n const dictParams = Object.fromEntries(urlSearchParams.entries());\n Object.keys(dictParams).forEach(key => {\n routeParams[key] = dictParams[key];\n });\n }", "getQueryParameters(queryParameters, routeParams) {\n const urlSearchParams = new URLSearchParams(queryParameters);\n const dictParams = Object.fromEntries(urlSearchParams.entries());\n Object.keys(dictParams).forEach(key => {\n routeParams[key] = dictParams[key];\n });\n }", "_prepare(params_orig) {\n let pars = [];\n for (let par in params_orig) {\n pars.push({ name: par, values: params_orig[par] });\n }\n\n this._combinations = [{}];\n for (let i = 0; i < pars.length; i++) {\n let collected_new = [];\n for (let obj of this._combinations) {\n for (let j = 0; j < pars[i].values.length; j++) {\n let obj2 = this.clone(obj);\n obj2[pars[i].name] = pars[i].values[j];\n collected_new.push(obj2);\n }\n }\n this._combinations = collected_new;\n }\n this._params = pars;\n }", "function clearUrlQuery() {\n if (window.location.search && window.history && window.history.pushState) {\n window.history.pushState({}, document.title, window.location.pathname);\n }\n}", "parseQueryParam(params) {\n const key = matchQueryParams(this.remaining);\n\n if (!key) {\n return;\n }\n\n this.capture(key);\n let value = '';\n\n if (this.consumeOptional('=')) {\n const valueMatch = matchUrlQueryParamValue(this.remaining);\n\n if (valueMatch) {\n value = valueMatch;\n this.capture(value);\n }\n }\n\n const decodedKey = decodeQuery(key);\n const decodedVal = decodeQuery(value);\n\n if (params.hasOwnProperty(decodedKey)) {\n // Append to existing values\n let currentVal = params[decodedKey];\n\n if (!Array.isArray(currentVal)) {\n currentVal = [currentVal];\n params[decodedKey] = currentVal;\n }\n\n currentVal.push(decodedVal);\n } else {\n // Create a new value\n params[decodedKey] = decodedVal;\n }\n }", "_setQueryStringOptions () {\n this.qs = this._get('qs', {})\n }", "parseQueryParam(params) {\n const key = matchQueryParams(this.remaining);\n if (!key) {\n return;\n }\n this.capture(key);\n let value = '';\n if (this.consumeOptional('=')) {\n const valueMatch = matchUrlQueryParamValue(this.remaining);\n if (valueMatch) {\n value = valueMatch;\n this.capture(value);\n }\n }\n const decodedKey = decodeQuery(key);\n const decodedVal = decodeQuery(value);\n if (params.hasOwnProperty(decodedKey)) {\n // Append to existing values\n let currentVal = params[decodedKey];\n if (!Array.isArray(currentVal)) {\n currentVal = [currentVal];\n params[decodedKey] = currentVal;\n }\n currentVal.push(decodedVal);\n }\n else {\n // Create a new value\n params[decodedKey] = decodedVal;\n }\n }", "parseQueryParam(params) {\n const key = matchQueryParams(this.remaining);\n if (!key) {\n return;\n }\n this.capture(key);\n let value = '';\n if (this.consumeOptional('=')) {\n const valueMatch = matchUrlQueryParamValue(this.remaining);\n if (valueMatch) {\n value = valueMatch;\n this.capture(value);\n }\n }\n const decodedKey = decodeQuery(key);\n const decodedVal = decodeQuery(value);\n if (params.hasOwnProperty(decodedKey)) {\n // Append to existing values\n let currentVal = params[decodedKey];\n if (!Array.isArray(currentVal)) {\n currentVal = [currentVal];\n params[decodedKey] = currentVal;\n }\n currentVal.push(decodedVal);\n }\n else {\n // Create a new value\n params[decodedKey] = decodedVal;\n }\n }", "parseQueryParam(params) {\n const key = matchQueryParams(this.remaining);\n if (!key) {\n return;\n }\n this.capture(key);\n let value = '';\n if (this.consumeOptional('=')) {\n const valueMatch = matchUrlQueryParamValue(this.remaining);\n if (valueMatch) {\n value = valueMatch;\n this.capture(value);\n }\n }\n const decodedKey = decodeQuery(key);\n const decodedVal = decodeQuery(value);\n if (params.hasOwnProperty(decodedKey)) {\n // Append to existing values\n let currentVal = params[decodedKey];\n if (!Array.isArray(currentVal)) {\n currentVal = [currentVal];\n params[decodedKey] = currentVal;\n }\n currentVal.push(decodedVal);\n }\n else {\n // Create a new value\n params[decodedKey] = decodedVal;\n }\n }", "parseQueryParam(params) {\n const key = matchQueryParams(this.remaining);\n if (!key) {\n return;\n }\n this.capture(key);\n let value = '';\n if (this.consumeOptional('=')) {\n const valueMatch = matchUrlQueryParamValue(this.remaining);\n if (valueMatch) {\n value = valueMatch;\n this.capture(value);\n }\n }\n const decodedKey = decodeQuery(key);\n const decodedVal = decodeQuery(value);\n if (params.hasOwnProperty(decodedKey)) {\n // Append to existing values\n let currentVal = params[decodedKey];\n if (!Array.isArray(currentVal)) {\n currentVal = [currentVal];\n params[decodedKey] = currentVal;\n }\n currentVal.push(decodedVal);\n }\n else {\n // Create a new value\n params[decodedKey] = decodedVal;\n }\n }", "parseQueryParam(params) {\n const key = matchQueryParams(this.remaining);\n if (!key) {\n return;\n }\n this.capture(key);\n let value = '';\n if (this.consumeOptional('=')) {\n const valueMatch = matchUrlQueryParamValue(this.remaining);\n if (valueMatch) {\n value = valueMatch;\n this.capture(value);\n }\n }\n const decodedKey = decodeQuery(key);\n const decodedVal = decodeQuery(value);\n if (params.hasOwnProperty(decodedKey)) {\n // Append to existing values\n let currentVal = params[decodedKey];\n if (!Array.isArray(currentVal)) {\n currentVal = [currentVal];\n params[decodedKey] = currentVal;\n }\n currentVal.push(decodedVal);\n }\n else {\n // Create a new value\n params[decodedKey] = decodedVal;\n }\n }", "loadQueryParams() {\n queryParamsToFormStore(\n this.args.queryParams,\n this.formStore,\n this.sourceNode\n );\n }", "clearQueryString () {\n window.history.replaceState({}, null, this._getPathFromUrl())\n }", "function delete2Params(param1, param2) {\n var searchParams = new URLSearchParams(url.search.slice(1))\n\n //delete the param\n searchParams.delete(param1)\n searchParams.delete(param2)\n\n //load up new url\n var newUrl = \"?\" + searchParams.toString()\n toNewURL(newUrl)\n }", "makeQueryData () {\n\t\t// remove the parameter in question from the query data\n\t\tconst queryData = super.makeQueryData();\n\t\tdelete queryData[this.parameter];\n\t\treturn queryData;\n\t}", "function updateQuery() {\n var newUrl = window.location.href;\n // clean out valueless parameters to simplify ensuing matching\n newUrl = newUrl.replace(/(.*[?&])param1(&(.*))?$/, \"$1$3\");\n if (param1 !== default1) {\n if (newUrl.match(/[?&]param1=/)) {\n newUrl = newUrl.replace(/(.*[?&]param1=)[^&]*(.*)/, '$1' + param1 + '$2');\n } else if (newUrl.indexOf('?') > 0) {\n newUrl = newUrl + '&param1=' + param1;\n } else {\n newUrl = newUrl + '?param1=' + param1;\n }\n } else {\n newUrl = newUrl.replace(/(.*[?&])param1=[^&]*&?(.*)/, '$1$2');\n }\n\n // tidy up\n if (newUrl.match(/[?&]$/)) {\n newUrl = newUrl.slice(0, -1);\n } \n window.history.pushState('', '', newUrl);\n}", "function pproxy_params_copy(obj){\n var newObj=new Object();\n for(var k in obj){\n\t\tvar arr=new Array();\n\t\tfor(var i in obj[k]){\n\t\t\tarr[i]=obj[k][i]+\"\";\n\t\t}\n\t\tnewObj[k]=arr;\n }\n return newObj\n}", "function removeParamsFromUrl(paramKey) {\n\n\n var nextUrl = window.location.origin + window.location.pathname;\n\n var params = getUrlVars(); //Get all the query params as an ARRAY\n params[paramKey] = '';\n var size = Object.keys(params).length;\n var i = 0;\n if (size == 0) {\n window.location.href = window.location.origin + window.location.pathname;\n } else {\n nextUrl += '?'; // ? for started to attach the query string to url\n\n // This is for search,selection by any one of ways => BRAND or SEARCH Keyword\n if (paramKey == 'search' && params['brand'] != undefined) {\n params['brand'] = '';\n }\n if (paramKey == 'brand' && params['search'] != undefined) {\n params['search'] = '';\n }\n\n // Attach the query params to the nextURL \n $.each(params, function(key, value) {\n if (value != '') {\n if (i == size) {\n nextUrl += key + '=' + value;\n } else {\n nextUrl += key + '=' + value + '&';\n }\n }\n\n i++;\n });\n\n window.location.href = nextUrl;\n }\n}", "clearInitialSearch() {\n const params = this.params();\n delete params.q;\n\n m.route(app.route(this.searchRoute, params));\n }", "get queryParams() {\n if (this.args.query) {\n return this.args.query;\n } else {\n return {};\n }\n }", "function QueryParameters() {}" ]
[ "0.72527725", "0.6354464", "0.62944865", "0.62072563", "0.6136836", "0.60743904", "0.603191", "0.5953603", "0.5945542", "0.59019774", "0.59019774", "0.58880925", "0.58802503", "0.5855626", "0.58492976", "0.58412933", "0.58412933", "0.58412933", "0.58412933", "0.58412933", "0.5818707", "0.5778576", "0.5764598", "0.57406044", "0.57304937", "0.56753093", "0.56500256", "0.5636668", "0.56286365", "0.5602003" ]
0.7555594
0
sets that.selectedMonth and that.selectedYear if different. returns true if the properties were set
function setMonthYear(date) { var month = date.getMonth(); var year = date.getFullYear(); // update properties if different if (month !== that.selectedMonth || year !== that.selectedYear) { that.selectedMonth = month; that.selectedYear = year; return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_setSelectedMonth(value) {\n if (value instanceof DateRange) {\n this._selectedMonth = this._getMonthInCurrentYear(value.start) ||\n this._getMonthInCurrentYear(value.end);\n }\n else {\n this._selectedMonth = this._getMonthInCurrentYear(value);\n }\n }", "_setSelectedMonth(value) {\n if (value instanceof DateRange) {\n this._selectedMonth = this._getMonthInCurrentYear(value.start) ||\n this._getMonthInCurrentYear(value.end);\n }\n else {\n this._selectedMonth = this._getMonthInCurrentYear(value);\n }\n }", "function pickYearAndMonth(year, month) {\n self.date.year = year || new Date().getFullYear();\n self.date.month = month || self.months[new Date().getMonth()];\n self.date.day = new Date().getDay();\n self.activeDay = self.date.day;\n\n getMonthNotes(year, month);\n }", "function setSelectedMonth()\n{\nptr= arguments[0];\nnew_date= arguments[1];\nptr=new_date.getMonth()+ptr;\nindex=ptr\nif(index == 12)\n index = 0;\nelse if(index == -1)\n index = 11;\nisLeap=leapYear(new_date.getFullYear)\nif(isLeap)\n new_date.setDate(calLeapPeriods[index]);\nelse\n new_date.setDate(calPeriods[index]);\nnew_date.setMonth(ptr);\n}", "_setMonth(date, monthSelector, updateDatesOnly) {\n const that = this,\n selectedDates = that._getDays(date, that.selectedDates),\n importantDates = that._getDays(date, that.importantDates),\n restrictedDates = that._getDays(date, that.restrictedDates);\n\n date.setDate(1);\n\n if (!monthSelector) {\n monthSelector = that.$.month;\n }\n\n monthSelector._date = new Date(date);\n\n if (!updateDatesOnly) {\n if (!that._viewDates || that._viewDates.length >= that.months) {\n that._viewDates = [];\n }\n\n that._viewDates.push(new Date(date));\n }\n\n date = new Date(date);\n\n //Correct the start day according to firstDayOfWeek property\n let firstDayOfWeek = (date.getDay() - that.firstDayOfWeek + 7) % 7;\n\n date.setDate(0);\n\n let previusMonthDays = date.getDate();\n\n date.setDate(32); // current month.\n date.setDate(1); // set to first day of month.\n date.setDate(32); // next month.\n\n if (that._selectedCells) {\n for (let i = 0; i < that._selectedCells.length; i++) {\n if (that._selectedCells[i].closest('.jqx-calendar-month') === monthSelector) {\n that._setCellState(that._selectedCells[i], 'selected', false);\n }\n }\n }\n\n that._setMonthContent(date, monthSelector, {\n previusMonthDays: previusMonthDays,\n firstDayOfWeek: firstDayOfWeek,\n selectedDates: selectedDates,\n importantDates: importantDates,\n restrictedDates: restrictedDates\n });\n }", "function updateMonth(month, date) {\n month.getElementsByTagName(\"option\")[date.getMonth()].selected = \"selected\";\n}", "function ds_setDateParts( year, month, date ) {\r\r\n\tthis.dayObj[date-1].selected = true;\r\r\n\tthis.monthObj[month-1].selected = true;\r\r\n\tfor( i=0; i < this.yearObj.length; i++ ) {\r\r\n\t\tif( this.yearObj[i].value == year )\r\r\n\t\t\tthis.yearObj[i].selected = true;\r\r\n\t}\r\r\n\tthis.adjustDaysInMonth();\r\r\n}", "function setYears() {\n if (self.budgetMonths[0].month === 'January') {\n for (i = 0; i < self.budgetMonths.length; i++) {\n self.budgetMonths[i].year = self.startingYear;\n }\n } else {\n var newYear = false;\n for (i = 0; i < self.budgetMonths.length; i++) {\n if (newYear === false && self.budgetMonths[i].month != 'January') {\n newYear = false;\n self.budgetMonths[i].year = self.startingYear;\n } else if (newYear === false && self.budgetMonths[i].month === 'January') {\n newYear = true;\n self.budgetMonths[i].year = self.startingYear + 1;\n } else {\n self.budgetMonths[i].year = self.startingYear + 1;\n }\n }\n }\n } // end setYears", "function setTheYear() {\n if ( currentMonth >= 2 ) { // Check if it's past March\n console.log('Month - greater than or equal to 2');\n if ( currentMonth == 2 ) {\n console.log('Month - Equal to 2');\n if ( currentDay == 1 ) {\n console.log('The first!');\n start.setYear(currentYear - 1);\n end.setYear(currentYear);\n } else {\n console.log('After the first');\n start.setYear(currentYear);\n end.setYear(currentYear + 1);\n }\n } else {\n console.log('Month - greater than 2');\n start.setYear(currentYear);\n end.setYear(currentYear + 1);\n }\n } else {\n console.log('Month - less than 2');\n start.setYear(currentYear - 1);\n end.setYear(currentYear);\n }\n deferCheckDate.resolve();\n }", "_yearSelected(event) {\n const year = event.value;\n this.yearSelected.emit(this._dateAdapter.createDate(year, 0, 1));\n let month = this._dateAdapter.getMonth(this.activeDate);\n let daysInMonth = this._dateAdapter.getNumDaysInMonth(this._dateAdapter.createDate(year, month, 1));\n this.selectedChange.emit(this._dateAdapter.createDate(year, month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));\n }", "_yearSelected(event) {\n const year = event.value;\n this.yearSelected.emit(this._dateAdapter.createDate(year, 0, 1));\n let month = this._dateAdapter.getMonth(this.activeDate);\n let daysInMonth = this._dateAdapter.getNumDaysInMonth(this._dateAdapter.createDate(year, month, 1));\n this.selectedChange.emit(this._dateAdapter.createDate(year, month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));\n }", "_hasSameMonthAndYear(d1, d2) {\n return !!(d1 && d2 && this._dateAdapter.getMonth(d1) == this._dateAdapter.getMonth(d2) &&\n this._dateAdapter.getYear(d1) == this._dateAdapter.getYear(d2));\n }", "_hasSameMonthAndYear(d1, d2) {\n return !!(d1 && d2 && this._dateAdapter.getMonth(d1) == this._dateAdapter.getMonth(d2) &&\n this._dateAdapter.getYear(d1) == this._dateAdapter.getYear(d2));\n }", "function changeMonthByYear(year_selector, month_selector) {\n var today = new Date();\n var months = \"<option selected disabled>Tháng</option>\";\n if (today.getFullYear() == year_selector.val()) {\n var today = new Date();\n for (var month = 1; month <= today.getMonth(); month++) {\n months += \"<option value='\" + month + \"'>\" + month + \"</option>/n\"\n }\n } else {\n for (var month = 1; month <= 12; month++) {\n months += \"<option value='\" + month + \"'>\" + month + \"</option>/n\"\n }\n }\n month_selector.html(months);\n}", "isMonthActive(month) {\n const date = this.createMoment(this.value).month(month);\n return date.isSame(this.value, 'month') && date.isSame(this.activeDate, 'year');\n }", "_monthSelectedInYearView(normalizedMonth) {\n this.monthSelected.emit(normalizedMonth);\n }", "_monthSelectedInYearView(normalizedMonth) {\n this.monthSelected.emit(normalizedMonth);\n }", "function chkDurationMonth(fromMonth, toMonth){\n\tif((fromMonth.selectedIndex >= 0) && (toMonth.selectedIndex >= 0)){\n\t\tif(fromMonth.selectedIndex > toMonth.selectedIndex){\n\t\t\ttoMonth.selectedIndex = fromMonth.selectedIndex;\n\t\t}\t\t\n\t}\n}", "isCurrentMonth(month) {\n const date = this.activeDate.clone().month(month);\n return date.isSame(this._current, 'month') && date.isSame(this._current, 'year');\n }", "function chkDurationYear(fromYear, toYear){\n\tif((fromYear.selectedIndex >= 0) && (toYear.selectedIndex >= 0)){\n\t\tif(fromYear.selectedIndex > toYear.selectedIndex){\n\t\t\ttoYear.selectedIndex = fromYear.selectedIndex;\n\t\t}\n\t}\n}", "isValid() {\n return this.selection != null && this._isValidDateInstance(this.selection);\n }", "isValid() {\n return this.selection != null && this._isValidDateInstance(this.selection);\n }", "function validateSelects() {\n $(\"#metric_results\").empty();\n\n if( $('#selectYear').val()!='' && $('#selectMonth').val()!='' ) {\n globalYear = parseInt($('#selectYear').val());\n globalMonth = parseInt($('#selectMonth').val());\n genera_tabla(globalYear, globalMonth);\n }\n}", "SetSelectedYears(years) {\n console.debug(`ContaplusModel::SetSelectedYears(${years})`)\n this.years_selected = years\n }", "function validateMonth(oMon) {\n var isValidMon = false,\n existMonths = shareData.curFyMonths;\n angular.forEach(existMonths, function (month, i) {\n if (month.value == oMon) {\n isValidMon = true;\n }\n })\n return isValidMon;\n\n }", "_monthSelected(event) {\n const month = event.value;\n const normalizedDate = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1);\n this.monthSelected.emit(normalizedDate);\n const daysInMonth = this._dateAdapter.getNumDaysInMonth(normalizedDate);\n this.selectedChange.emit(this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));\n }", "_monthSelected(event) {\n const month = event.value;\n const normalizedDate = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1);\n this.monthSelected.emit(normalizedDate);\n const daysInMonth = this._dateAdapter.getNumDaysInMonth(normalizedDate);\n this.selectedChange.emit(this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));\n }", "function sameYearAndMonth(d1, d2) {\n\treturn (\n\t\td1.getFullYear() == d2.getFullYear() &&\n\t\td1.getMonth() == d2.getMonth()\n\t);\n}", "function ArchiveSelectYear(year)\n{\n // DESCRIPTION:\n // Selects the year and\n // checks valid months\n\n var lastSelection = document.getElementById(\"selectedYear\").value;\n\n document.getElementById(\"selectedYear\").value = year;\n\n document.getElementById(\"year\" + lastSelection).classList.remove(\"active\");\n document.getElementById(\"year\" + year).classList.add(\"active\");\n\n var validMonths = document.getElementById(\"valMonth_\" + year).value\n\n\n if(validMonths.includes(\"|01|\"))\n {\n document.getElementById(\"month1\").className = \"\";\n document.getElementById(\"month1\").onclick = function() { ArchiveSelectMonth(01); }\n }\n else\n {\n document.getElementById(\"month1\").className = \"invalid\";\n document.getElementById(\"month1\").onclick = \"\";\n }\n\n if(validMonths.includes(\"|02|\"))\n {\n document.getElementById(\"month2\").className = \"\";\n document.getElementById(\"month2\").onclick = function() { ArchiveSelectMonth(02); }\n }\n else\n {\n document.getElementById(\"month2\").className = \"invalid\";\n document.getElementById(\"month2\").onclick = \"\";\n }\n\n if(validMonths.includes(\"|03|\"))\n {\n document.getElementById(\"month3\").className = \"\";\n document.getElementById(\"month3\").onclick = function() { ArchiveSelectMonth(03); }\n }\n else\n {\n document.getElementById(\"month3\").className = \"invalid\";\n document.getElementById(\"month3\").onclick = \"\";\n }\n\n if(validMonths.includes(\"|04|\"))\n {\n document.getElementById(\"month4\").className = \"\";\n document.getElementById(\"month4\").onclick = function() { ArchiveSelectMonth(04); }\n }\n else\n {\n document.getElementById(\"month4\").className = \"invalid\";\n document.getElementById(\"month4\").onclick = \"\";\n }\n\n if(validMonths.includes(\"|05|\"))\n {\n document.getElementById(\"month5\").className = \"\";\n document.getElementById(\"month5\").onclick = function() { ArchiveSelectMonth(05); }\n }\n else\n {\n document.getElementById(\"month5\").className = \"invalid\";\n document.getElementById(\"month5\").onclick = \"\";\n }\n\n if(validMonths.includes(\"|06|\"))\n {\n document.getElementById(\"month6\").className = \"\";\n document.getElementById(\"month6\").onclick = function() { ArchiveSelectMonth(06); }\n }\n else\n {\n document.getElementById(\"month6\").className = \"invalid\";\n document.getElementById(\"month6\").onclick = \"\";\n }\n\n if(validMonths.includes(\"|07|\"))\n {\n document.getElementById(\"month7\").className = \"\";\n document.getElementById(\"month7\").onclick = function() { ArchiveSelectMonth(07); }\n }\n else\n {\n document.getElementById(\"month7\").className = \"invalid\";\n document.getElementById(\"month7\").onclick = \"\";\n }\n\n if(validMonths.includes(\"|08|\"))\n {\n document.getElementById(\"month8\").className = \"\";\n document.getElementById(\"month8\").onclick = function() { ArchiveSelectMonth(08); }\n }\n else\n {\n document.getElementById(\"month8\").className = \"invalid\";\n document.getElementById(\"month8\").onclick = \"\";\n }\n\n if(validMonths.includes(\"|09|\"))\n {\n document.getElementById(\"month9\").className = \"\";\n document.getElementById(\"month9\").onclick = function() { ArchiveSelectMonth(09); }\n }\n else\n {\n document.getElementById(\"month9\").className = \"invalid\";\n document.getElementById(\"month9\").onclick = \"\";\n }\n\n if(validMonths.includes(\"|10|\"))\n {\n document.getElementById(\"month10\").className = \"\";\n document.getElementById(\"month10\").onclick = function() { ArchiveSelectMonth(10); }\n }\n else\n {\n document.getElementById(\"month10\").className = \"invalid\";\n document.getElementById(\"month10\").onclick = \"\";\n }\n\n if(validMonths.includes(\"|11|\"))\n {\n document.getElementById(\"month11\").className = \"\";\n document.getElementById(\"month11\").onclick = function() { ArchiveSelectMonth(11); }\n }\n else\n {\n document.getElementById(\"month11\").className = \"invalid\";\n document.getElementById(\"month11\").onclick = \"\";\n }\n\n if(validMonths.includes(\"|12|\"))\n {\n document.getElementById(\"month12\").className = \"\";\n document.getElementById(\"month12\").onclick = function() { ArchiveSelectMonth(12); }\n }\n else\n {\n document.getElementById(\"month12\").className = \"invalid\";\n document.getElementById(\"month12\").onclick = \"\";\n }\n\n UpdateArchiveFrame();\n}", "handleSelectChange(e) {\r\n // check if target is year or month\r\n if (e.target.name == \"month\") {\r\n this.setState({\r\n month: e.target.value\r\n });\r\n }\r\n if (e.target.name == \"year\") {\r\n this.setState({\r\n year: e.target.value\r\n });\r\n }\r\n }" ]
[ "0.65656024", "0.65656024", "0.63593584", "0.60906655", "0.5955042", "0.5863237", "0.5845072", "0.57911855", "0.5727883", "0.56956816", "0.56956816", "0.56865835", "0.56865835", "0.5653115", "0.56506276", "0.5645195", "0.5645195", "0.564405", "0.55890894", "0.557247", "0.5555571", "0.5555571", "0.5540653", "0.5527973", "0.5509826", "0.54617286", "0.54617286", "0.54534113", "0.54321355", "0.54085684" ]
0.776558
0
build the calendar array
function buildCalendar() { var year = that.selectedYear; var month = that.selectedMonth; var firstDateOfMonth = getDate(year, month, 1); var firstDayOfMonth = firstDateOfMonth.getDay(); var firstDayOfWeek = that.options.firstDayOfWeek; var rowIndex = 0, datesInWeek = 0, date = 1; calendarItems = []; that.weeks = []; // if first day of month != firstDayOfWeek then start dates from prior month if (firstDayOfWeek != firstDayOfMonth) { var daysBefore = getDaysBeforeFirstDayOfMonth(firstDayOfWeek, firstDayOfMonth); if (daysBefore) { // 0 is one day prior; 1 is two days prior and so forth date = date - daysBefore; } } while (date <= getDaysInMonth(year, month)) { calendarItems.push(createCellData(getDate(year, month, date++))); } // fill remaining cells with dates from next month while ((calendarItems.length % 7) !== 0) { calendarItems.push(createCellData(getDate(year, month, date++))); } // populate the that.weeks array. create a 2D array of 7 days per row angular.forEach(calendarItems, function (cellData) { if ((datesInWeek % 7) === 0) { that.weeks.push([]); rowIndex = that.weeks.length - 1; } that.weeks[rowIndex].push(cellData); datesInWeek++; }); //raise the callback for each cell data raiseRenderDateCallback(calendarItems); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function constructCalendar(selectedDate){\n scope.calendarDays = [];\n //Setting up the array\n var endOfMonth = angular.copy(defaultDate);\n endOfMonth = endOfMonth.endOf('month').format('DD');\n var currentDate = angular.copy(defaultDate);\n\t\t\t\tvar currentDisplayDate = angular.copy(defaultDate);\n\t\t\t\t currentDisplayDate = currentDisplayDate.format('mmmm yyyy');\n currentDate = currentDate.startOf('month');\n //Building The Array\n for (var i = 0; i < endOfMonth; i++){\n var day = {\n date: moment(currentDate), //date of the calendar\n dayOfWeek: moment(currentDate).format('dddd'),\n dateNumber: moment(currentDate).format('DD'),\n events: [] //empty array for events to occur\n }\n \n if (day.date.isSame(moment(), 'day')){\n day.isToday = true;\n }\n scope.calendarDays.push(day)\n currentDate = currentDate.add(1, 'days');\n }\n scope.headingDays = [\"Sunday\" ,\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"];\n console.log(scope.headingDays);\n //Adding Events\n addInactiveDates();\n populateEvents();\n assignColors(); \n }", "function buildDayArray(dayCal){\n //look through the json file \"Eight Day Calendar\" and assemble arrays of each date\n for (let i = 0; i < dayCal.VCALENDAR[0].VEVENT.length; i++){\n let day = dayCal.VCALENDAR[0].VEVENT[i].SUMMARY;\n let dtStamp = dayCal.VCALENDAR[0].VEVENT[i];\n let date = dtStamp[\"DTSTART;VALUE=DATE\"];\n\n if ( day === 'Day 1'){\n day1dates.push(date);\n }\n if ( day === 'Day 2'){\n day2dates.push(date);\n }\n if ( day === 'Day 3'){\n day3dates.push(date);\n }\n if ( day === 'Day 4'){\n day4dates.push(date);\n }\n if ( day === 'Day 5'){\n day5dates.push(date);\n }\n if ( day === 'Day 6'){\n day6dates.push(date);\n }\n if ( day === 'Day 7'){\n day7dates.push(date);\n }\n if (day === 'Day 8'){\n day8dates.push(date);\n }\n }\n day1dates.push('Day 1');\n day2dates.push('Day 2');\n day3dates.push('Day 3');\n day4dates.push('Day 4');\n day5dates.push('Day 5');\n day6dates.push('Day 6');\n day7dates.push('Day 7');\n day8dates.push('Day 8');\n daySpace.textContent = matchDayDate();\n}", "calendarFill(data) {\n\n //get month and year of transmitted data\n const currentMonth = data.getMonth();\n const currentYear = data.getFullYear();\n\n // get in what day of a week the month starts\n const startMonth = new Date(currentYear, currentMonth, 0).getDay() + 1;\n\n // get current amount of days\n const currentAmountOfDays = 33 - new Date(currentYear, currentMonth, 33).getDate();\n\n // get how many weeks are in month\n function getWeeks(year, month) {\n const l = new Date(year, month + 1, 0);\n return Math.ceil((l.getDate() - (l.getDay() ? l.getDay() : 7)) / 7) + 1;\n }\n const currentWeeks = getWeeks(currentYear, currentMonth);\n\n //array output with calendar\n const daysInWeek = 7;\n const arr = [];\n let counter = 0;\n let day = 1;\n for (let i = 0; i < currentWeeks; i++) {\n arr[i] = [];\n for (let j = 0; j < daysInWeek; j++) {\n counter += 1;\n if (counter < startMonth) {\n arr[i][j] = null;\n } else if (counter >= currentAmountOfDays + startMonth) {\n arr[i][j] = null;\n } else {\n arr[i][j] = day++;\n }\n }\n };\n return arr;\n\n }", "function createCal(year, month) {\n var day = 1, i, j, haveDays = true,\n startDay = new Date(year, month, day).getDay(),\n daysInMonths = [31, (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n calendar = [];\n\n startDay -= firstDay;\n if (startDay < 0) {\n startDay = 7 + startDay;\n }\n\n if (createCal.cache[year] && !isIE11) {\n if (createCal.cache[year][month]) {\n return createCal.cache[year][month];\n }\n } else {\n createCal.cache[year] = {};\n }\n\n i = 0;\n while (haveDays) {\n calendar[i] = [];\n for (j = 0; j < 7; j++) {\n if (i === 0) {\n if (j === startDay) {\n calendar[i][j] = day++;\n startDay++;\n }\n } else if (day <= daysInMonths[month]) {\n calendar[i][j] = day++;\n } else {\n calendar[i][j] = '';\n haveDays = false;\n }\n if (day > daysInMonths[month]) {\n haveDays = false;\n }\n }\n i++;\n }\n\n ////6th week of month fix IF NEEDED\n //if (calendar[5]) {\n // for (i = 0; i < calendar[5].length; i++) {\n // if (calendar[5][i] !== '') {\n // calendar[4][i] = '<span>' + calendar[4][i] + '</span><span>' + calendar[5][i] + '</span>';\n // }\n // }\n // calendar = calendar.slice(0, 5);\n //}\n\n for (i = 0; i < calendar.length; i++) {\n calendar[i] = '<tr><td class=\"eformDay month_holder\" data-month=\"'+(parseInt(month)+1)+'\" onclick=\"pureJSCalendar.dayClick(this)\">' + calendar[i].join('</td><td class=\"eformDay\" onclick=\"pureJSCalendar.dayClick(this)\">') + '</td></tr>';\n }\n\n const calendarInnerHtml = calendar.join('');\n calendar = document.createElement('table', { class: 'curr' });\n calendar.innerHTML = calendarInnerHtml;\n const tdEmty = calendar.querySelectorAll('td:empty');\n for (var i = 0; i < tdEmty.length; ++i) {\n tdEmty[i].classList.add('nil');\n }\n if (month === new Date().getMonth()) {\n const calTd = calendar.querySelectorAll('td');\n const calTdArray = Array.prototype.slice.call(calTd);\n calTdArray.forEach(function (current, index, array) {\n if (current.innerHTML === new Date().getDate().toString()) {\n current.classList.add('today');\n }\n });\n }\n\n createCal.cache[year][month] = { calendar: function () { return calendar }, label: months[month] + ' ' + year };//calendar.clone()\n\n //DisableCalendarDays();\n return createCal.cache[year][month];\n }", "createDateArray() {\n\t\tvar datesArray = [];\n\t\t\n\t\tfor(var i = 0; i < 6; i++){\n\t\t\tvar currentDate = new Date();\n\t\t\tcurrentDate.setDate(currentDate.getDate() + i);\n\t\t\t\n\t\t\tvar dd = currentDate.getDate();\n\t\t\tvar mm = currentDate.getMonth() + 1; //January is 0!\n\t\t\tvar yyyy = currentDate.getFullYear();\n\n\t\t\tif (dd < 10) {\n\t\t\t dd = '0' + dd;\n\t\t\t}\n\n\t\t\tif (mm < 10) {\n\t\t\t mm = '0' + mm;\n\t\t\t}\n\n\t\t\tdatesArray.push([mm, dd, yyyy].join('-'));\n\t\t}\n\t\treturn datesArray;\n\t}", "CreateCalendarDataItem(obj = {}) {\n const {\n index_date,\n year,\n month_id,\n day,\n } = obj;\n\n let _class_name = this.config.classname.date;\n\n // Get Event-Data on Target-Day.\n let _date_event_data_obj = this.GetEventData({\n year: year,\n month_id: month_id,\n day: day,\n });\n let _date_event_data = _date_event_data_obj.result;\n\n // Set day-of-week.\n let _date_day_of_week = this.state.week_data[index_date % 7];\n\n // On Today.\n if (\n day === this.NowDt.date() &&\n this.state.year === this.NowDt.year() &&\n this.state.month_id === this.NowDt.month()\n ) {\n _class_name += ` ${this.config.classname.today}`;\n }\n\n // Not this Month.\n if (!day) _class_name += ` ${this.config.classname.date_disable}`;\n\n // When has event data.\n if (_date_event_data.length) {\n _class_name += ` ${this.config.classname.date_hasevent}`;\n } else {\n _class_name += ` ${this.config.classname.date_noevent}`;\n }\n\n let _date_event = [];\n let _date_event_html = '';\n if(_date_event_data.length){\n // Create Event data.\n\n let _class_name_parent = '';\n\n _date_event_data.map((val, index) => {\n if(val.category_en){\n _class_name_parent += ` u-has-${val.category_en}`;\n }\n _date_event.push(val);\n\n if(typeof this.config.template.date_data === 'function' ){\n _date_event_html += Str2Mustache(this.config.template.date_data(val), val);\n } else {\n _date_event_html += Str2Mustache(this.config.template.date_data, val);\n }\n\n });\n _class_name += _class_name_parent;\n }\n\n let _date = CALENDAR_MODULE.AnalyzeDate(year, month_id, day).current;\n\n // Create Calendar HTML data for one day.\n let _return = Object.assign(_date,\n {\n index: index_date,\n class_name: _class_name,\n day_of_week: _date_day_of_week,\n date_data: _date_event_html,\n date_data_ary: _date_event\n }\n );\n\n return _return;\n }", "function BuildDates(date){\r\n var array = new Array();\r\n array['day'] = (date.getDate() < 10) ?\r\n '0' + date.getDate().toString() :\r\n date.getDate().toString();\r\n \r\n array['month'] = (date.getMonth() < 9) ?\r\n '0' + (date.getMonth()+1).toString() :\r\n (date.getMonth()+1).toString();\r\n \r\n array['year'] = date.getFullYear().toString();\r\n return array;\r\n}", "function createArray(){\n for (let i = 1; i <= 30; i++){\n let currentDate = new Date (`2020-11-${i} 15:00`);\n let item = { \"index\": i, \"date\": currentDate,\"dateString\":currentDate.toISOString().slice(0,10)}\n \n dateArray[i] = item\n addDateToDiv(item) \n }\n}", "function getCalendar(year, month, day) {\n var days = new Date(year, month + 1, 0).getDate();\n var offset = new Date(year, month, 1).getDay() - 1;\n offset = offset === -1 ? 6 : offset;\n var lines = Math.ceil((days + offset) / 7);\n var cal = [];\n var actual_day = 1 - offset;\n for (var l = 0; l < lines; l++) {\n var row = [];\n for (var c = 0; c < 7; c++) {\n row.push({\n id: actual_day,\n number: new Date(year, month, actual_day).getDate(),\n otherMonth: actual_day < 1 || actual_day > days,\n selected: actual_day === day,\n today: actual_day === new Date().getDate() && month === new Date().getMonth() && year === new Date().getFullYear()\n });\n actual_day++;\n }\n cal.push(row);\n }\n return cal;\n}", "function fillCalendar() {\n console.log(\"inside the fill calendar\");\n // for (let i = 0; i < events.length; i++) {\n // console.log(events[i].title);\n // }\n let currentMonth = date.getMonth()+1;\n let dateComp = new Date(date.getFullYear()+yearCounter, currentMonth-1+monthCounter, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n let year = new Date(date.getFullYear()+yearCounter, currentMonth+monthCounter, 0).getFullYear();\n let month = new Date(date.getFullYear()+yearCounter, currentMonth+monthCounter, 0).getMonth();\n let numDaysInMonth = new Date(date.getFullYear()+yearCounter, currentMonth+monthCounter, 0).getDate();\n let monthStartingDay = new Date(date.getFullYear()+yearCounter, currentMonth+-1+monthCounter, 1).getDay();\n let numDaysLastMonth = new Date(date.getFullYear()+yearCounter, currentMonth+monthCounter-1, 0).getDate();\n let monthStartingDayCopy = monthStartingDay;\n let counter = 1;\n let counter2 = 0;\n let counter3 = 0;\n let counter4 = 1;\n //\n //prints month and year above calendar\n //\n $(\"#month\").html(`${months[month]}`);\n $(\"#year\").html(`${year}`);\n //\n //clears all day boxes on calendar\n //\n $(\".day-box\").html(\" \"); \n // while loop fills in boxes for last month\n // first for-loop fills in first row for curreny month\n // second for-loop fills in the rest of the rows for current month\n // third for-loop fills in the rest of the rows for next month\n while (counter2 < monthStartingDay) {\n $(`#c${counter2}`).append(`<span class=\"faded\">${numDaysLastMonth-monthStartingDayCopy+1}</span>`);\n counter2++;\n monthStartingDayCopy--;\n }\n for (let j = monthStartingDay; j < 7; j++) {\n $(`#c${j}`).append(`<span class=\"bold\">${counter}</span>`);\n for (let i = 0 ; i < events.length; i++) {\n //\n // If the current date is equal to the date generated by fillCalender()\n // then highlight current day's box to lightgreen using currentDay class\n //\n if (currentMonth + monthCounter == parseInt(events[i].startMonth) && counter == parseInt(events[i].startDay)) {\n $(`#c${j}`).append(`<p class=\"event ${events[i].tag}\">${events[i].startHour}:${events[i].startMinutes} ${events[i].title}</p>`);\n }\n }\n counter++;\n }\n for (let j = 7; counter <= numDaysInMonth; j++) {\n $(`#c${j}`).append(`<span class=\"bold\">${counter}</span>`);\n if (date.getMonth() == dateComp.getMonth() && date.getDate() == dateComp.getDate() && date.getFullYear() == dateComp.getFullYear()) {\n currentDayIDNum = date.getDate()-monthStartingDay+1;\n $(`#c${currentDayIDNum}`).find(\"span\").addClass(\"currentDay\");\n } else {\n $(`#c${currentDayIDNum}`).find(\"span\").removeClass(\"currentDay\");\n }\n for (let i = 0 ; i < events.length; i++) {\n // console.log(\"Event index: \" + i)\n if (currentMonth + monthCounter == parseInt(events[i].startMonth) && counter == parseInt(events[i].startDay)) {\n $(`#c${j}`).append(`<p class=\"event ${events[i].tag}\">${events[i].startHour}:${events[i].startMinutes} ${events[i].title}</p>`);\n }\n }\n counter++;\n counter3 = j+1;\n }\n for (j = counter3; j < 42; j++) {\n $(`#c${j}`).append(`<span class=\"faded\">${counter4}</span>`);\n counter3++;\n counter4++;\n }\n console.log(\"Outside fill calendar\");\n}", "getOrganizedArr() {\n this.dayArr = [[],[],[],[],[],[],[]];\n this.items.forEach(item => {\n this.placeEventIntoDayArray(item);\n });\n this.dayArr = this.sortDayArr(this.dayArr);\n return this.dayArr;\n }", "function createCalendarQueue(): number[] {\n return range(Calendar_ROW * Calendar_COL)\n}", "function fillCurrent() {\n for (let i = startDay; i < endDate + startDay; i++) {\n dateArray.push(i - startDay + 1)\n }\n }", "function createCalendar() {\n addCalendar();\n displayDates();\n}", "function createCalendar(){\n // display the current month and year at the top of the calendar\n calendarHeader.innerHTML = `<h1>${monthInfo[dateInfo.currentMonth][0]} ${dateInfo.currentYear}</h1>`;\n checkLeapYear();\n addDaysFromPastMonth();\n addDaysFromCurrentMonth();\n addDaysFromNextMonth();\n}", "function updateCalendar(){\n //events = [];\n document.getElementById(\"display_events\").innerHTML = \"\";\n //document.getElementById(\"days\").innerHTML = \"\";\n $(\"#days\").empty();\n\tlet weeks = currentMonth.getWeeks();\n \n const data = {'month': currentMonth.month+1, 'year': currentMonth.year};\n eventsDay(data);\n //console.log(currentMonth);\n let index = 0;\n\tfor(let w in weeks){\n\t\tlet days = weeks[w].getDates();\n index++;\n\t\t// days contains normal JavaScript Date objects.\n\t\t//alert(\"Week starting on \"+days[0]); \n\t\t//$(\"#days\").append(\"<div class='calendar__week'>\");\n\t\tfor(let d in days){ \n\t\t\t// You can see console.log() output in your JavaScript debugging tool, like Firebug,\n\t\t\t// WebWit Inspector, or Dragonfly.\n const dayRegex = /(\\d{2})/g;\n const dayMatch = dayRegex.exec(days[d])[1];\n //const data = {'day': dayMatch, 'month': currentMonth.month+1, 'year': currentMonth.year};\n let name =\"\";\n let namearray = [];\n let count = 0;\n for (let i = 0; i < eventclass.length; ++i) {\n //console.log(eventclass[i].name);\n //console.log(eventclass[i].day + \" \" + dayMatch);\n const c = eventclass[i].tag;\n let color;\n if (c == 'holiday') {\n color = 'green';\n }\n else if (c == 'birthday') {\n color = 'pink';\n }\n else if (c == 'exam') {\n color = 'blue';\n }\n else if (c == 'important') {\n color = 'red';\n }\n else {\n color = '#aab2b8';\n }\n //console.log(eventclass[i].name + \" \" + eventclass[i].month);\n \n if (eventclass[i].day == dayMatch && currentMonth.month+1 == eventclass[i].month && currentMonth.year == eventclass[i].year) {\n //console.log(\"entered\");\n if (eventclass[i].day < 7) {\n if(index > 1) {\n //console.log(\"less than 1\");\n //\n }\n else {\n name= name.concat(\"<div id='eventbox'><span style='color:\"+color+\";'>\" + eventclass[i].name + \"</span> <button class='mod' id='modify_btn' value=\" + eventclass[i].id +\">Edit</button> <button class='del' id='delete_btn' value=\" + eventclass[i].id +\">Delete</button> <button class='time' id='time_btn' value=\" + eventclass[i].id +\">View Details</button></div>\");\n name = name.concat(\"<br>\");\n //console.log(eventclass[i].month);\n //console.log(\"greater\");\n }\n \n }\n else if (eventclass[i].day > 23) {\n if(index < 3) {\n //\n }\n else {\n name= name.concat(\"<div id='eventbox'><span style='color:\"+color+\";'>\" + eventclass[i].name + \"</span> <button class='mod' id='modify_btn' value=\" + eventclass[i].id +\">Edit</button> <button class='del' id='delete_btn' value=\" + eventclass[i].id +\">Delete</button> <button class='time' id='time_btn' value=\" + eventclass[i].id +\">View Details</button></div>\");\n name = name.concat(\"<br>\");\n \n }\n }\n else {\n //sname = name.concat(eventclass[i].name);\n // name= name.concat(\"<button class='mod' id='modify_btn' value=\" + eventclass[i].id +\">\" + eventclass[i].name + \"</button><p>\");\n name= name.concat(\"<div id='eventbox'><span style='color:\"+color+\";'>\" + eventclass[i].name + \"</span> <button class='mod' id='modify_btn' value=\" + eventclass[i].id +\">Edit</button> <button class='del' id='delete_btn' value=\" + eventclass[i].id +\">Delete</button> <button class='time' id='time_btn' value=\" + eventclass[i].id +\">View Details</button></div>\");\n name = name.concat(\"<br>\");\n //console.log(\"work\");\n //name = name + \"\\n\" + \"\\n\";\n //namearray[count] = name;\n //count ++;\n }\n\n }\n }\n if(name == \"\"){\n $(\"#days\").append(\"<li><div class='box'>\" + dayMatch + \"</div></li>\");\n } else {\n \n $(\"#days\").append(\"<li><div class='box'>\" + dayMatch + \"<br>\" +name + \"</div></li>\");\n }\n }\n\t}\n const mod_buttons = document.getElementsByClassName('mod');\n const del_buttons = document.getElementsByClassName('del');\n const time_buttons = document.getElementsByClassName('time');\n for ( let j in Object.keys( mod_buttons ) ) {\n mod_buttons[j].addEventListener(\"click\", modifyEvents, false);\n }\n for ( let k in Object.keys( del_buttons ) ) {\n del_buttons[k].addEventListener(\"click\", deleteEvents, false);\n }\n for ( let m in Object.keys( time_buttons ) ) {\n time_buttons[m].addEventListener(\"click\", viewtime, false);\n }\n \n}", "function makeDayArray() {\n this.length=7;\n this[1] = \"Sun.\"; this[2] = \"Mon.\"; this[3] = \"Tues.\";\n this[4] = \"Wed.\"; this[5] = \"Thurs.\"; this[6] = \"Fri.\";\n this[7] = \"Sat.\";\n return this;\n}", "function buildDay () {\n\n}", "function populate() {\n for (let i = 0; i < 42; i++) {\n calendarCells[i].textContent = dateArray[i];\n }\n }", "function buildDayArray(days) {\n var daysToGoal = _getDaysToGoal(config.startDate, config.goalDate);\n var date = moment(new Date(config.startDate));\n var dayNumber = 0;\n\n\n console.log(\"CONFIG IN BUILD DAY ARRAY\");\n console.log(config);\n for (var i = 0; i <= daysToGoal; i++) {\n\n var currentDay = new Day();\n\n //set our known values for the array\n currentDay.date = _addDay(date);\n currentDay.dayNumber = dayNumber;\n currentDay.dailyCalories = config.dailyCalories;\n currentDay.activityLevel = config.activityLevel;\n currentDay.height = config.height;\n currentDay.gender = config.gender;\n currentDay.age = config.age;\n\n //check for cheat days, modify the day we built if they exist\n currentDay = _checkCheatDay(currentDay, config.cheatDays);\n\n days.push(currentDay);\n\n dayNumber++;\n date = currentDay.date;\n }\n\n return days;\n }", "function getCalenderBody(){\n const dates = [];\n const lastDate = new Date(year, month + 1, 0).getDate(); //5月の最後の日にち\n for(let i = 1; i <= lastDate; i++){\n dates.push(\n {\n date: i,\n isToday: false,\n isDisable: false\n }\n );\n }\n\n if(year === dat.getFullYear() && month ===dat.getMonth()){\n dates[dat.getDate() - 1].isToday = true;\n } \n return dates;\n }", "function buildSeasonsArray()\n{\n var startDateString;\n var finishDateString;\n\n SEASONS_ARRAY = new Array(N_SEASONS);\n for (var i = 0; i < N_SEASONS; ++i)\n {\n SEASONS_ARRAY[i] = new Array(3); // Contents: 'seasonName',\n // 'startDateArray', 'finishDateArray'.\n\n startDateString = getNextWordFromCodedData();\n SEASONS_ARRAY[i]['startDateArray' ] = convMySQLdateStringToIntArray(startDateString);\n\n eatWhiteSpaceFromCodedData();\n\n finishDateString = getNextWordFromCodedData();\n SEASONS_ARRAY[i]['finishDateArray'] = convMySQLdateStringToIntArray(finishDateString);\n\n eatWhiteSpaceFromCodedData();\n\n SEASONS_ARRAY[i]['seasonName' ] = String(getRemainingLineFromCodedData());\n }\n}", "_getDays(c) {\n let sched = {\n m: [],\n t: [],\n w: [],\n r: [],\n f: [],\n };\n c.schedule.forEach(s => {\n switch(s.days) {\n case \"M\":\n sched.m.push(this._format(c.crn, s.startTime, s.endTime));\n break;\n case \"T\":\n sched.t.push(this._format(c.crn, s.startTime, s.endTime));\n break;\n case \"W\":\n sched.w.push(this._format(c.crn, s.startTime, s.endTime));\n break;\n case \"R\":\n sched.r.push(this._format(c.crn, s.startTime, s.endTime));\n break;\n case \"F\":\n sched.f.push(this._format(c.crn, s.startTime, s.endTime));\n break;\n case \"MWF\":\n [sched.m, sched.w, sched.f].map(d => d.push(this._format(c.crn, s.startTime, s.endTime)));\n break;\n case \"TR\":\n [sched.t, sched.r].map(d => d.push(this._format(c.crn, s.startTime, s.endTime)));\n break;\n case \"MW\":\n [sched.m, sched.w].map(d => d.push(this._format(c.crn, s.startTime, s.endTime)));\n break;\n default:\n }\n })\n return sched;\n }", "function createDemoEvents() {\n // Date for the calendar events (dummy data)\n var date = new Date();\n var d = date.getDate(),\n m = date.getMonth(),\n y = date.getFullYear();\n\n return [\n {\n title: 'All Day Event',\n start: new Date(y, m, 1),\n backgroundColor: '#f56954', //red\n borderColor: '#f56954' //red\n },\n {\n title: 'Long Event',\n start: new Date(y, m, d - 5),\n end: new Date(y, m, d - 2),\n backgroundColor: '#f39c12', //yellow\n borderColor: '#f39c12' //yellow\n },\n {\n title: 'Meeting',\n start: new Date(y, m, d, 10, 30),\n allDay: false,\n backgroundColor: '#0073b7', //Blue\n borderColor: '#0073b7' //Blue\n },\n {\n title: 'Lunch',\n start: new Date(y, m, d, 12, 0),\n end: new Date(y, m, d, 14, 0),\n allDay: false,\n backgroundColor: '#00c0ef', //Info (aqua)\n borderColor: '#00c0ef' //Info (aqua)\n },\n {\n title: 'Birthday Party',\n start: new Date(y, m, d + 1, 19, 0),\n end: new Date(y, m, d + 1, 22, 30),\n allDay: false,\n backgroundColor: '#00a65a', //Success (green)\n borderColor: '#00a65a' //Success (green)\n },\n {\n title: 'Open Google',\n start: new Date(y, m, 28),\n end: new Date(y, m, 29),\n url: '//google.com/',\n backgroundColor: '#3c8dbc', //Primary (light-blue)\n borderColor: '#3c8dbc' //Primary (light-blue)\n }\n ];\n }", "function calendar(year) {\n console.log(\"creating calendar\")\n for (var monthCount = 0; monthCount < 13; monthCount++) {\n var newList = $(\"<ul>\");\n newList.addClass(\"main\");\n for (var dayCount = 0; dayCount < 32; dayCount++) {\n\n if (dayCount===0 && monthCount===0) {\n var newListItem = $(\"<li>\")\n newListItem.addClass(\"cEmpty\")\n // newListItem.addClass(\"cLabel\");\n newList.append(newListItem)\n }\n else if (monthCount ===0)\n {\n var newListItem = $(\"<li>\");\n newListItem.addClass(\"cEmpty\");\n var labelDiv = $(\"<div>\")\n labelDiv.addClass(\"cLabel\");\n labelDiv.text(dayCount);\n newListItem.append(labelDiv);\n newList.append(newListItem);\n\n } else if (dayCount ===0) {\n var monthName = moment(monthCount, \"M\").format(\"MMM\")\n var newListItem = $(\"<li>\");\n newListItem.addClass(\"cEmpty\");\n var labelDiv = $(\"<div>\");\n labelDiv.addClass(\"cLabel\");\n labelDiv.text(monthName.substring(0,1));\n newListItem.append(labelDiv);\n newList.append(newListItem)\n } else {\n\n var newListItem = $(\"<li>\")\n\n var dateDiv = $(\"<div>\")\n var date = String(monthCount) + \"/\" + String(dayCount) + \"/\" + year\n var dateFormat = \"M/D/YYYY\"\n var convertedDate = moment(date, dateFormat)\n var dayOfTheWeek = convertedDate.format(\"d\") // sunday =0\n\n\n\n if (!convertedDate.isValid()) {\n newListItem.addClass(\"cEmpty\")\n } else {\n dateDiv.addClass(\"cDate\")\n dateDiv.addClass(date)\n dateDiv.text(convertedDate.format(\"MM/DD/YY\"));\n newListItem.append(dateDiv)\n\n var location = $(\"<div>\")\n location.addClass(\"cLocation\")\n location.text(\"Gary, IN\")\n newListItem.append(location)\n\n var mood = Math.floor(Math.random() * (9 - 1)) + 1\n newListItem.addClass(\"type-\" + mood)\n newListItem.addClass(\"cat-\" + dayOfTheWeek)\n }\n\n\n\n newList.append(newListItem)\n }\n }\n $(\".wrapper\").append(newList)\n }\n }", "function makeDateObjects(data){\r\n\t\tconsole.log(\"makeDateObjects\");\r\n\t\tfor (i = 0; i < data.length; i++){\r\n\t\t\tvar datestring = data[i][selectedOptions.dateField];\r\n\t\t\tvar thisYear = parseInt(datestring.substring(0,4));\r\n\t\t\tvar thisMonth = parseInt(datestring.substring(5,7));\r\n\t\t\tvar thisDay = parseInt(datestring.substring(8,10));\r\n\t\t\tvar thisDateComplete = new Date(thisYear, thisMonth-1, thisDay); // JS-Date Month begins at 0\r\n\t\t\tzaehlstellen_data[i][selectedOptions.dateField] = thisDateComplete;\r\n\t\t}\r\n\t}", "function createCalendar () {\n\tshowDays(); // works when days were previously hidden\n\tfindDaysInMonth(); // find how many days are in a current month\n\tfindWeeksInMonth(); // find how many weeks are in the current month\n\tvar firstDayOfMonthName = findFirstDayOfMonthName(); // find day of week of the first day of a month \n\tcreateWeeks(numberOfWeeks); // creating and displaying weeks depending on how many weeks are in a month (\"numberOfWeeks\")\n\taddDayNumbersAndCurrentId(numberOfWeeks, firstDayOfMonthName, daysInMonth); // adding a number of a day in a calendar elements; adding id to a current day\n\thideEmptyDays(); // hiding days elements of a calendar which don't contain a number of a day; adding a pointer to the one that are visible\n\tchangeWeeksDisplay(\"none\"); // hide all weeks (= view: week) \n\tdocument.getElementById(weekToDisplay).style.display = \"flex\"; // display a current week\n\taddDayClickEvent(); // add \"click\" event to new calendar days elements\n\taddWeekClickEvent(); // add \"click\" event to new calendar weeks elements\n}", "function buildEvents(calendar) {\n var start = startDate(calendar);\n var end = endDate(calendar);\n\n clearEvents(calendar);\n\n // Extract current filters from table\n var table_options = $(table).bootstrapTable('getOptions');\n var filters = table_options.query_params || {};\n\n filters.min_date = start;\n filters.max_date = end;\n filters.part_detail = true;\n\n // Request build orders from the server within specified date range\n inventreeGet(\n '{% url \"api-build-list\" %}',\n filters,\n {\n success: function(response) {\n\n for (var idx = 0; idx < response.length; idx++) {\n\n var order = response[idx];\n\n var date = order.creation_date;\n\n if (order.completion_date) {\n date = order.completion_date;\n } else if (order.target_date) {\n date = order.target_date;\n }\n\n var title = `${order.reference}`;\n\n var color = '#4c68f5';\n\n if (order.completed) {\n color = '#25c234';\n } else if (order.overdue) {\n color = '#c22525';\n }\n\n var event = {\n title: title,\n start: date,\n end: date,\n url: `/build/${order.pk}/`,\n backgroundColor: color,\n };\n\n calendar.addEvent(event);\n }\n }\n }\n );\n }", "function generateDate(today) {\n for (i = 0; i < datelen; i++) {\n var newday = new Date(today.getFullYear(), today.getMonth(), today.getDate()+i);\n dateArray.push(newday);\n }\n return dateArray\n }", "function creatMonthsArray(month, daysCount) {\n console.log(daysCount);\n debugger;\n var month2 = new Object({\n Week1: { days: new Array(7).fill(0), tatal: 0 },\n Week2: { days: new Array(7).fill(0), tatal: 0 },\n Week3: { days: new Array(7).fill(0), tatal: 0 },\n });\n if (daysCount === 31) {\n month2.Week4 = { days: new Array(10).fill(0), tatal: 0 };\n } else if (daysCount === 30) {\n month2.Week4 = { days: new Array(9).fill(0), tatal: 0 };\n } else if (daysCount === 29) {\n month2.Week4 = { days: new Array(8).fill(0), tatal: 0 };\n } else if (daysCount === 28) {\n month2.Week4 = { days: new Array(7).fill(0), tatal: 0 };\n }\n\n switch (month) {\n case 1:\n console.log(jan, 'month');\n jan = month2;\n break;\n case 2:\n Feb = month2;\n break;\n case 3:\n Mar = month2;\n break;\n case 4:\n aprile = month2;\n break;\n case 5:\n may = month2;\n break;\n case 6:\n jun = month2;\n break;\n case 7:\n jul = month2;\n break;\n case 8:\n ogst = month2;\n break;\n case 9:\n sept = month2;\n break;\n case 10:\n oct = month2;\n break;\n case 11:\n nov = month2;\n break;\n case 12:\n dec = month2;\n break;\n }\n}" ]
[ "0.71836436", "0.7157168", "0.69721913", "0.67158526", "0.6659444", "0.6658404", "0.6619664", "0.65990007", "0.6590704", "0.6581579", "0.6548451", "0.6483488", "0.6477152", "0.6459985", "0.64313257", "0.6424336", "0.6384324", "0.63710535", "0.6348234", "0.6305048", "0.624175", "0.6177929", "0.61765516", "0.6156055", "0.61342067", "0.6079149", "0.60789293", "0.60495967", "0.604608", "0.60231656" ]
0.7292485
0
Keep track of the active TextEditor, because when single clicking a file from the treeview, atom.workspace.getEditor() returns undefined
subscribeToFileOpen() { return atom.workspace.onDidOpen(event => { this.activeEditor = event.item; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _onEditorChanged() {\n\t\t_close();\n\t\tcurrentEditor = EditorManager.getCurrentFullEditor();\n\n\t\tcurrentEditor.$textNode = $(currentEditor.getRootElement()).find(\".CodeMirror-lines\");\n\t\tcurrentEditor.$textNode = $(currentEditor.$textNode.children()[0].children[3]);\n\t\tcurrentEditor.$numbersNode = $(currentEditor.getRootElement()).find(\".CodeMirror-gutter-text\");\n\n\t\t\n\t}", "function activeEditor() {\n let editor = atom.workspace.getActiveTextEditor();\n const editorView = atom.views.getView(editor);\n const className = \"vim-mode-plus-search-input-focused\";\n if (editorView.classList.contains(className)) {\n const allEditors = atom.textEditors.editorsWithMaintainedConfig;\n allEditors.forEach(e => {\n if (e.mini) {\n editor = e;\n return false;\n }\n });\n }\n return editor;\n}", "getFocusedEditor() {\n if (this.general && this.general.isFocused())\n return Promise.resolve(this.general.getModel());\n if (this.connection.isAvailable()) {\n return this.connection.access().then(editor => {\n if (editor.isFocused())\n return editor.getModel();\n else\n return this.main;\n });\n }\n else {\n return Promise.resolve(this.main);\n }\n }", "reload() {\n this.editor = atom.workspace.getActiveTextEditor();\n }", "get editor() {\n return this._editor;\n }", "get editor() {\n return this._editor;\n }", "function getCurrentEditorInstance() {\n let editor;\n const current_tool_mode =\n ss.getFromObject('editor_scratch', 'current_tool_mode');\n if (current_tool_mode === 'mesh_edit_mode') {\n return mesh_editor;\n }\n else if (current_tool_mode === 'curve_mode') {\n return mesh_editor.getCurvedDeformerLine();\n }\n else {\n throw Error('Unknown tool mode: ' + current_tool_mode);\n }\n }", "function getCurrentFullEditor() {\n // This *should* always be equivalent to DocumentManager.getCurrentDocument()._masterEditor\n return _currentEditor;\n }", "get WindowsEditor() {}", "makeActive() {\n const { activeFile, editor, switchFile } = editorManager;\n if (activeFile?.id === this.id) return;\n\n activeFile?.removeActive();\n switchFile(this.id);\n\n if (this.focused) {\n editor.focus();\n } else {\n editor.blur();\n }\n\n this.#upadteSaveIcon();\n this.#tab.classList.add('active');\n this.#tab.scrollIntoView();\n if (!this.loaded && !this.loading) {\n this.#loadText();\n }\n\n editorManager.header.subText = this.#getTitle();\n\n this.#emit('focus', createFileEvent(this));\n }", "function handleTextEditorChange(event) {\n if(isStorytellerCurrentlyActive) {\n //path to the file that is being edited\n const filePath = event.document.fileName;\n\n //if the file being edited is in the tracked st project\n if(filePath.startsWith(vscode.workspace.workspaceFolders[0].uri.fsPath) === true) {\n //go through each of the changes in this change event (there can \n //be more than one if there are multiple cursors)\n for(let i = 0;i < event.contentChanges.length;i++) {\n //get the change object\n const change = event.contentChanges[i];\n \n //if no text has been added, then this is a delete\n if(change.text.length === 0) {\n //get some data about the delete\n const numCharactersDeleted = change.rangeLength;\n const deleteTextStartLine = change.range.start.line;\n const deleteTextStartColumn = change.range.start.character;\n \n //record the deletion of text\n projectManager.handleDeletedText(filePath, deleteTextStartLine, deleteTextStartColumn, numCharactersDeleted);\n } else { //new text has been added in this change, this is an insert\n //if there was some text that was selected and replaced \n //(deleted and then added)\n if(change.rangeLength > 0) {\n //get some data about the delete\n const numCharactersDeleted = change.rangeLength;\n const deleteTextStartLine = change.range.start.line;\n const deleteTextStartColumn = change.range.start.character;\n\n //first delete the selected code (insert of new text to follow)\n projectManager.handleDeletedText(filePath, deleteTextStartLine, deleteTextStartColumn, numCharactersDeleted);\n } \n \n //get some data about the insert\n const newText = change.text;\n const newTextStartLine = change.range.start.line;\n const newTextStartColumn = change.range.start.character;\n \n //a set of all the event ids from a copy/cut\n let pastedInsertEventIds = [];\n\n //if this was a paste\n if(clipboardData.activePaste) { \n //if the new text is exactly the same as what was on our clipboard\n if(newText === clipboardData.text) {\n //store the pasted event ids\n pastedInsertEventIds = clipboardData.eventIds;\n } else { //this is a paste but it doesn't match the last storyteller copy/cut (pasted from another source)\n //create an array of strings with 'other' for the paste event ids to signify a paste from outside the editor\n pastedInsertEventIds = newText.split('').map(() => 'other');\n\n //clear out any old data\n clipboardData.text = '';\n clipboardData.eventIds = [];\n }\n\n //we handled the most current paste, set this back to false\n clipboardData.activePaste = false;\n }\n //record the insertion of new text\n projectManager.handleInsertedText(filePath, newText, newTextStartLine, newTextStartColumn, pastedInsertEventIds);\n }\n }\n }\n }\n}", "function updateEditor() {\n\t\ttextToEditor();\n\t\tpositionEditorCaret();\n\t}", "edit() {\n const { alert } = Nullthrows(this.props.dialogService);\n const { terminal } = Nullthrows(this.props.directoryService);\n const { unescape } = Nullthrows(this.props.uriService);\n\n const editor = this.env.EDITOR;\n\n if (!editor) {\n alert(`You have to define EDITOR environment variable.`);\n return;\n }\n\n const file = this.getCursor();\n const match = /^file:\\/\\/(.+)/.exec(file.uri);\n\n if (!match) {\n alert(`${file.uri} is not local.`);\n return;\n }\n\n terminal([\"-e\", editor, unescape(match[1])]);\n }", "function TextEditor(editor) {\n\tthis.editor = editor;\n\tthis.aceEditor = null;\n\tthis.state = 0;\n\tthis.xmlEditorDiv = null;\n\tthis.xmlContent = null;\n\tthis.selectedTagRange = null;\n\tthis.resetSelectedTagRange();\n\tthis.active = false;\n\tthis.tagRegex = /<(([a-zA-Z0-9\\-]+:)?([a-zA-Z0-9\\-]+))( |\\/|>|$)/;\n}", "function TextEditor() {}", "get OSXEditor() {}", "function checkActiveEditor() {\n const editor = vscode.window.activeTextEditor;\n if (!editor) {\n vscode.window.showInformationMessage('Cannot generate unit tests. No editor selected.');\n return;\n }\n if (!editor.document.fileName.endsWith('.go')) {\n vscode.window.showInformationMessage('Cannot generate unit tests. File in the editor is not a Go file.');\n return;\n }\n if (editor.document.isDirty) {\n vscode.window.showInformationMessage('File has unsaved changes. Save and try again.');\n return;\n }\n return editor;\n}", "_editorChange(e,deselect=!1){let root=this,editorChange=root.editor!==e.detail.editor,toolbarChange=root.toolbar!==e.detail.toolbar;if(deselect||editorChange||toolbarChange){let sel=window.getSelection();sel.removeAllRanges();root.editor=e.detail.editor;root.toolbar=e.detail.toolbar;if(root.observer)root.observer.disconnect();if(!deselect&&e.detail.editor){root.observer=new MutationObserver(evt=>{root.range=root.getRange()});root.observer.observe(e.detail.editor,{attributes:!1,childList:!0,subtree:!0,characterData:!1})}}}", "showEditor(path, selection) {\n if (!path) path = store.file?.path\n // TODO: selection!!!!\n try {\n navigate(new SpellLocation(path).editorUrl)\n store.compileApp()\n } catch (e) {\n store.showError(`Path '${path}' is invalid!`)\n }\n }", "get editorTextField() {\n return this.i.js;\n }", "switchToTextualEditor({openTabsCode = [], closeCurrentTabs = false}) {\n // Turn off simulator\n if (DwenguinoBlockly.simulatorState !== \"off\") {\n DwenguinoBlockly.toggleSimulator();\n $(\"#db_menu_item_simulator\").css(\"pointer-events\", \"none\");\n }\n DwenguinoBlockly.currentProgrammingContext = \"text\";\n document.getElementById(\"blocklyDiv\").style.visibility = \"hidden\";\n document.getElementById(\"db_code_pane\").style.visibility = \"visible\";\n if (closeCurrentTabs) {\n DwenguinoBlockly.textualEditor.getEditorPane().closeTabs(false);\n }\n DwenguinoBlockly.setOpenTextualEditorTabs(openTabsCode);\n DwenguinoBlockly.saveState();\n }", "clearActiveEditor() {\n this.activeEditor = void 0;\n }", "formatActiveTextEditor() {\n if ((editor = atom.workspace.getActiveTextEditor())) {\n if (editorHelper.hasElixirGrammar(editor)) {\n this.formatTextEditor(editor, editorHelper.getSelectedRange(editor));\n } else {\n atom.notifications.addInfo(\n \"Elixir Formatter only formats Elixir source code\",\n { dismissable: false }\n );\n }\n }\n }", "function selectedText(editor) {\n restoreRange(editor);\n return getSelection(editor).toString();\n }", "getProgramFromEditor() {\n return this.editorArea.getDoc().getValue()\n }", "function getSelection(editor) {\n //if (ie) return editor.doc.selection;\n return editor.$frame[0].contentWindow.getSelection();\n }", "getEditorContent() {\n if (this.settingsEngine.has('editor.content')) {\n return this.settingsEngine.get('editor.content');\n }\n\n return this.editorDefaultContent;\n }", "function onLoad(){\n\t$(\"#project_panel\").height($(window).height()*0.97);\n\tvar myTextArea = document.getElementById('myText');\n\tmyCodeMirror = CodeMirror.fromTextArea(myTextArea,{\n\t\tlineNumbers: true,\n\t mode: \"javascript\"\n\t});\n\tmyCodeMirror.setSize($(window).width() - myCodeMirror.left, $(window).height()*0.97);\n\t$(\"#context_menu\").hide();\n\t$(\"#intel_box\").hide();\n\t$(\"#new_file\").click(function(){\n\t\tvar path = full_path(selected_element);\n\t\tconsole.log(\"creating a new file in \" + path);\n\t\tnew_file(path);\n\t});\n\t$(\"#new_folder\").click(function(){\n\t\tvar path = full_path(selected_element);\n\t\tconsole.log(\"creating a new folder in \" + path);\n\t\tnew_folder(path);\n\t});\n\t$(\"#rename\").click(function(){rename();});\n\t$(\"#delete\").click(function(){remove();});\n\t$(\"#input_box\").hide();\n\t$(\"#input_box\").css({\n\t\tleft:$(window).width()/2 - $(\"#input_box\").width()/2,\n\t\ttop:$(window).height()/2 + $(\"#input_box\").height()/2\n\t});\n\t$(\"#new_proj\").click(function(){\n\t\tnew_project();\n\t});\n\t$(\"#edit_proj\").click(function(){ \n\t\t//working on it\n\t});\n\t$(\"#run_proj\").click(function(){\n\t\trun_mode();\n\t});\n\t\n\tmyCodeMirror.setOption(\"extraKeys\", {\"Up\":function(){\n\t\tif(intel_active) // logic to decide whether to move up or not\n\t\t{\n\t\t\tmove_selection(-1);\n\t\t\treturn CodeMirror.PASS;//prevent default action\n\t\t}\n\t\telse myCodeMirror.execCommand(\"goLineUp\");\n\t},\n\t\"Down\":function(){\n\t\tif(intel_active) // logic to decide whether to move up or not\n\t\t{\n\t\t\tmove_selection(1);\n\t\t\treturn CodeMirror.PASS;//prevent default action\n\t\t}\n\t\telse myCodeMirror.execCommand(\"goLineDown\");\n\t},\n\t\"Enter\":function(){\n\t\tif(intel_active) // logic to decide whether to move up or not\n\t\t{\n\t\t\treturn CodeMirror.PASS;//prevent default action\n\t\t}\n\t\telse myCodeMirror.execCommand(\"newlineAndIndent\");\n\t}});\n}", "editorTextChange(e) {\n this.props.editorTextChange( document.getElementById('editor').value );\n }", "get LinuxEditor() {}" ]
[ "0.6879253", "0.66936564", "0.6544721", "0.6524527", "0.6499231", "0.6499231", "0.64954007", "0.64462477", "0.6404208", "0.63776016", "0.62949413", "0.627102", "0.6243174", "0.618155", "0.61683685", "0.61574864", "0.61540544", "0.61104655", "0.60639465", "0.60564834", "0.60511154", "0.6046187", "0.60332465", "0.60233563", "0.6014656", "0.5976138", "0.5963169", "0.5945844", "0.58819705", "0.58772826" ]
0.7107289
0
! ignore /! Returns this documents _id cast to a string.
function r(){return null!=this._id?String(this._id):null}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function o(){return null!=this._id?String(this._id):null}", "toString() {\r\n\t\t\treturn 's' + this.idNum;\r\n\t\t}", "function n(){return null!=this._id?String(this._id):null}", "function n(){return null!=this._id?String(this._id):null}", "toString() {\n return this.id();\n }", "getId() {\n const parent = this.getParent();\n return parent ? `${parent.getId()}/${this.getInternalId()}` : this.getInternalId();\n }", "function idGetter() {\n if (this._id != null) {\n return String(this._id);\n }\n\n return null;\n}", "function idGetter() {\n if (this._id != null) {\n return String(this._id);\n }\n\n return null;\n}", "function idGetter() {\n if (this._id != null) {\n return String(this._id);\n }\n\n return null;\n}", "function idGetter() {\n if (this._id != null) {\n return String(this._id);\n }\n\n return null;\n}", "function idGetter() {\n if (this._id != null) {\n return String(this._id);\n }\n\n return null;\n}", "idString() {\n return ( Date.now().toString( 36 ) + Math.random().toString( 36 ).substr( 2, 5 ) ).toUpperCase();\n }", "getID() {\n return this._data.id ? this._data.id.trim() : null;\n }", "toString() {\r\n return this.id ? `<@${this.id}>` : null;\r\n }", "id() {\n const model = internal(this).model;\n return internal(model).entities.id(this);\n }", "get identifier() {\n if (this._uid) {\n return this._uid;\n } else {\n return this._id;\n }\n }", "function ObjectId() {\n var timestamp = (new Date().getTime() / 1000 | 0).toString(16);\n return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function () {\n return (Math.random() * 16 | 0).toString(16);\n }).toLowerCase();\n}", "toHexString() {\n if (ObjectId.cacheHexString && this.__id) {\n return this.__id;\n }\n const hexString = this.id.toString('hex');\n if (ObjectId.cacheHexString && !this.__id) {\n this.__id = hexString;\n }\n return hexString;\n }", "getNodeIDString() {\n return helperfunctions_1.bufferToNodeIDString(this.nodeID);\n }", "get id() {\n if (!this._id) {\n this._id = Util.GUID();\n }\n return this._id;\n }", "function objectIdToString(entity) {\n if (!entity) return entity\n entity[idProperty] = entity[idProperty].toString()\n return entity\n }", "createId() {\n return this.firestore.collection('_').doc().id;\n }", "function Entity$toIdString(obj) {\n return obj.meta.type.fullName + \"|\" + obj.meta.id;\n}", "getIdentifier() { return this.docIdentifier; }", "get id() {\n return this.getStringAttribute('id');\n }", "get id() {\n return this.getStringAttribute('id');\n }", "get id() {\n return this.getStringAttribute('id');\n }", "get id() {\n return this.getStringAttribute('id');\n }", "get id() {\n return this.getStringAttribute('id');\n }", "get id() {\n return this.getStringAttribute('id');\n }" ]
[ "0.7108244", "0.7106047", "0.7063738", "0.7063738", "0.6905292", "0.6743027", "0.6708931", "0.6708931", "0.6708931", "0.6708931", "0.6708931", "0.6595603", "0.6582902", "0.6465702", "0.6418251", "0.6397523", "0.6375707", "0.62922573", "0.62424135", "0.6236174", "0.62212014", "0.61810976", "0.6180219", "0.6141816", "0.60534024", "0.60534024", "0.60534024", "0.60534024", "0.60534024", "0.60534024" ]
0.74571913
0
The load process: Get the value Validate with the schema If upgrade is required, upgrade it
load(dataKey) { return __awaiter(this, void 0, void 0, function* () { const key = `${this.schema}/${dataKey}`; let value = yield this.loadItem(key); if (!value) { return undefined; } const schemaVer = SchemaUtils_1.SchemaUtils.ver(value.version).major; const latestVer = this.schemaRegistry.getLastVersion(this.schema); if (latestVer > schemaVer) { // data upgrade is needed const newValue = yield this.upgradeData(value, schemaVer, latestVer); yield this.saveItem(`${key}.${schemaVer}.bak`, newValue); yield this.saveItem(key, value); // Save back the upgraded value } return value; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get loadType() {}", "set loadType(value) {}", "function validateYupSchema(values,schema,sync,context){if(sync===void 0){sync=false;}if(context===void 0){context={};}var validateData=prepareDataForValidation(values);return schema[sync?'validateSync':'validate'](validateData,{abortEarly:false,context:context});}", "function getValidation(){\n\t\t\t\t\t\t\n\t\t\t\t\t}", "function loadValues() {\n\thiscore = parseInt(storage.hiscore2) || 0;\n\tlongest = parseInt(storage.longest2) || 1;\n\tspeed = parseInt(storage.speed2) || DEFAULT_SPEED;\n}", "_updateInternalSchemas () {\n this.get('getSchemaTask').perform()\n .then(({model, view, plugins, validators, propagateValidation}) => {\n this.setProperties({\n propagateValidation,\n validationResult: {}\n })\n\n if (model && !_.isEqual(this.get('internalBunsenModel'), model)) {\n this.set('internalBunsenModel', model)\n }\n\n if (view && !_.isEqual(this.get('internalBunsenView'), view)) {\n this.set('internalBunsenView', view)\n }\n\n this.setProperties({\n internalValidators: validators,\n internalPlugins: plugins\n })\n })\n .catch((err) => {\n this.set('localError', err.message)\n })\n }", "@action\n async validate() {\n if (this.args.parent === undefined) {\n if (this.args.alone) return; // if input is alone ignore\n }\n\n let value = this.args.value || this.args.selected;\n const res = await this.parent.state.validationSchema.validationFor(this.name,value,this);\n this.parent.updateState(); \n this.error = res;\n }", "_loadInfoFromDatabase() {\n // default values\n this._prefix = \"\";\n this._enabled = true;\n\n db.select(\"Plugins\", [\"prefix\", \"disabled\"], {\n id: this.id\n }).then((rows) => {\n if (rows.length > 0) {\n this._prefix = rows[0].prefix;\n this._enabled = (rows[0].disabled === 0);\n } else {\n return db.insert(\"Plugins\", {\n id: this.id,\n prefix: \"\",\n disabled: 0\n });\n }\n }).catch(Logger.err);\n }", "function handleLoadSync() {\n\t\t\t\t\tlogWithPhase( \"handleLoad - Sync\" );\n\t\t\t\t\t$scope.$eval( attributes.bnLoad );\n\t\t\t\t}", "getSchema(keyRef) {\n let sch;\n while (typeof (sch = getSchEnv.call(this, keyRef)) == \"string\")\n keyRef = sch;\n if (sch === undefined) {\n const { schemaId } = this.opts;\n const root = new compile_1.SchemaEnv({ schema: {}, schemaId });\n sch = compile_1.resolveSchema.call(this, root, keyRef);\n if (!sch)\n return;\n this.refs[keyRef] = sch;\n }\n return (sch.validate || this._compileSchemaEnv(sch));\n }", "getLoadData() {\n const { loadData, upperSearchValue } = this.$props;\n if (upperSearchValue) return null;\n return loadData;\n }", "loadResource() {\n // Load Selects\n this.loadStorageTierSelect(this.storage_tier)\n this.loadPublicAccessTypeSelect(this.public_access_type)\n this.loadAutoTieringSelect(this.auto_tiering)\n this.loadVersioningSelect(this.versioning)\n this.loadSelect(this.kms_key_id, 'key', true, () => true, 'Oracle-managed keys')\n // Assign Values\n this.storage_tier.property('value', this.resource.storage_tier)\n this.public_access_type.property('value', this.resource.public_access_type)\n this.auto_tiering.property('value', this.resource.auto_tiering)\n this.versioning.property('value', this.resource.versioning)\n this.object_events_enabled.property('checked', this.resource.object_events_enabled)\n this.kms_key_id.property('value', this.resource.kms_key_id)\n // Pricing Estimates\n this.estimated_monthly_capacity_gbs.property('value', this.resource.estimated_monthly_capacity_gbs)\n this.estimated_monthly_requests.property('value', this.resource.estimated_monthly_requests)\n }", "fromValidation(aValidation) {\n return require('folktale/data/conversions/validation-to-result')(aValidation);\n }", "'validateValue'(value) {}", "getVersionField(telegram) {\n let values = telegram.getValues();\n\n return values.has('BLOCK1_VERSION') ?\n values.get('BLOCK1_VERSION') : null;\n }", "_getValue_unavailable() {}", "readData( key, fallback ) {\n\t\tlet value = BdApi.loadData( this.getShortName(), key );\n\t\treturn typeof value !== 'undefined' ? value : fallback;\n\t}", "async validate () {\n\t\t// create a model from the attributes and let it do its own pre-save, this is where\n\t\t// validation happens ... note that since we're doing an update, we might not have\n\t\t// (and actually probably don't) have a complete model here\n\t\tthis.tempModel = new this.collection.modelClass(this.attributes, { dontSetDefaults: true });\n\t\ttry {\n\t\t\tawait this.tempModel.preSave();\n\t\t}\n\t\tcatch (error) {\n\t\t\tthrow this.request.errorHandler.error('validation', { info: error });\n\t\t}\n\t\tif (this.tempModel.validationWarnings instanceof Array) {\n\t\t\tthis.request.warn(`Validation warnings: \\n${this.tempModel.validationWarnings.join('\\n')}`);\n\t\t}\n\t\tObject.assign(this.attributes, this.tempModel.attributes);\n\t}", "async function load(req, res, next) {\n req.attribute = await Attribute.get(req.params.attributeId);\n return next();\n}", "getCurrentVersion() {\n let request = this._get('/classes/' + this.migrationVersionTable);\n return new Promise(function(resolve, reject) {\n request.query({ order: '-updatedAt' })\n .query({ limit: 1 })\n .end(function(err, res){\n if (res.ok) {\n let results = res['body'].results;\n // check if a version is available -> else set version to undefined\n let version = results.length > 0 ? results[0] : undefined;\n resolve(version);\n } else {\n reject(new Error('API Request failed: ' + res.body.error));\n }\n });\n });\n }", "_validateFieldCreation(name, value, schemaField) {\n\n\n if (!schemaField) schemaField = this._schema.fields[name];\n\n if (!schemaField || typeof schemaField !== \"object\")\n throw Error(\"Schema was not found\");\n\n //validate its type\n if (!schemaField.type || !defaultValuesExist[schemaField.type])\n throw Error(\"Type is invalid\");\n }", "loadValueProposition() {\n $(jqId(VALUE_PROPOSITION_PANEL)).load(\"valueproposition/network_load_balancer.html\");\n }", "async createOrUpdate(storage) {\n const v = await storage.userVersion();\n\n if (v === this.version) {\n return v;\n }\n\n if (v === 0) {\n return this.create(storage);\n }\n\n if (v < this.version) {\n return this.update(storage, v);\n }\n\n throw new Error(`Target version ${this.version} lower than DB version ${v}!`);\n }", "async function validateVehicle(vehicle, isUpdate = false, id = null) {\n const validation = await vehicleTypeModel\n .findById(vehicle.vehicle_type)\n .exec()\n .then(async (type) => {\n console.log(type);\n //checking for valid vehicle-type\n if (!type) {\n return { error: \"Invalid vehicle type selected\", value: {} };\n }\n\n let query = vehicleModel\n .where(\"license_plate\")\n .equals(vehicle.license_plate.trim().toUpperCase());\n\n //if validation for update then exclude current vehicle document while checking unique license no\n if (isUpdate) {\n query.where(\"_id\").ne(id);\n }\n\n let isVehicleAlreadyExist = await query\n .exec()\n .then((vehicles) => {\n if (vehicles.length >= 1)\n //return error if licensce no already exit else return false\n return { error: \"Licence plate no already exists\", value: {} };\n return false;\n })\n .catch((err) => {\n return { error: err, value: {} };\n });\n\n if (isVehicleAlreadyExist)\n // return the {error,value} object if vehicle already exists\n return isVehicleAlreadyExist;\n\n const schema = Joi.object().keys({\n vehicle_type: Joi.string().trim().required(),\n license_plate: Joi.string()\n .trim()\n .pattern(\n /^[A-Za-z]{2,3}[0-9]{4}$/, //regex for licence plate no\n )\n .uppercase()\n .required(),\n on_repair: Joi.bool(),\n // fuel_economy: Joi.number().min(1).required(),\n // load: Joi.number().min(1).required(),\n // capacity: Joi.number().min(1).required(),\n });\n\n return schema.validate(vehicle, { abortEarly: false });\n })\n .catch((err) => {\n return { error: err, value: {} };\n });\n return validation;\n}", "async getModelVersion () {\n\t\tconst model = await this.collection.getById(\n\t\t\tthis.id, \n\t\t\t{\n\t\t\t\tnoCache: true,\n\t\t\t\tfields: ['version'] \n\t\t\t}\n\t\t);\n\t\tif (!model) {\n\t\t\tthrow this.request.errorHandler.error('notFound');\n\t\t}\n\t\tthis.modelVersion = model.get('version') || 1;\n\t}", "validate(newValue, shouldBeDirty, forceExecution) {\n if ((!this.propertyResult.isDirty && shouldBeDirty) || this.latestValue !== newValue || forceExecution) {\n this.latestValue = newValue;\n return this.config.locale().then((locale) => {\n return this.collectionOfValidationRules.validate(newValue, locale)\n .then((validationResponse) => {\n if (this.latestValue === validationResponse.latestValue) {\n this.propertyResult.setValidity(validationResponse, shouldBeDirty);\n }\n return validationResponse.isValid;\n })\n .catch((err) => {\n throw Error('Unexpected behavior: a validation-rules-collection should always fulfil');\n });\n },\n () => {\n throw Error('An exception occurred while trying to load the locale');\n });\n }\n }", "load() {\n\t\tif (this.props.onDataRequire) {\n\t\t\tthis.props.onDataRequire.call(this, this, 0, 1048576, this.props.columns);\n\t\t}\n\t}", "loadResource() {\n // Load Selects\n const pool_filter = (ip) => !this.resource.getOkitJson().getAutoscalingConfigurations().map(a => a.resource.id).includes(ip.id)\n this.loadSelect(this.instance_pool_id, 'instance_pool', true, pool_filter)\n // Assign Values\n this.instance_pool_id.property('value', this.resource.auto_scaling_resources.id)\n this.cool_down_in_seconds.property('value', this.resource.cool_down_in_seconds)\n this.policy_type.property('value', this.resource.policy_type)\n this.showHidePolicyTypeRows(this.resource.policy_type)\n if (this.resource.policy_type === 'threshold') this.loadThresholdResources()\n else this.loadScheduledResources()\n }", "validate() {}", "async fetchAndSetMetaData() {\n const response = await this.apiCall(this.metaUrl);\n this.metaData = await this.readValue(response, this.fieldPath);\n this.isLoading = false;\n\n // if(this.validate && this.metaData.regex) {\n if(this.validate) {\n this.regex = new RegExp('^[a-z]*$');\n this.shadowRoot.querySelector('slot').addEventListener('keyup', e => this._handleValueChange(e))\n }\n }" ]
[ "0.51111925", "0.50718504", "0.4980221", "0.49248552", "0.48824722", "0.4878055", "0.48144794", "0.47584155", "0.47560233", "0.47282618", "0.47135982", "0.47014138", "0.46864286", "0.4670959", "0.46695036", "0.46513745", "0.46497405", "0.46280164", "0.46182457", "0.46181858", "0.4616731", "0.46159518", "0.4606562", "0.45818767", "0.45776573", "0.45613226", "0.45442978", "0.45315385", "0.4522235", "0.45178252" ]
0.6279358
0
Sets the origin so that floorplan is centered
resetOrigin() { var centerX = this.canvasElement.innerWidth() / 2.0; var centerY = this.canvasElement.innerHeight() / 2.0; var centerFloorplan = this.floorplan.getCenter(); this.originX = Dimensioning.cmToPixel(centerFloorplan.x) - centerX; this.originY = Dimensioning.cmToPixel(centerFloorplan.z) - centerY; this.unScaledOriginX = Dimensioning.cmToPixel(centerFloorplan.x, false) - centerX; this.unScaledOriginY = Dimensioning.cmToPixel(centerFloorplan.z, false) - centerY; // this.originX = centerFloorplan.x * this.pixelsPerCm - centerX; // this.originY = centerFloorplan.z * this.pixelsPerCm - centerY; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "recenter(origin = Vector.zero) {\n this.originX = origin.x;\n this.originY = origin.y;\n }", "function moveToOrigin() {\n if (visible) {\n ctx.translate(-((width / 2) - x(viewCenter.x)), -(-y(viewCenter.y) + (height / 2)));\n }\n }", "function setOrigin(ctx, axis) {\n\tctx.translate(-1 * axis.xLeftRange + axis.blank,\n\t\t-1 * axis.yRightRange + axis.blank);\n}", "setCenter() {\n this.cx = this.x + this.width / 2;\n this.cy = this.y + this.height / 2;\n }", "setCenter() {\n this.center = createVector(this.x, this.y);\n }", "centerCam()\n {\n this.camPos.x = -this.camOffset.x;\n this.camPos.y = -this.camOffset.y;\n this.zoom = 1.5;\n }", "setStartPosition() {\n this.x = DrunkenSailor.canvas.width - 20;\n this.y = 560;\n }", "_setWorldTransformOrigin() {\n // set transformation origin relative to world space as well\n this._boundingRect.world.transformOrigin = new Vec3(\n (this.transformOrigin.x * 2 - 1) // between -1 and 1\n * this._boundingRect.world.width,\n -(this.transformOrigin.y * 2 - 1) // between -1 and 1\n * this._boundingRect.world.height,\n this.transformOrigin.z\n );\n }", "function Origin(){\n this.x = midWidth;\n this.y = midHeight;\n}", "resetCenter() {\n this.center = createVector(this.x + this.w / 2, this.y + this.h / 2);\n }", "function handleOrigin(){\n\tvar newZoom = DEFAULT_SIZE / blob.r*5; //Precalculate the new zoom.\n\tzoom = lerp(zoom, newZoom, ZOOM_ACC); //Slowly 'lerp' to the new zoom from the old zoom.\n\t\n\ttranslate(width/2, height/2); //Center the view.\n\tscale(zoom); //Scale the view.\n\ttranslate(-blob.pos.x, -blob.pos.y); //Translate view with respect to player movement.\n}", "center() {\n this.panTo(this.graphDims.width / 2, this.graphDims.height / 2);\n }", "setOrigin( origin ) {\n this.transformOrigin = this.translation( origin.x, origin.y, origin.z );\n return this;\n }", "center() {\n this.move(this.getWorkspaceCenter().neg());\n }", "function set_mapview_origin(gui_x0, gui_y0)\n{\n var xmin, xmax, ymin, ymax, xsize, ysize;\n \n /* Normalize (wrap) the mapview origin. */\n var r = normalize_gui_pos(gui_x0, gui_y0);\n gui_x0 = r['gui_x'];\n gui_y0 = r['gui_y'];\n \n /* TODO: add support for mapview scrolling here. */\n \n base_set_mapview_origin(gui_x0, gui_y0);\n \n}", "set tileOrigin(coord) {\n this.x = coord.x * 8;\n this.y = coord.y * 8;\n }", "capLatitudeInPlace() {\n const limit = 0.5 * Math.PI;\n this._radians0 = Geometry_1.Geometry.clampToStartEnd(this._radians0, -limit, limit);\n this._radians1 = Geometry_1.Geometry.clampToStartEnd(this._radians1, -limit, limit);\n }", "function base_set_mapview_origin(gui_x0, gui_y0)\n{\n /* We need to calculate the vector of movement of the mapview. So\n * we find the GUI distance vector and then use this to calculate\n * the original mapview origin relative to the current position. Thus\n * if we move one tile to the left, even if this causes GUI positions\n * to wrap the distance vector is only one tile. */\n var g = normalize_gui_pos(gui_x0, gui_y0);\n gui_x0 = g['gui_x'];\n gui_y0 = g['gui_y'];\n \n mapview['gui_x0'] = gui_x0;\n mapview['gui_y0'] = gui_y0;\n \n}", "setOrigin(origin) {\n this._positionStrategy.setOrigin(origin);\n return this;\n }", "setOrigin (event) {\n const { left, top, width, height } = options.getBoundingClientRect(event)\n const origin = {\n x: left + Math.floor(width / 2),\n y: top + Math.floor(height / 2)\n }\n this.setState({ origin })\n }", "recenter() {\n this.pan = {\n x: 0,\n y: 0\n };\n this.zoom = 1;\n }", "adjustPosition() {\n //this.geometry.applyMatrix( new THREE.Matrix4().makeTranslation( -(this.width / 2), 0, -(this.height / 2)) );\n this.geometry.translate(-(this.width / 2), 0, -(this.height / 2));\n }", "function moveToViewCenter() {\n if (visible) {\n ctx.translate((width / 2) - x(viewCenter.x), -y(viewCenter.y) + (height / 2));\n }\n }", "_updatePosFromCenter() {\n let half = this._size.$multiply(0.5);\n this._topLeft = this._center.$subtract(half);\n this._bottomRight = this._center.$add(half);\n }", "function ReSet(){\n\ttransform.position.x = ((tempLon * 20037508.34 / 180)/100)-iniRef.x;\n\ttransform.position.z = System.Math.Log(System.Math.Tan((90 + tempLat) * System.Math.PI / 360)) / (System.Math.PI / 180);\n\ttransform.position.z = ((transform.position.z * 20037508.34 / 180)/100)-iniRef.z; \n\tcam.position.x = ((tempLon * 20037508.34 / 180)/100)-iniRef.x;\n\tcam.position.z = System.Math.Log(System.Math.Tan((90 + tempLat) * System.Math.PI / 360)) / (System.Math.PI / 180);\n\tcam.position.z = ((cam.position.z * 20037508.34 / 180)/100)-iniRef.z; \n}", "function setCenter() {\r\n that.center = new Array();\r\n that.center.x = board.fromPiecePos(that.xP) + \r\n board.fromPieceDist(that.widthP) / 2;\r\n that.center.y = board.fromPiecePos(that.yP) + \r\n board.fromPieceDist(that.heightP) / 2;\r\n }", "resetPosition() {\n // 505 is width, 101 is one block, so 202 will be center\n this.x = 202;\n // 606 is height, 171 is one block, so 435 will be center, but we need to be be off a bit,\n // so it will be 435 - 45px\n this.y = 390;\n }", "setCenter() {\n let x = 0;\n let y = 0;\n for (var v of this.pixelVectorPositions) {\n x += v.x;\n y += v.y;\n }\n\n x /= this.pixelVectorPositions.length;\n y /= this.pixelVectorPositions.length;\n this.center = createVector(x, y);\n\n }", "setCenter() {\n let x = 0;\n let y = 0;\n for (let v of this.pixelVectorPositions) {\n x += v.x;\n y += v.y;\n }\n\n x /= this.pixelVectorPositions.length;\n y /= this.pixelVectorPositions.length;\n this.center = createVector(x, y);\n }", "setMiddleCanva(){\n this.setX(this.canvas.width/2);\n this.setY(this.canvas.height/2);\n this.setDx(0);\n this.setDy(0);\n }" ]
[ "0.6963244", "0.68701035", "0.67081255", "0.65162814", "0.6457855", "0.6382377", "0.6355766", "0.6334865", "0.6326623", "0.624805", "0.6244178", "0.622014", "0.6214292", "0.6188106", "0.61551195", "0.6151244", "0.6120659", "0.61107975", "0.6072131", "0.6060452", "0.6059877", "0.60446167", "0.60296094", "0.5972478", "0.59585476", "0.59454286", "0.5941359", "0.5927878", "0.5922704", "0.5906183" ]
0.81728476
0
Iterates the current array value and yields a binder node for every item.
*[Symbol.iterator]() { const array = this.valueOf(); const ItemModel = this[_ItemModel]; if (array.length !== this.itemModels.length) { this.itemModels.length = array.length; } for (const i of array.keys()) { let itemModel = this.itemModels[i]; if (!itemModel) { const [optional, ...rest] = this.itemModelArgs; itemModel = new ItemModel(this, i, optional, ...rest); this.itemModels[i] = itemModel; } yield getBinderNode(itemModel); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "*[Symbol.iterator]() {\n for (let node = this.first, position = 0; node; position++, node = node.next) {\n yield node.value;\n }\n }", "* values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value;\n\t\t}\n\t}", "*[Symbol.iterator]() {\n let values = this.values;\n for (let i = 0; i < values.length; i++)\n yield values[i];\n }", "function evaluateObjectBindingPattern({ node, environment, evaluate, statementTraversalStack }, rightHandValue) {\n for (const element of node.elements) {\n evaluate.nodeWithArgument(element, environment, rightHandValue, statementTraversalStack);\n }\n}", "function evaluateArrayBindingPattern({ node, evaluate, environment, statementTraversalStack }, rightHandValue) {\n const iterator = rightHandValue[Symbol.iterator]();\n let elementsCursor = 0;\n while (elementsCursor < node.elements.length) {\n const { done, value } = iterator.next();\n if (done === true)\n break;\n evaluate.nodeWithArgument(node.elements[elementsCursor++], environment, value, statementTraversalStack);\n }\n}", "* processBinding (key, value) {\n // Get the \"on\" binding from \"on.click\"\n const [handlerName, property] = key.split('.');\n const handler = this.bindingHandlers.get(handlerName);\n\n if (handler && handler.preprocess) {\n const bindingsAddedByHandler = [];\n const chainFn = (...args) => bindingsAddedByHandler.push(args);\n value = handler.preprocess(value, key, chainFn);\n for (const [key, value] of bindingsAddedByHandler) {\n yield * this.processBinding(key, value);\n }\n } else if (property) {\n value = `{${property}:${value}}`;\n }\n\n yield `'${handlerName}':${value}`;\n }", "* processBinding (key, value) {\n // Get the \"on\" binding from \"on.click\"\n const [handlerName, property] = key.split('.')\n const handler = this.bindingHandlers.get(handlerName)\n\n if (handler && handler.preprocess) {\n const bindingsAddedByHandler = []\n const chainFn = (...args) => bindingsAddedByHandler.push(args)\n value = handler.preprocess(value, key, chainFn)\n for (const [key, value] of bindingsAddedByHandler) {\n yield * this.processBinding(key, value)\n }\n } else if (property) {\n value = `{${property}:${value}}`\n }\n\n yield `${handlerName}:${value}`\n }", "*[Symbol.iterator]() {\n let i = 0\n while (i < this.size()) {\n yield this.get(i)\n i++\n }\n }", "traverse(){\r\n this.Array.forEach(function (sa) {\r\n \r\n console.log(sa);\r\n\r\n })\r\n}", "[Symbol.iterator]() {\n return this.items.values();\n }", "each(cb) {\n let node = this.head;\n while (node !== null) {\n cb(node.value);\n node = node.next;\n }\n }", "*[Symbol.iterator]() {\n for (let current = this.#head.next;\n current != this.#tail;\n current = current.next) {\n yield current.value;\n }\n }", "traverse(){\r\n for (let i = 0; i < this.Array.length; i++) {\r\n console.log(this.Array[i])\r\n }}", "traverse() {\n \n\n for(var i = 0; i < this.arr.length; i++) {\n console.log(this.items[i])\n }\n}", "* [Symbol.iterator] () {\n yield* this.items;\n }", "bind() {\n const parent = DesignTokenNode.findParent(this);\n\n if (parent) {\n parent.appendChild(this);\n }\n\n for (const key of this.assignedValues.keys()) {\n key.notify(this.target);\n }\n }", "[Symbol.iterator]() {\n return this.data.values();\n }", "[Symbol.iterator]() {\n return this.data.values();\n }", "each(callback, ...names) {\n const {\n stack\n } = this;\n const {\n length\n } = stack;\n let value = getLast(stack);\n\n for (const name of names) {\n value = value[name];\n stack.push(name, value);\n }\n\n for (let i = 0; i < value.length; ++i) {\n stack.push(i, value[i]);\n callback(this, i);\n stack.length -= 2;\n }\n\n stack.length = length;\n }", "*[Symbol.iterator]() {\n const length = this.length;\n for (let i = 0 ; i < length ; i++) {\n yield this.get(i);\n }\n }", "traverseBF(fn) {\n //will give us some element within our root node, inside an array\n const arr = [this.root]\n\n //while-loop, works as long as array has something in it, is TRUTHY\n while (arr.length) {\n //remove first element out of array, with shift() method\n const node = arr.shift()\n //then take all node's children and push them into our array\n // CAN'T do node.children, would create a nested array\n // use spread operator to take all elements out, and push them into the array\n arr.push(...node.children) //TODO:For-loop, would have been more code!!!\n\n //take node AND pass in to our iterator func\n fn(node)\n }\n }", "*values() {\n\n let current = this[head];\n\n while (current !== null) {\n yield current.data;\n current = current.next;\n }\n }", "function gatherBindings(node) {\n const bindings =[];\n return Array.from(node.attributes).map(attr => {\n const match = /[(\\[](\\w+)[\\])]/.exec(attr.name);\n if(match) {\n return {\n type: match[0][0] === \"[\" ? 'input' : 'output',\n name: match[1],\n value: attr.value,\n attachTo: node \n };\n }\n }).filter(n => n)\n}", "[Symbol.iterator]() {\n return this.values[Symbol.iterator]();\n }", "[Symbol.iterator]() {\n return this.values[Symbol.iterator]();\n }", "iter() {\n return iter(this.root);\n }", "*[Symbol.iterator]() {\n let node = this.head;\n while (node) {\n yield node;\n node = node.next;\n }\n }", "[Symbol.iterator]() {\n return this.#array[Symbol.iterator]();\n }", "traverse() {\n this.#array.forEach((element, i) => console.log(`Indice ${i}: ${element}`));\n }", "iterateOverList(handler, newData) {\n /** @type NodeHandlerState */\n const state = PRIVATE.get(handler);\n let isDataArray = isArray(newData);\n let iterationDataList;\n\n\n if (isDataArray) {\n isDataArray = true;\n iterationDataList = newData;\n }\n else if (isPureObject(newData)) {\n iterationDataList = objectKeys(newData);\n } else {\n return;\n }\n\n const currentBinders = handler.binders;\n const binderToBeDestroyed = new Map(); // Will be recycled\n const totalItems = iterationDataList.length;\n const { usesKey, getKey } = handler._viewTemplate[EACH];\n\n // Loop through each piece of data and build a DOM binder for it.\n // The data should be in sync with `currentBinders`\n for (let i = 0; i < totalItems; i++) {\n let rowData = { // FIXME: can this object creation be avoided? For Arrays - it should be possible. Objects - not sure.\n $root: state.data.$root || state.data,\n $parent: state.data,\n $data: state.data.$data || state.data\n };\n\n // Adjust the rowData to have the `key` and/or `value` and `index` as top level items\n // These are added to the rowData object just created above.\n if (isDataArray) {\n this.getDataForIteration([ iterationDataList[i], i ], rowData);\n }\n else {\n this.getDataForIteration([ newData[ iterationDataList[i] ], iterationDataList[i], i ], rowData);\n }\n\n const rowKey = getKey(\n usesKey\n ? rowData // => Use rowData created above - getKey() will run a value getter on it.\n : isDataArray\n ? iterationDataList[i] // => Use the object from the newData\n : newData[ iterationDataList[i] ] // => Use the Object key\n );\n\n // If a binder currently exists, then see if it is the one previously\n // created for this row's data\n if (currentBinders[i] && currentBinders[i]._loop.rowKey === rowKey) {\n currentBinders[i][DOM_DATA_BIND_PROP].setData(rowData);\n continue;\n }\n\n // If there is a binder at the current position, then its not the one need.\n // move it to the `to be destroyed` list.\n if (currentBinders[i]) {\n currentBinders[i][DOM_DATA_BIND_PROP].recover();\n binderToBeDestroyed.set(\n currentBinders[i]._loop.rowKey,\n currentBinders[i]\n );\n currentBinders[i] = null;\n }\n\n // Do we have a rowBinder for this data item in the existing list,\n // but perhaps at a different location? Get it and move it to the new position.\n // Old position in the existing array is set to null (avoids mutating array)\n let binder = handler.bindersByKey.get(rowKey);\n\n if (binder) {\n if (binder._loop.pos !== null && currentBinders[binder._loop.pos] === binder) {\n currentBinders[binder._loop.pos] = null;\n }\n } else {\n binder = binderToBeDestroyed.get(rowKey);\n\n if (binder) {\n binderToBeDestroyed.delete(rowKey);\n }\n }\n\n if (binder) {\n currentBinders[i] = binder;\n binder._loop.pos = i;\n currentBinders[i][DOM_DATA_BIND_PROP].recover();\n positionRowInDom(currentBinders, i, handler._placeholderEle);\n currentBinders[i][DOM_DATA_BIND_PROP].setData(rowData);\n continue;\n }\n\n // Create new binder\n // First check if we can recycle one that is tagged to be destroyed.\n // if not, then create a new one.\n if (binderToBeDestroyed.size) {\n const [recycleBinderKey, recycleBinder] = binderToBeDestroyed.entries().next().value;\n binder = recycleBinder;\n binder[DOM_DATA_BIND_PROP].setData(rowData);\n binderToBeDestroyed.delete(recycleBinderKey);\n binder._loop.rowKey = rowKey;\n binder._loop.pos = i;\n } else {\n binder = render(handler._viewTemplate, rowData, handler._directives);\n binder._destroy = destroyRowElement;\n binder._handler = handler; // needed by destroyRowElement()\n binder._loop = { rowKey, pos: i };\n }\n\n currentBinders[i] = binder;\n handler.bindersByKey.set(rowKey, binder);\n positionRowInDom(currentBinders, i, handler._placeholderEle);\n }\n\n // Destroy binders that were not used\n if (binderToBeDestroyed.size) {\n arrayForEach(binderToBeDestroyed.values(), destroyBinder);\n binderToBeDestroyed.clear();\n }\n\n // remove any left over items in currentBinders where is no longer part of newData\n if (totalItems < currentBinders.length) {\n arrayForEach(arraySplice(currentBinders, totalItems), destroyBinder);\n }\n }" ]
[ "0.59960055", "0.59519696", "0.5868421", "0.5701254", "0.5693932", "0.5630378", "0.5591889", "0.557498", "0.5558848", "0.55200684", "0.550839", "0.5439565", "0.5429936", "0.53422356", "0.5290209", "0.52881205", "0.52828795", "0.52828795", "0.5261787", "0.52565503", "0.5194202", "0.51831704", "0.51682174", "0.51626706", "0.51626706", "0.5157099", "0.51460826", "0.5141461", "0.5129767", "0.51204026" ]
0.7023833
0
create a function/fuctions that collects the form values appends the values to the list of Adjectives make sure that the adjective is clickable make sure the list of adjectives is updated when a word is clicked on/ removed
function myFunc(event) { event.preventDefault() let word = document.createElement("li") word.textContent = form.field1.value; words.appendChild(word) //dynamic.textContent = form.field1.value; let dynamicWords = document.querySelectorAll("li") dynamicWords.forEach( word => { word.addEventListener("click", () => { dynamic.textContent = word.textContent; words.removeChild(word); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buttonListener()\n{\n event.preventDefault(); //do not reload\n\n //get all fields\n const myAdLib = document.getElementById( \"title_input\" ).value;\n const noun = document.getElementById( \"noun\" ).value;\n const verb = document.getElementById( \"verb\" ).value;\n const adjective = document.getElementById( \"adjective\" ).value;\n\n //if the user has any field left blank\n if ( !myAdLib || !noun || !verb || !adjective )\n {\n alert( \"Please fill in all fields\" );\n return;\n }\n\n //otherwise parse fields\n const story = `Last night I ate a ${noun}, and today I just had to ${verb}. What a ${adjective} day!`;\n form.style.display = \"none\"; //hide form container\n storyP.innerText = story;\n}", "function addGoal()\n{\n const enteredGoal = inputGoalEl.value ;\n const enteredGoalDesc = inputDescEl.value ;\n\n if( enteredGoal.length > 0 )\n {\n const enteredGoalStrong = document.createElement('strong')\n enteredGoalStrong.textContent = enteredGoal\n\n var attribId = \"goalItem\"\n attribId = attribId.concat( listEl.childElementCount+1 ) \n\n const buttonDeleteItem = document.createElement('input')\n buttonDeleteItem.setAttribute('onclick', 'removeItem(\"' + attribId + '\")')\n buttonDeleteItem.setAttribute('type', 'button')\n buttonDeleteItem.setAttribute('style', 'margin-top: 8px')\n \n buttonDeleteItem.value = \"Delete\"\n\n const lineBreak = document.createElement('br')\n const listItem = document.createElement('li');\n listItem.setAttribute('id', attribId)\n\n listItem.appendChild(enteredGoalStrong)\n listItem.append(lineBreak)\n listItem.append(enteredGoalDesc)\n listItem.append(buttonDeleteItem)\n \n listEl.appendChild(listItem)\n }\n else\n {\n alert(\"Title cannot be empty\")\n }\n\n // Reset values in form\n inputGoalEl.value = ''\n inputDescEl.value = ''\n}", "function addListItemFromForm() {\n addListItem( getFormValues());\n}", "function madLibs() {\n\n var storyDiv = document.getElementById(\"story\");\n\n var name = document.getElementById(\"name\").value;\n\n var adjective = document.getElementById(\"adjective\").value;\n\n var noun = document.getElementById(\"noun\").value;\n\n storyDiv.innerHTML = name + \" has a \" + adjective + \" \" + noun + \" and can't make it to the party!\";\n\n }", "function seachVerb(e) {\n e.preventDefault()\n let result2 = datass.filter(element => element.conjugated_forms[0][1].split(\" \")[1] === inputValue || element.conjugated_forms[1][1] === inputValue || element.conjugated_forms[1][1] === inputValue || element.conjugated_forms[2][1] === inputValue)\n\n\n\n\n try {\n settitre(result2[0].conjugated_forms[0][0] + \" : \")\n setvaleurTitre(result2[0].conjugated_forms[0][1])\n setSimplePast1(result2[0].conjugated_forms[1][0] + \" : \")\n setSimplePastValue(result2[0].conjugated_forms[1][1])\n setPastParticipe(result2[0].conjugated_forms[2][0] + \" : \")\n setPastParticipeValue(result2[0].conjugated_forms[2][1])\n setSimplePresent(result2[0].conjugation_tables.indicative[0].heading.toUpperCase())\n setPresentI(result2[0].conjugation_tables.indicative[0].forms[0][0])\n setPresentIRresult(result2[0].conjugation_tables.indicative[0].forms[0][1])\n setPresentYou(result2[0].conjugation_tables.indicative[0].forms[1][0])\n setPresentYouResult(result2[0].conjugation_tables.indicative[0].forms[1][1])\n setPresentHe(result2[0].conjugation_tables.indicative[0].forms[2][0])\n setPresentHeResult(result2[0].conjugation_tables.indicative[0].forms[2][1])\n setPresentWe(result2[0].conjugation_tables.indicative[0].forms[3][0])\n setPresentWeResult(result2[0].conjugation_tables.indicative[0].forms[3][1])\n setPresentYou1(result2[0].conjugation_tables.indicative[0].forms[4][0])\n setPresentYou1Result(result2[0].conjugation_tables.indicative[0].forms[4][1])\n setPresentThey(result2[0].conjugation_tables.indicative[0].forms[5][0])\n setPresentTheyResult(result2[0].conjugation_tables.indicative[0].forms[5][1])\n\n /* present progressive */\n setPresentProgressive(result2[0].conjugation_tables.indicative[1].heading.toUpperCase())\n setPresentProgressiveI(result2[0].conjugation_tables.indicative[1].forms[0][0])\n setPresentProgressiveIRresult(result2[0].conjugation_tables.indicative[1].forms[0][1])\n setPresentProgressiveYou(result2[0].conjugation_tables.indicative[1].forms[1][0])\n setPresentProgressiveYouResult(result2[0].conjugation_tables.indicative[1].forms[1][1])\n setPresentProgressiveHe(result2[0].conjugation_tables.indicative[1].forms[2][0])\n setPresentProgressiveHeResult(result2[0].conjugation_tables.indicative[1].forms[2][1])\n setPresentProgressiveWe(result2[0].conjugation_tables.indicative[1].forms[3][0])\n setPresentProgressiveWeResult(result2[0].conjugation_tables.indicative[1].forms[3][1])\n setPresentProgressiveYou1(result2[0].conjugation_tables.indicative[1].forms[4][0])\n setPresentProgressiveYou1Result(result2[0].conjugation_tables.indicative[1].forms[4][1])\n setPresentProgressiveThey(result2[0].conjugation_tables.indicative[1].forms[5][0])\n setPresentProgressiveTheyResult(result2[0].conjugation_tables.indicative[1].forms[5][1])\n\n /* present perfect */\n setPresentPerfect(result2[0].conjugation_tables.indicative[2].heading.toUpperCase())\n setPresentPerfectI(result2[0].conjugation_tables.indicative[2].forms[0][0])\n setPresentPerfectIRresult(result2[0].conjugation_tables.indicative[2].forms[0][1])\n setPresentPerfectYou(result2[0].conjugation_tables.indicative[2].forms[1][0])\n setPresentPerfectYouResult(result2[0].conjugation_tables.indicative[2].forms[1][1])\n setPresentPerfectHe(result2[0].conjugation_tables.indicative[2].forms[2][0])\n setPresentPerfectHeResult(result2[0].conjugation_tables.indicative[2].forms[2][1])\n setPresentPerfectWe(result2[0].conjugation_tables.indicative[2].forms[3][0])\n setPresentPerfectWeResult(result2[0].conjugation_tables.indicative[2].forms[3][1])\n setPresentPerfectYou1(result2[0].conjugation_tables.indicative[2].forms[4][0])\n setPresentPerfectYou1Result(result2[0].conjugation_tables.indicative[2].forms[4][1])\n setPresentPerfectThey(result2[0].conjugation_tables.indicative[2].forms[5][0])\n setPresentPerfectTheyResult(result2[0].conjugation_tables.indicative[2].forms[5][1])\n\n\n /* present perfect progressive */\n setPresentPerfectProgressive(result2[0].conjugation_tables.indicative[3].heading.toUpperCase())\n setPresentPerfectProgressiveI(result2[0].conjugation_tables.indicative[3].forms[0][0])\n setPresentPerfectProgressiveIRresult(result2[0].conjugation_tables.indicative[3].forms[0][1])\n setPresentPerfectProgressiveYou(result2[0].conjugation_tables.indicative[3].forms[1][0])\n setPresentPerfectProgressiveYouResult(result2[0].conjugation_tables.indicative[3].forms[1][1])\n setPresentPerfectProgressiveHe(result2[0].conjugation_tables.indicative[3].forms[2][0])\n setPresentPerfectProgressiveHeResult(result2[0].conjugation_tables.indicative[3].forms[2][1])\n setPresentPerfectProgressiveWe(result2[0].conjugation_tables.indicative[3].forms[3][0])\n setPresentPerfectProgressiveWeResult(result2[0].conjugation_tables.indicative[3].forms[3][1])\n setPresentPerfectProgressiveYou1(result2[0].conjugation_tables.indicative[3].forms[4][0])\n setPresentPerfectProgressiveYou1Result(result2[0].conjugation_tables.indicative[3].forms[4][1])\n setPresentPerfectProgressiveThey(result2[0].conjugation_tables.indicative[3].forms[5][0])\n setPresentPerfectProgressiveTheyResult(result2[0].conjugation_tables.indicative[3].forms[5][1])\n\n /* Simple past */\n setSimplePast(result2[0].conjugation_tables.indicative[4].heading.toUpperCase())\n setSimplePastI(result2[0].conjugation_tables.indicative[4].forms[0][0])\n setSimplePastIRresult(result2[0].conjugation_tables.indicative[4].forms[0][1])\n setSimplePastYou(result2[0].conjugation_tables.indicative[4].forms[1][0])\n setSimplePastYouResult(result2[0].conjugation_tables.indicative[4].forms[1][1])\n setSimplePastHe(result2[0].conjugation_tables.indicative[4].forms[2][0])\n setSimplePastHeResult(result2[0].conjugation_tables.indicative[4].forms[2][1])\n setSimplePastWe(result2[0].conjugation_tables.indicative[4].forms[3][0])\n setSimplePastWeResult(result2[0].conjugation_tables.indicative[4].forms[3][1])\n setSimplePastYou1(result2[0].conjugation_tables.indicative[4].forms[4][0])\n setSimplePastYou1Result(result2[0].conjugation_tables.indicative[4].forms[4][1])\n setSimplePastThey(result2[0].conjugation_tables.indicative[4].forms[5][0])\n setSimplePastTheyResult(result2[0].conjugation_tables.indicative[4].forms[5][1])\n\n\n /* past progressive */\n setPastProgressive(result2[0].conjugation_tables.indicative[5].heading.toUpperCase())\n setPastProgressiveI(result2[0].conjugation_tables.indicative[5].forms[0][0])\n setPastProgressiveIRresult(result2[0].conjugation_tables.indicative[5].forms[0][1])\n setPastProgressiveYou(result2[0].conjugation_tables.indicative[5].forms[1][0])\n setPastProgressiveYouResult(result2[0].conjugation_tables.indicative[5].forms[1][1])\n setPastProgressiveHe(result2[0].conjugation_tables.indicative[5].forms[2][0])\n setPastProgressiveHeResult(result2[0].conjugation_tables.indicative[5].forms[2][1])\n setPastProgressiveWe(result2[0].conjugation_tables.indicative[5].forms[3][0])\n setPastProgressiveWeResult(result2[0].conjugation_tables.indicative[5].forms[3][1])\n setPastProgressiveYou1(result2[0].conjugation_tables.indicative[5].forms[4][0])\n setPastProgressiveYou1Result(result2[0].conjugation_tables.indicative[5].forms[4][1])\n setPastProgressiveThey(result2[0].conjugation_tables.indicative[5].forms[5][0])\n setPastProgressiveTheyResult(result2[0].conjugation_tables.indicative[5].forms[5][1])\n\n /* past perfect */\n setPastPerfect(result2[0].conjugation_tables.indicative[6].heading.toUpperCase())\n setPastPerfectI(result2[0].conjugation_tables.indicative[6].forms[0][0])\n setPastPerfectIRresult(result2[0].conjugation_tables.indicative[6].forms[0][1])\n setPastPerfectYou(result2[0].conjugation_tables.indicative[6].forms[1][0])\n setPastPerfectYouResult(result2[0].conjugation_tables.indicative[6].forms[1][1])\n setPastPerfectHe(result2[0].conjugation_tables.indicative[6].forms[2][0])\n setPastPerfectHeResult(result2[0].conjugation_tables.indicative[6].forms[2][1])\n setPastPerfectWe(result2[0].conjugation_tables.indicative[6].forms[3][0])\n setPastPerfectWeResult(result2[0].conjugation_tables.indicative[6].forms[3][1])\n setPastPerfectYou1(result2[0].conjugation_tables.indicative[6].forms[4][0])\n setPastPerfectYou1Result(result2[0].conjugation_tables.indicative[6].forms[4][1])\n setPastPerfectThey(result2[0].conjugation_tables.indicative[6].forms[5][0])\n setPastPerfectTheyResult(result2[0].conjugation_tables.indicative[6].forms[5][1])\n\n\n /* past perfect progressive*/\n setPastPerfectProgressive(result2[0].conjugation_tables.indicative[7].heading.toUpperCase())\n setPastPerfectProgressiveI(result2[0].conjugation_tables.indicative[7].forms[0][0])\n setPastPerfectProgressiveIRresult(result2[0].conjugation_tables.indicative[7].forms[0][1])\n setPastPerfectProgressiveYou(result2[0].conjugation_tables.indicative[7].forms[1][0])\n setPastPerfectProgressiveYouResult(result2[0].conjugation_tables.indicative[7].forms[1][1])\n setPastPerfectProgressiveHe(result2[0].conjugation_tables.indicative[7].forms[2][0])\n setPastPerfectProgressiveHeResult(result2[0].conjugation_tables.indicative[7].forms[2][1])\n setPastPerfectProgressiveWe(result2[0].conjugation_tables.indicative[7].forms[3][0])\n setPastPerfectProgressiveWeResult(result2[0].conjugation_tables.indicative[7].forms[3][1])\n setPastPerfectProgressiveYou1(result2[0].conjugation_tables.indicative[7].forms[4][0])\n setPastPerfectProgressiveYou1Result(result2[0].conjugation_tables.indicative[7].forms[4][1])\n setPastPerfectProgressiveThey(result2[0].conjugation_tables.indicative[7].forms[5][0])\n setPastPerfectProgressiveTheyResult(result2[0].conjugation_tables.indicative[7].forms[5][1])\n\n /* simple future*/\n setSimpleFuture(result2[0].conjugation_tables.indicative[8].heading.toUpperCase())\n setSimpleFutureI(result2[0].conjugation_tables.indicative[8].forms[0][0])\n setSimpleFutureIRresult(result2[0].conjugation_tables.indicative[8].forms[0][1])\n setSimpleFutureYou(result2[0].conjugation_tables.indicative[8].forms[1][0])\n setSimpleFutureYouResult(result2[0].conjugation_tables.indicative[8].forms[1][1])\n setSimpleFutureHe(result2[0].conjugation_tables.indicative[8].forms[2][0])\n setSimpleFutureHeResult(result2[0].conjugation_tables.indicative[8].forms[2][1])\n setSimpleFutureWe(result2[0].conjugation_tables.indicative[8].forms[3][0])\n setSimpleFutureWeResult(result2[0].conjugation_tables.indicative[8].forms[3][1])\n setSimpleFutureYou1(result2[0].conjugation_tables.indicative[8].forms[4][0])\n setSimpleFutureYou1Result(result2[0].conjugation_tables.indicative[8].forms[4][1])\n setSimpleFutureThey(result2[0].conjugation_tables.indicative[8].forms[5][0])\n setSimpleFutureTheyResult(result2[0].conjugation_tables.indicative[8].forms[5][1])\n\n /* future progressive*/\n setFuturProgressive(result2[0].conjugation_tables.indicative[9].heading.toUpperCase())\n setFuturProgressiveI(result2[0].conjugation_tables.indicative[9].forms[0][0])\n setFuturProgressiveIRresult(result2[0].conjugation_tables.indicative[9].forms[0][1])\n setFuturProgressiveYou(result2[0].conjugation_tables.indicative[9].forms[1][0])\n setFuturProgressiveYouResult(result2[0].conjugation_tables.indicative[9].forms[1][1])\n setFuturProgressiveHe(result2[0].conjugation_tables.indicative[9].forms[2][0])\n setFuturProgressiveHeResult(result2[0].conjugation_tables.indicative[9].forms[2][1])\n setFuturProgressiveWe(result2[0].conjugation_tables.indicative[9].forms[3][0])\n setFuturProgressiveWeResult(result2[0].conjugation_tables.indicative[9].forms[3][1])\n setFuturProgressiveYou1(result2[0].conjugation_tables.indicative[9].forms[4][0])\n setFuturProgressiveYou1Result(result2[0].conjugation_tables.indicative[9].forms[4][1])\n setFuturProgressiveThey(result2[0].conjugation_tables.indicative[9].forms[5][0])\n setFuturProgressiveTheyResult(result2[0].conjugation_tables.indicative[9].forms[5][1])\n\n /* future perfect*/\n setFuturePerfect(result2[0].conjugation_tables.indicative[10].heading.toUpperCase())\n setFuturePerfectI(result2[0].conjugation_tables.indicative[10].forms[0][0])\n setFuturePerfectIRresult(result2[0].conjugation_tables.indicative[10].forms[0][1])\n setFuturePerfectYou(result2[0].conjugation_tables.indicative[10].forms[1][0])\n setFuturePerfectYouResult(result2[0].conjugation_tables.indicative[10].forms[1][1])\n setFuturePerfectHe(result2[0].conjugation_tables.indicative[10].forms[2][0])\n setFuturePerfectHeResult(result2[0].conjugation_tables.indicative[10].forms[2][1])\n setFuturePerfectWe(result2[0].conjugation_tables.indicative[10].forms[3][0])\n setFuturePerfectWeResult(result2[0].conjugation_tables.indicative[10].forms[3][1])\n setFuturePerfectYou1(result2[0].conjugation_tables.indicative[10].forms[4][0])\n setFuturePerfectYou1Result(result2[0].conjugation_tables.indicative[10].forms[4][1])\n setFuturePerfectThey(result2[0].conjugation_tables.indicative[10].forms[5][0])\n setFuturePerfectTheyResult(result2[0].conjugation_tables.indicative[10].forms[5][1])\n\n\n /* future perfect progressive*/\n setFuturePerfectProgressive(result2[0].conjugation_tables.indicative[11].heading.toUpperCase())\n setFuturePerfectProgressiveI(result2[0].conjugation_tables.indicative[11].forms[0][0])\n setFuturePerfectProgressiveIRresult(result2[0].conjugation_tables.indicative[11].forms[0][1])\n setFuturePerfectProgressiveYou(result2[0].conjugation_tables.indicative[11].forms[1][0])\n setFuturePerfectProgressiveYouResult(result2[0].conjugation_tables.indicative[11].forms[1][1])\n setFuturePerfectProgressiveHe(result2[0].conjugation_tables.indicative[11].forms[2][0])\n setFuturePerfectProgressiveHeResult(result2[0].conjugation_tables.indicative[11].forms[2][1])\n setFuturePerfectProgressiveWe(result2[0].conjugation_tables.indicative[11].forms[3][0])\n setFuturePerfectProgressiveWeResult(result2[0].conjugation_tables.indicative[11].forms[3][1])\n setFuturePerfectProgressiveYou1(result2[0].conjugation_tables.indicative[11].forms[4][0])\n setFuturePerfectProgressiveYou1Result(result2[0].conjugation_tables.indicative[11].forms[4][1])\n setFuturePerfectProgressiveThey(result2[0].conjugation_tables.indicative[11].forms[5][0])\n setFuturePerfectProgressiveTheyResult(result2[0].conjugation_tables.indicative[11].forms[5][1])\n\n /* passive form ------------------------------------------- */\n\n setSimplePassivePresent(result2[0].conjugation_tables.passive[0].heading.toUpperCase())\n setPassivePresentI(result2[0].conjugation_tables.passive[0].forms[0][0])\n setPassivePresentIRresult(result2[0].conjugation_tables.passive[0].forms[0][1])\n setPassivePresentYou(result2[0].conjugation_tables.passive[0].forms[1][0])\n setPassivePresentYouResult(result2[0].conjugation_tables.passive[0].forms[1][1])\n setPassivePresentHe(result2[0].conjugation_tables.passive[0].forms[2][0])\n setPassivePresentHeResult(result2[0].conjugation_tables.passive[0].forms[2][1])\n setPassivePresentWe(result2[0].conjugation_tables.passive[0].forms[3][0])\n setPassivePresentWeResult(result2[0].conjugation_tables.passive[0].forms[3][1])\n setPassivePresentYou1(result2[0].conjugation_tables.passive[0].forms[4][0])\n setPassivePresentYou1Result(result2[0].conjugation_tables.passive[0].forms[4][1])\n setPassivePresentThey(result2[0].conjugation_tables.passive[0].forms[5][0])\n setPassivePresentTheyResult(result2[0].conjugation_tables.passive[0].forms[5][1])\n\n /* present passive progressive */\n setPassivePresentProgressive(result2[0].conjugation_tables.passive[1].heading.toUpperCase())\n setPassivePresentProgressiveI(result2[0].conjugation_tables.passive[1].forms[0][0])\n setPassivePresentProgressiveIRresult(result2[0].conjugation_tables.passive[1].forms[0][1])\n setPassivePresentProgressiveYou(result2[0].conjugation_tables.passive[1].forms[1][0])\n setPassivePresentProgressiveYouResult(result2[0].conjugation_tables.passive[1].forms[1][1])\n setPassivePresentProgressiveHe(result2[0].conjugation_tables.passive[1].forms[2][0])\n setPassivePresentProgressiveHeResult(result2[0].conjugation_tables.passive[1].forms[2][1])\n setPassivePresentProgressiveWe(result2[0].conjugation_tables.passive[1].forms[3][0])\n setPassivePresentProgressiveWeResult(result2[0].conjugation_tables.passive[1].forms[3][1])\n setPassivePresentProgressiveYou1(result2[0].conjugation_tables.passive[1].forms[4][0])\n setPassivePresentProgressiveYou1Result(result2[0].conjugation_tables.passive[1].forms[4][1])\n setPassivePresentProgressiveThey(result2[0].conjugation_tables.passive[1].forms[5][0])\n setPassivePresentProgressiveTheyResult(result2[0].conjugation_tables.passive[1].forms[5][1])\n\n /* present passive perfect */\n setPassivePresentPerfect(result2[0].conjugation_tables.passive[2].heading.toUpperCase())\n setPassivePresentPerfectI(result2[0].conjugation_tables.passive[2].forms[0][0])\n setPassivePresentPerfectIRresult(result2[0].conjugation_tables.passive[2].forms[0][1])\n setPassivePresentPerfectYou(result2[0].conjugation_tables.passive[2].forms[1][0])\n setPassivePresentPerfectYouResult(result2[0].conjugation_tables.passive[2].forms[1][1])\n setPassivePresentPerfectHe(result2[0].conjugation_tables.passive[2].forms[2][0])\n setPassivePresentPerfectHeResult(result2[0].conjugation_tables.passive[2].forms[2][1])\n setPassivePresentPerfectWe(result2[0].conjugation_tables.passive[2].forms[3][0])\n setPassivePresentPerfectWeResult(result2[0].conjugation_tables.passive[2].forms[3][1])\n setPassivePresentPerfectYou1(result2[0].conjugation_tables.passive[2].forms[4][0])\n setPassivePresentPerfectYou1Result(result2[0].conjugation_tables.passive[2].forms[4][1])\n setPassivePresentPerfectThey(result2[0].conjugation_tables.passive[2].forms[5][0])\n setPassivePresentPerfectTheyResult(result2[0].conjugation_tables.passive[2].forms[5][1])\n\n\n /* present passive perfect progressive */\n setPassivePresentPerfectProgressive(result2[0].conjugation_tables.passive[3].heading.toUpperCase())\n setPassivePresentPerfectProgressiveI(result2[0].conjugation_tables.passive[3].forms[0][0])\n setPassivePresentPerfectProgressiveIRresult(result2[0].conjugation_tables.passive[3].forms[0][1])\n setPassivePresentPerfectProgressiveYou(result2[0].conjugation_tables.passive[3].forms[1][0])\n setPassivePresentPerfectProgressiveYouResult(result2[0].conjugation_tables.passive[3].forms[1][1])\n setPassivePresentPerfectProgressiveHe(result2[0].conjugation_tables.passive[3].forms[2][0])\n setPassivePresentPerfectProgressiveHeResult(result2[0].conjugation_tables.passive[3].forms[2][1])\n setPassivePresentPerfectProgressiveWe(result2[0].conjugation_tables.passive[3].forms[3][0])\n setPassivePresentPerfectProgressiveWeResult(result2[0].conjugation_tables.passive[3].forms[3][1])\n setPassivePresentPerfectProgressiveYou1(result2[0].conjugation_tables.passive[3].forms[4][0])\n setPassivePresentPerfectProgressiveYou1Result(result2[0].conjugation_tables.passive[3].forms[4][1])\n setPassivePresentPerfectProgressiveThey(result2[0].conjugation_tables.passive[3].forms[5][0])\n setPassivePresentPerfectProgressiveTheyResult(result2[0].conjugation_tables.passive[3].forms[5][1])\n\n /* Simple passivepast */\n setSimplePassivePast(result2[0].conjugation_tables.passive[4].heading.toUpperCase())\n setSimplePassivePastI(result2[0].conjugation_tables.passive[4].forms[0][0])\n setSimplePassivePastIRresult(result2[0].conjugation_tables.passive[4].forms[0][1])\n setSimplePassivePastYou(result2[0].conjugation_tables.passive[4].forms[1][0])\n setSimplePassivePastYouResult(result2[0].conjugation_tables.passive[4].forms[1][1])\n setSimplePassivePastHe(result2[0].conjugation_tables.passive[4].forms[2][0])\n setSimplePassivePastHeResult(result2[0].conjugation_tables.passive[4].forms[2][1])\n setSimplePassivePastWe(result2[0].conjugation_tables.passive[4].forms[3][0])\n setSimplePassivePastWeResult(result2[0].conjugation_tables.passive[4].forms[3][1])\n setSimplePassivePastYou1(result2[0].conjugation_tables.passive[4].forms[4][0])\n setSimplePassivePastYou1Result(result2[0].conjugation_tables.passive[4].forms[4][1])\n setSimplePassivePastThey(result2[0].conjugation_tables.passive[4].forms[5][0])\n setSimplePassivePastTheyResult(result2[0].conjugation_tables.passive[4].forms[5][1])\n\n\n /* past passive progressive */\n setPassivePastProgressive(result2[0].conjugation_tables.passive[5].heading.toUpperCase())\n setPassivePastProgressiveI(result2[0].conjugation_tables.passive[5].forms[0][0])\n setPassivePastProgressiveIRresult(result2[0].conjugation_tables.passive[5].forms[0][1])\n setPassivePastProgressiveYou(result2[0].conjugation_tables.passive[5].forms[1][0])\n setPassivePastProgressiveYouResult(result2[0].conjugation_tables.passive[5].forms[1][1])\n setPassivePastProgressiveHe(result2[0].conjugation_tables.passive[5].forms[2][0])\n setPassivePastProgressiveHeResult(result2[0].conjugation_tables.passive[5].forms[2][1])\n setPassivePastProgressiveWe(result2[0].conjugation_tables.passive[5].forms[3][0])\n setPassivePastProgressiveWeResult(result2[0].conjugation_tables.passive[5].forms[3][1])\n setPassivePastProgressiveYou1(result2[0].conjugation_tables.passive[5].forms[4][0])\n setPassivePastProgressiveYou1Result(result2[0].conjugation_tables.passive[5].forms[4][1])\n setPassivePastProgressiveThey(result2[0].conjugation_tables.passive[5].forms[5][0])\n setPassivePastProgressiveTheyResult(result2[0].conjugation_tables.passive[5].forms[5][1])\n\n /* past passive perfect */\n setPassivePastPerfect(result2[0].conjugation_tables.passive[6].heading.toUpperCase())\n setPassivePastPerfectI(result2[0].conjugation_tables.passive[6].forms[0][0])\n setPassivePastPerfectIRresult(result2[0].conjugation_tables.passive[6].forms[0][1])\n setPassivePastPerfectYou(result2[0].conjugation_tables.passive[6].forms[1][0])\n setPassivePastPerfectYouResult(result2[0].conjugation_tables.passive[6].forms[1][1])\n setPassivePastPerfectHe(result2[0].conjugation_tables.passive[6].forms[2][0])\n setPassivePastPerfectHeResult(result2[0].conjugation_tables.passive[6].forms[2][1])\n setPassivePastPerfectWe(result2[0].conjugation_tables.passive[6].forms[3][0])\n setPassivePastPerfectWeResult(result2[0].conjugation_tables.passive[6].forms[3][1])\n setPassivePastPerfectYou1(result2[0].conjugation_tables.passive[6].forms[4][0])\n setPassivePastPerfectYou1Result(result2[0].conjugation_tables.passive[6].forms[4][1])\n setPassivePastPerfectThey(result2[0].conjugation_tables.passive[6].forms[5][0])\n setPassivePastPerfectTheyResult(result2[0].conjugation_tables.passive[6].forms[5][1])\n\n\n /* past passiveperfect progressive*/\n setPassivePastPerfectProgressive(result2[0].conjugation_tables.passive[7].heading.toUpperCase())\n setPassivePastPerfectProgressiveI(result2[0].conjugation_tables.passive[7].forms[0][0])\n setPassivePastPerfectProgressiveIRresult(result2[0].conjugation_tables.passive[7].forms[0][1])\n setPassivePastPerfectProgressiveYou(result2[0].conjugation_tables.passive[7].forms[1][0])\n setPassivePastPerfectProgressiveYouResult(result2[0].conjugation_tables.passive[7].forms[1][1])\n setPassivePastPerfectProgressiveHe(result2[0].conjugation_tables.passive[7].forms[2][0])\n setPassivePastPerfectProgressiveHeResult(result2[0].conjugation_tables.passive[7].forms[2][1])\n setPassivePastPerfectProgressiveWe(result2[0].conjugation_tables.passive[7].forms[3][0])\n setPassivePastPerfectProgressiveWeResult(result2[0].conjugation_tables.passive[7].forms[3][1])\n setPassivePastPerfectProgressiveYou1(result2[0].conjugation_tables.passive[7].forms[4][0])\n setPassivePastPerfectProgressiveYou1Result(result2[0].conjugation_tables.passive[7].forms[4][1])\n setPassivePastPerfectProgressiveThey(result2[0].conjugation_tables.passive[7].forms[5][0])\n setPassivePastPerfectProgressiveTheyResult(result2[0].conjugation_tables.passive[7].forms[5][1])\n\n /* simple passive future*/\n setPassiveSimpleFuture(result2[0].conjugation_tables.passive[8].heading.toUpperCase())\n setPassiveSimpleFutureI(result2[0].conjugation_tables.passive[8].forms[0][0])\n setPassiveSimpleFutureIRresult(result2[0].conjugation_tables.passive[8].forms[0][1])\n setPassiveSimpleFutureYou(result2[0].conjugation_tables.passive[8].forms[1][0])\n setPassiveSimpleFutureYouResult(result2[0].conjugation_tables.passive[8].forms[1][1])\n setPassiveSimpleFutureHe(result2[0].conjugation_tables.passive[8].forms[2][0])\n setPassiveSimpleFutureHeResult(result2[0].conjugation_tables.passive[8].forms[2][1])\n setPassiveSimpleFutureWe(result2[0].conjugation_tables.passive[8].forms[3][0])\n setPassiveSimpleFutureWeResult(result2[0].conjugation_tables.passive[8].forms[3][1])\n setPassiveSimpleFutureYou1(result2[0].conjugation_tables.passive[8].forms[4][0])\n setPassiveSimpleFutureYou1Result(result2[0].conjugation_tables.passive[8].forms[4][1])\n setPassiveSimpleFutureThey(result2[0].conjugation_tables.passive[8].forms[5][0])\n setPassiveSimpleFutureTheyResult(result2[0].conjugation_tables.passive[8].forms[5][1])\n\n /* future passive progressive*/\n setPassiveFuturProgressive(result2[0].conjugation_tables.passive[9].heading.toUpperCase())\n setPassiveFuturProgressiveI(result2[0].conjugation_tables.passive[9].forms[0][0])\n setPassiveFuturProgressiveIRresult(result2[0].conjugation_tables.passive[9].forms[0][1])\n setPassiveFuturProgressiveYou(result2[0].conjugation_tables.passive[9].forms[1][0])\n setPassiveFuturProgressiveYouResult(result2[0].conjugation_tables.passive[9].forms[1][1])\n setPassiveFuturProgressiveHe(result2[0].conjugation_tables.passive[9].forms[2][0])\n setPassiveFuturProgressiveHeResult(result2[0].conjugation_tables.passive[9].forms[2][1])\n setPassiveFuturProgressiveWe(result2[0].conjugation_tables.passive[9].forms[3][0])\n setPassiveFuturProgressiveWeResult(result2[0].conjugation_tables.passive[9].forms[3][1])\n setPassiveFuturProgressiveYou1(result2[0].conjugation_tables.passive[9].forms[4][0])\n setPassiveFuturProgressiveYou1Result(result2[0].conjugation_tables.passive[9].forms[4][1])\n setPassiveFuturProgressiveThey(result2[0].conjugation_tables.passive[9].forms[5][0])\n setPassiveFuturProgressiveTheyResult(result2[0].conjugation_tables.passive[9].forms[5][1])\n\n /* future passive perfect*/\n setPassiveFuturePerfect(result2[0].conjugation_tables.passive[10].heading.toUpperCase())\n setPassiveFuturePerfectI(result2[0].conjugation_tables.passive[10].forms[0][0])\n setPassiveFuturePerfectIRresult(result2[0].conjugation_tables.passive[10].forms[0][1])\n setPassiveFuturePerfectYou(result2[0].conjugation_tables.passive[10].forms[1][0])\n setPassiveFuturePerfectYouResult(result2[0].conjugation_tables.passive[10].forms[1][1])\n setPassiveFuturePerfectHe(result2[0].conjugation_tables.passive[10].forms[2][0])\n setPassiveFuturePerfectHeResult(result2[0].conjugation_tables.passive[10].forms[2][1])\n setPassiveFuturePerfectWe(result2[0].conjugation_tables.passive[10].forms[3][0])\n setPassiveFuturePerfectWeResult(result2[0].conjugation_tables.passive[10].forms[3][1])\n setPassiveFuturePerfectYou1(result2[0].conjugation_tables.passive[10].forms[4][0])\n setPassiveFuturePerfectYou1Result(result2[0].conjugation_tables.passive[10].forms[4][1])\n setPassiveFuturePerfectThey(result2[0].conjugation_tables.passive[10].forms[5][0])\n setPassiveFuturePerfectTheyResult(result2[0].conjugation_tables.passive[10].forms[5][1])\n\n\n /* future passive perfect progressive*/\n setPassiveFuturePerfectProgressive(result2[0].conjugation_tables.passive[11].heading.toUpperCase())\n setPassiveFuturePerfectProgressiveI(result2[0].conjugation_tables.passive[11].forms[0][0])\n setPassiveFuturePerfectProgressiveIRresult(result2[0].conjugation_tables.passive[11].forms[0][1])\n setPassiveFuturePerfectProgressiveYou(result2[0].conjugation_tables.passive[11].forms[1][0])\n setPassiveFuturePerfectProgressiveYouResult(result2[0].conjugation_tables.passive[11].forms[1][1])\n setPassiveFuturePerfectProgressiveHe(result2[0].conjugation_tables.passive[11].forms[2][0])\n setPassiveFuturePerfectProgressiveHeResult(result2[0].conjugation_tables.passive[11].forms[2][1])\n setPassiveFuturePerfectProgressiveWe(result2[0].conjugation_tables.passive[11].forms[3][0])\n setPassiveFuturePerfectProgressiveWeResult(result2[0].conjugation_tables.passive[11].forms[3][1])\n setPassiveFuturePerfectProgressiveYou1(result2[0].conjugation_tables.passive[11].forms[4][0])\n setPassiveFuturePerfectProgressiveYou1Result(result2[0].conjugation_tables.passive[11].forms[4][1])\n setPassiveFuturePerfectProgressiveThey(result2[0].conjugation_tables.passive[11].forms[5][0])\n setPassiveFuturePerfectProgressiveTheyResult(result2[0].conjugation_tables.passive[11].forms[5][1])\n\n\n\n\n /* condition form ------------------------------------------- */\n\n setSimpleConditionalPresent(result2[0].conjugation_tables.conditional[0].heading.toUpperCase())\n setConditionalPresentI(result2[0].conjugation_tables.conditional[0].forms[0][0])\n setConditionalPresentIRresult(result2[0].conjugation_tables.conditional[0].forms[0][1])\n setConditionalPresentYou(result2[0].conjugation_tables.conditional[0].forms[1][0])\n setConditionalPresentYouResult(result2[0].conjugation_tables.conditional[0].forms[1][1])\n setConditionalPresentHe(result2[0].conjugation_tables.conditional[0].forms[2][0])\n setConditionalPresentHeResult(result2[0].conjugation_tables.conditional[0].forms[2][1])\n setConditionalPresentWe(result2[0].conjugation_tables.conditional[0].forms[3][0])\n setConditionalPresentWeResult(result2[0].conjugation_tables.conditional[0].forms[3][1])\n setConditionalPresentYou1(result2[0].conjugation_tables.conditional[0].forms[4][0])\n setConditionalPresentYou1Result(result2[0].conjugation_tables.conditional[0].forms[4][1])\n setConditionalPresentThey(result2[0].conjugation_tables.conditional[0].forms[5][0])\n setConditionalPresentTheyResult(result2[0].conjugation_tables.conditional[0].forms[5][1])\n\n /* present Conditional progressive */\n setConditionalPresentProgressive(result2[0].conjugation_tables.conditional[1].heading.toUpperCase())\n setConditionalPresentProgressiveI(result2[0].conjugation_tables.conditional[1].forms[0][0])\n setConditionalPresentProgressiveIRresult(result2[0].conjugation_tables.conditional[1].forms[0][1])\n setConditionalPresentProgressiveYou(result2[0].conjugation_tables.conditional[1].forms[1][0])\n setConditionalPresentProgressiveYouResult(result2[0].conjugation_tables.conditional[1].forms[1][1])\n setConditionalPresentProgressiveHe(result2[0].conjugation_tables.conditional[1].forms[2][0])\n setConditionalPresentProgressiveHeResult(result2[0].conjugation_tables.conditional[1].forms[2][1])\n setConditionalPresentProgressiveWe(result2[0].conjugation_tables.conditional[1].forms[3][0])\n setConditionalPresentProgressiveWeResult(result2[0].conjugation_tables.conditional[1].forms[3][1])\n setConditionalPresentProgressiveYou1(result2[0].conjugation_tables.conditional[1].forms[4][0])\n setConditionalPresentProgressiveYou1Result(result2[0].conjugation_tables.conditional[1].forms[4][1])\n setConditionalPresentProgressiveThey(result2[0].conjugation_tables.conditional[1].forms[5][0])\n setConditionalPresentProgressiveTheyResult(result2[0].conjugation_tables.conditional[1].forms[5][1])\n\n /* present Conditional perfect */\n setConditionalPresentPerfect(result2[0].conjugation_tables.conditional[2].heading.toUpperCase())\n setConditionalPresentPerfectI(result2[0].conjugation_tables.conditional[2].forms[0][0])\n setConditionalPresentPerfectIRresult(result2[0].conjugation_tables.conditional[2].forms[0][1])\n setConditionalPresentPerfectYou(result2[0].conjugation_tables.conditional[2].forms[1][0])\n setConditionalPresentPerfectYouResult(result2[0].conjugation_tables.conditional[2].forms[1][1])\n setConditionalPresentPerfectHe(result2[0].conjugation_tables.conditional[2].forms[2][0])\n setConditionalPresentPerfectHeResult(result2[0].conjugation_tables.conditional[2].forms[2][1])\n setConditionalPresentPerfectWe(result2[0].conjugation_tables.conditional[2].forms[3][0])\n setConditionalPresentPerfectWeResult(result2[0].conjugation_tables.conditional[2].forms[3][1])\n setConditionalPresentPerfectYou1(result2[0].conjugation_tables.conditional[2].forms[4][0])\n setConditionalPresentPerfectYou1Result(result2[0].conjugation_tables.conditional[2].forms[4][1])\n setConditionalPresentPerfectThey(result2[0].conjugation_tables.conditional[2].forms[5][0])\n setConditionalPresentPerfectTheyResult(result2[0].conjugation_tables.conditional[2].forms[5][1])\n\n\n /* present Conditional perfect progressive */\n setConditionalPresentPerfectProgressive(result2[0].conjugation_tables.conditional[3].heading.toUpperCase())\n setConditionalPresentPerfectProgressiveI(result2[0].conjugation_tables.conditional[3].forms[0][0])\n setConditionalPresentPerfectProgressiveIRresult(result2[0].conjugation_tables.conditional[3].forms[0][1])\n setConditionalPresentPerfectProgressiveYou(result2[0].conjugation_tables.conditional[3].forms[1][0])\n setConditionalPresentPerfectProgressiveYouResult(result2[0].conjugation_tables.conditional[3].forms[1][1])\n setConditionalPresentPerfectProgressiveHe(result2[0].conjugation_tables.conditional[3].forms[2][0])\n setConditionalPresentPerfectProgressiveHeResult(result2[0].conjugation_tables.conditional[3].forms[2][1])\n setConditionalPresentPerfectProgressiveWe(result2[0].conjugation_tables.conditional[3].forms[3][0])\n setConditionalPresentPerfectProgressiveWeResult(result2[0].conjugation_tables.conditional[3].forms[3][1])\n setConditionalPresentPerfectProgressiveYou1(result2[0].conjugation_tables.conditional[3].forms[4][0])\n setConditionalPresentPerfectProgressiveYou1Result(result2[0].conjugation_tables.conditional[3].forms[4][1])\n setConditionalPresentPerfectProgressiveThey(result2[0].conjugation_tables.conditional[3].forms[5][0])\n setConditionalPresentPerfectProgressiveTheyResult(result2[0].conjugation_tables.conditional[3].forms[5][1])\n\n\n\n\n } catch (e) {\n console.log(e.message)\n }\n\n history.push(`/conjugation/conjugation-verb-${inputValue}.html`)\n\n }", "function addAnnouncements() {\r\n anmtTitle = document.getElementById(\"titleAnmt\").value;\r\n anmtDescr = document.getElementById(\"descrAnmt\").value;\r\n var ul = document.getElementById(\"fullAnnouncements\");\r\n var li = document.createElement(\"li\");\r\n li.appendChild(document.createTextNode(anmtTitle + \" : \" + anmtDescr))\r\n ul.appendChild(li);\r\n}", "function addListItem() {\n let item = document.querySelector(\".item\").value; \n let info = document.querySelector(\".textarea\").value;\n fullList.push({\n \"item\" : item,\n \"info\" : info\n });\n modal.classList.remove(\"open\");\n adauga.classList.remove(\"open\");\n adauga.reset();\n build();\n}", "function keywordForm() {\n document.querySelector('#keyword-button').addEventListener('click', (e) => {\n e.preventDefault();\n var keyword = document.querySelector('#keyword').value\n\n // If no title or description, return early from this function\n if (!keyword) {\n return;\n }\n\n // Add values to firebase database\n firebase.database().ref('takeover/').push({\n keyword: keyword\n });\n\n // Remove value from input after adding it\n document.querySelector('#keyword').value = '';\n\n });\n\n\n // Show the full database value\n\n let listContainer = document.querySelector('.keywords-container');\n let state = {};\n\n firebase.database().ref('takeover/').on('value', function(snapshot) {\n // Pull the list value from firebase\n state.list = snapshot.val();\n renderList(listContainer, state)\n keywordList(state)\n chipperView()\n });\n\n\n}", "function addSuggestionToArray(ev) {\n\n var newSuggestion = inputElement.value;\n\n if(newSuggestion !== '' || newSuggestion !== undefined) {\n\n var isExisting = suggestionIsExisting(newSuggestion);\n\n var isUndefinedText = false;\n if(newSuggestion === 'undefined' || newSuggestion === ''){\n isUndefinedText = true;\n }\n\n\n if(!isExisting && !isUndefinedText){\n initialSuggestions.push(newSuggestion);\n\n traverseSuggestionsArray();\n\n inputElement.value = '';\n }\n\n } else{\n //do nothing\n }\n\n hideAllLiElements();\n inputElement.value = '';\n //console.toLocaleString(newSuggestion);\n }", "function searchDrug(){\n var search_term = \"\";\n __$(\"ulDrugs\").innerHTML = \"\";\n \n if(__$(\"inputTxt\").value.trim().length > 0){\n search_term = __$(\"inputTxt\").value.trim()\n }\n \n // Create Generic Drugs list\n for(var d = 0; d < generics.length; d++){\n if(search_term != \"\"){\n if(!generics[d][0].toLowerCase().match(search_term.toLowerCase())){\n continue;\n }\n }\n \n var li = document.createElement(\"li\");\n li.id = \"option\" + generics[d][0];\n li.innerHTML = generics[d][0];\n li.style.padding = \"15px\";\n\n if(d%2>0){\n li.style.backgroundColor = \"#eee\";\n li.setAttribute(\"tag\", \"#eee\");\n } else { \n li.setAttribute(\"tag\", \"#fff\");\n }\n\n li.setAttribute(\"concept_id\", generics[d][1])\n\n li.onclick = function(){ \n highlightSelected(__$(\"ulDrugs\"), this);\n \n current_concept_id = __$(this.id).getAttribute(\"concept_id\");\n \n __$(\"inputTxt\").value = this.innerHTML;\n askFormulation();\n }\n\n __$(\"ulDrugs\").appendChild(li);\n }\n}", "function addToList(cakeId, cakeName, quantity, selectedText , price, description, productImage) {\n const item = {\n cakeId: cakeId, \n cakeName: cakeName,\n quantity: quantity, \n weight: selectedText, \n price: price, \n description: description,\n productImage: productImage\n }\n formList.push(item);\n console.log(formList);\n// clear the form for the next input \n clearForm();\n console.log(`Total Submission: ${formList.length}`.formList);\n}", "function getInputs(e) {\n\te.preventDefault();\n\tvar subjectSelect = document.getElementById('subject').value;\n\tvar numPara = document.getElementById('paragraphs').value;\n\tvar numSent = document.getElementById('sentences').value;\n\tbuildPara(subjectSelect, numPara, numSent); \n}", "function addAnotherGenre(){\r\n // console.log('adding another genre')\r\n let hiddenVal = '';\r\n let val = document.getElementsByName(\"genreINPUT\");\r\n // console.log(val)\r\n let curVal = val[0].value;\r\n if (curVal === ''){\r\n console.log(\"EMPTY Value\");\r\n return\r\n }\r\n if(!checkgenreVal(val)){\r\n console.log(\"invalid text from genre\")\r\n \r\n val[0].value='';\r\n alert(\"Please enter a valid genre :)\")\r\n \r\n return;\r\n }\r\n\r\n let aDiv = document.getElementById(\"GenreAdd\");\r\n\r\n\r\n for(x in genreList){\r\n if(curVal.toLowerCase() === genreList[x].toLowerCase()){\r\n console.log(\"match\")\r\n curVal = genreList[x];\r\n \r\n }\r\n }\r\n \r\n\r\n\r\n let List = document.getElementById(\"genreList\") \r\n let hiddenElm = document.createElement(\"input\");\r\n hiddenElm.name = \"genreINPUT\";\r\n hiddenElm.type = \"text\";\r\n hiddenElm.value = curVal;\r\n hiddenElm.id = curVal;\r\n // hiddenElm.disabled = true;\r\n hiddenElm.style.display = \"none\";\r\n\r\n\r\n //maybe append the hiddenElm to the li so when it gets deleted \r\n // aDiv.appendChild(hiddenElm); \r\n \r\n let newElm = document.createElement(\"li\");\r\n let ex = document.createElement(\"p\");\r\n \r\n newElm.innerText = curVal;\r\n \r\n newElm.name = \"genre\";\r\n newElm.id = curVal\r\n \r\n ex.className = \"close\";\r\n // ex.innerHTML = \"&times;\";\r\n ex.appendChild(newElm)\r\n // newElm.appendChild(ex);\r\n newElm.appendChild(hiddenElm)\r\n\r\n // List.appendChild(newElm)\r\n List.appendChild(ex);\r\n val[0].value = '';\r\n events();\r\n}", "function adopt(){\n mainSection.innerHTML += adoptForm\n const adoptButton = document.getElementById('adopt-submit')\n adoptButton.addEventListener('click', adoptA)\n hideNameDiv()\n}", "function submitCourse(form) {\n /* create hidden field of selected courses */\n var acForm = document.getElementById(\"acForm\");\n var wantTake = document.getElementById(\"wantTake\").getElementsByTagName(\"li\");\n var alreadyTaken = document.getElementById(\"alreadyTaken\").getElementsByTagName(\"li\");\n /***************************************************/\n var dataArray = new Array;\n for ( i = 0; i < wantTake.length; i++) {\n var id = wantTake[i].id;\n var sid = wantTake[i].getElementsByTagName(\"input\")[0].value;\n var cid = wantTake[i].getElementsByTagName(\"input\")[1].value;\n dataArray.push(new wantTakeCourse(id, sid, cid));\n }\n var json = JSON.stringify(dataArray);\n\n var inp = document.createElement(\"input\");\n inp.setAttribute(\"type\", \"hidden\");\n inp.setAttribute(\"name\", \"wantTakeCourses\");\n inp.setAttribute(\"value\", json);\n acForm.appendChild(inp);\n /***************************************************/\n var dataArray = new Array;\n for ( i = 0; i < alreadyTaken.length; i++) {\n var id = alreadyTaken[i].id;\n var sid = alreadyTaken[i].getElementsByTagName(\"input\")[0].value;\n var cid = alreadyTaken[i].getElementsByTagName(\"input\")[1].value;\n dataArray.push(new wantTakeCourse(id, sid, cid));\n }\n var json = JSON.stringify(dataArray);\n\n var inp = document.createElement(\"input\");\n inp.setAttribute(\"type\", \"hidden\");\n inp.setAttribute(\"name\", \"alreadyTakenCourses\");\n inp.setAttribute(\"value\", json);\n acForm.appendChild(inp);\n /***************************************************/\n\n var dataArray = new Array;\n for ( i = 0; i < wantTake.length; i++) {\n var id = wantTake[i].id;\n // var maxDepth = 1;\n // if (wantTake[i].getElementsByTagName(\"input\")[2])\n \tmaxDepth = wantTake[i].getElementsByTagName(\"input\")[2].value;\n dataArray.push(new ASO(id, maxDepth));\n }\n\n var inpASO = document.createElement(\"input\");\n inpASO.setAttribute(\"type\", \"hidden\");\n inpASO.setAttribute(\"name\", \"aso\");\n inpASO.setAttribute(\"value\", JSON.stringify(dataArray));\n acForm.appendChild(inpASO);\n /***************************************************/\n form.submit();\n}", "function captureDogInputs(e) {\n let dogId = parseInt(e.currentTarget.dataset.editId);\n let name = document.querySelector(`[data-name-id=\"${dogId}\"]`).innerText;\n let breed = document.querySelector(`[data-breed-id=\"${dogId}\"]`).innerText;\n let sex = document.querySelector(`[data-sex-id=\"${dogId}\"]`).innerText;\n\n let nameInput = document.querySelector('#dogname');\n let breedInput = document.querySelector('#dogbreed');\n let sexInput = document.querySelector('#dogsex');\n\n nameInput.value = name;\n breedInput.value = breed;\n sexInput.value = sex;\n\n addSubmitEventListener(dogId);\n}", "function addto() {\n\tCW.add($(\".word input[name='trial']\").val(), $(\".word input[name='definition']\").val(), $(\".word select\").find(\":selected\").attr(\"value\"), ($(\".word input[name='horizontal']\").val() - 1), ($(\".word input[name='vertical']\").val() - 1), $(\".word input[name='symbol']\").val().toUpperCase);\t\n\t// convert value to integer\n\t$(\".alert-success span\").html(+($(\".alert-success span\").text()) + 1);\n\t$('.word')[0].reset();\n\t$(\".alert-warning\").hide()\n\t$(\".alert-success\").hide()\n\t$(\".alert-success\").toggle(\"fast\");\n\tevent.preventDefault();\n}", "updateForm() {\n this.$step.innerText = this.currentStep;\n\n\n this.slides.forEach(slide => {\n slide.classList.remove(\"active\");\n\n if (slide.dataset.step == this.currentStep) {\n slide.classList.add(\"active\");\n }\n });\n\n this.$stepInstructions[0].parentElement.parentElement.hidden = this.currentStep >= 5;\n this.$step.parentElement.hidden = this.currentStep >= 5;\n let categories = form.querySelectorAll(\"input[type='checkbox']:checked\");\n\n let categoriesText = [];\n for (let checkbox of categories) {\n categoriesText.push(checkbox.parentNode.lastElementChild.textContent);\n }\n\n console.log(categoriesText);\n\n let bagQuantityElement = form.querySelector(\"input[type='number']\").value;\n\n let donationDetails = document.querySelectorAll(\"div[data-step='5'] .summary div[class='form-section'] .summary--text\");\n console.log(donationDetails);\n let numberOfBags = donationDetails[0];\n console.log(bagQuantityElement);\n if (bagQuantityElement < 2) {\n numberOfBags.innerText = bagQuantityElement + \" worek zawierający \" + categoriesText.join(\" oraz \");\n } else if (bagQuantityElement < 5) {\n numberOfBags.innerText = bagQuantityElement + \" worki zawierające \" + categoriesText.join(\" oraz \");\n } else {\n numberOfBags.innerText = bagQuantityElement + \" worków zawierających \" + categoriesText.join(\" oraz \");\n }\n\n let address = form.querySelectorAll(\"div[data-step='4'] div[class='form-section form-section--columns'] input[type='text']\");\n let street = address[0].value;\n let city = address[1].value;\n let zipcode = address[2].value;\n let phone = document.querySelector(\"input[type='phone']\").value;\n let pickUpDate = document.querySelector(\"input[type='date']\").value;\n let pickUpTime = document.querySelector(\"input[type='time']\").value;\n let pickUpComments = document.querySelector(\"textarea\").value;\n\n const contactDetails = form.querySelectorAll(\"div[data-step='5'] .summary div[class='form-section form-section--columns'] ul li\");\n contactDetails[0].innerText = street;\n contactDetails[1].innerText = city;\n contactDetails[2].innerText = zipcode;\n contactDetails[3].innerText = phone;\n contactDetails[4].innerText = pickUpDate;\n contactDetails[5].innerText = pickUpTime;\n contactDetails[6].innerText = pickUpComments;\n\n let institutions = form.querySelector(\"input[type='radio']:checked\").parentNode.lastElementChild.firstElementChild.textContent;\n let institutionText = donationDetails[1];\n institutionText.innerText = \"Dla fundacji \" + institutions;\n }", "function addToListMouse() {\n let text1 = document.getElementById(\"text1\").value;\n if (text1.length > 0) {\n appendToList(text1);\n\n }\n}", "function submit() {\n words.innerHTML = emotionsArray.join(\" - \");\n}", "function addNewValues(){\n event.preventDefault();\n var textValue=$(\"#textBox\").val();\n console.log(textValue);\n topics.push(textValue);\n $(\"#textBox\").val(\"\");\n renderButton();\n\n}", "function getElements() { \n ignoreHyphenatedWordsText = document.getElementById('ignoreHyphenatedWordsText');\n replacementClickableText = document.getElementById('replacementClickableText');\n excludeConjuctionsText = document.getElementById('excludeConjuctionsText');\n excludePronounsText = document.getElementById('excludePronounsText');\n oneWordSynonymsText = document.getElementById('oneWordSynonymsText');\n resetOptionsBtn = document.getElementById('resetOptionsBtn');\n chkConjunctions = document.getElementById('chkConjunctions');\n redoPedantify = document.getElementById('forwardTextBtn');\n percentReplVal = document.getElementById('percReplValue');\n noSynRepText = document.getElementById('noSynRepText');\n percentReplSlider = document.getElementById('slider1');\n undoPedantify = document.getElementById('backTextBtn');\n chkMultiWord = document.getElementById('chkMultiWord');\n chkPronouns = document.getElementById('chkPronouns');\n chkNoRepeat = document.getElementById('chkNoRepeat');\n percRepText = document.getElementById('percRepText');\n excludeWord = document.getElementById('textArea2');\n chkHyphens = document.getElementById('chkHyphens');\n chooseFile = document.getElementById('chooseFile');\n saveBtn = document.getElementById('saveFileLink');\n submitBtn = document.getElementById('submitBtn');\n text_area = document.getElementById('textArea1');\n resetBtn = document.getElementById(\"resetBtn\");\n randBtn = document.getElementById('randBtn');\n minBtn = document.getElementById('minBtn');\n maxBtn = document.getElementById('maxBtn');\n}", "run(){\n \n const form = document.querySelector('#character-creation');\n const btn = document.querySelector('#display-info');\n //save a new character to the list\n form.addEventListener('click', event => {\n \n let target = event.target;\n if(target.type == 'submit') {\n event.preventDefault();\n event.preventDefault();\n console.log('click working');\n \n const form = document.querySelector('#character-creation');\n let character = CharacterFactory.characters(form['character'].value);\n character.name = form['name'].value;\n character.birthPlace = form['birth-place'].value;\n console.log(character);\n CharacterFactory.listOfCharacters.push(character);\n\n form['name'].value = null;\n form['birth-place'].value = null;\n form.querySelector('#other').checked = true;\n btn.classList.remove('hidden');\n btn.classList.add('showing');\n }\n });\n\n // display all character save inside the list\n btn.addEventListener('click', event => {\n const display = document.querySelector('#characters-list ul');\n display.innerHTML = '';\n let stringBuilder = '';\n CharacterFactory.listOfCharacters.forEach(character => {\n stringBuilder += `<li><article> \n <h3 class=\"name\"> ${character.name} </h3>\n <img class=\"obj\" width=\"100\" height=\"100\" src=\"${character.image}\" />\n <div class=\"img\"> \n <span class=\"birth\">Birth: ${character.birthPlace}</span>\n <span class=\"att\">Att: ${character.attack}</span>\n <span class=\"def\">Def: ${character.defense}</span>\n <span class=\"mag\">Mag: ${character.magic}</span>\n <span class=\"type\">Job: ${character.job}</span>\n </div>\n </article></li>`;\n });\n display.insertAdjacentHTML(\"beforeend\", stringBuilder);\n });\n }", "updateForm() {\n this.$step.innerText = this.currentStep;\n\n // TODO: Validation\n\n this.slides.forEach(slide => {\n slide.classList.remove(\"active\");\n\n if (slide.dataset.step == this.currentStep) {\n slide.classList.add(\"active\");\n }\n });\n\n this.$stepInstructions[0].parentElement.parentElement.hidden = this.currentStep >= 6;\n this.$step.parentElement.hidden = this.currentStep >= 6;\n\n /** Get data from inputs and show them in summary */\n const category_array = [];\n this.$checkboxInputs.forEach(function (element) {\n if (element.checked === true) {\n category_array.push(element.value)\n }\n });\n if (this.currentStep === 5) {\n // console.log(this.$fifthStepDiv.querySelectorAll('li')[0].querySelector('span.summary--text').innerText);\n let textLi = this.$fifthStepDiv.querySelectorAll('li');\n textLi[0].querySelector('span.summary--text').innerHTML = this.$bagsInput.value + ' worki zawierające: <br>' + category_array.join(', ');\n this.$divsTitle.forEach(function (element) {\n if (element.parentElement.parentElement.firstChild.nextSibling.checked === true) {\n textLi[1].querySelector('span.summary--text').innerHTML = 'Dla fundacji ' + '\"' + element.innerText + '\"'\n }\n });\n textLi[2].innerHTML = this.$addressInput.value;\n textLi[3].innerHTML = this.$cityInput.value;\n textLi[4].innerHTML = this.$postcodeInput.value;\n textLi[5].innerHTML = this.$phoneInput.value;\n textLi[6].innerHTML = this.$dateInput.value;\n textLi[7].innerHTML = this.$timeInput.value;\n textLi[8].innerHTML = this.$commentTextarea.value;\n\n }\n\n\n }", "function submitForm(event){\n event.preventDefault();\n const arr = [];\n Object.entries(inputs).map(([key,val])=>{\n return arr.push(inputs[key][2])\n })\n Axios.post('/api/words/', arr).then((response)=>{\n history.push('/results/1')\n }).catch(err=>{\n console.log(err);\n })\n }", "function buildIdLists() {\n\n $A( $(\"have\").options ).each( function( opt ) {\n var i = document.createElement( \"input\" );\n i.type = \"hidden\";\n i.name = \"have\";\n i.value = opt.value;\n $(\"domainSearchForm\").appendChild( i );\n } );\n \n $A( $(\"not\").options ).each( function( opt ) {\n var i = document.createElement( \"input\" );\n i.type = \"hidden\";\n i.name = \"not\";\n i.value = opt.value;\n $(\"domainSearchForm\").appendChild( i );\n } );\n\n $('domainSearchForm').submit();\n}", "function addIngredientsFunction() {\n var fieldWrapper = $(\"<div class=\\\"fieldwrapper\\\"/>\");\n var fName = $(\"<textarea id=\\\"ingredients\\\" name=\\\"ingredients\\\" minlength=\\\"1\\\" maxlength=\\\"100\\\" class=\\\"validate materialize-textarea manual-feedback col s11\\\" placeholder=\\\"Example: Milk, Eggs, Chocolate, Flour\\\" required></textarea>\");\n var removeButton = $(\"<button class=\\\"btn remove-btn col s1\\\" value=\\\"-\\\" type=\\\"button\\\"><i class=\\\"fa fa-minus\\\" aria-hidden=\\\"true\\\"></i></button>\");\n var alertDiv = $(\"<div class=\\\"col s12 left-align alert-div\\\"></div>\");\n removeButton.click(function () {\n $(this).parent().remove();\n });\n fieldWrapper.append(fName);\n fieldWrapper.append(removeButton);\n fieldWrapper.append(alertDiv);\n $(\"#ingredientsform\").append(fieldWrapper);\n // Add event listeners when a new item is created (on advice of Xavier, tutor at Code Institute)\n feedbackFocusFunction();\n feedbackChangeFunction();\n }", "function checkSkill(value) {\n //Remove the skill from the select to prevent duplicates\n var select = document.getElementById(\"skill\");\n select.options[select.selectedIndex] = null;\n\n //Locate the outer container for adding\n var container = document.getElementById(\"skillContainer\");\n\n //Create a container for each new skill\n var p = document.createElement(\"p\");\n p.id = \"p\"+value;\n p.classList.add(\"mb04\");\n\n //Hidden input for processing in back-end\n var nameInput = document.createElement(\"input\");\n nameInput.type = \"hidden\";\n nameInput.name = \"skillName[]\";\n nameInput.value = value;\n\n //Create a new select for selecting expertise for each skill\n var expertiseInput = document.createElement(\"select\");\n expertiseInput.classList.add(\"ib\");\n expertiseInput.classList.add(\"nudgeUp\");\n expertiseInput.name = \"skillExpertise[]\";\n expertiseInput.id = value;\n //Loop through possible expertises and add each as an option in the select\n var array = [\"10\",\"9\",\"8\",\"7\",\"6\",\"5\",\"4\",\"3\",\"2\",\"1\"];\n for (var i = 0; i < array.length; i++) {\n var option = document.createElement(\"option\");\n option.setAttribute(\"value\", array[i]);\n option.text = array[i];\n expertiseInput.appendChild(option);\n }\n\n //Create button to remove skill\n var button = document.createElement(\"button\");\n button.id = \"b\"+value;\n button.name = value;\n button.setAttribute(\"onclick\", \"removeSkill(this.name)\");\n button.classList.add(\"button\");\n button.classList.add(\"nudgeUp\");\n button.classList.add(\"fieldButton\");\n button.innerHTML = 'Remove Skill';\n\n //Add all inputs to inner container and append it to outer container\n p.appendChild(document.createTextNode(value + \": \"));\n p.appendChild(nameInput);\n p.appendChild(expertiseInput);\n p.appendChild(button);\n container.appendChild(p);\n}", "function onAddButtonClick(ev) {\n var valueToAdd = textBoxAddControls.value;\n textBoxAddControls.value = \"\";\n addTextStrong.innerHTML = valueToAdd;\n resultList.appendChild(listItems.cloneNode(true));\n }", "function appendToList(text1) {\n let ul1 = document.getElementById(\"ul1\");\n ul1.appendChild(createListItem(text1));\n document.getElementById(\"text1\").value = '';\n}" ]
[ "0.6291504", "0.6167496", "0.6037546", "0.6015859", "0.599327", "0.5981399", "0.59106576", "0.5880307", "0.58223295", "0.57768416", "0.57426405", "0.5727314", "0.572152", "0.56488866", "0.5647244", "0.56373197", "0.56308115", "0.55923796", "0.55520326", "0.55425507", "0.55364335", "0.55313414", "0.55225116", "0.55062735", "0.5488993", "0.5487924", "0.5484042", "0.5470128", "0.5460233", "0.54570365" ]
0.63710004
0
Set the logging function to be called to write logs. Argument: logFunction Logging function
function setLogFunction(logFunction) { my.logFunction = logFunction }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setLog(log) {\n module.exports.log = typeof log === 'function' ? log : null;\n }", "log(message) {\n this.loggingFunction(message);\n }", "function log() {\n //log here\n }", "function log()\n {\n if (my.logFunction == null)\n return\n\n var meta = ['name', 'QuickQWERTY']\n var data = Array.prototype.slice.call(arguments)\n my.logFunction.apply(this, meta.concat(data))\n }", "function logSomething(log) { log.info('something'); }", "function Log() {}", "function _____INTERNAL_log_functions_____(){}\t\t//{", "function setLoggingFunctions(message, error, stop) {\n _message = message;\n _error = error;\n _stop = stop;\n }", "function setLogMode(mode) {\n logMode = mode;\n }", "function log(s) {\r\n logFn && logFn(s);\r\n }", "function logger() {}", "log() {}", "function logger() {\r\n // if $log fn is called directly, default to \"info\" message\r\n logger.info.apply(logger, arguments);\r\n }", "function log(){\n console.log('logging');\n}", "function enableLogging() {\n logEnabled = true;\n}", "enableLogging (config = {}) {\n // Only attempt to enable logging from an object definition\n if (typeof config === 'object') {\n // Loop through logging config by method (function name)\n Object.keys(config).forEach(method => {\n // Get the current method configuration from the logging config by method\n const methodConfig = config[method]\n\n // Don't allow provided setting to override existing properties\n if (typeof this[method] !== 'undefined') {\n throw new Error(`Cannot override method for logging: '${method}' ... it already exists!`)\n }\n\n // Create the logging method as a function on the current Logger instance\n this[method] = (...args) => {\n // Determine whether or not to show the message\n // - If method isn't verbose only OR verbose flag is set\n // - AND\n // - The quiet flag is NOT set\n if ((!methodConfig.verbose || this.options.verbose) && !this.options.quiet) {\n // Get the console method to be used for this logging function\n // Check to see if the \"console\" object has the same function, otherwise just use \"log\"\n const consoleMethod = (typeof console[method] === 'function' ? console[method] : console['log'])\n\n // Get the prefix from method config, otherwise set it to blank\n const prefix = (typeof methodConfig.prefix === 'string' ? methodConfig.prefix : '')\n\n // Get the color from the method config, otherwise set it to blank\n const color = (typeof colors[methodConfig.color] === 'function' ? methodConfig.color : '')\n\n // Create the output variable\n let output = Logger.colorize(args, color)\n\n // If a prefix is set, prepend it to the previously created output\n if (prefix.trim() !== '') {\n output = Logger.colorize([prefix], color).concat(output)\n }\n\n // If the stamp flag is set, prepend the output with a timestamp\n if (methodConfig.stamp) {\n const timeStamp = this.getTimeStamp()\n output = Logger.colorize([`[${timeStamp}]`], color).concat(output)\n }\n\n // Use the console method obtained above, print the generated output\n consoleMethod(...output)\n\n // If the throws flag is set, and the force flag isn't allowed AND set\n if (methodConfig.throws === true && !(this.settings.allowForceNoThrow && this.options.force)) {\n // Throw the args as an error\n throw new Error(args)\n }\n }\n }\n })\n }\n }", "function apiLog(functionName, CMIElement, logMessage, messageLevel) {\n logMessage = formatMessage(functionName, CMIElement, logMessage);\n\n if (messageLevel >= this.apiLogLevel) {\n switch (messageLevel) {\n case constants.LOG_LEVEL_ERROR:\n console.error(logMessage);\n break;\n case constants.LOG_LEVEL_WARNING:\n console.warn(logMessage);\n break;\n case constants.LOG_LEVEL_INFO:\n console.info(logMessage);\n break;\n }\n }\n }", "function logTheArgument(someFunction) {\r\n someFunction();\r\n}", "function log (level, message) {\r\n\r\n}", "static usingFunction( logEvent ) {\n\n\t\tvar monitor = new AbstractLoggingMonitor();\n\n\t\t// Override the abstract method, completing the implementation.\n\t\tmonitor.logEvent = logEvent;\n\n\t\treturn( monitor );\n\n\t}", "setLoggingLevel(logLevel) {\n this.logLevel = logLevel;\n }", "function log(str) { Logger.log(str); }", "function genaLog(func) {\n return function() {\n let abc = func.apply(this, arguments);\n console.log(\"called\");\n return abc;\n }\n}", "function LogWrapper (isLogging) {\n if (this.constructor.name === 'Function') {\n throw new Error('Missing object context')\n }\n\n if (!isLogging) {\n // stub the logger out\n this.logger = {}\n\n this.logger.info = function () {}\n this.logger.error = function () {}\n this.logger.warn = function () {}\n return\n }\n\n // Else config winston for logging\n const Winston = require('winston')\n\n let winstonTransport = new (Winston.transports.Console)({\n json: false,\n colorize: true\n })\n\n this.logger = new (Winston.Logger)({\n transports: [winstonTransport]\n })\n}", "function PrintLog(a)\n{\nlogger.info(a);\n}", "function setLogger(newLogger) {\n\t\tif (logger) {\n\t\t\tlogger.close();\n\t\t\tfor (let funcName of logger._logFuncs) {\n\t\t\t\tdelete module.exports[funcName];\n\t\t\t}\n\t\t}\n\t\tlogger = newLogger;\n\t\tmodule.exports.logger = newLogger;\n\t\tfor (let funcName of logger._logFuncs) {\n\t\t\tmodule.exports[funcName] = function(...args) {\n\t\t\t\treturn logger[funcName](...args);\n\t\t\t};\n\t\t}\n\t}", "function LogOperator(){}", "log(message) {\n console.log(`[Function/${this.name}] INFO: ${message}`);\n }", "function setLogLevel(logLevel) {\r\n (0,_firebase_logger__WEBPACK_IMPORTED_MODULE_1__.setLogLevel)(logLevel);\r\n}", "function doLog() {\n console.log(\"This is a log message.\");\n}" ]
[ "0.68975186", "0.67589045", "0.6642748", "0.6397973", "0.63949114", "0.6261316", "0.62445617", "0.6176604", "0.61177546", "0.6078538", "0.60657465", "0.59924805", "0.5958662", "0.5945363", "0.58728874", "0.58673686", "0.5862124", "0.58538395", "0.58296937", "0.58278614", "0.5808897", "0.5746046", "0.5719085", "0.5675827", "0.5667716", "0.56441987", "0.56169176", "0.5616495", "0.5608392", "0.5600344" ]
0.8587265
0
Write logs via a configured logging function. Arguments: key, value, ... An even number of string arguments
function log() { if (my.logFunction == null) return var meta = ['name', 'QuickQWERTY'] var data = Array.prototype.slice.call(arguments) my.logFunction.apply(this, meta.concat(data)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function log() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i - 0] = arguments[_i];\n }\n if (!args.length) {\n return;\n }\n var id = args[0] + '';\n var fn = logMap[id];\n if (fn) {\n fn.apply(void 0, args.slice(1));\n }\n else {\n console.log('log: ' + JSON.stringify(args));\n }\n}", "log(_args) {\n\n }", "function log() {\n return stream.write(util$3.format.apply(util$3, arguments) + '\\n');\n}", "function log() {\n return stream.write(util$3.format.apply(util$3, arguments) + '\\n');\n}", "function logger(...params){\n console.log(params);\n}", "function logSomething(log) { log.info('something'); }", "function testLog(...args) {\n const rendered = args.map(arg =>\n typeof arg === 'string' ? arg : JSON.stringify(arg, abbreviateReplacer),\n );\n ephemeral.log.push(rendered.join(''));\n }", "function log() {\n\t\t return stream.write(util.format.apply(util, arguments) + '\\n');\n\t\t}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}" ]
[ "0.67879707", "0.6533823", "0.6361992", "0.6361992", "0.6291028", "0.6206539", "0.619093", "0.61777097", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527" ]
0.6722094
1
Return unit number m. Argument: m Unit number Return: Unit object
function unit(m) { if (alternateUnitAvailable(m) && my.settings.unit == my.UNIT.ALTERNATE) { return Units.alternate[m - Units.alternateStart] } else { return Units.main[m - 1] } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function m(t, n, r) {\n return t.units[n][r];\n }", "get unit () {\n\t\treturn this._unit;\n\t}", "function calculateUnitValue(i) {\n\tif (getUnit(i) === \"in\") return 1;\n\telse if (getUnit(i) === \"cm\") return .3937;\n\telse return 0;\n}", "get unit() {\n\t\treturn this.__unit;\n\t}", "function cmToMm(cm) {\n const mm = cm * 10;\n return mm;\n}", "function kilometerToMeter(kmUnit) {\n \n var meter = kmUnit * 1000;\n\n if (kmUnit > 0) {\n return meter;\n }\n else {\n return \"Length cannot be Negative\";\n }\n}", "function handleUnit(unit) {\n switch(unit) {\n case \"MT\":\n return \"Minutes\";\n case \"HT\":\n return \"Hours\";\n case \"D\":\n return \"Days\";\n case \"M\":\n return \" Months\";\n default:\n return \"\";\n }\n}", "function getMaterialConversionUnit() {\n\tif (!material_conversion['conversion_flag']) {\n\t return 'KG';\n\t} else {\n return material_conversion[getFieldValueById('trxtransactiondetails-net_unit')]['unit'];\n\t}\n}", "function getUnit(input) {\n return String(input).match(/[\\d.\\-+]*\\s*(.*)/)[1] || '';\n} // Emulate the sass function \"unitless\"", "function getUnit(input) {\n return String(input).match(/[\\d.\\-+]*\\s*(.*)/)[1] || '';\n} // Emulate the sass function \"unitless\"", "function getUnit(input) {\n return String(input).match(/[\\d.\\-+]*\\s*(.*)/)[1] || '';\n} // Emulate the sass function \"unitless\"", "function getUnit(input) {\n return String(input).match(/[\\d.\\-+]*\\s*(.*)/)[1] || '';\n} // Emulate the sass function \"unitless\"", "function getUnit(input) {\n return String(input).match(/[\\d.\\-+]*\\s*(.*)/)[1] || '';\n} // Emulate the sass function \"unitless\"", "function getUnit(input) {\n return String(input).match(/[\\d.\\-+]*\\s*(.*)/)[1] || '';\n} // Emulate the sass function \"unitless\"", "function getUnit(input) {\n return String(input).match(/[\\d.\\-+]*\\s*(.*)/)[1] || '';\n} // Emulate the sass function \"unitless\"", "function getUnit(input) {\n return String(input).match(/[\\d.\\-+]*\\s*(.*)/)[1] || '';\n} // Emulate the sass function \"unitless\"", "function getUnit(input) {\n return String(input).match(/[\\d.\\-+]*\\s*(.*)/)[1] || '';\n} // Emulate the sass function \"unitless\"", "function getUnit(input) {\n return String(input).match(/[\\d.\\-+]*\\s*(.*)/)[1] || '';\n} // Emulate the sass function \"unitless\"", "static setUnitMetric(unit) {\n if (unit === 'm' || unit === 'metres') {\n return `&units=metric`;\n }\n return ``;\n }", "function units(num) {\n\treturn num*CELL_SIZE + UNIT_NAME;\n}", "units() {\n return this.growRight('#Unit').match('#Unit$')\n }", "function get_units() {\n switch(cookie['units'])\t{\n case \"mi\":\treturn \"Miles\"; break;\n case \"nm\":\treturn \"Naut.M\"; break;\n default:\treturn \"KM\"; break;\n }\n}", "function toMm(val) {\n if (val === undefined) {\n return undefined;\n }\n var unit = val.substring(val.length - 2);\n var value = stripUnit(val);\n if (unit === \"cm\") {\n return value * 10;\n } else if (unit === \"in\") {\n return value * 25.4;\n } else if (unit === \"pt\" || unit === \"px\") {\n return value * 25.4 / 72;\n } else if (unit === \"pc\") {\n return value * 25.4 / 72 * 12;\n } else if (unit === \"mm\") {\n return value;\n } else {\n return undefined;\n }\n\n function stripUnit(val) {\n return new Number(val.substring(0, val.length - 2));\n}\n\n}", "function getUnitValue(u) { return (u.value != undefined) ? u.value : u; }", "get unitFormatted() {\r\n\t\treturn this.count > 1 ? this.unit + 's' : this.unit;\r\n\t}", "function kilometerToMeter(kiloMeterUnit) {\n if (kiloMeterUnit > 0) {\n var meterUnit = kiloMeterUnit*1000;\n return meterUnit;\n\n\n }\n else {\n return \"The meter unit value can not be negative\";\n }\n}", "function em(value) {\n return unit * value;\n}", "function em(value) {\n return unit * value;\n}", "function em(value) {\n return unit * value;\n}", "function em(value) {\n return unit * value;\n}" ]
[ "0.70042497", "0.68661445", "0.68420166", "0.6795911", "0.6646663", "0.66201526", "0.6605138", "0.6602586", "0.6594072", "0.6594072", "0.6594072", "0.6594072", "0.6594072", "0.6594072", "0.6594072", "0.6594072", "0.6594072", "0.6594072", "0.6593717", "0.65248364", "0.65179926", "0.6481319", "0.6464521", "0.6446638", "0.6400559", "0.63985634", "0.63667417", "0.63667417", "0.6339334", "0.6339334" ]
0.78354245
0
Return true if an alternate unit is available for unit number m. Argument: m Unit number Return: true if an alternate unit is available; false otherwise
function alternateUnitAvailable(m) { if (m >= Units.alternateStart && m < Units.alternateStart + Units.alternate.length) { return true } else { return false } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function unit(m)\n {\n if (alternateUnitAvailable(m) &&\n my.settings.unit == my.UNIT.ALTERNATE) {\n return Units.alternate[m - Units.alternateStart]\n } else {\n return Units.main[m - 1]\n }\n }", "metricTypeMatching (unitType, unitTypeTo) {\n switch (unitType) {\n case 'kg':\n if (unitTypeTo !== 'g' && unitTypeTo !== 'kg') return false\n break;\n case 'g':\n if (unitTypeTo !== 'g' && unitTypeTo !== 'kg') return false\n break;\n case 'l':\n if (unitTypeTo !== 'ml' && unitTypeTo !== 'l') return false\n break;\n case 'ml':\n if (unitTypeTo !== 'ml' && unitTypeTo !== 'l') return false\n break;\n case 'db':\n if (unitTypeTo !== 'db') return false\n break;\n default:\n return false\n }\n return true\n }", "function isUseUnitLt(useUnit, sgUnit) {\n if (sgUnit == \"year\" && (useUnit == \"month\" || useUnit == \"day\" || useUnit == \"hm\")) {\n return true;\n } else if (sgUnit == \"month\" && (useUnit == \"day\" || useUnit == \"hm\")) {\n return true;\n } else if (sgUnit == \"day\" && (useUnit == \"hm\")) {\n return true\n }\n return false;\n }", "function unit() {\n var errors = document.querySelector(\"#errors\");\n var unitNum = document.querySelector(\"#unit\");\n var num = unitNum.value.trim();\n var patt = /^[0-9]{1,4}$/g;\n if(!patt.test(num)) {\n errorMessage(\"<p>Please enter a valid unit number</p>\");\n return false; \n } \n else {\n return true;\n }\n}", "function isUnitModel(model) {\n return model && model.type === 'unit';\n}", "verify(m, mm) {\n const a = m.elements, aa = mm.elements, d = [], sa = [];\n let flag = true, i;\n for (i = 0; i < a.length; i++) {\n d[i] = Math.abs(a[i] - aa[i]);\n sa.push(\"a[\" + i + \"]=\" + a[i] + \" aa[\" + i + \"]=\" + aa[i] + \" d[i]=\" + d[i]);\n if (Math.abs(d[i]) > 0.01) {\n flag = false;\n for (i = 0; i < sa.length; i++) {\n console.error(\"error: \" + sa[i]);\n }\n break;\n }\n }\n return flag;\n }", "function isUnitSupported(unit) {\n try {\n new Intl.NumberFormat(undefined, {\n style: 'unit',\n unit,\n });\n }\n catch (e) {\n return false;\n }\n return true;\n }", "function isUnitModel(model) {\n return model && model.type === 'unit';\n }", "isActive(){\n return this._units.some(unit => unit.isActive());\n }", "hasVillager(){\n let villagerFound = false;\n for(let unit of this.units){\n if(unit.getType() === \"Villager\"){\n villagerFound = true;\n }\n }\n\n return villagerFound;\n }", "function isInSelection(unit, adminUnitSelected) {\n if (!adminUnitSelected || !unit) { return false; }\n return unit.get(adminUnitSelected.admin) === adminUnitSelected.name;\n }", "function isUnitModel(model) {\n return (model === null || model === void 0 ? void 0 : model.type) === 'unit';\n }", "function toggleUnit()\n {\n var newUnit\n var confirmMessage\n\n if (my.settings.unit == my.UNIT.MAIN) {\n newUnit = my.UNIT.ALTERNATE\n confirmMessage = Units.alternateConfirmMessage\n } else {\n newUnit = my.UNIT.MAIN\n confirmMessage = Units.mainConfirmMessage\n }\n\n if (!confirm(confirmMessage)) {\n return false\n }\n\n localStorage.unit = newUnit\n loadSettings()\n updateUnitFromURL()\n return false\n }", "function check_current_height_weight_unit(height_unit, weight_unit){\r\n\t\tif(height_unit == \"cm\"){\r\n\t\t\tcm_flag = 1;\r\n\t\t\th_flag = 2;\r\n\t\t}else{\r\n\t\t\tft_inch_flag = 1;\r\n\t\t\th_flag = 1;\r\n\t\t}\r\n\t\t\r\n\t\tif(weight_unit == \"kg\"){\r\n\t\t\tkg_flag = 1;\r\n\t\t}else{\r\n\t\t\tlbs_flag = 1;\r\n\t\t}\r\n\t}", "function checkLettre(m) {\n for (let b = 0; b < m.length; b++) {\n if (lettre == m[b]) {\n return true;\n }\n }\n}", "function specLikeMFL() {\n return ((specLateral[LCL_MM_FOOD] >= 1) &&\n\t (specDiagonal[LCL_MM_HOME] >= 1) &&\n\t (specTotal[LCL_CLEAR] >= 2) &&\n\t (specTotal[LCL_ML1] + specTotal[LCL_ML3] >= 1));\n}", "function unitHref(m, n)\n {\n if (typeof m == 'undefined') {\n return ''\n } else if (typeof n == 'undefined') {\n return '#' + m\n } else {\n return '#' + m + '.' + n\n }\n }", "get isUseFileUnitsSupported() {}", "function hasMND(data){\r\n if (data[0].type === 'MND' || data[data.length - 1].type === 'MND'){\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "function mtMtCheck(tin) {\n if (tin.length !== 9) {\n // No tests for UTR\n var chars = tin.toUpperCase().split(''); // Fill with zeros if smaller than proper\n\n while (chars.length < 8) {\n chars.unshift(0);\n } // Validate format according to last character\n\n\n switch (tin[7]) {\n case 'A':\n case 'P':\n if (parseInt(chars[6], 10) === 0) {\n return false;\n }\n\n break;\n\n default:\n {\n var first_part = parseInt(chars.join('').slice(0, 5), 10);\n\n if (first_part > 32000) {\n return false;\n }\n\n var second_part = parseInt(chars.join('').slice(5, 7), 10);\n\n if (first_part === second_part) {\n return false;\n }\n }\n }\n }\n\n return true;\n}", "assignUnits(state, cell, digit) {\n for (const unit of S.unitList[cell]) {\n let places = unit.map(u => state[u].includes(digit) ? u : false).filter(m => m !== false);\n if (places.length === 0) {\n this.logMessage(\"Contradiction: no place for \" + digit + \" in \" + S.unitName(unit), state);\n return false;\n }\n if (places.length === 1) {\n if (state[places[0]].length > 1) {\n this.logMessage(S.unitName(unit) + \" has only one place for \" + digit + \" at \" + places[0]);\n }\n if (!this.assign(state, places[0], digit)) {\n return false;\n }\n }\n }\n return true;\n }", "function determineUnit(minUnit, min, max, maxTicks) {\n\t\tvar units = Object.keys(interval);\n\t\tvar unit;\n\t\tvar numUnits = units.length;\n\n\t\tfor (var i = units.indexOf(minUnit); i < numUnits; i++) {\n\t\t\tunit = units[i];\n\t\t\tvar unitDetails = interval[unit];\n\t\t\tvar steps = (unitDetails.steps && unitDetails.steps[unitDetails.steps.length - 1]) || unitDetails.maxStep;\n\t\t\tif (steps === undefined || Math.ceil((max - min) / (steps * unitDetails.size)) <= maxTicks) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn unit;\n\t}", "function swieta(d, m)\n{\n if( d==1 && m==0 || d==6 && m==0 || d==ruchome[0] && m==ruchome[1] || d==1 && m==4 || d==3 && m==4 || d==ruchome[2] && m==ruchome[3] || d==15 && m==7 || d==1 && m==10 || d==11 && m==10 || d==25 && m==11 || d==26 && m==11 )\n {\n return true;\n }\n else \n {\n return false;\n }\n}", "function is_medicare(MN) {\n var medicareNumber;\n var pattern;\n var length;\n var matches;\n var base;\n var checkDigit;\n var total;\n var multipliers;\n var isValid;\n\n pattern = /^(\\d{8})(\\d)/;\n medicareNumber = MN.toString().replace(/ /g, '');\n length = 11;\n\n if (medicareNumber.length === length) {\n matches = pattern.exec(medicareNumber);\n if (matches) {\n base = matches[1];\n checkDigit = matches[2];\n total = 0;\n multipliers = [1, 3, 7, 9, 1, 3, 7, 9];\n\n for (var i = 0; i < multipliers.length; i++) {\n total += base[i] * multipliers[i];\n }\n\n isValid = (total % 10) === Number(checkDigit);\n } else {\n isValid = false;\n }\n } else {\n isValid = false;\n }\n\n return isValid;\n}", "usdcPathExists(fromMint, toMint) {\n const fromMarket = this.tokenList\n .getList()\n .filter((t) => t.address === fromMint.toString())\n .filter((t) => { var _a; return ((_a = t.extensions) === null || _a === void 0 ? void 0 : _a.serumV3Usdc) !== undefined; })[0];\n const toMarket = this.tokenList\n .getList()\n .filter((t) => t.address === toMint.toString())\n .filter((t) => { var _a; return ((_a = t.extensions) === null || _a === void 0 ? void 0 : _a.serumV3Usdc) !== undefined; })[0];\n return fromMarket !== undefined && toMarket !== undefined;\n }", "function mtMtCheck(tin) {\n if (tin.length !== 9) {\n // No tests for UTR\n var chars = tin.toUpperCase().split(''); // Fill with zeros if smaller than proper\n while(chars.length < 8)chars.unshift(0);\n // Validate format according to last character\n switch(tin[7]){\n case 'A':\n case 'P':\n if (parseInt(chars[6], 10) === 0) return false;\n break;\n default:\n var first_part = parseInt(chars.join('').slice(0, 5), 10);\n if (first_part > 32000) return false;\n var second_part = parseInt(chars.join('').slice(5, 7), 10);\n if (first_part === second_part) return false;\n }\n }\n return true;\n}", "function containsTimeUnit(fullTimeUnit, timeUnit) {\n var index = fullTimeUnit.indexOf(timeUnit);\n\n if (index < 0) {\n return false;\n } // exclude milliseconds\n\n\n if (index > 0 && timeUnit === 'seconds' && fullTimeUnit.charAt(index - 1) === 'i') {\n return false;\n } // exclude dayofyear\n\n\n if (fullTimeUnit.length > index + 3 && timeUnit === 'day' && fullTimeUnit.charAt(index + 3) === 'o') {\n return false;\n }\n\n if (index > 0 && timeUnit === 'year' && fullTimeUnit.charAt(index - 1) === 'f') {\n return false;\n }\n\n return true;\n }", "function checkHitTest(p, m) {\n\tvar i=0, wlen= planComponents.walls.length, flen= planComponents.fornitures.length, toRet=0;\n\t\n\tfor (i=flen-1;i>=0;i--) {\n\t\tif (planComponents.fornitures[i].hitTest(p, m)) {\n\t\t\ttoRet=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tif (toRet) {\n\t\treturn 1;\n\t}\n\t\n\tfor (i=wlen-1;i>=0;i--) {\n\t\tif (planComponents.walls[i].hitTest(p, m)) {\n\t\t\ttoRet= 1;\n\t\t\tbreak ;\n\t\t}\n\t}\n\t\n\treturn toRet;\n}", "function isBase(unitList) {\n return unitList.length === 1\n && Math.abs(unitList[0].power - 1.0) < 1e-15\n && Object.keys(unitList[0].unit.dimension).length === 1\n && unitList[0].unit.dimension[Object.keys(unitList[0].unit.dimension)[0]] === 1;\n}", "function GetInternalUnit()\n{\n\treturn m_internalUnit;\n}" ]
[ "0.7132564", "0.5845576", "0.5764157", "0.5596584", "0.5589817", "0.55570203", "0.5511924", "0.54607326", "0.5388938", "0.53454024", "0.5287075", "0.5208508", "0.519486", "0.51917964", "0.5117975", "0.50865567", "0.50762963", "0.5061085", "0.5053876", "0.50512236", "0.5026597", "0.4898522", "0.48809773", "0.48480073", "0.48469317", "0.48431376", "0.48269847", "0.48121962", "0.48066226", "0.47816533" ]
0.8651971
0
Display the unit links
function displayUnitLinks() { // Delete all existing unit links var linksDiv = my.html.unitLinks Util.removeChildren(linksDiv) // Create new unit links for (var i = 0; i < Units.main.length; i++) { var label = 'སློབ་མཚན། ' + (i + 1) var selected = (i + 1 == my.current.unitNo) var href = unitHref(i + 1) var divElement = boxedLink(label, selected, href) divElement.id = 'unit' + (i + 1) divElement.title = unit(i + 1).title linksDiv.appendChild(divElement) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displaySubunitLinks()\n {\n // Delete all existing subunit links\n var linksDiv = my.html.subunitLinks\n while (linksDiv.firstChild &&\n linksDiv.firstChild.className != 'stretch') {\n\n linksDiv.removeChild(linksDiv.firstChild)\n }\n\n // Create new subunit links for the unit m\n var numberOfSubunits = my.current.subunitTitles.length\n for (var i = numberOfSubunits - 1; i >= 0; i--) {\n // Insert whitespaces between div elements, otherwise they\n // would not be justified\n var whitespace = document.createTextNode('\\n')\n linksDiv.insertBefore(whitespace, linksDiv.firstChild)\n\n var label = my.current.subunitTitles[i]\n var selected = (i + 1 == my.current.subunitNo)\n var href = unitHref(my.current.unitNo, i + 1)\n\n var subunitDiv = boxedLink(label, selected, href)\n subunitDiv.id = 'subunit' + (i + 1)\n subunitDiv.style.width = (95 / numberOfSubunits) + '%'\n\n linksDiv.insertBefore(subunitDiv, linksDiv.firstChild)\n }\n }", "function displayAlternateUnitLinks()\n {\n // If alternate unit is not available for the current unit,\n // hide the alternate links element\n if (!alternateUnitAvailable(my.current.unitNo)) {\n alternateUnitLinks.style.visibility = 'hidden'\n return\n }\n\n // Delete all existing alternate unit links\n Util.removeChildren(alternateUnitLinks)\n\n // Create div elements for the main unit and alternate unit\n var mainUnitElement =\n boxedLink(Units.mainLabel,\n my.settings.unit == my.UNIT.MAIN,\n '#', toggleUnit)\n\n var alternateUnitElement =\n boxedLink(Units.alternateLabel,\n my.settings.unit == my.UNIT.ALTERNATE,\n '#', toggleUnit)\n\n alternateUnitLinks.appendChild(mainUnitElement)\n alternateUnitLinks.appendChild(alternateUnitElement)\n alternateUnitLinks.style.visibility = 'visible'\n }", "function renderUnit(unit) {\n return crel('li',\n crel('span', {'class':'naam'}, unit.naam), \n crel('span', {'class':'afkorting'}, unit.afkorting),\n crel('span', {'class':'wikilink'},\n crel ('a', {'href':unit.wikilink},unit.wikilink)),\n crel('span', {'class':'wow'}, unit.wieofwat),\n crel('span', {'class':'foto'}, \n crel ('img', {'src': unit.foto})),\n )\n }", "show() {\n for (let node of this.nodes) {\n node.show();\n node.showLinks();\n }\n }", "function displayUnitTitle() {\n\n // Parts of the unit title\n var unitNo = 'སློབ་མཚན། ' + my.current.unitNo +\n '.' + my.current.subunitNo\n var space = '\\u00a0\\u00a0'\n var title = '[' + my.current.unit.title + ']'\n\n Util.setChildren(my.html.unitTitle, unitNo, space, title)\n }", "function updateNavigationLinks()\n {\n if (currentSubunitIsTheFirstSubunit()) {\n my.html.previousLink.style.visibility = 'hidden'\n my.html.nextLink.style.visibility = 'visible'\n } else if (currentSubunitIsTheLastSubunit()) {\n my.html.previousLink.style.visibility = 'visible'\n my.html.nextLink.style.visibility = 'hidden'\n } else {\n my.html.previousLink.style.visibility = 'visible'\n my.html.nextLink.style.visibility = 'visible'\n }\n }", "function unit() {\n // Add more tests here.\n return linkUnit();\n}", "function unitHref(m, n)\n {\n if (typeof m == 'undefined') {\n return ''\n } else if (typeof n == 'undefined') {\n return '#' + m\n } else {\n return '#' + m + '.' + n\n }\n }", "function showUnits() {\n console.log(\"showUnits()\");\n units.forEach(unit => {\n /*\n // add unit names to page\n var unitName = document.createElement(\"h1\");\n unitName.innerText = unit.fields.name;\n document.body.appendChild(unitName);\n\n // add unit location to page\n unitLocation = document.createElement(\"p\");\n unitLocation.innerText = unit.fields.location;\n document.body.appendChild(unitLocation);\n\n // add image to page\n var unitImage = document.createElement(\"img\");\n unitImage.src = unit.fields.image[0].url;\n document.body.appendChild(unitImage); */\n\n // creating a new div container, where our unit info will go\n var unitContainer = document.createElement(\"div\");\n unitContainer.classList.add(\"unit-container\");\n document.querySelector(\".container\").append(unitContainer);\n\n // add unit names to unit container\n var unitName = document.createElement(\"h2\");\n unitName.classList.add(\"unit-name\");\n unitName.innerText = unit.fields.name;\n unitContainer.append(unitName);\n\n // add location to unit container\n var unitLocation = document.createElement(\"h3\");\n unitLocation.classList.add(\"unit-location\");\n unitLocation.innerText = unit.fields.location;\n unitLocation.style.color = \"#5F5C4F\";\n unitContainer.append(unitLocation);\n\n // add description to container\n var unitDescription = document.createElement(\"p\");\n unitDescription.classList.add(\"unit-description\");\n unitDescription.innerText = unit.fields.description;\n unitContainer.append(unitDescription);\n\n // add image to container\n var unitImage = document.createElement(\"img\");\n unitImage.classList.add(\"unit-image\");\n unitImage.src = unit.fields.image[0].url;\n unitContainer.append(unitImage);\n\n // add event listener\n // when user clicks on unit container\n // image and description will appear or disappear\n unitContainer.addEventListener(\"click\", function() {\n unitDescription.classList.toggle(\"active\");\n unitImage.classList.toggle(\"active\");\n });\n\n // add to each container as a class\n var unitCh = unit.fields.chapter;\n console.log(unitCh);\n unitContainer.classList.add(unitCh);\n\n // filter by chapter 2\n var filterCh2 = document.querySelector(\".ch2\");\n filterCh2.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter2\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh3 = document.querySelector(\".ch3\");\n filterCh3.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter3\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh4 = document.querySelector(\".ch4\");\n filterCh4.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter4\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh5 = document.querySelector(\".ch5\");\n filterCh5.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter5\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh6 = document.querySelector(\".ch6\");\n filterCh6.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter6\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh9 = document.querySelector(\".ch9\");\n filterCh9.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter9\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh13 = document.querySelector(\".ch13\");\n filterCh13.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter13\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh14 = document.querySelector(\".ch14\");\n filterCh14.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter14\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh17 = document.querySelector(\".ch17\");\n filterCh17.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter17\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var reset = document.querySelector(\".reset\");\n reset.addEventListener(\"click\", function(){\n unitContainer.style.background = \"#9f9b86\";\n })\n });\n}", "function linkDisplay (numLinks,urlList) {\r\n let i = 0;\r\n console.log(urlList);\r\n while( i < numLinks ) {\r\n let link = 'link:'+(i+1);\r\n let url = urlList[i];\r\n let linkLocation = document.getElementById(link);\r\n linkLocation.innerHTML = url;\r\n linkLocation.setAttribute('href',url);\r\n linkLocation.setAttribute('target','_blank');\r\n i++;\r\n }\r\n}", "function setup_metacpan_links() {\n $('a[href^=\"/dist/overview/\"]').each(\n function() {\n var module = this.href.match('/dist/overview/(.*)$')[1].replace('-', '::', 'g');\n console.log(\"module = \" + module);\n $(this).after('&nbsp;' + '<a href=\"http://metacpan.org/module/' + module + '\">' + metacpan_img + '</a>');\n });\n}", "function ShowLinks(linkId) { console.log(\"sellwood_px: ShowLinks called; this function is not defined in px.\"); }", "function displayGuide() {\n my.html.guide.innerHTML = my.current.unit.guide\n }", "mostrarTarefas() {\n printPlanejamentoAtual(this.getPlanejamentoAtual());\n printListaTarefa(this.listaQuadros());\n }", "function atLinks() {\n linklist = [\"239MTG\", \"affinityforartifacts\", \"alliesmtg\", \"AllStandards\", \"Alphabetter\", \"Amonkhet\", \"architectMTG\", \"ArclightPhoenixMTG\", \"aristocratsMTG\", \"BadMTGCombos\", \"basementboardgames\", \"BaSE_MtG\", \"BudgetBrews\", \"budgetdecks\", \"BulkMagic\", \"cardsphere\", \"casualmtg\", \"CatsPlayingMTG\", \"CircuitContest\", \"cocomtg\", \"CompetitiveEDH\", \"custommagic\", \"DeckbuildingPrompts\", \"edh\", \"EDHug\", \"EggsMTG\", \"ElvesMTG\", \"enchantress\", \"EsperMagic\", \"findmycard\", \"fishmtg\", \"FlickerMTG\", \"freemagic\", \"goblinsMTG\", \"HamiltonMTG\", \"HardenedScales\", \"humansmtg\", \"infect\", \"johnnys\", \"kikichord\", \"lanternmtg\", \"lavaspike\", \"locketstorm\", \"lrcast\", \"magicarena\", \"Magicdeckbuilding\", \"MagicDuels\", \"magicTCG\", \"magicTCG101\", \"MakingMagic\", \"marchesatheblackrose\", \"marduMTG\", \"MentalMentalMagic\", \"millMTG\", \"ModernLoam\", \"modernmagic\", \"ModernRecMTG\", \"modernspikes\", \"ModernZombies\", \"monobluemagic\", \"mtg\", \"MTGAngels\", \"mtgbattlebox\", \"mtgbracket\", \"mtgbrawl\", \"mtgbudgetmodern\", \"mtgcardfetcher\", \"mtgcube\", \"MTGDredge\", \"mtgfinalfrontier\", \"mtgfinance\", \"mtgfrontier\", \"mtglegacy\", \"MTGManalessDredge\", \"MTGMaverick\", \"mtgmel\", \"mtgrules\", \"mtgspirits\", \"mtgtreefolk\", \"mtgvorthos\", \"neobrand\", \"nicfitmtg\", \"oathbreaker_mtg\", \"oldschoolmtg\", \"pauper\", \"PauperArena\", \"PauperEDH\", \"peasantcube\", \"PennyDreadfulMTG\", \"PioneerMTG\", \"planeshiftmtg\", \"ponzamtg\", \"RatsMTG\", \"RealLifeMTG\", \"RecklessBrewery\", \"rpg_brasil\", \"scapeshift\", \"shittyjudgequestions\", \"sistersmtg\", \"skredred\", \"Sligh\", \"spikes\", \"stoneblade\", \"StrangeBrewEDH\", \"SuperUltraBudgetEDH\", \"therandomclub\", \"Thoptersword\", \"threecardblind\", \"TinyLeaders\", \"TronMTG\", \"UBFaeries\", \"uwcontrol\", \"xmage\", \"reddit.com/message\", \"reddit.com/user/MTGCardFetcher\"]\n\n for (j = 0; j < linklist.length; j++) {\n if (location.href.toLowerCase().includes(linklist[j].toLowerCase()))\n return true;\n }\n return false;\n}", "function currentSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n window.location.href = unitHref(m, n)\n }", "function display() {\n\treturn {\n\t\tdisplayStores: function() {\n\t\t\tfor (var i = 0; i < stores.length; i++) {\n\t\t\t\t$('<a class=\"storeLink\"></a>').appendTo('#mainDiv').append($('<img>').attr('src', stores[i].src))\n\t\t\t}\n\n\t\t\t$('.storeLink').click(function() {\n\t\t\t\tnewPage();\n\t\t\t\t\tfor (var i = 0; i < products.length; i++) {\n\t\t\t\t\t\t$('#mainDiv').append($('<a id=\"productLink\"></a>')\n\t\t\t\t\t\t.append($('<img>').attr('src', products[i].src))).append(products[i].name + '\\n' + products[i].price + '\\n' + products[i].size, $('<input type=\"checkbox\">').attr('id',i))\n\t\t\t\t\t}\n\n\t\t\t\t$('#mainDiv').append(\n\t\t\t\t buttons()\n\t\t\t\t)\n\t\t\t});\n\t\t},\n\n\t\tdisplayMen: function() {\n\t\t\tnewPage();\n\t\t\tfor (var i = 0; i < products.length; i++) {\n\t\t\t\tif (products[i].cat === 'men') {\n\t\t\t\t\tconsole.log(i)\n\t\t\t\t\t$('#mainDiv').append($('<a id=\"productLink\"></a>')\n\t\t\t\t\t.append($('<img>').attr('src', products[i].src))).append(products[i].name + '\\n' + products[i].price + '\\n' +products[i].size)\n\t\t\t\t\t.append($('<input type=\"checkbox\">').attr('id', i))\n\t\t\t\t\t.append(buttons());\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tdisplayWomen: function() {\n\t\t\tnewPage();\n\t\t\tfor (var i = 0; i < products.length; i++) {\n\t\t\t\tif (products[i].cat === 'women') {\n\t\t\t\t\t$('#mainDiv').append($('<a id=\"productLink\"></a>')\n\t\t\t\t\t.append($('<img>').attr('src', products[i].src))).append(products[i].name + '\\n' + products[i].price + '\\n' +products[i].size)\n\t\t\t\t\t.append($('<input type=\"checkbox\">').attr('id', i))\n\t\t\t\t\t.append(buttons());\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tdisplayKids: function() {\n\t\t\tnewPage();\n\t\t\tfor (var i = 0; i < products.length; i++) {\n\t\t\t\tif (products[i].cat === 'kids') {\n\t\t\t\t\t$('#mainDiv').append($('<a id=\"productLink\"></a>')\n\t\t\t\t\t.append($('<img>').attr('src', products[i].src))).append(products[i].name + '\\n' + products[i].price + '\\n' +products[i].size)\n\t\t\t\t\t.append($('<input type=\"checkbox\">').attr('id', i))\n\t\t\t\t\t.append(buttons());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function showLinks (delay) {\n // Show links\n\n // This is kind of redundant, but as long as the link arrows have not been\n // moved to user control layer, keep calling the modeSwitchWalkClick()\n // to bring arrows to the top layer. Once loaded, move svLinkArrowsLoaded to true.\n if (!status.svLinkArrowsLoaded) {\n var numPath = $divViewControlLayer.find(\"path\").length;\n if (numPath === 0) {\n makeLinksClickable();\n } else {\n status.svLinkArrowsLoaded = true;\n }\n }\n\n if (status.hideNonavailablePanoLinks &&\n status.availablePanoIds) {\n $.each($('path'), function (i, v) {\n if ($(v).attr('pano')) {\n var panoId = $(v).attr('pano');\n var idx = status.availablePanoIds.indexOf(panoId);\n\n if (idx === -1) {\n $(v).prev().prev().remove();\n $(v).prev().remove();\n $(v).remove();\n } else {\n //if (properties.browser === 'chrome') {\n // Somehow chrome does not allow me to select path\n // and fadeOut. Instead, I'm just manipulating path's style\n // and making it hidden.\n $(v).prev().prev().css('visibility', 'visible');\n $(v).prev().css('visibility', 'visible');\n $(v).css('visibility', 'visible');\n }\n }\n });\n } else {\n if (properties.browser === 'chrome') {\n // Somehow chrome does not allow me to select path\n // and fadeOut. Instead, I'm just manipulating path's style\n // and making it hidden.\n $('path').css('visibility', 'visible');\n } else {\n if (!delay) {\n delay = 0;\n }\n // $('path').show();\n $('path').css('visibility', 'visible');\n }\n }\n }", "function displayLinks(anchors, url){\n\t//none found\n\tif(anchors.length == 0){\n\t\t$('#results').innerHTML = \"Sorry. No links were found on this page. Are you sure you typed the correct url?\"\n\t}\n\telse{\n\t\t$('#results').innerHTML = `<h2>Results for ${url}</h2>`;\n\t}\n\n\t//go through anchors array, adding one by one to DOM.\n\tfor(let i in anchors){\n\t\t$('#results').append(`${anchors[i]}<br/>`);\n\t\tformatUrl(url);\n\t}\n\n\treturn;\n}", "function quickLinks(){\n\t\tvar menu = find(\"//td[@class='menu']\", XPFirst);\n\t\tfor (var j = 0; j < 2; j++) for (var i = 0; i < menu.childNodes.length; i++) if (menu.childNodes[i].nodeName == 'BR') removeElement(menu.childNodes[i]);\n\t\tmenu.innerHTML += '<hr/>';\n\t\tmenu.innerHTML += '<a href=\"login.php\">' + T('LOGIN') + '</a>';\n\t\tmenu.innerHTML += '<a href=\"allianz.php\">' + T('ALIANZA') + '</a>';\n\t\tmenu.innerHTML += '<a href=\"a2b.php\">' + T('ENV_TROPAS') + '</a>';\n\t\tmenu.innerHTML += '<a href=\"warsim.php\">' + T('SIM') + '</a>';\n\t\tmenu.innerHTML += '<hr/>';\n\t\tmenu.innerHTML += '<a href=\"http://trcomp.sourceforge.net/?lang=' + idioma + '\" target=\"_blank\">' + T('COMP') + '</a>';\n//\t\tmenu.innerHTML += '<a href=\"http://travmap.shishnet.org/?lang=' + idioma + '\" target=\"_blank\">' + T('MAPA') + '</a>';\n//\t\tmenu.innerHTML += '<a href=\"http://www.denibol.com/~victor/travian_calc/\" target=\"_blank\">' + T('CALC') + '</a>';\n\t\tmenu.innerHTML += '<a href=\"http://www.denibol.com/proyectos/travian_beyond/\" target=\"_blank\">Travian Beyond</a>';\n\t}", "function showUSGSLinks(evt){\n\t//check to see if there is already an existing linksDiv so that it is not build additional linksDiv. Unlikely to occur since the usgsLinks div is being destroyed on mouseleave.\n\tif (!dojo.byId('usgsLinks')){\n\t\t//create linksDiv\n\t\tvar linksDiv = dojo.doc.createElement(\"div\");\n\t\tlinksDiv.id = 'usgsLinks';\n\t\t//LINKS BOX HEADER TITLE HERE\n\t\tlinksDiv.innerHTML = '<div class=\"usgsLinksHeader\"><b>USGS Links</b></div>';\n\t\t//USGS LINKS GO HERE\n\t\tlinksDiv.innerHTML += '<p>';\n\t\tlinksDiv.innerHTML += '<a style=\"color:white\" target=\"_blank\" href=\"http://www.usgs.gov/\">USGS Home</a><br />';\n\t\tlinksDiv.innerHTML += '<a style=\"color:white\" target=\"_blank\" href=\"http://www.usgs.gov/ask/\">Contact USGS</a><br />';\n\t\tlinksDiv.innerHTML += '<a style=\"color:white\" target=\"_blank\" href=\"http://search.usgs.gov/\">Search USGS</a><br />';\n\t\tlinksDiv.innerHTML += '<a style=\"color:white\" target=\"_blank\" href=\"http://www.usgs.gov/laws/accessibility.html\">Accessibility</a><br />';\n\t\tlinksDiv.innerHTML += '<a style=\"color:white\" target=\"_blank\" href=\"http://www.usgs.gov/foia/\">FOIA</a><br />';\n\t\tlinksDiv.innerHTML += '<a style=\"color:white\" target=\"_blank\" href=\"http://www.usgs.gov/laws/privacy.html\">Privacy</a><br />';\n\t\tlinksDiv.innerHTML += '<a style=\"color:white\" target=\"_blank\" href=\"http://www.usgs.gov/laws/policies_notices.html\">Policies and Notices</a></p>';\n\t\t\n\t\t//place the new div at the click point minus 5px so the mouse cursor is within the div\n\t\tlinksDiv.style.top = evt.clientY-5 + 'px';\n\t\tlinksDiv.style.left = evt.clientX-5 + 'px';\n\t\t\n\t\t//add the div to the document\n\t\tdojo.byId('map').appendChild(linksDiv);\n\t\t//on mouse leave, call the removeLinks function\n\t\tdojo.connect(dojo.byId(\"usgsLinks\"), \"onmouseleave\", removeLinks);\n\n\t}\n}", "function displayDocuManager() {\n\n\t// clear\n\t$(\".controlContentBlock[id=compare-manage] > ol\").empty();\n\n\t// show each corpus\n\tfor (let corpusName in _dataset) {\n\t\tif (typeof _dataset[corpusName] !== 'object') continue;\n\t\tlet manageItem = \"<li name=\\\"\" + corpusName + \"\\\">\" + corpusName + \"</li>\";\n\t\tlet className = (_dataset[corpusName].isShow) ?\"glyphicon-eye-open\" :\"glyphicon-eye-close\";\n\t\tlet hideBtn = \"<span class=\\\"glyphicon \" + className + \"\\\" name=\\\"\" + corpusName + \"\\\" onclick=\\\"hideOrShowCorpus(this, '\"+corpusName+\"')\\\"></span>\";\n\t\tlet deleteBtn = \"<span class=\\\"glyphicon glyphicon-trash\\\" name=\\\"\" + corpusName + \"\\\" onclick=\\\"deleteCorpus('\" + corpusName + \"')\\\"></span>\";\n\t\t$(\".controlContentBlock[id=compare-manage] > ol\").append(manageItem + hideBtn + deleteBtn);\n\t}\n}", "function eLink(db,nm) {\n\tdbs = new Array(\"http://us.battle.net/wow/en/search?f=wowitem&q=\",\"http://www.wowhead.com/?search=\");\n\tdbTs = new Array(\"Armory\",\"Wowhead\");\n\tdbHs = new Array(\"&real; \",\"&omega; \");\n\tel = '<a href=\"'+ dbs[db]+nm + '\" target=\"_blank\" title=\"'+ dbTs[db] +'\">'+ dbHs[db] + '</a>';\n\treturn el;\n}", "populateUnitMenus() {\n\t\tlet category = this.m_catMenu.value;\n\t\tthis.m_unitAMenu.innerHTML = \"\";\n\t\tCONFIG[category].forEach(function(item) {\n\t\t\tGUI.m_unitAMenu.innerHTML += \"<option value=\\\"\" + item[0] + \"\\\">\" + item[1] + \"</option>\";\n\t\t});\n\t\t\n\t\tthis.m_unitBMenu.innerHTML = \"\";\n\t\tCONFIG[category].forEach(function(item) {\n\t\t\tGUI.m_unitBMenu.innerHTML += \"<option value=\\\"\" + item[0] + \"\\\">\" + item[1] + \"</option>\";\n\t\t});\n\t}", "function displayLinks() {\n $('[data-type=gallery] .image').each(function(index, item) {\n const link = $('a', item.parentNode);\n if (!link.get(0)) return;\n\n item = $(item);\n item.addClass('clickable');\n item.data('href', link.attr('href'));\n item.on('click', goto_article);\n });\n\n function goto_article(event) {\n let el = event.currentTarget;\n window.location = $(el).data('href');\n }\n}", "function displayLinks() {\n var x = document.links;\n var links = \"\";\n var i;\n for (i = 0; i < x.length; i++) {\n links = links + x[i].href + \"<br>\";\n }\n document.getElementById(\"links\").innerHTML = links;\n}", "printLinks() {\n this.links.forEach((link) => console.log(link));\n }", "function displayGenresList() {\n const genresValues = Object.values(genresTypes)\n const genresKeys = Object.keys(genresTypes)\n let htmlContent = ``\n for (let i = 0; i < genresValues.length; i++) {\n htmlContent += `<a class=\"nav-item nav-link border\" href=\"#\" data-genresid=\"${genresKeys[i]}\">${genresValues[i]}</a>`\n }\n genresList.innerHTML = htmlContent\n }", "generateLink() {\n return `\n <a href='https://en.wikipedia.org/wiki/${encodeURI(this.options[0])}' property='rdf:seeAlso'>\n ${this.options[0]}\n </a>&nbsp;\n `;\n }", "function setupLinks() {\n\tfor(let i = 0; i < 11; i++) {\n\t\tif(i == 10) { \n\t\t\tlinks[i] = createA('/resilience-repository/about.html', proj_names[i]);\n\t\t}\n\t\telse {\n\t\t\tlinks[i] = createA('/resilience-repository/projects/proj'+i+'.html', proj_names[i]);\n\t\t}\n\t}\n}" ]
[ "0.7937359", "0.7711603", "0.64367145", "0.6167931", "0.614548", "0.61015666", "0.60523754", "0.5939187", "0.5838429", "0.5720863", "0.56588864", "0.55833983", "0.55783045", "0.5575401", "0.55705994", "0.5568032", "0.55376863", "0.55354947", "0.5526451", "0.5490971", "0.54887956", "0.54759604", "0.54733926", "0.5454163", "0.545412", "0.5452656", "0.544991", "0.5424047", "0.541289", "0.53985363" ]
0.89430076
0
Create an HTML div element containing a label if the div element is specified as selected, and/or a hyperlink if the div element is specified as not selected. Arguments: label Label to be displayed inside the div element selected Whether the div element should be marked selected href Fragment identifier for the link to be created clickHandler Function to be invoked when the link is clicked Return: HTML div element with the label and/or link
function boxedLink(label, selected, href, clickHandler) { var divElement = document.createElement('div') if (selected) { var spanElement = document.createElement('span') Util.addChildren(spanElement, label) divElement.appendChild(spanElement) divElement.className = 'selected' } else { var anchorElement = document.createElement('a') anchorElement.href = href Util.addChildren(anchorElement, label) if (typeof clickHandler != 'undefined') { anchorElement.onclick = clickHandler } divElement.appendChild(anchorElement) } return divElement }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function formAnchorHtml(href, label) {\r\n\treturn \"<div class='linkContainer'>\" + label + \": <a href='\" + href + \"' target='_blank'>\" + href + \"</a></div>\";\r\n}", "function createLink(label,link){\n var newLink=$(\"<a>\", {\n title: label,\n href: link,\n class: \"toolbox_button\"\n }).append( label );\n return newLink;\n }", "function createBookNewsArea(){\n var myDiv = document.getElementById('arqsiWidgetBookNews_div'); \n\n var a = document.createElement(\"a\");\n var myNewsLabel = document.createTextNode(\"Novidades\");\n a.href = '#';\n a.onclick = afterNewsSelected;\n a.appendChild(myNewsLabel);\n myDiv.appendChild(a);\n\n}", "_onLabelClick(e) {\n if (this.disabled) return;\n if (e.target.nodeName === \"A\") {\n // If click on link within label, navigate\n return;\n }\n\n this.model = !this.model;\n this._emit(\"model-change\", {\n value: this.model,\n });\n // prevent click checkbox within <a></a> triggering navigation\n e.preventDefault();\n }", "function handleLinkClick(event) {\n\t\tvar linkLabel = event.currentTarget.id;\n\t\tvar url;\n\t\tswitch(linkLabel) {\n\t\t\tcase 'pivotal' :\n\t\t\t\turl = \"http://www.gopivotal.com/\";\n\t\t\t\twindow.open(url, '_blank');\n\t\t\t\tbreak;\n\t\t\tcase 'support' :\n\t\t\t\turl = \"https://support.gopivotal.com/hc/en-us\";\n\t\t\t\twindow.open(url, '_blank');\n\t\t\t\tbreak;\n\t\t\tcase 'feedback' :\n\t\t\t\turl = \"http://www.gopivotal.com/contact\";\n\t\t\t\twindow.open(url, '_blank');\n\t\t\t\tbreak;\n\t\t\tcase 'help' :\n\t\t\t\turl = \"../../static/docs/gpdb_only/index.html\";\n\t\t\t\twindow.open(url, '_blank');\n\t\t\t\tbreak;\n\t\t\tcase 'logout' :\n\t\t\t\tlogoutClick();\n\t\t\t\tbreak;\n\t\t}\n\t}", "function Label_CreateHTMLObject(theObject)\n{\n\t//create the label/link\n\tvar theHTML = document.createElement(\"div\");\n\t//simple add\n\ttheHTML = Basic_SetParent(theHTML, theObject);\n\t//set ourselves as directly the child container\n\ttheObject.HTMLParent = theHTML;\n\t//set its Basic Properties\n\tBasic_SetBasicProperties(theHTML, theObject);\n\t//never disable these\n\ttheHTML.disabled = false;\n\t//Updates the Cursor\n\tLabel_UpdateCursor(theHTML, theObject);\n\t//Update word break\n\tLabel_CheckMultiline(theHTML, theObject);\n\t//Update Caption\n\tBasic_UpdateCaption(theHTML, theObject);\n\t//Update Label Overflow\n\tLabel_UpdateOverFlow(theHTML, theObject);\n\t//update focus only\n\tLabel_UpdateOnFocusOnly(theHTML, theObject);\n\t//Update ShortCut\n\tLabel_UpdateShortCut(theHTML, theObject);\n\t//add a special post to correct the font\n\t__SIMULATOR.Interpreter.AddPostDisplayCmd(theObject.DataObject.Id, __INTERPRETER_CMD_RESET_FONT);\n\t//not TreeGrid Cell? nor a ultragrid\n\tif (!theObject.TreeGridCell && !theObject.UltraGrid)\n\t{\n\t\t//add events\n\t\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_MOUSEDOWN, Browser_CancelBubbleAndMenu);\n\t\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_CLICK, Label_MouseDown);\n\t\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_DOUBLECLICK, Label_MouseDown);\n\t\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_MOUSERIGHT, Label_MouseDown);\n\t\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_SELECTSTART, Label_MouseDown);\n\t\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_SCROLL, Simulator_OnScroll);\n\t\t//touch enabled?\n\t\tif (__BROWSER_IS_TOUCH_ENABLED)\n\t\t{\n\t\t\t//add double click listener\n\t\t\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_MOUSEDOWN, Label_TouchDoubleClick);\n\t\t}\n\t\t//install the dragging listener\n\t\tDragging_InstallListener(theObject, theHTML);\n\t}\n\t//add states listener\n\tBasic_SetStatesListener(theHTML);\n\t//mouseover event is always processed\n\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_MOUSEOVER, Label_MouseOver);\n\ttheHTML.State_OnFocus = Label_OnFocus;\n\ttheHTML.UpdateProperties = Label_UpdateProperties;\n\ttheHTML.GetDesignerName = Label_GetDesignerName;\n\t//return the newly created object\n\treturn theHTML;\n}", "function makeLink(parentElementLabel, childElementLabel) {\n\n return new joint.dia.Link({\n source: { id: parentElementLabel },\n target: { id: childElementLabel },\n attrs: { '.marker-target': { d: 'M 4 0 L 0 2 L 4 4 z' } },\n smooth: false\n });\n}", "function Item(label, handler, cssClass){\n this.label = label || \"\";\n this.elem = $(\"<li/>\").html(label);\n this.cssClass = cssClass;\n if(typeof cssClass !== 'undefined'){\n this.elem.addClass(cssClass);\n }\n\n if(typeof handler === 'function'){\n this.elem.click(handler);\n } else if(typeof handler === 'string') {\n this.elem.html(\"<a href=\" + handler + \" target='_blank'>\" + label + \"</a>\");\n }\n }", "function newPage(id,text){\n return $(\"<a id='\" + id + \"' href='#'>\" + text + \"</a>\").click(navigate);\n}//END newPage function", "function generateOnClick(onClickNewPage, onClickRoute) {\n if (onClickNewPage) {\n // Then we link to new page\n return () => window.location.href = onClickRoute;\n } else {\n // Link to div section\n return () => document.getElementById(onClickRoute).scrollIntoView();\n }\n}", "function makeLink(target, content) {\n // a local let\n\n let elemA = document.createElement(\"a\");\n\n // use the param \"target \" to go into the href\n elemA.href = target;\n //and the param \"content\" for what goes inside the tag\n elemA.innerText = content;\n\n // add an target Attribute for fun \n elemA.setAttribute(\"target\", \"_blank\");\n\n // a local divMain aswell \n let divMain = document.getElementsByTagName(\"div\");\n divMain[0].appendChild(elemA);\n}", "function Label(){\n this.createLabel =function(text,id){\n this.item=document.createElement('p');\n this.item.setAttribute(\"id\",id);\n var textLabel = document.createTextNode(text); \n this.item.appendChild(textLabel);\n \n },\n\n this.setText = function(text){\n this.item.innerHTML=text;\n\n }\n this.addtoDocument =function(){\n document.body.appendChild(this.item);\n }\n this.addtodiv=function(id){\n document.getElementById(id).appendChild(this.item);\n }\n}", "function anchorClicked(e) {\n e.preventDefault();\n const selectedBookEl = document.getElementById('selectedBook');\n if (!selectedBookEl) return;\n\n const self = this;\n const cell = self.parentElement;\n const row = cell.parentElement;\n const data = row.querySelectorAll('td');\n\n // Generate HTML details of selected book\n let bookData = `<ul class=\"book-details\">`;\n for (const field of data) {\n // console.log(field); // each <td>\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement\n bookData += `<li><b>${field.dataset.value}</b>: ${field.innerText}</li>`;\n }\n bookData += `</ul>`;\n\n selectedBookEl.innerHTML = bookData; // render\n}", "function createMenuItem(label, link, subMenu) {\n\t\treturn $('<li>').append(\n\t\t\t$('<a>', {\n\t\t\t\ttext: label,\n\t\t\t\thref: link\n\t\t\t}),\n\t\t\t(typeof subMenu === 'undefined') ? null : subMenu\n\t\t);\n\t}", "function handleClick(el,e) {\n\tloadURL(el.attributes.target,el.text);\n}", "function createLabel(htmlFor, text){\n\tconst label = document.createElement(\"label\");\n\tlabel.htmlFor = htmlFor;\n\tconst b = document.createElement(\"b\");\n\tb.textContent = text;\n\tlabel.appendChild(b);\n\treturn label;\n}", "_onLabelClick(ev) {\n const $target = $(ev.currentTarget);\n this.trigger('revisionSelected', [0, $target.data('revision')]);\n }", "function goLabel(labelId) {\n return labelHome(labelId);\n}", "function addLinkToDiv(parentId, func, title, text, addBr)\n{\n var parentNode = $(parentId);\n if (parentNode)\n {\n if (!addBr)\n {\n if ($$(\"#\" + parentId + \" a\").length > 0) \n addTextToDiv(parentId, \" | \");\n }\n\n var link = document.createElement(\"a\");\n link.href = \"javascript:void(0)\";\n link.addEventListener(\"click\", func, true);\n link.setAttribute(\"title\", title);\n var linkContent = document.createTextNode(text);\n link.appendChild(linkContent);\n if (addBr)\n parentNode.insertBefore(document.createElement(\"br\"), null);\n parentNode.insertBefore(link, null);\n\n }\n else\n {\n throw(\"Attempt to add link to non-existant div $('\" + parentId + \"')\");\n }\n}", "function createContextMenuItem(label,onclick,divider) {\n\n\tif (onclick == \"\")\n\t\tvar menuHTML = '<div class=\"contextMenuDivInactive\" class=\"contextMenuInactive\">'+label+'</div>';\n\telse\n\t\tvar menuHTML = '<div class=\"contextMenuDiv\" onclick=\"'+onclick+'\" onmouseover=\"this.className=\\'contextMenuDivMouseOver\\';\" onmouseout=\"this.className=\\'contextMenuDiv\\';\">'+label+'</div>';\n\n\t// Add horizontal divider\n\tif (divider == 1) {\n\t\tmenuHTML += '<div class=\"contextMenuDivider\"></div>';\n\t\tglobalContextHeight = parseInt(globalContextHeight) + 12;\n\t}\n\n\t// Set height of the menu\n\tglobalContextHeight = parseInt(globalContextHeight) + 29;\n\t\t\n\treturn menuHTML;\n}", "function createLabel(label, id) {\n var elm_label = document.createElement('label');\n elm_label.className = '.label';\n elm_label.setAttribute('for', id);\n elm_label.innerHTML = label;\n return elm_label\n}", "clickLabel() {\n $(this.rootElement)\n .$('label')\n .click();\n }", "clickLabel() {\n $(this.rootElement)\n .$('label')\n .click();\n }", "function addOverlayDiv(label, selection) {\r\n\t\t\tcurrentZIndex++;\r\n\t\t\t// Div that will permanently shown but invisible\r\n\t\t\tvar div = document.createElement('div');\r\n\t\t\t// Div that contain border, title, etc only shown first time and upon hover\r\n\t\t\tvar anotherDiv = document.createElement('div');\r\n\t\t\tdiv = addStyle(div, selection, currentZIndex);\r\n\t\t\tanotherDiv = addStyle(anotherDiv, selection, currentZIndex, true);\r\n\t\t\t$(anotherDiv).append(label);\r\n\t\t\t$('body').append(div);\r\n\t\t\t$('body').append(anotherDiv);\r\n\t\t\tif (o.autoHide)\r\n\t\t\t\thideIt($(anotherDiv), o.timeoutDelay);\r\n\t\t\t$(div).hover(function() {\r\n\t\t\t\tif (!$(anotherDiv).is(\":visible\")) {\r\n\t\t\t\t\tshowIt($(anotherDiv), o.timeoutDelay);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}", "editLabel(id, event) {\n event.preventDefault();\n if (event.target.label.value !== \"\") {\n const link = this.props.node.ports.bottom.links[id];\n link.addLabel(event.target.label.value);\n this.props.node.display = false;\n this.props.node.selectedLinkId = null;\n this.props.node.app.forceUpdate();\n }\n }", "function showLinkLabel(e) {\n var label = e.subject.findObject('LABEL');\n if (label !== null) {\n label.visible = (e.subject.fromNode.data.category === 'Conditional');\n }\n }", "function build_link_base (label,url) {\n var ext_link = $('<a></a>');\n ext_link.html(label);\n if (url) {\n ext_link.attr('href', url);\n }\n return ext_link;\n}", "function selected2link() {\n if (!toolbar.data(\"sourceOpened\")) {\n var selectedTag = getSelectedNode(); // the selected node\n var thisHrefLink = \"http://\"; // default the input value of the link-form-field\n\n // display the link-form-field\n linkAreaSwitch(true);\n\n if (selectedTag) {\n\n var thisTagName = selectedTag.prop('tagName').toLowerCase();\n\n // if tag name of the selected node is \"a\" and the selected node have \"href\" attribute\n if (thisTagName == \"a\" && selectedTag.is('[href]')) {\n thisHrefLink = selectedTag.attr('href');\n\n selectedTag.attr(setdatalink, \"\");\n }\n // if it don't have \"a\" tag name\n else\n replaceSelection(\"a\", setdatalink, \"\");\n\n }\n else\n linkinput.val(thisHrefLink).focus();\n\n // the method of displaying-hiding to link-types\n linktypeselect.click(function (e) {\n if ($(e.target).hasClass(vars.css + \"_linktypetext\") || $(e.target).hasClass(vars.css + \"_linktypearrow\"))\n linktypeSwitch(true);\n });\n\n // the method of selecting to link-types\n linktypes.find(\"a\").click(function () {\n var thisLinkType = $(this).attr(vars.css + \"-linktype\");\n\n linktypes.data(\"linktype\", thisLinkType)\n\n linktypeview.find(\".\" + vars.css + \"_linktypetext\").html(linktypes.find('a:eq(' + linktypes.data(\"linktype\") + ')').text());\n\n linkInputSet(thisHrefLink);\n\n linktypeSwitch();\n });\n\n linkInputSet(thisHrefLink);\n\n // the method of link-input\n linkinput\n // auto focus\n .focus()\n // update to value\n .val(thisHrefLink)\n // the event of key to enter in link-input\n .bind(\"keypress keyup\", function (e) {\n if (e.keyCode == 13) {\n linkRecord(jQTE.find(\"[\" + setdatalink + \"]\"));\n return false;\n }\n });\n\n // the event of click link-button\n linkbutton.click(function () {\n linkRecord(jQTE.find(\"[\" + setdatalink + \"]\"));\n });\n }\n else\n // hide the link-form-field\n linkAreaSwitch(false);\n }", "_setLabel(label, labelTextContainer, dropDownLabelContainer) {\n const potentialHTMLTemplate = label ? document.getElementById(label) : null;\n\n if (potentialHTMLTemplate !== null && potentialHTMLTemplate.tagName.toLowerCase() === 'template') {\n // label is the id of an HTML template\n const templateContent = document.importNode(potentialHTMLTemplate.content, true);\n\n labelTextContainer.appendChild(templateContent);\n\n if (dropDownLabelContainer) {\n const templateContent = document.importNode(potentialHTMLTemplate.content, true);\n\n dropDownLabelContainer.appendChild(templateContent);\n }\n }\n else {\n // label is string\n if (label === '') {\n label = '&nbsp;';\n }\n\n labelTextContainer.innerHTML = label;\n\n if (dropDownLabelContainer) {\n dropDownLabelContainer.innerHTML = label;\n }\n }\n }", "function toggleLabelSelection(event) {\n var labelFor = event.target.htmlFor;\n var labelInput = document.getElementById(labelFor);\n if (!labelInput.checked) {\n selectedTags.push(labelFor);\n } else {\n selectedTags = selectedTags.filter(tag => tag !== labelFor);\n }\n showRecipes(); //this gives template for recipe selection\n}" ]
[ "0.6615223", "0.60973525", "0.5916459", "0.58006585", "0.55518717", "0.5511999", "0.5477806", "0.5327929", "0.5247053", "0.52089906", "0.5196766", "0.51823187", "0.51765573", "0.51503855", "0.5128251", "0.5105734", "0.5094164", "0.5088068", "0.5087811", "0.5085603", "0.50777036", "0.50602454", "0.50602454", "0.50507367", "0.5049001", "0.50489277", "0.5037331", "0.5020067", "0.499498", "0.49791932" ]
0.7782364
0
Return fragment identifier to be used in URL for the specified unit and subunit. Arguments: m Unit number (number) n Subunit number (number) Return value: Fragment identifier to be used in URL (string)
function unitHref(m, n) { if (typeof m == 'undefined') { return '' } else if (typeof n == 'undefined') { return '#' + m } else { return '#' + m + '.' + n } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_fragment( url ) {\n return url.replace( re_fragment, '$2' );\n }", "function updateUnitFromURL()\n {\n // Default lesson is Unit 1.1\n var unitNo = 1\n var subunitNo = 1\n\n // Parse the fragment identifier in the URL and determine the\n // unit\n if (window.location.hash.length > 0) {\n var fragmentID = window.location.hash.slice(1)\n var tokens = fragmentID.split('.')\n unitNo = parseInt(tokens[0])\n if (tokens.length > 1)\n subunitNo = parseInt(tokens[1])\n }\n\n // Default to unit 1 if unit number could not be parsed\n // correctly from the URL\n if (isNaN(unitNo)) {\n unitNo = 1\n }\n\n // Default to subunit 1 if unit number could not be parsed\n // correctly from the URL\n if (isNaN(subunitNo)) {\n subunitNo = 1\n }\n\n setSubunit(unitNo, subunitNo)\n\n displayUnitLinks()\n displaySubunitLinks()\n displayAlternateUnitLinks()\n updateNavigationLinks()\n updateProgressTooltip()\n\n displayUnitTitle()\n displayGuide()\n\n resetSubunit()\n }", "function get_fragment( url ) {\n url = url || loc.href;\n return url.replace( /^[^#]*#?(.*)$/, '$1' );\n }", "function get_fragment( url ) {\nurl = url || location.href;\nreturn '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );\n}", "function generateConcreteFragmentID() {\n\t return __webpack_require__(221)(_nextFragmentID++) + SUFFIX;\n\t}", "function get_fragment( url ) {\n url = url || location.href;\n return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );\n }", "function get_fragment( url ) {\n url = url || location.href;\n return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );\n }", "function get_fragment( url ) {\n url = url || location.href;\n return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );\n }", "function get_fragment(url) {\n url = url || location.href;\n return '#' + url.replace(/^[^#]*#?(.*)$/, '$1');\n }", "function get_fragment(url) {\n url = url || location.href;\n return '#' + url.replace(/^[^#]*#?(.*)$/, '$1');\n }", "function getFragment(url) {\n url = url || location.href;\n if (Router.nativeHistory && supportNativeHistory) {\n url = new S.Uri(url);\n var query = url.getQuery().toString();\n return url.getPath().substr(Router.urlRoot.length) + (query ? ('?' + query) : '');\n } else {\n return getHash(url);\n }\n }", "function unit(m)\n {\n if (alternateUnitAvailable(m) &&\n my.settings.unit == my.UNIT.ALTERNATE) {\n return Units.alternate[m - Units.alternateStart]\n } else {\n return Units.main[m - 1]\n }\n }", "get_fragment_id() {\n return this.fragment_id\n }", "function setSubunit(m, n)\n {\n my.current.unitNo = m\n my.current.subunitNo = n\n\n my.current.unit = unit(m)\n\n my.current.subunitTitles.length = 0\n for (var subunitTitle in my.current.unit.subunits) {\n my.current.subunitTitles.push(subunitTitle)\n }\n\n var subunitTitle = my.current.subunitTitles[n - 1]\n my.current.subunitText = my.current.unit.subunits[subunitTitle]\n }", "function currentSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n window.location.href = unitHref(m, n)\n }", "get_fragment() {\n return this.fc.get_fragment_by_id(this.get_fragment_id());\n }", "function getSlideNumberFromUrlFragment() {\n var fragment = window.location.hash || ''\n\n currentSlideNumber = (parseInt(fragment.substr(1)) - 1) || 0\n}", "function getSlideNumberFromUrlFragment() {\n var fragment = window.location.hash || ''\n\n currentSlideNumber = (parseInt(fragment.substr(1)) - 1) || 0\n}", "getFragment(fragment) {\n if (fragment === null) {\n if (this._usePushState || !this._wantsHashChange) {\n fragment = this.getPath();\n } else {\n fragment = this.getHash();\n }\n } else {\n fragment = this.getHash();\n }\n return fragment.replace(routeStripper, '');\n }", "onFragment(id) {\n const resourceAnnotation = this.resourceAnnotation(id);\n if (!resourceAnnotation) return undefined;\n // IIIF v2\n const on = resourceAnnotation.getProperty('on');\n // IIIF v3\n const target = resourceAnnotation.getProperty('target');\n const fragmentMatch = (on || target).match(/xywh=(.*)$/);\n if (!fragmentMatch) return undefined;\n return fragmentMatch[1].split(',').map(str => parseInt(str, 10));\n }", "function nextSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheLastSubunit()) {\n if (n == my.current.subunitTitles.length) {\n // If the user is at unit M.L where L is the last\n // subunit of unit M, then go to unit (M + 1).1.\n m++\n n = 1\n } else {\n // If the user is at unit M.N, then go to unit M.(N + 1).\n n++\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "getFragment() {\n return this.clearSlashes(decodeURI(window.location.pathname + window.location.search)).replace(/\\?(.*)$/, '');\n }", "loadUrl(fragment) {\n fragment = this.fragment = this.location.pathname\n this.onLoadUrl && this.onLoadUrl(fragment, this.location.search)\n }", "function get_sm_name(page_url){\r\n\t//GM_log(page_url);\r\n\r\n\tvar site_start = page_url.indexOf('&s=');\r\n\tif (site_start==-1){\r\n\t\tsite_start = page_url.indexOf('&S=');\r\n\t}\r\n\tvar site_end = page_url.indexOf('&r',site_start);\r\n\tvar site_url= page_url.substring(site_start+3,site_end);\r\n\r\n\t//GM_log(site_start +\"|\"+site_end +\"|\"+site_url);\t\r\n\treturn site_url;\r\n}", "function getLinkId(url) {\n\n var id = url.slice(url.lastIndexOf('/') + 1, url.length);\n //console.log(\"ID= \" + id);\n return id;\n\n}//get link id", "function getGroupID(URL) {\n var start_pos = URL.indexOf('=') + 1;\n var end_pos = URL.indexOf('&study_group_uuid', start_pos);\n var studyGroupID = URL.substring(start_pos, end_pos);\n console.log(studyGroupID);\n return studyGroupID;\n}", "resource(fullUrl){\n //Pega o caminho da URL ou seja a string que vem após a porta e antes das querys\n //protocolo://domínio:porta/RECURSO/.../RECURSO?query_string#fragmento\n let parsedUrl = url.parse(fullUrl).pathname\n return parsedUrl\n }", "getUrlSection(segment) {\n\n if (segment != 0 && segment != 1) {\n return;\n }\n\n // default page is the first one in the list\n let default_page = \"\";\n\n if (this.appPages.length > 0) {\n default_page = this.appPages[0][\"name\"];\n }\n\n let curr_url = decodeURI(window.location.href);\n\n // has page defined\n if (curr_url.split(\"#\").length > 1) {\n return curr_url.split(\"#\")[segment];\n } else {\n window.location.href = encodeURI(window.location.href + \"#\" + default_page);\n return default_page;\n }\n }", "function getStep() {\n\tlet url = new URL(window.location.href);\n\tlet hash = url.hash.substring(1);\n\tif (hash === '0' || hash === '1' || hash === '2' || hash === '3') {\n\t\treturn parseInt(hash, 10);\n\t} else {\n\t\treturn '0';\n\t}\n}", "function getPhotoSetID() {\n\t\t\tvar photoset = WIN.location.hash.substring(1);\n\t\t\tswitch (photoset) {\t\t\t\t\t\t\t \t\t// convert string to flikr photoset id\n\t\t\tcase \"decks\":\n\t\t\t\tphotoset = \"72157626337904479\"\n\t\t\t\tbreak;\n\t\t\tcase \"bathrooms\":\n\t\t\t\tphotoset = \"72157629682777453\"\n\t\t\t\tbreak;\n\t\t\tcase \"kitchens\":\n\t\t\t\tphotoset = \"72157629318222372\"\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tphotoset = \"72157626337904479\" \n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn photoset;\n\t\t}" ]
[ "0.59477466", "0.593649", "0.5595272", "0.5579261", "0.5552435", "0.5512202", "0.5512202", "0.5512202", "0.5494468", "0.5494468", "0.5205885", "0.51779586", "0.51635396", "0.511326", "0.5038234", "0.49963725", "0.49533242", "0.49533242", "0.4853974", "0.48509097", "0.48320642", "0.48295593", "0.4820523", "0.4772506", "0.46751952", "0.4662405", "0.46560073", "0.46526718", "0.46282628", "0.46000108" ]
0.6636278
0
Process the current URL and perform appropriate tasks. This function is called automatically when the fragment identifier in the current URL changes.
function processURLChange() { switch(window.location.hash) { case '#restart': currentSubunit() break case '#previous': previousSubunit() break case '#next': nextSubunit() break default: updateUnitFromURL() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "processURL() {\n\t\t\tlet urlParams = {};\n\t\t\t// Get URL params - split em up - loop over them - fill urlParams object\n\t\t\twindow.location.search\n\t\t\t\t.replace('?', '')\n\t\t\t\t.split('&')\n\t\t\t\t.forEach(chunks => {\n\t\t\t\t\tlet kv = chunks.split('=');\n\t\t\t\t\turlParams[kv[0]] = kv[1];\n\t\t\t\t});\n\t\t\t// If a command URL is present.\n\t\t\tif (urlParams.hasOwnProperty('note')) {\n\t\t\t\tmethods.add('note', urlParams);\n\t\t\t\t// Clear the state.\n\t\t\t\twindow.history.pushState({}, document.title, '/');\n\t\t\t}\n\t\t}", "function do_fragment_change() {\n var fragment = window.location.hash;\n set_url(fragment);\n\n if (fragment.match(/^#t=/)) {\n do_time_change(fragment);\n }\n else if (fragment.match(/^#!/)) {\n do_transcript_change(fragment);\n }\n}", "function checkURL() {\n\t\tvar url = window.location.href;\n\t\t\n\t\tif(url != lastQuery) {\n\t\t\tvar parsedURL = parseURL(url);\n\t\t\t\n\t\t\tvar routeAndParams = findMatchingRoute(parsedURL);\n\t\t\t\n\t\t\tif(routeAndParams !== false) {\n\t\t\t\ttry {\n\t\t\t\t\tvar route = routeAndParams[0];\n\t\t\t\t\tvar params = routeAndParams[1];\n\t\t\t\t\t\n\t\t\t\t\troute[2].call(route[3], params);\n\t\t\t\t} catch(e) {\n\t\t\t\t\tif(e.message != \"StopProcessingHandlerException\") {\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tlastQuery = url;\n\t\t}\n\t}", "function _urlChangedCallback() {\n if (_oldHref == location.href) {\n return;\n }\n _oldHref = location.href\n var parsedUrl = {href: location.href};\n if (urlParser) {\n parsedUrl = urlParser.parse(location.href);\n }\n //var newLocation = parse(location.href);\n var changes = {};\n for (var entry in parsedUrl) {\n if (parsedUrl[entry] != _oldParsedUrl[entry]) {\n\n\n changes[entry] = {\n \"old\": _oldParsedUrl[entry],\n \"new\": parsedUrl[entry]\n }\n\n\n }\n }\n for (var entry in changes) {\n var callbackName = \"on\" + entry + \"changed\";\n if (_export[callbackName] && (_export[callbackName] instanceof Function)) {\n _export[callbackName].call(null, changes);\n }\n }\n _oldParsedUrl = parsedUrl;\n\n }", "function _urlChangedCallback() {\n if (_oldHref == location.href) {\n return;\n }\n _oldHref = location.href\n var parsedUrl = {href: location.href};\n if (urlParser) {\n parsedUrl = urlParser.parse(location.href);\n }\n //var newLocation = parse(location.href);\n var changes = {};\n for (var entry in parsedUrl) {\n if (parsedUrl[entry] != _oldParsedUrl[entry]) {\n\n\n changes[entry] = {\n \"old\": _oldParsedUrl[entry],\n \"new\": parsedUrl[entry]\n }\n\n\n }\n }\n for (var entry in changes) {\n var callbackName = \"on\" + entry + \"changed\";\n if (_export[callbackName] && (_export[callbackName] instanceof Function)) {\n _export[callbackName].call(null, changes);\n }\n }\n _oldParsedUrl = parsedUrl;\n\n }", "function runWhenURLMet(){\n url = location.hash.slice(1).split(\"?\")[0];\n data = location.hash.slice(1).split(\"?\");\n \n setActive(url);\n\n if (url === \"home\"){\n list(\"products\", \"homeul\",true);\n }\n if (url === \"login\" || url === \"\"){\n document.getElementById(\"menu\").style.display = \"none\";\n document.getElementById(\"returnBtn\").style.display = \"none\";\n }\n if (url !== \"login\" && url !== \"\"){\n document.getElementById(\"menu\").style.display = \"flex\";\n document.getElementById(\"returnBtn\").style.display = \"block\";\n }\n if (url === \"detail\"){\n details(data[1]);\n }\n}", "parseUrl () {\r\n this.currentIndex = this.getParameter(\"index\");\r\n this.currentFolder = this.findSubnavFolderByIndex(this.currentIndex);\r\n\r\n const page = this.getParameter(\"page\");\r\n\r\n if (this.currentFolder) {\r\n const target = document.querySelector(`#${page}`);\r\n\r\n this.toggleActivePages(target);\r\n this.toggleActiveSubnav(this.currentIndex);\r\n } else {\r\n const target = document.querySelector(\"#flight-ops-home\");\r\n\r\n this.toggleActivePages(target);\r\n this.toggleActiveSubnav(0);\r\n }\r\n }", "function processUrlParameters() {\n\tvar params = window.location.hash.substring(1).split('&');\n\tfor (i in params) {\n\t\tvar pair = params[i].split('=');\n\t\tvar handler = parameterMap[pair[0]];\n\t\tif (handler) {\n\t\t\thandler(pair[1]);\n\t\t}\n\t}\n}", "function updateUrlFragment() {\n window.history.replaceState(null, '', '#' + (currentSlideNumber + 1))\n}", "function updateUrlFragment() {\n window.history.replaceState(null, '', '#' + (currentSlideNumber + 1))\n}", "function poll() {\n var hash = get_fragment(),\n history_hash = history_get( last_hash );\n \n if ( hash !== last_hash ) {\n history_set( last_hash = hash, history_hash );\n \n $(window).trigger( str_hashchange );\n \n } else if ( history_hash !== last_hash ) {\n location.href = location.href.replace( /#.*/, '' ) + history_hash;\n }\n \n timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );\n }", "function poll() {\n var hash = get_fragment(),\n history_hash = history_get( last_hash );\n \n if ( hash !== last_hash ) {\n history_set( last_hash = hash, history_hash );\n \n $(window).trigger( str_hashchange );\n \n } else if ( history_hash !== last_hash ) {\n location.href = location.href.replace( /#.*/, '' ) + history_hash;\n }\n \n timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );\n }", "function poll() {\n var hash = get_fragment(),\n history_hash = history_get( last_hash );\n \n if ( hash !== last_hash ) {\n history_set( last_hash = hash, history_hash );\n \n $(window).trigger( str_hashchange );\n \n } else if ( history_hash !== last_hash ) {\n location.href = location.href.replace( /#.*/, '' ) + history_hash;\n }\n \n timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );\n }", "function poll() {\n var hash = get_fragment(),\n history_hash = history_get(last_hash);\n\n if (hash !== last_hash) {\n history_set(last_hash = hash, history_hash);\n\n $(window).trigger(str_hashchange);\n\n } else if (history_hash !== last_hash) {\n location.href = location.href.replace(/#.*/, '') + history_hash;\n }\n\n timeout_id = setTimeout(poll, $.fn[str_hashchange].delay);\n }", "function poll() {\n var hash = get_fragment(),\n history_hash = history_get(last_hash);\n\n if (hash !== last_hash) {\n history_set(last_hash = hash, history_hash);\n\n $(window).trigger(str_hashchange);\n\n } else if (history_hash !== last_hash) {\n location.href = location.href.replace(/#.*/, '') + history_hash;\n }\n\n timeout_id = setTimeout(poll, $.fn[str_hashchange].delay);\n }", "function parseCurrentUrlParams () {\n\t\tme.urlParams = me.paramsToObject(window.location.search.substr(1));\n\t}", "function hashChange() {\n var hash = window.location.hash.slice(1);\n var ind = dayMap.indexOf(hash);\n console.log(hash, ind)\n if(hash && ind)\n detailPage(ind);\n else\n homePage();\n }", "function updatePageUrl() {\n // here we have updated the globals so we will take the url data from the history object\n // unless its the list view where we use the default dates\n // (if we were coming from the updated url ones the setPageUrl method would trigger instead of this one)\n if (scheduled.currentView == 'list') {\n scheduled.listDateStart = scheduled.defaultlistDateStart;\n scheduled.listDateEnd = scheduled.defaultlistDateEnd;\n }\n\n var urlParams = createUrl();\n var url = window.location.origin + window.location.pathname + urlParams;\n History.pushState(null, null, url);\n }", "function locationHashChanged() {\n var hash = location.hash.slice(1);\n router.handleURL(hash);\n}", "function updateURLFragment(path) {\n window.location.hash = path;\n }", "function poll() {\n var hash = get_fragment(),\n history_hash = history_get( last_hash );\n \n if ( hash !== last_hash ) {\n history_set( last_hash = hash, history_hash );\n \n $(window).trigger( str_hashchange );\n \n } else if ( history_hash !== last_hash ) {\n location.href = location.href.replace( /#.*/, '' ) + history_hash;\n }\n \n timeout_id = window.setTimeout( poll, $.fn[ str_hashchange ].delay );\n}", "function processHashInstruction() {\n switch (window.location.hash) {\n case '#nocache':\n deleteAllCaches();\n Common.customAlert('Deleted all Caches');\n break;\n\n case '#unregister':\n unregisterServiceWorkers();\n Common.customAlert('Unregistered Service Workers');\n break;\n\n case '#deletestorage':\n localStorage.clear();\n Common.customAlert('Deleted Storage');\n break;\n }\n}", "function dealWithHash () {\n\tif (!_ignoreHashChangeOnce) {\n\t\tvar hash = window.location.hash.substr(1);\n\t\tconsole.log('Hash changed to: '+hash);\n\t\tif (hash != '') {\n\t\t\tsetupAndSendAjaxRequest(hash);\n\t\t}else{\n\t\t\tsetupAndSendAjaxRequest('pages/home.html');\n\t\t}\n\t}\n\t_ignoreHashChangeOnce = false;\n}", "function onHashChange() {\n\t\tupdateActiveTab();\n\t\tupdateActiveSection();\n\t}", "function handleNewHash() {\n var location = window.location.hash.replace(/^#\\/?|\\/$/g, '').split('/');\n}", "checkUrl(/* e */) {\n if (this.location.pathname === this.fragment) {\n return false\n }\n\n this.loadUrl()\n }", "loadUrl(fragment) {\n fragment = this.fragment = this.location.pathname\n this.onLoadUrl && this.onLoadUrl(fragment, this.location.search)\n }", "handleCurrentRoute()\n\t{\n\t\tconst newQuery = this.props.match.params.query;\n\n\t\tif(this.props.query !== newQuery)\n\t\t{\n\t\t\tthis.props.performSearch(newQuery);\n\t\t}\n\t}", "function onPopAndStart(){\n var l = location.href;\n //http://localhost/.../hash\n var pageName = l.substring(l.lastIndexOf(\"/\")+1);\n // if no pageName set pageName to false\n pageName = pageName || false;\n switchToSection(pageName);\n }", "function hashChangeHandler(){\n if(!isScrolling && !options.lockAnchors){\n var value = window.location.hash.replace('#', '').split('/');\n var section = decodeURIComponent(value[0]);\n var slide = decodeURIComponent(value[1]);\n\n //when moving to a slide in the first section for the first time (first time to add an anchor to the URL)\n var isFirstSlideMove = (typeof lastScrolledDestiny === 'undefined');\n var isFirstScrollMove = (typeof lastScrolledDestiny === 'undefined' && typeof slide === 'undefined' && !slideMoving);\n\n\n if(section.length){\n /*in order to call scrollpage() only once for each destination at a time\n It is called twice for each scroll otherwise, as in case of using anchorlinks `hashChange`\n event is fired on every scroll too.*/\n if ((section && section !== lastScrolledDestiny) && !isFirstSlideMove || isFirstScrollMove || (!slideMoving && lastScrolledSlide != slide )) {\n scrollPageAndSlide(section, slide);\n }\n }\n }\n }" ]
[ "0.6454162", "0.6398715", "0.61943847", "0.6142036", "0.61398184", "0.6094532", "0.6076581", "0.603019", "0.5881091", "0.5881091", "0.58692473", "0.58692473", "0.58692473", "0.58502096", "0.5821408", "0.5806132", "0.5700259", "0.56412446", "0.5632201", "0.5630265", "0.5624022", "0.5617764", "0.56093305", "0.56079865", "0.5576951", "0.55722314", "0.55647296", "0.55635333", "0.5539779", "0.55246913" ]
0.67682683
0
Go to current subunit.
function currentSubunit() { var m = my.current.unitNo var n = my.current.subunitNo window.location.href = unitHref(m, n) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheLastSubunit()) {\n if (n == my.current.subunitTitles.length) {\n // If the user is at unit M.L where L is the last\n // subunit of unit M, then go to unit (M + 1).1.\n m++\n n = 1\n } else {\n // If the user is at unit M.N, then go to unit M.(N + 1).\n n++\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "function goToUnitPage() {\n history.push(\"/selectunit\");\n }", "function goToRoot() {\n goTo();\n }", "function previousSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheFirstSubunit()) {\n if (n == 1) {\n // If the user is at unit M.1, go to unit (M - 1).L\n // where L is the last subunit of the previous unit.\n previousUnit = unit(m - 1)\n var previousSubunitTitles = []\n for (var subunitTitle in previousUnit.subunits) {\n previousSubunitTitles.push(subunitTitle)\n }\n\n m--\n n = previousSubunitTitles.length\n } else {\n // If the user is at unit M.N, go to unit M.(N - 1)\n n--\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "gotoNextStep() {\n this.gotoStep(this.currentStep + 1);\n }", "static goTo() {\n // to implement on child\n }", "function goToStep(step){//because steps starts with zero\nthis._currentStep=step-2;if(typeof this._introItems!==\"undefined\"){nextStep.call(this);}}", "function nav(){\n var path = currentTest().path;\n window.location = path;\n }", "__nextStep() {\n this.openNextStep();\n }", "jumpTo(step) {\n\t\t// Calculating winner at this point in game\n\t\tlet winnerSquares = this.calculateWinnerSquares(this.state.history[step].squares, true);\n\t\tlet winner = winnerSquares ? this.state.history[step].squares[winnerSquares[0]] : null;\n\t\tlet showTrophy = winner ? true : false;\n\t\tthis.setState({\n\t\t\tstepNumber: step,\n\t\t\tnextPlayer: this.getNextPlayer(step),\n\t\t\twinner: winner,\n\t\t\twinnerSquares: winnerSquares,\n\t\t\tshowTrophy: showTrophy\n\t\t});\n\t}", "function currentSubunitIsTheFirstSubunit()\n {\n return my.current.unitNo == 1 && my.current.subunitNo == 1\n }", "function goToSubworkflow(node) {\n var matchingTableRow = getTableRow(node);\n var subworkflowLink = $(matchingTableRow).find(\"a.subworkflow\");\n if (subworkflowLink.length > 0) {\n location.href = subworkflowLink.attr(\"href\");\n }\n }", "function _goToStep(step) {\n\t //because steps starts with zero\n\t this._currentStep = step - 2;\n\t if (typeof (this._introItems) !== 'undefined') {\n\t _nextStep.call(this);\n\t }\n\t }", "function goToPreviousStep() {\n\tpreviousSteps();\n\tupdateStepsText();\n\tconsole.log(\"hey\");\n}", "function _goToStep(step) {\n //because steps starts with zero\n this._currentStep = step - 2;\n if (typeof (this._introItems) !== 'undefined') {\n _nextStep.call(this);\n }\n }", "function _goToStep(step) {\n //because steps starts with zero\n this._currentStep = step - 2;\n if (typeof (this._introItems) !== 'undefined') {\n _nextStep.call(this);\n }\n }", "function _goToStep(step) {\n //because steps starts with zero\n this._currentStep = step - 2;\n if (typeof (this._introItems) !== 'undefined') {\n _nextStep.call(this);\n }\n }", "function _goToStep(step) {\n //because steps starts with zero\n this._currentStep = step - 2;\n if (typeof (this._introItems) !== 'undefined') {\n _nextStep.call(this);\n }\n }", "function _goToStep(step) {\n //because steps starts with zero\n this._currentStep = step - 2;\n if (typeof (this._introItems) !== 'undefined') {\n _nextStep.call(this);\n }\n }", "click() {\n let tour = get(this, 'tour');\n tour.start();\n }", "gotoParentContext(){\n let bot = this.botid;\n let parent = this.selectedContext.parent_context;\n //this.router.navigateToRoute(`manager/bot/${bot}/context/${parent}`);\n //this.router.navigateToRoute('bot-context','contextid':parent);\n this.router.navigateToRoute('bot-context', { 'contextid': parent }, // route parameters object\n { trigger: true, replace: true }); // options\n }", "function goToStepNumber(step){this._currentStepNumber=step;if(typeof this._introItems!==\"undefined\"){nextStep.call(this);}}", "goToSelected () {\n this.path = this.selectedPath;\n }", "function goToNextStep() {\n\tnextSteps();\n\tupdateStepsText();\n\tconsole.log(\"hi\");\n}", "function _goToStep(step) {\n //because steps starts with zero\n this._currentStep = step - 2;\n if(typeof (this._introItems) !== 'undefined') {\n _nextStep.call(this);\n }\n }", "gotoNextFrame() {\n this.scriptOwner.parentClip.gotoNextFrame();\n }", "function down(results){\n goToPage('step1f');\n}", "async gotoAddMenuPage(testController) {\n await testController.click('#add-menu-food-page');\n }", "levelUp() {\n\t\tthis.getActiveUnits().forEach(unit => {\n\t\t\tunit.levelUp();\n\t\t});\n\t}", "breakoutClicked () {\n this.SceneManager.switchToUsingTransaction('Breakout/Level1', Transition.named('ScrollFrom', { direction: 'bottom' }))\n }" ]
[ "0.7053677", "0.6360854", "0.6329819", "0.60506517", "0.59753084", "0.5795796", "0.57329166", "0.570666", "0.5690685", "0.5668464", "0.5607941", "0.5563058", "0.55586433", "0.5523618", "0.55072564", "0.55072564", "0.55072564", "0.55072564", "0.55072564", "0.5503803", "0.5499513", "0.54933804", "0.54700446", "0.54545695", "0.5450763", "0.54216146", "0.5402049", "0.5392531", "0.5389773", "0.53402305" ]
0.75363404
0
Check if the current unit is the first subunit among all the subunits. Return: true if the current subunit is the first subunit; false otherwise
function currentSubunitIsTheFirstSubunit() { return my.current.unitNo == 1 && my.current.subunitNo == 1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function currentSubunitIsTheLastSubunit()\n {\n return my.current.unitNo == Units.main.length &&\n my.current.subunitNo == my.current.subunitTitles.length\n }", "function isFirstChild(subtree){\n var par = subtree.parent;\n if (par.children[0] === subtree) {\n return true;\n }\n}", "function nextSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheLastSubunit()) {\n if (n == my.current.subunitTitles.length) {\n // If the user is at unit M.L where L is the last\n // subunit of unit M, then go to unit (M + 1).1.\n m++\n n = 1\n } else {\n // If the user is at unit M.N, then go to unit M.(N + 1).\n n++\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "function is_prefix_of(sub, seq) {\n if(is_empty_list(sub)){\n return true;\n } else if(is_empty_list(seq)){\n return false;\n } else if(head(sub) === head(seq)){\n return is_prefix_of(tail(sub), tail(seq));\n } else {\n return false;\n }\n}", "get isFirstChild() {\t\t\n\t\tvar parent = this.__atom.parent;\n\t\tif (!parent) {\n\t\t\tthrow new Error('There is no parent atom');\n\t\t}\n\t\tvar firstChild = parent.children[0];\n\t\treturn firstChild === this.atom;\t\t\n\t}", "function previousSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheFirstSubunit()) {\n if (n == 1) {\n // If the user is at unit M.1, go to unit (M - 1).L\n // where L is the last subunit of the previous unit.\n previousUnit = unit(m - 1)\n var previousSubunitTitles = []\n for (var subunitTitle in previousUnit.subunits) {\n previousSubunitTitles.push(subunitTitle)\n }\n\n m--\n n = previousSubunitTitles.length\n } else {\n // If the user is at unit M.N, go to unit M.(N - 1)\n n--\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "function isBase(unitList) {\n return unitList.length === 1\n && Math.abs(unitList[0].power - 1.0) < 1e-15\n && Object.keys(unitList[0].unit.dimension).length === 1\n && unitList[0].unit.dimension[Object.keys(unitList[0].unit.dimension)[0]] === 1;\n}", "function isSuperset(superset, subset) {\n // empty sets do not apply to this question\n // I know, technically, any non-empty set contains the empty set. But\n // practicelly, that just muddies the waters here\n if (superset.size === 0 || subset.size === 0) {\n return false;\n }\n for (let el of subset) {\n if (!superset.has(el)) {\n return false;\n }\n }\n return true;\n}", "function getFirstCat(tower, catId) {\r\n\tvar ind = 0;\r\n\tvar upTo = getIndex(catId);\r\n\t\r\n\tfor (ind = 0; ind < upTo; ind++) {\r\n\t\tif (tower[ind] != EMPTY) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\treturn true;\r\n}", "isActive(){\n return this._units.some(unit => unit.isActive());\n }", "function is_subseq_at(sub, seq, start_pos){\n let cnt = 0;\n let flag = false;\n for(let i = start_pos; i < seq.length; i = i + 1){\n if(cnt === sub.length){\n break;\n } else if(sub[cnt] !== seq[i]){\n flag = true;\n break;\n } else {\n if(i+1<seq.length){cnt = cnt + 1;} else {}\n }\n }\n \n if(flag || cnt < sub.length-1){\n return false;\n } else {\n // display(cnt);\n return true;\n }\n}", "function areAllSubsetsEmpty()\n{\n if(isSubsetEmpty(1) && isSubsetEmpty(2))\n {\n Ext.Msg.alert('子集为空', '所有子集均为空。请选择子集。');//<SIAT_zh_CN original=\"Subsets are empty\">子集为空</SIAT_zh_CN>//<SIAT_zh_CN original=\"All subsets are empty. Please select subsets.\">所有子集均为空。请选择子集。</SIAT_zh_CN>\n \n return true;\n }\n}", "canAddSub() {\n return this.subaddable().length > 0;\n }", "function currentSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n window.location.href = unitHref(m, n)\n }", "isBase() {\n return isBase(this.unitList);\n }", "hasVillager(){\n let villagerFound = false;\n for(let unit of this.units){\n if(unit.getType() === \"Villager\"){\n villagerFound = true;\n }\n }\n\n return villagerFound;\n }", "isProperSuperset(subset) {\n return XSet.isProperSuperset(this, subset);\n }", "isSuperset(subset) {\n return XSet.isSuperset(this, subset);\n }", "isFull() {\n if (this.hasSupernova) {\n return true;\n }\n return this.sectors.every(row => {\n return row.every(sector => !sector.container.isEmpty())\n });\n }", "function isCompound(unitList) {\n if (unitList.length === 0) {\n return false;\n }\n return unitList.length > 1 || Math.abs(unitList[0].power - 1.0) > 1e-15;\n}", "isCompound() {\n return isCompound(this.unitList);\n }", "isIngredientUnique() {\n let ingredients = this.state.ingredients;\n\n for (\n let ingredientIndex = 0;\n ingredientIndex < ingredients.length;\n ingredientIndex++\n ) {\n // get ingredient's name\n let ingredientName = Object.keys(ingredients[ingredientIndex])[0];\n\n // split quantity and unit\n let unitWithQuantity =\n ingredients[ingredientIndex][ingredientName].split(\" \");\n\n // if ingredient's name and unit are already present, do not add such ingredient\n if (\n ingredientName === this.state.ingredientName &&\n unitWithQuantity[1] === this.state.ingredientUnit\n )\n return false;\n }\n return true;\n }", "function isSub(index1, index2) {\r\n\tvar result = false;\r\n\tvar i = index1;\r\n\t\r\n\twhile (i != -1 && nodes[i].parentID != 'root' && result == false) {\r\n\t\tif(nodes[i].parentID==nodes[index2].id) result = true;\r\n\t\ti = getItemIndex(nodes[i].parentID);\t\t\r\n\t}\r\n\r\n\treturn result;\r\n}", "function isInSelection(unit, adminUnitSelected) {\n if (!adminUnitSelected || !unit) { return false; }\n return unit.get(adminUnitSelected.admin) === adminUnitSelected.name;\n }", "get isFirst() {\n return this.index === 0;\n }", "function isSuperset(set, subset)\n{\n for(let elem of subset)\n {\n if(!set.has(elem)){ return false; }\n }\n return true;\n}", "function isSubsequenceRecursion(s, t) {\n // base case\n if (s === null || s.length === 0) return true;\n\n for (let i = 0; i < t.length; i++) {\n if (t.charAt(i) === s.charAt(0)) {\n return isSubsequenceRecursion(s.substr(1), t.substr(i+1))\n }\n }\n return false\n}", "function isSuperset(set, subset) {\n for (var elem of subset) {\n if (!set.has(elem)) {\n return false;\n }\n }\n return true;\n}", "hasNext() {\n if (this.first) return true;\n return (!this.curr || this.curr.next == null) ? false : true;\n }", "function isSelectionAtLeafStart(editorState) {\n var selection = editorState.getSelection();\n var anchorKey = selection.getAnchorKey();\n var blockTree = editorState.getBlockTree(anchorKey);\n var offset = selection.getStartOffset();\n\n var isAtStart = false;\n\n blockTree.some(function (leafSet) {\n if (offset === leafSet.get('start')) {\n isAtStart = true;\n return true;\n }\n\n if (offset < leafSet.get('end')) {\n return leafSet.get('leaves').some(function (leaf) {\n var leafStart = leaf.get('start');\n if (offset === leafStart) {\n isAtStart = true;\n return true;\n }\n\n return false;\n });\n }\n\n return false;\n });\n\n return isAtStart;\n}" ]
[ "0.6750091", "0.59201705", "0.5856817", "0.56979275", "0.5572986", "0.5389489", "0.52738553", "0.5268939", "0.5255774", "0.5230735", "0.5198978", "0.5186373", "0.51727164", "0.51307213", "0.51191735", "0.51138365", "0.5085178", "0.5050002", "0.50461066", "0.5044285", "0.50414205", "0.49877152", "0.49611166", "0.49431747", "0.4937476", "0.49337822", "0.4932743", "0.4913778", "0.48472986", "0.4844908" ]
0.8978072
0
Check if the current subunit is the last subunit among all the subunits. Return: true if the current subunit is the last subunit; false otherwise
function currentSubunitIsTheLastSubunit() { return my.current.unitNo == Units.main.length && my.current.subunitNo == my.current.subunitTitles.length }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function currentSubunitIsTheFirstSubunit()\n {\n return my.current.unitNo == 1 && my.current.subunitNo == 1\n }", "function isLast(idx) {\n const parent = inArr[idx][1];\n for (let i = idx + 1; i < inArr.length; i++) {\n if (inArr[i][1] === parent) {\n return false;\n }\n }\n return true;\n }", "function isLastItem() {\n var curListItem = $(this).closest(\".listItem\");\n var totalItems = $(this).closest(\".list\").find(\".listItem\").length;\n var itemInd = $(curListItem).index(); // this starts at 1\n return totalItems === itemInd;\n}", "isLast(item) {\n return this.crumbs.indexOf(item) === this.crumbs.length - 1;\n }", "get isLast() {\n return this.index === this.length - 1;\n }", "isLastSubscriptInChain() {\n let depth = 0;\n for (let i = this.tokens.currentIndex() + 1; ; i++) {\n if (i >= this.tokens.tokens.length) {\n throw new Error(\"Reached the end of the code while finding the end of the access chain.\");\n }\n if (this.tokens.tokens[i].isOptionalChainStart) {\n depth++;\n } else if (this.tokens.tokens[i].isOptionalChainEnd) {\n depth--;\n }\n if (depth < 0) {\n return true;\n }\n\n // This subscript token is a later one in the same chain.\n if (depth === 0 && this.tokens.tokens[i].subscriptStartIndex != null) {\n return false;\n }\n }\n }", "isLastStep() {\n return this.wizardSteps.length > 0 && this.currentStepIndex === this.wizardSteps.length - 1;\n }", "decision () {\n\n // console.log('length: ', this.leves.length)\n if ((this.currentIndexLevel == this.leves.length - 1)) {\n return true\n }\n return false\n }", "function nextSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheLastSubunit()) {\n if (n == my.current.subunitTitles.length) {\n // If the user is at unit M.L where L is the last\n // subunit of unit M, then go to unit (M + 1).1.\n m++\n n = 1\n } else {\n // If the user is at unit M.N, then go to unit M.(N + 1).\n n++\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "function isLastItem(selected_id) {\r\n\tif (!$('#' + selected_id + '-node')[0].nextSibling\r\n\t\t\t&& !$('#' + selected_id + '-node')[0].previousSibling)\r\n\t\treturn true;\r\n\telse\r\n\t\treturn false;\r\n}", "get isEnd() {\n return !this.descendants.length;\n }", "isEnd() {\r\n return this.curr.next == null ? true : false;\r\n }", "lastMoviePlay()\n {\n return (this.currentMoviePlay == this.playsCoords.length - 1);\n }", "function endOfCombat() {\n\tvar eoc = false;\n\n\t_.each(combat.fleets,function(fleet) {\n\t\tconsole.log(fleet.name + \" \" + fleet.combat.loseCount + \" of \" + fleet.combat.unitCount + \"(\" + fleet.breakoff + \")\");\n\t\tif(fleet.combat.loseCount >= fleet.combat.unitCount) {\n\t\t\teoc = true;\n\t\t}\n\t});\n\n\treturn eoc;\n}", "function previousSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheFirstSubunit()) {\n if (n == 1) {\n // If the user is at unit M.1, go to unit (M - 1).L\n // where L is the last subunit of the previous unit.\n previousUnit = unit(m - 1)\n var previousSubunitTitles = []\n for (var subunitTitle in previousUnit.subunits) {\n previousSubunitTitles.push(subunitTitle)\n }\n\n m--\n n = previousSubunitTitles.length\n } else {\n // If the user is at unit M.N, go to unit M.(N - 1)\n n--\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "function nodeEndsWith(n, expectedLastToken, sourceFile) {\n var children = n.getChildren(sourceFile);\n if (children.length) {\n var last = ts.lastOrUndefined(children);\n if (last.kind === expectedLastToken) {\n return true;\n }\n else if (last.kind === 23 /* SemicolonToken */ && children.length !== 1) {\n return children[children.length - 2].kind === expectedLastToken;\n }\n }\n return false;\n }", "function lastRound(){\r\n\tif(nthRound === rounds){\r\n\t\treturn true;\r\n\t}\r\n\telse{\r\n\t\treturn false;\r\n\t}\r\n}", "removeLast() {\n\t\tif (this.head === null) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (this.head === this.tail) {\n\t\t\tthis.head = null;\n\t\t\tthis.tail = null;\n\t\t} else {\n\t\t\tthis.tail = this.tail.previous;\n\t\t\tthis.tail.next = null;\n\t\t}\n\n\t\tthis._size--;\n\n\t\treturn true;\n\t}", "canAddSub() {\n return this.subaddable().length > 0;\n }", "function isEnd() {\n\t\tlet flag = true;\n\t\tfor (let i = 0; i < pieceCount.length; i++) {\n\t\t\t//for each puzzle piece\n\t\t\tlet top = parseInt(pieceCount[i].style.top);\n\t\t\tlet left = parseInt(pieceCount[i].style.left);\n\t\t\tif (left != (i % 4 * PIECESIZE) || top != parseInt(i / 4) * PIECESIZE) {\n\t\t\t\t//checks if each piece matches its left and top position\n\t\t\t\tflag = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn flag;\n\t}", "isEnd() {\n return this.data.rounds.end(); \n }", "isEndingWith(value, sub) {\n return this.isString(value) && value.endsWith(sub);\n }", "function is_subseq_at(sub, seq, start_pos){\n let cnt = 0;\n let flag = false;\n for(let i = start_pos; i < seq.length; i = i + 1){\n if(cnt === sub.length){\n break;\n } else if(sub[cnt] !== seq[i]){\n flag = true;\n break;\n } else {\n if(i+1<seq.length){cnt = cnt + 1;} else {}\n }\n }\n \n if(flag || cnt < sub.length-1){\n return false;\n } else {\n // display(cnt);\n return true;\n }\n}", "_isMovingToSubmenu() {\n const submenuPoints = this._getSubmenuBounds();\n if (!submenuPoints) {\n return false;\n }\n let numMoving = 0;\n const currPoint = this._points[this._points.length - 1];\n // start from the second last point and calculate the slope between each point and the last\n // point.\n for (let i = this._points.length - 2; i >= 0; i--) {\n const previous = this._points[i];\n const slope = getSlope(currPoint, previous);\n if (isWithinSubmenu(submenuPoints, slope, getYIntercept(currPoint, slope))) {\n numMoving++;\n }\n }\n return numMoving >= Math.floor(NUM_POINTS / 2);\n }", "isBase() {\n return isBase(this.unitList);\n }", "isLastPage () {\n return this.lastItemIndex === 0\n ? true\n : this.computedPagination.page >= this.pagesNumber\n }", "function checkIfLastOperator() {\n var lastChar = screenContent.substr(screenContent.length - 1);\n var operator = [\"+\", \"-\", \"*\", \"/\", \".\"];\n for (i = 0; i < operator.length; i++) {\n if (operator[i] === lastChar) {\n return true;\n }\n }\n return false;\n }", "isFull() {\n if (this.front == 0 && this.rear == this.size - 1 || (this.rear + 1 == this.front)) {\n return true;\n }\n return false;\n }", "last() {\n return this._last && this._last.value;\n }", "isSelectionOnLastLine() {\n return this.getLineIndex(this.end) >= this.lineBreaks_.length - 1;\n }" ]
[ "0.7374074", "0.6813333", "0.6345423", "0.634049", "0.62572867", "0.61544603", "0.60059303", "0.5926182", "0.58705175", "0.57863706", "0.5739082", "0.5722547", "0.56428087", "0.56001955", "0.5597021", "0.55936736", "0.5565375", "0.5556319", "0.5512312", "0.53971046", "0.53872925", "0.536717", "0.53639793", "0.53609425", "0.5330404", "0.5295771", "0.52895784", "0.5275687", "0.52747136", "0.5234391" ]
0.8845541
0
Go to previous subunit. Do nothing if the user is already at the first subunit of the first unit.
function previousSubunit() { var m = my.current.unitNo var n = my.current.subunitNo if (!currentSubunitIsTheFirstSubunit()) { if (n == 1) { // If the user is at unit M.1, go to unit (M - 1).L // where L is the last subunit of the previous unit. previousUnit = unit(m - 1) var previousSubunitTitles = [] for (var subunitTitle in previousUnit.subunits) { previousSubunitTitles.push(subunitTitle) } m-- n = previousSubunitTitles.length } else { // If the user is at unit M.N, go to unit M.(N - 1) n-- } } window.location.href = unitHref(m, n) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gotoPrevious() {\n\tif(typeof previousInventory !== 'undefined') {\n\t\tnextInventory = currentInventory;\n\t\tcurrentInventory = previousInventory;\n\t\tpreviousInventory = undefined;\n\t}\n}", "function nextSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheLastSubunit()) {\n if (n == my.current.subunitTitles.length) {\n // If the user is at unit M.L where L is the last\n // subunit of unit M, then go to unit (M + 1).1.\n m++\n n = 1\n } else {\n // If the user is at unit M.N, then go to unit M.(N + 1).\n n++\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "function goToPrevious() {\n var prevId = getPreviousLocationIndex();\n if (prevId != null) {\n setCurrentLocation(prevId);\n }\n }", "function goToPrevStep(){\n unhighlightArrow(currStepId, numberToString[currStepId]);\n currStepId-=1;\n replaceStep();\n highlightArrow(currStepId, numberToString[currStepId]); \n}", "__previousStep() {\n this.openPreviousStep();\n }", "navigateToPreviousStep() {\n if (this.state.currentStepIndex <= 0) {\n return;\n }\n this.setState(prevState => ({\n currentStepIndex: prevState.currentStepIndex - 1,\n }));\n }", "prevStep() {\n\n if (this.currStep > -1) {\n\n this.goTo(this.currSlide, this.currStep - 1);\n\n }\n\n }", "function goToPreviousStep() {\n\tpreviousSteps();\n\tupdateStepsText();\n\tconsole.log(\"hey\");\n}", "function goToPrevious() {\n goTo(_currentContext.previous);\n }", "traversePreviousQuestion() {\r\n this.curr = this.curr.prev;\r\n }", "previous(){\n let previous = this.currentId - 1;\n if(previous <= 1){\n previous = 1;\n }\n this.goto(previous);\n }", "function goToPreviousSlide() {\n if (getCurrentSubSlide() != -1 && getCurrentSubSlide() > 0) {\n goToSlide(getCurrentMainSlide(), getCurrentSubSlide() - 1);\n return true;\n }\n if (getCurrentMainSlide() > 0) {\n goToSlide(getCurrentMainSlide() - 1);\n return true;\n }\n}", "openPreviousStep() {\n this.activeStep.toggleStep();\n this.removeActiveStep();\n if (this.previousStep !== null) this.previousStep.toggleStep();\n }", "function previousPhase() {\n var index = phases.indexOf(currentPhase);\n if (index > 0) {\n setPhase(phases[index - 1]);\n }\n }", "runOneStepBackwards() {\n this.stateHistory.previousState()\n }", "function _previousStep() {\n if(this._currentStep == 0)\n return;\n\n _showElement.call(this, this._introItems[--this._currentStep].element);\n }", "function moveToPrev(Calvin){\n\t// console.log(\"MPrev: \" + currElement);\n\tif(currElement>1 && currElement<elementIdArray.length){\n\t\tcurrElement= currElement-2; //this needs to be -2\n\t\t\n\t\tletThereBeLight(currElement,Calvin);\n\t\tif(currElement <= 0){\n\t\t\tcurrElement =0;\n\t\t\tfirstIteration =0;\n\t\t}\n\t}\n\telse if(firstIteration == 0 || currElement <= 0){\n\t\tremoveDarkness();\n\t\talert(\"This is the start of our tour, you can't go back any farther!\");\n\t\tcurrElement =0;\n\t\tfirstIteration =0;\n\t}\n\telse if(currElement <= 1){\n\t\tcurrElement =0;\n\t\tfirstIteration =0;\n\t\tletThereBeLight(currElement,Calvin);\n\t\tconsole.log(\"currElement: \" + currElement);\n\t\talert(\"You're already at the first stop\");\n\t}\n}", "goToPreviousView() {\n const poppedData = this.previousItems.pop();\n this.breadCrumbs.pop();\n this.handleStructs(this.supportedKeys);\n this.setState({\n properties: poppedData,\n });\n }", "function prev() {\n\t\tvar prevStep = steps.prev();\n\t\tsetSteps(steps);\n\t\tsetCurrent(prevStep);\n\t}", "movePrevious() {\n const previousStep = this.steps[this.currentStep - 1];\n if (!previousStep) {\n // this.reset();\n return;\n }\n\n this.overlay.highlight(previousStep);\n this.currentStep -= 1;\n }", "goToPrev () {\n\t\t\tif (this.canGoToPrev) {\n\t\t\t\tthis.goTo(this.currentSlide - 1)\n\t\t\t}\n\t\t}", "function currentSubunitIsTheFirstSubunit()\n {\n return my.current.unitNo == 1 && my.current.subunitNo == 1\n }", "function backToLastFolderBeforeSearch() {\n var navItem = _.last(beforeSearchNavStack);\n\n navItem.back();\n navStack = beforeSearchNavStack;\n updatePaths();\n}", "function gotoPreviousSong() {\n if (songIndex === 0) {\n songIndex = songs.length - 1;\n } else {\n songIndex = songIndex - 1;\n }\n\n const isDiscPlayingNow = !disc.paused;\n loadSong(songs[songIndex]);\n resetProgress();\n if (isDiscPlayingNow) {\n playPauseMedia();\n }\n}", "previous() {\n this._previous();\n }", "prev() {\n const that = this;\n\n that.navigateTo(that.pageIndex - 1);\n }", "goToPrevious() {\n if (this.history.getPagesCount()) {\n this.transition = this.history.getCurrentPage().transition;\n if (!_.isEmpty(this.transition)) {\n this.transition += '-exit';\n }\n this.history.pop();\n this.isPageAddedToHistory = true;\n window.history.back();\n }\n }", "function _previousStep() {\n\t this._direction = 'backward';\n\n\t if (this._currentStep === 0) {\n\t return false;\n\t }\n\n\t var nextStep = this._introItems[--this._currentStep];\n\t if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n\t this._introBeforeChangeCallback.call(this, nextStep.element);\n\t }\n\n\t _showElement.call(this, nextStep);\n\t }", "selectPrevious() {\n const children = Array.from(this.children);\n if (!children || children.length === 0) {\n return;\n }\n const selectedItem = this.selectedItem;\n const prevIndex = children.indexOf(selectedItem);\n const nextIndex = prevIndex - 1 < 0 ? children.length - 1 : prevIndex - 1;\n this.selected = nextIndex;\n }", "function _previousStep() {\n this._direction = 'backward';\n\n if (this._currentStep === 0) {\n return false;\n }\n\n var nextStep = this._introItems[--this._currentStep];\n if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n this._introBeforeChangeCallback.call(this, nextStep.element);\n }\n\n _showElement.call(this, nextStep);\n }" ]
[ "0.6854732", "0.6815929", "0.658525", "0.64508104", "0.640415", "0.63642716", "0.63620764", "0.63244075", "0.63183886", "0.62671536", "0.62564474", "0.6256289", "0.62429714", "0.6223968", "0.62040365", "0.61888427", "0.6183852", "0.61303896", "0.6111446", "0.60822654", "0.60807467", "0.60804945", "0.60690904", "0.6052097", "0.60289294", "0.60287344", "0.6027386", "0.6019147", "0.6016408", "0.6011942" ]
0.8497916
0
Go to next subunit. Do nothing if the user is already at the last subunit of the last unit.
function nextSubunit() { var m = my.current.unitNo var n = my.current.subunitNo if (!currentSubunitIsTheLastSubunit()) { if (n == my.current.subunitTitles.length) { // If the user is at unit M.L where L is the last // subunit of unit M, then go to unit (M + 1).1. m++ n = 1 } else { // If the user is at unit M.N, then go to unit M.(N + 1). n++ } } window.location.href = unitHref(m, n) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function previousSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheFirstSubunit()) {\n if (n == 1) {\n // If the user is at unit M.1, go to unit (M - 1).L\n // where L is the last subunit of the previous unit.\n previousUnit = unit(m - 1)\n var previousSubunitTitles = []\n for (var subunitTitle in previousUnit.subunits) {\n previousSubunitTitles.push(subunitTitle)\n }\n\n m--\n n = previousSubunitTitles.length\n } else {\n // If the user is at unit M.N, go to unit M.(N - 1)\n n--\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "function currentSubunitIsTheFirstSubunit()\n {\n return my.current.unitNo == 1 && my.current.subunitNo == 1\n }", "function currentSubunitIsTheLastSubunit()\n {\n return my.current.unitNo == Units.main.length &&\n my.current.subunitNo == my.current.subunitTitles.length\n }", "function currentSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n window.location.href = unitHref(m, n)\n }", "function gotoNext() {\n var currentIndex = findCurrentIndexInList();\n if (currentIndex == -1)\n return;\n var nextIndex = currentIndex + 1;\n // If next is == length then loop to zero\n if (nextIndex == exports.activeList.members.length) {\n nextIndex = 0;\n }\n var next = exports.activeList.members[nextIndex];\n gotoLine(next.filePath, next.line, next.col, exports.activeList);\n}", "function nextStep() {\n if (enemyCount < enemyData.length-1) {\n enemyCount++;\n setsunaNoMikiri();\n }\n}", "next(){\r\n (this.position == this.testimonial.length - 1) ? this.position = 0 : this.position++\r\n }", "function moveToNext(Calvin){\n\t// console.log(\"MNext: \" + currElement);\n\t// console.log(\"Element Array Length: \" + elementIdArray.length);\n\tif(currElement>0 && currElement<elementIdArray.length){\n\t\tletThereBeLight(currElement,Calvin);\n\t\tcurrElement++;\n\t}\n\telse if(firstIteration == 0){\n\t\tletThereBeLight(currElement,Calvin);\n\t\tfirstIteration++;\n\t\tcurrElement++;\n\n\t}\n\telse if(currElement >= elementIdArray.length-1){\n\t\talert(\"You have reached the end of this guided tour! Thanks for joining us!\");\n\t\tCalvin.eraseTourGuide();\n\t\tremoveDarkness();\n\t\tcurrElement =0;\n\t\tfirstIteration=0;\n\t}\n}", "gotoNextStep() {\n this.gotoStep(this.currentStep + 1);\n }", "function gotoNext() {\n\tif(typeof nextInventory !== 'undefined') {\n\t\tpreviousInventory = currentInventory;\n\t\tcurrentInventory = nextInventory;\n\t\tnextInventory = undefined;\n\t}\n}", "function next() {\n\t\t\tif (aTests.length) {\n\t\t\t\trunTest(aTests.shift());\n\t\t\t} else if (!iRunningTests) {\n\t\t\t\toTotal.element.classList.remove(\"hidden\");\n\t\t\t\toTotal.element.firstChild.classList.add(\"running\");\n\t\t\t\tsummary(Date.now() - iStart);\n\t\t\t\tsaveLastRun(mLastRun);\n\t\t\t\tif (oFirstFailedTest) {\n\t\t\t\t\tselect(oFirstFailedTest);\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function nextPhase() {\n var index = phases.indexOf(currentPhase);\n if (index < phases.length - 1) {\n setPhase(phases[index + 1]);\n }\n }", "function next() {\n\t\t\tif (aTests.length) {\n\t\t\t\treturn runTest(aTests.shift());\n\t\t\t} else if (!iRunningTests) {\n\t\t\t\toTotal.element.classList.remove(\"hidden\");\n\t\t\t\toTotal.element.firstChild.classList.add(\"running\");\n\t\t\t\tsummary(Date.now() - iStart);\n\t\t\t\tif (oFirstFailedTest) {\n\t\t\t\t\tselect(oFirstFailedTest);\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function goToNext() {\n var nextId = getNextLocationIndex();\n if (nextId != null) {\n setCurrentLocation(nextId);\n }\n }", "next(){\n let next = this.currentId + 1;\n if(next >= this.list.length){\n next = this.list.length;\n }\n this.goto(next);\n }", "next() {\n // $(this.parentElement).data(\"obj\").select_fwd();\n $(this.parentElement).data(\"obj\").update_idx(1);\n return false;\n }", "function _next() {\n\t\t\ttry {\n\t\t\t\tif (_model.playlist[0].levels[0].file.length > 0) {\n\t\t\t\t\tif (_model.item + 1 == _model.playlist.length) {\n\t\t\t\t\t\treturn _item(0);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn _item(_model.item + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t} catch (err) {\n\t\t\t\t_eventDispatcher.sendEvent(jwplayer.api.events.JWPLAYER_ERROR, err);\n\t\t\t}\n\t\t\treturn false;\n\t\t}", "function selectNextEnemy() {\n if (hasRunInit) {\n for (var i = 0; i < allCPUS.length; i++) {\n if (cpuInfoDiv.textContent === allCPUS[i][0]) {\n cpuBattle = allCPUS[i + 1];\n upNext = allCPUS[i + 2];\n previous = allCPUS[i];\n buildEnemyCycle(previous, upNext);\n }\n else if (cpuInfoDiv.textContent === allCPUS[allCPUS.length - 1][0]) {\n location.assign(\"/\");\n }\n }\n }\n}", "function selectNextItem(){\n var items = document.getElementById('searchresults').childNodes;\n selectIndex((selectedSearchIndex + 1) % items.length);\n }", "nextStep() {\n\n if (this.slides[this.currSlide].steps.length - 1 > this.currStep) {\n\n this.goTo(this.currSlide, this.currStep + 1);\n\n }\n\n }", "function setSubunit(m, n)\n {\n my.current.unitNo = m\n my.current.subunitNo = n\n\n my.current.unit = unit(m)\n\n my.current.subunitTitles.length = 0\n for (var subunitTitle in my.current.unit.subunits) {\n my.current.subunitTitles.push(subunitTitle)\n }\n\n var subunitTitle = my.current.subunitTitles[n - 1]\n my.current.subunitText = my.current.unit.subunits[subunitTitle]\n }", "__nextStep() {\n this.openNextStep();\n }", "function userNextSong() {\n\t// check if we have another song\n\tif (songs.length <= 1) {\n\t\talert('Please add another song before skipping.');\n\t} else {\n\t\tnextSong();\n\t}\n}", "selectNext() {\n const children = Array.from(this.children);\n if (!children || children.length === 0) {\n return;\n }\n const selectedItem = this.selectedItem;\n const prevIndex = children.indexOf(selectedItem);\n const nextIndex = prevIndex + 1 >= children.length ? 0 : prevIndex + 1;\n this.selected = nextIndex;\n }", "next() {\n this.selectedIndex = Math.min(this._selectedIndex + 1, this.steps.length - 1);\n }", "nextLevel() {\n this.subLevel = 0;\n this.changeTagLevel(this.level);\n this.illuminateSequence();\n this.addButtonListener();\n }", "function goToNextSlide() {\n if (getCurrentSubSlide() != -1 && getNumberOfSubSlides() > getCurrentSubSlide()+1) {\n goToSlide(getCurrentMainSlide(), getCurrentSubSlide() + 1);\n return true;\n }\n if (getNumberOfMainSlides() > getCurrentMainSlide() + 1) {\n goToSlide(getCurrentMainSlide()+1);\n return true;\n }\n return false;\n}", "function goToNextStep(){\n unhighlightArrow(currStepId, numberToString[currStepId]);\n currStepId+=1;\n replaceStep();\n highlightArrow(currStepId, numberToString[currStepId]); \n}", "nextLevel(){\n this.levelSpawner.level++;\n\n // if we get to the end set player to the first level and bring up the main menu\n if(this.levelSpawner.level >= this.levelSpawner.levels.length)\n {\n this.scene.switch(\"menuscene\");\n this.scene.stop(\"levelcompletescene\");\n this.scene.stop(\"maingame\");\n\n } else{\n this.levelSpawner.setCurrentLevel();\n this.triggerLevelLoad();\n this.activateControllerInput();\n }\n\n }", "function next() {\n\t\t\treturn go(current+1);\n\t\t}" ]
[ "0.7028668", "0.6967198", "0.6539519", "0.6401484", "0.5965367", "0.5732943", "0.5724467", "0.5700484", "0.5699314", "0.5635313", "0.5633174", "0.55105114", "0.545854", "0.54373163", "0.54054415", "0.5392803", "0.5353802", "0.53360796", "0.53306997", "0.53289", "0.53122544", "0.5297138", "0.5286168", "0.5264657", "0.52605283", "0.5258688", "0.5243193", "0.5240092", "0.52234066", "0.52050996" ]
0.8740801
0
Parse the current URL and determine the current unit and subunit numbers, and display the determined subunit. The fragment identifier in the URL may contain the current unit and subunit numbers in m.n format where m is the current unit number and n is the current subunit number. If the fragment identifier is absent, then the current unit is 1 and the current subunit is 1. If the fragment identifier is a single integer m only, then the current unit is m and the current subunit is 1. The following is a list of example URLs along with the unit number they translate to. Unit 1.1 Unit 5.1 Unit 5.1 Unit 5.2
function updateUnitFromURL() { // Default lesson is Unit 1.1 var unitNo = 1 var subunitNo = 1 // Parse the fragment identifier in the URL and determine the // unit if (window.location.hash.length > 0) { var fragmentID = window.location.hash.slice(1) var tokens = fragmentID.split('.') unitNo = parseInt(tokens[0]) if (tokens.length > 1) subunitNo = parseInt(tokens[1]) } // Default to unit 1 if unit number could not be parsed // correctly from the URL if (isNaN(unitNo)) { unitNo = 1 } // Default to subunit 1 if unit number could not be parsed // correctly from the URL if (isNaN(subunitNo)) { subunitNo = 1 } setSubunit(unitNo, subunitNo) displayUnitLinks() displaySubunitLinks() displayAlternateUnitLinks() updateNavigationLinks() updateProgressTooltip() displayUnitTitle() displayGuide() resetSubunit() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processURLChange()\n {\n switch(window.location.hash) {\n\n case '#restart':\n currentSubunit()\n break\n\n case '#previous':\n previousSubunit()\n break\n\n case '#next':\n nextSubunit()\n break\n\n default:\n updateUnitFromURL()\n }\n }", "function currentSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n window.location.href = unitHref(m, n)\n }", "function nextSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheLastSubunit()) {\n if (n == my.current.subunitTitles.length) {\n // If the user is at unit M.L where L is the last\n // subunit of unit M, then go to unit (M + 1).1.\n m++\n n = 1\n } else {\n // If the user is at unit M.N, then go to unit M.(N + 1).\n n++\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "function displaySubunitLinks()\n {\n // Delete all existing subunit links\n var linksDiv = my.html.subunitLinks\n while (linksDiv.firstChild &&\n linksDiv.firstChild.className != 'stretch') {\n\n linksDiv.removeChild(linksDiv.firstChild)\n }\n\n // Create new subunit links for the unit m\n var numberOfSubunits = my.current.subunitTitles.length\n for (var i = numberOfSubunits - 1; i >= 0; i--) {\n // Insert whitespaces between div elements, otherwise they\n // would not be justified\n var whitespace = document.createTextNode('\\n')\n linksDiv.insertBefore(whitespace, linksDiv.firstChild)\n\n var label = my.current.subunitTitles[i]\n var selected = (i + 1 == my.current.subunitNo)\n var href = unitHref(my.current.unitNo, i + 1)\n\n var subunitDiv = boxedLink(label, selected, href)\n subunitDiv.id = 'subunit' + (i + 1)\n subunitDiv.style.width = (95 / numberOfSubunits) + '%'\n\n linksDiv.insertBefore(subunitDiv, linksDiv.firstChild)\n }\n }", "parseUrl () {\r\n this.currentIndex = this.getParameter(\"index\");\r\n this.currentFolder = this.findSubnavFolderByIndex(this.currentIndex);\r\n\r\n const page = this.getParameter(\"page\");\r\n\r\n if (this.currentFolder) {\r\n const target = document.querySelector(`#${page}`);\r\n\r\n this.toggleActivePages(target);\r\n this.toggleActiveSubnav(this.currentIndex);\r\n } else {\r\n const target = document.querySelector(\"#flight-ops-home\");\r\n\r\n this.toggleActivePages(target);\r\n this.toggleActiveSubnav(0);\r\n }\r\n }", "function parseUrl() {\r\n var hash = window.location.hash.substr( 1 );\r\n var rez = hash.split( '-' );\r\n var index = rez.length > 1 && /^\\+?\\d+$/.test( rez[ rez.length - 1 ] ) ? parseInt( rez.pop( -1 ), 10 ) || 1 : 1;\r\n var gallery = rez.join( '-' );\r\n\r\n\t\t// Index is starting from 1\r\n\t\tif ( index < 1 ) {\r\n\t\t\tindex = 1;\r\n\t\t}\r\n\r\n return {\r\n hash : hash,\r\n index : index,\r\n gallery : gallery\r\n };\r\n }", "function parseUrl() {\n var hash = window.location.hash.substr( 1 );\n var rez = hash.split( '-' );\n var index = rez.length > 1 && /^\\+?\\d+$/.test( rez[ rez.length - 1 ] ) ? parseInt( rez.pop( -1 ), 10 ) || 1 : 1;\n var gallery = rez.join( '-' );\n\n // Index is starting from 1\n if ( index < 1 ) {\n index = 1;\n }\n\n return {\n hash : hash,\n index : index,\n gallery : gallery\n };\n }", "function parseUrl() {\n var hash = window.location.hash.substr( 1 );\n var rez = hash.split( '-' );\n var index = rez.length > 1 && /^\\+?\\d+$/.test( rez[ rez.length - 1 ] ) ? parseInt( rez.pop( -1 ), 10 ) || 1 : 1;\n var gallery = rez.join( '-' );\n\n\t\t// Index is starting from 1\n\t\tif ( index < 1 ) {\n\t\t\tindex = 1;\n\t\t}\n\n return {\n hash : hash,\n index : index,\n gallery : gallery\n };\n }", "function parseUrl() {\n var hash = window.location.hash.substr( 1 );\n var rez = hash.split( '-' );\n var index = rez.length > 1 && /^\\+?\\d+$/.test( rez[ rez.length - 1 ] ) ? parseInt( rez.pop( -1 ), 10 ) || 1 : 1;\n var gallery = rez.join( '-' );\n\n\t\t// Index is starting from 1\n\t\tif ( index < 1 ) {\n\t\t\tindex = 1;\n\t\t}\n\n return {\n hash : hash,\n index : index,\n gallery : gallery\n };\n }", "function parseUrl() {\n var hash = window.location.hash.substr( 1 );\n var rez = hash.split( '-' );\n var index = rez.length > 1 && /^\\+?\\d+$/.test( rez[ rez.length - 1 ] ) ? parseInt( rez.pop( -1 ), 10 ) || 1 : 1;\n var gallery = rez.join( '-' );\n\n\t\t// Index is starting from 1\n\t\tif ( index < 1 ) {\n\t\t\tindex = 1;\n\t\t}\n\n return {\n hash : hash,\n index : index,\n gallery : gallery\n };\n }", "function parseUrl() {\n var hash = window.location.hash.substr( 1 );\n var rez = hash.split( '-' );\n var index = rez.length > 1 && /^\\+?\\d+$/.test( rez[ rez.length - 1 ] ) ? parseInt( rez.pop( -1 ), 10 ) || 1 : 1;\n var gallery = rez.join( '-' );\n\n\t\t// Index is starting from 1\n\t\tif ( index < 1 ) {\n\t\t\tindex = 1;\n\t\t}\n\n return {\n hash : hash,\n index : index,\n gallery : gallery\n };\n }", "function parseUrl() {\r\n var hash = window.location.hash.substr(1),\r\n rez = hash.split(\"-\"),\r\n index = rez.length > 1 && /^\\+?\\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,\r\n gallery = rez.join(\"-\");\r\n\r\n return {\r\n hash: hash,\r\n /* Index is starting from 1 */\r\n index: index < 1 ? 1 : index,\r\n gallery: gallery\r\n };\r\n }", "function parseUrl() {\r\n var hash = window.location.hash.substr(1),\r\n rez = hash.split(\"-\"),\r\n index = rez.length > 1 && /^\\+?\\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,\r\n gallery = rez.join(\"-\");\r\n\r\n return {\r\n hash: hash,\r\n /* Index is starting from 1 */\r\n index: index < 1 ? 1 : index,\r\n gallery: gallery\r\n };\r\n }", "function parseUrl() {\n var hash = window.location.hash.substr(1),\n rez = hash.split(\"-\"),\n index = rez.length > 1 && /^\\+?\\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,\n gallery = rez.join(\"-\");\n\n return {\n hash: hash,\n /* Index is starting from 1 */\n index: index < 1 ? 1 : index,\n gallery: gallery\n };\n }", "function parseUrl(urlPart, name_size){\n let output = \"\"; \n let i = 3; \n for(i=5;i<name_size;i++){\n output = output.concat(urlPart[i])\n }\n return output; //returns city name \n}", "function parseUrl() {\n var hash = window.location.hash.substr(1),\n rez = hash.split(\"-\"),\n index = rez.length > 1 && /^\\+?\\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,\n gallery = rez.join(\"-\");\n\n return {\n hash: hash,\n /* Index is starting from 1 */\n index: index < 1 ? 1 : index,\n gallery: gallery\n };\n }", "function parseUrl() {\n var hash = window.location.hash.substr(1),\n rez = hash.split(\"-\"),\n index = rez.length > 1 && /^\\+?\\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,\n gallery = rez.join(\"-\");\n\n return {\n hash: hash,\n /* Index is starting from 1 */\n index: index < 1 ? 1 : index,\n gallery: gallery\n };\n }", "function parseUrl() {\n var hash = window.location.hash.substr(1),\n rez = hash.split(\"-\"),\n index = rez.length > 1 && /^\\+?\\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,\n gallery = rez.join(\"-\");\n\n return {\n hash: hash,\n /* Index is starting from 1 */\n index: index < 1 ? 1 : index,\n gallery: gallery\n };\n }", "function unitHref(m, n)\n {\n if (typeof m == 'undefined') {\n return ''\n } else if (typeof n == 'undefined') {\n return '#' + m\n } else {\n return '#' + m + '.' + n\n }\n }", "function previousSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheFirstSubunit()) {\n if (n == 1) {\n // If the user is at unit M.1, go to unit (M - 1).L\n // where L is the last subunit of the previous unit.\n previousUnit = unit(m - 1)\n var previousSubunitTitles = []\n for (var subunitTitle in previousUnit.subunits) {\n previousSubunitTitles.push(subunitTitle)\n }\n\n m--\n n = previousSubunitTitles.length\n } else {\n // If the user is at unit M.N, go to unit M.(N - 1)\n n--\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "function getSectionAndSubsectionFromURL () {\n let sectionId = (document.location.hash || '').split('#').pop();\n let subSectionElement = document.querySelector('section #' + sectionId);\n\n if (subSectionElement) {\n // locate section\n let subSectionId = sectionId;\n let sectionElement = subSectionElement;\n while (sectionElement && sectionElement.className.indexOf('container-info-topic') < 0) {\n sectionElement = sectionElement.parentNode;\n }\n\n return {\n sectionId: sectionElement.id,\n subSectionId\n };\n } else {\n return {\n sectionId: sectionId,\n subSectionId: null\n };\n }\n}", "function getSlideNumberFromUrlFragment() {\n var fragment = window.location.hash || ''\n\n currentSlideNumber = (parseInt(fragment.substr(1)) - 1) || 0\n}", "function getSlideNumberFromUrlFragment() {\n var fragment = window.location.hash || ''\n\n currentSlideNumber = (parseInt(fragment.substr(1)) - 1) || 0\n}", "function parseURLParentID(number) {\n let queryString = decodeURIComponent(window.location.search);\n let queries = queryString.split(\"?\");\n let searchQueries = queries[number];\n return searchQueries;\n}", "function get_subsection_url(html) {\r\n var friendId = null;\r\n var page_nums = [1]; //Start with one page of results\r\n //Look for anything like this:\r\n //http://friends.myspace.com/index.cfm?fuseaction=user.viewfriends&friendId=30920517&p=5\r\n var results = html.match(/index.cfm\\?fuseaction=user\\.viewfriends&friendId=(\\d+)/);\r\n if (results && results[1]) {\r\n friendId = results[1];\r\n }\r\n else {\r\n if (mydebug) alert('Could not find friendId');\r\n }\r\n results = html.match(/index.cfm\\?fuseaction=user\\.viewfriends&friendId=\\d+&p=\\d+\"/g);\r\n if (results) {\r\n for (i=0;i<results.length;i++) {\r\n //Get our friendId if we dont yet have it.\r\n var page_num = results[i].match(/(\\d+)\"$/);\r\n if (page_num) {\r\n page_nums.push(page_num[1]);\r\n }\r\n }\r\n }\r\n else {\r\n //Case where there is not enough friends for paging (like 11)\r\n return 'http://www.myspace.com/index.cfm?fuseaction=user.viewfriends&friendId=' + friendId;\r\n }\r\n\r\n var random_page = Math.floor(Math.random() * array_max(page_nums)) + 1;\r\n var ret = 'http://www.myspace.com/index.cfm?fuseaction=user.viewfriends&friendId=' + friendId + '&p=' + random_page;\r\n return ret;\r\n}", "function Main_ParseUrlParameters()\n{\n\t//create an url object\n\tvar url = {};\n\n\t//get the url string\n\tvar strURL = location.href;\n\t//search for first query\n\tvar nAmp = strURL.indexOf(\"?\");\n\tif (nAmp != -1)\n\t{\n\t\t//correct url\n\t\tstrURL = strURL.substr(nAmp + 1);\n\t\t//split into pairs\n\t\tstrURL = strURL.split(\"&\");\n\t\t//loop through them\n\t\tfor (var i = 0, c = strURL.length; i < c; i++)\n\t\t{\n\t\t\t//split this into the name/value pair\n\t\t\tvar pair = strURL[i].split(\"=\");\n\t\t\tif (pair.length == 2)\n\t\t\t{\n\t\t\t\t//add this\n\t\t\t\turl[pair[0].toLowerCase()] = pair[1];\n\t\t\t}\n\t\t}\n\t\t//we have a root?\n\t\tif (url.startid)\n\t\t{\n\t\t\t//add root\n\t\t\turl.StartStateId = url.startid;\n\t\t\t//has extension?\n\t\t\tif (url.StartStateId.indexOf(__NEMESIS_EXTENSION) != -1)\n\t\t\t{\n\t\t\t\t//remove it\n\t\t\t\turl.StartStateId.replace(__NEMESIS_EXTENSION, \"\");\n\t\t\t}\n\t\t}\n\t}\n\t//return it\n\treturn url;\n}", "function get_fragment( url ) {\n return url.replace( re_fragment, '$2' );\n }", "function setSubunit(m, n)\n {\n my.current.unitNo = m\n my.current.subunitNo = n\n\n my.current.unit = unit(m)\n\n my.current.subunitTitles.length = 0\n for (var subunitTitle in my.current.unit.subunits) {\n my.current.subunitTitles.push(subunitTitle)\n }\n\n var subunitTitle = my.current.subunitTitles[n - 1]\n my.current.subunitText = my.current.unit.subunits[subunitTitle]\n }", "resource(fullUrl){\n //Pega o caminho da URL ou seja a string que vem após a porta e antes das querys\n //protocolo://domínio:porta/RECURSO/.../RECURSO?query_string#fragmento\n let parsedUrl = url.parse(fullUrl).pathname\n return parsedUrl\n }", "loadUrl(fragment) {\n fragment = this.fragment = this.location.pathname\n this.onLoadUrl && this.onLoadUrl(fragment, this.location.search)\n }" ]
[ "0.57399017", "0.55339396", "0.55089235", "0.5478526", "0.5245436", "0.52014214", "0.51806206", "0.51796454", "0.51796454", "0.51796454", "0.51796454", "0.5109641", "0.5109641", "0.51018316", "0.5095522", "0.5089784", "0.5089784", "0.5089784", "0.50066376", "0.49780166", "0.49744242", "0.49657768", "0.49657768", "0.48233014", "0.4769604", "0.471231", "0.4682484", "0.46442086", "0.46416062", "0.45030606" ]
0.7518052
0
Update the visibility of the navigation links to the previous and the next subunits. Hide the link to the previous subunit when the user is at the first subunit. Hide the link to the next subunit when the user is already at the last subunit. Display both links otherwise.
function updateNavigationLinks() { if (currentSubunitIsTheFirstSubunit()) { my.html.previousLink.style.visibility = 'hidden' my.html.nextLink.style.visibility = 'visible' } else if (currentSubunitIsTheLastSubunit()) { my.html.previousLink.style.visibility = 'visible' my.html.nextLink.style.visibility = 'hidden' } else { my.html.previousLink.style.visibility = 'visible' my.html.nextLink.style.visibility = 'visible' } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displaySubunitLinks()\n {\n // Delete all existing subunit links\n var linksDiv = my.html.subunitLinks\n while (linksDiv.firstChild &&\n linksDiv.firstChild.className != 'stretch') {\n\n linksDiv.removeChild(linksDiv.firstChild)\n }\n\n // Create new subunit links for the unit m\n var numberOfSubunits = my.current.subunitTitles.length\n for (var i = numberOfSubunits - 1; i >= 0; i--) {\n // Insert whitespaces between div elements, otherwise they\n // would not be justified\n var whitespace = document.createTextNode('\\n')\n linksDiv.insertBefore(whitespace, linksDiv.firstChild)\n\n var label = my.current.subunitTitles[i]\n var selected = (i + 1 == my.current.subunitNo)\n var href = unitHref(my.current.unitNo, i + 1)\n\n var subunitDiv = boxedLink(label, selected, href)\n subunitDiv.id = 'subunit' + (i + 1)\n subunitDiv.style.width = (95 / numberOfSubunits) + '%'\n\n linksDiv.insertBefore(subunitDiv, linksDiv.firstChild)\n }\n }", "function displayAlternateUnitLinks()\n {\n // If alternate unit is not available for the current unit,\n // hide the alternate links element\n if (!alternateUnitAvailable(my.current.unitNo)) {\n alternateUnitLinks.style.visibility = 'hidden'\n return\n }\n\n // Delete all existing alternate unit links\n Util.removeChildren(alternateUnitLinks)\n\n // Create div elements for the main unit and alternate unit\n var mainUnitElement =\n boxedLink(Units.mainLabel,\n my.settings.unit == my.UNIT.MAIN,\n '#', toggleUnit)\n\n var alternateUnitElement =\n boxedLink(Units.alternateLabel,\n my.settings.unit == my.UNIT.ALTERNATE,\n '#', toggleUnit)\n\n alternateUnitLinks.appendChild(mainUnitElement)\n alternateUnitLinks.appendChild(alternateUnitElement)\n alternateUnitLinks.style.visibility = 'visible'\n }", "function updateNavVisibility(){if(!nav||navAsThumbnails){return;}getVisibleNavIndex();if(visibleNavIndexes!==visibleNavIndexesCached){forEachNodeList(navItems,function(el,i){if(visibleNavIndexes.indexOf(i)<0){hideElement(el);}else{showElement(el);}});// cache visible nav indexes\nvisibleNavIndexesCached=visibleNavIndexes;}}", "function updateNavigation() {\n\tif ($(document.body).hasClass('single-page')){\n\t\treturn;\n\t}\n\n\t$(\".toc .topic-link + ul\").hide();\n\n\tvar li = $(\".toc li\");\n\tvar next, prev;\n\t$.each(li, function(i, e){\n\t\tif ($(\".topic-link.active\").closest(\"li\").get(0) === this) {\n\t\t\tnext = $(li.get(i+1)).find(\".topic-link:first\");\n\t\t\tif (i>0){\n\t\t\t\tprev = $(li.get(i-1)).find(\".topic-link:first\");\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t});\n}", "function updateNavVisibility () {\n if (!nav || navAsThumbnails) { return; }\n\n if (pages !== pagesCached) {\n var min = pagesCached,\n max = pages,\n fn = showElement;\n\n if (pagesCached > pages) {\n min = pages;\n max = pagesCached;\n fn = hideElement;\n }\n\n while (min < max) {\n fn(navItems[min]);\n min++;\n }\n\n // cache pages\n pagesCached = pages;\n }\n }", "function updateNavigation()\r\n {\r\n $('#linkLogin').hide();\r\n $('#linkRegister').hide(); \r\n $('#linkListBooks').show();\r\n $('#linkCreateBook').show();\r\n $('#linkLogout').show();\r\n showPage('viewBooks');\r\n }", "function update(){\r\n if(currentIndex === 0){\r\n $nav.find(\".prev\").hide();\r\n }else{\r\n $nav.find(\".prev\").show();\r\n }\r\n\r\n\r\n\r\n if(currentIndex === $slides.length - 1 ){\r\n $nav.find(\".next\").hide();\r\n }else{\r\n $nav.find(\".next\").show();\r\n }\r\n }", "function toggleSubNav (listObjID, linkObj) {\n var listObj = document.getElementById(listObjID);\n // If sub nav items are hidden, show them\n if (listObj.style.display === \"none\") {\n listObj.style.display = \"block\";\n linkObj.querySelector(\".expandPlusSign\").style.display = \"none\";\n linkObj.querySelector(\".collapseMinusSign\").style.display = \"inline-block\";\n linkObj.querySelector(\".grayArrowLine\").style.display = \"block\";\n linkObj.setAttribute(\"aria-expanded\", true);\n }\n // If sub nav items are shown, hide them\n else {\n listObj.style.display = \"none\";\n linkObj.querySelector(\".expandPlusSign\").style.display = \"inline-block\";\n linkObj.querySelector(\".collapseMinusSign\").style.display = \"none\";\n linkObj.querySelector(\".grayArrowLine\").style.display = \"none\";\n linkObj.setAttribute(\"aria-expanded\", false);\n }\n}", "function displayUnitLinks()\n {\n // Delete all existing unit links\n var linksDiv = my.html.unitLinks\n Util.removeChildren(linksDiv)\n\n // Create new unit links\n for (var i = 0; i < Units.main.length; i++) {\n var label = 'སློབ་མཚན། ' + (i + 1)\n var selected = (i + 1 == my.current.unitNo)\n var href = unitHref(i + 1)\n\n var divElement = boxedLink(label, selected, href)\n divElement.id = 'unit' + (i + 1)\n divElement.title = unit(i + 1).title\n\n linksDiv.appendChild(divElement)\n }\n }", "setupSubLinks() {\n for (let subLink in this.subLinks) {\n this.subLinks[subLink].addEventListener(\"click\", (e) => {\n let linkID = e.target.id;\n if (linkID === \"\") {\n linkID = e.target.parentNode.id;\n }\n let subViewToShow = linkID.slice(0, -5);\n this.showSubView(subViewToShow);\n });\n }\n }", "function recalculateNavigationVisibility() {\r\n // TODO: Do this with a CSS class\r\n if (NUM_ACTIVE_REQUESTS > 0) {\r\n document.getElementsByClassName(\"comic-navigation\")[0].style.opacity = 0.5;\r\n } else {\r\n document.getElementsByClassName(\"comic-navigation\")[0].style.opacity = 1.0;\r\n }\r\n\r\n var page = getActivePageData()\r\n\r\n if (page === undefined) {\r\n // We're still loading\r\n return;\r\n }\r\n\r\n // TODO: Change these into CSS class for \"hidden\"\r\n if (page.slug === page.last) {\r\n document.getElementById(\"navigation-next\").style.display = \"none\";\r\n document.getElementById(\"navigation-last\").style.display = \"none\";\r\n } else {\r\n document.getElementById(\"navigation-next\").style.display = \"\";\r\n document.getElementById(\"navigation-last\").style.display = \"\";\r\n }\r\n if (page.slug === page.first) {\r\n document.getElementById(\"navigation-previous\").style.display = \"none\";\r\n document.getElementById(\"navigation-first\").style.display = \"none\";\r\n } else {\r\n document.getElementById(\"navigation-previous\").style.display = \"\";\r\n document.getElementById(\"navigation-first\").style.display = \"\";\r\n }\r\n\r\n document.getElementById(\"navigation-first\").blur();\r\n document.getElementById(\"navigation-previous\").blur();\r\n document.getElementById(\"navigation-next\").blur();\r\n document.getElementById(\"navigation-last\").blur();\r\n }", "function updateButtonDisplay () {\n\t\tvar isFirst = !!document.querySelector('.more-views .selected:first-child');\n\t\tvar isLast = !!document.querySelector('.more-views .selected:last-child');\n\n\t\tisLast ? nextButton.hide() : nextButton.show();\n\t\tisFirst ? previousButton.hide() : previousButton.show();;\n\t}", "function _updateThumbnailNavigation() {\n\t\tvar\n\t\t\tdiff = _safeWidth(thumbs.parent()) - _safeWidth(thumbs),\n\t\t\tpos = _getRTLPosition(thumbs);\n\t\tbtnScrollBack.toggleClass(CLASS_HIDDEN, pos >= 0);\n\t\tbtnScrollForward.toggleClass(CLASS_HIDDEN, diff > 0 || pos <= diff);\n\t}", "function setPageNavigation(list) {\n let liprev = document.getElementById('itemPage');\n let total = 0;\n if (list.length == 0) {\n document.getElementById('myPageNavigation').className = 'hide';\n } else {\n document.getElementById('myPageNavigation').className = 'd-flex justify-content-center';\n if (list.length % 10 == 0) {\n total = list.length / 10;\n totaltemp = total;\n } else {\n total = parseInt(list.length / 10) + 1;\n totaltemp = total;\n }\n liprev.innerHTML = '';\n for (let i = itemnavigate; i <= total; i++) {\n if (i >= itemnavigate && i <= itemnavigate + 4) {\n let li = document.createElement('li');\n let a = `<a class=\"page-link mylink\" href=\"#menuFeature\">${i}</a>`;\n li.innerHTML = a;\n liprev.appendChild(li);\n setEvenItemPageNavigate(li, list);\n if (i == itempage) {\n li.className = 'page-item textdecoration';\n li.setAttribute('id', 'active');\n } else {\n li.className = 'page-item';\n }\n }\n }\n if (total == 1) {\n document.getElementById('buttonprev').className = 'page-link mylink hide';\n document.getElementById('buttonnext').className = 'page-link mylink hide';\n } else {\n if (document.getElementById('active').firstChild.innerHTML == 1) {\n document.getElementById('buttonprev').className = 'page-link mylink hide';\n document.getElementById('buttonnext').className = 'page-link mylink show';\n } else if (document.getElementById('active').firstChild.innerHTML == total) {\n document.getElementById('buttonprev').className = 'page-link mylink show';\n document.getElementById('buttonnext').className = 'page-link mylink hide';\n } else {\n document.getElementById('buttonprev').className = 'page-link mylink show';\n document.getElementById('buttonnext').className = 'page-link mylink show';\n }\n }\n }\n}", "toggleChildren() {\n\t\tthis.setState({\n\t\t\tlinksVisible: !this.state.linksVisible\n\t\t});\n\t}", "function arrowVisibility () {\n if (thisEmployee.parent().next().length == 0) {\n $('#next').hide();\n } else {\n $('#next').show();\n }\n\n if (thisEmployee.parent().prev().length == 0) {\n $('#previous').hide();\n } else {\n $('#previous').show();\n }\n }", "function showMobileSubLInks(link){ \n let icon=link.children[1];\n let childUL=link.children[2];\n if(childUL.classList.contains('hide-mobile-sub-ul')){ \n $SC(icon, 'fa-angle-down', 'fa-angle-up');\n $SC(childUL, 'hide-mobile-sub-ul', 'show-mobile-sub-ul');\n } else{ \n $SC(icon, 'fa-angle-up', 'fa-angle-down');\n $SC(childUL, 'show-mobile-sub-ul', 'hide-mobile-sub-ul');\n }\n}", "function displayLinks (startIndex, numLinks) {\n\n for (let index = 0; index < linksToDisplay.length; index += 1) {\n if ((index >= startIndex) && (index < startIndex + numLinks)) {\n linksToDisplay[index].style.display = \"\";\n } else {\n linksToDisplay[index].style.display = \"none\";\n }\n }\n\n}", "function unitListVisible() {\n setVisible(!visible);\n }", "visibilityChanged()\n {\n super.visibilityChanged();\n\n if(!this.visibleRecursively)\n this.dropdownOpener.visible = false;\n }", "function recalculateNavigationVisibility() {\r\n // TODO: This might be re-rendering the page too often because it's messing with the style directly.\r\n // TODO: Do this with a CSS class\r\n if (NUM_ACTIVE_REQUESTS > 0) {\r\n setOpacity(\".navigation-wrapper\", 0.5);\r\n } else {\r\n setOpacity(\".navigation-wrapper\", 1);\r\n }\r\n\r\n const page = getActivePageData();\r\n\r\n if (page === undefined) {\r\n // We're still loading\r\n return;\r\n }\r\n\r\n // TODO: Change these into CSS class for \"hidden\"\r\n if (page.slug === page.last) {\r\n setOpacity(\".navigation-next, .navigation-last\", 0);\r\n } else {\r\n setOpacity(\".navigation-next, .navigation-last\", 1);\r\n }\r\n if (page.slug === page.first) {\r\n setOpacity(\".navigation-previous, .navigation-first\", 0);\r\n } else {\r\n setOpacity(\".navigation-previous, .navigation-first\", 1);\r\n }\r\n\r\n document.querySelectorAll(\".navigation-first, .navigation-previous, .navigation-next, .navigation-last\").forEach(function (e) {\r\n e.blur();\r\n });\r\n }", "function updateDirButtonsVisibility(){\r\n $magnifier.find('.button').show();\r\n if (current === 1 ){\r\n $magnifier.find('.button[data-dir=\"prev\"]').hide();\r\n } else if (current === numberOfImages){\r\n $magnifier.find('.button[data-dir=\"next\"]').hide();\r\n }\r\n }", "function toggleRels() {\n\tif($('#cont_rels').css('display') == 'none') {\n\t\t$('#cont_rels').css('display', 'block');\n\t\t$('#cont_rels_link').html('- Similar movies');\n\t} else {\n\t\t$('#cont_rels').css('display', 'none');\n\t\t$('#cont_rels_link').html('+ Similar movies');\n\t}\n}", "function conservationCon() {\n console.log(\"Links Changed\")\n document.getElementById(\"subLinks\").innerHTML = \"\";\n document.getElementById(\"subLinks\").innerHTML = \"<h3>Conservation</h3><ul><li><a href='#'><h4>Carolinian Canada</h4></a></li><li><a href='#'><h4>Friends of the Thames / Thames River Cleanup</h4></a></li><li><a href='#'><h4>Nature London</h4></a></li><li><a href='#'><h4>North Shore Steelhead Association</h4></a></li><li><a href='#'><h4>Ontario Streams</h4></a></li><li><a href='#'><h4>Ontario Federation of Anglers and Hunters</h4></a></li><li><a href='#'><h4>Trout Unlimited Canada</h4></a></li></ul>\";\n}", "function ShowNextPrevButtons(lastpage)\n{\n // Show Prev and Next buttons if there is more than 1 page.\n if (lastpage > 1)\n {\n $(\"#prev\").css(\"visibility\", \"visible\");\n $(\"#next\").css(\"visibility\", \"visible\");\n }\n else \n {\n $(\"#prev\").css(\"visibility\", \"hidden\");\n $(\"#next\").css(\"visibility\", \"hidden\"); \n } \n}", "updateMenuItemsDisplay () {\n const pg = this.page\n if (!pg) {\n // initial page load, header elements not yet attached but menu items\n // would already be hidden/displayed as appropriate.\n return\n }\n if (!this.user.authed) {\n Doc.hide(pg.noteMenuEntry, pg.walletsMenuEntry, pg.marketsMenuEntry, pg.profileMenuEntry)\n return\n }\n Doc.show(pg.noteMenuEntry, pg.walletsMenuEntry, pg.profileMenuEntry)\n if (Object.keys(this.user.exchanges).length > 0) {\n Doc.show(pg.marketsMenuEntry)\n } else {\n Doc.hide(pg.marketsMenuEntry)\n }\n }", "function showHidePanels() {\n // Show the next\n $('#banners ul li h2 a').not('li li').eq(currentNode).addClass('active');\n $('#banners li').not('li li').eq(currentNode).find('ul').slideDown();\n $('#banners li').not('li li').eq(currentNode).find('img').fadeIn();\n // Hide the previous\n $('#banners ul li h2 a').not('li li').eq(previousNode).removeClass('active');\n $('#banners li').not('li li').eq(previousNode).find('ul').slideUp();\n $('#banners li').not('li li').eq(previousNode).find('img').fadeOut();\n }", "function lijstSubMenuItem() {\n\n if ($mLess.text() == \"meer\") {\n $mLess.text(\"minder\")\n } else {\n $mLess.text(\"meer\");\n\n }\n $list.toggleClass('hidden')\n $resum.get(0).scrollIntoView('slow');\n event.preventDefault()\n }", "function _toggleButtons(){\n\n\t\t\t\tif($nav.children('.fn-previous-button').is(':hidden')){\n\t\t\t\t\t$nav.children('.fn-previous-button, .fn-next-button').show();\n\t\t\t\t \t$nav.children('.fn-close-button').hide();\n\t\t\t\t }\n\t\t\t\telse {\n\t\t\t\t\t$nav.children('.fn-previous-button, .fn-next-button').hide();\n\t\t\t\t \t$nav.children('.fn-close-button').show();\n\t\t\t\t}\n\t\t\t}", "function showNextSection(current, next) {\r\n document.getElementById(`rules-title`).style.display = `none`;\r\n document.getElementById(current).style.display = `none`;\r\n document.getElementById(next).style.display = `block`;\r\n}" ]
[ "0.6815112", "0.6497733", "0.6421594", "0.63802665", "0.6369621", "0.6159566", "0.59982234", "0.5988072", "0.5962577", "0.5941914", "0.59193903", "0.57708377", "0.5681644", "0.56591916", "0.5647338", "0.5598288", "0.55446005", "0.5538505", "0.5519809", "0.5513127", "0.5512945", "0.5487881", "0.54627854", "0.5452651", "0.54026324", "0.53968394", "0.538439", "0.5358553", "0.5341277", "0.5335947" ]
0.8930255
0
Display the number of characters in the current lesson as a tooltip for progress bar and progress percent.
function updateProgressTooltip() { my.html.progress.title = 'This lesson contains ' + my.current.subunitText.length + ' characters.' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getText()\n\t{\n\t\tif (that.showUsed)\n\t\t\treturn \"Tries used: \" + that.current;\n\t\telse\n\t\t\treturn \"Tries left: \" + (that.maximum - that.current);\n\t}", "function progressCounter() {\n return document.getElementById(\"counter\").innerHTML =\n `Score: ${questionCount}/12`;\n}", "renderPresenceHelp() {\n var cmds = require('@commands');\n var n = (this.getTotalCharacterCount() / 1000).toFixed(1);\n return cmds.command_char + `help, ${Number.isNaN(n) ? 0 : n}k chars`;\n }", "stats() {\n let timeLeft = parseInt(document.getElementById(\"time-remaining\").innerHTML);\n let totalTime = 100 - timeLeft;\n let flipCount = parseInt(document.getElementById(\"flips\").innerHTML);\n document.getElementById(\"victory-p\").innerHTML = `You took ${totalTime} seconds and ${flipCount} flips!`;\n }", "function showQuestionCounter(questionNumber) {\n return \"Question \" + (questionNumber) + \" of \" + questionAnswersOptions.length;\n}", "function setResultTooltips()\n {\n var textLength = my.current.subunitText.length\n var charNoun = textLength == 1 ? 'character' : 'characters'\n\n // Speed tooltip\n my.html.speed.title =\n 'You have typed ' + textLength + ' ' + charNoun +\n ' in\\n' +\n Util.prettyTime(my.current.timeElapsed) + '.\\n\\n' +\n 'Your typing speed is\\n' +\n my.current.wpm + ' words per minute, or\\n' +\n my.current.cpm + ' characters per minute.'\n\n\n // Error rate tooltip\n var errorRateTooltip\n var accuracyTooltip\n\n // Update error rate\n if (my.current.errorRate == Number.POSITIVE_INFINITY) {\n errorRateTooltip = '\\u221e'\n accuracyTooltip = 0\n } else {\n errorRateTooltip = parseFloat(my.current.errorRate.toFixed(1))\n accuracyTooltip = 100 - errorRateTooltip\n }\n\n var errorNoun = my.current.errors == 1 ? 'error' : 'errors'\n\n var title =\n 'You have typed ' + textLength + ' ' + charNoun +\n '.\\n' +\n 'You have made ' + my.current.errors + ' ' +\n errorNoun + '.\\n' +\n 'Your error rate is ' + errorRateTooltip + '%.\\n' +\n 'Your accuracy is ' + accuracyTooltip + '%.\\n'\n\n my.html.error.title = title\n }", "function questionNumber() {\n var currentQuestionNumber = quiz.questionIndex + 1;\n var element = document.getElementById(\"progress\");\n element.innerHTML = \"Question \" + currentQuestionNumber + \" of \" + quiz.questions.length;\n \n}", "function showProgress() {\n var currentQuestionNumber = quiz.questionIndex + 1;\n var element = document.getElementById(\"progress\");\n element.innerHTML = \"Question \" + currentQuestionNumber + \" of \" + quiz.questions.length;\n}", "function showProgress(){\r\n var currentQuestionNumber = quiz.questionIndex + 1;\r\n var element = document.getElementById(\"progress\");\r\n element.innerHTML = \"Question \" + currentQuestionNumber + \" of \" + quiz.questions.length;\r\n}", "function charCount() {\n\n\tif (this.about_me.value.length <= 140) {\n\t\tvar x = document.getElementById(\"characters\");\n\t\tx.innerHTML = '<p>' + this.about_me.value.length + '</p>';\n\t} else {\n\t\tvar x = document.getElementById(\"characters\");\n\t\tx.innerHTML = '<p style=\"color:red;\">' + (140 - this.about_me.value.length) + '</p>';\n\t}\n\n\n}", "function displayAbilityPointsTotal() {\n document.getElementById(\"remainingPoints\").innerHTML = \"<b>Remaining Points: \" + (20 - character.getUserPointsTotal());\n}", "function getStatusHtml() { \n return `<div class='status_bar'>\n <span>Question ${getCurrentNum() + 1} / ${DATA_SOURCE.length}</span>\n <span>Score ${getRightCnt()}</span>\n </div>`;\n}", "function display_tip() {\n if (pause_on_tile === true) {\n g.paused = true;\n }\n\n show_description(g.progress); //description.js\n\n g.progress = g.progress + 1;\n}", "function showProgress(quiz) {\n var currentQuestionNumber = quiz.questionIndex + 1;\n var element = document.getElementById(\"progress\");\n element.innerHTML = \"Question \" + currentQuestionNumber + \" of \" + quiz.questions.length;\n}", "function countTitle(str) {\r\n\tvar length = str.length;\r\n\tif(length > 50){\r\n\t\tdocument.getElementById(\"count-title\").classList.add(\"text-danger\");\r\n\t\tdocument.getElementById(\"count-title\").classList.remove(\"text-secondary\");\r\n\t} else{\r\n\t\tdocument.getElementById(\"count-title\").classList.add(\"text-secondary\");\r\n\t\tdocument.getElementById(\"count-title\").classList.remove(\"text-danger\");\r\n\t}\r\n\tdocument.getElementById(\"count-title\").innerHTML = length + '/50';\r\n}", "function showProgress() {\n var currentQuestionNumber = quiz.questionIndex + 1;\n $('#progress').html(\"Question \" + currentQuestionNumber + \" of \" + quiz.questions.length);\n}", "function progress(piece, nbPieces, page, nbPages, doc, nbDocs) {\n var percent = (piece/nbPieces)*100;\n $(\"#progress .progress-bar\").attr('aria-valuenow', percent).attr('style','width:'+percent.toFixed(2)+'%').find(\"span\").html(percent.toFixed(0) + \"%)\");\n $(\"#progressPiece\").html(\"Piece \" + piece + \"/\" + nbPieces);\n $(\"#progressPage\").html((page && nbPages) ? \"Page \" + page + \"/\" + nbPages : \"\");\n $(\"#progressDoc\").html((doc && nbDocs) ? \"Document \" + doc + \"/\" + nbDocs : \"\");\n}", "function updateChar() {\n tweet1Count.textContent = tweet1.textLength;\n}", "function showProgress() {\n console.log(quiz)\n var currentQuestionNumber = quiz.qindex;\n var element = document.getElementById(\"progress\");\n element.innerHTML = \"Question\" + currentQuestionNumber + \"of \" + quiz.questions.length;\n}", "function toolTipHTML() {\n return \"100\";\n }", "function showDataPointCount() {\n $('.dataPoints').html('<span class=\"bold\">' + dataPointCounter + ' p/s</span>');\n dataPointCounter = 0;\n}", "function questionNum() {\n $(\".questionNum\").text(\"Question \" + questionCounter + \" of 10\");\n }", "getTooltipText(){\n\t\t\n\t\tconst isConsumable = this.isConsumable(),\n\t\t\tisBreakable = ~this.slots.indexOf(Asset.Slots.upperBody) || ~this.slots.indexOf(Asset.Slots.lowerBody)\n\t\t;\n\t\tlet html = '';\n\t\t// Usable items shows the action tooltip instead\n\t\tif( isConsumable && !this.iuad )\n\t\t\treturn this.use_action.getTooltipText(true, this.rarity);\n\n\t\tlet apCost = this.equipped ? Game.UNEQUIP_COST : Game.EQUIP_COST;\n\n\n\t\thtml += '<strong class=\"'+(Asset.RarityNames[this.rarity])+'\">'+esc(this.name)+'</strong><br />';\n\t\t// Low level indicator (only affects upper/lowerbody since they're the only ones that give protection\n\t\tif( \n\t\t\tthis.isLowLevel() && \n\t\t\t(this.slots.includes(Asset.Slots.upperBody) || this.slots.includes(Asset.Slots.lowerBody)) \n\t\t){\n\n\t\t\tif( this.durability )\n\t\t\t\thtml += '<em style=\"color:#FAA\">Low level, armor reduced</em><br />';\n\t\t\telse\n\t\t\t\thtml += '<em style=\"color:#FAA\">Broken!</em><br />';\n\n\t\t}\n\t\t\n\t\thtml += '<em class=\"sub\">';\n\t\tif( game.battle_active && this.parent )\n\t\t\thtml += '[<span style=\"color:'+(this.parent.ap >= apCost ? '#DFD' : '#FDD')+'\">'+\n\t\t\t\tapCost+' AP to '+(this.equipped ? 'take off' : 'equip')+\n\t\t\t'</span>]<br />';\n\n\t\tif( this.equippable() ){\n\n\t\t\tlet lv = this.getLevel() || 0;\n\t\t\tif( lv < 0 )\n\t\t\t\tlv = game.getAveragePlayerLevel()+Math.abs(lv)-1;\n\t\t\t\n\t\t\thtml += 'Lv '+lv+' | ';\n\t\t\t\n\t\t\tif( this.isDamageable() )\n\t\t\t\thtml += (+this.durability)+'/'+this.getMaxDurability()+' Durability | ';\n\n\t\t}\n\t\thtml += this.getWeightReadable()+' ';\n\t\tif( this.equippable() ){\n\t\t\thtml += '| ';\n\t\t\tif(this.slots.length && !this.equipped)\n\t\t\t\thtml+= '<strong>'+this.slots.map(el => el.toUpperCase()).join(' + ')+'</strong>';\n\t\t\telse if(this.slots.length)\n\t\t\t\thtml+= 'Equipped <strong>'+this.slots.map(el => el.toUpperCase()).join(' + ')+'</strong>';\n\t\t}\n\t\thtml += '</em><br />';\n\n\t\t\n\t\t// Special tags:\n\t\t/*\n\t\t\t%TOD - Approximate time of day\n\t\t*/\n\t\tlet aDesc = this.description\n\t\t\t.split('%TOD').join(game.getApproxTimeOfDay())\n\t\t;\n\t\t\n\t\thtml += esc(aDesc);\n\n\t\thtml += '<div class=\"assetWrappers\">';\n\t\tfor( let wrapper of this.wrappers ){\n\n\t\t\tif( wrapper.description ){\n\t\t\t\t\n\t\t\t\tlet color = '#FAA';\n\t\t\t\tif( wrapper.rarity > 0 )\n\t\t\t\t\tcolor = Asset.RarityColors[wrapper.rarity];\n\t\t\t\tlet desc = wrapper.description;\n\n\t\t\t\thtml += '<br /><span style=\"color:'+color+'\">'+esc(desc)+'</span>';\n\n\t\t\t}\n\t\t}\n\t\thtml += '</div>';\n\n\t\treturn html;\n\t}", "updateDisplayString() {\n this.displayString = 'Increase ' + this.name + ' by ' + this.value + ' ' + this.measuringUnit;\n }", "function setAttemptText() {\n attemptTracker.innerHTML = \"You can select \" + attemptsLeft + \" more tile(s).\";\n}", "function showProgress()\n\t{\n var progress = document.getElementById(\"questionIndex\");\n progress.innerHTML = \"Question \" + indexNumber + \" of \" + total;\n\t indexNumber++;\n\t}", "function showProgress() {\n $(\".questionNumber\").text(questionNumber);\n console.log('showing progress');\n}", "function showProgress() {\n var currentQuestionNumber = quiz.triviaQuestionIndex + i;\n var element = document.getElementById(\"#progress\");\n element.innerHTML = \"Question \" + currentQuestionNumber + \"of \" + quiz.triviaQuestions.length;\n}", "showDescription(tempVal) {\r\n return (h(\"g\", { class: \"description-container sc-dxp-progressbar-0\", transform: ((this.dir && this.dir === 'rtl') ? 'scale(-1, 1) translate(-100, 0)' : ''), \"transform-origin\": \"center\" },\r\n h(\"text\", { x: \"50\", y: this.showPercentage ? '50' : '45', class: \"svg-stats sc-dxp-progressbar-0\", \"alignment-baseline\": \"middle\", \"text-anchor\": \"middle\" }, tempVal),\r\n h(\"text\", { x: \"50\", y: this.showPercentage ? '67' : '60', class: \"svg-description sc-dxp-progressbar-0\", \"alignment-baseline\": \"middle\", \"text-anchor\": \"middle\" }, this.progressDescription)));\r\n }", "function drawLabel() {\n p.text(`Trials: ${p.props.playedGames}/${p.props.countOfGames}`, 20, p.wrapper.offsetHeight-20);\n }" ]
[ "0.63974106", "0.63857794", "0.6294473", "0.608395", "0.60486114", "0.60395604", "0.60382754", "0.6016912", "0.6004261", "0.5978744", "0.59687585", "0.5904694", "0.589417", "0.5893446", "0.5883062", "0.58821046", "0.5881417", "0.58747065", "0.5828251", "0.5799645", "0.5796174", "0.5773258", "0.57575035", "0.5755384", "0.574395", "0.57376766", "0.5733984", "0.57333666", "0.5717199", "0.5702513" ]
0.7974769
0
Display alternate unit links for units which alternate units are available. Display nothing otherwise.
function displayAlternateUnitLinks() { // If alternate unit is not available for the current unit, // hide the alternate links element if (!alternateUnitAvailable(my.current.unitNo)) { alternateUnitLinks.style.visibility = 'hidden' return } // Delete all existing alternate unit links Util.removeChildren(alternateUnitLinks) // Create div elements for the main unit and alternate unit var mainUnitElement = boxedLink(Units.mainLabel, my.settings.unit == my.UNIT.MAIN, '#', toggleUnit) var alternateUnitElement = boxedLink(Units.alternateLabel, my.settings.unit == my.UNIT.ALTERNATE, '#', toggleUnit) alternateUnitLinks.appendChild(mainUnitElement) alternateUnitLinks.appendChild(alternateUnitElement) alternateUnitLinks.style.visibility = 'visible' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayUnitLinks()\n {\n // Delete all existing unit links\n var linksDiv = my.html.unitLinks\n Util.removeChildren(linksDiv)\n\n // Create new unit links\n for (var i = 0; i < Units.main.length; i++) {\n var label = 'སློབ་མཚན། ' + (i + 1)\n var selected = (i + 1 == my.current.unitNo)\n var href = unitHref(i + 1)\n\n var divElement = boxedLink(label, selected, href)\n divElement.id = 'unit' + (i + 1)\n divElement.title = unit(i + 1).title\n\n linksDiv.appendChild(divElement)\n }\n }", "function displaySubunitLinks()\n {\n // Delete all existing subunit links\n var linksDiv = my.html.subunitLinks\n while (linksDiv.firstChild &&\n linksDiv.firstChild.className != 'stretch') {\n\n linksDiv.removeChild(linksDiv.firstChild)\n }\n\n // Create new subunit links for the unit m\n var numberOfSubunits = my.current.subunitTitles.length\n for (var i = numberOfSubunits - 1; i >= 0; i--) {\n // Insert whitespaces between div elements, otherwise they\n // would not be justified\n var whitespace = document.createTextNode('\\n')\n linksDiv.insertBefore(whitespace, linksDiv.firstChild)\n\n var label = my.current.subunitTitles[i]\n var selected = (i + 1 == my.current.subunitNo)\n var href = unitHref(my.current.unitNo, i + 1)\n\n var subunitDiv = boxedLink(label, selected, href)\n subunitDiv.id = 'subunit' + (i + 1)\n subunitDiv.style.width = (95 / numberOfSubunits) + '%'\n\n linksDiv.insertBefore(subunitDiv, linksDiv.firstChild)\n }\n }", "function updateNavigationLinks()\n {\n if (currentSubunitIsTheFirstSubunit()) {\n my.html.previousLink.style.visibility = 'hidden'\n my.html.nextLink.style.visibility = 'visible'\n } else if (currentSubunitIsTheLastSubunit()) {\n my.html.previousLink.style.visibility = 'visible'\n my.html.nextLink.style.visibility = 'hidden'\n } else {\n my.html.previousLink.style.visibility = 'visible'\n my.html.nextLink.style.visibility = 'visible'\n }\n }", "function alternateUnitAvailable(m)\n {\n if (m >= Units.alternateStart &&\n m < Units.alternateStart + Units.alternate.length) {\n return true\n } else {\n return false\n }\n }", "function unitHref(m, n)\n {\n if (typeof m == 'undefined') {\n return ''\n } else if (typeof n == 'undefined') {\n return '#' + m\n } else {\n return '#' + m + '.' + n\n }\n }", "function displayUnitTitle() {\n\n // Parts of the unit title\n var unitNo = 'སློབ་མཚན། ' + my.current.unitNo +\n '.' + my.current.subunitNo\n var space = '\\u00a0\\u00a0'\n var title = '[' + my.current.unit.title + ']'\n\n Util.setChildren(my.html.unitTitle, unitNo, space, title)\n }", "function displayAlternativeSettings(){\n displaySettings();\n alternatives.showAlternative(alternativeList[1]);\n}", "function unit() {\n // Add more tests here.\n return linkUnit();\n}", "function nextSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheLastSubunit()) {\n if (n == my.current.subunitTitles.length) {\n // If the user is at unit M.L where L is the last\n // subunit of unit M, then go to unit (M + 1).1.\n m++\n n = 1\n } else {\n // If the user is at unit M.N, then go to unit M.(N + 1).\n n++\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "function renderUnit(unit) {\n return crel('li',\n crel('span', {'class':'naam'}, unit.naam), \n crel('span', {'class':'afkorting'}, unit.afkorting),\n crel('span', {'class':'wikilink'},\n crel ('a', {'href':unit.wikilink},unit.wikilink)),\n crel('span', {'class':'wow'}, unit.wieofwat),\n crel('span', {'class':'foto'}, \n crel ('img', {'src': unit.foto})),\n )\n }", "function showUnits() {\n console.log(\"showUnits()\");\n units.forEach(unit => {\n /*\n // add unit names to page\n var unitName = document.createElement(\"h1\");\n unitName.innerText = unit.fields.name;\n document.body.appendChild(unitName);\n\n // add unit location to page\n unitLocation = document.createElement(\"p\");\n unitLocation.innerText = unit.fields.location;\n document.body.appendChild(unitLocation);\n\n // add image to page\n var unitImage = document.createElement(\"img\");\n unitImage.src = unit.fields.image[0].url;\n document.body.appendChild(unitImage); */\n\n // creating a new div container, where our unit info will go\n var unitContainer = document.createElement(\"div\");\n unitContainer.classList.add(\"unit-container\");\n document.querySelector(\".container\").append(unitContainer);\n\n // add unit names to unit container\n var unitName = document.createElement(\"h2\");\n unitName.classList.add(\"unit-name\");\n unitName.innerText = unit.fields.name;\n unitContainer.append(unitName);\n\n // add location to unit container\n var unitLocation = document.createElement(\"h3\");\n unitLocation.classList.add(\"unit-location\");\n unitLocation.innerText = unit.fields.location;\n unitLocation.style.color = \"#5F5C4F\";\n unitContainer.append(unitLocation);\n\n // add description to container\n var unitDescription = document.createElement(\"p\");\n unitDescription.classList.add(\"unit-description\");\n unitDescription.innerText = unit.fields.description;\n unitContainer.append(unitDescription);\n\n // add image to container\n var unitImage = document.createElement(\"img\");\n unitImage.classList.add(\"unit-image\");\n unitImage.src = unit.fields.image[0].url;\n unitContainer.append(unitImage);\n\n // add event listener\n // when user clicks on unit container\n // image and description will appear or disappear\n unitContainer.addEventListener(\"click\", function() {\n unitDescription.classList.toggle(\"active\");\n unitImage.classList.toggle(\"active\");\n });\n\n // add to each container as a class\n var unitCh = unit.fields.chapter;\n console.log(unitCh);\n unitContainer.classList.add(unitCh);\n\n // filter by chapter 2\n var filterCh2 = document.querySelector(\".ch2\");\n filterCh2.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter2\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh3 = document.querySelector(\".ch3\");\n filterCh3.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter3\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh4 = document.querySelector(\".ch4\");\n filterCh4.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter4\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh5 = document.querySelector(\".ch5\");\n filterCh5.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter5\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh6 = document.querySelector(\".ch6\");\n filterCh6.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter6\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh9 = document.querySelector(\".ch9\");\n filterCh9.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter9\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh13 = document.querySelector(\".ch13\");\n filterCh13.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter13\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh14 = document.querySelector(\".ch14\");\n filterCh14.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter14\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh17 = document.querySelector(\".ch17\");\n filterCh17.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter17\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var reset = document.querySelector(\".reset\");\n reset.addEventListener(\"click\", function(){\n unitContainer.style.background = \"#9f9b86\";\n })\n });\n}", "function unit(m)\n {\n if (alternateUnitAvailable(m) &&\n my.settings.unit == my.UNIT.ALTERNATE) {\n return Units.alternate[m - Units.alternateStart]\n } else {\n return Units.main[m - 1]\n }\n }", "function displayGuide() {\n my.html.guide.innerHTML = my.current.unit.guide\n }", "function unitListVisible() {\n setVisible(!visible);\n }", "show() {\n for (let node of this.nodes) {\n node.show();\n node.showLinks();\n }\n }", "function eLink(db,nm) {\n\tdbs = new Array(\"http://us.battle.net/wow/en/search?f=wowitem&q=\",\"http://www.wowhead.com/?search=\");\n\tdbTs = new Array(\"Armory\",\"Wowhead\");\n\tdbHs = new Array(\"&real; \",\"&omega; \");\n\tel = '<a href=\"'+ dbs[db]+nm + '\" target=\"_blank\" title=\"'+ dbTs[db] +'\">'+ dbHs[db] + '</a>';\n\treturn el;\n}", "function showLinks() {\n var imageEl = document.getElementById('image');\n var voiceEl = document.getElementById('voice');\n for (var i = 0; i < visibleLinks.length; ++i) {\n if(RegExp('jpg|jpeg|png|gif').test(visibleLinks[i])){\n imageEl.dataset.url = visibleLinks[i];\n imageEl.style.display = null;\n } else if(RegExp('wav|mp3').test(visibleLinks[i])) {\n voiceEl.dataset.url = visibleLinks[i];\n voiceEl.style.display = null;\n }\n }\n}", "function showLinkLabel(e) {\n var label = e.subject.findObject(\"LABEL\");\n if (label !== null) label.visible = (e.subject.fromNode.data.figure === \"Diamond\");\n }", "function showItineraryInfo(){\n\tif(directionsDisplay){\n\t\tvar html = '';\n\t\thtml += '<div id=\"intinerary\"><ul>Your Itinerary:';\n\t\tvar letter = 'A';\n\t\tfor(var i=0;i<itinerary.length;i++){\n\t\t\thtml += '<li>'+letter+': '+results[itinerary[i]].name+'</li>';\n\t\t\tletter = String.fromCharCode(letter.charCodeAt(0) + 1);\n\t\t}\n\t\thtml += '</ul></div>';\n\t\t\n\t\titineraryContainer.innerHTML = html;\n\t\tdirectionsDisplay.setPanel(document.getElementById('intinerary'));\n\t}\n}", "function displaySongsByArtist(targetdiv,linker,grouplinker) {\n var route = \"/songs\";\n if (searchstring !== \"\") route += \"?search=\"+searchstring;\n getServerData(route, function(songs) {\n var artists = {};\n songs.forEach(function(song) {\n if (typeof artists[song.artist] === 'undefined') artists[song.artist] = [];\n artists[song.artist].push(song);\n });\n\n targetdiv.innerHTML = \"\";\n var artistid = 0;\n for (artistname in artists) {\n targetdiv.appendChild(\n createAccordionNode(targetdiv,artistid++, artistname, artists[artistname],\"artist\",linker,grouplinker)\n );\n }\n });\n}", "function toggleUnit()\n {\n var newUnit\n var confirmMessage\n\n if (my.settings.unit == my.UNIT.MAIN) {\n newUnit = my.UNIT.ALTERNATE\n confirmMessage = Units.alternateConfirmMessage\n } else {\n newUnit = my.UNIT.MAIN\n confirmMessage = Units.mainConfirmMessage\n }\n\n if (!confirm(confirmMessage)) {\n return false\n }\n\n localStorage.unit = newUnit\n loadSettings()\n updateUnitFromURL()\n return false\n }", "function displayLinks (startIndex, numLinks) {\n\n for (let index = 0; index < linksToDisplay.length; index += 1) {\n if ((index >= startIndex) && (index < startIndex + numLinks)) {\n linksToDisplay[index].style.display = \"\";\n } else {\n linksToDisplay[index].style.display = \"none\";\n }\n }\n\n}", "function currentSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n window.location.href = unitHref(m, n)\n }", "function updateDisplay(ensembles)\n{\n\tif(ensembles == undefined){\n\t\t$(\"alsoModule\").style.display = \"none\";\n\t\t$(\"outfit_link\").style.display = \"none\";\n\t\treturn;\n\t}\n\tif (ensembles.length <= 0 ) {\n\t\t$(\"alsoModule\").style.display = \"none\";\n\t\t$(\"outfit_link\").style.display = \"none\";\n\t\treturn;\n\t}\n\tvar out = document.getElementById(\"thumbs\");\n\tout.innerHTML = \"\";\n\tulElement = createTag('ul', 'alsoModuleContent', 'thumbs clearfix');\n\tfor (var i = 0; i < ensembles.length; i++) {\n\t\tvar image = ensembles[i].img;\n\t\tvar ensemble_id = ensembles[i].id;\n\t\tvar name = ensembles[i].name;\n\t\tvar imgElement = createDOM('img', {'src':'' + image});\n var bodyClassName = document.body.className;\n var aElement;\n if (bodyClassName.match('STANDALONE-PRODUCT-PAGE')){\n var ensembleUrl = getBaseURL() + '/catalog/product.jsp?ensembleId=' + ensemble_id;\n var ebCMCatInfo = $(\"ebCM_CATEGORY_INFO\");\n var categoryInfo = null;\n if (ebCMCatInfo !== null) {\n \tcategoryInfo = $(\"ebCM_CATEGORY_INFO\").value;\n } \n if(categoryInfo == null || categoryInfo == \"null\"){\n \t aElement = createDOM('a', {'href':ensembleUrl, 'alt':'' + name});\n }\n else {\n \t aElement = createDOM('a', {'href':ensembleUrl+categoryInfo, 'alt':'' + name});\n }\n } else {\n aElement = createDOM('a', {'href':'javascript:YAHOO.ebauer.productUtils.completer(\\'' + ensemble_id + '\\')' , 'alt':'' + name});\n }\n aElement.appendChild(imgElement);\n\t\t//var aElement = createDOM('a', {'href':'javascript:YAHOO.ebauer.productUtils.completer(\\'' + ensemble_id + '\\')' , 'alt':'' + name});\n\n\n\t\tvar liElement = '';\n\t\tif (ensemble_id == shownEnsembleId) {\n\t\t\tliElement = createTag('li', 'alsoThumb' + i, 'hot', aElement);\n\t\t} else {\n\t\t\tliElement = createTag('li', 'alsoThumb' + i, 'not', aElement);\n\t\t}\n\t\tulElement.appendChild(liElement);\n\t}\n\tout.appendChild(ulElement);\n}", "function show_mainUnit(){\n $(\".bg-model2,.bg-model3,.bg-model4,.bg-model5,.bg-model6,.bg-model7,.bg-model8\").css('display', 'none');\n $(\".bg-model\").css('display', 'flex');\n }", "function setDisplayUnits(units) {\n if (units === 'nautical') {\n localStorage['displayUnits'] = \"nautical\";\n } else if (units === 'metric') {\n localStorage['displayUnits'] = \"metric\";\n } else if (units === 'imperial') {\n localStorage['displayUnits'] = \"imperial\";\n }\n onDisplayUnitsChanged();\n}", "populateUnitMenus() {\n\t\tlet category = this.m_catMenu.value;\n\t\tthis.m_unitAMenu.innerHTML = \"\";\n\t\tCONFIG[category].forEach(function(item) {\n\t\t\tGUI.m_unitAMenu.innerHTML += \"<option value=\\\"\" + item[0] + \"\\\">\" + item[1] + \"</option>\";\n\t\t});\n\t\t\n\t\tthis.m_unitBMenu.innerHTML = \"\";\n\t\tCONFIG[category].forEach(function(item) {\n\t\t\tGUI.m_unitBMenu.innerHTML += \"<option value=\\\"\" + item[0] + \"\\\">\" + item[1] + \"</option>\";\n\t\t});\n\t}", "function atLinks() {\n linklist = [\"239MTG\", \"affinityforartifacts\", \"alliesmtg\", \"AllStandards\", \"Alphabetter\", \"Amonkhet\", \"architectMTG\", \"ArclightPhoenixMTG\", \"aristocratsMTG\", \"BadMTGCombos\", \"basementboardgames\", \"BaSE_MtG\", \"BudgetBrews\", \"budgetdecks\", \"BulkMagic\", \"cardsphere\", \"casualmtg\", \"CatsPlayingMTG\", \"CircuitContest\", \"cocomtg\", \"CompetitiveEDH\", \"custommagic\", \"DeckbuildingPrompts\", \"edh\", \"EDHug\", \"EggsMTG\", \"ElvesMTG\", \"enchantress\", \"EsperMagic\", \"findmycard\", \"fishmtg\", \"FlickerMTG\", \"freemagic\", \"goblinsMTG\", \"HamiltonMTG\", \"HardenedScales\", \"humansmtg\", \"infect\", \"johnnys\", \"kikichord\", \"lanternmtg\", \"lavaspike\", \"locketstorm\", \"lrcast\", \"magicarena\", \"Magicdeckbuilding\", \"MagicDuels\", \"magicTCG\", \"magicTCG101\", \"MakingMagic\", \"marchesatheblackrose\", \"marduMTG\", \"MentalMentalMagic\", \"millMTG\", \"ModernLoam\", \"modernmagic\", \"ModernRecMTG\", \"modernspikes\", \"ModernZombies\", \"monobluemagic\", \"mtg\", \"MTGAngels\", \"mtgbattlebox\", \"mtgbracket\", \"mtgbrawl\", \"mtgbudgetmodern\", \"mtgcardfetcher\", \"mtgcube\", \"MTGDredge\", \"mtgfinalfrontier\", \"mtgfinance\", \"mtgfrontier\", \"mtglegacy\", \"MTGManalessDredge\", \"MTGMaverick\", \"mtgmel\", \"mtgrules\", \"mtgspirits\", \"mtgtreefolk\", \"mtgvorthos\", \"neobrand\", \"nicfitmtg\", \"oathbreaker_mtg\", \"oldschoolmtg\", \"pauper\", \"PauperArena\", \"PauperEDH\", \"peasantcube\", \"PennyDreadfulMTG\", \"PioneerMTG\", \"planeshiftmtg\", \"ponzamtg\", \"RatsMTG\", \"RealLifeMTG\", \"RecklessBrewery\", \"rpg_brasil\", \"scapeshift\", \"shittyjudgequestions\", \"sistersmtg\", \"skredred\", \"Sligh\", \"spikes\", \"stoneblade\", \"StrangeBrewEDH\", \"SuperUltraBudgetEDH\", \"therandomclub\", \"Thoptersword\", \"threecardblind\", \"TinyLeaders\", \"TronMTG\", \"UBFaeries\", \"uwcontrol\", \"xmage\", \"reddit.com/message\", \"reddit.com/user/MTGCardFetcher\"]\n\n for (j = 0; j < linklist.length; j++) {\n if (location.href.toLowerCase().includes(linklist[j].toLowerCase()))\n return true;\n }\n return false;\n}", "function displayArtEuropeana(data) {\n for (let i = 0; i < data.items.length; i++) {\n const art = document.querySelector(\".art-div\");\n\n const artLink = document.createElement(\"a\");\n const artImage = document.createElement(\"img\");\n\n artLink.appendChild(artImage);\n artLink.href = data.items[i].guid;\n artLink.setAttribute(\"target\", \"_blank\");\n artLink.classList.add(\"flex-item\");\n \n artImage.src = data.items[i].edmIsShownBy[0];\n artImage.alt = data.items[i].title;\n art.appendChild(artLink);\n }\n}", "function frmPatientSummary_showSegUnits() {\n searchPatient_closeSearchList();\n kony.print(\"------frmPatientSummary_showSegUnits---->>\");\n if(frmPatientSummary.fcunitslist.isVisible) {\n frmPatientSummary.fcunitslist.setVisibility(false);\n } else {\n frmPatientSummary.fcunitslist.setVisibility(true);\n }\n frmPatientSummary.fcwoundslist.setVisibility(false);\n frmPatientSummary.forceLayout();\n}" ]
[ "0.77809185", "0.7369583", "0.58161587", "0.5763911", "0.56235474", "0.55743605", "0.54173905", "0.51850575", "0.5181195", "0.51405776", "0.5051855", "0.49769798", "0.4955198", "0.49350837", "0.48927215", "0.4863896", "0.48422644", "0.4814439", "0.48136592", "0.48125017", "0.4800615", "0.47920805", "0.47880828", "0.47842285", "0.4765942", "0.47552675", "0.47155598", "0.46939862", "0.4693005", "0.46923605" ]
0.8933749
0
Toggle between main unit and alternate unit
function toggleUnit() { var newUnit var confirmMessage if (my.settings.unit == my.UNIT.MAIN) { newUnit = my.UNIT.ALTERNATE confirmMessage = Units.alternateConfirmMessage } else { newUnit = my.UNIT.MAIN confirmMessage = Units.mainConfirmMessage } if (!confirm(confirmMessage)) { return false } localStorage.unit = newUnit loadSettings() updateUnitFromURL() return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toggle(){this.off=!this.off}", "toggle4() {\r\n }", "doClick( evt ) {\n if( evt.altKey ) {\n let alternate = new CustomEvent( Thermometer.ALTERNATE, {\n detail: {\n status: this.status()\n }\n } );\n this.root.dispatchEvent( alternate );\n } else {\n // Toggle units\n if( this.display == Thermometer.FAHRENHEIT ) {\n this.display = Thermometer.CELCIUS;\n } else {\n this.display = Thermometer.FAHRENHEIT;\n }\n\n // Update display\n this.update();\n }\n }", "modeBtnAction() {\n console.log('Toggling scale mode/unit')\n this._unit = trickler.TricklerUnits.GRAINS === this._unit ? trickler.TricklerUnits.GRAMS : trickler.TricklerUnits.GRAINS\n }", "static toggle() {\n if (this.isLight()) {\n this.dark()\n } else {\n this.light()\n }\n }", "function simpleSwitcherToggle() {\n \"use strict\";\n $(\"#switcher-head .button\").toggle(function() {\n $(\"#style-switcher\").animate({\n left: 0\n }, 500);\n }, function() {\n $(\"#style-switcher\").animate({\n left: -263\n }, 500);\n });\n }", "function togglePlaySimulation(){\n playing = !playing;\n sPlanetIndex = -1;\n atStart = false;\n}", "function toggleLight() {\n setLit(!islit);\n }", "function toggle(t) {\n\tt.reversed() ? t.play() : t.reverse();\n\t\n}", "function toggle()\n{\n\tif(speed == 0) \n\t{\n\t\tspeed = 3; //start snake and set button to stop\n\t\tdocument.getElementById(\"toggle\").value = \"Stop\";\n\t}\n\telse \n\t{\n\t\tspeed = 0; //stop the snake and set button to start\n\t\tdocument.getElementById(\"toggle\").value = \"Start\";\n\t}\n}", "function toggleMeasurement() {\n let currentUnit = document.querySelector('#unit-wrapper').getAttribute('data-measure');\n if(currentUnit == 'imperial') {\n // Metric\n measureUpdate('metric');\n document.querySelector('#unit-wrapper').setAttribute('data-measure', 'metric');\n writeCookie('canitube_Settings_Unit Measure', 'metric', 10000000);\n } else {\n // Imperial\n measureUpdate('imperial');\n document.querySelector('#unit-wrapper').setAttribute('data-measure', 'imperial');\n writeCookie('canitube_Settings_Unit Measure', 'imperial', 10000000);\n }\n\n}", "animateTV () {\r\n if (this.tvpower === \"off\") {\r\n this.tvleft.anims.play('leftscreenon', true);\r\n this.tvright.anims.play('rightscreenon', true);\r\n this.tvpower = \"on\";\r\n }\r\n else {\r\n this.tvleft.anims.play('leftscreenoff');\r\n this.tvright.anims.play('rightscreenoff');\r\n this.tvpower = \"off\";\r\n }\r\n }", "toggleAsset() {\n if (this.direction === Constants.RHINO_DIRECTIONS.LEFT) {\n this.setDirection(Constants.RHINO_DIRECTIONS.LEFT_2);\n } else {\n this.setDirection(Constants.RHINO_DIRECTIONS.LEFT);\n }\n }", "function toggleState() {\n runBest = !runBest;\n // Show the best bird\n if (runBest) {\n resetGame();\n runBestButton.html('continue training');\n if(playing)togglePlay()\n // Go train some more\n } else {\n nextGeneration();\n runBestButton.html('run pre-trained bird');\n }\n}", "function toggles(e){\n switch(e){\n case 49: //1\n lightsOn[0] = !lightsOn[0];\n break;\n case 50: //2\n lightsOn[1] = !lightsOn[1];\n break;\n case 51: //3\n lightsOn[2] = !lightsOn[2];\n break;\n case 52: //4\n lightsOn[3] = !lightsOn[3];\n break;\n case 80: //p\n isDisco=!isDisco;\n break;\n case 79: //o\n fanOn=!fanOn;\n break;\n case 72:\n controlsShown ? (document.getElementById(\"overlay\").style.display = \"none\", controlsShown = !1) : (document.getElementById(\"overlay\").style.display = \"block\", controlsShown = !0);\n break;\n case 73: //i\n self.noclip=!self.noclip;\n break;\n case 32: //space\n if(!self.noclip){\n \tif(self.canJump){\n \tself.velocity[1] = 3.5;\n \tself.canJump=false;\n }\n }\n break;\n case 69: //e\n doorOpen=!doorOpen;\n break;\n case 81: //q\n spawnEntity(types[Math.floor(Math.random()*(types.length))]);\n break;\n }\n}", "function tutup() {\r\n document.getElementById(\"drop2\").classList.toggle(\"tampil\");\r\n document.getElementById(\"down2\").classList.toggle(\"on\");\r\n}", "function toggleTemps(){\n\n if (temperatureUnit.textContent === \"F\"){\n \n temperatureUnit.textContent = \"C\";\n temperatureDegree.textContent = celsius.toFixed(1);\n \n } else {\n \n temperatureUnit.textContent = \"F\";\n temperatureDegree.textContent = temperature\n }\n }", "function switchmanual() {\n var div1 = document.getElementById(\"toatom\");\n var div2 = document.getElementById(\"tomanual\");\n if (div2.style.display === \"none\") {\n div2.style.display = \"block\";\n div1.style.display = \"none\";\n } else {\n div2.style.display = \"none\";\n div1.style.display = \"block\";\n }\n}", "function switchwater() {\n clearTimeout(timeout);\n if (this.value === \"on\") {\n showpies()\n d3.select(\".waterswitchlabel\").text(\"hide\");\n }else if(this.value === \"off\"){\n hidepies()\n d3.select(\".waterswitchlabel\").text(\"show\");\n }\n }", "function switchmanual() { \r\n var div1 = document.getElementById(\"toatom\");\r\n var div2 = document.getElementById(\"tomanual\");\r\n if (div2.style.display === \"none\") {\r\n div2.style.display = \"block\";\r\n div1.style.display = \"none\";\r\n } else {\r\n div2.style.display = \"none\";\r\n div1.style.display = \"block\";\r\n } \r\n}", "toggle() {\n this.enabled = !this.enabled;\n }", "switchIlumination() {\n\n if (!this.typeBasic)\n //colocamos o material (Phong ou Lambert) como sendo Basic\n this.material = this.materials[0];\n\n else\n //colocamos o material Basic como sendo o anterior a ser mudado para Basic\n this.material = this.materials[this.currMaterial];\n\n this.typeBasic = !this.typeBasic;\n }", "function animation() {\r\n switchOn();\r\n switchOff();\r\n}", "function toggleTrain() {\n\tif(dead)loop();\n\tstate = TRAINING;\n\tnextGeneration();\n}", "onToggle() {}", "function specToggle() {\r\n var spec = makeObject();\r\n vert = spec.vertex;\r\n flatNormz = spec.flatN;\r\n smoothNormz = spec.smoothN;\r\n ind = spec.index;\r\n var tempF = spec.fcolor;\r\n var tempS = spec.scolor;\r\n \r\n if (specular === true) {\r\n specular = false;\r\n flatColor = tempF;\r\n smoothColor = tempS;\r\n gl = main();\r\n if (buttonE){drawObjects();}\r\n else {drawSOR(gl); drawLights(gl);}\r\n }else if (specular === false){\r\n specular = true;\r\n flatColor = tempF;\r\n smoothColor = tempF;\r\n if (flatShaded){flatColor = specularLighting(flatNormz);}\r\n else{smoothColor = specularLighting(smoothNormz);}\r\n gl = main();\r\n if (buttonE){drawObjects();}\r\n else{drawSOR(gl); drawLights(gl);}\r\n flatColor=tempF;\r\n smoothColor=tempS;\r\n }\r\n}", "void turnOff() {\r\n isOn = false;\r\n System.out.println(\"Light on? \" + isOn);\r\n }", "switchIlumination() {\n if (this.typeBasic)\n //colocamos o material como sendo Basic\n this.material = this.materials[1];\n\n else\n //colocamos o material Basic como sendo Phong\n this.material = this.materials[0];\n\n this.typeBasic = !this.typeBasic;\n }", "function toggleAlien() {\r\n\t(document.getElementById(\"alien\").checked === false) ? totalPwrLvl -= 250 : totalPwrLvl += 250;\r\n\tpwrlvlSide.innerHTML = \"#\" + totalPwrLvl;\r\n}", "function switchToggle() {\n\t\t\t\t\t$scope.isToggleOn = !$scope.isToggleOn;\n\t\t\t\t}" ]
[ "0.6337465", "0.63069147", "0.62731224", "0.6251226", "0.6235556", "0.6194663", "0.6177884", "0.6143803", "0.608878", "0.6079503", "0.6077901", "0.602295", "0.5992622", "0.59773976", "0.5958581", "0.5950306", "0.5947523", "0.5947133", "0.59378153", "0.59265465", "0.5925762", "0.5912037", "0.5893966", "0.5893138", "0.5882677", "0.5880027", "0.5871889", "0.58697814", "0.5857058", "0.5849993" ]
0.72000253
0
Reset the state of the current subunit. The following activities are performed while resetting the state of the current subunit. 1. Set the state of the tutor to READY. 2. Set the number of errors made to 0. 3. Clear the input textarea element.
function resetSubunit() { my.current.state = my.STATE.READY my.current.errors = 0 my.html.input.value = '' log('state', my.current.state.toUpperCase(), 'unit', my.current.unitNo + '.' + my.current.subunitNo, 'type', my.settings.unit) updatePracticePaneState() updatePracticePane() clearAdvice() clearResultTooltips() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reset() {\n\tstate.questionCounter = 0;\n\tstate.score = 0;\n\tstate.questions = [\n\t\t{\n\t\t\tid: 0,\n\t\t\tpregunta: 'Ets un/a Vilafranquí/ina de Tota la Vida? Prova el test!',\n\t\t\trespostes: [],\n\t\t\tcorrecte: null,\n\t\t},\n\t];\n\tstate.collectedAnswers = [];\n\tstate.comodinsLeft = state.comodinsInitial;\n\tstate.comodiUsedInQuestion = false;\n\tstate.comodiButtonExpanded = false;\n\t// display initial question\n\tdisplayInitialQuestion();\n}", "function resetAllStates() {\n // Set the timer back to 75\n time = 75;\n // Show the timer to the user\n shownTime.text(time);\n // Set endQuiz variable to false\n quizEnded = false;\n // Set the userAnswers array to be empty\n userAnswers = [];\n // Set the scoreboard input value to be empty\n userNameInput.val('');\n}", "function reset() {\n\tiQ = 0;\n\ttotal = iQ;\n\tnumCorrect = 0;\n\t$('.explanationBlock').text('');\n\tupdate();\n\tsetCurrent();\n\tsetZero();\n}", "function resetSettings()\n {\n my.settings.unit = my.UNIT.MAIN\n }", "resetStatus() {\n this.busy = false;\n this.errors.forget();\n this.successful = false;\n }", "reset() {\n this.interacted = false;\n if (this._completedOverride != null) {\n this._completedOverride = false;\n }\n if (this._customError != null) {\n this._customError = false;\n }\n if (this.stepControl) {\n this.stepControl.reset();\n }\n }", "reset() {\r\n this.currentState = this.initial;\r\n }", "function reset()\n\t{\n\t\tsetValue('')\n\t}", "reset(){\n this.enable();\n this.init();\n this.buildAll();\n }", "resetTimer() {\n this.timeSelected = 0;\n this.completeElapsed = 0;\n this.complete = false;\n }", "reset() {\n this.gameInProgress = true; // true if playing game, false if ended\n\n // 1.) available players\n this.createCharacters();\n this.displayAvailableCharacters(this.characters);\n\n // Number enemies defeated\n this.enemiesDefeated = 0;\n this.defeatedCharacters.length = 0;\n this.defeatedCharacters = [];\n this.displayDefeatedCharacters(this.defeatedCharacters);\n\n // get rid of player and enemy\n this.currentPlayer = undefined;\n this.currentEnemy = undefined;\n\n // Interact with the DOM\n this.displayGameStatus();\n }", "function reset() {\n tfInput.value = \"\";\n tfResultado.value = \"\";\n taLogArea.value = \"\";\n numPrevio = 0;\n numActual = 0;\n numAcumulado = 0;\n strOperacion = \"\";\n cOperador = \"\";\n}", "function reset() {\n\t setState(null);\n\t} // in case of reload", "reset() {\r\n this.activeState = this.config.initial;\r\n }", "function reset() {\n\n //clear enemies\n allEnemies.length = 0;\n //clear any text messages from the heads-up display.\n hud.textElements.length = 0;\n }", "reset() {\r\n this.currentState = this.config.initial;\r\n }", "reset() {\r\n this.state = this.initial;\r\n }", "reset() {\r\n this.currentState = this.initalState;\r\n this.clearHistory();\r\n }", "reset(){\n\t\tif(model.autoRunTimerId !== -1){\n\t\t\tclearInterval(model.autoRunTimerId) // stop autorun timer if it is started\n\t\t\t//document.getElementById('autoRunBtn').innerHTML='Autorun';\n\t\t}\n\n\t\t$(\"#infoBitNum\").prop('disabled', false);\n\t\t$(\"#parityBitNum\").prop('disabled', false);\n\t\t$(\"#cwBitNum\").prop('disabled', false);\n\t\t$(\"#errDetectNum\").prop('disabled', false);\n\t\t$(\"#selGenPolyBtn\").prop('disabled', false);\n\n\t\tthis.algorithm.reset();\n\t\tthis.stat.reset();\n\t\tthis.stat.remove();\n\t\tthis.layer.getStage().clear();\n\t\tthis.layer.destroy();\n\t\ttry{\n\t\t\t$(\".ui-dialog-content\").dialog(\"close\");\n\t\t} catch(e) {console.log(e)}\n\t}", "resetState() {\n this.state = states.WAITING_FOR_CHOICE;\n }", "reset() {\n this.resetFields();\n this.resetStatus();\n }", "function resetQuiz() {\n // Clear out what's in the results container\n resultsContainer.innerText = \"\";\n // Clear out the quiz container\n quizContainer.innerHTML = \"\";\n // Rebuild the quiz\n buildQuiz();\n }", "function resetWholeQuestion(){\n\t\tresetQuestion();\n\t\tresetChoices();\t\n\t}", "reset() {\r\n this.prevState=this.currentState;\r\n this.currentState = this.config.initial;\r\n }", "function reset () {\n answer = \"\";\n if (questionCount < questions.length) {\n $(\".game\").html(\"\");\n $(\"#choices\").html(\"\");\n questionSetup();\n time = 20;\n }\n else {\n finish();\n }\n }", "reset() {\r\n this.state=this.initial;\r\n this.statesStack.clear();\r\n\r\n }", "function resetAll() {\n playerMoney = 1000;\n winnings = 0;\n jackpot = 5000;\n turn = 0;\n playerBet = 5;\n maxBet = 20;\n winNumber = 0;\n lossNumber = 0;\n winRatio = false;\n\n resetText();\n\n setEnableSpin();\n}", "reset() {\n this._setTreeStatus('');\n this._checkedAutorollers = new Set();\n this._selectedTreeStatus = '';\n this.setAttribute('collapsed', '');\n this._render();\n }", "reset() {\n this._updateSelectedItemIndex(0);\n this.steps.forEach(step => step.reset());\n this._stateChanged();\n }", "function reset() {\n numAnsRight = 0;\n numAnsWrong = 0;\n numTimedOut = 0;\n questionCount = 0;\n nextQuestion();\n console.log(\"game started\");\n }" ]
[ "0.643484", "0.6290009", "0.6285774", "0.6202145", "0.62011844", "0.61792785", "0.6145059", "0.6135676", "0.6133065", "0.6085142", "0.60610527", "0.6059029", "0.599889", "0.5981631", "0.59789747", "0.5977937", "0.5974269", "0.5968152", "0.5956023", "0.59373504", "0.59372663", "0.5925465", "0.59191865", "0.590948", "0.59015906", "0.5900781", "0.5895473", "0.58935714", "0.5888325", "0.5887031" ]
0.88482547
0
Set the tutor properties for the specified unit and subunit numbers. Arguments: m Unit number n Subunit number
function setSubunit(m, n) { my.current.unitNo = m my.current.subunitNo = n my.current.unit = unit(m) my.current.subunitTitles.length = 0 for (var subunitTitle in my.current.unit.subunits) { my.current.subunitTitles.push(subunitTitle) } var subunitTitle = my.current.subunitTitles[n - 1] my.current.subunitText = my.current.unit.subunits[subunitTitle] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setUnits() {\n this.units = unitSystem.getUnits();\n }", "function setUnitInfoInfo(stroption) {\n UnitInfo = stroption;\n}", "function setTerreainUniformVariables() {\n // Terrain uniform variables\n terrainDeferred.bindTexToUnit(\"tex_Color\", terrain_diffuse, 0);\n terrainDeferred.bindTexToUnit(\"tex_Normal\", terrain_normal, 1);\n terrainDeferred.bindTexToUnit(\"tex_Specular\", terrain_specular, 2);\n terrainDeferred.bindTexToUnit(\"sand_Normal\", sand_normal, 3);\n terrainDeferred.bindTexToUnit(\"sand_Normal2\", sand_normal2, 4);\n terrainDeferred.setSandEdge(controls.SandEdge);\n terrainDeferred.setSandSteep(controls.SandSteep);\n terrainDeferred.setFlowEdge(controls.FlowEdge);\n terrainDeferred.setFlowSpeed(controls.FlowSpeed);\n terrainDeferred.setTime(timer.currentTime);\n terrainDeferred.setSandDiffuse(__WEBPACK_IMPORTED_MODULE_0_gl_matrix__[\"e\" /* vec4 */].fromValues(controls.SandDiffuse[0] / 255, controls.SandDiffuse[1] / 255, controls.SandDiffuse[2] / 255, 1.0));\n terrainDeferred.setCloudEdge(controls.CloudEdge);\n terrainDeferred.setCloudSize(controls.CloudSize);\n terrainDeferred.setCloudNoise(controls.CloudNoise);\n terrainDeferred.setCloudSpeed(controls.CloudSpeed);\n terrainDeferred.setCloudSpeed2(controls.CloudSpeed2);\n mounDeferred.bindTexToUnit(\"tex_Color\", moun_diffuse, 5);\n mounDeferred.bindTexToUnit(\"tex_Normal\", moun_normal, 6);\n mounDeferred.bindTexToUnit(\"tex_Specular\", moun_specular, 7);\n mounDeferred.bindTexToUnit(\"tex_Color2\", terrain_diffuse, 0);\n mounDeferred.bindTexToUnit(\"tex_Normal2\", terrain_normal, 1);\n mounDeferred.bindTexToUnit(\"tex_Specular2\", terrain_specular, 2);\n mounDeferred.setAmount(controls.EdgePow);\n //mounDeferred.setSandDiffuse(vec4.fromValues(controls.MounDiffuse[0]/255, controls.MounDiffuse[1]/255, controls.MounDiffuse[2]/255, 1.0));\n mounDeferred.setSandSpecular(__WEBPACK_IMPORTED_MODULE_0_gl_matrix__[\"e\" /* vec4 */].fromValues(controls.SandDiffuse[0] / 255, controls.SandDiffuse[1] / 255, controls.SandDiffuse[2] / 255, 1.0));\n mounDeferred.setSandEdge(controls.MounEdge);\n mounDeferred.setCloudEdge(controls.CloudEdge);\n mounDeferred.setCloudSize(controls.CloudSize);\n mounDeferred.setCloudNoise(controls.CloudNoise);\n mounDeferred.setCloudSpeed(controls.CloudSpeed);\n mounDeferred.setCloudSpeed2(controls.CloudSpeed2);\n mounDeferred.setTime(timer.currentTime);\n ribbonDeferred.bindTexToUnit(\"tex_Color\", moun_diffuse, 5);\n ribbonDeferred.bindTexToUnit(\"tex_Normal\", moun_normal, 6);\n ribbonDeferred.bindTexToUnit(\"tex_Specular\", moun_specular, 7);\n ribbonDeferred.setSandDiffuse(__WEBPACK_IMPORTED_MODULE_0_gl_matrix__[\"e\" /* vec4 */].fromValues(controls.RibbonDiffuse[0] / 255, controls.RibbonDiffuse[1] / 255, controls.RibbonDiffuse[2] / 255, 1.0));\n ribbonDeferred.setSandSpecular(__WEBPACK_IMPORTED_MODULE_0_gl_matrix__[\"e\" /* vec4 */].fromValues(controls.SandDiffuse[0] / 255, controls.SandDiffuse[1] / 255, controls.SandDiffuse[2] / 255, 1.0));\n ribbonDeferred.setSandEdge(controls.RibbonEdge);\n ribbonDeferred.setCloudEdge(controls.CloudEdge);\n ribbonDeferred.setCloudSize(controls.CloudSize);\n ribbonDeferred.setCloudNoise(controls.CloudNoise);\n ribbonDeferred.setCloudSpeed(controls.CloudSpeed);\n ribbonDeferred.setCloudSpeed2(controls.CloudSpeed2);\n ribbonDeferred.setTime(timer.currentTime);\n ribbonDeferred.setAmount(controls.RibbonAmount);\n ribbonDeferred.setAmount2(controls.RibbonAmount2);\n ribbonDeferred.setAmount3(controls.RibbonAmount3);\n }", "function m(t, n, r) {\n return t.units[n][r];\n }", "function unit(m)\n {\n if (alternateUnitAvailable(m) &&\n my.settings.unit == my.UNIT.ALTERNATE) {\n return Units.alternate[m - Units.alternateStart]\n } else {\n return Units.main[m - 1]\n }\n }", "function PropulsionUnit() {\n }", "function PropulsionUnit() {\n }", "function setUnits(){\n var units=JSON.parse(localStorage['units']);\n for (var i = 0; i < MAX_NUMBER_OF_UNITS; i++) {\n var trans = 0.3; // the rgba transparency\n var div = $('#unit'+i); // Select the unit div\n var img = $('#unit'+i+'> img'); // Select the unit img tag\n div.css('border','1px dotted green');\n \n if ( units[i] === undefined){ // Unit is unused\n div.css('display','none');\n break;\n }\n if(i == selected){ // The chosen Unit\n trans = 0.9;\n div.css('border','2px solid black'); \n } \n var rgba = \"rgba(\"+units[i].split(';')[2]+\",\"+trans+\")\";\n div.css('background',rgba);\n var type = units[i].split(';')[1];\n img.attr(\"src\",\"markers/\"+type+\"-icon.png\");\n img.attr('class',type);\n } \n }", "function PropulsionUnit() {\n\t}", "set testProperty(n)\n\t\t{\n\t\t\tmap.get(this)._SetTestProperty(n);\n\t\t}", "set units(enumUnits) {\n // TODO: Check licensed (or will obviously fail on the server)\n this.SetMarginMeasure(enumUnits);\n }", "setUTMData(utmData) {\n this.utmData = utmData;\n }", "static setUnitMetric(unit) {\n if (unit === 'm' || unit === 'metres') {\n return `&units=metric`;\n }\n return ``;\n }", "function nextSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheLastSubunit()) {\n if (n == my.current.subunitTitles.length) {\n // If the user is at unit M.L where L is the last\n // subunit of unit M, then go to unit (M + 1).1.\n m++\n n = 1\n } else {\n // If the user is at unit M.N, then go to unit M.(N + 1).\n n++\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "function setM(self, m) {\n self.m_ = m;\n self.lastCanvas_ = null;\n }", "setMasechtaNumber(masechtaNumber) {\n this.masechtaNumber = masechtaNumber;\n }", "async function getUnit() {\n const unitResponse = await microcredapi.get(`/student/${window.localStorage.getItem('userId')}/enrolled`)\n setUnit({'code': window.localStorage.getItem('unitId'), 'name': unitResponse.data.unitMap[window.localStorage.getItem('unitId')]})\n }", "function setEnrollDataForMoveOnUnitByUnitId($el, unit){\n if(!$el || !this[PRIVATE_LEVEL] || !this[PRIVATE_LEVEL].children) return;\n\n var levelInfo = this[PRIVATE_LEVEL].children,\n currCourseInfo;\n\n if(unit){\n currCourseInfo = $.grep(levelInfo, function(v, i){\n return v.id === unit.id;\n })[0];\n\n $el.data({\n \"enrollmentId\": \"student_course_enrollment!\" + TypeidParser.parseId(currCourseInfo.parent.parent.id),\n \"courseId\": currCourseInfo.parent.parent.id,\n \"levelId\": currCourseInfo.parent.id,\n \"unitId\": currCourseInfo.id\n });\n\n } else {\n $el.removeData(['enrollmentId' , 'courseId' , 'levelId', 'unitId']);\n }\n }", "function unitChange() {\n oldunits = units;\n if(document.getElementById('unit_SI').checked) {\n units = 'unit_SI';\n doseUnit = 'uSv/h';\n dosenorm = eps * 1e4 * 3600;\n lunit = cm;\n lunitname = 'cm';\n }\n else {\n units = 'unit_US';\n doseUnit = 'mrem/h';\n dosenorm = eps * 1e3 * 3600;\n lunit = inch;\n lunitname = 'inch';\n }\n\n // Update length unit\n var ltext = document.getElementsByClassName('lunit');\n for (var i = 0; i < ltext.length; i++) { \n ltext[i].innerHTML = lunitname;\n };\n\n // Update dose unit\n var dtext = document.getElementsByClassName('dunit');\n for (var i = 0; i < dtext.length; i++) {\n dtext[i].innerHTML = doseUnit;\n };\n\n autoConv = document.getElementById('autoConv').checked;\n if(autoConv) { // Covert length values according to the selected unit\n var linp = document.getElementsByClassName('inpL');\n var unitfactor;\n if(units=='unit_SI' && oldunits=='unit_US')\n unitfactor = inch/cm;\n else if(units=='unit_US' && oldunits=='unit_SI')\n unitfactor = cm/inch;\n else\n unitfactor = 1.0;\n for (var i = 0; i < linp.length; i++) {\n linp[i].value = (parseFloat(linp[i].value) * unitfactor).toFixed(2);\n };\n }\n updateAll();\n}", "function setMentor(mentor){\n mentorBio.info = mentor;\n mentorId = mentorBio.info.id;\n getProfiles();\n }", "setRoomProperties(dimensions, materials) {\n this.room.setProperties(dimensions, materials);\n }", "function convertToUTM(obj) {\n [obj.north, obj.east] = proj4(wgs84, utm, [obj.lat, obj.lng]);\n}", "function CSIRO_phiM(MC, U) {\n if(MC<12) {\n return Math.exp(-0.108*MC);\n } else if((MC>12) && (U<=10)) {\n return (0.684 - 0.0342*MC);\n } else {\n return (0.547 - 0.0228*MC);\n }\n}", "multiUnitParams(props = this.props) {\n return `?unit_ids=${this.unit_ids(props)}${this.getDateParams(props)}`\n }", "set Specular(value) {}", "function dlgSetUIUnit(nUIUnit)\n{\n\tg_nUIUnit\t= nUIUnit + 1;\n\tg_bDirty\t= true;\n\tdlgDisplayDurations();\n}", "function setTurns(number){\n\t\t\t\t\tif(number == 1){\n\t\t\t\t\t\tgame.gender = 'woman';\n\t\t\t\t\t\tgame.turnLimit = 82; //82;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tgame.gender = 'man';\n\t\t\t\t\t\tgame.turnLimit = 79; //79;\n\t\t\t\t\t}\n\t\t\t\t}", "set useFileUnits(value) {}", "function LLtoUTM(EQUATORIAL_RADIUS, ECC_SQUARED) {\n return function (lat, lon, utmcoords, zone) {\n var squared = ECC_SQUARED,\n radius = EQUATORIAL_RADIUS,\n primeSquared = squared / (1 - squared),\n // utmcoords is a 2-D array declared by the calling routine\n // note: input of lon = 180 or -180 with zone 60 not allowed; use 179.9999\n lat = parseFloat(lat),\n lon = parseFloat(lon)\n\n // Constrain reporting USNG coords to the latitude range [80S .. 84N]\n if (lat > 84.0 || lat < -80.0) {\n return undefined\n } else {\n\n // sanity check on input - turned off when testing with Generic Viewer\n if (lon > 360 || lon < -180 || lat > 90 || lat < -90) {\n throw new Error(str('usng.js, LLtoUTM, invalid input. lat: ', toFixed(lat, 4), ' lon: ', toFixed(lon, 4)))\n }\n\n // Make sure the longitude is between -180.00 .. 179.99..\n // Convert values on 0-360 range to this range.\n var lonTemp = (lon + 180) - parseInt((lon + 180) / 360) * 360 - 180,\n latRad = lat * DEG_2_RAD,\n lonRad = lonTemp * DEG_2_RAD,\n\n // user-supplied zone number will force coordinates to be computed in a particular zone\n zoneNumber = (!zone) ? getZoneNumber(lat, lon) : zone,\n\n lonOrigin = dec(zoneNumber) * 6 - 180 + 3, // +3 puts origin in middle of zone\n lonOriginRad = lonOrigin * DEG_2_RAD,\n\n // compute the UTM Zone from the latitude and longitude\n UTMZone = str(zoneNumber, UTMLetterDesignator(lat), ' '),\n\n N = radius / sqrt(1 - squared * sin(latRad) * sin(latRad)),\n T = tan(latRad) * tan(latRad),\n C = primeSquared * cos(latRad) * cos(latRad),\n A = cos(latRad) * (lonRad - lonOriginRad),\n\n // Note that the term Mo drops out of the \"M\" equation, because phi\n // (latitude crossing the central meridian, lambda0, at the origin of the\n // x,y coordinates), is equal to zero for UTM.\n M = radius * ((1 - squared / 4\n - 3 * (squared * squared) / 64\n - 5 * (squared * squared * squared) / 256) * latRad\n - (3 * squared / 8 + 3 * squared * squared / 32\n + 45 * squared * squared * squared / 1024)\n * sin(2 * latRad) + (15 * squared * squared / 256\n + 45 * squared * squared * squared / 1024) * sin(4 * latRad)\n - (35 * squared * squared * squared / 3072) * sin(6 * latRad)),\n\n UTMEasting = (k0 * N * (A + (1 - T + C) * (A * A * A) / 6\n + (5 - 18 * T + T * T + 72 * C - 58 * primeSquared)\n * (A * A * A * A * A) / 120)\n + EASTING_OFFSET),\n\n UTMNorthing = (k0 * (M + N * tan(latRad) * ((A * A) / 2 + (5 - T + 9\n * C + 4 * C * C) * (A * A * A * A) / 24\n + (61 - 58 * T + T * T + 600 * C - 330 * primeSquared)\n * (A * A * A * A * A * A) / 720)))\n\n aset(utmcoords, 0, UTMEasting)\n aset(utmcoords, 1, UTMNorthing)\n aset(utmcoords, 2, zoneNumber)\n }\n }\n}", "function setPlayersPerRoom( nb ){\n playersPerRoom = nb;\n }" ]
[ "0.54758155", "0.52496386", "0.49302256", "0.49276233", "0.49223965", "0.49028546", "0.49028546", "0.4879682", "0.48509598", "0.4790742", "0.47573644", "0.4746591", "0.46574658", "0.46320707", "0.45933446", "0.45891666", "0.4576543", "0.45003316", "0.44828627", "0.4465418", "0.44550613", "0.4452959", "0.44489872", "0.4446852", "0.44393513", "0.441655", "0.440703", "0.43846184", "0.43820027", "0.4367751" ]
0.75769377
0
Display the subunit links for the current unit.
function displaySubunitLinks() { // Delete all existing subunit links var linksDiv = my.html.subunitLinks while (linksDiv.firstChild && linksDiv.firstChild.className != 'stretch') { linksDiv.removeChild(linksDiv.firstChild) } // Create new subunit links for the unit m var numberOfSubunits = my.current.subunitTitles.length for (var i = numberOfSubunits - 1; i >= 0; i--) { // Insert whitespaces between div elements, otherwise they // would not be justified var whitespace = document.createTextNode('\n') linksDiv.insertBefore(whitespace, linksDiv.firstChild) var label = my.current.subunitTitles[i] var selected = (i + 1 == my.current.subunitNo) var href = unitHref(my.current.unitNo, i + 1) var subunitDiv = boxedLink(label, selected, href) subunitDiv.id = 'subunit' + (i + 1) subunitDiv.style.width = (95 / numberOfSubunits) + '%' linksDiv.insertBefore(subunitDiv, linksDiv.firstChild) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayUnitLinks()\n {\n // Delete all existing unit links\n var linksDiv = my.html.unitLinks\n Util.removeChildren(linksDiv)\n\n // Create new unit links\n for (var i = 0; i < Units.main.length; i++) {\n var label = 'སློབ་མཚན། ' + (i + 1)\n var selected = (i + 1 == my.current.unitNo)\n var href = unitHref(i + 1)\n\n var divElement = boxedLink(label, selected, href)\n divElement.id = 'unit' + (i + 1)\n divElement.title = unit(i + 1).title\n\n linksDiv.appendChild(divElement)\n }\n }", "function displayAlternateUnitLinks()\n {\n // If alternate unit is not available for the current unit,\n // hide the alternate links element\n if (!alternateUnitAvailable(my.current.unitNo)) {\n alternateUnitLinks.style.visibility = 'hidden'\n return\n }\n\n // Delete all existing alternate unit links\n Util.removeChildren(alternateUnitLinks)\n\n // Create div elements for the main unit and alternate unit\n var mainUnitElement =\n boxedLink(Units.mainLabel,\n my.settings.unit == my.UNIT.MAIN,\n '#', toggleUnit)\n\n var alternateUnitElement =\n boxedLink(Units.alternateLabel,\n my.settings.unit == my.UNIT.ALTERNATE,\n '#', toggleUnit)\n\n alternateUnitLinks.appendChild(mainUnitElement)\n alternateUnitLinks.appendChild(alternateUnitElement)\n alternateUnitLinks.style.visibility = 'visible'\n }", "function currentSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n window.location.href = unitHref(m, n)\n }", "function updateNavigationLinks()\n {\n if (currentSubunitIsTheFirstSubunit()) {\n my.html.previousLink.style.visibility = 'hidden'\n my.html.nextLink.style.visibility = 'visible'\n } else if (currentSubunitIsTheLastSubunit()) {\n my.html.previousLink.style.visibility = 'visible'\n my.html.nextLink.style.visibility = 'hidden'\n } else {\n my.html.previousLink.style.visibility = 'visible'\n my.html.nextLink.style.visibility = 'visible'\n }\n }", "setupSubLinks() {\n for (let subLink in this.subLinks) {\n this.subLinks[subLink].addEventListener(\"click\", (e) => {\n let linkID = e.target.id;\n if (linkID === \"\") {\n linkID = e.target.parentNode.id;\n }\n let subViewToShow = linkID.slice(0, -5);\n this.showSubView(subViewToShow);\n });\n }\n }", "function displayUnitTitle() {\n\n // Parts of the unit title\n var unitNo = 'སློབ་མཚན། ' + my.current.unitNo +\n '.' + my.current.subunitNo\n var space = '\\u00a0\\u00a0'\n var title = '[' + my.current.unit.title + ']'\n\n Util.setChildren(my.html.unitTitle, unitNo, space, title)\n }", "function nextSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheLastSubunit()) {\n if (n == my.current.subunitTitles.length) {\n // If the user is at unit M.L where L is the last\n // subunit of unit M, then go to unit (M + 1).1.\n m++\n n = 1\n } else {\n // If the user is at unit M.N, then go to unit M.(N + 1).\n n++\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "showAll() {\n this.down(this.$element.find('[data-submenu]'));\n }", "show() {\n for (let node of this.nodes) {\n node.show();\n node.showLinks();\n }\n }", "populateUnitMenus() {\n\t\tlet category = this.m_catMenu.value;\n\t\tthis.m_unitAMenu.innerHTML = \"\";\n\t\tCONFIG[category].forEach(function(item) {\n\t\t\tGUI.m_unitAMenu.innerHTML += \"<option value=\\\"\" + item[0] + \"\\\">\" + item[1] + \"</option>\";\n\t\t});\n\t\t\n\t\tthis.m_unitBMenu.innerHTML = \"\";\n\t\tCONFIG[category].forEach(function(item) {\n\t\t\tGUI.m_unitBMenu.innerHTML += \"<option value=\\\"\" + item[0] + \"\\\">\" + item[1] + \"</option>\";\n\t\t});\n\t}", "function renderUnit(unit) {\n return crel('li',\n crel('span', {'class':'naam'}, unit.naam), \n crel('span', {'class':'afkorting'}, unit.afkorting),\n crel('span', {'class':'wikilink'},\n crel ('a', {'href':unit.wikilink},unit.wikilink)),\n crel('span', {'class':'wow'}, unit.wieofwat),\n crel('span', {'class':'foto'}, \n crel ('img', {'src': unit.foto})),\n )\n }", "function updateUnitFromURL()\n {\n // Default lesson is Unit 1.1\n var unitNo = 1\n var subunitNo = 1\n\n // Parse the fragment identifier in the URL and determine the\n // unit\n if (window.location.hash.length > 0) {\n var fragmentID = window.location.hash.slice(1)\n var tokens = fragmentID.split('.')\n unitNo = parseInt(tokens[0])\n if (tokens.length > 1)\n subunitNo = parseInt(tokens[1])\n }\n\n // Default to unit 1 if unit number could not be parsed\n // correctly from the URL\n if (isNaN(unitNo)) {\n unitNo = 1\n }\n\n // Default to subunit 1 if unit number could not be parsed\n // correctly from the URL\n if (isNaN(subunitNo)) {\n subunitNo = 1\n }\n\n setSubunit(unitNo, subunitNo)\n\n displayUnitLinks()\n displaySubunitLinks()\n displayAlternateUnitLinks()\n updateNavigationLinks()\n updateProgressTooltip()\n\n displayUnitTitle()\n displayGuide()\n\n resetSubunit()\n }", "function show()\r\n{\r\n // show the sub menu\r\n this.getElementsByTagName('ul')[0].style['visibility'] = 'visible';\r\n var currentNode=this;\r\n while(currentNode)\r\n {\r\n if( currentNode.nodeName=='LI')\r\n {\r\n currentNode.getElementsByTagName('a')[0].className = 'linkOver';\r\n }\r\n currentNode=currentNode.parentNode;\r\n }\r\n // clear the timeout\r\n eval ( \"clearTimeout( timeout\"+ this.id +\");\" );\r\n hideAllOthersUls( this );\r\n}", "function lijstSubMenuItem() {\n\n if ($mLess.text() == \"meer\") {\n $mLess.text(\"minder\")\n } else {\n $mLess.text(\"meer\");\n\n }\n $list.toggleClass('hidden')\n $resum.get(0).scrollIntoView('slow');\n event.preventDefault()\n }", "function displaySub(submenu){\n\n if (submenu == 'Nail Extensions'){\n $('#extensions-options').html(extensions_fills_sub);\n $('#fills-options').html('');\n $('#manicure-options').html('');\n }\n else if(submenu == 'Fills'){\n $('#extensions-options').html('');\n $('#fills-options').html(extensions_fills_sub);\n $('#manicure-options').html('');\n }\n\n else if(submenu == 'Manicure'){\n $('#extensions-options').html('');\n $('#fills-options').html('');\n $('#manicure-options').html(manicure_sub)\n\n }\n\n}", "function RMTLinkAsSub_onClick() {\n RMTLinkAsSubDerived(\"Sub\");\n}", "function setSubunit(m, n)\n {\n my.current.unitNo = m\n my.current.subunitNo = n\n\n my.current.unit = unit(m)\n\n my.current.subunitTitles.length = 0\n for (var subunitTitle in my.current.unit.subunits) {\n my.current.subunitTitles.push(subunitTitle)\n }\n\n var subunitTitle = my.current.subunitTitles[n - 1]\n my.current.subunitText = my.current.unit.subunits[subunitTitle]\n }", "function showUnits() {\n console.log(\"showUnits()\");\n units.forEach(unit => {\n /*\n // add unit names to page\n var unitName = document.createElement(\"h1\");\n unitName.innerText = unit.fields.name;\n document.body.appendChild(unitName);\n\n // add unit location to page\n unitLocation = document.createElement(\"p\");\n unitLocation.innerText = unit.fields.location;\n document.body.appendChild(unitLocation);\n\n // add image to page\n var unitImage = document.createElement(\"img\");\n unitImage.src = unit.fields.image[0].url;\n document.body.appendChild(unitImage); */\n\n // creating a new div container, where our unit info will go\n var unitContainer = document.createElement(\"div\");\n unitContainer.classList.add(\"unit-container\");\n document.querySelector(\".container\").append(unitContainer);\n\n // add unit names to unit container\n var unitName = document.createElement(\"h2\");\n unitName.classList.add(\"unit-name\");\n unitName.innerText = unit.fields.name;\n unitContainer.append(unitName);\n\n // add location to unit container\n var unitLocation = document.createElement(\"h3\");\n unitLocation.classList.add(\"unit-location\");\n unitLocation.innerText = unit.fields.location;\n unitLocation.style.color = \"#5F5C4F\";\n unitContainer.append(unitLocation);\n\n // add description to container\n var unitDescription = document.createElement(\"p\");\n unitDescription.classList.add(\"unit-description\");\n unitDescription.innerText = unit.fields.description;\n unitContainer.append(unitDescription);\n\n // add image to container\n var unitImage = document.createElement(\"img\");\n unitImage.classList.add(\"unit-image\");\n unitImage.src = unit.fields.image[0].url;\n unitContainer.append(unitImage);\n\n // add event listener\n // when user clicks on unit container\n // image and description will appear or disappear\n unitContainer.addEventListener(\"click\", function() {\n unitDescription.classList.toggle(\"active\");\n unitImage.classList.toggle(\"active\");\n });\n\n // add to each container as a class\n var unitCh = unit.fields.chapter;\n console.log(unitCh);\n unitContainer.classList.add(unitCh);\n\n // filter by chapter 2\n var filterCh2 = document.querySelector(\".ch2\");\n filterCh2.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter2\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh3 = document.querySelector(\".ch3\");\n filterCh3.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter3\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh4 = document.querySelector(\".ch4\");\n filterCh4.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter4\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh5 = document.querySelector(\".ch5\");\n filterCh5.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter5\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh6 = document.querySelector(\".ch6\");\n filterCh6.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter6\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh9 = document.querySelector(\".ch9\");\n filterCh9.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter9\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh13 = document.querySelector(\".ch13\");\n filterCh13.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter13\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh14 = document.querySelector(\".ch14\");\n filterCh14.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter14\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var filterCh17 = document.querySelector(\".ch17\");\n filterCh17.addEventListener(\"click\", function(){\n if(unitContainer.classList.contains(\"chapter17\")){\n unitContainer.style.background = \"#D7D2B5\";\n }\n else{\n unitContainer.style.background = \"#9f9b86\";\n }\n })\n\n var reset = document.querySelector(\".reset\");\n reset.addEventListener(\"click\", function(){\n unitContainer.style.background = \"#9f9b86\";\n })\n });\n}", "function showSubMenu() {\n\tvar objThis = this;\t\n\tfor (var i = 0; i < objThis.childNodes.length; i++) {\n\t\tif (objThis.childNodes.item(i).nodeName == \"UL\")\t{\t\t\t\t\t\t\t\n\t\t\tobjThis.childNodes.item(i).style.display = \"block\";\n\t\t}\t\t\n\t}\t\n}", "function renderSubLinks(){\n if(sublinks.length === 0){\n return null;\n }\n else{\n return(\n <React.Fragment>\n <div className=\"side-menu-links\">\n <SideMenu sublinks={sublinks}/>\n </div>\n <hr/>\n </React.Fragment>\n );\n }\n }", "function conservationCon() {\n console.log(\"Links Changed\")\n document.getElementById(\"subLinks\").innerHTML = \"\";\n document.getElementById(\"subLinks\").innerHTML = \"<h3>Conservation</h3><ul><li><a href='#'><h4>Carolinian Canada</h4></a></li><li><a href='#'><h4>Friends of the Thames / Thames River Cleanup</h4></a></li><li><a href='#'><h4>Nature London</h4></a></li><li><a href='#'><h4>North Shore Steelhead Association</h4></a></li><li><a href='#'><h4>Ontario Streams</h4></a></li><li><a href='#'><h4>Ontario Federation of Anglers and Hunters</h4></a></li><li><a href='#'><h4>Trout Unlimited Canada</h4></a></li></ul>\";\n}", "function showSubUL(img, subUL){\n $SC(img, 'fa-angle-down', 'fa-angle-up' ); \n $SC(subUL, 'hide-sub-ul' , 'show-sub-ul' );\n}", "function unit() {\n // Add more tests here.\n return linkUnit();\n}", "function previousSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheFirstSubunit()) {\n if (n == 1) {\n // If the user is at unit M.1, go to unit (M - 1).L\n // where L is the last subunit of the previous unit.\n previousUnit = unit(m - 1)\n var previousSubunitTitles = []\n for (var subunitTitle in previousUnit.subunits) {\n previousSubunitTitles.push(subunitTitle)\n }\n\n m--\n n = previousSubunitTitles.length\n } else {\n // If the user is at unit M.N, go to unit M.(N - 1)\n n--\n }\n }\n\n window.location.href = unitHref(m, n)\n }", "link() {\n\t\t// Call super link to link members of Top Level (Identified)\n\t\tsuper.link();\n\t\t\n this._members = this._sbolDocument.lookupURIs(this._members);\n }", "function showSubpages(subpage1, subpage2, subpage3, subpage4, subpage5, subpage6) {\n var subpages = [subpage1, subpage2, subpage3, subpage4, subpage5, subpage6];\n var i = 0;\n var x;\n for(var i = 0; i < subpages.length; i++) {\n if(subpages[i] == null) {\n break;\n }\n x = document.getElementById(subpages[i]);\n if (x.className === \"subpage-button\") {\n x.className += \" open\";\n }\n else {\n x.className = \"subpage-button\";\n }\n }\n}", "get subPlanDisplay() {\n\t\treturn this.__subPlanDisplay;\n\t}", "levelUp() {\n\t\tthis.getActiveUnits().forEach(unit => {\n\t\t\tunit.levelUp();\n\t\t});\n\t}", "function showMobileSubLInks(link){ \n let icon=link.children[1];\n let childUL=link.children[2];\n if(childUL.classList.contains('hide-mobile-sub-ul')){ \n $SC(icon, 'fa-angle-down', 'fa-angle-up');\n $SC(childUL, 'hide-mobile-sub-ul', 'show-mobile-sub-ul');\n } else{ \n $SC(icon, 'fa-angle-up', 'fa-angle-down');\n $SC(childUL, 'show-mobile-sub-ul', 'hide-mobile-sub-ul');\n }\n}", "function _showSubscribersView() {\n\t\tif (RELAY_USER.isSuperAdmin()) {\n\t\t\t_subscriberProcessingStart();\n\t\t\t$('#subscribersView').fadeIn();\n\n\t\t\t// Pull entire list of subscribers (past and present)\n\t\t\t$.when(SUBSCRIBERS.getSubscribersXHR()).done(function (orgs) {\n\t\t\t\tvar tblBody = '';\n\t\t\t\t$.each(orgs, function (index, orgObj) {\n\t\t\t\t\t// `active` parameter\n\t\t\t\t\tvar $dropDownAccess = $('#tblDropdownTemplate').clone();\n\t\t\t\t\tswitch (orgObj.active) {\n\t\t\t\t\t\tcase \"1\":\n\t\t\t\t\t\t\t$dropDownAccess.find('.currentValue').text('Aktiv');\n\t\t\t\t\t\t\t$dropDownAccess.find('.dropdown-menu').append('<li style=\"cursor: pointer;\"><a class=\"btn-link btnDeactivateOrgAccess\" data-org=\"' + orgObj.org + '\">Steng tilgang</a></li>');\n\t\t\t\t\t\t\t$dropDownAccess.find('.btn').addClass('btn-success');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"0\":\n\t\t\t\t\t\t\t$dropDownAccess.find('.currentValue').text('Stengt');\n\t\t\t\t\t\t\t$dropDownAccess.find('.dropdown-menu').append('<li style=\"cursor: pointer;\"><a class=\"btn-link btnActivateOrgAccess\" data-org=\"' + orgObj.org + '\">Aktiver tilgang</a></li>');\n\t\t\t\t\t\t\t$dropDownAccess.find('.btn').addClass('btn-danger');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t// `affiliation_access` parameter\n\t\t\t\t\tvar $dropDownAffiliation = $('#tblDropdownTemplate').clone();\n\t\t\t\t\t$dropDownAffiliation.find('.currentValue').text(orgObj.affiliation_access);\n\t\t\t\t\tswitch (orgObj.affiliation_access) {\n\t\t\t\t\t\tcase \"employee\":\n\t\t\t\t\t\t\t$dropDownAffiliation.find('.btn').addClass('btn-info');\n\t\t\t\t\t\t\t$dropDownAffiliation.find('.dropdown-menu').append('<li style=\"cursor: pointer;\"><a class=\"btn-link btnAddOrgStudentAccess\" data-org=\"' + orgObj.org + '\">Legg til studenttilgang</a></li>');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"member\":\n\t\t\t\t\t\t\t$dropDownAffiliation.find('.btn').addClass('btn-primary');\n\t\t\t\t\t\t\t$dropDownAffiliation.find('.dropdown-menu').append('<li style=\"cursor: pointer;\"><a class=\"btn-link btnRemoveOrgStudentAccess\" data-org=\"' + orgObj.org + '\">Fjern studenttilgang</a></li>');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Add row to table\n\t\t\t\t\ttblBody += '<tr>' +\n\t\t\t\t\t\t'<td>' + orgObj.org + '</td>' +\n\t\t\t\t\t\t//'<td>' + orgObj.affiliation_access + '</td>' +\n\t\t\t\t\t\t'<td>' + $dropDownAffiliation.html() + '</td>' +\n\t\t\t\t\t\t//'<td>' + orgObj.active + '</td>' +\n\t\t\t\t\t\t'<td>' + $dropDownAccess.html() + '</td>' +\n\t\t\t\t\t\t'<td class=\"text-center\"><button class=\"btnDeleteOrg btn-link uninett-fontColor-red\" type=\"button\" data-org=\"' + orgObj.org + '\"><span class=\"glyphicon glyphicon-remove\"></span></button></td>' +\n\t\t\t\t\t\t'</tr>';\n\t\t\t\t});\n\t\t\t\t$('#tblSubscribers').find('tbody').html(tblBody);\n\t\t\t\t//\n\t\t\t\t_subscriberProcessingEnd()\n\t\t\t});\n\t\t}\n\t}" ]
[ "0.7663342", "0.68255967", "0.68116045", "0.6465879", "0.6303267", "0.6192426", "0.61063194", "0.5817894", "0.55888015", "0.5503396", "0.54560477", "0.54035646", "0.5357568", "0.5330761", "0.5311307", "0.5309545", "0.5302293", "0.5295641", "0.528613", "0.5247997", "0.52389777", "0.52320105", "0.5222548", "0.52167785", "0.5209261", "0.5149554", "0.51089853", "0.506512", "0.49731746", "0.49142888" ]
0.86291367
0
Display title for the current unit.
function displayUnitTitle() { // Parts of the unit title var unitNo = 'སློབ་མཚན། ' + my.current.unitNo + '.' + my.current.subunitNo var space = '\u00a0\u00a0' var title = '[' + my.current.unit.title + ']' Util.setChildren(my.html.unitTitle, unitNo, space, title) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "title() { return this.owner.name + \" - \" + this.label.replace('\\n', ' ') }", "showTitle() {\n this.log(_consts.SEPARATOR);\n\n if (!this.options.title) {\n const title = `${_consts.GENERATOR_NAME} v${_package.version}`;\n const subTitle = 'Add hook to existing API';\n this.log(\n _yosay(\n `Helm Chart Generator.\\n${_chalk.red(\n title\n )}\\n${_chalk.yellow(subTitle)}`\n )\n );\n } else {\n this.log(this.options.title);\n }\n }", "getTitle() {\n return `Title is: ${this.title}`;\n }", "function getTitle() {\n return chalk.blue(\n figlet.textSync(\"Weather app\", {\n horizontalLayout: \"full\",\n font: \"banner\",\n })\n );\n}", "getFormattedTitle() {\n return this.info.title.toUpperCase();\n }", "function title() {\r\n drawScene(gl);\r\n if (!cube_title.isScrambling)\r\n cube_title.scramble();\r\n moveCamera({ movementX: velX, movementY: velY });\r\n cube_title.update(1 / 60);\r\n cube_title.show(programInfo);\r\n titleAnimationRequest = requestAnimationFrame(title);\r\n }", "function displayTitle (event) {\n $display.textContent = listoftitles[event.target.getAttribute('id')-1]\n }", "_showTitle() {\n if (this._titleJqElem) {\n this._titleJqElem.find(\".chart-title-text:first\").text(this.controlOptions.chartTitle);\n }\n }", "function my_title_format (window) {\n return '{'+get_current_profile()+'} '+window.buffers.current.description;\n}", "function setTitle() {\n dt = formatDate(myDateFormat, appstate.date);\n dtextra = (appstate.date2 === null) ? '' : ' to ' + formatDate(myDateFormat, appstate.date2);\n $('#maptitle').html(\"Viewing \" + vartitle[appstate.ltype] +\n \" for \" + dt + \" \" + dtextra);\n $('#variable_desc').html(vardesc[appstate.ltype]);\n}", "function title() {\n var elm\n \n elm = d.find(\"title\");\n elm.innerText = g.title;\n \n elm = d.tags(\"title\");\n elm[0].innerText = g.title;\n }", "get title() {\n this._logger.trace(\"[getter] title\");\n\n return this._title;\n }", "function showTitle(title) {\n\n push();\n fill(0, 30);\n noStroke();\n textStyle(BOLD);\n textSize(50);\n textAlign(CENTER);\n text(title, width/2, 100);\n pop();\n\n}", "function Title(props) {\n\treturn <div id=\"title\">\n\t Steve's Neighborhood Map - <span id=\"city-name\">(Bethlehem, PA)</span>\n </div>\n}", "function titleSetup() {\n\t\t\t\t\tif(scope.title !== undefined) {\n\t\t\t\t\t\t// For now we don't display the title\n\t\t\t\t\t\t// sel.select(\"span.list-title\").text(scope.title);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsel.select(\"span.list-title\").text(null);\n\t\t\t\t\t}\n\t\t\t\t}", "function setTitle() {\n\t\ttitle.selectAll(\"*\").remove();\n\n\t\t// All the hustle for enabling italics ^^\n\t\tvar tmp = document.createElement(\"text\");\n\t\ttmp.innerHTML = \"Terrorist Attacks Divided into <tspan style='font-style: italic;'>K=\" + focusK + \"</tspan> Partitions\";\n\t\tvar nodes = Array.prototype.slice.call(tmp.childNodes);\n\t\tnodes.forEach(function(node) {\n\t\t\ttitle.append(\"tspan\")\n\t\t\t\t.attr(\"style\", node.getAttribute && node.getAttribute(\"style\"))\n\t\t\t\t.text(node.textContent);\n\t\t});\n\t}", "async setTitle(_) {\n this.titleView = _;\n this._top.attr(\"title\", this.titleView);\n select(this.element).attr(\"titleView\", this.titleView);\n select(this.element.shadowRoot.querySelector(\".title\")).text(_);\n }", "title() {\n return cy.get(pop_up_title_locator)\n }", "_updateTitlePanelTitle() {\n let current = this.currentWidget;\n const inputElement = this._titleHandler.inputElement;\n inputElement.value = current ? current.title.label : '';\n inputElement.title = current ? current.title.caption : '';\n }", "get title() {\n\t\treturn this.__title;\n\t}", "get title() {\n\t\treturn this.__title;\n\t}", "get title() {\n\t\treturn this.__title;\n\t}", "get title() {\n\t\treturn this.__title;\n\t}", "get title() {\n\t\treturn this.__title;\n\t}", "static get title() {\n return 'Oops! You weren\\'t supposed to see this...';\n }", "static get defaultTitle() { return 'Tool'; }", "pageTitle() {\n if(this.props.currentContestId) {\n return this.currentContest().contestName;\n }\n return \"Naming Contests\";\n }", "get title () {\n\t\treturn this._title;\n\t}", "get title () {\n\t\treturn this._title;\n\t}", "get title () {\n\t\treturn this._title;\n\t}" ]
[ "0.69369173", "0.6902636", "0.6851144", "0.68014085", "0.67773896", "0.6727385", "0.6676678", "0.6635912", "0.64873755", "0.6485262", "0.6455869", "0.6447169", "0.6438482", "0.64255977", "0.64178836", "0.6412323", "0.64063", "0.6403999", "0.6394279", "0.6350035", "0.6350035", "0.6350035", "0.6350035", "0.6350035", "0.63340473", "0.63295585", "0.6327297", "0.63001436", "0.63001436", "0.63001436" ]
0.8794409
0
Display guide for the current unit.
function displayGuide() { my.html.guide.innerHTML = my.current.unit.guide }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateDisplayString() {\n this.displayString = 'Increase ' + this.name + ' by ' + this.value + ' ' + this.measuringUnit;\n }", "function displayHelpText() {\n console.log();\n console.log(' Usage: astrum figma [command]');\n console.log();\n console.log(' Commands:');\n console.log(' info\\tdisplays current Figma settings');\n console.log(' edit\\tedits Figma settings');\n console.log();\n}", "function display() {\n lcd.clear();\n lcd.cursor(0, 0).print(displayDate());\n lcd.cursor(1, 0).print(displayMeasure());\n }", "function getGuideDisplay(res, mysql, context, complete) {\n mysql.pool.query(\"SELECT tour_guide.tourGuide_ID as guide_ID, CONCAT(tour_guide.first_name, ' ', tour_guide.last_name) as guide_full_name FROM tour_guide ORDER BY guide_full_name\",\n function (error, results, fields) {\n if (error) {\n res.write(JSON.stringify(error));\n res.end();\n }\n context.guide_display = results;\n complete();\n });\n }", "function Guide(oa){\n\t\tthis.objtype = 'guide';\n\n\t\tthis.type = oa.type || 'vertical';\n\t\tthis.name = oa.name || (this.type + ' guide');\n\t\tthis.location = isval(oa.location)? oa.location : 200;\n\t\tthis.angle = oa.angle || false;\n\t\tthis.color = oa.color || makeRandomSaturatedColor();\n\t\tthis.visible = isval(oa.visible)? oa.visible : true;\n\t\tthis.showname = isval(oa.showname)? oa.showname : true;\n\t\tthis.editable = isval(oa.editable)? oa.editable : true;\n\t}", "function displayUnitTitle() {\n\n // Parts of the unit title\n var unitNo = 'སློབ་མཚན། ' + my.current.unitNo +\n '.' + my.current.subunitNo\n var space = '\\u00a0\\u00a0'\n var title = '[' + my.current.unit.title + ']'\n\n Util.setChildren(my.html.unitTitle, unitNo, space, title)\n }", "getHelp ( input, output ) {\n output.standardOutput.writeLine( 'Usage:' );\n this.getUsage().split( '\\n' ).forEach( line => output.standardOutput.writeLine( line ) );\n output.standardOutput.writeLine( '' );\n\n if ( this.getDescription() ) {\n output.standardOutput.writeLine( 'Description:' );\n output.standardOutput.writeLine( this.getDescription() );\n }\n\n output.standardOutput.writeLine( '' );\n }", "get help() {\n\t\tlet response = \"\"\n\t\tif (this._description) { \n\t\t\tresponse = this._description; \n\t\t}\n\n\t\tresponse += \" - Usage: \" + this.format;\n\t\tresponse += \" - Ex: \" + this.example;\n\n\t\treturn response;\n\t}", "function DisplayDesc() {\n\t\tif (props.powerPro.boss === 0) {\n\t\t\treturn (\n\t\t\t\t<p>\n\t\t\t\t\tYou enter the generator room and are standing on a landing. You notice\n\t\t\t\t\ta catwalk stretching the length of the room. In the center of the room\n\t\t\t\t\tis a cyborg scientist working at a console.\n\t\t\t\t</p>\n\t\t\t);\n\t\t} else {\n\t\t\treturn (\n\t\t\t\t<p>\n\t\t\t\t\tYou return to the generator room. Dr. Crackle is working at his\n\t\t\t\t\tconsole once again.\n\t\t\t\t</p>\n\t\t\t);\n\t\t}\n\t}", "helpText(){\n\n if(this.getStep() === 0 ){\n return ` -== HELP ==-\n The first line is 1 integer, consisting of the number of the number of lines of source code (N).\n The second line is 1 integer, constiting of the number of queries (Q).\n The next N lines consiste of HRML source code, consisting of either an opening tag with zero or more attributes or a closing tag. \n Then the next Q lines contains the queries. \n Each line is a string that references an attribute in the HRML source code.`;\n\n }else if(this.getStep() === 1){\n return 'START';\n }\n }", "function info() {\n\tseperator();\n\tOutput('<span>>info:<span><br>');\n\tOutput('<span>Console simulator by Mario Duarte https://codepen.io/MarioDesigns/pen/JbOyqe</span></br>');\n}", "function getDescription(){\n\t\tvar str = \"Draw Tool\";\n\n\t\treturn str;\n\t}", "describe() {\n return \"You've walked into the \" + this._name + \", \" + this._description;\n }", "function showHelpText() {\n ctx.save();\n\n if (lastUsedInput === 'keyboard') {\n setFont(18);\n ctx.fillStyle = 'white';\n ctx.fillText(translation.spacebar + ' ' + translation.select, 28 - fontMeasurement, kontra.canvas.height - 25 + fontMeasurement / 2.5);\n }\n else if (lastUsedInput === 'gamepad') {\n drawAButton(28, kontra.canvas.height - 25);\n setFont(18);\n ctx.fillStyle = 'white';\n ctx.fillText(translation.select, 28 + fontMeasurement * 1.75, kontra.canvas.height - 25 + fontMeasurement / 2.5);\n }\n\n ctx.restore();\n}", "show() {\n if (this.curriculum === Curriculum.QUICK_ORIENTATION ||\n this.curriculum === Curriculum.TOUCH_ORIENTATION) {\n // If opening the tutorial from the OOBE, automatically show the first\n // lesson.\n this.updateIncludedLessons_();\n this.showLesson_(0);\n } else {\n this.showMainMenu_();\n }\n this.isVisible = true;\n }", "printHelp(obj){\n console.log();\n this.terminal.green(\"Usage: %s [options]\\n\", obj.cmd ? obj.cmd : \"\");\n if( obj.desc ){\n this.terminal.brightBlack(\"\\t%s\\n\", obj.desc);\n }\n if( obj.opts && obj.opts.length > 0 ){\n this.terminal.black(\"\\nOptions:\\n\");\n let opt;\n for( let i = 0; i < obj.opts.length; i++ ){\n opt = obj.opts[i];\n if( !opt.cmd )\n continue;\n\n this.terminal.green(\"%s\\t%s\\n\", opt.cmd, opt.desc ? opt.desc : \"\");\n }\n }\n }", "function help() {\n printLine('The following commands work. Hover them for more information.');\n printLine('' +\n ' <span class=\"yellow\" title=\"Explain the list of commands\">help</span>,' +\n ' <span class=\"yellow\" title=\"Clear the screen for freshness\">clear</span>,' +\n ' <span class=\"yellow\" title=\"List all the files in this directory\">ls</span>,' +\n ' <span class=\"yellow\" title=\"List all links on the website\">tree</span>,' +\n ' <span class=\"yellow\" title=\"Change directory to `dirname`\">cd </span>' +\n '<span class=\"blue\" title=\"Change directory to `dirname`\"><em>dirname</em></span>,' +\n ' <span class=\"yellow\" title=\"Show the contents of `filename`\">cat </span>' +\n '<span class=\"green\" title=\"Show the contents of `filename`\"><em>filename</em></span>'\n );\n printLine('<br>');\n printLine('You can also use the' +\n ' <kbd class=\"cyan\">Up</kbd> and' +\n ' <kbd class=\"cyan\">Down</kbd>' +\n ' keys to navigate through your command history.'\n );\n printLine('You can click on tree nodes if CLI is not your thing.' +\n ' You\\'ll still need to hit <kbd class=\"cyan\">Enter</kbd>.'\n );\n}", "function showInstructions() {\n\t\t\tclear();\n\t\t\tdiv.update('<span style=\"color: grey; font-style: italic;\">' + lang.instructions + '</span>');\n\t\t}", "lldisplayWordDefinition() {\r\n console.log(`\\nDefinition: ${this.definition}`);\r\n }", "helpInfo () {\n\t\tlet me = this;\n\n\t\treturn [\n\t\t\t$('<h3>').append(\n\t\t\t\tt('Adicionar um novo equipamento à aventura')\n\t\t\t),\n\t\t\tEquipament.helpTypeMeaning()\n\t\t];\n\t}", "updateDisplay() {\n $('#steps .value').text(this.stepCounter);\n }", "helpInformation() {\n let desc = [];\n\n if (this._description) {\n desc = [this._description, ''];\n const {\n argsDescription\n } = this;\n\n if (argsDescription && this._args.length) {\n const width = this.padWidth();\n desc.push('Arguments:');\n desc.push('');\n\n this._args.forEach(({\n name\n }) => {\n desc.push(` ${pad(name, width)} ${argsDescription[name]}`);\n });\n\n desc.push('');\n }\n }\n\n let cmdName = this._name;\n\n if (this._alias) {\n cmdName = `${cmdName}|${this._alias}`;\n }\n\n const usage = [`Usage: ${cmdName} ${this.getUsage()}`, ''];\n let cmds = [];\n const commandHelp = this.commandHelp();\n if (commandHelp) cmds = [commandHelp];\n const options = ['Options:', `${this.optionHelp().replace(/^/gm, ' ')}`, ''];\n return usage.concat(desc).concat(options).concat(cmds).join('\\n');\n }", "getDescription() {\n let desc = super.getDescription();\n\n if (this.hasMajor()) {\n desc += ` Their mayor is ${this.major}`;\n }\n\n return desc;\n }", "function Start() {\n\t\tvar text = GetComponentInChildren(TextMesh) as TextMesh;\n\t\ttext.text = ability.helpText;\n\t\t\n\t\t// if the unit is used, make sure you're grayed out\t\n\t//\tif(unit.used) {\n\t//\t\trenderer.material.color = Color.gray;\n\t//\t}\n\t}", "displayWordInfo() {\r\n this.displayHangman();\r\n this.displayLives();\r\n this.displayLetters();\r\n this.displayLettersToGuess();\r\n }", "function outputDeviceSummary(){\n console.log(\"============================\");\n console.log(\"Power: \" + pCurrent);\n console.log(\"Mode: \" + mCurrent);\n console.log(\"============================\");\n}", "function displayHelp() {\n /* eslint-disable no-console */\n console.log(\n /* eslint-disable indent */\n`Usage: node generate_full_demo.js [options]\nOptions:\n -h, --help Display this help\n -m, --minify Minify the built demo\n -p, --production-mode Build all files in production mode (less runtime checks, mostly).\n -w, --watch Re-build each time either the demo or library files change`,\n /* eslint-enable indent */\n );\n /* eslint-enable no-console */\n}", "show() {\n strokeWeight(this.stroke);\n fill(this.color);\n rect(this.x, this.y, this.w, this.h);\n\n if (this.dragging == false) {\n strokeWeight(1);\n fill(0);\n textSize(1 * this.h);\n text(`${this.length}`, UBoxUlcX+UBoxWidth-50, this.y + this.h);\n }\n }", "printHelpText() {\n const helpText = fs.readFileSync(\n path.join(__dirname, 'cli-help.txt'), 'utf8');\n logHelper.info(helpText);\n }", "get display() {\n\t\treturn this.__display;\n\t}" ]
[ "0.59519535", "0.5727213", "0.559132", "0.5571523", "0.55665183", "0.5551647", "0.55430514", "0.55373716", "0.55318224", "0.5527445", "0.55033475", "0.55029726", "0.54797006", "0.5464949", "0.5432987", "0.5432799", "0.54291075", "0.5413121", "0.54024214", "0.5394989", "0.53793067", "0.5342624", "0.5322632", "0.5320708", "0.5315983", "0.53125954", "0.5287781", "0.5262568", "0.5252287", "0.5240082" ]
0.8241103
0
Set the target text to be typed. The target text consits of three parts: 1. Prefix 2. Target character 3. Suffix The target character is the character the user should type to move ahead in the subunit. The prefix and the suffix offer some context around the target character to be typed. These three parts combined, in the specified order above, is a substring from the subunit's text from units.js.
function setTargetText() { // The target text should display at least one character var targetLength = Settings.TARGET_TEXT_LENGTH if (targetLength < 1) { targetLength = 1 } // Length of the target text should be odd as equal number of // characters should be displayed on either side of the // character to be typed if (targetLength % 2 == 0) { targetLength-- } // Number of characters on either side of the character to be // typed, assuming that the character to be typed is at the // centre var prefixLength = (targetLength - 1) / 2 // Calculate the start index and the end index of the substring // to be selected from the subunit text to display as the target // text var i = my.current.correctInputLength var textLength = my.current.subunitText.length if (i <= prefixLength) { var startIndex = 0 } else if (i >= textLength - 1 - prefixLength) { var startIndex = textLength - targetLength } else { var startIndex = i - prefixLength } var endIndex = startIndex + targetLength // Select prefix string var s = my.current.subunitText.substring(startIndex, i) my.current.targetPrefix = Util.visual(s) // Select target character if (i < textLength) { s = my.current.subunitText.charAt(i) my.current.targetChar = Util.visual(s) } else { my.current.targetChar = '' } // Select suffix string s = my.current.subunitText.substring(i + 1, endIndex) my.current.targetSuffix = Util.visual(s) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayTargetText()\n {\n // Create target character element\n var targetCharElement = document.createElement('span')\n var targetChar = document.createTextNode(my.current.targetChar)\n targetCharElement.className = 'targetChar'\n targetCharElement.appendChild(targetChar)\n\n // Set new target text\n Util.setChildren(my.html.target, my.current.targetPrefix,\n targetCharElement,\n my.current.targetSuffix)\n }", "function typeString($target, index, cursorPosition, callback) {\n // Get text\n var text = settings.text[index];\n // Get placeholder, type next character\n var placeholder = $target.attr('placeholder');\n $target.attr('placeholder', placeholder + text[cursorPosition]);\n // Type next character\n if (cursorPosition < text.length - 1) {\n setTimeout(function () {\n typeString($target, index, cursorPosition + 1, callback);\n }, settings.delay);\n return true;\n }\n // Callback if animation is finished\n callback();\n }", "function setSubunit(m, n)\n {\n my.current.unitNo = m\n my.current.subunitNo = n\n\n my.current.unit = unit(m)\n\n my.current.subunitTitles.length = 0\n for (var subunitTitle in my.current.unit.subunits) {\n my.current.subunitTitles.push(subunitTitle)\n }\n\n var subunitTitle = my.current.subunitTitles[n - 1]\n my.current.subunitText = my.current.unit.subunits[subunitTitle]\n }", "function onTextPost(prefix, target, text)\n{\n text = stripTextDecoration(text);\n\n var cfgCmd = new RegExp('^' + scriptName + '/([^ \\t]+)[ \\t]*(.*)[ \\t]*');\n if (prefix.nick == myNick && text.match(cfgCmd)) {\n cmd = RegExp.$1;\n arg = RegExp.$2.replace(/\\s+/g, ' ').split(' ');\n if (arg.length == 1 && arg[0] == '')\n arg.length = 0;\n scriptCfgCmd(prefix, target, cmd, arg)\n }\n\n if (!chList[target.toLowerCase()])\n return;\n\n if (text.match(/^\\.cl\\s+(.*)/)) {\n if (target == '#TASers') // FIXME: poor hack\n cl(prefix, target, RegExp.$1, 'ja');\n else\n cl(prefix, target, RegExp.$1, 'en');\n }\n}", "wrapText (start, end, prefix, suffix) {\n let replace = this.text.slice(start, end);\n let edit = {\n start,\n end,\n insert: prefix + replace + suffix,\n replace,\n preSelection: this.selection,\n postSelection: {\n start: start + prefix.length,\n end: end + prefix.length,\n isCollapsed: start === end,\n backwards: this.selection.backwards\n }\n };\n this.edit(edit);\n this.editHistory.push(edit);\n this.redoStack = [];\n }", "set text(value) {}", "set text(value) {}", "function setTextInput(text) {\n setText(text);\n }", "function setSelectedText( data )\n{\n /**\n * Source: https://stackoverflow.com/a/11077016/3829526\n */\n\n if( activeInput.selectionStart || activeInput.selectionStart == '0' )\n {\n let startPos = activeInput.selectionStart;\n let endPos = activeInput.selectionEnd;\n\n activeInput.value = activeInput.value.substring( 0, startPos )\n + data\n + activeInput.value.substring( endPos, activeInput.value.length );\n } \n \n else\n activeInput.value += data;\n}", "function setTextId(num) {\n text = num;\n multiphrase = '';\n lastused_phrase = '';\n}", "function typeText(text){\n var chars = text.split('');\n chars.forEach(function(char, index){\n $(settings.el).delay(settings.speed).queue(function (next){\n var text = $(this).html() + char;\n $(this).html(text);\n next();\n\n // we are done, remove from queue\n if(index === chars.length - 1){\n settings.queue = settings.queue - 1;\n $(settings.mainel).trigger('typewriteTyped', text);\n }\n });\n }, this);\n }", "substituteText() {\n const proxyObj = this.display;\n this.display = new Text();\n this.display.substitute(proxyObj);\n }", "function updateText(ev) {\n setText(ev.target.value);\n }", "set setText (text) {\n this.text = text;\n }", "set text(text) {\n\t\tthis._text = text;\n\t}", "updateText(target, text) {\n this.changedFlag();\n\n var targetnotfound = true;\n var i = 0;\n var targets = target.trim().split(' ');\n\n //find which part of the target refers to the element ID\n while (targetnotfound && (i < targets.length)) {\n if (this.elemmap.has(targets[i])) {\n targetnotfound = false;\n } else {\n i++;\n }\n }\n if (targetnotfound) {\n return false;\n }\n \n var id = targets.splice(i, 1)[0];\n\n //store target element index, while also removing element ID from array of targets\n var targindex = this.elemmap.get(id);\n\n\n //use remaining target array to put text change in correct object parameter\n try {\n this.data.elements[targindex][targets[0]] = text;\n } catch {\n return false;\n }\n\n return true;\n\n }", "function type() {\n // Type as long as there are characters left in phrase\n if (char_index <= text[text_index].length) {\n if (!typing) set_typing(true);\n set_typed_text(text[text_index].substring(0, char_index++));\n setTimeout(type, type_delay);\n }\n // Call erase when finished\n else {\n set_typing(false);\n setTimeout(erase, new_delay);\n }\n }", "constructor(_text, _option1, _target1, _option2, _target2) {\n this.text = _text;\n this.option1 = _option1;\n this.target1 = _target1;\n this.option2 = _option2;\n this.target2 = _target2;\n }", "function displayTarget(){\n findTarget();\n if(isPlaying===true){\n $('#target-letter').text(\"'\" + targetLet + \"'\");\n }\n}", "function XSetInputControl(InputId, targetId, WordIdPrefix, punctuation) {\n //alert('Input function');\n var inst = $(InputId).mobiscroll('getInst');//Get instance of the tree control for the page you are switching to\n\n // inst.hide();\n\n //if the setValue function exists\n if (Object.keys(inst).some(function (k) { return ~k.indexOf(\"setValue\") })) {\n\n try {\n inst.setValue(LastSentenceSelections, true); //set values to match the last sentence\n }\n catch (err) {\n alert(err);\n }\n\n }\n //inst.show();//Trigger OnShow Event \n\n //Update Sentence\n DisplaySentence(targetId, WordIdPrefix, punctuation);\n}", "moveThrough(units) {\n this.units = units;\n this.text.text = this.units.toString();\n }", "function selectText(target) {\n const range = document.createRange();\n range.selectNodeContents(target);\n\n const selection = window.getSelection();\n selection.removeAllRanges();\n selection.addRange(range);\n}", "function typing_effect_subfunc(caption,boxed,end,captionLength) {\r\n\taudio_cursor.play();\r\n boxed.html(caption.substr(0, captionLength++));\r\n if(captionLength < caption.length+1 ) {\r\n\t\tsetTimeout(function() {typing_effect_subfunc(caption,boxed,end,captionLength);},100);\r\n //setTimeout('typero(caption,boxed)', 100);\r\n } else if (end==false){\r\n\t\tboxed.html(caption+'<br\\>');\r\n //captionLength = 0;\r\n //caption = '';\r\n\t\t//console.log(\"was here1\");\r\n }\r\n\telse{\r\n\t\t//boxed.html(caption+'<br\\>');\r\n //captionLength = 0;\r\n //caption = '';\r\n\t\t//console.log(\"was here2\");\r\n }\r\n}", "update(text, start, end) {\n this.lineOffsets = undefined;\n const content = this.getText();\n this.setText(content.slice(0, start) + text + content.slice(end));\n }", "text (state, text) {\n state.text = text\n }", "function updateCharCount(target) {\n var length = target.value.length;\n displayMessage(length + \" characters\");\n}", "function changeText() {\n \n }", "insertAtCaret(e, toIns='') {\n let textarea = document.getElementById('editor');\n const posStart = textarea.selectionStart;\n const posEnd = textarea.selectionEnd;\n const text = textarea.value;\n \n textarea.focus();\n //If the previous same length substring is the same as the text to insert, then remove it\n if ( text.substring( posEnd - toIns.length , posEnd) === toIns ) {\n textarea.value = text.substring(0, posEnd - toIns.length) + text.substring(posEnd);\n textarea.setSelectionRange(posStart, posStart);\n }\n //Else insert the string\n else {\n \n textarea.value = `${text.substring(0, posEnd)}${toIns}${text.substring(posEnd)}`;\n \n textarea.setSelectionRange(posEnd, posEnd + toIns.length );\n }\n //Trigger the redux action dispatch\n this.editorTextChange();\n }", "function targetLettersLogged() {\n for (i = 0; i < playingWord.targetWord.length; i++) {\n playingWord.addLetter(playingWord.targetWord[i], false);\n }\n}", "recursivelyUpdateText(target, ab, from, to) {\n if (ab.landwalk == from) {\n ab.landwalk = to;\n ab.modified = true;\n }\n for (let modif of ab.effect.modification.parts) {\n if (modif instanceof AddAbilityModification) {\n let aam = modif;\n this.recursivelyUpdateText(target, aam.addWhat, from, to);\n }\n if (modif instanceof ChangeLandTypeModification) {\n let cltm = modif;\n if (cltm.from == from)\n cltm.from = to;\n if (cltm.to == from)\n cltm.to = to;\n ab.modified = true;\n }\n }\n }" ]
[ "0.60048664", "0.5775657", "0.56695825", "0.56505764", "0.55948794", "0.5434984", "0.5434984", "0.5361348", "0.5334576", "0.52660495", "0.518258", "0.5154124", "0.51522535", "0.51208586", "0.51101273", "0.5055028", "0.5045333", "0.50254977", "0.5013132", "0.5006947", "0.49945083", "0.49866375", "0.49791938", "0.4977379", "0.49736243", "0.49437115", "0.49388146", "0.4928043", "0.49188653", "0.49185315" ]
0.83831364
0
Display the current target text
function displayTargetText() { // Create target character element var targetCharElement = document.createElement('span') var targetChar = document.createTextNode(my.current.targetChar) targetCharElement.className = 'targetChar' targetCharElement.appendChild(targetChar) // Set new target text Util.setChildren(my.html.target, my.current.targetPrefix, targetCharElement, my.current.targetSuffix) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayTarget(){\n findTarget();\n if(isPlaying===true){\n $('#target-letter').text(\"'\" + targetLet + \"'\");\n }\n}", "function setTargetText() {\n\n // The target text should display at least one character\n var targetLength = Settings.TARGET_TEXT_LENGTH\n if (targetLength < 1) {\n targetLength = 1\n }\n\n // Length of the target text should be odd as equal number of\n // characters should be displayed on either side of the\n // character to be typed\n if (targetLength % 2 == 0) {\n targetLength--\n }\n\n // Number of characters on either side of the character to be\n // typed, assuming that the character to be typed is at the\n // centre\n var prefixLength = (targetLength - 1) / 2\n\n // Calculate the start index and the end index of the substring\n // to be selected from the subunit text to display as the target\n // text\n var i = my.current.correctInputLength\n var textLength = my.current.subunitText.length\n if (i <= prefixLength) {\n var startIndex = 0\n } else if (i >= textLength - 1 - prefixLength) {\n var startIndex = textLength - targetLength\n } else {\n var startIndex = i - prefixLength\n }\n var endIndex = startIndex + targetLength\n\n // Select prefix string\n var s = my.current.subunitText.substring(startIndex, i)\n my.current.targetPrefix = Util.visual(s)\n\n // Select target character\n if (i < textLength) {\n s = my.current.subunitText.charAt(i)\n my.current.targetChar = Util.visual(s)\n } else {\n my.current.targetChar = ''\n }\n\n // Select suffix string\n s = my.current.subunitText.substring(i + 1, endIndex)\n my.current.targetSuffix = Util.visual(s)\n }", "function showCurrentText() {\n\tunselectAll();\n\thideAll();\n\tshowAllHeaders();\n\t$(\"#pano\" + currentpanonum).addClass('selected').children().show(5,scrollTo(currentpanonum));\n}", "set targetDisplay(value) {}", "function showText(txt) {\n labelText = txt;\n}", "function showNewText(text) {\n firstText.innerHTML = `${text}`;\n gsap.to(\".m402-text-relative\", {\n duration: 0.3,\n opacity: 1\n });\n}", "function showNewText(text) {\n firstText.innerHTML = `${text}`;\n gsap.to(\".m402-text-relative\", {\n duration: 0.3,\n opacity: 1\n });\n}", "function updateDisplay(target, str) {\n var container = $(target);\n if (str === undefined)\n return container.text() || \"\";\n else {\n container.text(str);\n return str;\n }\n }", "function showText(i) {\n Shiny.onInputChange('text_contents', el.data[i-1].longtext);\n }", "get targetDisplay() {}", "printInfo(text) {\n const targetName = this.context.isTestTarget ? 'test' : 'build';\n this.logger.info(`- ${this.context.projectName}@${targetName}: ${text}`);\n }", "function msg(target) {\n $(\"#textText\").html(\"You tapped \" + tapCount +\", double tapped \" + doubleTapCount + \" and long tapped \" + longTapCount + \" times on \" + $(target).attr(\"id\"));\n }", "substituteText() {\n const proxyObj = this.display;\n this.display = new Text();\n this.display.substitute(proxyObj);\n }", "function displayFactText(currentFact, positionId) {\n document.getElementById(positionId).innerHTML = currentFact.text;\n}", "showTarget(point) {\n let target = ConnectionTool.getTarget(this.lastPoint);\n Registry.viewManager.updateTarget(this.typeString, this.setString, target);\n }", "function updateText() {\n\t \tvar actionButton = document.getElementById(\"capture\");\n\t \t/* Check player's state. */\n\t \tif( _Nimbb.getState() == \"recording\" ) {\n\t \t \t/* Update link text. */\n\t \t \tactionButton.innerHTML = \"stop (\" + _Count + \")\";\n\t \t} else {\n\t \t \tactionButton.innerHTML = \"record\";\n\t \t}\n\t}", "function showText(e){\n $(e).html($(e).find('span').html());\n}", "function reflectCurrent() {\n document.getElementById('current-'+ activePlayer).textContent = current;\n }", "function changeText() {\n \n }", "function displayText(myText){\n document.getElementById(\"myText\").innerHTML = myText;\n}", "mainText() {\n return 'Long-Live *as* ' + this.fullName();\n }", "function showText() {\n // TODO\n document.getElementById(\"text\").style.display = \"block\";\n document.getElementById(\"more\").innerHTML = \"\";\n }", "function showInfo(event){\n console.log(`Mi currentTarget es ${event.currentTarget.id}`);\n console.log(`Mi target es ${event.target.id}`);\n}", "function onTextChange() {\n displayText = textEl.value;\n}", "function gText(e) {\n displayValue = (document.all) ? document.selection.createRange().text : document.getSelection();\n document.getElementById('input').value = displayValue \n}", "function getItemText(target) {\n\n\n var source = sourceCtrl;\n\n //We try and find the caret that was clicked so we can display the path up to that level. The first step is to find the text for that caret level.\n var selectedCaretText = getSelectedTextForBreadCrumbItem(target);\n\n //Completed will be set to true if we find the max level we have to display in the lookup\n var completed = false;\n var text = \"\";\n\n //we get all items\n var id = \"#\" + $(source).attr(\"id\");\n\n $(id + \" .ds-bc-nav-lu-item\").not(\".ds-bc-defaultitem\").each(function (i) {\n\n if (completed == false) {\n\n var txt = $(this).text().trim();\n\n if (txt.length > 0) {\n text = text + txt + \"\\\\\";\n }\n\n\n if (selectedCaretText.length > 0 && (selectedCaretText.toLowerCase() == txt.toLowerCase() || selectedCaretText == \"\\\\\")) {\n completed = true;\n }\n }\n\n });\n\n\n return text;\n }", "function displayText(text) {\n\tdocument.getElementById('imageLabel').innerHTML = text;\n}", "function updateText(ev) {\n setText(ev.target.value);\n }", "function displayTargetText(){\r\n\tvar targetText = document.createElement(\"img\");\r\n\ttargetText.src = \"graphics/target.png\";\r\n\ttargetText.style = \"position:absolute; top:24%\";\r\n\ttargetText.style.marginLeft = \"31%\";\r\n\ttargetText.setAttribute (\"width\", \"5%\");\r\n\ttargetText.setAttribute (\"height\", \"5%\");\r\n\tdocument.body.appendChild(targetText);\r\n}", "function showOutput(text) {\n document.getElementById('output').innerHTML = text;\n}" ]
[ "0.7295878", "0.7170134", "0.68684554", "0.6815694", "0.66996807", "0.6583383", "0.6583383", "0.64378256", "0.6414652", "0.6315669", "0.62590045", "0.6213346", "0.6204112", "0.6199924", "0.61949795", "0.61788446", "0.61720175", "0.61701274", "0.6166431", "0.61591864", "0.614656", "0.61163616", "0.6088094", "0.60782313", "0.60629815", "0.6048719", "0.60479", "0.60419977", "0.6024392", "0.5988648" ]
0.86897904
0
Update practice pane after evaluating the user's input. The input typed by the user is evaluated for correctness and then the practice pane is updated.
function updatePracticePane() { evaluateInput() setTargetText() displayTargetText() updateProgress() updateSpeed() updateError() updateSmiley() if (my.current.state == my.STATE.COMPLETED) { displayAdvice() setResultTooltips() log('state', my.current.state.toUpperCase(), 'unit', my.current.unitNo + '.' + my.current.subunitNo, 'type', my.settings.unit, 'wpm', my.current.wpm, 'error', my.current.errorRate.toFixed(1)) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function evaluateInput()\n {\n var inputText = my.html.input.value\n var inputLength = inputText.length\n\n // If the tutor is in READY state, and input has been entered,\n // then set it to RUNNING STATE.\n if (my.current.state == my.STATE.READY && inputLength > 0) {\n\n my.current.startTime = new Date().getTime()\n my.current.state = my.STATE.RUNNING\n updatePracticePaneState()\n\n log('state', my.current.state.toUpperCase(),\n 'unit', my.current.unitNo + '.' + my.current.subunitNo,\n 'type', my.settings.unit)\n }\n\n // Number of characters correctly typed by the user\n var goodChars = Util.common(my.current.subunitText, inputText)\n my.current.correctInputLength = goodChars\n\n // Validate the input\n if (goodChars == inputLength) {\n\n // Clear error if any\n if (my.current.state == my.STATE.ERROR) {\n\n my.current.state = my.STATE.RUNNING\n updatePracticePaneState()\n }\n } else {\n\n // Set and display error\n if (my.current.state == my.STATE.RUNNING) {\n my.current.state = my.STATE.ERROR\n my.current.errors++\n updatePracticePaneState()\n } else if (my.current.state == my.STATE.ERROR) {\n processInputCommand()\n }\n }\n\n // Update error rate\n if (goodChars == 0) {\n if (my.current.errors == 0) {\n my.current.errorRate = 0\n } else {\n my.current.errorRate = Number.POSITIVE_INFINITY\n }\n } else {\n my.current.errorRate = 100 * my.current.errors / goodChars\n }\n\n // Check if the complete target text has been typed successfully\n if (goodChars == my.current.subunitText.length) {\n my.current.state = my.STATE.COMPLETED\n updatePracticePaneState()\n }\n }", "function updatePracticePaneState()\n {\n switch (my.current.state) {\n\n case my.STATE.READY:\n my.html.practicePane.className = ''\n my.html.input.disabled = false\n my.html.input.focus()\n Util.setChildren(my.html.status, 'READY')\n my.html.status.title = 'Type in the input box below ' +\n 'to begin this lesson.'\n my.html.restartLink.style.visibility = 'hidden'\n break\n\n case my.STATE.RUNNING:\n my.html.practicePane.className = ''\n my.html.input.disabled = false\n my.html.input.focus()\n Util.setChildren(my.html.status, '')\n my.html.status.title = ''\n my.html.restartLink.style.visibility = 'visible'\n break\n\n case my.STATE.ERROR:\n my.html.practicePane.className = 'error'\n my.html.input.disabled = false\n my.html.input.focus()\n my.html.restartLink.style.visibility = 'visible'\n Util.setChildren(my.html.status, 'ERROR!')\n my.html.status.title = 'Fix errors in the input box ' +\n 'by pressing the backspace key.'\n break\n\n case my.STATE.COMPLETED:\n my.html.practicePane.className = 'completed'\n my.html.input.disabled = true\n my.html.input.blur()\n my.html.restartLink.style.visibility = 'visible'\n Util.setChildren(my.html.status, 'COMPLETED')\n my.html.status.title = 'You have completed this lesson.'\n break\n }\n\n }", "update() {\n this.scoreHTML.innerText = this.score;\n // show modal if you score 12\n if(this.score == 12){\n this.win();\n }\n }", "function updateDisplay () {\n if (isGameOver()) {\n $('h1').text(' gameover. winner is ' + whoWon())\n } else {\n $('h1').text(quiz.currentQuestion + ') ' + quiz.questions[quiz.currentQuestion].prompt)\n // hard coded display, only has 4 answers at a time. Each is displayed as a button, so can use the order (eg) that they appear in the dom to select them\n $('button').eq(0).text(quiz.questions[quiz.currentQuestion].choices[0])\n $('button').eq(1).text(quiz.questions[quiz.currentQuestion].choices[1])\n $('button').eq(2).text(quiz.questions[quiz.currentQuestion].choices[2])\n $('button').eq(3).text(quiz.questions[quiz.currentQuestion].choices[3])\n }\n // update player scores regardless\n $('h3').eq(0).text('Player1: ' + quiz.player1Points)\n $('h3').eq(1).text('Player2: ' + quiz.player2Points)\n}", "function proceed(difficultyLvl) {\n randomWords();\n input.value = \"\";\n showInput.innerText = \"Value displays here\";\n input.focus();\n switch (difficultyLvl) {\n case \"Easy\":\n s += 4;\n break;\n case \"Hard\":\n s += 3;\n break;\n case \"Very Hard\":\n s += 2;\n break;\n default:\n s += 4;\n }\n console.log(s);\n score += 3;\n scoreSheet.innerText = score;\n}", "function clickedCorrect() {\n $(\"#correctInput\").show();\n $(\"#wrongInput\").hide();\n if (clickedCorrect) {\n yourScore +=10;\n };\n }", "function answerIsCorrect () {\r\n feedbackForCorrect();\r\n updateScore();\r\n}", "function processInputCommand()\n {\n var inputText = my.html.input.value\n var goodChars = my.current.correctInputLength\n\n if (inputCommandIs('restart') || inputCommandIs('rst')) {\n location.href = '#restart'\n } else if (inputCommandIs('fix') || inputCommandIs('xxx')){\n my.html.input.value = inputText.substring(0, goodChars)\n updatePracticePane()\n } else if (inputCommandIs('qtpi')) {\n qtpi()\n }\n }", "function whenCorrect() {\n //clear container class html\n //display \"CORRECT!\"\n $(\".container\").html(\"<h2>CORRECT!<h2>\");\n //display correct answer\n displayCorrect();\n //increase score\n correct++;\n answered++;\n }", "function saveInput() {\r\n\t\t\tif (document.getElementById(\"check\").innerHTML == \"New Phrase!\") {\r\n\r\n \tdocument.getElementById(\"result1\").innerHTML= \"A Screwdriver\";\r\n \tdocument.getElementById(\"result2\").innerHTML= \"Ask Rude Arrive Her\";\r\n }\r\n\t\r\n var input = document.getElementById(\"userInput\").value;\r\n document.getElementById(\"result1\").style.visibility = \"visible\";\r\n document.getElementById(\"result2\").style.visibility = \"visible\";\r\n document.getElementById(\"check\").innerText= \"New Phrase!\";\r\n document.getElementById(\"userInput\").value = '';\r\n \t// document.getElementById(\"userInput\").style.border=\"3.5px solid #ff4d4d\";\r\n \t// document.getElementById(\"correct\").style.display = \"none\";\r\n \t// document.getElementById(\"incorrect\").style.display = \"block\";\r\n}", "function results() {\n selectedAnswers = $(displayTest.find(\"input:checked\"));\n //if user is correct\n if (\n selectedAnswers[0].value === testSetup[currentQuestion - 1].questionAnswer\n ) {\n //add to correct score and display on element\n correct++;\n $(\"#correct\").text(\"Answers right: \" + correct);\n } else {\n //if user is wrong then add to wrong score and display on element\n wrong++;\n $(\"#incorrect\").text(\"Wrong answers: \" + wrong);\n }\n //check to see if the user has reached the end of the test\n if (currentQuestion === 10) {\n //toggle finalize modal at end of test to display score\n $(\"#modalMatch\").modal(\"toggle\");\n $(\"#testScore\").text(\n \"End of test! You scored a \" + (parseFloat(correct) / 10) * 100 + \"%\"\n );\n //show postTest element\n $(\"#postTest\").show();\n $(\"#submitTest\").hide();\n }\n }", "function evaluate() {\n $('#quizBoard').hide();\n $('#results').show();\n if ($('#q1f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q2t').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q3f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q4f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q5t').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q6t').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q7f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q8f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q9f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n $('#corr').html(correct)\n $('#incorr').html(incorrect)\n $('#percent').html(correct/9)\n}", "function update() {\n type = textInput.value();\n shapeWidth = shapeSlider.value();\n density = densitySlider.value();\n shapeOpacity = opacitySlider.value();\n let size = fontSizeOptions.value();\n fontSize = int(size);\n fontStyle = fontStyleOptions.value();\n shape = radioShape.value();\n fillInitially = radioFill.value();\n shake = shakeCheckBox.checked();\n move = moveCheckBox.checked();\n colourInitially = radioColour.value();\n\n setUpText();\n}", "function handlecorrectAnswer(){\n $('.QAform').html(`\n <img class = \"icon circle\" src = \"https://github.com/katngo/catquiz/blob/master/cat-broke-vase.jpg?raw=true\" alt = \"cat broke the vase\"></img>\n <p>Hmm...you're not bad at all</p>\n <button type = \"button\" class = \"nextButton\">Next</button>`);\n updateScore();\n}", "function userCorrectAnswerSubmitted(answer) {\n store.score++;\n $('.correct-updater').html('Correct!');\n}", "function updateDisplay(msg){\n\t\t//displays story\n\t\tvar target=document.getElementById(\"OutputTxtBox\");\n\t\ttarget.value=msg+\"\\n\"+target.value;\n\t\t//displays score\n\t\tdocument.getElementById(\"OutputScore\").value=score;\n\t}", "function check_if_update(){\n if(total_results_past == total_results){\n read_speech(\"Here's a hint. You're supposed to say: \" + window.paragraph_list[window.curr_paragraph])\n } else{\n if(flip){\n if(conf_score == conf_score_past){\n read_speech(\"You seem lost. You're supposed to say: \" + window.paragraph_list[window.curr_paragraph])\n }\n conf_score_past = conf_score\n }\n }\n total_results_past = total_results\n flip = !flip;\n}", "function change () {\n setAnswer(this.value)\n // If the appearance is 'quick', then also progress to the next field\n if (fieldProperties.APPEARANCE.includes('quick') === true) {\n goToNextField()\n }\n}", "function updateScore(){\n\tdocument.getElementById(\"correct\").innerHTML = \"Correct Answers: \" + counters.correct;\n\tdocument.getElementById(\"incorrect\").innerHTML= \"Incorrect Answers: \" + counters.incorrect;\n\tdocument.getElementById(\"unanswered\").innerHTML= \"Unanswered: \" + counters.unanswered;\n}", "function updateDisplay () {\n if (isGameOver()) {\n if (whoWon() === 1) {\n $('#gameStatus').text('Gameover. The winner is Player1!')\n } else if (whoWon() === 2) {\n $('#gameStatus').text('Gameover. The winner is Player2!')\n } else {\n $('#gameStatus').text('Gameover. It\\'s a draw!')\n }\n }\n\n if (!isGameOver()) {\n $('#gameStatus').text('Q' + (quiz.currentQuestion + 1) + ') ' + 'It\\'s Player' + (quiz.currentQuestion % 2 + 1) + '\\'s turn')\n // update question\n var flagIndex = quiz.currentQuestion + 1\n $('#flag').css('background-image', 'url(./img/flag' + flagIndex + '.gif)')\n $('#choice1').text(quiz.questions[quiz.currentQuestion].choices[0])\n $('#choice2').text(quiz.questions[quiz.currentQuestion].choices[1])\n $('#choice3').text(quiz.questions[quiz.currentQuestion].choices[2])\n $('#choice4').text(quiz.questions[quiz.currentQuestion].choices[3])\n // update sccore\n $('#player1Score').text(quiz.player1Score)\n $('#player2Score').text(quiz.player2Score)\n }\n}", "function beginQuiz(){\n endQuiz.style.display = \"none\";\n if (currentQuestionSpot === finalQuestion){\n return finalScore();\n } \n var currentQuestion = quizQuestions[currentQuestionSpot];\n questionsEl.innerHTML = \"<p>\" + currentQuestion.question + \"</p>\";\n choiceA.innerHTML = currentQuestion.optionA;\n choiceB.innerHTML = currentQuestion.optionB;\n choiceC.innerHTML = currentQuestion.optionC;\n choiceD.innerHTML = currentQuestion.optionD;\n}", "function inputChange (e) {\n var isCorrect = game.check(this.value),\n wordObj,\n i,\n l = game.wordsByIndex.length;\n if (isCorrect) {\n // TODO: run correct animation & move to the next stage\n game.level++;\n game.currentSceneIndex++;\n // sound\n game.soundInstance = createjs.Sound.play(\"Correct\"); // play using id. Could also use full sourcepath or event.src.\n //game.soundInstance.addEventListener(\"complete\", createjs.proxy(this.handleComplete, this));\n game.soundInstance.volume = 0.5;\n window.alert('Correct!');\n loadScene(game.currentSceneIndex)\n this.value='';\n } else if (this.value.length > game.minimumWordLength) {\n for (i = 0; i < l; i++) {\n wordObj = game.wordsByIndex[i];\n if (wordsAreEqual(wordObj.spl, this.value)) {\n game.level--;\n setPopupContent(i, 500, 100);\n // show mask\n jQuery('#mask').show();\n // show pop-up\n jQuery('#popup').show();\n this.value='';\n }\n }\n }\n}", "function correct() {\n score = score + 5;\n document.getElementById(\"score\").innerHTML = score;\n color_confusion();\n}", "function displayInputMade() {\n var guessesDisplay = document.querySelector(\"#guessesDisplay\");\n guessesDisplay.textContent = incorrectInputEntered;\n\n var inputMadeDisplay = document.querySelector(\"#inputMadeDisplay\");\n inputMadeDisplay.textContent = incorrectInputEntered;\n}", "function correctAnswer(){\n\tscore += addScore(time);\n\tupdateScore();\n if(++level == 10){\n difficulty = 1;\n } else if(level == 20){\n difficulty = 2;\n }\n document.getElementById('level').innerHTML = \"Level : \" + level;\n\tresetComponent();\n}", "function solvePart2(){\n\n // Display the answer\n document.getElementById(\"answer2\").innerHTML = \"fill me in\"\n }", "function userAnswerCorrect () {\n userCorrectFeedback();\n updateScore();\n $('.js-CorrectHidden').css('display', 'flex');\n}", "function updateScore() {\n\t$(\"#wordsCorrect\").html(\"<h5>Words Guessed Correctly: </h5><h3>\" + scoreCorrect + \"</h3>\");\n\t$(\"#wordsSkipped\").html(\"<h5>Words Skipped: </h5><h3>\" + scoreSkipped + \"</h3>\");\n}", "function problem_1() {\n\n problemNumber.innerHTML = 'Problem 1';\n input1.style.visibility = 'visible';\n input1.style.width = '200px';\n input1.placeholder = 'Enter \"number\"';\n\n jsConsole.writeLine('Problem 1. Odd or Even');\n jsConsole.writeLine(' - Write an expression that checks if given integer is odd or even.');\n solutionText();\n\n submit.onclick = function () {\n var num = input1.value * 1;\n\n if (!isNaN(num)) {\n\n var result;\n if (num % 2 === 0) {\n result = 'Even';\n } else {\n result = 'Odd';\n }\n printResult();\n } else {\n\n incorrectInput();\n }\n\n function printResult() {\n jsConsole.writeLine(num + ' is ' + result);\n playWhat();\n }\n }\n}", "function updateDisplay () {\n if (isGameOver()) {\n\n } else {\n $('h1.question').text(quiz.questions[quiz.currentQuestion].qn)\n $('h2.answer').text(quiz.questions[quiz.currentQuestion].factMsg)\n // hard coded display, only has 4 answers at a time. Each is displayed as a button, so can use the order (eg) that they appear in the dom to select them\n $('button').eq(0).text(quiz.questions[quiz.currentQuestion].options[0])\n $('button').eq(1).text(quiz.questions[quiz.currentQuestion].options[1])\n if (quiz.questions[quiz.currentQuestion].options[2]) {\n $('button').eq(2).text(quiz.questions[quiz.currentQuestion].options[2])\n } else {\n }\n $('button').eq(3).text(quiz.questions[quiz.currentQuestion].options[3])\n }\n}" ]
[ "0.72625816", "0.67071354", "0.5888808", "0.5870281", "0.5828073", "0.5824714", "0.58144224", "0.5802231", "0.577422", "0.56987923", "0.56887746", "0.56745684", "0.56663615", "0.5627791", "0.5627436", "0.5613489", "0.55984586", "0.55934066", "0.5570111", "0.5563535", "0.55629057", "0.55542916", "0.55504906", "0.55461013", "0.5532929", "0.55270463", "0.5526843", "0.5526558", "0.5516418", "0.55080324" ]
0.770059
0
Evaluate the input typed by the user and change the practice panel state if necessary.
function evaluateInput() { var inputText = my.html.input.value var inputLength = inputText.length // If the tutor is in READY state, and input has been entered, // then set it to RUNNING STATE. if (my.current.state == my.STATE.READY && inputLength > 0) { my.current.startTime = new Date().getTime() my.current.state = my.STATE.RUNNING updatePracticePaneState() log('state', my.current.state.toUpperCase(), 'unit', my.current.unitNo + '.' + my.current.subunitNo, 'type', my.settings.unit) } // Number of characters correctly typed by the user var goodChars = Util.common(my.current.subunitText, inputText) my.current.correctInputLength = goodChars // Validate the input if (goodChars == inputLength) { // Clear error if any if (my.current.state == my.STATE.ERROR) { my.current.state = my.STATE.RUNNING updatePracticePaneState() } } else { // Set and display error if (my.current.state == my.STATE.RUNNING) { my.current.state = my.STATE.ERROR my.current.errors++ updatePracticePaneState() } else if (my.current.state == my.STATE.ERROR) { processInputCommand() } } // Update error rate if (goodChars == 0) { if (my.current.errors == 0) { my.current.errorRate = 0 } else { my.current.errorRate = Number.POSITIVE_INFINITY } } else { my.current.errorRate = 100 * my.current.errors / goodChars } // Check if the complete target text has been typed successfully if (goodChars == my.current.subunitText.length) { my.current.state = my.STATE.COMPLETED updatePracticePaneState() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updatePracticePane()\n {\n evaluateInput()\n setTargetText()\n displayTargetText()\n updateProgress()\n updateSpeed()\n updateError()\n updateSmiley()\n\n if (my.current.state == my.STATE.COMPLETED) {\n displayAdvice()\n setResultTooltips()\n\n log('state', my.current.state.toUpperCase(),\n 'unit', my.current.unitNo + '.' + my.current.subunitNo,\n 'type', my.settings.unit,\n 'wpm', my.current.wpm,\n 'error', my.current.errorRate.toFixed(1))\n }\n }", "function updatePracticePaneState()\n {\n switch (my.current.state) {\n\n case my.STATE.READY:\n my.html.practicePane.className = ''\n my.html.input.disabled = false\n my.html.input.focus()\n Util.setChildren(my.html.status, 'READY')\n my.html.status.title = 'Type in the input box below ' +\n 'to begin this lesson.'\n my.html.restartLink.style.visibility = 'hidden'\n break\n\n case my.STATE.RUNNING:\n my.html.practicePane.className = ''\n my.html.input.disabled = false\n my.html.input.focus()\n Util.setChildren(my.html.status, '')\n my.html.status.title = ''\n my.html.restartLink.style.visibility = 'visible'\n break\n\n case my.STATE.ERROR:\n my.html.practicePane.className = 'error'\n my.html.input.disabled = false\n my.html.input.focus()\n my.html.restartLink.style.visibility = 'visible'\n Util.setChildren(my.html.status, 'ERROR!')\n my.html.status.title = 'Fix errors in the input box ' +\n 'by pressing the backspace key.'\n break\n\n case my.STATE.COMPLETED:\n my.html.practicePane.className = 'completed'\n my.html.input.disabled = true\n my.html.input.blur()\n my.html.restartLink.style.visibility = 'visible'\n Util.setChildren(my.html.status, 'COMPLETED')\n my.html.status.title = 'You have completed this lesson.'\n break\n }\n\n }", "function processInputCommand()\n {\n var inputText = my.html.input.value\n var goodChars = my.current.correctInputLength\n\n if (inputCommandIs('restart') || inputCommandIs('rst')) {\n location.href = '#restart'\n } else if (inputCommandIs('fix') || inputCommandIs('xxx')){\n my.html.input.value = inputText.substring(0, goodChars)\n updatePracticePane()\n } else if (inputCommandIs('qtpi')) {\n qtpi()\n }\n }", "function readAndCheckInput(){\n\tanswerNumber = parseInt(inputField.value, toBase);\n\tif(answerNumber == problemNumber){\n\t\tproblem.style.color = 'green';\n\t\tproblem.innerHTML = 'Correct. \\n Press \"New Question\" to continue';\n\t}else{\n\t\tproblem.style.color = 'red';\n\t\tproblem.innerHTML =\n\t\t \"Wrong! \\nThe correct answer was \" \n\t\t + problemNumber.toString(toBase);\n\t}\n\tstate = TEXT_STATE;\n}", "function proceed(difficultyLvl) {\n randomWords();\n input.value = \"\";\n showInput.innerText = \"Value displays here\";\n input.focus();\n switch (difficultyLvl) {\n case \"Easy\":\n s += 4;\n break;\n case \"Hard\":\n s += 3;\n break;\n case \"Very Hard\":\n s += 2;\n break;\n default:\n s += 4;\n }\n console.log(s);\n score += 3;\n scoreSheet.innerText = score;\n}", "function userChoice(choice){\n setHulkChoice();\n evaluate(choice);\n}", "function inputChange (e) {\n var isCorrect = game.check(this.value),\n wordObj,\n i,\n l = game.wordsByIndex.length;\n if (isCorrect) {\n // TODO: run correct animation & move to the next stage\n game.level++;\n game.currentSceneIndex++;\n // sound\n game.soundInstance = createjs.Sound.play(\"Correct\"); // play using id. Could also use full sourcepath or event.src.\n //game.soundInstance.addEventListener(\"complete\", createjs.proxy(this.handleComplete, this));\n game.soundInstance.volume = 0.5;\n window.alert('Correct!');\n loadScene(game.currentSceneIndex)\n this.value='';\n } else if (this.value.length > game.minimumWordLength) {\n for (i = 0; i < l; i++) {\n wordObj = game.wordsByIndex[i];\n if (wordsAreEqual(wordObj.spl, this.value)) {\n game.level--;\n setPopupContent(i, 500, 100);\n // show mask\n jQuery('#mask').show();\n // show pop-up\n jQuery('#popup').show();\n this.value='';\n }\n }\n }\n}", "function checkAnswer(){\n trueAnswer = returnCorrectAnswer();\n userAnswer = getInput();\n// this if statement is stating if user inputs the right answer what happens and if not what happens\n if(userAnswer === trueAnswer){\n var messageCorrect = array[global_index].messageCorrect;\n score ++;\n swal({\n title: messageCorrect,\n text: \"You got \" + score + \" out of 8 correct.\",\n });\n }\n else{\n var messageIncorrect = array[global_index].messageIncorrect;\n swal({\n title: messageIncorrect,\n text: \"You got \" + score + \" out of 8 correct.\",\n });\n }\n }", "function UserInputs(action, input) {\n switch (action) {\n case \"concert-this\":\n runBandsInTown(input);\n fixString(input)\n break;\n case \"spotify-this-song\":\n runSpotify(input);\n fixString(input)\n break;\n case \"movie-this\":\n runOmdb(input);\n fixString(input)\n break;\n case \"do-what-it-says\":\n runRandom(input);\n break;\n default:\n console.log(\"\\n--------------------------------------------------------\");\n console.log(\n \"Please enter a valid argument, such as:\\n\\nnode liri.js movie-this [MOVIE TITLE]\\n\\nnode liri.js spotify-this-song [SONG TITLE]\\n\\nnode liri.js concert-this [ARTIST NAME]\\n\\nnode liri.js do-what-it-says\"\n );\n console.log(\n \"--------------------------------------------------------\\n\\n\"\n );\n }\n}", "function start() {\r\n let answer = document.getElementById(\"textInput\").value;\r\n console.log(\"Type OK to start\");\r\n if (\r\n answer === \"ok\" ||\r\n answer === \"OK\" ||\r\n answer === \"Ok\" ||\r\n answer === \"oK\"\r\n ) {\r\n document.getElementById(\"firstInput\").style.display = \"none\";\r\n document.getElementById(\"secondInput\").style.display = \"\";\r\n document.getElementById(\"textbox\").innerHTML =\r\n \"Pick Your Class: Barbarian, Rogue, Knight\";\r\n console.log(answer);\r\n } else {\r\n document.getElementById(\"textbox\").innerHTML = \"How did you fail? Type OK\";\r\n console.log(\"How did you fail? Type OK\");\r\n console.log(answer);\r\n }\r\n}", "function useInput() {\n checkVar(getInput.value);\n // console.log(getInput.value);\n outputP.innerText = getInput.value;\n getInput.value = \"\";\n \n\n}", "function problem_1() {\n\n problemNumber.innerHTML = 'Problem 1';\n input1.style.visibility = 'visible';\n input1.style.width = '200px';\n input1.placeholder = 'Enter \"number\"';\n\n jsConsole.writeLine('Problem 1. Odd or Even');\n jsConsole.writeLine(' - Write an expression that checks if given integer is odd or even.');\n solutionText();\n\n submit.onclick = function () {\n var num = input1.value * 1;\n\n if (!isNaN(num)) {\n\n var result;\n if (num % 2 === 0) {\n result = 'Even';\n } else {\n result = 'Odd';\n }\n printResult();\n } else {\n\n incorrectInput();\n }\n\n function printResult() {\n jsConsole.writeLine(num + ' is ' + result);\n playWhat();\n }\n }\n}", "function saveInput() {\r\n\t\t\tif (document.getElementById(\"check\").innerHTML == \"New Phrase!\") {\r\n\r\n \tdocument.getElementById(\"result1\").innerHTML= \"A Screwdriver\";\r\n \tdocument.getElementById(\"result2\").innerHTML= \"Ask Rude Arrive Her\";\r\n }\r\n\t\r\n var input = document.getElementById(\"userInput\").value;\r\n document.getElementById(\"result1\").style.visibility = \"visible\";\r\n document.getElementById(\"result2\").style.visibility = \"visible\";\r\n document.getElementById(\"check\").innerText= \"New Phrase!\";\r\n document.getElementById(\"userInput\").value = '';\r\n \t// document.getElementById(\"userInput\").style.border=\"3.5px solid #ff4d4d\";\r\n \t// document.getElementById(\"correct\").style.display = \"none\";\r\n \t// document.getElementById(\"incorrect\").style.display = \"block\";\r\n}", "function action () {\n userInput = document.getElementById('input').value\n userInput = parseInt(userInput)\n // when input is given, the input is stored\n if (userInput < 0) {\n document.getElementById('answer').innerHTML = 'negative'\n // this will display the message negative if the number is negative\n } else {\n document.getElementById('answer').innerHTML = 'positive'\n // this will display the postive message if the number is positive\n }\n}", "handleInputAlice() {\n if (this.state.phaseNumber === 1) {\n this.setState({comment:\"Click on a Word!\"});\n }\n else if (this.state.phaseNumber === 3) {\n //guess mystery word\n if (this.state.aliceInput.toLowerCase() === this.state.mysteryWords[(this.state.mysteryWordId-1)].toLowerCase()){\n this.updatePhaseHUD(4);\n this.setState({phaseNumber:4, comment:\"You got it now!\", aliceNumber: 1});\n this.updateRightGuess();\n } else {\n this.updatePhaseHUD(4);\n this.setState({phaseNumber:4, comment:\"Wrong Guess but still very noice!\"});\n this.updateWrongGuess();\n }\n }\n else if (this.state.phaseNumber === 4) {\n this.setState({comment:\"The Tutorial is already over!\"});\n }\n else {\n this.setState({comment:\"It's not Alice's Turn!\"});\n }\n }", "function incorrectInput() {\n showLevelOverlay();\n getId('currentLevel').style.display = \"none\";\n getId('passOrFail').style.display = \"none\";\n getId('scoreMultiplied').style.display = \"none\";\n getId('normalScore').style.display = \"none\";\n getId('pointsDivider').style.display = \"none\";\n getId('tutorialOrHearts').style.display = \"none\";\n getId('congrats').style.display = \"block\";\n getId('congratsText').style.color = \"#C4273C\";\n getId('congratsText').innerHTML = \"Please enter\";\n getId('highScore').style.display = \"block\";\n getId('highScoreText').style.color = \"#C4273C\";\n getId('highScoreText').innerHTML = \"YOUR NAME!\";\n getId('enterName').style.display = \"block\";\n getId('nameBoxContainer').style.display = \"block\";\n getId('buttonLeftText').innerHTML = \"Reset\";\n getId('buttonRightText').innerHTML = \"Submit\";\n}", "function exercise(input){\n if(input === 'running'){\n var statement = \"Today's excercise: \" + input ; \n }else if (input === 'swimming'){\n var statement = \"Today's excercise: \" + input ; \n }\n return statement; \n}", "function initialPrompt() {\n word = input.question(\"Let's play some scrabble!\\n\\nEnter a word to score: \");\n \n /*console.log('\\n' + scrabbleScore.scoring);\n console.log('\\n' + 'Simple Score: ' + simpleScore.scoring());\n console.log('\\n' + 'Vowel Bonus Score: ' + vowelBonusScore.scoring());*/\n \n}", "function evaluate() {\n $('#quizBoard').hide();\n $('#results').show();\n if ($('#q1f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q2t').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q3f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q4f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q5t').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q6t').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q7f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q8f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q9f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n $('#corr').html(correct)\n $('#incorr').html(incorrect)\n $('#percent').html(correct/9)\n}", "function processAnswer() {\r\n var answer = document.getElementById('answer');\r\n // if answer field is empty, do nothing\r\n if (answer.value == \"\") {\r\n return;\r\n }\r\n // increase score if correct\r\n addScore();\r\n checkSuccess();\r\n // take life if wrong\r\n takeLifeAway();\r\n // display gameover if lives = 0\r\n if(checkGameOver()) {\r\n hideGame();\r\n displayGameOver();\r\n }\r\n displayFactors();\r\n answer.value = \"\";\r\n}", "checkAnswer() {\n \n let currentQuestionAnswer = eval(propblems[this.state.currentProblemIndex].question);\n let nextString = null;\n\n if (currentQuestionAnswer == this.state.answerByUser) {\n nextString = \"Clear\";\n this.setState(state => ({\n score:state.score+1\n }))\n } else {\n nextString = \"Wrong\";\n }\n\n\n console.log(this.state.score);\n\n this.setState(state => ({\n currentDisplayingStr: nextString,\n currentProblemIndex: state.currentProblemIndex + 1,\n currentQuestionIndex: null,\n shouldShowInput: false\n }))\n\n this.initiateTest();\n }", "function evaluate(){\n var pc = randed, you = person();\n \n if(pc == you){ document.getElementById(\"eval\").innerHTML=\" Draw \"; }\n else if(pc == 1 && you == 2){document.getElementById(\"eval\").innerHTML=\" PC Scores \";}\n else if(pc== 1 && you == 3){document.getElementById(\"eval\").innerHTML=\" You Scores \";}\n else if(pc==2 && you ==1){document.getElementById(\"eval\").innerHTML=\" You Scores \";}\n else if(pc==2 && you==3){document.getElementById(\"eval\").innerHTML=\" PC Scores \";}\n else if(pc==3 && you==1){document.getElementById(\"eval\").innerHTML=\" PC Scores \";}\n else if(pc==3 && you==2){document.getElementById(\"eval\").innerHTML=\" You Scores \";}\n}", "function runProgram(){\n\n userWord=initialPrompt();\n\n\n\n transformStyle=scoreStylePrompt();\n\n console.log(userWord);\n console.log(transformStyle);\n \n}", "function askUser(){\n setRatingVars();\n checkEvents();\n if(outChooseVal == 1){\n console.log(chalk.cyan(\"\\nYour task has been completed. Select the a validator to continue...\\n\"));\n }\n if(canRate == true){\n giveRating();\n }\n else{\n if(prov == 0)\n inquirer.prompt([questions]).then(answers => {choiceMade(answers.whatToDo)});\n else\n inquirer.prompt([questions1]).then(answers => {choiceMade(answers.whatToDo1)});\n }\n}", "function initialPrompt() {\n let userInput = null;\n let boolean = false;\n while (boolean == false) {\n userInput = input.question(\"Let's play some scrabble! \\nEnter a word to score: \");\n boolean = validateInput(userInput);\n }\n return userInput;\n}", "function evaluator (userAnswer) {\n currentTour;\n correctAnswer;\n if (userAnswer === correctAnswer) {\n currentTour = currentTour + 1;\n console.log(\"User wrigt\");\n console.log(\"Tour\",currentTour)\n answerCorrect();\n quizExecutor(currentTour);\n } else {\n currentTour = currentTour + 1;\n console.log(\"User wrong\");\n console.log(\"Tour\",currentTour);\n answerWrong();\n quizExecutor(currentTour);\n };\n }", "function change () {\n setAnswer(this.value)\n // If the appearance is 'quick', then also progress to the next field\n if (fieldProperties.APPEARANCE.includes('quick') === true) {\n goToNextField()\n }\n}", "evaluate() {\n // If the last character in the\n // current display is a number\n // (For the case where an operator\n // was input last)\n if (this.state.display.match(/\\d$/)) {\n // Remove unnecessary operators\n let evaluate = this.state.display.replace(\n /[\\*\\-\\+\\/]+(?!\\-?\\d)/g,\n ''\n );\n // Evaluate answer\n let answer = eval(evaluate);\n // Update display to show answer\n // and formula to show the\n // evaluated equation\n this.setState({\n display: answer.toString(),\n formula: this.state.display + '=' + answer,\n });\n }\n }", "function userInputClick() {\n // Get input from user and store it in variable\n const age = parseInt(document.getElementById(\"age-entered\").value)\n const day = document.getElementById(\"day-entered\").value\n\n // Checks if user should go to the movies\n if ((day == \"tuesday\" || day == \"thursday\") || (age > 12 && age < 21)) {\n document.getElementById(\"output\").innerHTML = \"You should go to the museum because you will get a discount\"\n } else {\n document.getElementById(\"output\").innerHTML = \"You should not go to the museum today because you will not get a discount\"\n }\n}", "function getInput(){\n return prompt(\"Enter your score:\");\n}" ]
[ "0.6807743", "0.669007", "0.63524586", "0.6127466", "0.60732496", "0.5969236", "0.58497804", "0.58126897", "0.58098054", "0.5806892", "0.57868755", "0.5749469", "0.5738369", "0.56831956", "0.5662569", "0.5647252", "0.56438404", "0.56296617", "0.56276786", "0.5623167", "0.56001574", "0.5591893", "0.5570634", "0.55607116", "0.5559122", "0.5557966", "0.55572045", "0.5555474", "0.5555315", "0.5549991" ]
0.79498196
0
Update the state of the practice pane according to the current state of the unit.
function updatePracticePaneState() { switch (my.current.state) { case my.STATE.READY: my.html.practicePane.className = '' my.html.input.disabled = false my.html.input.focus() Util.setChildren(my.html.status, 'READY') my.html.status.title = 'Type in the input box below ' + 'to begin this lesson.' my.html.restartLink.style.visibility = 'hidden' break case my.STATE.RUNNING: my.html.practicePane.className = '' my.html.input.disabled = false my.html.input.focus() Util.setChildren(my.html.status, '') my.html.status.title = '' my.html.restartLink.style.visibility = 'visible' break case my.STATE.ERROR: my.html.practicePane.className = 'error' my.html.input.disabled = false my.html.input.focus() my.html.restartLink.style.visibility = 'visible' Util.setChildren(my.html.status, 'ERROR!') my.html.status.title = 'Fix errors in the input box ' + 'by pressing the backspace key.' break case my.STATE.COMPLETED: my.html.practicePane.className = 'completed' my.html.input.disabled = true my.html.input.blur() my.html.restartLink.style.visibility = 'visible' Util.setChildren(my.html.status, 'COMPLETED') my.html.status.title = 'You have completed this lesson.' break } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updatePracticePane()\n {\n evaluateInput()\n setTargetText()\n displayTargetText()\n updateProgress()\n updateSpeed()\n updateError()\n updateSmiley()\n\n if (my.current.state == my.STATE.COMPLETED) {\n displayAdvice()\n setResultTooltips()\n\n log('state', my.current.state.toUpperCase(),\n 'unit', my.current.unitNo + '.' + my.current.subunitNo,\n 'type', my.settings.unit,\n 'wpm', my.current.wpm,\n 'error', my.current.errorRate.toFixed(1))\n }\n }", "function update_progress_section() {\n\t// Update the visual progress section (much of it temp for now)\n\t$('#questions_correct_level_count').text(questions_correct_level_count)\n\t$('#questions_incorrect_level_count').text(questions_incorrect_level_count)\n\t$('#questions_correct_total_count').text(questions_correct_total_count)\n\t$('#questions_incorrect_total_count').text(questions_incorrect_total_count)\n\t$('#progress_current_question').text(question_number)\n\t$('#questions_attempted_total_count').text(questions_attempted_count)\n\t$('#questions_correct_required').text(questions_correct_required)\n\t$('#questions_attempted_required').text(questions_attempted_required)\n}", "function setUpdatingState() {\n status.innerText = 'Updating arrangements...';\n status.style.color = 'black';\n playButton.disabled = true;\n alphaSlider.disabled = true;\n sampleButton1.disabled = true;\n sampleButton2.disabled = true;\n saveButton.disabled = true;\n changeChordsButton.disabled = true;\n chordInputs.forEach(c => c.disabled = true);\n chordInputs.forEach(c => c.style.color = 'gray');\n}", "updateUI(state, progress, answerValue = undefined, node = undefined) {\n // change background color of answer selection button\n if (node !== undefined) {\n let styleQuery = document.querySelector(`[data-key='${node}']`).style;\n if (answerValue === 'true') {\n styleQuery.backgroundColor = 'hsl(140, 100%, 30%)'; // red\n styleQuery.color = 'white';\n } else {\n styleQuery.backgroundColor = 'hsl(0, 100%, 55%)'; // green\n styleQuery.color = 'white';\n }\n }\n // this.validateUI(node);\n setTimeout(() => {\n this.header(progress);\n if (state === 'end') {\n this.end(progress);\n } else {\n this.main();\n }\n }, (answerValue === undefined) ? 100 : 2000)\n }", "updateUI() {\n document.getElementById(\"health\").innerHTML = this.currPlayerHealth;\n document.getElementById(\"food\").innerHTML = this.playerFood;\n document.getElementById(\"turn\").innerHTML = this.turnNum;\n document.getElementById(\"lvl\").innerHTML = this.currentLevel;\n document.getElementById(\"scr\").innerHTML = this.playerScore;\n\n }", "updateState(state) {\n $('#tournament-name').text(state.casters.tournament);\n $('#tournament-bracket').attr('format', state.tournament.bracket.format);\n\n this.bracket = state.tournament.bracket;\n\n $('#bracket-items').html('');\n for (const r in this.bracket.rounds) {\n $('#bracket-items').append(bracketItem(this.bracket.rounds[r]));\n }\n\n // final\n if ('Final' in this.bracket.rounds) {\n const final = this.bracket.rounds.Final;\n\n if (final.winner === 1) {\n $('#bracket-winner .name').text(final.team1);\n setCSSImage(\n $('#bracket-winner .logo'),\n final.team1Logo && final.team1Logo !== '' ? final.team1Logo : './images/default-logo.png',\n );\n }\n else if (final.winner === 2) {\n $('#bracket-winner .name').text(final.team2);\n setCSSImage(\n $('#bracket-winner .logo'),\n final.team2Logo && final.team2Logo !== '' ? final.team2Logo : './images/default-logo.png',\n );\n }\n else {\n $('#bracket-winner .name').text('');\n setCSSImage($('#bracket-winner .logo'), '');\n }\n }\n }", "update() {\n this.scoreHTML.innerText = this.score;\n // show modal if you score 12\n if(this.score == 12){\n this.win();\n }\n }", "function updateDisplay () {\n if (isGameOver()) {\n if (whoWon() === 1) {\n $('#gameStatus').text('Gameover. The winner is Player1!')\n } else if (whoWon() === 2) {\n $('#gameStatus').text('Gameover. The winner is Player2!')\n } else {\n $('#gameStatus').text('Gameover. It\\'s a draw!')\n }\n }\n\n if (!isGameOver()) {\n $('#gameStatus').text('Q' + (quiz.currentQuestion + 1) + ') ' + 'It\\'s Player' + (quiz.currentQuestion % 2 + 1) + '\\'s turn')\n // update question\n var flagIndex = quiz.currentQuestion + 1\n $('#flag').css('background-image', 'url(./img/flag' + flagIndex + '.gif)')\n $('#choice1').text(quiz.questions[quiz.currentQuestion].choices[0])\n $('#choice2').text(quiz.questions[quiz.currentQuestion].choices[1])\n $('#choice3').text(quiz.questions[quiz.currentQuestion].choices[2])\n $('#choice4').text(quiz.questions[quiz.currentQuestion].choices[3])\n // update sccore\n $('#player1Score').text(quiz.player1Score)\n $('#player2Score').text(quiz.player2Score)\n }\n}", "function evaluateInput()\n {\n var inputText = my.html.input.value\n var inputLength = inputText.length\n\n // If the tutor is in READY state, and input has been entered,\n // then set it to RUNNING STATE.\n if (my.current.state == my.STATE.READY && inputLength > 0) {\n\n my.current.startTime = new Date().getTime()\n my.current.state = my.STATE.RUNNING\n updatePracticePaneState()\n\n log('state', my.current.state.toUpperCase(),\n 'unit', my.current.unitNo + '.' + my.current.subunitNo,\n 'type', my.settings.unit)\n }\n\n // Number of characters correctly typed by the user\n var goodChars = Util.common(my.current.subunitText, inputText)\n my.current.correctInputLength = goodChars\n\n // Validate the input\n if (goodChars == inputLength) {\n\n // Clear error if any\n if (my.current.state == my.STATE.ERROR) {\n\n my.current.state = my.STATE.RUNNING\n updatePracticePaneState()\n }\n } else {\n\n // Set and display error\n if (my.current.state == my.STATE.RUNNING) {\n my.current.state = my.STATE.ERROR\n my.current.errors++\n updatePracticePaneState()\n } else if (my.current.state == my.STATE.ERROR) {\n processInputCommand()\n }\n }\n\n // Update error rate\n if (goodChars == 0) {\n if (my.current.errors == 0) {\n my.current.errorRate = 0\n } else {\n my.current.errorRate = Number.POSITIVE_INFINITY\n }\n } else {\n my.current.errorRate = 100 * my.current.errors / goodChars\n }\n\n // Check if the complete target text has been typed successfully\n if (goodChars == my.current.subunitText.length) {\n my.current.state = my.STATE.COMPLETED\n updatePracticePaneState()\n }\n }", "function resetSubunit()\n {\n my.current.state = my.STATE.READY\n my.current.errors = 0\n my.html.input.value = ''\n\n log('state', my.current.state.toUpperCase(),\n 'unit', my.current.unitNo + '.' + my.current.subunitNo,\n 'type', my.settings.unit)\n\n updatePracticePaneState()\n updatePracticePane()\n clearAdvice()\n clearResultTooltips()\n }", "function updateUI () {\n $(\".wins\").text(wins);\n $(\".losses\").text(losses);\n $(\".score-report\").text(totalScore);\n }", "updateDisplay() {\n $('#steps .value').text(this.stepCounter);\n }", "onCorrect () {\n if (this.state.category < 5) {\n this.updateCheese();\n this.updateBoard();\n }\n else {\n this.updateCheese();\n this.gameEnd();\n }\n }", "changeState(state) {\n // Game State\n if (state === 'game') {\n this.menu.style.display = 'none';\n this.canvas.style.display = 'block';\n\n // Instructions state\n } else if (state === 'instructions') {\n this.menu.style.display = 'none';\n this.instructions.style.display = 'block';\n\n // Menu state\n } else if (state === 'menu') {\n this.instructions.style.display = 'none';\n this.canvas.style.display = 'none';\n this.menu.style.display = 'block';\n\n // Winning State\n } else if (state === 'win') {\n this.canvas.style.display = 'none';\n this.winSection.style.display = 'block';\n\n // Not a state but displays the game state again\n } else if ('.play-again') {\n this.winSection.style.display = 'none';\n this.canvas.style.display = 'block';\n }\n }", "makeUI() {\n gameState.criteriaText = this.add.text(gameState.CENTER_X, gameState.CRITERIA_HEIGHT, `MULTIPLES OF ${gameState.criteriaNum}`, {\n font: gameState.INFO_FONT,\n fill: '#00ffff'\n }).setOrigin(0.5);\n gameState.creditsText = this.add.text(192, 684, `Created by Jon So, 2021`, {\n font: gameState.DECO_FONT,\n fill: '#ffffff'\n });\n gameState.scoreText = this.add.text(gameState.CENTER_X, gameState.SCORE_HEIGHT, `${gameState.score}`, {\n font: gameState.SCORE_FONT,\n fill: '#ffffff'\n }).setOrigin(0.5);\n gameState.levelText = this.add.text(3 * gameState.CENTER_X / 2, 3 * gameState.CENTER_Y / 2, `LV. ${gameState.level}: ${gameState.FLAVORS[gameState.colorFlavorIndex]}`, {\n font: gameState.INFO_FONT,\n fill: '#ffffff'\n }).setOrigin(0.5);\n gameState.readyPrompt = this.add.text(gameState.CENTER_X, 9 * gameState.CENTER_Y / 16, ``, {\n font: gameState.READY_FONT,\n fill: '#ff0000'\n }).setOrigin(0.5);\n gameState.comboCounterTextLeft = this.add.text(gameState.CENTER_X / 7 + 8, gameState.CENTER_Y - 32, `1x`, {\n font: gameState.COMBO_FONT,\n fill: '#ffffff',\n }).setOrigin(0.5).setFontStyle('bold italic');\n gameState.comboCounterTextRight = this.add.text(config.width - gameState.CENTER_X / 7 - 8, gameState.CENTER_Y - 32, `1x`, {\n font: gameState.COMBO_FONT,\n fill: '#ffffff',\n }).setOrigin(0.5).setFontStyle('bold italic');\n // Display the high score/highest level/ highest combo\n\t\tgameState.highText = this.add.text(gameState.CENTER_X, 16, \n\t\t\t`HI SCORE-${localStorage.getItem(gameState.LS_HISCORE_KEY)}\\t\\tHI COMBO-${localStorage.getItem(gameState.LS_HICOMBO_KEY)}\\t\\tHI LEVEL-${localStorage.getItem(gameState.LS_HILEVEL_KEY)}`, {\n\t\t\t\tfont: gameState.INFO_FONT,\n \tfill: '#ffffff'\n }).setOrigin(0.5).setTint(0xff0000).setFontStyle(\"bold\"); \n this.showReadyPrompt();\n gameState.levelText.setTint(gameState.COLOR_HEXS[gameState.colorFlavorIndex]);\n this.setupLivesDisplay();\n }", "function updateUI() {\n updatePlayerComponents(['points', 'teenagers', 'kettles', 'theaters', 'cps'])\n updatePriceComponents(['teenagers', 'kettles', 'theaters'])\n updateDoublePowerButton()\n}", "function updateDisplay () {\n if (isGameOver()) {\n $('h1').text(' gameover. winner is ' + whoWon())\n } else {\n $('h1').text(quiz.currentQuestion + ') ' + quiz.questions[quiz.currentQuestion].prompt)\n // hard coded display, only has 4 answers at a time. Each is displayed as a button, so can use the order (eg) that they appear in the dom to select them\n $('button').eq(0).text(quiz.questions[quiz.currentQuestion].choices[0])\n $('button').eq(1).text(quiz.questions[quiz.currentQuestion].choices[1])\n $('button').eq(2).text(quiz.questions[quiz.currentQuestion].choices[2])\n $('button').eq(3).text(quiz.questions[quiz.currentQuestion].choices[3])\n }\n // update player scores regardless\n $('h3').eq(0).text('Player1: ' + quiz.player1Points)\n $('h3').eq(1).text('Player2: ' + quiz.player2Points)\n}", "updateUI(){\n document.getElementById(\"theWord\").innerHTML = this._constructDisplayWord();\n document.getElementById(\"guessdLetter\").innerHTML = this._guessedLetter.toString().replace(/,/g, ' ');;\n document.getElementById(\"lives\").innerHTML = this._lives;\n document.getElementById(\"wins\").innerHTML = this._wins;\n }", "function changeTutorial() {\n\t\tcaptionTextIndex = 0;\n\t\tvar numSteps = captionText[tutorialIndex].length;;\n\t\tvar stepWidth = headerBar.size[0] / numSteps;// / numSteps - (0.4 * numSteps);\n\t\tvar content = '<div style=\"width:' + stepWidth + 'px;\" class=\"completedStep\"></div>';\n\t\tfor (var i=1; i < numSteps; i++) {\n\t\t\tcontent += '<div style=\"width:' + stepWidth + 'px;\" class=\"uncompletedStep\"></div>'\n\t\t}\n\t\tprogressBar.setContent('<div>'+content+'</div>');\n\t\tcaption.setContent(captionText[tutorialIndex][captionTextIndex]);\n\t\theaderBar.setContent(tutorialNames[tutorialIndex]);\n\t}", "function displayGuide() {\n my.html.guide.innerHTML = my.current.unit.guide\n }", "function indicateState() {\n setTutorialState(props.tutorialText);\n setShowModalState(true);\n }", "function update() {\n \n var object = editor.selected;\n if (object !== null) {\n object.visible = objectVisible.getValue();\n var selectObjectType = editor.getObjectType(object);\n var lineType = \"\";\n var scopeType = \"\";\n if (selectObjectType === 'line' || selectObjectType === 'hline' || selectObjectType === 'auline') {\n if (selectObjectType === 'line') {\n lineType = \"l\";\n }\n else if (selectObjectType === 'hline') {\n lineType = \"h\";\n }\n else {\n lineType = \"au\";\n }\n if (selectScope.dom.value == 1) {\n scopeType = \"unit\";\n }\n else {\n scopeType = \"area\";\n }\n console.log(\"upate\", objectName.getValue(), objectUserData.getValue(), materialColor.getHexValue(), selectType.getValue(), selectState.getValue(), scopeType, selectAParent.getValue(), lineType, objectLossRate.getValue());\n editor.updateAULineInfo(object, objectName.getValue(), objectUserData.getValue(), materialColor.getHexValue(), selectType.getValue(), selectState.getValue(), scopeType, selectAParent.getValue(), lineType, objectLossRate.getValue());\n } else {\n }\n }\n }", "function updateDisplay () {\n if (isGameOver()) {\n\n } else {\n $('h1.question').text(quiz.questions[quiz.currentQuestion].qn)\n $('h2.answer').text(quiz.questions[quiz.currentQuestion].factMsg)\n // hard coded display, only has 4 answers at a time. Each is displayed as a button, so can use the order (eg) that they appear in the dom to select them\n $('button').eq(0).text(quiz.questions[quiz.currentQuestion].options[0])\n $('button').eq(1).text(quiz.questions[quiz.currentQuestion].options[1])\n if (quiz.questions[quiz.currentQuestion].options[2]) {\n $('button').eq(2).text(quiz.questions[quiz.currentQuestion].options[2])\n } else {\n }\n $('button').eq(3).text(quiz.questions[quiz.currentQuestion].options[3])\n }\n}", "function updateGoals()\n{\n //Step 1: Stop timer\n startStopTimer();\n //Show goal scoring submenu -> allows entry for scorer + assists names\n document.getElementsByClassName(\"menu\")[0].style.display = \"none\";\n document.getElementsByClassName(\"scoring-menu\")[0].style.display = \"block\";\n \n\tif(currTeam == 1)\n\t{\n\t\tT1.goals += 1;\n\t\tdocument.getElementsByClassName(\"team-one-score\")[0].innerHTML = T1.goals;\n\t}\n\telse\n\t{\n\t\tT2.goals += 1;\n\t\tdocument.getElementsByClassName(\"team-two-score\")[0].innerHTML = T2.goals;\n\t}\n}", "updateDisplayString() {\n this.displayString = 'Increase ' + this.name + ' by ' + this.value + ' ' + this.measuringUnit;\n }", "function updateUI(){\n\t\n\t$('elapsed').innerText = timeElapsed();\n\t$('timer').innerText = countdown;\n\t$('shots').innerText = min_elapsed;\n\t$('bottles').innerText = toBottles(min_elapsed);\n\t$('ml').innerText = toMl(min_elapsed);\n\t$('oz').innerText = toOz(min_elapsed);\n\tif(paused){\n\t\t$('status').innerText = 'Play!';\n\t\t$('status').setStyle('color', '#'+Math.floor(Math.random()*16777215).toString(16));\n\t}\n\telse{\n\t\t$('status').innerText = 'Pause.';\n\t}\n\t$('interval').innerText = 'Game interval is ' + interval + ' seconds. Click to change.';\n}", "function update_unit_menu(value){\n value = parseInt(value);\n\n // GET THE UNIT DATA FOR THE SELECTED UNIT\n if (parseInt(get_num_value(document.getElementById(selected_unit).id)[0]) === p_color){\n // GET THE DATA FOR THE CIV THAT IS THE CURRENT PLAYER\n document.getElementById('unit_menu_name').innerHTML = civ_units[p_color][value].unit_Type;\n\n document.getElementById('unit_menu_stats').innerHTML = \"Movement \"+civ_units[p_color][value].unit_Movement_Remaining+\"/\"+civ_units[p_color][value].unit_Movement+\"<br>Health \"+civ_units[p_color][value].unit_Health+\"<br>Strength \"+civ_units[p_color][value].unit_Strength+\"<br>Class \" + civ_units[p_color][value].unit_Class\n\n if (civ_units[p_color][value].unit_Type === \"City\"){\n document.getElementById('unit_menu_actions').innerHTML = \"\\\n <a href='javascript:void(0);' onclick='city_menu()'><span href='javascript:void(0);' class='in-game_hotkey'>C</span>ity View</a>\\\n \"\n }\n\n if (civ_units[p_color][value].unit_Type === \"Settler\"){\n document.getElementById('unit_menu_actions').innerHTML = \"\\\n <a href='javascript:void(0);' onclick='unit_action(\"+value+\")'><span href='javascript:void(0);' class='in-game_hotkey'>B</span>uild City</a><br>\\\n <a href='javascript:void(0);' onclick='unit_action(\"+value+\", 0)'><span href='javascript:void(0);' class='in-game_hotkey'>D</span>elete Unit</a>\\\n \"\n }\n\n if ((civ_units[p_color][value].unit_Type === \"Warrior\") ||\n (civ_units[p_color][value].unit_Type === \"Horsemen\") ||\n (civ_units[p_color][value].unit_Type === \"Archers\")){ // value = 1 here\n document.getElementById('unit_menu_actions').innerHTML = \"\\\n <a href='javascript:void(0);' onclick='unit_attack = 1'><span href='javascript:void(0);' class='in-game_hotkey'>A</span>ttack</a><br>\\\n <a href='javascript:void(0);' onclick='unit_action(\"+value+\", 0)'><span href='javascript:void(0);' class='in-game_hotkey'>D</span>elete Unit</a>\\\n \"\n }\n } else{\n // GET DATA FOR THE OTHER CIVS THAT AREN'T THE CURRENT PLAYER\n for (var i = 0, length = player.length; i < length; i++){\n if (parseInt(get_num_value(document.getElementById(selected_unit).id)[0]) === i){\n //alert(\"p_color = \" + i);\n document.getElementById('unit_menu_name').innerHTML = civ_units[i][value].unit_Type;\n\n document.getElementById('unit_menu_stats').innerHTML = \"Movement \"+civ_units[i][value].unit_Movement_Remaining+\"/\"+civ_units[i][value].unit_Movement+\"<br>Health \"+civ_units[i][value].unit_Health+\"<br>Strength \"+civ_units[i][value].unit_Strength\n\n if (civ_units[i][value].unit_Type === \"City\"){\n document.getElementById('unit_menu_actions').innerHTML = \"\\\n <a href='javascript:void(0);' onclick='city_menu()'><span class='in-game_hotkey'>C</span>ity View</a>\\\n \"\n }\n\n if (civ_units[i][value].unit_Type === \"Settler\"){\n document.getElementById('unit_menu_actions').innerHTML = \"\\\n <a href='javascript:void(0);' onclick='unit_action(\"+value+\")'><span class='in-game_hotkey'>B</span>uild City</a>\\\n \"\n }\n\n if (civ_units[i][value].unit_Type === \"Warrior\"){\n document.getElementById('unit_menu_actions').innerHTML = \"NYI\"\n }\n }\n }\n }\n}", "function updateDisplay() {\n if (view == 'assignments') {\n $('#graded-items').hide();\n\n $('#assignments').show();\n $('.assignment-progress-bar').show();\n updateAssignments((a) => {\n assignments = a;\n displayAssignments(assignments);\n });\n } else if (view == 'gradedItems') {\n $('#assignments').hide();\n $('.assignment-progress-bar').hide();\n\n $('#graded-items').show();\n updateGradedItems((g) => {\n gradedItems = g;\n displayGradedItems(gradedItems);\n });\n }\n }", "winner() {\r\n this.state = STATES.win;\r\n this.htmlOverlay.innerHTML = \"<p>Congratulation you are the winner</p>\";\r\n this.htmlOverlay.style.display = \"block\";\r\n }", "function update(){\n updateSnakeMovement();\n updateGameFinishedState();\n updateFoodAcquiredState();\n }" ]
[ "0.8052318", "0.57588446", "0.5743218", "0.56928384", "0.5668989", "0.5660109", "0.55661553", "0.55559504", "0.5511542", "0.55113316", "0.5503733", "0.5496617", "0.5492996", "0.546254", "0.54377234", "0.5434156", "0.54306704", "0.54262424", "0.5418253", "0.5390242", "0.5385376", "0.53657335", "0.53603494", "0.53505397", "0.53352255", "0.53305477", "0.5320918", "0.5308575", "0.52924037", "0.52922857" ]
0.7647987
1
Update the typing speed.
function updateSpeed() { // WPM and CPM does not need to be calculated on error if (my.current.state == my.STATE.ERROR) { return } var goodChars = my.current.correctInputLength // Determine the time elapsed since the user began typing var currentTime = new Date().getTime() var timeElapsed = currentTime - my.current.startTime my.current.timeElapsed = timeElapsed // Calculate WPM and CPM var wpm if (timeElapsed == 0) { wpm = goodChars == 0 ? 0 : '\u221e' } else { wpm = Math.round(60000 * goodChars / 5 / timeElapsed) my.current.wpm = wpm my.current.cpm = Math.round(60000 * goodChars / timeElapsed) } // Display WPM Util.setChildren(my.html.speed, wpm + ' wpm') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateTyping () {\n if (connected) {\n if (!typing) {\n typing = true;\n socket.emit('typing', {\n target: target,\n });\n }\n lastTypingTime = (new Date()).getTime();\n\n setTimeout(function () {\n var typingTimer = (new Date()).getTime();\n var timeDiff = typingTimer - lastTypingTime;\n if (timeDiff >= TYPING_TIMER_LENGTH && typing) {\n socket.emit('stop typing', {\n target: target,\n });\n typing = false;\n }\n }, TYPING_TIMER_LENGTH);\n }\n }", "updateSpeed (speed) {\n this.speed = speed;\n }", "function updateSpeed() {\n\tif(!paused) {\n\t\tclearInterval(interval);\n\t\tinterval = setInterval(doTick, speed);\n\t}\n\t$('#speed-input').val(speed);\n\t$('#speed-text').html(speed);\n\n\tlet rotation = (speed / (MAX_SPEED - MIN_SPEED) ) * 180 - 90;\n\trotation *= -1;\n\t$('#speed-line').css('transform', 'rotate('+rotation+'deg)');\n}", "function updateTyping () {\n if (connected) {\n if (!typing) {\n typing = true;\n socket.emit('typing');\n }\n lastTypingTime = (new Date()).getTime();\n\n setTimeout(function () {\n var typingTimer = (new Date()).getTime();\n var timeDiff = typingTimer - lastTypingTime;\n if (timeDiff >= TYPING_TIMER_LENGTH && typing) {\n socket.emit('stop typing');\n typing = false;\n }\n }, TYPING_TIMER_LENGTH);\n }\n }", "function updateTyping () {\n if (connected) {\n if (!typing) {\n typing = true;\n socket.emit('typing');\n }\n lastTypingTime = (new Date()).getTime();\n\n setTimeout(function () {\n var typingTimer = (new Date()).getTime();\n var timeDiff = typingTimer - lastTypingTime;\n if (timeDiff >= TYPING_TIMER_LENGTH && typing) {\n socket.emit('stop typing');\n typing = false;\n }\n }, TYPING_TIMER_LENGTH);\n }\n }", "function updateTyping () {\n if (connected) {\n if (!typing) {\n typing = true;\n socket.emit('typing');\n }\n lastTypingTime = (new Date()).getTime();\n\n setTimeout(function () {\n var typingTimer = (new Date()).getTime();\n var timeDiff = typingTimer - lastTypingTime;\n if (timeDiff >= TYPING_TIMER_LENGTH && typing) {\n socket.emit('stop typing');\n typing = false;\n }\n }, TYPING_TIMER_LENGTH);\n }\n }", "function updateTyping () {\n if (connected) {\n if (!typing) {\n typing = true;\n socket.emit('typing');\n }\n lastTypingTime = (new Date()).getTime();\n\n setTimeout(function () {\n var typingTimer = (new Date()).getTime();\n var timeDiff = typingTimer - lastTypingTime;\n if (timeDiff >= TYPING_TIMER_LENGTH && typing) {\n socket.emit('stop typing');\n typing = false;\n }\n }, TYPING_TIMER_LENGTH);\n }\n }", "function updateTyping () {\n if (connected) {\n if (!typing) {\n typing = true;\n socket.emit('typing');\n }\n lastTypingTime = (new Date()).getTime();\n\n setTimeout(function () {\n var typingTimer = (new Date()).getTime();\n var timeDiff = typingTimer - lastTypingTime;\n if (timeDiff >= TYPING_TIMER_LENGTH && typing) {\n socket.emit('stop typing');\n typing = false;\n }\n }, TYPING_TIMER_LENGTH);\n }\n }", "function updateTyping () {\n \n if (!typing) {\n typing = true;\n socket.emit('typing', {name:username});\n }\n lastTypingTime = (new Date()).getTime();\n\n setTimeout(function () {\n var typingTimer = (new Date()).getTime();\n var timeDiff = typingTimer - lastTypingTime;\n if (timeDiff >= TYPING_TIMER_LENGTH && typing) {\n socket.emit('stop typing', {name:username});\n typing = false;\n }\n }, TYPING_TIMER_LENGTH);\n \n }", "_updateGenerationSpeed(speed) {\n this['generationSpeed'] = parseInt(speed, 10);\n this._layoutWords();\n }", "function sendUpdateTyping() {\n if (connected) {\n if (!typing) {\n typing = true;\n socket.emit('typing');\n }\n }\n lastTypingTime = (new Date()).getTime();\n $timeout(function () {\n var typingTimer = (new Date()).getTime();\n var timeDiff = typingTimer - lastTypingTime;\n if (timeDiff >= TYPING_TIMER_LENGTH && typing) {\n socket.emit('stop typing');\n typing = false;\n }\n }, TYPING_TIMER_LENGTH)\n }", "function changeSpeed() {\n if (id(\"start\").disabled) {\n clearInterval(timer);\n let speed = parseInt(id(\"speed\").value);\n timer = setInterval(handleText, speed);\n }\n }", "function setScrollingSpeed(value, type) {\n setVariableState('scrollingSpeed', value, type);\n }", "function setScrollingSpeed(value, type){\n setVariableState('scrollingSpeed', value, type);\n }", "function setScrollingSpeed(value, type){\n setVariableState('scrollingSpeed', value, type);\n }", "function setScrollingSpeed(value, type){\n setVariableState('scrollingSpeed', value, type);\n }", "function setScrollingSpeed(value, type){\n setVariableState('scrollingSpeed', value, type);\n }", "function setScrollingSpeed(value, type){\n setVariableState('scrollingSpeed', value, type);\n }", "function setScrollingSpeed(value, type){\r\n setVariableState('scrollingSpeed', value, type);\r\n }", "function setScrollingSpeed(value, type){\r\n setVariableState('scrollingSpeed', value, type);\r\n }", "function setScrollingSpeed(value, type){\r\n setVariableState('scrollingSpeed', value, type);\r\n }", "function setScrollingSpeed(value, type){\r\n setVariableState('scrollingSpeed', value, type);\r\n }", "function setScrollingSpeed(value, type){\r\n setVariableState('scrollingSpeed', value, type);\r\n }", "function update_speed() {\r\n\t\tvar new_speed = $(\"#speed_range\").val()\r\n\t\tif (new_speed != speed_input) {\r\n\t\t\tset_speed(new_speed)\r\n\t\t}\r\n\t}", "function setScrollingSpeed(value, type) {\n setVariableState('scrollingSpeed', value, type);\n }", "textBoxDidUpdate() {\n // user is typing because the value of the textbox just changed\n this.isTyping = true;\n this.lastTypingTime = (new Date()).getTime();\n // Create Timer event\n setTimeout(() => {this.checkTyping()}, this.typingTimeout);\n }", "typeAnimation(){\n\t\t//preserve a copy of all the text we're about to display incase we need to save\n\t\tthis.saveCopy();\n\t\t\n\t\tFileManager.writing = false; \n\t\t\n\t\t//figure out how fast we want to type the screen based on how much content needs typing \n\t\tvar letters = 0;\n\t\tfor (i=0; i< this.state.toShowText.length; i++){\t\t\t \n\t\t\tletters += this.state.toShowText[i].text.length;\n\t\t}\n\t\tvar scale = Math.floor(letters/20);\n\t\tif(scale < 1){\n\t\t\tscale = 1;\n\t\t}\n\t\t\n\t\t\n\t\t//do the actual typing\n\t\tthis.typeAnimationActual(scale);\n\t\t\n\t}", "increaseSpeed() {\n\n this.speed = Math.max(this.speed - Snake.SPEED_INCREMENT, Snake.MAX_SPEED);\n\n }", "function changeSpeed(s) {\n player.speed += s;\n}", "function SetSpeed(speed) {\n guiData.cursorSpeed = speed;\n}" ]
[ "0.7157912", "0.7022486", "0.7008835", "0.69932204", "0.69932204", "0.69932204", "0.69932204", "0.69932204", "0.6932238", "0.66575783", "0.6471192", "0.6457088", "0.6453484", "0.6439646", "0.6439646", "0.6439646", "0.6439646", "0.6439646", "0.6437958", "0.6437958", "0.6437958", "0.6437958", "0.6437958", "0.6429243", "0.6420516", "0.6411208", "0.63576484", "0.63570404", "0.6337781", "0.6288373" ]
0.7838378
0
Update the error rate.
function updateError() { var goodChars = my.current.correctInputLength var errorRate var errorRateTooltip var accuracyTooltip // Update error rate if (my.current.errorRate == Number.POSITIVE_INFINITY) { errorRate = '\u221e' } else { errorRate = Math.round(my.current.errorRate) } // Display error rate Util.setChildren(my.html.error, errorRate + '% error') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static set updateRate(value) {}", "updateLearningRate() {\n /* history must have more than 2 values */\n if (this.mseHistory.length < 2) {\n return;\n }\n /* MSE went up = bad update then devide by 2*/\n if (this.mseHistory[0] > this.mseHistory[1]) {\n this.options.learningRate /= 2;\n }\n /* MSE went down : it is right direction then multiply with 5% */\n else {\n this.options.learningRate *= 1.05\n }\n }", "function updateRate(deltaValue){\n if (Math.abs(deltaValue) > Math.abs(currentDelta)){\n // document.getElementById('rateOfChange').innerHTML=deltaValue;\n currentDelta = (delta) % deltaLimit;\n }\n }", "function updateTrendValue() {\n\t if (!$scope.trendMap) return;\n\t var av = $scope.aggregateValueAsXrp;\n\t for (var cur in $scope.trendMap) {if ($scope.trendMap.hasOwnProperty(cur)){\n\t var rate = ($scope.exchangeRates[cur] || 0);\n\t var sbAsXrp = $scope.trendMap[cur] * rate;\n\t av -= sbAsXrp;\n\t }}\n\t $scope.trendValueAsPercentage = ($scope.aggregateValueAsXrp - av) / av;\n\t }", "static get updateRate() {}", "function setError(reset) {\n\terror *= ramp;\n\tif (reset) error = 0.25;\n\tif (Math.random() < 0.5) error *= -1;\n}", "updateGrowthRate() {\n // TODO\n return 0;\n }", "function setReconnectionTimeIncreasingRate(value) {\n if (!Number.isFinite(value) || value <= 1) {\n throw new Error(`reconnection time's increasing rate must be greater than 1.0.`);\n }\n reconnectionTimeIncreasingRate = value;\n}", "function changeRate () {\n var usValue = allRates[currentBank][rateType];\n if (usValue == 0) usValue = 1;\n currentRate = mainCurrency == 'us' ? usValue: 1.0 / usValue;\n}", "function updatePrice(rate, quantity) {\n totalPrice += rate * quantity;\n console.log(totalPrice);\n updateDomPrice();\n }", "function updateSrcValue() {\n destAmount = document.getElementById('dest-amount').value\n srcAmount = destAmount * (1 / (expectedRate / (10 ** 18)));\n displaySrcAmount();\n}", "updateTotalScore() {\n this.score =\n this.calculatedRedScore +\n this.calculatedYellowScore +\n this.calculatedGreenScore +\n this.calculatedBlueScore -\n this.penaltyScore;\n this.displayCurrentScore();\n }", "function setError(err) {\n _error = err;\n component.forceUpdate();\n }", "UpdateMetrics() {\n }", "function setRate(tx){\n if (!tx.rate){\n // try to get rate from btcavg or from event as fallback\n try {\n tx['rate'] = btcavgLookup(tx.date);\n } catch(e) {\n throw Error('No rate given: '+JSON.stringify(tx));\n }\n }\n }", "function updateHitrate()\n{\n\tvar s1 = collect(makeProperJson(vdata[0]),['VBE'],undefined);\n\tvar tmp = [10, 100, 1000];\t\n\tfor (x in tmp ) {\n\t\ta = tmp[x];\n\t\tvar origa = a;\n\t\tif (vdatap.length-1 < a) {\n\t\t\ta = vdatap.length-1;\n\t\t}\n\t\tproper = makeProperJson(vdata[a]);\n\t\ts2 = collect(proper,['VBE'],undefined);\n\t\tstorage = collect(proper,['SMA','SMF'],'Transient');\n\t\thitrate[origa].d = a;\n\t\thitrate[origa].h = ((vdatap[0]['cache_hit'] - vdatap[a]['cache_hit']) / (vdatap[0]['client_req'] - vdatap[a]['client_req'])).toFixed(5);\n\t\thitrate[origa].b = (s1['beresp_hdrbytes'] + s1['beresp_bodybytes'] - \n\t\t\t\t s2['beresp_hdrbytes'] - s2['beresp_bodybytes']) / a;\n\t\thitrate[origa].f = (vdatap[0]['s_resp_hdrbytes'] + vdatap[0]['s_resp_bodybytes']\n\t\t\t\t- (vdatap[a]['s_resp_hdrbytes'] + vdatap[a]['s_resp_bodybytes']))/a;\n\t\tdocument.getElementById(\"hitrate\" + origa + \"d\").textContent = hitrate[origa].d;\n\t\tdocument.getElementById(\"hitrate\" + origa + \"v\").textContent = (hitrate[origa].h*100).toFixed(3) + \"%\";\n\t\tdocument.getElementById(\"bw\" + origa + \"v\").textContent = toHuman(hitrate[origa].b) + \"B/s\";\n\t\tdocument.getElementById(\"fbw\" + origa + \"v\").textContent = toHuman(hitrate[origa].f) + \"B/s\";\n\t\t\n\t\tdocument.getElementById(\"storage\" + origa + \"v\").textContent = toHuman(storage['g_bytes']);\n\n\t}\n\tdocument.getElementById(\"MAIN.uptime-1\").textContent = secToDiff(vdatap[0]['uptime']);\n\tdocument.getElementById(\"MGT.uptime-1\").textContent = secToDiff(vdatap[0]['MGT.uptime']);\n}", "function setError(error) {\n _error = \"(\" + _counter + \") \" + ioHelper.normalizeError(error);\n _counter++;\n _msg = \"\";\n component.forceUpdate();\n }", "function updateDifference() {\n // Adjust the base estimate vs adjusted estimate difference\n $scope.adjustedPercentage = (($scope.selectedEstimate - $scope.baseEstimate) / $scope.baseEstimate) * 100;\n }", "function setRate(\r\n rate_)\r\n {\r\n\t\tif(rate!=rate_){//允许任意设置\r\n\t\t\trate = rate_;\r\n\t\t\toldRatePosition = 0;\r\n\t\t\tnewRatePosition = 0;\r\n\t\t}\r\n }", "function updateElectricRate($scope,http,device,updateSurplus) {\n // Dates:\n var nowSeconds = Math.round(Date.now() / 1000);\n var minuteAgoSeconds = nowSeconds - 60;\n http.get(sodecUrl('events-in-range',\n [{p:'measurement',v:'electric_power'},\n {p:'device',v:device},\n {p:'start',v:minuteAgoSeconds},\n {p:'end',v:nowSeconds}]))\n .then(function(result){\n var events = result.data;\n if (events.length < 2){\n $scope.elec.rate[device] = false;\n } else {\n // in watt-seconds:\n var readingDiff = events[events.length - 1].r\n - events[events.length - 2].r;\n // in seconds:\n var timeDiff = (events[events.length -1].t\n - events[events.length - 2].t) / 1000;\n var watts = readingDiff / timeDiff;\n $scope.elec.rate[device] = {val:watts / 1000};\n if (updateSurplus){\n updateElectricSurplus($scope,'rate');\n }\n updateMissingPower($scope,'rate');\n }\n });\n }", "function changeRates() {\n for (const rate in rates) {\n min % 2 === 0 ? (rates[rate] -= 0.0001) : (rates[rate] += 0.0001);\n rates[rate] = parseFloat(rates[rate].toFixed(4));\n if (counter === 12) {\n min++;\n counter = 0;\n }\n }\n\n if (min === 5) {\n clearInterval(window.interval);\n }\n setState({ rates });\n changeBackground();\n }", "updateR() {\n if (this.lastRUpdate==0 || globalUpdateCount - this.lastRUpdate >= DAY_LENGTH) {\n let pts = this.fields.map(f => f.pts).reduce((acc, pts) => acc.concat(pts), [])\n pts.push(...this.sender.objs.map(o => o.point))\n \n let nInfectious = 0\n const val = pts\n .map(pt => {\n if (pt.isInfectious()) {\n nInfectious += 1\n const timeInfectious = globalUpdateCount - pt.lastStatusUpdate + (pt.status == Point.INFECTIOUS2) ? Point.infectious1Interval : 0\n if (timeInfectious>0) {\n const timeRemaining = Point.infectious2Interval + Point.infectious1Interval - timeInfectious\n return pt.nInfected/timeInfectious*timeRemaining // estimated infections over duration of illness\n } else return 0\n } else return 0\n })\n .reduce((sum, ei) => sum + ei)\n \n if (nInfectious>0) {\n this.rVal = val/nInfectious\n this.rMax = this.rMax < this.rVal ? this.rVal : this.rMax\n } else this.rVal = 0\n this.lastRUpdate = globalUpdateCount\n }\n }", "markGood() {\n this.usageCount += 1;\n\n if (this.errorScore > 0) {\n this.errorScore -= this.errorScoreDecrement;\n }\n }", "function updateTruckCost() {\n // Recalculate the truck cost estimate\n $scope.truckCost = $scope.baseEstimate * $scope.truckCostIncrements[$scope.truckCostIndex];\n }", "function updateExpPercentage(){\n let percentages = budget.getPercentages();\n ui.displayPercentage(percentages);\n }", "function handleRatingUpdate(event, currentRating, addedRating, totalRatings){\n event.preventDefault();\n var newTotalRatings = totalRatings + 1\n var updatedRating = (currentRating * totalRatings) / newTotalRatings;\n \n\n var updatedRatingInfo = {\n rating : updatedRating,\n totalRatings : newTotalRatings\n }\n \n updateRating(updatedRatingInfo);\n \n }", "function updateBandwidth() {\n let bandwidthCoeff = bandwidthCtl.getValue() >=1 ? bandwidthCtl.getValue()/10: 1;\n bandwidth[0].value = bandwidthCoeff * 0.5;\n bandwidth[1].value = bandwidthCoeff * 4;\n bandwidthLabel.setHTML(`bandwidth: ${bandwidthCoeff}px`);\n }", "function updateErrHandler(error, result) {\n\tif (error) {\n\t\tlog(\"cannot update data\")\n\t\tthrow error\n\t} else {\n\t\tlog(\"Update Success\") \n\t}\n}", "checkRateUpdate(){\n const dateUpdate = this.state.dateUpdate;\n \n if(typeof dateUpdate === \"number\"){\n const timeSinceLastUpdate = new Date() - dateUpdate;\n const timeMaxWithOutUpdate = 21600000 // 6h = 6 * 60 * 60 * 1000 = 21600000\n\n if (timeSinceLastUpdate > timeMaxWithOutUpdate)\n this.getTheRates();\n }\n }", "updateRadiusStep() {\n\n\t\tconst r = this.r / this.samples;\n\t\tthis.uniforms.get(\"radiusStep\").value.set(r, r).divide(this.resolution);\n\n\t}" ]
[ "0.68976146", "0.6777766", "0.612367", "0.59151495", "0.590682", "0.5859789", "0.57602364", "0.56785697", "0.5597232", "0.55769384", "0.55600226", "0.548091", "0.54773706", "0.5463604", "0.5435289", "0.5433369", "0.5412823", "0.5403989", "0.53394127", "0.5322566", "0.53169334", "0.5304287", "0.5291295", "0.5285533", "0.52803606", "0.5271445", "0.52682203", "0.52477145", "0.5202698", "0.5199739" ]
0.7552104
0
Update the smiley to reflect the user's performance.
function updateSmiley() { var errorRate = Math.round(my.current.errorRate) var smiley if (errorRate == 0) { if (my.current.wpm >= 40) { smiley = my.SMILEY.VERY_HAPPY } else { smiley = my.SMILEY.HAPPY } } else if (errorRate > 0 && errorRate <= 2) { smiley = my.SMILEY.UNHAPPY } else { smiley = my.SMILEY.SAD } Util.setChildren(my.html.smiley, smiley) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateEmoji(){\r\n if(this.rating < .2){\r\n this.emoji = \"media/verysad.png\"; \r\n }\r\n else if(this.rating < .4){\r\n this.emoji = \"media/sad.png\"; \r\n }\r\n else if(this.rating < .6){\r\n this.emoji = \"media/neutral.png\"; \r\n }\r\n else if(this.rating < .8){\r\n this.emoji = \"media/happy.webp\"; \r\n }\r\n else{\r\n this.emoji = \"media/veryhappy.png\"; \r\n }\r\n }", "updateUI() {\n this.scoreText.setText(`Score ${this.bumperPoint}`);\n\n const emojis = [];\n for (let i = 0; i < this.healthPoint; i++) {\n emojis.push('❤');\n }\n let healthHearts = emojis.join().replace(/\\,/g, ' ');\n this.healthText.setText(`Health ${healthHearts}`);\n }", "function update() {\r\n\r\n // update game\r\n game.update();\r\n\r\n // toggle tower clickable depending on the user's money\r\n updateTowerStore();\r\n\r\n let { type, lives, money, level, difficulty } = game.getLevelStats();\r\n\r\n // update lives and money based on game stats \r\n livesLabel.innerHTML = 'Lives: ' + lives;\r\n moneyLabel.innerHTML = '$' + money;\r\n levelLabel.innerHTML = 'Level: ' + level; \r\n difficultyLabel.innerHTML = 'difficulty: ' + difficulty;\r\n nextLevelLabel.innerHTML = '';\r\n\r\n if (type) nextLevelLabel.appendChild(ENEMY_IMAGES[type]);\r\n else nextLevelLabel.style.display = 'none';\r\n\r\n // increase flashing transparency\r\n flashingTransparency = flashingTransparency + .2;\r\n}", "function updateIcon(duration, currentTime) {\r\n\r\n\tduration = formatTime(duration, false)\r\n\tcurrentTime = formatTime(currentTime)\r\n\r\n\tvar height = 32\r\n\tvar width = 32\r\n\r\n\tvar c = document.createElement(\"canvas\")\r\n\tc.height = height\r\n\tc.width = width\r\n\r\n\tvar newIcon = c.getContext(\"2d\")\r\n\tnewIcon.font = \"15px Arial\"\r\n\tnewIcon.textAlign = \"center\"\r\n\tnewIcon.fillStyle = \"#\" + getTextColor() // \"rgb(180,0,0)\"\r\n\r\n\tnewIcon.fillText(currentTime, width/2, 12)\r\n\tnewIcon.fillText(duration, width/2, 31)\r\n\r\n\t// Draw horizontal line\r\n\tnewIcon.beginPath()\r\n\tnewIcon.lineWidth = 0\r\n\tnewIcon.strokeStyle = \"#\" + getTextColor() // \"rgb(100,0,0)\"; //\r\n\tnewIcon.moveTo(0, height/2)\r\n\tnewIcon.lineTo(width, height/2)\r\n\tnewIcon.stroke()\r\n\r\n\tchrome.browserAction.setIcon({imageData: newIcon.getImageData(0, 0, width, height)})\r\n\r\n}", "function updateHighScore() {\n if (isIdleMode) {\n highScoreElement.textContent = `Idle High Score: ${highScoreIdle}`;\n } else {\n highScoreElement.textContent = `Speedrun High Score: ${highScoreSpeedrun}`;\n }\n}", "function updateHighScore() {\n if (isIdleMode) {\n highScoreElement.textContent = `Idle High Score: ${highScoreIdle}`;\n } else {\n highScoreElement.textContent = `Speedrun High Score: ${highScoreSpeedrun}`;\n }\n}", "function updateSpeed()\n {\n // WPM and CPM does not need to be calculated on error\n if (my.current.state == my.STATE.ERROR) {\n return\n }\n\n var goodChars = my.current.correctInputLength\n\n // Determine the time elapsed since the user began typing\n var currentTime = new Date().getTime()\n var timeElapsed = currentTime - my.current.startTime\n my.current.timeElapsed = timeElapsed\n\n // Calculate WPM and CPM\n var wpm\n if (timeElapsed == 0) {\n wpm = goodChars == 0 ? 0 : '\\u221e'\n } else {\n wpm = Math.round(60000 * goodChars / 5 / timeElapsed)\n my.current.wpm = wpm\n my.current.cpm = Math.round(60000 * goodChars / timeElapsed)\n }\n\n // Display WPM\n Util.setChildren(my.html.speed, wpm + ' wpm')\n }", "function smiley(){\n vm.input = vm.input.concat(\"😁\");\n }", "function updateBlacksmith(){\n\t$(\"#bsmRandomWeaponCostText\").html(bsmRandomWeaponCost);\n\t$(\"#bsmStrengthenPercentText\").html(bsmStrengthenPercent);\n\t$(\"#bsmStrengthenCostText\").html(bsmStrengthenCost);\n\t$(\"#bsmStrengthenBladePercentText\").html(bsmStrengthenBladeBonus);\n\t$(\"#bsmStrengthenHiltPercentText\").html(bsmStrengthenHiltBonus);\n\t$(\"#bsmStrengthenPointPercentText\").html(bsmStrengthenPointBonus);\n\tupdateBlacksmithButtons();\n}", "function updateHPDisplay() {\n\t// Update the HP label\n\tvar temp = document.getElementById('currentHP');\n\ttemp.innerHTML = parseInt(displayedHP + 0.5);\n\n\t// Update the HP width\n\thpBoxCurrent.style.width = displayedHP / maxHP * 100 + '%';\n\n\t// Update the HP color\n\thpUpdateColor();\n}", "function updateSinglePlayerStatScreen(currTurn){\n console.log(\"updateSinglePlayerStatScreen\");\n singleGraphics.clear();\n //only redraw the health bar if we're on the single player stat screen\n if(!statScreen.ShowAll){\n updateSinglePlayerHealthBar(currTurn);\n }\n\n // update each Attribute String with data from the queue, and randomly switch each string to be \n // red (#ff0000) or green (#00ff00)\n // in the finished version the green or red will depend on a buff or debuff\n var characterArray = convertTurnToPlayerArray(currTurn); \n for(var attrStr in statScreen.SinglePlayer.AttributeStrings){\n if(statScreen.SinglePlayer.AttributeStrings.hasOwnProperty(attrStr)){\n //the attribute string with appropiate spacing if necessary\n //\"MovementSpeed\" --> \"Movement Speed\"\n var spacedAttrStr = attrStr;\n switch(attrStr){\n case \"MovementSpeed\":\n spacedAttrStr = \"Movement Speed\"\n break;\n case \"SpellPower\":\n spacedAttrStr = \"Spell Power\"\n break;\n default:\n break;\n }\n statScreen.SinglePlayer.AttributeStrings[attrStr]\n .setText(spacedAttrStr + \": \" + characterArray[statScreen.SinglePlayer.PlayerIndex].Attributes[attrStr]);\n statScreen.SinglePlayer.AttributeStrings[attrStr].setStyle({\n font: \"3em Arial\", \n fill: chooseColor(currTurn, statScreen.SinglePlayer.PlayerIndex, attrStr),\n });\n }\n }\n\n}", "function updateStats() {\n $(\"#fighterhealth\").text(\"HP:\\xa0\" + fighterHP);\n $(\"#defenderhealth\").text(\"HP:\\xa0\" + defenderHP);\n }", "function update() {\n document.getElementById('cheese-Count').innerText = cheese.toString();\n drawPerClickStat();\n}", "function updateStats() {\n var htmlString = \"\";\n htmlString += (\"<h1>\" + character.name + \"</h1>\");\n htmlString += (\"<h2 id='level'>Level \" + character.lvl + \"</h2>\");\n htmlString += (\"<p id='hp'>HP: \" + character.hp + \"/\" + character.maxhp + \"</p>\");\n htmlString += (\"<p id='xp'>XP: \" + character.xp + \"/\" + (character.lvl*character.lvl*150) + \"</p>\");\n htmlString += (\"<p id='energy'>Energy: \" + character.energy + \"/\" + character.maxenergy + \"</p>\");\n $('#stats').css('overflow-y', 'hidden');\n $('#stats').html(htmlString);\n }", "function updateHighScoreMC() {\r\n $('#mcGames h4 span span').html(highScoreMC);\r\n }", "updateGameSpeed() {\n const score = document.getElementById('score');\n const formattedScore = parseInt(score.innerHTML);\n if (formattedScore % 5 === 0 && this.speed > 100) {\n this.endGameTick();\n this.speed = this.speed - 100;\n this.startGameTick();\n }\n }", "function updateSkills(){\n\tvar skillName;\n\tvar mod = parseInt($('#charProficiency').val());\n\tvar stat; \n\n\tif(saved.getItem('skillBonus') != null)\n\t\tvar skillName = saved.getItem('skillBonus').split(':');\n\n\n\tfor(var i = 0;i < skillBonus.length;++i){\n\t\tstat = parseInt(saved.getItem(skillName[i]));\n\n\t\t// If user has not entered in a stat value\n\t\tif(isNaN(stat))\n\t\t\tstat = 0;\n\n\t\t$('#'+skillBonus[i]).val(stat + mod);\n\t}\n}", "function updateGameStats(score, size, speed) {\n document.getElementById('score').innerText = score;\n document.getElementById('size').innerText = size;\n document.getElementById('speed').innerText = speed.toFixed(2) + ' blocks/sec';\n}", "_updateScore() {\n\t\tthis._$scoreBoard.textContent= this._score+'';\n\t}", "update() {\n this.character.update();\n }", "_updateScore () {\n this._scoreBoard.innerHTML = this._score;\n }", "updateScore() {\n ctx.font = \"30px Verdana\";\n ctx.fillStyle = \"white\";\n ctx.fillText(`Kills:`, 90, 70);\n ctx.drawImage(zombieDieingImages[3], 160, 0, 80, 80);\n ctx.fillText(`x${this.score}`, 230, 70);\n }", "function smiley(icon) {\n comment = document.getElementById(\"comment\");\n\ticon = ' ' + icon + ' ';\n\tinsertAtCursor(comment, icon); // Added by Hiro\n\t//comment.value += icon; // Commented out by Hiro\n}", "updateBadge() {\n var numberOfUnwatchedLessons = this.lessons.filter(lesson => {\n return lesson.watched == false;\n }).length;\n\n Chrome.changeBadgeValue(numberOfUnwatchedLessons.toString());\n }", "function react () {\n lastInput = clock.getElapsedTime()\n intensity += 0.0008\n if (intensity > 0.005) { intensity = 0.005 }\n}", "function updateScore(value) {\n gState.score += value;\n document.querySelector('header > h3 > span').innerText = gState.score;\n displayVictory();\n}", "function stopwatchUpdate() {\r\n rawTime += intervalRate;\r\n stopwatchTime.innerHTML = formatTime(rawTime);\r\n}", "UpdateMetrics() {\n }", "function updateEnemyStats() {\n\t\t$(\"#enemyHealth\").html(\"HP: \" + enemyPicked.health + \"<br />Attack: \" + enemyPicked.attack);\n\t\t$(\"#enemyName\").html(enemyPicked.display);\n\t}", "function changeSword() {\n if (sword==0) {\n $('#swords').css({filter:'grayscale(0%)'});\n sword++;\n }\n else if (sword==1) {\n $('#swords').attr('src', 'images/item sprites/Green Sword.png');\n sword++;\n }\n else if (sword==2) {\n $('#swords').attr('src', 'images/item sprites/Red Sword.png');\n sword++;\n }\n else if(sword==3) {\n $('#swords').attr('src', 'images/item sprites/Blue Sword.png');\n sword++;\n }\n else if (sword==4) {\n $('#swords').attr('src', 'images/item sprites/Four Sword.png');\n sword++;\n }\n else {\n $('#swords').attr('src', \"images/item sprites/Smith's Sword.png\");\n $('#swords').css({filter:'grayscale(100%)'});\n sword=0;\n }\n}" ]
[ "0.6357531", "0.6007764", "0.58803296", "0.58789414", "0.5813852", "0.5813852", "0.5776564", "0.5775895", "0.57672244", "0.5700112", "0.56986904", "0.56731766", "0.56420135", "0.5633069", "0.5606887", "0.55965483", "0.5571476", "0.5565529", "0.55529016", "0.5541287", "0.5539472", "0.5529085", "0.55222493", "0.5519005", "0.5491551", "0.54904914", "0.5477656", "0.54747933", "0.54702455", "0.5465039" ]
0.78108287
0
Clear the tooltips in the result pane.
function clearResultTooltips() { my.html.speed.title = '' my.html.error.title = '' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clear_tooltip() {\n\t$(\"#tooltip_container\").empty()\n\t$(\"#tooltip_container\").hide()\n}", "function hideTooltips() {\n\t\t\t\t\ttooltipObject.remove();\n\t\t\t\t}", "removeAllTooltips() {\n if (!this.activeToolTips?.length) {\n return;\n }\n for (let i = this.activeToolTips.length - 1; i > -1; i--) {\n this.activeToolTips[i].destroy();\n this.activeToolTips.splice(i, 1);\n }\n }", "clearTip() {\n if (this.tip) {\n this.tip.remove();\n }\n }", "function removeTooltips() {\r\n\t$('.tooltip').remove();\r\n}", "remove() { this.tooltip.remove(); this.element.remove(); }", "function hideToolTip(d, i) {\n tooltip.style({\n \"height\": 0,\n \"width\": 0,\n \"opacity\": 0\n }).html(\"\");\n }", "function hideTooltips() {\n\t\tif (tooltips_element) {\n\t\t\ttooltips_element.style.display = 'none';\n\t\t}\n\t}", "clearOptions(){\n let element = p5Instance.select(`#div_${this.id}`);\n if(element){\n element.remove();\n this.command.context.chain.strokeWeight(1);\n }\n\n //clear tips div\n let tipDiv = document.getElementById(`tip_${this.id}`);\n if(tipDiv){\n tipDiv.remove();\n }\n }", "function removeTooltip() {\t\t\t\r\n\t\t\t$('.popover').each(function() { $(this).remove(); });\r\n\t\t\treturn;\r\n\r\n\t\t}//end function removeTooltip ", "function clearMarkers() {\r\n\t\t\tif (_markers && _markers.length > 0) {\r\n\t\t\t\tfor (var i = 0; i < _markers.length; i++) {\r\n\t\t\t\t\tvar currMarker = _markers[i];\r\n\t\t\t\t\tcurrMarker.tooltip = null;\r\n\t\t\t\t\tcurrMarker.setMap(null);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t_markers = [];\r\n\r\n\t\t} // clearMarkers", "reset () {\n this.displayPlot(null)\n this.displayStatistics(null, null)\n this.displayLog(null)\n this.displayError(null)\n this.results = new Map()\n }", "function clearResults() {\n selectedPoints = [];\n Map.layers().remove(Map.layers().get(2));\n var instructionsLabel = ui.Label('Select regions to compare population.');\n resultsPanel.widgets().reset([instructionsLabel]);\n}", "function quitarToolTipASelects() {\n $('.categoria_id, .talle_id, .proveedor_id, .genero').tooltip({\n disabled: true\n });\n }", "function reset() {\n $('#locator-loader').show();\n $('.sidebar-js-button').removeClass('active');\n $('.result-body').hide();\n $('.legend-inner-container').hide();\n $('.legend-body').html('');\n $('#result-list').html('');\n $('.result-dropdown select').html('');\n }", "function removeElements() {\n d3.selectAll('.svg-tooltip').remove();\n d3.selectAll('.y-axis').remove();\n d3.selectAll('.tooltip-container').remove();\n d3.selectAll('.title-container').remove();\n console.log('removed elements');\n }", "function clear() {\n contentVeil.reset();\n contentVeil.hide();\n removePreviewLegend();\n unwrapInterestingRange();\n }", "function removeTocTooltip(){\r\n $(\"#wh_publication_toc>.wh-tooltip-wrapper\").remove();\r\n }", "clear() {\n Array.prototype.forEach.call(this._el, function(profile) {\n profile.innerHTML = '';\n });\n }", "destroy() {\n //removing all qtip from DOM\n $('[id^=\"qtip\"]').remove();\n }", "function removeTooltip() {\n //Hide the tooltip\n $('.popover').each(function() {\n $(this).remove();\n }); \n}//function removeTooltip", "function removeToolTip() {\n preventTooltipHiding = !preventTooltipHiding;\n if (!preventTooltipHiding) {\n if (toolTipText == \"\") {\n hideToolTip();\n } else {\n showToolTip(toolTipText);\n preventTooltipHiding = !preventTooltipHiding;\n }\n }\n}", "function removeTooltip() { \n element.removeAttribute( ariaDescribedBy )\n ops.container.removeChild( tooltip )\n timer = null\n }", "function clearTip() {\n amount.value = \"\";\n percentage.value = \"\";\n numPeople.value = \"\"\n output.textContent = \"\";\n}", "function hideTooltip() {\n tt.style('opacity', 0.0);\n }", "function hide() {\n if (tooltip) {\n tooltip.parentNode.removeChild(tooltip);\n tooltip = null;\n }\n }", "function hideTooltip() {\n tt.style('opacity', 0.0);\n }", "function hideTooltip() {\n tt.style('opacity', 0.0);\n }", "function hideTooltip() {\n tt.style('opacity', 0.0);\n }", "function hideTooltip() {\n tt.style('opacity', 0.0);\n }" ]
[ "0.72888374", "0.7272986", "0.71922415", "0.70528156", "0.7044061", "0.6836587", "0.6780974", "0.6755042", "0.67468494", "0.6684047", "0.6585681", "0.65823495", "0.6580139", "0.6493192", "0.6448353", "0.6445565", "0.6445071", "0.6443478", "0.64297915", "0.6418842", "0.6394975", "0.6381378", "0.6372761", "0.6366909", "0.6342811", "0.63369536", "0.63352585", "0.63048494", "0.63048494", "0.63048494" ]
0.8378526
0
Set the tooltips in the result pane.
function setResultTooltips() { var textLength = my.current.subunitText.length var charNoun = textLength == 1 ? 'character' : 'characters' // Speed tooltip my.html.speed.title = 'You have typed ' + textLength + ' ' + charNoun + ' in\n' + Util.prettyTime(my.current.timeElapsed) + '.\n\n' + 'Your typing speed is\n' + my.current.wpm + ' words per minute, or\n' + my.current.cpm + ' characters per minute.' // Error rate tooltip var errorRateTooltip var accuracyTooltip // Update error rate if (my.current.errorRate == Number.POSITIVE_INFINITY) { errorRateTooltip = '\u221e' accuracyTooltip = 0 } else { errorRateTooltip = parseFloat(my.current.errorRate.toFixed(1)) accuracyTooltip = 100 - errorRateTooltip } var errorNoun = my.current.errors == 1 ? 'error' : 'errors' var title = 'You have typed ' + textLength + ' ' + charNoun + '.\n' + 'You have made ' + my.current.errors + ' ' + errorNoun + '.\n' + 'Your error rate is ' + errorRateTooltip + '%.\n' + 'Your accuracy is ' + accuracyTooltip + '%.\n' my.html.error.title = title }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_addTooltips() {\n $(this.el.querySelectorAll('[title]')).tooltip({\n delay: { show: 500, hide: 0 }\n });\n }", "set tooltip(value) {}", "function initializeTooltips() {\n // Download document link\n $('.download-document').tooltip({\n 'show': true,\n 'placement': 'top',\n 'title': \"Download the document\"\n });\n\n // Delete document link\n $('.delete-document').tooltip({\n 'show': true,\n 'placement': 'top',\n 'title': \"Delete the document\"\n });\n\n // Upload document link\n $('.upload-document').tooltip({\n 'show': true,\n 'placement': 'top',\n 'title': \"Upload document\"\n });\n\n // Create new folder link\n $('.create-folder').tooltip({\n 'show': true,\n 'placement': 'top',\n 'title': \"Create new folder\"\n });\n}", "function setupTooltips() {\n var elements = getAllElementsWithAttribute(\"tooltip\");\n elements.forEach(function(element) {\n attachTooltip(element);\n });\n}", "function clearResultTooltips()\n {\n my.html.speed.title = ''\n my.html.error.title = ''\n }", "function updateTooltips() {\n jQuery('.tooltip').tooltip({showURL: false });\n}", "set Tooltip(value) {\n this._tooltip = value;\n }", "function tooltips() {\n removeTooltips();\n\n // Tooltips are added with options.tooltips in original order.\n scope_Tooltips = scope_Handles.map(addTooltip);\n\n bindEvent(\"update.tooltips\", function(values, handleNumber, unencoded) {\n if (!scope_Tooltips[handleNumber]) {\n return;\n }\n\n var formattedValue = values[handleNumber];\n\n if (options.tooltips[handleNumber] !== true) {\n formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n }\n\n scope_Tooltips[handleNumber].innerHTML = formattedValue;\n });\n }", "function tooltips() {\n removeTooltips();\n\n // Tooltips are added with options.tooltips in original order.\n scope_Tooltips = scope_Handles.map(addTooltip);\n\n bindEvent(\"update.tooltips\", function(values, handleNumber, unencoded) {\n if (!scope_Tooltips[handleNumber]) {\n return;\n }\n\n var formattedValue = values[handleNumber];\n\n if (options.tooltips[handleNumber] !== true) {\n formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n }\n\n scope_Tooltips[handleNumber].innerHTML = formattedValue;\n });\n }", "function tooltips() {\n removeTooltips();\n\n // Tooltips are added with options.tooltips in original order.\n scope_Tooltips = scope_Handles.map(addTooltip);\n\n bindEvent(\"update.tooltips\", function(values, handleNumber, unencoded) {\n if (!scope_Tooltips[handleNumber]) {\n return;\n }\n\n var formattedValue = values[handleNumber];\n\n if (options.tooltips[handleNumber] !== true) {\n formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n }\n\n scope_Tooltips[handleNumber].innerHTML = formattedValue;\n });\n }", "function tooltips() {\n removeTooltips();\n\n // Tooltips are added with options.tooltips in original order.\n scope_Tooltips = scope_Handles.map(addTooltip);\n\n bindEvent(\"update.tooltips\", function(values, handleNumber, unencoded) {\n if (!scope_Tooltips[handleNumber]) {\n return;\n }\n\n var formattedValue = values[handleNumber];\n\n if (options.tooltips[handleNumber] !== true) {\n formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n }\n\n scope_Tooltips[handleNumber].innerHTML = formattedValue;\n });\n }", "function initInstanceInfoTooltip() {\n jQuery('#instance-tooltip').tooltip();\n}", "function init() {\n setUpToolTip();\n}", "function setTooltips()\r\n{\r\n $(function()\r\n {\r\n if ($(\".tooltip\").length > 0)\r\n {\r\n $(\".tooltip\").tooltip({showURL: false});\r\n }\r\n });\r\n}", "function setupBootstrapTooltips() {\n\t$('[data-toggle=\"tooltip\"], .conceptPoint, #recommendSection .panel-heading, .btn-info').tooltip({\n\t\tcontainer: 'body',\n\t\thtml: true\n\t});\n}", "function tooltips() {\n removeTooltips();\n // Tooltips are added with options.tooltips in original order.\n scope_Tooltips = scope_Handles.map(addTooltip);\n bindEvent(\"update\" + INTERNAL_EVENT_NS.tooltips, function (values, handleNumber, unencoded) {\n if (!scope_Tooltips || !options.tooltips) {\n return;\n }\n if (scope_Tooltips[handleNumber] === false) {\n return;\n }\n var formattedValue = values[handleNumber];\n if (options.tooltips[handleNumber] !== true) {\n formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n }\n scope_Tooltips[handleNumber].innerHTML = formattedValue;\n });\n }", "function tooltips() {\n\n // Tooltips are added with options.tooltips in original order.\n var tips = scope_Handles.map(addTooltip);\n\n bindEvent('update', function (values, handleNumber, unencoded) {\n\n if (!tips[handleNumber]) {\n return;\n }\n\n var formattedValue = values[handleNumber];\n\n if (options.tooltips[handleNumber] !== true) {\n formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n }\n\n tips[handleNumber].innerHTML = formattedValue;\n });\n }", "function loadTooltips() {\n $('.hover-tooltip').tooltip({\n title: hoverGetData,\n html: true,\n container: 'body',\n placement: 'left',\n delay: {\n \"show\": 100,\n \"hide\": 1500\n }\n });\n}", "function tooltips ( ) {\r\n\r\n\t\t// Tooltips are added with options.tooltips in original order.\r\n\t\tvar tips = scope_Handles.map(addTooltip);\r\n\r\n\t\tbindEvent('update', function(values, handleNumber, unencoded) {\r\n\r\n\t\t\tif ( !tips[handleNumber] ) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar formattedValue = values[handleNumber];\r\n\r\n\t\t\tif ( options.tooltips[handleNumber] !== true ) {\r\n\t\t\t\tformattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\r\n\t\t\t}\r\n\r\n\t\t\ttips[handleNumber].innerHTML = formattedValue;\r\n\t\t});\r\n\t}", "function tooltips ( ) {\n\n\t\t// Tooltips are added with options.tooltips in original order.\n\t\tvar tips = scope_Handles.map(addTooltip);\n\n\t\tbindEvent('update', function(values, handleNumber, unencoded) {\n\n\t\t\tif ( !tips[handleNumber] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar formattedValue = values[handleNumber];\n\n\t\t\tif ( options.tooltips[handleNumber] !== true ) {\n\t\t\t\tformattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n\t\t\t}\n\n\t\t\ttips[handleNumber].innerHTML = formattedValue;\n\t\t});\n\t}", "function tooltips ( ) {\n\n\t\t// Tooltips are added with options.tooltips in original order.\n\t\tvar tips = scope_Handles.map(addTooltip);\n\n\t\tbindEvent('update', function(values, handleNumber, unencoded) {\n\n\t\t\tif ( !tips[handleNumber] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar formattedValue = values[handleNumber];\n\n\t\t\tif ( options.tooltips[handleNumber] !== true ) {\n\t\t\t\tformattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n\t\t\t}\n\n\t\t\ttips[handleNumber].innerHTML = formattedValue;\n\t\t});\n\t}", "function tooltips ( ) {\n\n\t\t// Tooltips are added with options.tooltips in original order.\n\t\tvar tips = scope_Handles.map(addTooltip);\n\n\t\tbindEvent('update', function(values, handleNumber, unencoded) {\n\n\t\t\tif ( !tips[handleNumber] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar formattedValue = values[handleNumber];\n\n\t\t\tif ( options.tooltips[handleNumber] !== true ) {\n\t\t\t\tformattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n\t\t\t}\n\n\t\t\ttips[handleNumber].innerHTML = formattedValue;\n\t\t});\n\t}", "function tooltips ( ) {\n\n\t\t// Tooltips are added with options.tooltips in original order.\n\t\tvar tips = scope_Handles.map(addTooltip);\n\n\t\tbindEvent('update', function(values, handleNumber, unencoded) {\n\n\t\t\tif ( !tips[handleNumber] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar formattedValue = values[handleNumber];\n\n\t\t\tif ( options.tooltips[handleNumber] !== true ) {\n\t\t\t\tformattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n\t\t\t}\n\n\t\t\ttips[handleNumber].innerHTML = formattedValue;\n\t\t});\n\t}", "function tooltips ( ) {\n\n\t\t// Tooltips are added with options.tooltips in original order.\n\t\tvar tips = scope_Handles.map(addTooltip);\n\n\t\tbindEvent('update', function(values, handleNumber, unencoded) {\n\n\t\t\tif ( !tips[handleNumber] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar formattedValue = values[handleNumber];\n\n\t\t\tif ( options.tooltips[handleNumber] !== true ) {\n\t\t\t\tformattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n\t\t\t}\n\n\t\t\ttips[handleNumber].innerHTML = formattedValue;\n\t\t});\n\t}", "function tooltips ( ) {\n\n\t\t// Tooltips are added with options.tooltips in original order.\n\t\tvar tips = scope_Handles.map(addTooltip);\n\n\t\tbindEvent('update', function(values, handleNumber, unencoded) {\n\n\t\t\tif ( !tips[handleNumber] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar formattedValue = values[handleNumber];\n\n\t\t\tif ( options.tooltips[handleNumber] !== true ) {\n\t\t\t\tformattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n\t\t\t}\n\n\t\t\ttips[handleNumber].innerHTML = formattedValue;\n\t\t});\n\t}", "function tooltips ( ) {\n\n\t\t// Tooltips are added with options.tooltips in original order.\n\t\tvar tips = scope_Handles.map(addTooltip);\n\n\t\tbindEvent('update', function(values, handleNumber, unencoded) {\n\n\t\t\tif ( !tips[handleNumber] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar formattedValue = values[handleNumber];\n\n\t\t\tif ( options.tooltips[handleNumber] !== true ) {\n\t\t\t\tformattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n\t\t\t}\n\n\t\t\ttips[handleNumber].innerHTML = formattedValue;\n\t\t});\n\t}", "function tooltips ( ) {\n\n\t\t// Tooltips are added with options.tooltips in original order.\n\t\tvar tips = scope_Handles.map(addTooltip);\n\n\t\tbindEvent('update', function(values, handleNumber, unencoded) {\n\n\t\t\tif ( !tips[handleNumber] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar formattedValue = values[handleNumber];\n\n\t\t\tif ( options.tooltips[handleNumber] !== true ) {\n\t\t\t\tformattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n\t\t\t}\n\n\t\t\ttips[handleNumber].innerHTML = formattedValue;\n\t\t});\n\t}", "function tooltips ( ) {\n\n\t\t// Tooltips are added with options.tooltips in original order.\n\t\tvar tips = scope_Handles.map(addTooltip);\n\n\t\tbindEvent('update', function(values, handleNumber, unencoded) {\n\n\t\t\tif ( !tips[handleNumber] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar formattedValue = values[handleNumber];\n\n\t\t\tif ( options.tooltips[handleNumber] !== true ) {\n\t\t\t\tformattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n\t\t\t}\n\n\t\t\ttips[handleNumber].innerHTML = formattedValue;\n\t\t});\n\t}", "function tooltips ( ) {\n\n\t\t// Tooltips are added with options.tooltips in original order.\n\t\tvar tips = scope_Handles.map(addTooltip);\n\n\t\tbindEvent('update', function(values, handleNumber, unencoded) {\n\n\t\t\tif ( !tips[handleNumber] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar formattedValue = values[handleNumber];\n\n\t\t\tif ( options.tooltips[handleNumber] !== true ) {\n\t\t\t\tformattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n\t\t\t}\n\n\t\t\ttips[handleNumber].innerHTML = formattedValue;\n\t\t});\n\t}", "toggleTooltips() {\n self.enableTooltips = !self.enableTooltips;\n }" ]
[ "0.7334321", "0.73147136", "0.6849508", "0.68288565", "0.67945063", "0.65687245", "0.65527654", "0.6503227", "0.6503227", "0.6503227", "0.6503227", "0.64765465", "0.6445026", "0.64272773", "0.6391714", "0.6388349", "0.63838303", "0.63723147", "0.6370157", "0.63505405", "0.63505405", "0.63505405", "0.63505405", "0.63505405", "0.63505405", "0.63505405", "0.63505405", "0.63505405", "0.63505405", "0.6347971" ]
0.753394
0
Process command entered by the user in the input textarea element when the tutor is in error state. Once the tutor enters the error state, the supported commands are searched at the end of the erroneous input. If a supported command is found at the end of the erroneous input, the command is processed. The following is a list of the supported commands: restart restart the current subunit reset same as the 'restart' command fix remove errors from the input text xxx same as the 'fix' command
function processInputCommand() { var inputText = my.html.input.value var goodChars = my.current.correctInputLength if (inputCommandIs('restart') || inputCommandIs('rst')) { location.href = '#restart' } else if (inputCommandIs('fix') || inputCommandIs('xxx')){ my.html.input.value = inputText.substring(0, goodChars) updatePracticePane() } else if (inputCommandIs('qtpi')) { qtpi() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleError(command, index, error) {\n // Record the reason for the command failure.\n if (command.func.name === 'throwError') {\n historyItem[index].status = 'Unrecognized';\n }\n else if (failHard) {\n historyItem[index].status = 'Skipped';\n }\n else {\n historyItem[index].status = 'Failed: ' + error.message;\n }\n\n // If the command was unrecognized or failed outright, log it.\n if (!failHard) {\n error.message = error.message.split('\\n').map(function(string) {\n return string = '\\t' + string;\n }).join('\\n');\n\n console.error(\"Editor command '\" + command.name\n + \"' failed with error:\\n\" + error.message);\n }\n\n // Skip remaining commands.\n failHard = true;\n }", "function editCommand() {\n \tconsole.log(\"Checking if command is valid.\");\n \tvar commandData = $(\"#editCommandData\").text().trim().toLowerCase();\n \tvar commandPoints = Number($(\"#editCommandPoints\").text());\n \tvar commandUses = Number($(\"#editCommandUses\").text());\n \tvar commandRank = document.getElementById(\"rankChoiceEdit\").value;\n \tvar repeat = document.getElementById(\"commandRepeatableChoiceEdit\").value\n\n \tcommandData = commandData.replace(new RegExp(\"^[\\!]+\"), \"\").trim();\n\n \tif (commandData.length >= 255) {\n \t//max length is 255.\n \terrorMessageCommandModal(\"The message is too long\", \"editCommandData\");\n \treturn\n \t} else if (commandData.length == 0) {\n \terrorMessageCommandModal(\"You must type a message\", \"editCommandData\");\n \treturn\n \t} else {\n \tcommandData = strip(commandData);\n \tresetMessageCommandModal(\"editCommandData\")\n \t}\n\n \tif (isNaN(commandPoints) == true) {\n \terrorMessageCommandModal(\"Points must be a number\", \"editCommandPoints\");\n \treturn\n \t} else if (Math.sign(parseFloat(commandPoints)) == -1) {\n \terrorMessageCommandModal(\"Points cannot be negative\", \"editCommandPoints\");\n \treturn\n \t} else {\n \tresetMessageCommandModal(\"editCommandPoints\")\n \t}\n\n \tif (isNaN(commandUses) == true) {\n \terrorMessageCommandModal(\"Uses must be a number\", \"editCommandUses\");\n \treturn\n \t} else if (Math.sign(parseFloat(commandUses)) == -1) {\n \terrorMessageCommandModal(\"Uses cannot be negative\", \"editCommandUses\");\n \treturn\n \t} else {\n \tresetMessageCommandModal(\"editCommandUses\")\n \t}\n\n \tif (repeat == \"false\") { repeat = false } else { repeat = true }\n\n \tconsole.log(commandData, commandPoints, commandUses, commandRank, repeat);\n \t// Adds it to the db and table\n \tCommandHandle.editCommand(commandToBeEdited, null, commandData, commandUses, commandPoints, commandRank, null, repeat); //Edit the DB\n \tCommandHandle.findCommand(commandToBeEdited).then(data => {\n \tif (data !== null) {\n \t\tvar filteredData = table //A set of functions that removes the command, adds it back, and redraws the table.\n \t.rows()\n \t.indexes()\n \t.filter(function (value, index) {\n \t\treturn table.row(value).data().commandName == commandToBeEdited;\n \t});\n \t\ttable.rows(filteredData).remove();\n \t\ttable.row.add({ commandName: commandToBeEdited, arguements: null, message: commandData, uses: commandUses, points: commandPoints, rank: commandRank });\n \t\ttable.draw();\n \t\t$(\"#modalEditCommand\").modal(\"hide\");\n \t\tdocument.getElementById(\"editModal\").innerHTML = editCommandModalEntry()\n \t}\n \t})\n\n \t// Shows an error in the modal\n \tfunction errorMessageCommandModal(message, errLocation) {\n \tvar editCommandName = document.getElementById(errLocation).parentElement;\n \tvar cmdErrorMessageEdit = document.getElementById(\"errorMessageEdit\")\n \teditCommandName.classList.add(\"errorClass\");\n \tcmdErrorMessageEdit.innerHTML = message;\n \tconsole.log(\"Command is not valid.\");\n \t}\n\n \t// Resets the errors\n \tfunction resetMessageCommandModal(toBeReset) {\n \ttry {\n \t\tdocument.getElementById(toBeReset).parentElement.classList.remove(\"errorClass\");\n \t\tdocument.getElementById(\"errorMessageEdit\").innerHTML = \"\";\n \t} catch (error) {\n \t\tconsole.log(error);\n \t}\n \t}\n}", "verifyCommandInputValidity() {\n if (this.mode == Editor.MODE_COMMAND) {\n if (this.commandInput.getContent()[0] != \":\")\n this.changeMode(Editor.MODE_GENERAL);\n }\n }", "function parseCommand(command) {\n console.log(currScene);\n // go through each action and try to run\n for (index in currScene.actions) {\n let condition = currScene.actions[index][0];\n let action = currScene.actions[index][1];\n\n if (checkCondition(command, condition)) {\n if (restart.includes(command)){\n reset_globals();\n }\n console.log(\"condition passed\");\n console.log(condition);\n console.log(\"---\");\n executeAction(action);\n return;\n }\n }\n\n // if we failed to parse execute the action Error\n narrate(`I don't know what \"${command}\" means.`);\n}", "_onCommand(e) {\n e.preventDefault();\n const command = this.commandInput.value;\n this.commandInput.value = \"\";\n // begin shout command\n if(command.startsWith(\"/shout \")) { \n const shout = command.substring(7);\n this._addMessage(`You shout \"${shout}\"`);\n } // end shout command\n\n // begin shout command\n else if(command.startsWith(\"/whisper \")) { \n const shout = command.substring(9);\n this._addMessage(`You whisper \"${shout}\"`);\n } // end shout command \n\n // begin logoff command \n else if (command.startsWith(\"/logoff\")) { \n this._onLogOut(); \n } // end logoff command\n\n // begin search command\n else if (command.startsWith(\"/search\")) {\n this._search();\n } // end search command \n\n // begin attack command\n else if (command.startsWith(\"/attack\")) {\n this._attack();\n } // end attack command\n\n // begin help command\n else if (command.startsWith(\"/help\")) {\n this._helpMessage();\n } // end help command\n\n // begin escape command\n else if (command.startsWith(\"/escape\"))\n {\n this._escape();\n } // end escape command\n\n // begin dam command\n else if(command.startsWith(\"/dam\")) {\n console.log(this._calculatePlayerDamage());\n } // end dam command\n\n // basic speech\n else {\n this._addMessage(`You say \"${command}\"`);\n }\n }", "function ManageErrors(commandcalledName, data) {\n selecteditem.error = Translate(\"Error\" + commandcalledName + data.error.errorCode);\n\n if (selecteditem.error.length === 0) {\n selecteditem.error = data.error.errorMessage; //to translate --> The Cannot prepare an ES ticket becouse scenario step id 2 is not valid.\n }\n }", "function checkNewCommand() {\n \tconsole.log(\"Checking if command is valid.\");\n \tvar commandName = $(\"#addCommandName\").text().trim().toLowerCase();\n \tvar commandData = $(\"#addCommandData\").text().trim();\n \tvar commandPoints = Number($(\"#addCommandPoints\").text());\n \tvar commandUses = Number($(\"#addCommandUses\").text());\n \tvar repeat = document.getElementById(\"commandRepeatableChoice\").value\n \tvar commandRank = document.getElementById(\"rankChoiceAdd\").value;\n\n \tcommandName = commandName.replace(new RegExp(\"^[\\!]+\"), \"\").trim();\n \tif (commandName.length == 0 || commandName == \"!\") {\n \terrorMessageCommandModal(\"You must enter a command name!\", \"addCommandName\")\n \treturn\n \t} else {\n \tCommandHandle.findCommand(commandName).then(data => {\n \t\tif (data !== null) {\n \t\tconsole.log(\"The command \" + commandName + \" already exists\");\n \t\tdocument.getElementById(\"addCommandName\").classList.add(\"errorClass\");\n \t\tdocument.getElementById(\"errorMessageAdd\").innerHTML = \"This command already exists\";\n \t\treturn\n \t\t}\n \t})\n \t}\n \tresetMessageCommandModal(\"addCommandName\");\n\n \tif (commandData.length >= 255) {\n \t//max length is 255\n \terrorMessageCommandModal(\"This message is too long.\", \"addCommandData\");\n \treturn\n \t} else if (commandData.length == 0) {\n \terrorMessageCommandModal(\"You must type a message.\", \"addCommandData\");\n \treturn\n \t} else {\n \tcommandData = strip(commandData);\n \tresetMessageCommandModal(\"addCommandData\");\n \t}\n\n \tif (isNaN(commandPoints) == true) {\n \terrorMessageCommandModal(\"Points must be a number\", \"addCommandPoints\");\n \treturn\n \t} else if (Math.sign(parseFloat(commandPoints)) == -1) {\n \terrorMessageCommandModal(\"Cannot be negative\", \"addCommandPoints\");\n \treturn\n \t} else {\n \tresetMessageCommandModal(\"addCommandPoints\")\n \t}\n\n \tif (isNaN(commandUses) == true) {\n \terrorMessageCommandModal(\"Uses must be a number\", \"addCommandUses\");\n \treturn\n \t} else if (Math.sign(parseFloat(commandUses)) == -1) {\n \terrorMessageCommandModal(\"Cannot be negative\", \"addCommandUses\");\n \treturn\n \t} else {\n \tresetMessageCommandModal(\"addCommandUses\")\n \t}\n\n \tcommandData = commandData.replace(new RegExp(\"^[\\!]+\"), \"\").trim();\n\n \tif (repeat == \"false\") { repeat = false } else { repeat = true }\n\n \tconsole.log(commandName, commandData, commandPoints, commandUses, commandRank, null, repeat);\n \t//Adds a command to the DB\n \tCommandHandle.addCommand(commandName, null, commandData, commandUses, commandPoints, commandRank, null, repeat);\n \t//adds a row to the table with the new command info\n \taddCommandTable(commandName, commandData, commandUses, commandPoints, commandRank)\n \t$(\"#modalCart\").modal(\"hide\");\n\n \t// Shows an error in the modal\n \tfunction errorMessageCommandModal(message, errLocation) {\n \tvar addCommandName = document.getElementById(errLocation).parentElement;\n \tvar cmdErrorMessage = document.getElementById(\"errorMessageAdd\")\n \taddCommandName.classList.add(\"errorClass\");\n \tcmdErrorMessage.innerHTML = message;\n \tconsole.log(\"Command is not valid.\");\n \t}\n\n \t// resets the errors\n \tfunction resetMessageCommandModal(toBeReset) {\n \ttry {\n \t\tdocument.getElementById(toBeReset).parentElement.classList.remove(\"errorClass\");\n \t\tdocument.getElementById(\"errorMessageAdd\").innerHTML = \"\";\n \t} catch (error) {\n \t\tconsole.log(error);\n \t}\n \t}\n}", "function shellInvalidCommand()\n{\n _StdIn.putText(\"Invalid Command. \");\n if (_MCPMode)\n {\n _StdIn.putText(\"Want me to slow down your power cycles for you?\");\n }\n else\n {\n _StdIn.putText(\"Type 'help' for user designed help.\");\n }\n}", "function resolveCommands_CMD(e) {\n var cmd = e.toLowerCase();\n \n Tempus_returnString.sw_append(td.minute+' '+td.day()+' '+td.month_txt()+' : '+cmd);\n /*\n * reference to the solarwinds object\n * format the string here from data entered/returned\n * pass to solarwinds\n * solarWindsRef.sw_append('<div>ass hat. man if i were any better at this it would be sinful</div>');\n */\n\n if (!loggedIn && cmd == 'root') {\n /*\n * looking for the correct loging command \n */\n currArray++;\n loggedIn = true;\n //temp password\n } else if (loggedIn && !passwordIn && cmd == 'asshat') {\n /*\n * if the correct login has been entered has the correct pasword been entered?\n */\n currArray++;\n passwordIn = true;\n } else if (loggedIn && passwordIn) {\n /*\n * bot the correct password and login was entered and stored so\n * we are ready to proceed\n */\n\n if (cmd == 'en') {\n switch (currArray) {\n case 2:\n currArray++;\n break;\n case 14:\n currArray++;\n break;\n case 32:\n currArray++;\n break;\n case 34:\n currArray++;\n break;\n case 36:\n currArray++;\n break;\n }\n\n }\n\n else if (cmd == \"password1\") {\n switch (currArray) {\n case 3:\n currArray++;\n break;\n case 31:\n currArray++;\n break;\n case 33:\n currArray++;\n break;\n case 35:\n currArray++;\n break;\n case 37:\n currArray++;\n break;\n }\n }\n\n else if (cmd == \"ping\") {\n switch (currArray) {\n case 4:\n currArray++;\n break;\n case 5:\n currArray++;\n break;\n case 44:\n currArray++;\n break;\n }\n }\n\n else if (cmd == \"copy st\" && currArray == 6) {\n currArray++;\n }\n else if (cmd == \"copy startup-config tftp\" && currArray == 7) {\n currArray++;\n }\n //temp command\n else if (currArray == 8 && cmd == \"j gibbens\") {\n\n currArray++;\n }\n else if (cmd == \"erase starup-config\" && currArray == 9) {\n currArray++;\n }\n else if (cmd == \"reload\" && currArray == 10) {\n currArray++;\n }\n else if (cmd == \"y\" && currArray == 11) {\n currArray++;\n }\n else if (cmd == \"ip address\" && currArray == 12) {\n currArray++;\n }\n else if (currArray == 13) {\n currArray++;\n }\n\n else if (cmd == \"#conf t\" && currArray == 15) {\n currArray++;\n }\n else if (cmd == \"#int\" && currArray == 16) {\n console.log(currArray);\n currArray++;\n }\n else if (cmd == \"#interface vlan1\" && currArray == 17) {\n currArray++;\n }\n else if (cmd == \"ip address\" && currArray == 18) {\n currArray++;\n }\n else if (cmd == \"no shut\" && currArray == 19) {\n currArray++;\n }\n else if (cmd == \"end\" && currArray == 20) {\n currArray++;\n }\n else if (cmd == \"copy tftp flash\" && currArray == 21) {\n currArray++;\n }\n else if (cmd == \"reload command\" && currArray == 22) {\n currArray++;\n }\n else if (cmd == \"filename\" && currArray == 23) {\n currArray++;\n }\n else if (cmd == \"y\" && currArray == 24) {\n currArray++;\n }\n else if (cmd == \"copy tftp start\" && currArray == 25) {\n currArray++;\n }\n //root\n else if (cmd == \"root\" && currArray == 26) {\n currArray++;\n }\n //paswordr\n else if (cmd == \"passwordxmar\" && currArray == 27) {\n currArray++;\n }\n //temp password\n else if (cmd == \"passwordxmar\" && currArray == 28) {\n currArray++;\n }else if (cmd == \"password\" && currArray == 29) {\n currArray++;\n }\n\n else if (cmd == \"password\" && currArray == 30) {\n currArray++;\n }\n else if (cmd == \"root\" && currArray == 31) {\n currArray++;\n }\n else if (cmd == \"config t\" && currArray == 38) {\n currArray++;\n }\n /*\n else if (cmd == \"cr\" && currArray == 39) {\n currArray++;\n }\n else if (cmd == \"crypto key gen\" && currArray == 40) {\n currArray++;\n }\n else if (cmd == \"crypto key generator rsa\" && currArray == 41) {\n currArray++;\n }\n else if (cmd == \"1024\" && currArray == 42) {\n currArray++;\n }\n\n else if (cmd == \"wr\" && currArray == 43) {\n currArray++;\n }\n else if (cmd == \"show flash\" && currArray == 44) {\n currArray++;\n }*/\n else {\n xmarCmd.updateError(errorsCMD(), 'dialogContent_xmarCMD');\n }\n \n // console.log(cmd);\n // console.log(currArray);\n }\n\n inc();\n }", "function commands(command) {\n try {\n var interpreter = interpreters.top();\n \n if (command == 'exit' && settings.exit) {\n if (interpreters.size() == 1) {\n if (settings.login) {\n logout();\n } else {\n var msg = 'You can exit from main interpeter';\n self.echo(msg);\n }\n } else {\n self.pop('exit');\n }\n } else {\n echo_command(command);\n if (command == 'clear' && settings.clear) {\n self.clear();\n } else {\n interpreter['eval'](command, self);\n }\n }\n \n } catch (e) {\n display_exception(e, 'USER');\n self.resume();\n throw e;\n }\n }", "function checkInput() {\n const ERR_MESS_SYNTAX = \"TODO: Bad Syntax\";\n const OUT_LIST = \"t ls\";\n const OUT_ADD = \"t a\";\n const OUT_CLEAR = \"clear\";\n const OUT_ADD_NUM = /^t do ([0-9]+)$/;\n const OUT_PRI = /^t p ([0-9] [A-Z])$/;\n var index;\n\n todocl.out.innerHTML = CLEAR;\n todocl.todoText = CLEAR;\n readFile(false);\n\n if (todocl.todoCommand === OUT_LIST) {\n readFile(true);\n } else if (todocl.todoCommand === OUT_ADD) {\n todocl.todoAdd = true;\n todocl.out.innerHTML = \"ADD\";\n } else if (todocl.todoCommand === OUT_CLEAR) {\n todocl.out.innerHTML = CLEAR;\n } else if (todocl.todoCommand.match(OUT_PRI)) {\n priTask(todocl.todoCommand.charAt(6), todocl.todoCommand.charAt(4));\n } else if (todocl.todoCommand.match(OUT_ADD_NUM)) {\n index = Number(todocl.todoCommand.charAt(5)) - 1;\n deleteTask(index);\n } else {\n todocl.out.innerHTML = ERR_MESS_SYNTAX;\n }\n }", "async function run() {\n let errors = '';\n try {\n const commands = core.getInput('run').split(/\\r?\\n/);\n const type = core.getInput('type');\n const files = core.getInput('files');\n\n // get changed files\n let changedFiles = [];\n if (files) {\n changedFiles = JSON.parse(files);\n }\n\n // get problem matcher\n const matcher = PROBLEM_MATCHERS[type];\n if (matcher === undefined) {\n throw new Error(`not supported problem matcher type: ${type}`);\n }\n\n // execute command\n const re = new RegExp(matcher['regexp']);\n for (const cmd of commands) {\n const ret = await exec(cmd.trim(), {env: process.env}, (line) => {\n const match = re.exec(line);\n if (match) {\n if (changedFiles.includes(getMatchedFile(matcher, match))) {\n console.log(line);\n }\n const severity = match[matcher['severity']];\n if (severity === 'error') {\n errors += line;\n }\n } else {\n console.log(line);\n }\n });\n if (ret !== 0) {\n throw new Error(`run process exited with code ${ret}`);\n }\n }\n } catch (error) {\n core.setFailed(error.message);\n console.error(error);\n }\n\n if (errors) {\n core.setOutput('errors', errors);\n }\n}", "handleTextChange(event) {\n this.runningBlockedInput = [];\n this.isValidCheck = true;\n if (this.symbolsNotAllowed != undefined || this.wordsNotAllowed != undefined) {\n this.interimValue = (event.target.value).toLowerCase();\n this.interimValue = this.interimValue.replace(/(<([^>]+)>)/ig, \"\");\n \n //Symbol check section\n if (this.symbolsNotAllowed != undefined) {\n let matchesSymbol = this.interimValue.match(this.symbolsNotAllowed);\n if (matchesSymbol != null && matchesSymbol.length > 0) {\n for(let i = 0; i < matchesSymbol.length; i++){\n this.runningBlockedInput.push(matchesSymbol[i]);\n }\n this.isValidCheck = false;\n } else {\n this.richText = event.target.value;\n }\n }\n\n if (this.wordsNotAllowed != undefined) {\n let matchesWords = this.interimValue.match(this.wordsNotAllowed);\n if (matchesWords != null && matchesWords.length > 0) {\n for(let i = 0; i < matchesWords.length; i++){\n this.runningBlockedInput.push(matchesWords[i]);\n }\n this.isValidCheck = false;\n } else {\n this.richText = event.target.value;\n }\n }\n } else {\n this.isValidCheck = true;\n this.richText = event.target.value;\n }\n this.characterCount = this.richText.length;\n if(this.characterCap && this.characterCount > this.characterLimit){\n this.isValidCheck = false;\n }\n //Display different message if warn only - validation also won't be enforced on Next.\n if(this.characterCap && this.characterCount > this.characterLimit){\n this.errorMessage = 'Error - Character Limit Exceeded';\n }else if(!this.warnOnly){\n this.errorMessage = 'Error - Invalid Symbols/Words found: '+this.runningBlockedInput.toString();\n }else{\n this.errorMessage = 'Warning - Invalid Symbols/Words found: '+this.runningBlockedInput.toString();\n }\n \n }", "function treatTextAreaErrors() {\n var errorMsg = errorInPuzzleString(textArea.value);\n document.getElementById('error-msg').textContent = errorMsg;\n }", "function commandTrigger() {\n var line = promptText;\n if (typeof config.commandValidate == 'function') {\n var ret = config.commandValidate(line);\n if (ret == true || ret == false) {\n if (ret) {\n handleCommand();\n }\n } else {\n commandResult(ret,\"jquery-console-message-error\");\n }\n } else {\n handleCommand();\n }\n }", "function initCommandParser() {\n var commandParser = {};\n commandParser.commandHolder = initCommandRamHolder();\n commandParser.createCommand = function (code) {\n console.log(code);\n //Код команди виглядає так:\n //addi $t1,$t2,$t3\n //var firstSpilt = code.split(\" \");\n var firstSpaceIndex = code.indexOf(\" \");\n var firstSplit = [code.substring(0,firstSpaceIndex),code.substring(firstSpaceIndex+1)];\n var end = [firstSplit[0]].concat(firstSplit[1].split(commandRegExp));\n console.log(code);\n return end;\n };\n commandParser.parse = function (splitedCode) {\n var code = splitedCode[0];\n switch (code) {\n //TImm Group\n case 'addi':\n case 'addiu':\n case 'andi':\n case 'ori':\n case 'slti':\n case 'sltiu':\n case 'xori':\n return cStart[code] + convertTSImm(splitedCode);\n break;\n //DST Group\n case 'add':\n case 'addu':\n case 'and':\n case 'or':\n case 'sllv':\n case 'slt':\n case 'sltu':\n case 'srlv':\n case 'sub':\n case 'subu':\n case 'xor':\n return cStart[code] + convertDST(splitedCode) + cEnd[code];\n break;\n //SOff Group\n case 'bgez':\n case 'bgezal':\n case 'bgtz':\n case 'blez':\n case 'bltz':\n case 'bltzal':\n var offsetLabel = splitedCode[2];\n if (!numberRegExp.test(offsetLabel)) {\n var currentCommandNumber = this.commandHolder.commandCodeList.length;\n var labelNumber = this.commandHolder.getLabel(offsetLabel);\n var offset = labelNumber - currentCommandNumber;\n splitedCode[2] = parseInt(offset);\n }\n return cStart[code] + convertSOff(splitedCode);\n break;\n //ST Group\n case 'div':\n case 'divu':\n case 'mult':\n case 'multu':\n return cStart[code] + convertST(splitedCode) + cEnd[code];\n break;\n //STOff Group\n case 'beq':\n case 'bne':\n offsetLabel = splitedCode[3];\n if (!numberRegExp.test(offsetLabel)) {\n currentCommandNumber = this.commandHolder.commandCodeList.length;\n labelNumber = this.commandHolder.getLabel(offsetLabel);\n offset = labelNumber - currentCommandNumber;\n splitedCode[3] = parseInt(offset);\n }\n return cStart[code] + convertSTOff(splitedCode);\n break;\n //Target Group\n case 'j':\n case 'jal':\n var targetLabel = splitedCode[1];\n if (!numberRegExp.test(targetLabel)){\n labelNumber = this.commandHolder.getLabel(targetLabel);\n splitedCode[1] = labelNumber;\n }\n return cStart[code] + convertTarget(splitedCode);\n break;\n //TOffS Group\n case 'lw':\n case 'sw':\n case 'lb':\n case 'sb':\n return cStart[code] + convertTOffS(splitedCode);\n break;\n //SorD Group\n case 'mfhi':\n case 'mflo':\n case 'jr':\n return cStart[code] + convertSorD(splitedCode) + cEnd[code];\n break;\n //TImm Group\n case 'lui':\n return cStart[code] + convertTImm(splitedCode);\n break;\n //DTH Group\n case 'sll':\n case 'sra':\n case 'srl':\n return cStart[code] + convertDTH(splitedCode) + cEnd[code];\n break;\n\n }\n };\n return commandParser;\n}", "static parseInputForCommands({domain=null,input=null,arrayIndex=-1})\n{\nlet cmds={};\n\n\n// Override commands from config/input\nif(Array.isArray(input.domain))\n{\nif(input.domain[arrayIndex].preflight_commands&&\nObject.keys(input.domain[arrayIndex].preflight_commands).length>0)\n{\ncmds=input.domain[arrayIndex].preflight_commands;\n}\n\nif(input.domain[arrayIndex].commands&&\nObject.keys(input.domain[arrayIndex].commands).length>0)\n{\n// If there were no preflight commands, override any previously specified commands\nif(!input.domain[arrayIndex].preflight_commands||\nObject.keys(input.domain[arrayIndex].preflight_commands).length<1)\n{\ncmds=input.domain[arrayIndex].commands;\n}else\n// or else add to the preflight commands\n{\ncmds=Object.assign(cmds,input.domain[arrayIndex].commands);\n}\n}\n\n\n}else\nif(input.domain[domain]&&Object.keys(input.domain[domain]).length>0)\n{\nif(input.domain[domain].preflight_commands&&\nObject.keys(input.domain[domain].preflight_commands).length>0)\n{\ncmds=input.domain[domain].preflight_commands;\n}\n\nif(input.domain[domain].commands&&\nObject.keys(input.domain[domain].commands).length>0)\n{\n// If there were no preflight commands, override any previously specified commands\nif(!input.domain[domain].preflight_commands||\nObject.keys(input.domain[domain].preflight_commands).length<1)\n{\ncmds=input.domain[domain].commands;\n}else\n// or else add to the preflight commands\n{\ncmds=Object.assign(cmds,input.domain[domain].commands);\n}\n}\n}\n\nreturn cmds;\n}", "checkForNextError() {\n if (!isNullOrUndefined(this.viewer)) {\n let errorWords = this.errorWordCollection;\n if (errorWords.length > 0) {\n for (let i = 0; i < errorWords.length; i++) {\n let errorElements = errorWords.get(errorWords.keys[i]);\n for (let j = 0; j < errorElements.length; j++) {\n if (errorElements[j] instanceof ErrorTextElementBox && !errorElements[j].ischangeDetected) {\n this.updateErrorElementTextBox(errorWords.keys[i], errorElements[j]);\n }\n else if (errorElements[j] instanceof TextElementBox) {\n let matchResults = this.getMatchedResultsFromElement(errorElements[j]);\n let results = matchResults.textResults;\n // tslint:disable-next-line:max-line-length\n let markIndex = (errorElements[j].ischangeDetected) ? errorElements[j].start.offset : errorElements[j].line.getOffset(errorElements[j], 0);\n // tslint:disable-next-line:max-line-length\n this.viewer.owner.searchModule.textSearch.updateMatchedTextLocation(matchResults.matches, results, matchResults.elementInfo, 0, errorElements[j], false, null, markIndex);\n for (let i = 0; i < results.length; i++) {\n let element = this.createErrorElementWithInfo(results.innerList[i], errorElements[j]);\n this.updateErrorElementTextBox(element.text, element);\n break;\n }\n }\n break;\n }\n break;\n }\n }\n else {\n this.viewer.clearSelectionHighlight();\n }\n }\n }", "function parseCommand(text){\n var words = text.split(\" \");\n for(var i=0; i < words.length; i++){\n if (words[i] in commandList){\n processCommand(words[i]);\n break;\n }\n }\n}", "function validateCommand(command) {\n if (commandVerbs.indexOf(command) == -1) {\n doNotUnderstand();\n } else {\n getNewAdventure(command);\n }\n }", "function processCommands(command, commandParam){\n\n\t//console.log(commandParam);\n\n\tswitch(command){\n\n\tcase 'spotify-this-song':\n\t\t//If user has not specified a song , use default\n\t\tif(commandParam === undefined){\n\t\t\tcommandParam = defaultSong;\n\t\t} \n\t\tspotifyThis(commandParam); break;\n\tcase 'movie-this':\n\t\t//If user has not specified a movie Name , use default\n\t\tif(commandParam === undefined){\n\t\t\tcommandParam = defaultMovie;\n\t\t} \n\t\tmovieThis(commandParam); break;\n\tcase 'do-what-it-says':\n\t\tdoWhatItSays(); break;\n\tdefault: \n\t\tconsole.log(\"Invalid command. Please type any of the following commands: spotify-this-song movie-this or do-what-it-says\");\n}\n\n\n}", "function history_edit_command(command) {\n remove_history_editor();\n \n history_current_editor = $('<form class=\"command\"><input type=\"text\"/></form>');\n $('input',history_current_editor).val(command.text());\n history_replaced_command = command;\n history_replaced_command.parent().addClass('selected');\n history_replaced_command.replaceWith(history_current_editor);\n \n $('input',history_current_editor).focus().keydown(function(event) {\n // Navigate up and down the command history.\n // 38 == UP key\n // 40 == DOWN key\n if (event.which != 38 && event.which != 40) {\n return;\n }\n event.preventDefault();\n \n var current_action = history_current_editor.parent();\n var next_action = $('.command', event.which == 38 ?\n current_action.prev() : current_action.next());\n \n if (next_action.length > 0) {\n history_edit_command(next_action);\n } else {\n if (event.which == 40) {\n $('#input').focus();\n } else {\n // TODO: Implement cleared history interface\n }\n }\n }).keydown(function (event) {\n // Remove the editor\n // 27 ESC key\n if (event.which == 27) {\n event.preventDefault();\n remove_history_editor();\n }\n }).keydown(function (event) {\n // Shift + ENTER sends the command\n // to a new output frame.\n if (event.which == 13 && event.shiftKey) {\n event.preventDefault();\n $('#input').val($(this).val());\n remove_history_editor();\n $('#go').click();\n }\n }).keydown(tab_completion);\n\n history_current_editor.submit(function(event) {\n event.preventDefault();\n if (working)\n return;\n \n var input = $('input', this);\n var container = $(this).parent();\n var cmd = $.trim(input.val());\n if (cmd.length == 0) return;\n \n if (execute_on_client(cmd,container)) {\n remove_history_editor();\n return;\n }\n \n setWorking(true);\n $.ajax({\n type: 'GET', url: '/cmd?' + escapeCommand(cmd),\n dataType: 'html',\n success: function (response) {\n history_replace_result(container,cmd,response);\n remove_history_editor();\n $('#input').focus();\n },\n error: function (request, message, exception) {\n history_replace_result(container,\n $('<div class=\"command\"><span class=\"failed\">' + cmd + '</span></div>'),\n $('<strong>HTTP ' + request.status\n + ' ' + request.statusText + '</strong>'\n + ' ' + request.responseText));\n },\n complete: function (request, message) {\n setWorking(false);\n last_request = request;\n }\n });\n });\n}", "function replyInvalidCommand(err=null){\n if(err){\n message.reply(err)\n }else{\n message.reply('Please enter valid command.\\nCommand for help: >help');\n }\n }", "function processInput() {\n var value = inputArea.value;\n /* split input in text area by newline */\n var lines = value.split('\\n');\n var output = parseLines(lines);\n /* Output is an object with two properties,\n 'outputLines' and 'errors' */\n var outputLines = output.outputLines;\n var errors = output.errors;\n /* Toggle visibility of errors section\n depending on if there are errors at all */\n if (errors.length == 0) {\n errorsContainer.classList.remove('visible');\n } else {\n errorsContainer.classList.add('visible');\n /* clear all errors before adding new ones */\n while (errorsUl.firstChild) {\n errorsUl.removeChild(errorsUl.firstChild);\n }\n errors.forEach(function(error) {\n addErrorToUl(error);\n });\n }\n /* actually set the output to pre element,\n join multiple lines with newline */\n outputPre.innerHTML = outputLines.join('\\n');\n }", "function validCommand() {\n console.log(\"\\n\" + \"Please enter a valid command from the following list:\");\n console.log(\"concert-this\");\n console.log(\"spotify-this-song\");\n console.log(\"movie-this\");\n console.log(\"do-what-it-says\" + \"\\n\");\n}", "function processInput(str) {\n str = typeof(str) == 'string' && str.trim().length > 0 ? str.trim() : false\n\n if(str) {\n str == 'list' || '?' || 'help'\n ? listOptions()\n : str == 'quit' || str == 'q'\n ? process.exit(0)\n : console.log(BLUE, 'No matching script')\n } else {\n console.log(RED, 'Invalid Input')\n }\n}", "function splitCommand() {\n // command is retrieved from the text box\n str = document.getElementById('tags').value;\n var name = document.getElementById('user_name').value;\n var listname = document.getElementById('list_id').value;\n // Error message is thrown if either user or list is not specified\n if (!name || !listname) {\n alert(\"Enter the command without ANY spelling or grammatical errors \\nEnter an '@' sign before entering the person's name \\nOne task can be allocated to one person at a time \\nType a '#' sign before the list name \\nIf entering the date directly follow dd/mm/yyyy format i.e. 29/12/2017 \\nDue date command should be able to fetch an exact date i.e. 'finish by the end of next week' will work whereas 'finish it next week' will not work \\nMention start date and end date explicitly (synonyms are accepted) i.e. Start today and submit it by next Monday \\nA week starts on Monday and finishes on Sunday (Public holidays and weekends are not considered) \\nDue date cannot be before start date \\nDescription of the task must be enclosed in '[ ]' \\nPercentage completed must be stated as number followed by percentage sign i.e. 25% \\nPlus symbol followed by 1 (high) or 2(medium) or 3(low) must be entered to indicate the priority of the task i.e. +1\");\n }\n // user and list are replaced with empty spaces in the command\n str = str.replace(document.getElementById('user_name').value, '').replace(document.getElementById('list_id').value, '');\n // empty spaces are removed\n cap = str.trim().toUpperCase();\n // the command is processed with endElements array to split the command into two halves if it has start date and end date\n for (var x = 0; x < endElements.length; x++) {\n if (cap.indexOf(endElements[x]) >= 0) {\n dateText.push(cap.substr(cap.indexOf(endElements[x]) - cap.charAt(0), cap.indexOf(endElements[x]) - 1));\n dateText.push(cap.substr(cap.indexOf(endElements[x]), cap.length));\n }\n }\n // priority is processed from the command\n if (cap.indexOf('+') > -1) {\n priority = cap.substr(cap.indexOf('+') + 1, 1);\n var priority_text;\n switch (priority) {\n case \"1\":\n priority_text = \"High\";\n break;\n case \"2\":\n priority_text = \"Medium\";\n break;\n case \"3\":\n priority_text = \"Low\";\n break;\n default:\n priority_text = \"high\";\n priority = \"1\";\n break;\n }\n resultArray['PRIORITY'] = \"(\" + priority + \") \" + priority_text;\n }\n // percentage is processed from the command\n if (cap.indexOf('%') > -1) {\n var cap1 = \" \" + cap;\n percentage = cap1.substr(cap1.indexOf('%') - 3, 3);\n percentage = percentage.replace(/\\D/g, '');\n percentage = percentage.trim();\n resultArray['PERCENTAGE'] = percentage;\n }\n // description is extracted from the command\n if (cap.indexOf('[') > -1) {\n desc = cap.substring(cap.lastIndexOf(\"[\") + 1, cap.lastIndexOf(\"]\"));\n desc = desc.trim();\n desc = desc.substring(0, 1).toUpperCase() + desc.substring(1).toLowerCase();\n resultArray['DESCRIPTION'] = desc;\n }\n // this loop gets the date by running the loop wrt length of dateText array\n for (var y1 = 0; y1 < dateText.length; y1++) {\n var res = dateText[y1].split(\" \");\n var dateValue = dateText[y1].substr(dateText[y1].indexOf('/') - 2, 10);\n // checks if the date entered matches the format dd/mm/yyyy\n var t = dateValue.match(/^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/);\n if (t !== null) {\n var d = +t[1],\n m = +t[2],\n y = +t[3];\n var dateFull = new Date(y, m - 1, d);\n if (dateFull.getFullYear() === y && dateFull.getMonth() === m - 1) {\n // passes the date value to displayDate function where the date is displayed\n displayDate(dateFull);\n }\n }\n // If the date specified is not in the format of dd/mm/yyyy then the time and time adjectives are pushed into the array\n for (var i = 0; i < res.length; i++) {\n for (var l = 0; l < time.length; l++) {\n\n if (res[i] == time[l]) {\n timeElements.push(res[i]);\n }\n }\n for (var j = 0; j < timeAdj.length; j++) {\n if (res[i] == timeAdj[j]) {\n timeAdjEle.push(res[i]);\n }\n }\n }\n // this if condition will get executed if there are no time elements\n if (timeElements.length == 0) {\n displayFields();\n }\n // this if condition will get executed if there are no time adjective elements\n if (timeElements.length >= 1 && timeAdjEle.length == 0) {\n\n for (var i = 0; i < res.length; i++) {\n for (var l = 0; l < time.length; l++) {\n if (res[i] == time[l]) {\n timeFinal = res[i];\n // calculates today's date\n if (timeFinal == \"TODAY\") {\n var today = new Date();\n timeToAdd = today;\n }\n // calculates tomorrow's date\n if (timeFinal == \"TOMORROW\") {\n if ((res[i - 1] != \"AFTER\") || (res[i - 2] != \"DAY\")) {\n var tomorrow = new Date();\n tomorrow.setDate(tomorrow.getDate() + 1);\n timeToAdd = tomorrow;\n }\n }\n // calculates day after tomorrow's date\n if (timeFinal == \"TOMORROW\") {\n if ((res[i - 1] == \"AFTER\") && (res[i - 2] == \"DAY\")) {\n var tomorrow = new Date();\n tomorrow.setDate(tomorrow.getDate() + 2);\n timeToAdd = tomorrow;\n }\n }\n // calculates date values related to number of days\n if (timeFinal == \"DAY\" || timeFinal == \"DAYS\") {\n if (res[i - 2] == \"COUPLE\") {\n var day = new Date();\n day.setDate(day.getDate() + 2);\n timeToAdd = day;\n } else {\n // the position of the number entered is found out from the words string\n var pos = words.indexOf(res[i - 1].substring(0, 3).toLowerCase());\n var numberConverted = pos / 3 + 1;\n var days = numberConverted;\n var day = new Date();\n // number is added to along with today's date\n day.setDate(day.getDate() + days);\n timeToAdd = day;\n }\n }\n // calculates date values related to number of weeks\n if (timeFinal == \"WEEK\" || timeFinal == \"WEEKS\") {\n if (res[i - 2] == \"COUPLE\") {\n var week = new Date();\n week.setDate(week.getDate() + 14);\n timeToAdd = week;\n } else {\n var pos = words.indexOf(res[i - 1].substring(0, 3).toLowerCase());\n var numberConverted = pos / 3 + 1;\n var weeks = numberConverted * 7;\n var week = new Date();\n week.setDate(week.getDate() + weeks);\n timeToAdd = week;\n }\n }\n // calculates date values related to number of months\n if (timeFinal == \"MONTH\" || timeFinal == \"MONTHS\") {\n if (res[i - 2] == \"COUPLE\") {\n var month = new Date();\n month.setDate(month.getDate() + 61);\n timeToAdd = month;\n } else {\n var pos = words.indexOf(res[i - 1].substring(0, 3).toLowerCase());\n var numberConverted = pos / 3 + 1;\n var months = numberConverted * 30;\n var month = new Date();\n month.setDate(month.getDate() + months);\n timeToAdd = month;\n }\n }\n // calculates date values related to number of years\n if (timeFinal == \"YEAR\" || timeFinal == \"YEARS\") {\n if (res[i - 2] == \"COUPLE\") {\n var year = new Date();\n year.setDate(year.getDate() + 730);\n timeToAdd = year;\n } else {\n var pos = words.indexOf(res[i - 1].substring(0, 3).toLowerCase());\n var numberConverted = pos / 3 + 1;\n var years = numberConverted * 365;\n var year = new Date();\n year.setDate(year.getDate() + years);\n timeToAdd = year;\n }\n }\n }\n }\n }\n displayDate(timeToAdd);\n }\n\n if ((timeElements.length >= 1) && (timeAdjEle.length <= 1)) {\n if ((timeElements[0] == \"MONDAY\") || (timeElements[0] == \"TUESDAY\") || (timeElements[0] == \"WEDNESDAY\") || (timeElements[0] == \"THURSDAY\") || (timeElements[0] == \"FRIDAY\") || (timeElements[0] == \"SATURDAY\") || (timeElements[0] == \"SUNDAY\")) {\n // calculates date values related to this+weekday\n if ((timeAdjEle[0] == \"THIS\") || (timeAdjEle[1] == \"THIS\")) {\n var dayNum = dayFinder(timeElements[0]);\n if (dayNum >= date.getDay()) {\n var thisDay = new Date(date.getFullYear(), date.getMonth(), date.getDate() + (dayNum - date.getDay()));\n displayDate(thisDay);\n }\n if (dayNum < date.getDay()) {\n var thisDay = new Date(date.getFullYear(), date.getMonth(), date.getDate() + (7 - (date.getDay() - dayNum)));\n displayDate(thisDay);\n }\n }\n // calculates date values related to next+weekday\n if ((timeAdjEle[0] == \"NEXT\") || (timeAdjEle[1] == \"NEXT\")) {\n var dayNum = dayFinder(timeElements[0]);\n var thisDay = new Date(date.getFullYear(), date.getMonth(), date.getDate() + (7 - (date.getDay() - dayNum)));\n displayDate(thisDay);\n }\n }\n }\n\n if ((timeElements.length >= 1) && (timeAdjEle.length <= 2)) {\n if ((timeAdjEle[0] == \"WITHIN\") || (timeAdjEle[1] == \"WITHIN\")) {\n if ((timeAdjEle[0] == \"THIS\") || (timeAdjEle[1] == \"THIS\")) {\n // calculates date values related to within this month\n if (timeElements[0] == \"MONTH\") {\n lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);\n finalTime = lastDay;\n displayDate(finalTime);\n }\n // calculates date values related to within this + (month)\n if ((timeElements[0] == \"JANUARY\") || (timeElements[0] == \"FEBRUARY\") || (timeElements[0] == \"MARCH\") || (timeElements[0] == \"APRIL\") || (timeElements[0] == \"MAY\") || (timeElements[0] == \"JUNE\") || (timeElements[0] == \"JULY\") || (timeElements[0] == \"AUGUST\") || (timeElements[0] == \"SEPTEMBER\") || (timeElements[0] == \"OCTOBER\") || (timeElements[0] == \"NOVEMBER\") || (timeElements[0] == \"DECEMBER\")) {\n monthCalculator(timeElements[0]);\n }\n // calculates date values related to within this week\n if (timeElements[0] == \"WEEK\") {\n var curr = new Date;\n lastDay = new Date(curr.setDate(curr.getDate() - curr.getDay() + 7));\n finalTime = lastDay;\n displayDate(finalTime);\n }\n // calculates date values related to within this year\n if (timeElements[0] == \"YEAR\") {\n var curr = new Date;\n lastDay = new Date(curr.getFullYear(), 11, 31);\n finalTime = lastDay;\n displayDate(finalTime);\n }\n }\n if ((timeAdjEle[0] == \"NEXT\") || (timeAdjEle[1] == \"NEXT\")) {\n // calculates date values related to within next month\n if (timeElements[0] == \"MONTH\") {\n lastDay = new Date(date.getFullYear(), date.getMonth() + 2, 0);\n finalTime = lastDay;\n displayDate(finalTime);\n }\n // calculates date values related to within next + (month)\n if ((timeElements[0] == \"JANUARY\") || (timeElements[0] == \"FEBRUARY\") || (timeElements[0] == \"MARCH\") || (timeElements[0] == \"APRIL\") || (timeElements[0] == \"MAY\") || (timeElements[0] == \"JUNE\") || (timeElements[0] == \"JULY\") || (timeElements[0] == \"AUGUST\") || (timeElements[0] == \"SEPTEMBER\") || (timeElements[0] == \"OCTOBER\") || (timeElements[0] == \"NOVEMBER\") || (timeElements[0] == \"DECEMBER\")) {\n monthCalculator(timeElements[0]);\n }\n // calculates date values related to within next week\n if (timeElements[0] == \"WEEK\") {\n var curr = new Date;\n lastDay = new Date(curr.setDate(curr.getDate() - curr.getDay() + 14));\n finalTime = lastDay;\n displayDate(finalTime);\n }\n // calculates date values related to within this year\n if (timeElements[0] == \"YEAR\") {\n var curr = new Date;\n lastDay = new Date(curr.getFullYear() + 1, 11, 31);\n finalTime = lastDay;\n displayDate(finalTime);\n }\n }\n }\n if ((timeAdjEle[0] == \"END\") || (timeAdjEle[1] == \"END\")) {\n if ((timeAdjEle[0] == \"THIS\") || (timeAdjEle[1] == \"THIS\")) {\n // calculates date values related to by the end of this month\n if (timeElements[0] == \"MONTH\") {\n lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);\n finalTime = lastDay;\n displayDate(finalTime);\n }\n // calculates date values related to by the end of this (month)\n if ((timeElements[0] == \"JANUARY\") || (timeElements[0] == \"FEBRUARY\") || (timeElements[0] == \"MARCH\") || (timeElements[0] == \"APRIL\") || (timeElements[0] == \"MAY\") || (timeElements[0] == \"JUNE\") || (timeElements[0] == \"JULY\") || (timeElements[0] == \"AUGUST\") || (timeElements[0] == \"SEPTEMBER\") || (timeElements[0] == \"OCTOBER\") || (timeElements[0] == \"NOVEMBER\") || (timeElements[0] == \"DECEMBER\")) {\n monthCalculator(timeElements[0]);\n }\n // calculates date values related to by the end of this week\n if (timeElements[0] == \"WEEK\") {\n var curr = new Date;\n lastDay = new Date(curr.setDate(curr.getDate() - curr.getDay() + 7));\n finalTime = lastDay;\n displayDate(finalTime);\n }\n // calculates date values related to by the end of this year\n if (timeElements[0] == \"YEAR\") {\n var curr = new Date;\n lastDay = new Date(curr.getFullYear(), 11, 31);\n finalTime = lastDay;\n displayDate(finalTime);\n }\n }\n if ((timeAdjEle[0] == \"NEXT\") || (timeAdjEle[1] == \"NEXT\")) {\n // calculates date values related to by the end of next month\n if (timeElements[0] == \"MONTH\") {\n lastDay = new Date(date.getFullYear(), date.getMonth() + 2, 0);\n finalTime = lastDay;\n displayDate(finalTime);\n }\n // calculates date values related to by the end of next (month)\n if ((timeElements[0] == \"JANUARY\") || (timeElements[0] == \"FEBRUARY\") || (timeElements[0] == \"MARCH\") || (timeElements[0] == \"APRIL\") || (timeElements[0] == \"MAY\") || (timeElements[0] == \"JUNE\") || (timeElements[0] == \"JULY\") || (timeElements[0] == \"AUGUST\") || (timeElements[0] == \"SEPTEMBER\") || (timeElements[0] == \"OCTOBER\") || (timeElements[0] == \"NOVEMBER\") || (timeElements[0] == \"DECEMBER\")) {\n monthCalculator(timeElements[0]);\n }\n // calculates date values related to by the end of next week\n if (timeElements[0] == \"WEEK\") {\n var curr = new Date;\n lastDay = new Date(curr.setDate(curr.getDate() - curr.getDay() + 14));\n finalTime = lastDay;\n displayDate(finalTime);\n }\n // calculates date values related to by the end of next year\n if (timeElements[0] == \"YEAR\") {\n var curr = new Date;\n lastDay = new Date(curr.getFullYear() + 1, 11, 31);\n finalTime = lastDay;\n displayDate(finalTime);\n }\n }\n }\n }\n if ((timeElements.length >= 2) && (timeAdjEle.length >= 2)) {\n if ((timeAdjEle[0] == \"THIS\") || (timeAdjEle[1] == \"THIS\")) {\n // calculates date values related to two time elements and two time adjective elements (this month)\n if ((timeElements[0] == \"MONTH\") || (timeElements[1] == \"MONTH\")) {\n lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);\n\n if ((timeAdjEle[0] == \"LAST\") || (timeAdjEle[1] == \"LAST\")) {\n thisMonthDay(\"LAST\", \"0\");\n }\n if ((timeAdjEle[0] == \"FIRST\") || (timeAdjEle[1] == \"FIRST\")) {\n thisMonthDay(\"FIRST\", \"1\");\n }\n if ((timeAdjEle[0] == \"SECOND\") || (timeAdjEle[1] == \"SECOND\")) {\n thisMonthDay(\"SECOND\", \"2\");\n }\n if ((timeAdjEle[0] == \"THIRD\") || (timeAdjEle[1] == \"THIRD\")) {\n thisMonthDay(\"THIRD\", \"3\");\n }\n if ((timeAdjEle[0] == \"FOURTH\") || (timeAdjEle[1] == \"FOURTH\")) {\n thisMonthDay(\"FOURTH\", \"4\");\n }\n if ((timeAdjEle[0] == \"FIFTH\") || (timeAdjEle[1] == \"FIFTH\")) {\n thisMonthDay(\"FIFTH\", \"5\");\n }\n }\n // calculates date values related to two time elements and two time adjective elements (this (month name))\n if ((timeElements[1] == \"JANUARY\") || (timeElements[1] == \"FEBRUARY\") || (timeElements[1] == \"MARCH\") || (timeElements[1] == \"APRIL\") || (timeElements[1] == \"MAY\") || (timeElements[1] == \"JUNE\") || (timeElements[1] == \"JULY\") || (timeElements[1] == \"AUGUST\") || (timeElements[1] == \"SEPTEMBER\") || (timeElements[1] == \"OCTOBER\") || (timeElements[1] == \"NOVEMBER\") || (timeElements[1] == \"DECEMBER\")) {\n lastDay = monthReturn(timeElements[1]);\n if ((timeAdjEle[0] == \"LAST\") || (timeAdjEle[1] == \"LAST\")) {\n MonthDay(\"LAST\", \"0\");\n }\n if ((timeAdjEle[0] == \"FIRST\") || (timeAdjEle[1] == \"FIRST\")) {\n MonthDay(\"FIRST\", \"1\");\n }\n if ((timeAdjEle[0] == \"SECOND\") || (timeAdjEle[1] == \"SECOND\")) {\n MonthDay(\"SECOND\", \"2\");\n }\n if ((timeAdjEle[0] == \"THIRD\") || (timeAdjEle[1] == \"THIRD\")) {\n MonthDay(\"THIRD\", \"3\");\n }\n if ((timeAdjEle[0] == \"FOURTH\") || (timeAdjEle[1] == \"FOURTH\")) {\n MonthDay(\"FOURTH\", \"4\");\n }\n if ((timeAdjEle[0] == \"FIFTH\") || (timeAdjEle[1] == \"FIFTH\")) {\n MonthDay(\"FIFTH\", \"5\");\n }\n }\n }\n // calculates date values related to two time elements and two time adjective elements (next month)\n if ((timeAdjEle[0] == \"NEXT\") || (timeAdjEle[1] == \"NEXT\")) {\n if ((timeElements[0] == \"MONTH\") || (timeElements[1] == \"MONTH\")) {\n lastDay = new Date(date.getFullYear(), date.getMonth() + 2, 0);\n if ((timeAdjEle[0] == \"LAST\") || (timeAdjEle[1] == \"LAST\")) {\n nextMonthDay(\"LAST\", \"0\");\n }\n if ((timeAdjEle[0] == \"FIRST\") || (timeAdjEle[1] == \"FIRST\")) {\n nextMonthDay(\"FIRST\", \"1\");\n }\n if ((timeAdjEle[0] == \"SECOND\") || (timeAdjEle[1] == \"SECOND\")) {\n nextMonthDay(\"SECOND\", \"2\");\n }\n if ((timeAdjEle[0] == \"THIRD\") || (timeAdjEle[1] == \"THIRD\")) {\n nextMonthDay(\"THIRD\", \"3\");\n }\n if ((timeAdjEle[0] == \"FOURTH\") || (timeAdjEle[1] == \"FOURTH\")) {\n nextMonthDay(\"FOURTH\", \"4\");\n }\n if ((timeAdjEle[0] == \"FIFTH\") || (timeAdjEle[1] == \"FIFTH\")) {\n nextMonthDay(\"FIFTH\", \"5\");\n }\n }\n // calculates date values related to two time elements and two time adjective elements (next (month name))\n if ((timeElements[1] == \"JANUARY\") || (timeElements[1] == \"FEBRUARY\") || (timeElements[1] == \"MARCH\") || (timeElements[1] == \"APRIL\") || (timeElements[1] == \"MAY\") || (timeElements[1] == \"JUNE\") || (timeElements[1] == \"JULY\") || (timeElements[1] == \"AUGUST\") || (timeElements[1] == \"SEPTEMBER\") || (timeElements[1] == \"OCTOBER\") || (timeElements[1] == \"NOVEMBER\") || (timeElements[1] == \"DECEMBER\")) {\n lastDay = monthReturn(timeElements[1]);\n if ((timeAdjEle[0] == \"LAST\") || (timeAdjEle[1] == \"LAST\")) {\n MonthDay(\"LAST\", \"0\");\n }\n if ((timeAdjEle[0] == \"FIRST\") || (timeAdjEle[1] == \"FIRST\")) {\n MonthDay(\"FIRST\", \"1\");\n }\n if ((timeAdjEle[0] == \"SECOND\") || (timeAdjEle[1] == \"SECOND\")) {\n MonthDay(\"SECOND\", \"2\");\n }\n if ((timeAdjEle[0] == \"THIRD\") || (timeAdjEle[1] == \"THIRD\")) {\n MonthDay(\"THIRD\", \"3\");\n }\n if ((timeAdjEle[0] == \"FOURTH\") || (timeAdjEle[1] == \"FOURTH\")) {\n MonthDay(\"FOURTH\", \"4\");\n }\n if ((timeAdjEle[0] == \"FIFTH\") || (timeAdjEle[1] == \"FIFTH\")) {\n MonthDay(\"FIFTH\", \"5\");\n }\n }\n }\n }\n // empties the array\n timeAdjEle = [];\n timeElements = [];\n }\n // Final alert message is displayed with all the elements of associative array\n alert(\"User: \" + document.getElementById('user_name').value + \"\\n Title:\" + resultArray['TITLE'] + \"\\n\" + \"Priority: \" + resultArray['PRIORITY'] + \"\\n\" + \"Percentage: \" + resultArray['PERCENTAGE'] + \"\\n\" + \"Description: \" + resultArray['DESCRIPTION'] + \"\\n\" + \"Start Date: \" + resultArray['STARTDATE'] + \"\\n\" + \"Due Date: \" + resultArray['DUEDATE']);\n}", "function checkCommandInEditMode() {\n var editCommand = new Object();\n editCommand[openCommand] = new Object();\n\n //add each default answer\n $(\".oldAnswerEdit\").each(function(i, e) {\n var answerName = $(e).val();\n var answerOutput = $(e).closest(\".row\").next(\"div\").children(\"div\").eq(0).children(\"div\").eq(0).children(\"textarea\").val();\n var lastChangedText = $(e).closest(\".row\").next(\"div\").children(\"div\").eq(0).children(\"div\").eq(1).children(\"small\").text();\n\n editCommand[openCommand][answerName] = new Object();\n //add answer key and value to answer object\n editCommand[openCommand][answerName][\"answer\"] = answerOutput;\n editCommand[openCommand][answerName][\"lastChangedAnswer\"] = lastChangedText;\n //add variables object\n editCommand[openCommand][answerName][\"variables\"] = new Object();\n //add each variable object\n $(\".availableVariable\", $(e).closest(\".row\").next(\"div\").children(\"div\").eq(1).children(\"div\")).each(function(i, e) {\n var variableName = e.innerHTML;\n var variableIdentifier = $(e).attr(\"data-original-title\");\n editCommand[openCommand][answerName][\"variables\"][variableName] = variableIdentifier;\n\n })\n });\n\n //add each new answer\n $(\".newAnswerEdit\").each(function(i, e) {\n var answerName = $(e).val();\n var answerOutput = $(e).closest(\".row\").next(\"div\").children(\"div\").eq(0).children(\"textarea\").val();\n var lastChangedText = $(e).closest(\".row\").next(\"div\").children(\"div\").eq(0).children(\"div\").eq(1).children(\"small\").text();\n\n editCommand[openCommand][answerName] = new Object();\n //add answer key and value to answer object\n editCommand[openCommand][answerName][\"answer\"] = answerOutput;\n editCommand[openCommand][answerName][\"lastChangedAnswer\"] = lastChangedText;\n //add variables object\n editCommand[openCommand][answerName][\"variables\"] = new Object();\n\n //add each variable object\n $(\".availableVariable\", $(e).closest(\".row\").next(\"div\").children(\"div\").eq(1)).each(function(i, e) {\n var variableName = e.innerHTML;\n var variableIdentifier = $(e).attr(\"data-original-title\");\n editCommand[openCommand][answerName][\"variables\"][variableName] = variableIdentifier;\n\n })\n });\n\n if (JSON.stringify(editCommand[openCommand]) !== JSON.stringify(botCommandObject[openCommand])) {\n editModeCommandNew = true;\n } else {\n editModeCommandNew = false;\n }\n\n setCommitChangesBtnEditMode();\n}", "function ecrire(){\nrl.question(welcomemessage, (answer) =>{\n\tif (answer == 'exit'){\n\t\tprocess.exit();\n\t}\n\telse if (answer== 'set'){\n\t\tset();\n\t}\n\telse if (answer == 'get'){\n\t\tget();\n\t}\n\telse if (answer == 'lastquery'){\n\t\tlastquery();\n\t}\n\n\telse if (answer == 'mysql') {\n\t\tsetEvent();\n\t}\n\telse if (answer== 'php'){\n\t\teventphp();\n\t}\n\telse {\n\t\tconsole.log(answer + ': command not found \\n' + listofcommand);\n\t\tsetTimeout(function(){ecrire()},120);\n\t}\n\t});\n}", "function shellInvalidCommand()\n{\n _StdIn.putText(\"Invalid Command. \");\n if (_SarcasticMode)\n {\n _StdIn.putText(\"Duh. Go back to your Speak & Spell.\");\n }\n else\n {\n _StdIn.putText(\"Type 'help' for, well... help.\");\n }\n}" ]
[ "0.5959118", "0.58217865", "0.58019996", "0.5768349", "0.5623921", "0.55826753", "0.552547", "0.54393476", "0.5423634", "0.5421429", "0.5404077", "0.5386142", "0.537462", "0.5317956", "0.53178096", "0.5307177", "0.52626866", "0.52485746", "0.5248293", "0.52112913", "0.52062845", "0.5194742", "0.51838636", "0.5167228", "0.5140333", "0.5138397", "0.51113564", "0.5104242", "0.5102777", "0.5088123" ]
0.67122287
0
Check if the input entered by the user contains the specified command. The specified command is considered to be contained in the input if the input ends with the specified command. Return: true if the specified command is present in the input; false otherwise
function inputCommandIs(command) { var input = my.html.input.value return input.substring(input.length - command.length) == command }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "hasCmd(cmd) {\n return this.parsed._.includes(cmd.name);\n }", "function checkIfValidCommand(command) {\n\n var valid_commands = /df|mf|al[0-9]+|ar[0-9]|none+/i;\n\n if (valid_commands.test(command)) {\n return true;\n } else {\n console.log(\"Unknown command: \" + command);\n return false;\n }\n}", "function checkCommand(intendedCommand) {\n var validCommand;\n if (intendedCommand === concert) {\n validCommand = true;\n callBandsTown();\n } else if (intendedCommand === spotify) {\n validCommand = true;\n callSpotify();\n } else if (intendedCommand === movie) {\n validCommand = true;\n callOmdb();\n } else if (intendedCommand === doWhat) {\n validCommand = true;\n callTxt();\n \n } else {\n validCommand = false;\n console.log('Invalid Command');\n }\n \n return validCommand;\n}", "function word_present(command, synonyms){\n for (n in synonyms){\n var synonym = synonyms[n];\n if (synonym.charAt(0) == \"<\"){\n //must be an exact match\n synonym = synonym.substring(1);\n if (command == synonym)\n return true;\n }\n else{\n if (command.includes(synonym))\n return true;\n }\n }\n return false;\n}", "function command_ok(command){\n if (command == 2 || command == 4 || command == 6 || command == 7){\n return true;\n }\n return false;\n}", "static isBotCommand(command) {\n const arr = command.split(\" \")\n if (!arr || arr.length != 2) {\n return false\n }\n else if (arr[0] != BotCommand) {\n return false\n }\n return true\n }", "verifyCommandInputValidity() {\n if (this.mode == Editor.MODE_COMMAND) {\n if (this.commandInput.getContent()[0] != \":\")\n this.changeMode(Editor.MODE_GENERAL);\n }\n }", "function checkCommand ( cmd ) {\r\n\tvar somethingUndefined = Object.keys( cmd ).some(function ( key ) {\r\n\t\treturn !cmd[ key ];\r\n\t}),\r\n\t\terror;\r\n\r\n\tif ( somethingUndefined ) {\r\n\t\terror = 'Illegal /learn object';\r\n\t}\r\n\r\n\tif ( !/^[\\w\\-]+$/.test(cmd.name) ) {\r\n\t\terror = 'Invalid command name';\r\n\t}\r\n\r\n\tif ( bot.commandExists(cmd.name.toLowerCase()) ) {\r\n\t\terror = 'Command ' + cmd.name + ' already exists';\r\n\t}\r\n\r\n\treturn error;\r\n}", "function commandExists(cmd){\n try{\n cp.execSync(\"where \" + cmd, {stdio:[\"ignore\"]});\n return true;\n }catch(err){\n return false;\n }\n}", "function textIsValidCommand(text) {\n var strArr = text.split(\"\\n\");\n var _iteratorNormalCompletion8 = true;\n var _didIteratorError8 = false;\n var _iteratorError8 = undefined;\n\n try {\n for (var _iterator8 = strArr[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {\n var str = _step8.value;\n\n var idx = str.indexOf('(');\n var idx2 = str.indexOf(')');\n if (!(idx > 0 && idx2 > idx)) {\n return false;\n }\n }\n } catch (err) {\n _didIteratorError8 = true;\n _iteratorError8 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion8 && _iterator8.return) {\n _iterator8.return();\n }\n } finally {\n if (_didIteratorError8) {\n throw _iteratorError8;\n }\n }\n }\n\n return true;\n}", "function validCommand() {\n console.log(\"\\n\" + \"Please enter a valid command from the following list:\");\n console.log(\"concert-this\");\n console.log(\"spotify-this-song\");\n console.log(\"movie-this\");\n console.log(\"do-what-it-says\" + \"\\n\");\n}", "hasCommand(commandName) {\n return !util_1.isUndefined(this.getCommand(commandName));\n }", "function findInput() {\n array = ['output', 'input', 'love'];\n return array.includes('input')\n}", "function is_write_command(command) {\n return /(pop)|(set)|(del)/i.test(command);\n}", "isCommandValid() {\n return (\n this.state.command.name === \"\" || this.state.command.queries.length < 2\n );\n }", "function checkCommand(e) {\n if (e.keyCode == 13) {\n var newCommand = $(this).val().split(\" \")[0];\n validateCommand(newCommand);\n $(this).val(\"\");\n } \n }", "isCommandEnabled(command) {\n var enabled = true;\n\n switch (command) {\n case \"open_in_folder_button\":\n if (gFolderDisplay.selectedCount != 1) {\n enabled = false;\n }\n break;\n case \"cmd_delete\":\n case \"cmd_shiftDelete\":\n case \"button_delete\":\n // this assumes that advanced searches don't cross accounts\n if (gFolderDisplay.selectedCount <= 0) {\n enabled = false;\n }\n break;\n case \"saveas_vf_button\":\n // need someway to see if there are any search criteria...\n return true;\n case \"cmd_selectAll\":\n return true;\n default:\n if (gFolderDisplay.selectedCount <= 0) {\n enabled = false;\n }\n break;\n }\n\n return enabled;\n }", "function validateCommand(command) {\n if (commandVerbs.indexOf(command) == -1) {\n doNotUnderstand();\n } else {\n getNewAdventure(command);\n }\n }", "isCommand(commandName) {\n return this.getCommand().name === commandName;\n }", "command(keys, exact = false) {\n \n // short-circuit check for exact\n if (exact && (keys.length !== this.pressed.length)) {\n return false\n }\n \n // check if all of our keys are pressed\n // short-circuits on failure\n for (let i = 0, ii = keys.length; i < ii; i++) {\n if (this.keys[keys[i]]) continue\n else return false\n }\n \n return true\n }", "function checkNewCommand() {\n \tconsole.log(\"Checking if command is valid.\");\n \tvar commandName = $(\"#addCommandName\").text().trim().toLowerCase();\n \tvar commandData = $(\"#addCommandData\").text().trim();\n \tvar commandPoints = Number($(\"#addCommandPoints\").text());\n \tvar commandUses = Number($(\"#addCommandUses\").text());\n \tvar repeat = document.getElementById(\"commandRepeatableChoice\").value\n \tvar commandRank = document.getElementById(\"rankChoiceAdd\").value;\n\n \tcommandName = commandName.replace(new RegExp(\"^[\\!]+\"), \"\").trim();\n \tif (commandName.length == 0 || commandName == \"!\") {\n \terrorMessageCommandModal(\"You must enter a command name!\", \"addCommandName\")\n \treturn\n \t} else {\n \tCommandHandle.findCommand(commandName).then(data => {\n \t\tif (data !== null) {\n \t\tconsole.log(\"The command \" + commandName + \" already exists\");\n \t\tdocument.getElementById(\"addCommandName\").classList.add(\"errorClass\");\n \t\tdocument.getElementById(\"errorMessageAdd\").innerHTML = \"This command already exists\";\n \t\treturn\n \t\t}\n \t})\n \t}\n \tresetMessageCommandModal(\"addCommandName\");\n\n \tif (commandData.length >= 255) {\n \t//max length is 255\n \terrorMessageCommandModal(\"This message is too long.\", \"addCommandData\");\n \treturn\n \t} else if (commandData.length == 0) {\n \terrorMessageCommandModal(\"You must type a message.\", \"addCommandData\");\n \treturn\n \t} else {\n \tcommandData = strip(commandData);\n \tresetMessageCommandModal(\"addCommandData\");\n \t}\n\n \tif (isNaN(commandPoints) == true) {\n \terrorMessageCommandModal(\"Points must be a number\", \"addCommandPoints\");\n \treturn\n \t} else if (Math.sign(parseFloat(commandPoints)) == -1) {\n \terrorMessageCommandModal(\"Cannot be negative\", \"addCommandPoints\");\n \treturn\n \t} else {\n \tresetMessageCommandModal(\"addCommandPoints\")\n \t}\n\n \tif (isNaN(commandUses) == true) {\n \terrorMessageCommandModal(\"Uses must be a number\", \"addCommandUses\");\n \treturn\n \t} else if (Math.sign(parseFloat(commandUses)) == -1) {\n \terrorMessageCommandModal(\"Cannot be negative\", \"addCommandUses\");\n \treturn\n \t} else {\n \tresetMessageCommandModal(\"addCommandUses\")\n \t}\n\n \tcommandData = commandData.replace(new RegExp(\"^[\\!]+\"), \"\").trim();\n\n \tif (repeat == \"false\") { repeat = false } else { repeat = true }\n\n \tconsole.log(commandName, commandData, commandPoints, commandUses, commandRank, null, repeat);\n \t//Adds a command to the DB\n \tCommandHandle.addCommand(commandName, null, commandData, commandUses, commandPoints, commandRank, null, repeat);\n \t//adds a row to the table with the new command info\n \taddCommandTable(commandName, commandData, commandUses, commandPoints, commandRank)\n \t$(\"#modalCart\").modal(\"hide\");\n\n \t// Shows an error in the modal\n \tfunction errorMessageCommandModal(message, errLocation) {\n \tvar addCommandName = document.getElementById(errLocation).parentElement;\n \tvar cmdErrorMessage = document.getElementById(\"errorMessageAdd\")\n \taddCommandName.classList.add(\"errorClass\");\n \tcmdErrorMessage.innerHTML = message;\n \tconsole.log(\"Command is not valid.\");\n \t}\n\n \t// resets the errors\n \tfunction resetMessageCommandModal(toBeReset) {\n \ttry {\n \t\tdocument.getElementById(toBeReset).parentElement.classList.remove(\"errorClass\");\n \t\tdocument.getElementById(\"errorMessageAdd\").innerHTML = \"\";\n \t} catch (error) {\n \t\tconsole.log(error);\n \t}\n \t}\n}", "function evaluateCmd(userInput) {\n //parses the user input to understand which command was typed\n const userInputArray = userInput.split(\" \");\n const command = userInputArray[0];\n\n switch (command) {\n case \"echo\":\n commandLibrary.echo(userInputArray.slice(1).join(\" \"));\n break;\n case \"cat\":\n commandLibrary.cat(userInputArray.slice(1));\n break;\n case \"head\":\n commandLibrary.head(userInputArray.slice(1));\n break;\n case \"tail\":\n commandLibrary.tail(userInputArray.slice(1));\n break;\n default:\n console.log('No such command found');\n }\n}", "function commandFinder(cmd) {\n\tvar activeCommands = JSON.parse(fs.readFileSync('./cmds.json', 'utf8'));\n\tvar splitInput = cmd.trim().split(\" \")\n\tfor (var i = 0; i < activeCommands.commands.length; i++) {\n\t\tif (activeCommands.commands[i].name.toLowerCase() == splitInput[0].toLowerCase()) {\n\t\t\tif (activeCommands.commands[i].name.toLowerCase() != \"exit\") {\n\t\t\t\tclearScreen();\n\t\t\t\trunScript(activeCommands.commands[i].file, function (err) {\n \t\t\t\tif (err) throw err;\n \t\t\t\t//clearScreen();\n \t\t\t\tconsole.log(`\\n-----------\\nThe ${activeCommands.commands[i].name} command has finished running.`);\n \t\t\t\taskForPrompt();\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log(\"\\nThe script has been terminated.\")\n\t\t\t\tprocess.exit()\n\t\t\t}\n\t\t}\n\t\tif (i + 1 == activeCommands.commands.length) {\n\t\t\tclearScreen()\n\t\t\tconsole.log(\"You didn't enter a valid command.\\nNeed help? Type in 'help' as your input.\\n\")\n\t\t\taskForPrompt()\n\t\t}\n\t}\n}", "function parseCommand(text){\n var words = text.split(\" \");\n for(var i=0; i < words.length; i++){\n if (words[i] in commandList){\n processCommand(words[i]);\n break;\n }\n }\n}", "runCmd() {\n switch(this.command) {\n case \"concert-this\":\n this.concertThis();\n break;\n case \"spotify-this-song\":\n this.spotifyThisSong();\n break;\n case \"movie-this\":\n this.movieThis();\n break;\n case \"do-what-it-says\":\n this.doWhatItSays();\n break;\n case undefined:\n this.usage();\n return false;\n default:\n console.log(`Unable to understand the command \"${this.command}\"\\n`);\n this.usage();\n return false;\n }\n\n return true;\n }", "function checkCommand(command) {\n\t\t/* premier check js pour certaine commandes like help */\n\t\tif (listeCommandes[command]['noserver'] == null) {\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: '/chats/checkCommand',\n\t\t\t\tdata: {message: input.val(), onglet: ongletActuel},\n\t\t\t\tsuccess: function(data) {\n\t\t\t\t\targsRun = data;\n\t\t\t\t\tlisteCommandes[command]['run']();\n\t\t\t\t},\n\t\t\t\tdataType: 'json'\n\t\t\t});\n\t\t} else {\n\t\t\targsRun = input.val();\n\t\t\tlisteCommandes[command]['noserver']();\n\t\t}\n\t}", "function validateInput(key){\n\t\treturn (valid.indexOf(key) > -1) && (expected.indexOf(key) > -1);\n\t}", "function cmd(str, msg) { //Function for commands.\n return msg.content.startsWith(prefix + str);\n}", "function commandValid(args) {\n if (args.length < 3) {\n return false;\n }\n if (!Array.isArray(args)) {\n return false;\n }\n return true;\n}", "checkLetter(keyClicked) {\r\n if (this.phrase.includes(keyClicked)) {\r\n console.log('Yeah bitch');\r\n return true;\r\n } else {\r\n console.log('No Bitch');\r\n return false;\r\n }\r\n }" ]
[ "0.7033517", "0.6786447", "0.6714409", "0.65853816", "0.6538311", "0.650227", "0.63899565", "0.6280926", "0.6191514", "0.60680556", "0.6061942", "0.60344607", "0.6002469", "0.5984184", "0.5972817", "0.5945315", "0.59247154", "0.58821195", "0.5809269", "0.57636255", "0.57066196", "0.5675339", "0.56722206", "0.565522", "0.563733", "0.56165475", "0.55609924", "0.5558802", "0.54971296", "0.54489636" ]
0.80050147
0
Create an HTML element to display a pink heart and add it to the HTML page. Return: HTML element with containing the heart
function createHeart() { var span = document.createElement('span') span.style.position = 'absolute' span.style.color = '#f52887' span.style.opacity = '0' Util.addChildren(span, '\u2665') document.body.appendChild(span) return span }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function heartHeartHeart() {\r\n document.body.appendChild(heartsHome);\r\n heartBlock(); \r\n }", "function createHeart(color) {\r\n const heart = document.createElement(\"div\");\r\n heart.className = \"heart\";\r\n heartsHome.appendChild(heart);\r\n heart.style.backgroundColor = color;\r\n }", "function render_heart_rate(heart_rate){\n const target = document.getElementById('heart-rate-text');\n var hr = heart_rate;\n if (target) {\n target.innerHTML = hr;\n if (hr > 120 || hr < 50) {\n get_location();\n };\n };\n}", "function drawHeart (index) {\n const offset = index * 40;\n\n noStroke();\n fill(255, 0, 0);\n ellipse(offset + 30, 60, 15, 15);\n ellipse(offset + 40, 60, 15, 15);\n triangle(offset + 23, 63, offset + 47, 63, offset + 35, 75);\n}", "function makeHeart(x,y,type){\n\ttype += '_heart';\n\treturn makePowerup(x,y,type,GAIN_HEALTH);\n}", "function drawLives()\n{\n offset = 0;\n push();\n \n fill(255, 0, 0);\n for(i = 0; i < lives; i++)\n {\n heart(width-150+offset, 20, 18);\n offset += 30; \n }\n pop();\n}", "function drawHeart(context, elem, xp, yp, wp, hp){\n let width = pc(wp, elem.width); \n let height = pc(hp, elem.height); \n let y = pc(yp, elem.height); \n let x = pc(xp, elem.width); \n let topCurveHeight = height * 0.3;\n context.moveTo(x, y + topCurveHeight);\n context.bezierCurveTo(x, y,x - width / 2, y,x - width / 2, y + topCurveHeight);\n context.bezierCurveTo(x - width / 2, y + (height + topCurveHeight) / 2, x, y + (height + topCurveHeight) / 2,x, y + height);\n context.bezierCurveTo(x, y + (height + topCurveHeight) / 2, x + width / 2, y + (height + topCurveHeight) / 2, x + width / 2, y + topCurveHeight);\n context.bezierCurveTo(x + width / 2, y, x, y,x, y + topCurveHeight);\n context.closePath();\n}", "function growingHearts()\n {\n var ox = 0\n var oy = 80\n\n var w = document.body.clientWidth - ox - 200\n var h = document.body.clientHeight - oy - 200\n\n var newInterval = Util.random(200, 2000)\n\n window.setInterval(function()\n {\n\n var heart = createHeart()\n heart.style.fontSize = '0%'\n heart.style.left = Util.random(ox, ox + w) + 'px'\n heart.style.top = Util.random(oy, oy + h) + 'px'\n\n var growInterval = Util.random(10, 50)\n var size = Util.random(200, 2000)\n var i = 0\n var id = window.setInterval(function()\n {\n i += 20\n heart.style.fontSize = i + '%'\n\n if (i < size / 2 ) {\n heart.style.opacity = '1'\n } else {\n heart.style.opacity = (1 - (2 * i - size) / size ) + ''\n }\n\n if (i >= size) {\n window.clearInterval(id)\n document.body.removeChild(heart)\n }\n }, growInterval)\n }, newInterval)\n }", "function risingHearts()\n {\n var ox = 0\n var oy = 80\n\n var w = document.body.clientWidth - ox - 200\n var h = document.body.clientHeight - oy - 200\n\n var newInterval = Util.random(200, 2000)\n\n window.setInterval(function()\n {\n var x = Util.random(ox, ox + w)\n var y = Util.random(oy + h - 100, oy + h)\n\n var heart = createHeart()\n heart.style.fontSize = Util.random(100, 2000) + '%'\n heart.style.left = x + 'px'\n heart.style.top = y + 'px'\n\n var riseInterval = Util.random(10, 50)\n var rise = Util.random(h / 4, h)\n var drift = Util.random(-1, 1)\n var i = 0\n var id = window.setInterval(function()\n {\n i++\n if (Util.random(1, 100) <= 1) {\n drift = (drift == Util.random(-1, 1) ? 1 : 0)\n }\n\n x = Math.min(Math.max(x + drift, ox), ox + w)\n\n heart.style.left = x + 'px'\n heart.style.top = (y - i) + 'px'\n\n if (i < rise / 4) {\n heart.style.opacity = (4 * i / rise) + ''\n } else if (i < rise / 2 ) {\n heart.style.opacity = '1'\n } else {\n heart.style.opacity = (1 - (2 * i - rise) / rise ) + ''\n }\n\n if (i >= rise) {\n window.clearInterval(id)\n document.body.removeChild(heart)\n }\n }, riseInterval)\n }, newInterval)\n }", "function Hearts(){\n\tvar life = document.createElement('img');\n\tlife.style.position = 'absolute';\n\tlife.height = 50;\n\tlife.width = 100;\n\tlife.style.top = 5 + '%';\n\tlife.style.left = 0 + '%';\n\tlife.src = \"../images/lifes.png\";\n\n\tvar heart0 = document.createElement('img');\n\theart0.id = 'heart0';\n\theart0.style.position = 'absolute';\n\theart0.height = 50;\n\theart0.width = 50;\n\theart0.style.top = 50 + 'px';\n\theart0.style.left = 10 + 'px';\n\theart0.src = \"../images/heart.png\"\n\n\tvar heart1 = document.createElement('img');\n\theart1.id = 'heart1';\n\theart1.style.position = 'absolute';\n\theart1.height = 50;\n\theart1.width = 50;\n\theart1.style.top = 50 + 'px';\n\theart1.style.left = 60 + 'px';\n\theart1.src = \"../images/heart.png\"\n\n\tvar heart2 = document.createElement('img');\n\theart2.id = 'heart2';\n\theart2.style.position = 'absolute';\n\theart2.height = 50;\n\theart2.width = 50;\n\theart2.style.top = 50 + 'px';\n\theart2.style.left = 110 + 'px';\n\theart2.src = \"../images/heart.png\"\n\n\tdocument.getElementById('hearts').appendChild(life);\n\tdocument.getElementById('hearts').appendChild(heart0);\n\tdocument.getElementById('hearts').appendChild(heart1);\n\tdocument.getElementById('hearts').appendChild(heart2);\n\n\t//create the image of the heart and the writing on top left of the screen\n}", "static get heartIconFilled() {\n const icon = 'data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTkuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDUwIDUwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MCA1MDsiIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSIxNnB4IiBoZWlnaHQ9IjE2cHgiPgo8cGF0aCBzdHlsZT0iZmlsbDojRDc1QTRBOyIgZD0iTTI0Ljg1LDEwLjEyNmMyLjAxOC00Ljc4Myw2LjYyOC04LjEyNSwxMS45OS04LjEyNWM3LjIyMywwLDEyLjQyNSw2LjE3OSwxMy4wNzksMTMuNTQzICBjMCwwLDAuMzUzLDEuODI4LTAuNDI0LDUuMTE5Yy0xLjA1OCw0LjQ4Mi0zLjU0NSw4LjQ2NC02Ljg5OCwxMS41MDNMMjQuODUsNDhMNy40MDIsMzIuMTY1Yy0zLjM1My0zLjAzOC01Ljg0LTcuMDIxLTYuODk4LTExLjUwMyAgYy0wLjc3Ny0zLjI5MS0wLjQyNC01LjExOS0wLjQyNC01LjExOUMwLjczNCw4LjE3OSw1LjkzNiwyLDEzLjE1OSwyQzE4LjUyMiwyLDIyLjgzMiw1LjM0MywyNC44NSwxMC4xMjZ6Ii8+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=';\n return icon;\n }", "static get heartIconLight() {\n const icon = 'data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTkuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDUxLjk5NyA1MS45OTciIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDUxLjk5NyA1MS45OTc7IiB4bWw6c3BhY2U9InByZXNlcnZlIiB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4Ij4KPGc+Cgk8cGF0aCBkPSJNNTEuOTExLDE2LjI0MkM1MS4xNTIsNy44ODgsNDUuMjM5LDEuODI3LDM3LjgzOSwxLjgyN2MtNC45MywwLTkuNDQ0LDIuNjUzLTExLjk4NCw2LjkwNSAgIGMtMi41MTctNC4zMDctNi44NDYtNi45MDYtMTEuNjk3LTYuOTA2Yy03LjM5OSwwLTEzLjMxMyw2LjA2MS0xNC4wNzEsMTQuNDE1Yy0wLjA2LDAuMzY5LTAuMzA2LDIuMzExLDAuNDQyLDUuNDc4ICAgYzEuMDc4LDQuNTY4LDMuNTY4LDguNzIzLDcuMTk5LDEyLjAxM2wxOC4xMTUsMTYuNDM5bDE4LjQyNi0xNi40MzhjMy42MzEtMy4yOTEsNi4xMjEtNy40NDUsNy4xOTktMTIuMDE0ICAgQzUyLjIxNiwxOC41NTMsNTEuOTcsMTYuNjExLDUxLjkxMSwxNi4yNDJ6IE00OS41MjEsMjEuMjYxYy0wLjk4NCw0LjE3Mi0zLjI2NSw3Ljk3My02LjU5LDEwLjk4NUwyNS44NTUsNDcuNDgxTDkuMDcyLDMyLjI1ICAgYy0zLjMzMS0zLjAxOC01LjYxMS02LjgxOC02LjU5Ni0xMC45OWMtMC43MDgtMi45OTctMC40MTctNC42OS0wLjQxNi00LjcwMWwwLjAxNS0wLjEwMUMyLjcyNSw5LjEzOSw3LjgwNiwzLjgyNiwxNC4xNTgsMy44MjYgICBjNC42ODcsMCw4LjgxMywyLjg4LDEwLjc3MSw3LjUxNWwwLjkyMSwyLjE4M2wwLjkyMS0yLjE4M2MxLjkyNy00LjU2NCw2LjI3MS03LjUxNCwxMS4wNjktNy41MTQgICBjNi4zNTEsMCwxMS40MzMsNS4zMTMsMTIuMDk2LDEyLjcyN0M0OS45MzgsMTYuNTcsNTAuMjI5LDE4LjI2NCw0OS41MjEsMjEuMjYxeiIgZmlsbD0iIzAwMDAwMCIvPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=';\n return icon;\n }", "function createHeart(){\n for (let i = 1; i <= numberofHeart; i++) {\n var imgHeart = document.createElement('img');\n imgHeart.src=\"./img/like.svg\";\n imgHeart.id =\"like\" + i;\n \n imgHeart.style=\"position:absolute;z-index:0;\"\n document.body.appendChild(imgHeart);\n }\n }", "function drawHeart(){ \n //draws a light white background behind the heart\n ctx.save();\n ctx.translate(canvas.width/2, canvas.height/2);\n ctx.fillStyle=\"rgba(255,255,255,.5)\";\n ctx.strokeStyle=\"rgba(255,255,255,1)\";\n \n ctx.lineWidth=5;\n ctx.beginPath();\n ctx.arc(0,0,180,0,2*Math.PI);\n ctx.shadowBlur=15;\n ctx.shadowColor=\"white\";\n \n if(invert){\n ctx.shadowColor=\"grey\";\n }\n \n ctx.stroke();\n ctx.fill();\n ctx.restore();\n \n //heart curves\n ctx.save();\n ctx.translate(canvas.width/2, canvas.height/2);\n ctx.fillStyle=\"#BE1E73\";\n ctx.strokeStyle= \"pink\";\n ctx.lineWidth= 3;\n ctx.beginPath();\n ctx.moveTo(0,-15);\n ctx.bezierCurveTo( 0,-45, -50,-45, -50, -15);\n ctx.bezierCurveTo( -50,15, 0,20, 0, 45 );\n ctx.bezierCurveTo( 0,20, 50,15, 50, -15 ); \n ctx.bezierCurveTo( 50,-45, 0,-45, 0, -15);\n ctx.closePath();\n ctx.fill();\n ctx.shadowBlur=8;\n ctx.shadowColor=\"white\";\n \n if(invert){\n ctx.shadowColor=\"grey\";\n }\n ctx.stroke();\n ctx.restore();\n }", "function heart(x, y, size) \n{\n x_pos = x;\n y_pos = y;\n beginShape();\n vertex(x_pos, y_pos);\n bezierVertex(x_pos - size / 2, y_pos - size / 2, x_pos - size, y_pos + size / 3, x_pos, y_pos + size);\n bezierVertex(x_pos + size, y_pos + size / 3, x_pos + size / 2, y_pos - size / 2, x_pos, y_pos);\n endShape(CLOSE);\n}", "function N() {\n M = document.createElement('canvas');\n // Ensure same dimensions\n M.width = W;\n M.height = H;\n m = M.getContext('2d');\n\n // This color is the one of the filled shape\n S(m,B);\n // Fill the mask\n m.fillRect(0, 0, W, H);\n m.globalCompositeOperation = 'xor';\n\n\n // heart\n m.beginPath();\n Z = W/2;\n h = H/3;\n P = Math.PI;\n m.moveTo(Z,H*.8);\n m.lineTo(Z-h-(h/7),h+(h/8));\n m.arc(Z-(h/2), h, h*.6,P-(P/8),0);\n m.arc(Z+(h/2),h,h*.6,P,P/8);\n m.closePath();\n m.fill();\n\n m.font = O+\"px Arial\";\n S(m,B);\n m.fillText(s,Z-((h*(s.length*.1))),h/.7);\n}", "function heartLine(k) {\r\n var k;\r\n for (i = 0; i< 10; i++) {\r\n i = i + k;\r\n var color\r\n switch (i%5) {\r\n case 0:\r\n color = \"#9b5de5\"; // Amethyst\r\n break;\r\n case 1:\r\n color = \"#f15bb5\"; // Magenta Crayola\r\n break;\r\n case 2:\r\n color = \"#fee440\"; // Minion Yellow\r\n break;\r\n case 3:\r\n color = \"#00bbf9\"; // Capri\r\n break;\r\n case 4:\r\n color = \"#00f5d4\"; // Sea Green Crayola\r\n break;\r\n \r\n default:\r\n break;\r\n }\r\n i = i - k;\r\n setTimeout(createHeart,500*i, color);\r\n\r\n }\r\n\r\n }", "function setHeartIcon () {\n var image = data.images ? data.images[data.index] : data.image;\n if (Saved.has(image)) {\n page.querySelector('.app-button.heart').classList.add('fav');\n } else {\n page.querySelector('.app-button.heart').classList.remove('fav');\n }\n }", "function paint()\n{\n\tvar newText = document.createTextNode(\"polysaccharide\");\n\tvar newElem = document.createElement(\"h3\");\n\tnewElem.appendChild( newText );\n\tdocument.getElementById(\"cooties\").appendChild(newElem);\n\n}", "function heartUpdate(item) {\n item.addEventListener('click', (e) => {\n if (e.target.classList.contains('red')) {\n e.target.innerText = '♡'\n e.target.classList.toggle(\"red\")\n e.target.classList.toggle(\"heart\")\n } else {\n e.target.innerText = '♥'\n e.target.classList.toggle(\"red\")\n e.target.classList.toggle(\"heart\")\n }\n })\n}", "function drawHeart(evt) {\n\tvar position = getMouseXY(evt);\n\tvar img = new Image();\n\timg.onload = function() {\n\t\tcontext.drawImage(img,position.x,position.y);\n\t}\n\timg.src = \"heart_picture.png\";\n}", "function generateFavoriteButton(user, story) {\n const isFavorite = user.isFavorite(story);\n const heartType = isFavorite ? 'fas' : 'far';\n\n return `<div class=\"favorite\">\n <i class=\"${heartType} fa-heart\"></i>\n </div>`;\n}", "function fav(heart){\n\tif (heart.src.includes(\"heart_filled\"))\n\t\theart.src = \"/resources/pics/heart.png\";\n\telse\n\t\theart.src = \"/resources/pics/heart_filled.png\";\n}", "function changeHeart() {\r\n var star = document.getElementById('heart');\r\n if (health === 4) {\r\n star.src = \"https://res.cloudinary.com/dytmcam8b/image/upload/v1561725918/virtual%20pet/l1.png\";\r\n }\r\n else if (health === 3) {\r\n star.src = \"https://res.cloudinary.com/dytmcam8b/image/upload/v1561725919/virtual%20pet/l2.png\";\r\n } else if (health === 2) {\r\n star.src = \"https://res.cloudinary.com/dytmcam8b/image/upload/v1561725919/virtual%20pet/l3.png\";\r\n } else if (health === 1) {\r\n star.src = \"https://res.cloudinary.com/dytmcam8b/image/upload/v1561725919/virtual%20pet/l4.png\";\r\n }\r\n }", "function heartDiamond(){\n let hrtX = bgLeft + 7000;\n imageMode(CENTER);\n image(heartImg, hrtX, heartD.y,heartD.size, heartD.size);\n hrtTouch(hrtX);\n}", "function createCard(task) {\n var heartedClass = null;\n if(task.hearted) {heartedClass = \"hearted\"}\n return `\n <div class=\"card-container\">\n <div id=\"${task._id}\" class=\"card\">\n <img class=\"screenshot\" src=\"${task.screenshotURL}\"/>\n <h2 class=\"title\">${task.title}</h2>\n <input readonly type=\"number\" value=\"${task.voteCount}\" class=\"vote-count\"></input>\n <span class=\"heart-holder\">\n <div class=\"heart icon ` + heartedClass + ` \" ></div>\n </span>\n </div>\n </div>`;\n}", "function generateHaiku() {\n // Make a DIV with the new sentence\n var expansion = cfree.getExpansion('<start>');\n expansion = expansion.replace(/%/g, '<br/>');\n var par = createP(expansion);\n par.class('text');\n}", "function loveProduct (){\n $('.product-love ').click(function(){\n $(this).toggleClass('heart')\n if($(this).hasClass('heart')){\n this.innerHTML = `<i class=\"fas fa-heart love\"></i>`\n }else{\n this.innerHTML = `<i class=\"far fa-heart love\"></i>`\n }\n })\n }", "createElement(type, innerHTML, colorHex) {\n var element = document.createElement(`span`)\n element.innerHTML = \" \" + innerHTML\n element.style.color = `#${colorHex}`\n element.classList.add(type)\n //Jesli to wiadomosc to uzywamy emotek\n if (type == 'message') $(element).emoticonize()\n return element\n }", "function paintFavouriteSeries() {\r\n let htmlCode = \"\";\r\n htmlCode += `<button class=\"card__list--button-reset js-reset\">Borrar todo</button>`;\r\n for (const favourite of arrayFavourites) {\r\n htmlCode += `<li class=\"section-favourites__cards\">`;\r\n htmlCode += `<div class=\"section-favourites__cards--item\" id=\"${favourite.id}\">`;\r\n htmlCode += `<h4 \"section-favourites__cards--title\">${favourite.name}</h4>`;\r\n htmlCode += `<img class=\"section-favourites__cards--img\"\r\n src=\"${favourite.image}\"\r\n title=\"${favourite.name}\"\r\n alt=\"${favourite.name}\"/>`;\r\n htmlCode += `<i class=\"section-favourites__cards--button js-remove gg-trash\" id=\"${favourite.id}\"></i>`;\r\n }\r\n htmlCode += `</div>`;\r\n htmlCode += `</li>`;\r\n favouritesElement.innerHTML = htmlCode;\r\n setInLocalStorage();\r\n listenSeriesEvents();\r\n listenFavouritesEvents();\r\n}" ]
[ "0.76339394", "0.742686", "0.6561861", "0.6505662", "0.6476186", "0.6309439", "0.62926173", "0.6253584", "0.62520117", "0.6244221", "0.62009877", "0.6122166", "0.6114754", "0.60292", "0.6018961", "0.59802157", "0.59791756", "0.58925426", "0.58808786", "0.581332", "0.5811368", "0.5798168", "0.57945263", "0.5778548", "0.5774479", "0.57631654", "0.5756979", "0.5702802", "0.5684964", "0.56624407" ]
0.8188092
0
Display growing hearts all over the page.
function growingHearts() { var ox = 0 var oy = 80 var w = document.body.clientWidth - ox - 200 var h = document.body.clientHeight - oy - 200 var newInterval = Util.random(200, 2000) window.setInterval(function() { var heart = createHeart() heart.style.fontSize = '0%' heart.style.left = Util.random(ox, ox + w) + 'px' heart.style.top = Util.random(oy, oy + h) + 'px' var growInterval = Util.random(10, 50) var size = Util.random(200, 2000) var i = 0 var id = window.setInterval(function() { i += 20 heart.style.fontSize = i + '%' if (i < size / 2 ) { heart.style.opacity = '1' } else { heart.style.opacity = (1 - (2 * i - size) / size ) + '' } if (i >= size) { window.clearInterval(id) document.body.removeChild(heart) } }, growInterval) }, newInterval) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function risingHearts()\n {\n var ox = 0\n var oy = 80\n\n var w = document.body.clientWidth - ox - 200\n var h = document.body.clientHeight - oy - 200\n\n var newInterval = Util.random(200, 2000)\n\n window.setInterval(function()\n {\n var x = Util.random(ox, ox + w)\n var y = Util.random(oy + h - 100, oy + h)\n\n var heart = createHeart()\n heart.style.fontSize = Util.random(100, 2000) + '%'\n heart.style.left = x + 'px'\n heart.style.top = y + 'px'\n\n var riseInterval = Util.random(10, 50)\n var rise = Util.random(h / 4, h)\n var drift = Util.random(-1, 1)\n var i = 0\n var id = window.setInterval(function()\n {\n i++\n if (Util.random(1, 100) <= 1) {\n drift = (drift == Util.random(-1, 1) ? 1 : 0)\n }\n\n x = Math.min(Math.max(x + drift, ox), ox + w)\n\n heart.style.left = x + 'px'\n heart.style.top = (y - i) + 'px'\n\n if (i < rise / 4) {\n heart.style.opacity = (4 * i / rise) + ''\n } else if (i < rise / 2 ) {\n heart.style.opacity = '1'\n } else {\n heart.style.opacity = (1 - (2 * i - rise) / rise ) + ''\n }\n\n if (i >= rise) {\n window.clearInterval(id)\n document.body.removeChild(heart)\n }\n }, riseInterval)\n }, newInterval)\n }", "function countHearts() {\n\t\t$(\"#hearts\").html(\"\");\n\t\tfor (let i = 0; i < fullHearts; i++) {\n\t\t\t$(\"#hearts\").append('#');\n\t\t}\n\t\tfor (let j = 0; j < emptyHearts; j++) {\n\t\t\t$(\"#hearts\").append('*');\n\t\t}\n\n\t}", "function updateHearts() {\n const lives = document.getElementById('lives');\n lives.innerHTML = '';\n numHearts = maxGuesses - missedGuesses;\n for (i = 0; i < numHearts; i++) {\n lives.insertAdjacentHTML('beforeend', liveHeartTemplate);\n }\n for (i = 0; i < missedGuesses; i++) {\n lives.insertAdjacentHTML('beforeend', lostHeartTemplate);\n }\n}", "function displayHearts() {\n\tdocument.getElementById(\"heart5\").hidden = false;\n\tdocument.getElementById(\"heart4\").hidden = false;\n\tdocument.getElementById(\"heart3\").hidden = false;\n\tdocument.getElementById(\"heart2\").hidden = false;\n\tdocument.getElementById(\"heart1\").hidden = false;\n\t\n\tif( health === 4) {\n\t\tdocument.getElementById(\"heart5\").hidden = true;\n\t\t\n\t}\n\t\n\tif( health === 3) {\n\t\tdocument.getElementById(\"heart5\").hidden = true;\n\t\tdocument.getElementById(\"heart4\").hidden = true;\n\t\t\n\t}\n\t\n\tif( health === 2) {\n\t\n\t\tdocument.getElementById(\"heart5\").hidden = true;\n\t\tdocument.getElementById(\"heart4\").hidden = true;\n\t\tdocument.getElementById(\"heart3\").hidden = true;\n\t\t\n\t\t\n\t\t\n\t}\n\t\n\tif( health === 1) {\n\t\tdocument.getElementById(\"heart5\").hidden = true;\n\t\tdocument.getElementById(\"heart4\").hidden = true;\n\t\tdocument.getElementById(\"heart3\").hidden = true;\n\t\tdocument.getElementById(\"heart2\").hidden = true;\n\t\t\n\t\t\n\t}\n\t\n\tif( health === 0) {\n\t\tdocument.getElementById(\"heart5\").hidden = true;\n\t\tdocument.getElementById(\"heart4\").hidden = true;\n\t\tdocument.getElementById(\"heart3\").hidden = true;\n\t\tdocument.getElementById(\"heart2\").hidden = true;\n\t\tdocument.getElementById(\"heart1\").hidden = true;\n\t\t\n\t}\n}", "function hearts() {\n ctx.font = \"20px Times New Roman\";\n //number of lives and location of the lives tab\n ctx.fillText(\"Level: \"+lives, 8, 20);\n}", "function heartHeartHeart() {\r\n document.body.appendChild(heartsHome);\r\n heartBlock(); \r\n }", "function animateHeart(){\n if(stepAnimateHeart == 120){\n stepAnimateHeart--;\n }\n for (let i = 1; i <= numberofHeart; i++) {\n $('#like' + i).width(stepAnimateHeart*0.15); \n }\n if(stepAnimateHeart == 0){\n stepAnimateHeart++;\n }\n stepAnimateHeart++;\n requestAnimationFrame(animateHeart);\n }", "function drawLives()\n{\n offset = 0;\n push();\n \n fill(255, 0, 0);\n for(i = 0; i < lives; i++)\n {\n heart(width-150+offset, 20, 18);\n offset += 30; \n }\n pop();\n}", "function addHearts(){\n $(\"#livesLeft\").empty();\n for(i=0;i<lives; i++){\n $(\"#livesLeft\").append('<img src=\"images/heart.png\" class=\"lifesize\">');\n }\n }", "function drawLives() {\n\tfor (var i = 0; i < max_lives; i++) {\n\t\tif (i < lives) {\n\t\t\theart[i].style.visibility=\"visible\";\n\t\t}\n\t\telse {\n\t\t\theart[i].style.visibility=\"hidden\";\n\t\t}\n\t}\n}", "function Hearts(){\n\tvar life = document.createElement('img');\n\tlife.style.position = 'absolute';\n\tlife.height = 50;\n\tlife.width = 100;\n\tlife.style.top = 5 + '%';\n\tlife.style.left = 0 + '%';\n\tlife.src = \"../images/lifes.png\";\n\n\tvar heart0 = document.createElement('img');\n\theart0.id = 'heart0';\n\theart0.style.position = 'absolute';\n\theart0.height = 50;\n\theart0.width = 50;\n\theart0.style.top = 50 + 'px';\n\theart0.style.left = 10 + 'px';\n\theart0.src = \"../images/heart.png\"\n\n\tvar heart1 = document.createElement('img');\n\theart1.id = 'heart1';\n\theart1.style.position = 'absolute';\n\theart1.height = 50;\n\theart1.width = 50;\n\theart1.style.top = 50 + 'px';\n\theart1.style.left = 60 + 'px';\n\theart1.src = \"../images/heart.png\"\n\n\tvar heart2 = document.createElement('img');\n\theart2.id = 'heart2';\n\theart2.style.position = 'absolute';\n\theart2.height = 50;\n\theart2.width = 50;\n\theart2.style.top = 50 + 'px';\n\theart2.style.left = 110 + 'px';\n\theart2.src = \"../images/heart.png\"\n\n\tdocument.getElementById('hearts').appendChild(life);\n\tdocument.getElementById('hearts').appendChild(heart0);\n\tdocument.getElementById('hearts').appendChild(heart1);\n\tdocument.getElementById('hearts').appendChild(heart2);\n\n\t//create the image of the heart and the writing on top left of the screen\n}", "showEggs() {\n this.UpdatePoppedEggCount();\n }", "function drawHeart (index) {\n const offset = index * 40;\n\n noStroke();\n fill(255, 0, 0);\n ellipse(offset + 30, 60, 15, 15);\n ellipse(offset + 40, 60, 15, 15);\n triangle(offset + 23, 63, offset + 47, 63, offset + 35, 75);\n}", "function displayLives(numLives) {\n var lives = $(\"#livesHearts\")\n lives.empty()\n var lifeElement = \"<i class='material-icons'>favorite</i>\"\n for (var i = 0; i < numLives; i++) {\n lives.append($(lifeElement))\n }\n }", "function showHighscores() {\n statsEl.style.display = \"none\";\n highscoresEl.style.display = \"flex\";\n for (let i = 0; i < highscores.length; i++) {\n let entry = document.createElement(\"span\");\n entry.textContent = (i + 1) + \". \" + highscores[i];\n highscoresBox.appendChild(entry);\n }\n}", "display() {\n // Lerp to proper colors\n if (blackStarfield) {\n this.alpha = 127;\n this.bg = color(0);\n this.color = color(255);\n } else {\n this.alpha = lerp(this.alpha, curLevel.alpha, STARFIELD_LERP);\n this.bg = lerpColor(this.bg, color(curLevel.bg), STARFIELD_LERP);\n this.color = lerpColor(this.color, color(curLevel.color), STARFIELD_LERP);\n }\n\n // Skip rendering stars if low graphics mode\n if (!showStars) return;\n\n // Render stars\n for (let i = 0; i < this.stars.length; i++) {\n let s = this.stars[i];\n\n // Render star\n this.color.setAlpha(this.alpha * noise(s.noise));\n fill(this.color);\n noStroke();\n ellipse(s.x, s.y, s.r, s.r);\n\n // Update position\n if (!paused) {\n s.y += s.dy * dt();\n if (s.y - s.r > height) {\n s.r = random(2);\n s.x = random(width);\n s.y = 0;\n s.dy = random(this.speed);\n }\n }\n\n // Update noise\n s.noise += s.deltaNoise;\n }\n }", "function displayFish(fish) {\n push();\n fish.r = random(0,200);\n fish.g = random(0,200);\n fish.b = random(0,200);\n\n if(!fish.eaten) {\n fill(fish.r, fish.g, fish.b);\n noStroke();\n ellipse(fish.x, fish.y, fish.size);\n }\n\n pop();\n}", "function showMoreHighScores() {\n\n // Remove the See More Option\n UI.displaySeeMore(false);\n\n // Show all the high scores \n UI.displayHighScores(highScoreConfig.total);\n\n // Add the See Less Option\n UI.displaySeeLess(true);\n}", "reduceHearts() {\n const activeHeart = \"rgb(232, 9, 9)\";\n const lostHeart = \"rgb(232, 232, 232)\";\n if ($(\"#heart1\").css(\"color\") == activeHeart) {\n $(\"#heart1\").css(\"color\", lostHeart);\n }\n else if ( $(\"#heart2\").css(\"color\") == activeHeart) {\n $(\"#heart2\").css(\"color\", lostHeart);\n }\n else if ($(\"#heart3\").css(\"color\") == activeHeart) {\n $(\"#heart3\").css(\"color\", lostHeart);\n gameOver();\n }\n }", "function drawHen() {\n for (let i = 0; i < hens.length; i++) {\n let hen = hens[i];\n let image = currentHenImage;\n\n if (hen.dead) {\n image = 'img/chicken/hen_dead.png';\n }\n\n addBackgroundobject(image, hen.position_x, bg_ground, hen.position_y, hen.scale, 1);\n }\n}", "function showHighScores() {\n display.set(\"highScores\").show();\n }", "function dispStars() {\n let starsOnPage = generateStars();\n document.querySelector('.stars').innerHTML = starsOnPage;\n}", "function render_heart_rate(heart_rate){\n const target = document.getElementById('heart-rate-text');\n var hr = heart_rate;\n if (target) {\n target.innerHTML = hr;\n if (hr > 120 || hr < 50) {\n get_location();\n };\n };\n}", "function renderHealth() {\n let playerHealth = document.getElementById(\"playerHealth\")\n let enemyHealth = document.getElementById(\"enemyHealth\")\n let buckName = document.getElementById(\"buckName\")\n let enemyName = document.getElementById(\"enemyName\")\n // Remove all playerHearts\n while (playerHealth.firstChild) {\n playerHealth.removeChild(playerHealth.lastChild);\n }\n // Render PlayerHearts\n for (let i = 0; i < playerHearts; i++) {\n let img = document.createElement(\"img\")\n img.src = \"assets/heart.png\"\n playerHealth.appendChild(img)\n\n // Render \"Buck's Health:\" text\n buckName.innerHTML = \"Buck's Health\"\n }\n // Remove all enemyHearts\n while (enemyHealth.firstChild) {\n enemyHealth.removeChild(enemyHealth.lastChild);\n }\n // Render enemyHearts\n for (let i = 0; i < enemyHearts; i++) {\n let img = document.createElement(\"img\")\n img.src = \"assets/heart.png\"\n enemyHealth.appendChild(img)\n\n // Render \"Enemies Health:\" text\n enemyName.innerHTML = \"Enemies Health\"\n }\n}", "function InventoryItemMouthFuturisticHarnessPanelGagDraw() {\n\tInventoryItemMouthFuturisticPanelGagDraw();\n}", "makingHungry() {\n let calories = get('#calories > span');\n if (this.calories > 199)\n this.calories -= 200;\n else\n this.calories = 0;\n calories.innerHTML = this.calories;\n }", "function update_life() {\n leven = leven - 1;\n if (leven < 0) {\n leven = 0;\n } else {\n leven_span.text(leven);\n }\n }", "display() {\n if (this.health > 0) {\n push();\n noStroke();\n fill(this.fillColor);\n this.radius = this.health;\n ellipse(this.x, this.y, this.radius * 2);\n image(this.image, this.x, this.y, this.radius, this.radius);\n pop();\n } else {\n var removed = hunterList.splice(this.index, 1);\n }\n }", "display() {\n super.display();\n //Displays rock\n push();\n noStroke();\n fill(this.baseColor.r, this.baseColor.g, this.baseColor.b);\n ellipse(this.x, this.y, this.width,this.height);\n pop();\n }", "refreshing(heal) {\n this.newLine();\n this.player.health += Number(heal);\n console.log(\"Ah, refreshing.\");\n }" ]
[ "0.7028781", "0.69954866", "0.6911459", "0.67804664", "0.66451013", "0.66191816", "0.65603215", "0.6518552", "0.6307231", "0.6275858", "0.62382776", "0.61654353", "0.61185664", "0.60795075", "0.6067219", "0.59611285", "0.5948496", "0.59225917", "0.591076", "0.58987635", "0.5892848", "0.588518", "0.58671933", "0.5840471", "0.5837398", "0.5818222", "0.5802816", "0.5794954", "0.5793289", "0.5773033" ]
0.7471282
0
Display hearts rising across the page
function risingHearts() { var ox = 0 var oy = 80 var w = document.body.clientWidth - ox - 200 var h = document.body.clientHeight - oy - 200 var newInterval = Util.random(200, 2000) window.setInterval(function() { var x = Util.random(ox, ox + w) var y = Util.random(oy + h - 100, oy + h) var heart = createHeart() heart.style.fontSize = Util.random(100, 2000) + '%' heart.style.left = x + 'px' heart.style.top = y + 'px' var riseInterval = Util.random(10, 50) var rise = Util.random(h / 4, h) var drift = Util.random(-1, 1) var i = 0 var id = window.setInterval(function() { i++ if (Util.random(1, 100) <= 1) { drift = (drift == Util.random(-1, 1) ? 1 : 0) } x = Math.min(Math.max(x + drift, ox), ox + w) heart.style.left = x + 'px' heart.style.top = (y - i) + 'px' if (i < rise / 4) { heart.style.opacity = (4 * i / rise) + '' } else if (i < rise / 2 ) { heart.style.opacity = '1' } else { heart.style.opacity = (1 - (2 * i - rise) / rise ) + '' } if (i >= rise) { window.clearInterval(id) document.body.removeChild(heart) } }, riseInterval) }, newInterval) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countHearts() {\n\t\t$(\"#hearts\").html(\"\");\n\t\tfor (let i = 0; i < fullHearts; i++) {\n\t\t\t$(\"#hearts\").append('#');\n\t\t}\n\t\tfor (let j = 0; j < emptyHearts; j++) {\n\t\t\t$(\"#hearts\").append('*');\n\t\t}\n\n\t}", "function hearts() {\n ctx.font = \"20px Times New Roman\";\n //number of lives and location of the lives tab\n ctx.fillText(\"Level: \"+lives, 8, 20);\n}", "function displayHearts() {\n\tdocument.getElementById(\"heart5\").hidden = false;\n\tdocument.getElementById(\"heart4\").hidden = false;\n\tdocument.getElementById(\"heart3\").hidden = false;\n\tdocument.getElementById(\"heart2\").hidden = false;\n\tdocument.getElementById(\"heart1\").hidden = false;\n\t\n\tif( health === 4) {\n\t\tdocument.getElementById(\"heart5\").hidden = true;\n\t\t\n\t}\n\t\n\tif( health === 3) {\n\t\tdocument.getElementById(\"heart5\").hidden = true;\n\t\tdocument.getElementById(\"heart4\").hidden = true;\n\t\t\n\t}\n\t\n\tif( health === 2) {\n\t\n\t\tdocument.getElementById(\"heart5\").hidden = true;\n\t\tdocument.getElementById(\"heart4\").hidden = true;\n\t\tdocument.getElementById(\"heart3\").hidden = true;\n\t\t\n\t\t\n\t\t\n\t}\n\t\n\tif( health === 1) {\n\t\tdocument.getElementById(\"heart5\").hidden = true;\n\t\tdocument.getElementById(\"heart4\").hidden = true;\n\t\tdocument.getElementById(\"heart3\").hidden = true;\n\t\tdocument.getElementById(\"heart2\").hidden = true;\n\t\t\n\t\t\n\t}\n\t\n\tif( health === 0) {\n\t\tdocument.getElementById(\"heart5\").hidden = true;\n\t\tdocument.getElementById(\"heart4\").hidden = true;\n\t\tdocument.getElementById(\"heart3\").hidden = true;\n\t\tdocument.getElementById(\"heart2\").hidden = true;\n\t\tdocument.getElementById(\"heart1\").hidden = true;\n\t\t\n\t}\n}", "function drawHeart (index) {\n const offset = index * 40;\n\n noStroke();\n fill(255, 0, 0);\n ellipse(offset + 30, 60, 15, 15);\n ellipse(offset + 40, 60, 15, 15);\n triangle(offset + 23, 63, offset + 47, 63, offset + 35, 75);\n}", "function drawLives()\n{\n offset = 0;\n push();\n \n fill(255, 0, 0);\n for(i = 0; i < lives; i++)\n {\n heart(width-150+offset, 20, 18);\n offset += 30; \n }\n pop();\n}", "function growingHearts()\n {\n var ox = 0\n var oy = 80\n\n var w = document.body.clientWidth - ox - 200\n var h = document.body.clientHeight - oy - 200\n\n var newInterval = Util.random(200, 2000)\n\n window.setInterval(function()\n {\n\n var heart = createHeart()\n heart.style.fontSize = '0%'\n heart.style.left = Util.random(ox, ox + w) + 'px'\n heart.style.top = Util.random(oy, oy + h) + 'px'\n\n var growInterval = Util.random(10, 50)\n var size = Util.random(200, 2000)\n var i = 0\n var id = window.setInterval(function()\n {\n i += 20\n heart.style.fontSize = i + '%'\n\n if (i < size / 2 ) {\n heart.style.opacity = '1'\n } else {\n heart.style.opacity = (1 - (2 * i - size) / size ) + ''\n }\n\n if (i >= size) {\n window.clearInterval(id)\n document.body.removeChild(heart)\n }\n }, growInterval)\n }, newInterval)\n }", "function displayFish(fish) {\n push();\n fish.r = random(0,200);\n fish.g = random(0,200);\n fish.b = random(0,200);\n\n if(!fish.eaten) {\n fill(fish.r, fish.g, fish.b);\n noStroke();\n ellipse(fish.x, fish.y, fish.size);\n }\n\n pop();\n}", "display() {\n super.display();\n //Displays rock\n push();\n noStroke();\n fill(this.baseColor.r, this.baseColor.g, this.baseColor.b);\n ellipse(this.x, this.y, this.width,this.height);\n pop();\n }", "reduceHearts() {\n const activeHeart = \"rgb(232, 9, 9)\";\n const lostHeart = \"rgb(232, 232, 232)\";\n if ($(\"#heart1\").css(\"color\") == activeHeart) {\n $(\"#heart1\").css(\"color\", lostHeart);\n }\n else if ( $(\"#heart2\").css(\"color\") == activeHeart) {\n $(\"#heart2\").css(\"color\", lostHeart);\n }\n else if ($(\"#heart3\").css(\"color\") == activeHeart) {\n $(\"#heart3\").css(\"color\", lostHeart);\n gameOver();\n }\n }", "function heartHeartHeart() {\r\n document.body.appendChild(heartsHome);\r\n heartBlock(); \r\n }", "function updateHearts() {\n const lives = document.getElementById('lives');\n lives.innerHTML = '';\n numHearts = maxGuesses - missedGuesses;\n for (i = 0; i < numHearts; i++) {\n lives.insertAdjacentHTML('beforeend', liveHeartTemplate);\n }\n for (i = 0; i < missedGuesses; i++) {\n lives.insertAdjacentHTML('beforeend', lostHeartTemplate);\n }\n}", "function drawHands(){\n\n //draw seconds' hand\n push();\n rotate(secondAngle); \n stroke(255,0,0);\n strokeWeight(6);\n line(0,0,100,0);\n pop();\n\n //draw minutes' hand\n push();\n rotate(minuteAngle);\n stroke(0,255,0);\n strokeWeight(6);\n line(0,0,75,0);\n pop();\n\n //draw hours' hand\n push();\n rotate(hourAngle);\n stroke(0,0,255);\n strokeWeight(6);\n line(0,0,50,0);\n pop();\n}", "function render_heart_rate(heart_rate){\n const target = document.getElementById('heart-rate-text');\n var hr = heart_rate;\n if (target) {\n target.innerHTML = hr;\n if (hr > 120 || hr < 50) {\n get_location();\n };\n };\n}", "function animateHeart(){\n if(stepAnimateHeart == 120){\n stepAnimateHeart--;\n }\n for (let i = 1; i <= numberofHeart; i++) {\n $('#like' + i).width(stepAnimateHeart*0.15); \n }\n if(stepAnimateHeart == 0){\n stepAnimateHeart++;\n }\n stepAnimateHeart++;\n requestAnimationFrame(animateHeart);\n }", "function Hearts(){\n\tvar life = document.createElement('img');\n\tlife.style.position = 'absolute';\n\tlife.height = 50;\n\tlife.width = 100;\n\tlife.style.top = 5 + '%';\n\tlife.style.left = 0 + '%';\n\tlife.src = \"../images/lifes.png\";\n\n\tvar heart0 = document.createElement('img');\n\theart0.id = 'heart0';\n\theart0.style.position = 'absolute';\n\theart0.height = 50;\n\theart0.width = 50;\n\theart0.style.top = 50 + 'px';\n\theart0.style.left = 10 + 'px';\n\theart0.src = \"../images/heart.png\"\n\n\tvar heart1 = document.createElement('img');\n\theart1.id = 'heart1';\n\theart1.style.position = 'absolute';\n\theart1.height = 50;\n\theart1.width = 50;\n\theart1.style.top = 50 + 'px';\n\theart1.style.left = 60 + 'px';\n\theart1.src = \"../images/heart.png\"\n\n\tvar heart2 = document.createElement('img');\n\theart2.id = 'heart2';\n\theart2.style.position = 'absolute';\n\theart2.height = 50;\n\theart2.width = 50;\n\theart2.style.top = 50 + 'px';\n\theart2.style.left = 110 + 'px';\n\theart2.src = \"../images/heart.png\"\n\n\tdocument.getElementById('hearts').appendChild(life);\n\tdocument.getElementById('hearts').appendChild(heart0);\n\tdocument.getElementById('hearts').appendChild(heart1);\n\tdocument.getElementById('hearts').appendChild(heart2);\n\n\t//create the image of the heart and the writing on top left of the screen\n}", "function displayReaction(){\n var name;\n var currentX = horizontalBuffer;\n var currentY = verticalBuffer;\n currentX = currentX + setInitialXCoor(countSubstrates);\n drawSubstrates(currentX, currentY);\n\n currentY = currentY + objectHeight + verticalBuffer * 2; //for version with downwards arrow\n currentX = canvas1.width / 2; //for version with downwards arrow\n name = checkedEnzsNames[0];\n drawDownArrow(currentX, currentY, name);\n\n currentX = horizontalBuffer;\n currentY = verticalBuffer * 5 + objectHeight * 2;\n currentX = currentX + setInitialXCoor(countProducts);\n drawProducts(currentX, currentY);\n}", "function livesCounter(brokenHearts){\n if(brokenHearts === 0){\n //5 hearts on screen\n image(img, imgCoord.x -200, imgCoord.y, imgCoord.size, imgCoord.size2);\n image(img, imgCoord.x -100, imgCoord.y, imgCoord.size, imgCoord.size2);\n image(img, imgCoord.x, imgCoord.y, imgCoord.size, imgCoord.size2);\n image(img, imgCoord.x +100, imgCoord.y, imgCoord.size, imgCoord.size2);\n image(img, imgCoord.x +200, imgCoord.y, imgCoord.size, imgCoord.size2);\n } else if (brokenHearts === 1){\n //4 hearts on screen\n image(img, imgCoord.x -200, imgCoord.y, imgCoord.size, imgCoord.size2);\n image(img, imgCoord.x -100, imgCoord.y, imgCoord.size, imgCoord.size2);\n image(img, imgCoord.x, imgCoord.y, imgCoord.size, imgCoord.size2);\n image(img, imgCoord.x +100, imgCoord.y, imgCoord.size, imgCoord.size2);\n } else if (brokenHearts === 2){\n //3 hearts on screen\n image(img, imgCoord.x -200, imgCoord.y, imgCoord.size, imgCoord.size2);\n image(img, imgCoord.x -100, imgCoord.y, imgCoord.size, imgCoord.size2);\n image(img, imgCoord.x, imgCoord.y, imgCoord.size, imgCoord.size2);\n } else if (brokenHearts === 3){\n //2 hearts on screen\n image(img, imgCoord.x -200, imgCoord.y, imgCoord.size, imgCoord.size2);\n image(img, imgCoord.x -100, imgCoord.y, imgCoord.size, imgCoord.size2);\n } else if (brokenHearts === 4){\n //1 hearts on screen\n image(img, imgCoord.x -200, imgCoord.y, imgCoord.size, imgCoord.size2);\n } else if (brokenHearts === 5){\n //0 hearts on screen, finishes game\n state = 'ending';\n }\n}", "display() {\n // Lerp to proper colors\n if (blackStarfield) {\n this.alpha = 127;\n this.bg = color(0);\n this.color = color(255);\n } else {\n this.alpha = lerp(this.alpha, curLevel.alpha, STARFIELD_LERP);\n this.bg = lerpColor(this.bg, color(curLevel.bg), STARFIELD_LERP);\n this.color = lerpColor(this.color, color(curLevel.color), STARFIELD_LERP);\n }\n\n // Skip rendering stars if low graphics mode\n if (!showStars) return;\n\n // Render stars\n for (let i = 0; i < this.stars.length; i++) {\n let s = this.stars[i];\n\n // Render star\n this.color.setAlpha(this.alpha * noise(s.noise));\n fill(this.color);\n noStroke();\n ellipse(s.x, s.y, s.r, s.r);\n\n // Update position\n if (!paused) {\n s.y += s.dy * dt();\n if (s.y - s.r > height) {\n s.r = random(2);\n s.x = random(width);\n s.y = 0;\n s.dy = random(this.speed);\n }\n }\n\n // Update noise\n s.noise += s.deltaNoise;\n }\n }", "function drawLives() {\n\tfor (var i = 0; i < max_lives; i++) {\n\t\tif (i < lives) {\n\t\t\theart[i].style.visibility=\"visible\";\n\t\t}\n\t\telse {\n\t\t\theart[i].style.visibility=\"hidden\";\n\t\t}\n\t}\n}", "function drawHiker(x, y) {\n fill(backpackColor[i]); // backpack\n rect(x - 10, y + 10, HIKER_WIDTH, HIKER_HEIGHT / 2);\n fill(skinColor[i]); // skin\n rect(x, y, HIKER_WIDTH, HIKER_HEIGHT);\n fill(shirtColor[i]); // shirt\n rect(x, y + 12, HIKER_WIDTH, HIKER_HEIGHT - 15);\n fill(PANT_COLOR); // pants\n rect(x, y + 25, HIKER_WIDTH, HIKER_HEIGHT / 2);\n fill(hairColor[i]); // hair\n rect(x, y - 5, HIKER_WIDTH, HIKER_HEIGHT / 10);\n\n // adds long hair for every other hiker\n if (i % 2 == 1) {\n rect(x, y - 5, 5, 25);\n }\n}", "function addHearts(){\n $(\"#livesLeft\").empty();\n for(i=0;i<lives; i++){\n $(\"#livesLeft\").append('<img src=\"images/heart.png\" class=\"lifesize\">');\n }\n }", "function drawSmileFace() {\n\tdrawHead();\n\tdrawEyes();\n\tdrawSmile();\n}", "function drawLeftStars(num) {\n var str = '';\n for(var i = 0; i < num; i++) {\n str = str + \"*\";\n }\n for(var i = num; i < 75; i++) {\n str += \" \";\n }\n return str;\n}", "render() {\r\n if (this.cardSuit === heart || this.cardSuit === gem) {\r\n faceOfCard.style.color = '#f00a47'; // red\r\n faceOfCard.style.border = '5px solid #f00a47';\r\n } else {\r\n faceOfCard.style.color = '#05ccf0'; // blue\r\n faceOfCard.style.border = '5px solid #05ccf0';\r\n }\r\n\r\n faceOfCard.innerHTML = `\r\n <h1>${this.cardNumber}</h1>\r\n <i class=\"${this.cardSuit}\"></i>\r\n `;\r\n }", "show()\n\t{\n\t\tif(mode == 1)\n\t\t{\n\t\t\tif(score >= 105)\n\t\t\t{\n\t\t\t\tstroke(255);\n\n\t\t\t\tif (score >= 120)\n\t\t\t\t{\n\t\t\t\t\tstrokeWeight(1);\n\n\t\t\t\t\tif(score >= 135)\n\t\t\t\t\t{\n\t\t\t\t\t\tstrokeWeight(0.1);\n\t\t\t\t\t\tif(score >= 150)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnoStroke();\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\telse if(mode == 2)\n\t\t{\n\t\t\tif(score >= 70)\n\t\t\t{\n\t\t\t\tstroke(255);\n\n\t\t\t\tif (score >= 80)\n\t\t\t\t{\n\t\t\t\t\tstrokeWeight(1);\n\n\t\t\t\t\tif(score >= 90)\n\t\t\t\t\t{\n\t\t\t\t\t\tstrokeWeight(0.1);\n\t\t\t\t\t\tif(score >= 100)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnoStroke();\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\telse\n\t\t{\n\t\t\tif(score >= 35)\n\t\t\t{\n\t\t\t\tstroke(255);\n\n\t\t\t\tif (score >= 40)\n\t\t\t\t{\n\t\t\t\t\tstrokeWeight(1);\n\n\t\t\t\t\tif(score >= 45)\n\t\t\t\t\t{\n\t\t\t\t\t\tstrokeWeight(0.1);\n\t\t\t\t\t\tif(score >= 50)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnoStroke();\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\tfill(this.fadeR, this.fadeG, this.fadeB);\n\t\tellipse(this.x, this.y, this.r * 2);\n\t}", "function createHeart()\n {\n var span = document.createElement('span')\n\n span.style.position = 'absolute'\n span.style.color = '#f52887'\n span.style.opacity = '0'\n Util.addChildren(span, '\\u2665')\n\n document.body.appendChild(span)\n return span\n }", "function showLives(){\n if(livesCounter == 3){\n image(heartLivesImg, 50, 65, 25,25);\n image(heartLivesImg, 80, 65, 25,25);\n image(heartLivesImg, 110, 65, 25,25);\n }\n else if (livesCounter == 2){\n image(heartLivesImg, 50, 65, 25,25);\n image(heartLivesImg, 80, 65, 25,25);\n }\n else if(livesCounter == 1){\n image(heartLivesImg, 50, 65, 25,25);\n }\n else if(livesCounter == 0) {\n image(transparentImg, 50, 65, 25,25);\n }\n}", "function upLeft(pHeight, pColorEven, pColorOdd, pSymbol){\nvar rLine =\"\";\nfor (i=1;i<=pHeight;i++){\nrLine +=\"<p>\";\n\nfor (x=1;x<=pHeight-i;x++) {\n\n rLine +=\"<span class='space'>\" + pSymbol +\"</span>\";\n}\n\nfor(j=x;j<=pHeight;j++){\n\n\nif (j%2) \nrLine +=\"<span style='color:\" + pColorEven + \";'>\" + pSymbol +\"</span>\";\nelse\nrLine +=\"<span style='color:\" + pColorOdd + \";'>\" + pSymbol +\"</span>\";\n\n}\nrLine +=\"</p>\";\n\n}\n\ndocument.getElementById(\"upLeft\").innerHTML = rLine;\n}", "function downLeft(pHeight, pColorEven, pColorOdd, pSymbol){\nvar rLine =\"\";\nfor (i=pHeight;i > 0;i--){\nrLine +=\"<p>\";\n \n for (x=1;x<=pHeight-i;x++) {\n\n rLine +=\"<span class='space'>\" + pSymbol +\"</span>\";\n}\n \nfor(j=0;j<i;j++){\n\nif (j%2) \nrLine +=\"<span style='color:\" + pColorEven + \";'>\" + pSymbol +\"</span>\";\nelse\nrLine +=\"<span style='color:\" + pColorOdd + \";'>\" + pSymbol +\"</span>\";\n\n}\nrLine +=\"</p>\";\n\n}\n\ndocument.getElementById(\"downLeft\").innerHTML = rLine;\n}", "function drawHen() {\n for (let i = 0; i < hens.length; i++) {\n let hen = hens[i];\n let image = currentHenImage;\n\n if (hen.dead) {\n image = 'img/chicken/hen_dead.png';\n }\n\n addBackgroundobject(image, hen.position_x, bg_ground, hen.position_y, hen.scale, 1);\n }\n}" ]
[ "0.68376845", "0.6826211", "0.67068046", "0.63591355", "0.63379914", "0.6292296", "0.628281", "0.6262421", "0.61563504", "0.60988206", "0.60862625", "0.6055171", "0.60303503", "0.602348", "0.601556", "0.5917671", "0.5907442", "0.5907421", "0.5824928", "0.5818143", "0.5815627", "0.5801446", "0.57784384", "0.575231", "0.5740446", "0.57333845", "0.57273036", "0.5721684", "0.5694444", "0.56823003" ]
0.7237409
0
XXX: handle drafts in some other way. it's better to provide a control mechanism for filtering content based on metadata
draft() { return require.context( 'json!yaml-frontmatter!./drafts', false, /^\.\/.*\.md$/ ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gotContent(data){\r\n let page = data.query.pages; \r\n //console.log(page);\r\n let pageID = Object.keys(data.query.pages)[0];\r\n console.log(pageID);\r\n\r\n let content = page[pageID].revisions[0][\"*\"];\r\n startOfContentChar = \"'''\"\r\n startCharIndex = content.search(startOfContentChar) + 3;\r\n console.log(startCharIndex);\r\n endCharIndex = startCharIndex + 200 + 1;\r\n description = content.substring(startCharIndex, endCharIndex) + '...'\r\n document.getElementById('contentDisplay').innerHTML =description;\r\n //console.log(content); \r\n // access summary brute force \r\n //let summary = page[pageID].revisions[0][\"*\"][10];\r\n //console.log('SUMMARY' + summary);\r\n }", "function updateEntityPreviewContent() {\r\n if (currentEntity) {\r\n // first get the contentContainer for the entity's preview\r\n var contentContainer = $(\"#\" + currentEntity.id + \" > div\");\r\n // create the contentContainer if it doesn't exist:\r\n if (!contentContainer[0])\r\n contentContainer = createEntityPreview(currentEntity);\r\n \r\n // add/update the appropriate contents\r\n switch(currentEntity.type) {\r\n case \"image\" :\r\n // get the image element in the contentContainer\r\n var image = $(\"#\"+currentEntity.id + \" > img\");\r\n //empty the contentContainer and create a new image contentContainer if one doesn't exist\"\r\n if(!image[0]) {\r\n image = $(\"<img>\");\r\n contentContainer.empty();\r\n contentContainer.append(image);\r\n }\r\n // set the image's source\r\n image.src = currentEntity.content;\r\n break;\r\n case \"textbox\" :\r\n // clear the current content of the contentContainer\r\n contentContainer.empty();\r\n // slice the content along line breaks so <br> tags are not needed\r\n var lines = currentEntity.content.split(/(\\r\\n)|(^\\r\\n)/gm);\r\n // add each entry to the contentContainer seperated by line breaks\r\n for (var i = 0; i < lines.length; ++i)\r\n contentContainer.append(\"\" + lines[i] + \"<br>\");\r\n break;\r\n case \"bulletlist\" :\r\n // get the contentContainer for the entitiy:\r\n var list = contentContainer.children(\"ul\");\r\n // empty the div and create a new list if one does'nt exist:\r\n if(!list[0]) {\r\n contentContainer.empty();\r\n var list = $(\"<ul><ul>\");\r\n contentContainer.append(list);\r\n }\r\n // empty the list:\r\n list.empty();\r\n // slice the content along line breaks to get the list entries:\r\n var entries = currentEntity.content.split(/(\\r\\n|^\\r\\n)/gm);\r\n // add each entry to the list:\r\n for (var i = 0; i < entries.length; ++i)\r\n $(\"<li>\"+entries[i]+\"</li>\").appendTo(list);\r\n }\r\n }\r\n}", "function content () {\n if (search.file === 'new') {\n return Split(sidebar(), [FileNew(state, emit), Page()])\n }\n\n if (search.file) return File(state, emit)\n if (search.pages === 'all') return PagesAll(state, emit)\n\n if (search.page === 'new') {\n return Split(\n sidebar(),\n [PageNew(state, emit), Page()]\n )\n }\n\n if (search.files === 'all') {\n return FilesAll(state, emit)\n }\n\n return Split(\n sidebar(),\n Page()\n )\n }", "function gotContent(data){\r\n let page = data.query.pages; \r\n //console.log(page);\r\n let pageID = Object.keys(data.query.pages)[0];\r\n console.log(pageID);\r\n\r\n let followUpContent = page[pageID].revisions[0][\"*\"];\r\n startOfContentChar = \"'''\"\r\n startCharIndex = followUpContent.search(startOfContentChar) + 3;\r\n console.log(startCharIndex);\r\n endCharIndex = startCharIndex + 200 + 1;\r\n secondDescription = followUpContent.substring(startCharIndex, endCharIndex) + '...'\r\n document.getElementById('secondContentDisplay').innerHTML =secondDescription; \r\n }", "function emblContentMetaProperties_Read() {\n var metaProperties = {};\n // <!-- Content descriptors -->\n // <meta name=\"embl:who\" content=\"{{ meta-who }}\"> <!-- the people, groups and teams involved -->\n // <meta name=\"embl:what\" content=\"{{ meta-what }}\"> <!-- the activities covered -->\n // <meta name=\"embl:where\" content=\"{{ meta-where }}\"> <!-- at which EMBL sites the content applies -->\n // <meta name=\"embl:active\" content=\"{{ meta-active }}\"> <!-- which of the who/what/where is active -->\n metaProperties.who = metaProperties.who || document.querySelector(\"meta[name='embl:who']\");\n metaProperties.what = metaProperties.what || document.querySelector(\"meta[name='embl:what']\");\n metaProperties.where = metaProperties.where || document.querySelector(\"meta[name='embl:where']\");\n metaProperties.active = metaProperties.active || document.querySelector(\"meta[name='embl:active']\");\n\n // <!-- Content role -->\n // <meta name=\"embl:utility\" content=\"-8\"> <!-- if content is task and work based or if is meant to inspire -->\n // <meta name=\"embl:reach\" content=\"-5\"> <!-- if content is externally (public) or internally focused (those that work at EMBL) -->\n metaProperties.utility = metaProperties.utility || document.querySelector(\"meta[name='embl:utility']\");\n metaProperties.reach = metaProperties.reach || document.querySelector(\"meta[name='embl:reach']\");\n\n // <!-- Page infromation -->\n // <meta name=\"embl:maintainer\" content=\"{{ meta-maintainer }}\"> <!-- the contact person or group responsible for the page -->\n // <meta name=\"embl:last-review\" content=\"{{ meta-last-review }}\"> <!-- the last time the page was reviewed or updated -->\n // <meta name=\"embl:review-cycle\" content=\"{{ meta-review-cycle }}\"> <!-- how long in days before the page should be checked -->\n // <meta name=\"embl:expiry\" content=\"{{ meta-expiry }}\"> <!-- if there is a fixed point in time when the page is no longer relevant -->\n metaProperties.maintainer = metaProperties.maintainer || document.querySelector(\"meta[name='embl:maintainer']\");\n metaProperties.lastReview = metaProperties.lastReview || document.querySelector(\"meta[name='embl:last-review']\");\n metaProperties.reviewCycle = metaProperties.reviewCycle || document.querySelector(\"meta[name='embl:review-cycle']\");\n metaProperties.expiry = metaProperties.expiry || document.querySelector(\"meta[name='embl:expiry']\");\n for (var key in metaProperties) {\n if (metaProperties[key] != null && metaProperties[key].getAttribute(\"content\").length != 0) {\n metaProperties[key] = metaProperties[key].getAttribute(\"content\");\n } else {\n metaProperties[key] = 'notSet';\n }\n }\n return metaProperties;\n}", "initDrafts() {\n this.drafts = {};\n\n // restore data from localStorage\n const contents = window.localStorage.drafts;\n if (contents != null) {\n try {\n this.drafts = JSON.parse(contents);\n }\n catch (e) {\n window.localStorage.removeItem('drafts');\n }\n }\n\n if (this.state.pageId == null) {\n const draft = this.findDraft(this.state.path);\n if (draft != null) {\n this.state.markdown = draft;\n }\n }\n }", "docToFeedItem(doc) {\n const { config } = this.imports\n const { hCard } = this.options\n\n const item = {\n title: doc.get('properties.name.0'),\n id: doc.getPermalink(),\n link: doc.getPermalink(),\n description: doc.get('properties.summary.0'),\n content: doc.get('properties.content.0.html'),\n author: [\n {\n name:\n doc.get('properties.author.0.properties.name.0') ||\n hCard.properties.name[0],\n link:\n doc.get('properties.author.0.properties.photo.0') ||\n hCard.properties.url\n ? hCard.properties.url[0]\n : config.get('siteBaseUrl'),\n email:\n doc.get('properties.author.0.properties.email.0') ||\n hCard.properties.name[0],\n },\n ],\n date: new Date(doc.get('properties.published.0')),\n image:\n doc.get('properties.featured.0') || doc.get('properties.photo.0.value'),\n }\n\n // Tidy up item removing undefined keys\n Object.keys(item).forEach((key) => {\n if (item[key] === undefined) {\n delete item[key]\n }\n })\n\n // Set title fallback from content\n if (!item.title && !item.description) {\n if (!item.content) {\n // This is a post type without a summary, name or content\n // TODO: Handle contentless posts like likes and reposts better.\n // console.warn(\n // '[Postr Feeds]',\n // 'Item is currently not supported',\n // doc.toMf2()\n // )\n return null\n } else {\n item.title =\n doc.get('properties.content.0.value').substring(0, 50) + '…'\n }\n // NOTE: This runs a lottt...\n // console.log('No title or description for rss', item)\n }\n\n // Set content fallback from title\n if (!item.content && (item.description || item.title)) {\n item.content = item.description || item.title\n }\n\n return item\n }", "setContent(content) {\n const { data } = content;\n var vList = data.filter(item => item.contentType.toLowerCase() === \"video\");\n var aList = data.filter(\n item => item.contentType.toLowerCase() === \"article\"\n );\n\n this.setState({\n src: data,\n active_list: data,\n video_list: vList,\n article_list: aList\n });\n }", "function filterContent (data) {\n const intro = {}\n intro.text = $(data).find('p, pre')\n intro.img = $(data).find('figure > img')\n if (intro.text.length === 0) {\n intro.text = null\n }\n if (intro.img.length === 0) {\n intro.img = null\n }\n if (intro.img || intro.text) {\n return intro\n }\n}", "function filterContent(posts) {\n for (let post of posts) {\n if (post.slug === \"tutorials\") {\n return post;\n break;\n }\n }\n}", "function getFilterContentProvider(contentProps) {\n var pillContent = {\n createContent: function (editMode, props, updateConfiguredStatus, updateAriaLabel, editingComplete, removeSelf) {\n return Promise.resolve().then(function () { return require(/* webpackMode: \"lazy\", webpackChunkName: \"FilterPill\" */ \"./FilterPill\"); }).then(function (FilterPill) {\n return React.createElement(FilterPill.FilterPill, { editMode: editMode, disableEdit: props.disableEdit, enableValueMultiSelect: props.enableValueMultiSelect, hideOperatorSelection: props.hideOperatorSelection, areDimensionsLoading: props.areDimensionsLoading, areOperatorsLoading: props.areOperatorsLoading, areValuesLoading: props.areValuesLoading, pickerLists: props.pickerLists, selection: props.selection, onSelectionChange: props.onSelectionChange, showLabels: props.showLabels, canCreateValueEntries: props.canCreateValueEntries, valueEntryCreatorPromptTextFormat: props.valueEntryCreatorPromptTextFormat, autoOpen: props.autoOpen, customOptionRenderers: props.customOptionRenderers, customValueRenderers: props.customValueRenderers, updateConfiguredStatus: updateConfiguredStatus, updateAriaLabel: updateAriaLabel, removeSelf: removeSelf });\n });\n },\n contentProps: contentProps,\n };\n return pillContent;\n}", "function gotContent(data){\r\n let page = data.query.pages; \r\n //console.log(page);\r\n let pageID = Object.keys(data.query.pages)[0];\r\n console.log(pageID);\r\n\r\n let lastfollowUpContent = page[pageID].revisions[0][\"*\"];\r\n startOfContentChar = \"'''\"\r\n startCharIndex = lastfollowUpContent.search(startOfContentChar) + 3;\r\n console.log(startCharIndex);\r\n endCharIndex = startCharIndex + 200 + 1;\r\n secondDescription = lastfollowUpContent.substring(startCharIndex, endCharIndex) + '...'\r\n document.getElementById('lastContentDisplay').innerHTML =secondDescription;\r\n }", "async getSponsoredMain() {\n let { firstObject:post } = await this.store.query('article', {\n sponsored_content: true,\n show_as_feature: true,\n limit: 1,\n });\n\n if (!post) {\n return;\n }\n const ageInHours = moment().diff(post.publishedMoment, 'hours');\n if (ageInHours >= 24 && ageInHours <= 48) {\n return post;\n }\n }", "function giveMeHugeDraft(mode) {\n var result;\n if (mode == 'final') {\n result = {\n text: ''\n };\n return result;\n }\n if (mode == 'preview') {\n result = {\n text: '******DRAFT******',\n fontSize: 40,\n bold: true,\n color: 'red',\n alignment: 'center'\n };\n return result;\n }\n}", "function getContentType(limit, skip, contentSettings, itemsPulled) {\n\tlet previewMode = false;\n\tif (argv.preview) {\n\t\tpreviewMode = true;\n\t}\n\tif (previewMode && !process.env.CONTENTFUL_PREVIEW_TOKEN) {\n\t\tthrow new Error(\n\t\t\t'Environment variable CONTENTFUL_PREVIEW_TOKEN not set'\n\t\t);\n\t} else if (!previewMode && !process.env.CONTENTFUL_TOKEN) {\n\t\tthrow new Error('Environment variable CONTENTFUL_TOKEN not set');\n\t}\n\tconst options = {\n\t\tspace: process.env.CONTENTFUL_SPACE,\n\t\thost: previewMode ? 'preview.contentful.com' : 'cdn.contentful.com',\n\t\taccessToken: previewMode\n\t\t\t? process.env.CONTENTFUL_PREVIEW_TOKEN\n\t\t\t: process.env.CONTENTFUL_TOKEN,\n\t};\n\tconst client = contentful.createClient(options);\n\n\t// check for file extension default to markdown\n\tif (!contentSettings.fileExtension) {\n\t\tcontentSettings.fileExtension = 'md';\n\t}\n\n\tclient\n\t\t.getEntries({\n\t\t\tcontent_type: contentSettings.typeId,\n\t\t\tlimit: limit,\n\t\t\tskip: skip,\n\t\t\torder: 'sys.updatedAt',\n\t\t})\n\t\t.then(data => {\n\t\t\t// variable for counting number of items pulled\n\t\t\tlet itemCount;\n\t\t\tif (itemsPulled) {\n\t\t\t\titemCount = itemsPulled;\n\t\t\t} else {\n\t\t\t\titemCount = 0;\n\t\t\t}\n\t\t\t// create directory for file\n\t\t\tmkdirp.sync(`.${contentSettings.directory}`);\n\n\t\t\tfor (let i = 0; i < data.items.length; i++) {\n\t\t\t\tconst item = data.items[i];\n\t\t\t\tconst frontMatter = {};\n\t\t\t\tif (contentSettings.isHeadless) {\n\t\t\t\t\tfrontMatter.headless = true;\n\t\t\t\t\tmkdirp.sync(`.${contentSettings.directory + item.sys.id}`);\n\t\t\t\t}\n\t\t\t\tif (contentSettings.type) {\n\t\t\t\t\tfrontMatter.type = contentSettings.type;\n\t\t\t\t}\n\t\t\t\tfrontMatter.updated = item.sys.updatedAt;\n\t\t\t\tfrontMatter.createdAt = item.sys.createdAt;\n\t\t\t\tfrontMatter.date = item.sys.createdAt;\n\t\t\t\tfor (const field of Object.keys(item.fields)) {\n\t\t\t\t\tif (field === contentSettings.mainContent) {\n\t\t\t\t\t\t// skips to prevent duplicating mainContent in frontmatter\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (field === 'date') {\n\t\t\t\t\t\t// convert dates with time to ISO String so Hugo can properly Parse\n\t\t\t\t\t\tconst d = item.fields[field];\n\t\t\t\t\t\tif (d.length > 10) {\n\t\t\t\t\t\t\tfrontMatter.date = new Date(d).toISOString();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfrontMatter.date = d;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst fieldContent = item.fields[field];\n\t\t\t\t\tswitch (typeof fieldContent) {\n\t\t\t\t\t\tcase 'object':\n\t\t\t\t\t\t\tif ('sys' in fieldContent) {\n\t\t\t\t\t\t\t\tfrontMatter[field] = {};\n\t\t\t\t\t\t\t\tswitch (fieldContent.sys.type) {\n\t\t\t\t\t\t\t\t\tcase 'Asset':\n\t\t\t\t\t\t\t\t\t\tfrontMatter[field] = getAssetFields(\n\t\t\t\t\t\t\t\t\t\t\tfieldContent\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase 'Entry':\n\t\t\t\t\t\t\t\t\t\tfrontMatter[field] = getEntryFields(\n\t\t\t\t\t\t\t\t\t\t\tfieldContent\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tfrontMatter[field] = fieldContent;\n\t\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\t// rich text (see rich text function)\n\t\t\t\t\t\t\telse if ('nodeType' in fieldContent) {\n\t\t\t\t\t\t\t\tfrontMatter[field] = [];\n\t\t\t\t\t\t\t\tfrontMatter[\n\t\t\t\t\t\t\t\t\t`${field}_plaintext`\n\t\t\t\t\t\t\t\t] = richTextToPlain(fieldContent);\n\t\t\t\t\t\t\t\tconst nodes = fieldContent.content;\n\t\t\t\t\t\t\t\tfor (let i = 0; i < nodes.length; i++) {\n\t\t\t\t\t\t\t\t\tfrontMatter[field].push(\n\t\t\t\t\t\t\t\t\t\trichTextNodes(nodes[i])\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// arrays\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif (!fieldContent.length) {\n\t\t\t\t\t\t\t\t\tfrontMatter[field] = fieldContent;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tfrontMatter[field] = [];\n\t\t\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\t\t\tlet i = 0;\n\t\t\t\t\t\t\t\t\t\ti < fieldContent.length;\n\t\t\t\t\t\t\t\t\t\ti++\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tconst arrayNode = fieldContent[i];\n\t\t\t\t\t\t\t\t\t\tswitch (typeof arrayNode) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'object': {\n\t\t\t\t\t\t\t\t\t\t\t\tlet arrayObject = {};\n\t\t\t\t\t\t\t\t\t\t\t\tswitch (arrayNode.sys.type) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase 'Asset':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayObject = getAssetFields(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayNode\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrontMatter[field].push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayObject\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase 'Entry':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayObject = getEntryFields(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayNode\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrontMatter[field].push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayObject\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrontMatter[field].push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayNode\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tfrontMatter[field].push(\n\t\t\t\t\t\t\t\t\t\t\t\t\tarrayNode\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tfrontMatter[field] = item.fields[field];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (contentSettings.isHeadless) {\n\t\t\t\t\tfrontMatter.headless = true;\n\t\t\t\t\tmkdirp.sync(`.${contentSettings.directory + item.sys.id}`);\n\t\t\t\t}\n\t\t\t\tfrontMatter.updated = item.sys.updatedAt;\n\t\t\t\tfrontMatter.createdAt = item.sys.createdAt;\n\t\t\t\tfrontMatter.date = item.sys.createdAt;\n\t\t\t\tfor (const field of Object.keys(item.fields)) {\n\t\t\t\t\tif (field === contentSettings.mainContent) {\n\t\t\t\t\t\t// skips to prevent duplicating mainContent in frontmatter\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (field === 'date') {\n\t\t\t\t\t\t// convert dates with time to ISO String so Hugo can properly Parse\n\t\t\t\t\t\tconst d = item.fields[field];\n\t\t\t\t\t\tif (d.length > 10) {\n\t\t\t\t\t\t\tfrontMatter.date = new Date(d).toISOString();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfrontMatter.date = d;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst fieldContent = item.fields[field];\n\t\t\t\t\tswitch (typeof fieldContent) {\n\t\t\t\t\t\tcase 'object':\n\t\t\t\t\t\t\tif ('sys' in fieldContent) {\n\t\t\t\t\t\t\t\tfrontMatter[field] = {};\n\t\t\t\t\t\t\t\tswitch (fieldContent.sys.type) {\n\t\t\t\t\t\t\t\t\tcase 'Asset':\n\t\t\t\t\t\t\t\t\t\tfrontMatter[field] = getAssetFields(\n\t\t\t\t\t\t\t\t\t\t\tfieldContent\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase 'Entry':\n\t\t\t\t\t\t\t\t\t\tfrontMatter[field] = getEntryFields(\n\t\t\t\t\t\t\t\t\t\t\tfieldContent\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tfrontMatter[field] = fieldContent;\n\t\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\t// rich text (see rich text function)\n\t\t\t\t\t\t\telse if ('nodeType' in fieldContent) {\n\t\t\t\t\t\t\t\tfrontMatter[field] = [];\n\t\t\t\t\t\t\t\tfrontMatter[\n\t\t\t\t\t\t\t\t\t`${field}_plaintext`\n\t\t\t\t\t\t\t\t] = richTextToPlain(fieldContent);\n\t\t\t\t\t\t\t\tconst nodes = fieldContent.content;\n\t\t\t\t\t\t\t\tfor (let i = 0; i < nodes.length; i++) {\n\t\t\t\t\t\t\t\t\tfrontMatter[field].push(\n\t\t\t\t\t\t\t\t\t\trichTextNodes(nodes[i])\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// arrays\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif (!fieldContent.length) {\n\t\t\t\t\t\t\t\t\tfrontMatter[field] = fieldContent;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tfrontMatter[field] = [];\n\t\t\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\t\t\tlet i = 0;\n\t\t\t\t\t\t\t\t\t\ti < fieldContent.length;\n\t\t\t\t\t\t\t\t\t\ti++\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tconst arrayNode = fieldContent[i];\n\t\t\t\t\t\t\t\t\t\tswitch (typeof arrayNode) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'object': {\n\t\t\t\t\t\t\t\t\t\t\t\tlet arrayObject = {};\n\t\t\t\t\t\t\t\t\t\t\t\tswitch (arrayNode.sys.type) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase 'Asset':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayObject = getAssetFields(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayNode\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrontMatter[field].push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayObject\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase 'Entry':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayObject = getEntryFields(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayNode\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrontMatter[field].push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayObject\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrontMatter[field].push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayNode\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tfrontMatter[field].push(\n\t\t\t\t\t\t\t\t\t\t\t\t\tarrayNode\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tfrontMatter[field] = item.fields[field];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlet mainContent = null;\n\t\t\t\tif (item.fields[contentSettings.mainContent]) {\n\t\t\t\t\tmainContent = `${item.fields[contentSettings.mainContent]}`;\n\t\t\t\t}\n\n\t\t\t\tcreateFile(\n\t\t\t\t\tcontentSettings,\n\t\t\t\t\titem.sys.id,\n\t\t\t\t\tfrontMatter,\n\t\t\t\t\tmainContent\n\t\t\t\t);\n\t\t\t\titemCount++;\n\t\t\t}\n\n\t\t\t// check total number of items against number of items pulled in API\n\t\t\tif (data.total > data.limit) {\n\t\t\t\t// run function again if there are still more items to get\n\t\t\t\tconst newSkip = skip + limit;\n\t\t\t\tgetContentType(limit, newSkip, contentSettings, itemCount);\n\t\t\t} else {\n\t\t\t\tlet grammarStuff;\n\t\t\t\tif (Number(data.total) === 1) {\n\t\t\t\t\tgrammarStuff = 'item';\n\t\t\t\t} else {\n\t\t\t\t\tgrammarStuff = 'items';\n\t\t\t\t}\n\t\t\t\tconsole.log(\n\t\t\t\t\t` ${contentSettings.typeId} - ${itemCount} ${grammarStuff}`\n\t\t\t\t);\n\t\t\t\ttypesExtracted++;\n\t\t\t\tif (checkIfFinished(typesExtracted, totalContentTypes)) {\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t`\\n---------------------------------------------\\n`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t\t.catch(error => {\n\t\t\tconst response = error.response;\n\t\t\tif (response) {\n\t\t\t\tconsole.log(\n\t\t\t\t\t` --------------------------\\n ${contentSettings.typeId} - ERROR ${response.status} ${response.statusText}\\n (Note: ${response.data.message})\\n --------------------------`\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconsole.log(error);\n\t\t\t}\n\t\t});\n}", "function gotContent(data) {\n\n //Require pageID\n let page = data.query.pages;\n let pageId = Object.keys(data.query.pages)[0];\n \n //Correct if error found\n if (pageId < 0 || page[pageId].revisions === undefined){ \n restart();\n }\n let content = page[pageId].revisions[0]['*'];\n\n //Find a word >4 letters\n let wordRegex = /\\b\\w{4,7}\\b/g;\n content.match(wordRegex);\n let word = random((content.match(wordRegex)));\n\n goWiki(word);\n}", "function onPublishChange(e) {\r\n const btnKey = e.target.dataset.buttonkey;\r\n let newFilters = Object.assign({}, filters);\r\n if (btnKey === 'all') {\r\n delete newFilters.isPublished;\r\n } else {\r\n newFilters.isPublished = btnKey === 'published' ? true : false;\r\n }\r\n setFilters(newFilters);\r\n }", "onActiveMessagesLoaded(aFolderDisplay) {\n let filterer = this.maybeActiveFilterer;\n if (!filterer) {\n return;\n }\n\n let filtering = aFolderDisplay.view.search.userTerms != null;\n\n // - postFilterProcess everyone who cares\n // This may need to be converted into an asynchronous process at some point.\n for (let filterDef of QuickFilterManager.filterDefs) {\n if (\"postFilterProcess\" in filterDef) {\n let preState =\n filterDef.name in filterer.filterValues\n ? filterer.filterValues[filterDef.name]\n : null;\n let [newState, update, treatAsUserAction] = filterDef.postFilterProcess(\n preState,\n aFolderDisplay.view,\n filtering\n );\n filterer.setFilterValue(filterDef.name, newState, !treatAsUserAction);\n if (update) {\n if (\n aFolderDisplay._tabInfo == this.tabmail.currentTabInfo &&\n \"reflectInDOM\" in filterDef\n ) {\n let domNode = document.getElementById(filterDef.domId);\n // We are passing update as a super-secret data propagation channel\n // exclusively for one-off cases like the text filter gloda upsell.\n filterDef.reflectInDOM(domNode, newState, document, this, update);\n }\n }\n }\n }\n\n // - Update match status.\n this.reflectFiltererResults(filterer, aFolderDisplay);\n }", "function filterPosts(post) {\n let valid = true;\n\n // Exclude posts with no message\n if (!post.message) {\n valid = false;\n }\n\n // Exclude posts updating cover photos\n if (post.story && post.story.includes('cover photo')) {\n valid = false;\n }\n\n return valid;\n }", "function checkQuery( itcb ) {\n if( args.query ) {\n\n // map form mapped fields back to schema fields\n if( args.query.editorName ) {\n args.query['editor.name'] = args.query.editorName;\n delete args.query.editorName;\n }\n if( args.query.editorInitials ) {\n args.query['editor.initials'] = args.query.editorInitials;\n delete args.query.editorInitials;\n }\n\n // there are other properties that can also filter \"timestamp\"\n if( args.query.$or && Array.isArray( args.query.$or ) ) {\n // rename \"quarterColumn\" property to \"timestamp\"\n args.query.$or.forEach( function( or ) {\n if( or.quarterColumn ) {\n or.timestamp = or.quarterColumn;\n delete or.quarterColumn;\n }\n } );\n // also apply original \"timestamp\" to \"$or\"\n if( args.query.timestamp ) {\n args.query.$or.push( {timestamp: args.query.timestamp} );\n delete args.query.timestamp;\n }\n }\n\n /**\n * [MOJ-11908]\n * Whenever a regex filter against the activity's content is queried, we intercept it.\n * This makes it possible to search the content for the so-called \"badges\" (bootstrap-labels),\n * which are rendered, if specific properties of an activity are set to true/false, or to\n * specific values (mainly ENUMs)\n * E.g. activity.phContinuousMed = true renders a badge with the abbreviation \"DM\" (in german),\n * which means \"DauerMedikament\".\n *\n * Since the user sees these patches within the content, he assumes, that one may search for the\n * label's content. In the example, this would be \"DM\".\n * So we have to be able to filter the properties in the database accordingly,\n * although the activity.content has NO knowledge of the \"DM\".\n *\n * Here, this is done by analyzing the query sent by the user,\n * and search for these abbreviations. If found, the query is altered on-the-fly,\n * to include a search for the requested parameters.\n */\n if( args.query.content && args.query.content.$regex ) {\n let CONTINUOUS_MEDICATION = i18n( 'InCaseMojit.activity_schema.CONTINUOUS_MEDICATION' ),\n SAMPLE_MEDICATION = i18n( 'InCaseMojit.activity_schema.SAMPLE_MEDICATION' ),\n ACUTE_DOK = i18n( 'InCaseMojit.activity_schema.diagnose_type.ACUTE_DOK' ),\n ACUTE_INVALIDATING = i18n( 'InCaseMojit.activity_schema.diagnose_type.ACUTE_INVALIDATING' ),\n CONT_DIAGNOSES = i18n( 'InCaseMojit.activity_schema.diagnose_type.CONT_DIAGNOSES' ),\n CONT_DIAGNOSES_DOK = i18n( 'InCaseMojit.activity_schema.diagnose_type.CONT_DIAGNOSES_DOK' ),\n CONT_DIAGNOSES_INVALIDATING = i18n( 'InCaseMojit.activity_schema.diagnose_type.CONT_DIAGNOSES_INVALIDATING' ),\n A_CONT_DIAGNOSES = i18n( 'InCaseMojit.activity_schema.diagnose_type.A_CONT_DIAGNOSES' ),\n A_CONT_DIAGNOSES_DOK = i18n( 'InCaseMojit.activity_schema.diagnose_type.A_CONT_DIAGNOSES_DOK' ),\n A_CONT_DIAGNOSES_INVALIDATING = i18n( 'InCaseMojit.activity_schema.diagnose_type.A_CONT_DIAGNOSES_INVALIDATING' ),\n EXPENSES = i18n( 'InCaseMojit.casefile_detail.group.EXPENSES' ),\n\n /**\n * An activity may provide multiple parameters, which are set to true/false,\n * or a given set of parameters. Depending on this state, a badge (bootstrap-label)\n * is displayed in the content, which shows an abbreviation, according to this state.\n * So the user sees this label, and tries to search for it, by typing the abbreviation.\n *\n * This array defines an object for each searchable property (which has a corresponding badge).\n * {\n * searchTag : abbreviation displayed in the label,\n * searchCondition: database parameters to be searched for\n * }\n * @type {Array}\n */\n propertiesToSearchFor = [\n {\n searchTag: CONTINUOUS_MEDICATION,\n searchCondition: {phContinuousMed: true}\n },\n {\n searchTag: SAMPLE_MEDICATION,\n searchCondition: {phSampleMed: true}\n },\n {\n searchTag: ACUTE_DOK,\n searchCondition: {\n diagnosisType: 'ACUTE',\n diagnosisTreatmentRelevance: 'DOKUMENTATIV'\n }\n },\n {\n searchTag: ACUTE_INVALIDATING,\n searchCondition: {\n diagnosisType: 'ACUTE',\n diagnosisTreatmentRelevance: 'INVALIDATING'\n }\n },\n {\n searchTag: CONT_DIAGNOSES,\n searchCondition: {\n diagnosisType: 'CONTINUOUS',\n diagnosisTreatmentRelevance: 'TREATMENT_RELEVANT'\n }\n },\n {\n searchTag: CONT_DIAGNOSES_DOK,\n searchCondition: {\n diagnosisType: 'CONTINUOUS',\n diagnosisTreatmentRelevance: 'DOKUMENTATIV'\n }\n },\n {\n searchTag: CONT_DIAGNOSES_INVALIDATING,\n searchCondition: {\n diagnosisType: 'CONTINUOUS',\n diagnosisTreatmentRelevance: 'INVALIDATING'\n }\n },\n {\n searchTag: A_CONT_DIAGNOSES,\n searchCondition: {\n diagnosisType: 'ANAMNESTIC',\n diagnosisTreatmentRelevance: 'TREATMENT_RELEVANT'\n }\n },\n {\n searchTag: A_CONT_DIAGNOSES_DOK,\n searchCondition: {\n diagnosisType: 'ANAMNESTIC',\n diagnosisTreatmentRelevance: 'DOKUMENTATIV'\n }\n },\n {\n searchTag: A_CONT_DIAGNOSES_INVALIDATING,\n searchCondition: {\n diagnosisType: 'ANAMNESTIC',\n diagnosisTreatmentRelevance: 'INVALIDATING'\n }\n },\n {\n searchTag: EXPENSES,\n searchCondition: {\n $and: [\n {costType: {$exists: true}},\n {costType: {$type: \"string\"}},\n {costType: {$ne: \"\"}}\n ]\n }\n },\n {\n searchTag: 'email',\n searchCondition: {savedEmails: {$exists: true}}\n\n }\n\n ],\n\n // extract the query's regex source\n queryRegexSource = (args.query.content.$regex.source || ''),\n queryRegexFlags = (args.query.content.$regex.flags || 'i');\n\n /**\n * We start, by examining the search query (which is actually a regex itself), for the occurrence of\n * the searchTags of the properties. So we filter out all occurrences, for which we have to\n * take care about. Notice: the query may additionally be limited to the beginning\n * or the end of the string, \"^\" or \"$\", respectively.\n * Examples for this regex:\n * - \"DM\", \"^DM\", \"DM$\": single occurrences\n * To search all continuous medications (DM).\n * - \"DM ExampleMedication\", \"DM ExampleMedication\", \"^DM ExampleMedication$\"\n * To search for all continuous medications (DM), and additionally those of type \"ExampleMedication\".\n * - \"DM MM\", \"^DM MM\", \"DM MM$\": multiple occurrences\n * To search for all continuous (DM) and sample medications (MM). Should generally not happen.\n */\n propertiesToSearchFor = propertiesToSearchFor\n .filter( propertyToSearch => {\n // Create multiple RegExp from the property's search tag, and match each\n // against the query. Each RegExp covers the cases explained above.\n let // watch out, the searchTag itself is escaped for regex characters\n // => this requires us to double-escape all regex-characters in our search tag,\n // to obtain a match on those (e.g. search for \"DD.d\", query is \"DD\\.d\", so we create a regex with \"DD\\\\\\.d\")\n escapedSearchTag = Y.doccirrus.commonutils.$regexEscape( Y.doccirrus.commonutils.$regexEscape( propertyToSearch.searchTag ) ),\n // get a collection of all tests to run on the user's query regex\n regexTests = [\n // match the occurrence of the searchTag at the beginning of the query\n new RegExp( \"^\\\\^?\" + escapedSearchTag + \"\\\\s\", \"gi\" ),\n\n // match the occurrence of the searchTag in the middle of the query\n new RegExp( \"\\\\s\" + escapedSearchTag + \"(\\\\s)\", \"gi\" ), // the capture group is intended here!\n\n // match the occurrence of the searchTag at the end of the query\n new RegExp( \"\\\\s\" + escapedSearchTag + \"\\\\$?$\", \"gi\" ),\n\n // match the occurrence of the searchTag as the only content of the query\n new RegExp( \"^\\\\^?\" + escapedSearchTag + \"\\\\$?$\", \"gi\" )\n ],\n tagFound = false,\n tagFoundCallback = ( match, spaceCaptureGroup ) => {\n /**\n * If yes, this function is invoked.\n * Here, we remove the occurrence of the tag from the regex string,\n * and mark the tag as found.\n * E.g.:\n * \"DD Test-Diagnosis XYZ\" => \"Test-Diagnosis XYZ\"\n *\n * NOTICE:\n * We explicitly proceed with other regex tests from the array,\n * to catch multiple occurrences of the same tag in the different positions,\n * and to properly remove these occurrences.\n * This may be caused by the user entering the tag twice,\n * e.g. \"DM test medication DM\", and him still expecting a result.\n * @type {boolean}\n */\n tagFound = true;\n\n /**\n * Replace every tag by an empty string, with one exception:\n * In case of a positioning of the tag within the string,\n * we have to keep a space, to avoid merging words.\n */\n return (typeof spaceCaptureGroup === \"string\") ? spaceCaptureGroup : '';\n };\n\n for( let regexTest of regexTests ) { //eslint-disable-line no-unused-vars\n // see, if there is a match of the query's regex source with the test regex\n queryRegexSource = queryRegexSource.replace( regexTest, tagFoundCallback );\n }\n\n // if no tag of this type was found, exclude the tag from further treatment\n return tagFound;\n } );\n\n /**\n * Now, that we have all relevant properties, and that we have cleaned the query's regex source\n * from these properties, we may map the matching properties into the query as new conditions ($and).\n */\n if( propertiesToSearchFor.length > 0 ) {\n\n // Create the new search Regex for the content, which has been cleaned from all matched tags.\n args.query.content.$regex = new RegExp( queryRegexSource, queryRegexFlags );\n\n // Ensure, that there is an $and defined ...\n if( !args.query.$and ) {\n args.query.$and = [];\n }\n // ... and that it is an array.\n if( Array.isArray( args.query.$and ) ) {\n // move the former \"content\"-query out of the original query, and into the $and.\n args.query.$and.push( {content: args.query.content} );\n delete args.query.content;\n\n // finally, map the all search conditions into the $and\n propertiesToSearchFor.map( propertyToSearch => args.query.$and.push( propertyToSearch.searchCondition ) );\n }\n }\n }\n\n }\n if( caseFileDoctorSelectFilter ) {\n args.query = {$and: [caseFileDoctorSelectFilter, args.query]};\n }\n itcb( null );\n }", "function removeUnpublishedContent() {\n $_node.getUnpublishedNodes(function (data) {\n for(i in data){\n var nid = data[i].nid;\n var _v_item = $('#media_'+nid);\n if(_v_item.length > 0)\n {\n _v_item.remove();\n }\n }\n });\n}", "function previewContent(content, article){\n\n var regex = new RegExp(article.sourceName, 'g', 'i')\n var redactedContent = content.replace(regex, \"[REDACTED BY YOURAGORA]\")\n\n if(redactedContent.includes(\"<p>\")){\n if(redactedContent.match(/<p>/g).length > 2){\n var fixedContent = redactedContent.replace(/(<img)(.*?)(>)/g, '')\n var pattern = /(<p>)(.*?)(<\\/p>)/g\n // TODO: Can we loop this more elegantly?\n var par1 = pattern.exec(fixedContent)[0]\n var par2 = pattern.exec(fixedContent)[0]\n var par3 = pattern.exec(fixedContent)[0]\n var par4 = pattern.exec(fixedContent)[0]\n return [par1, par2, par3, par4].join(\" \")\n } else {\n return '';}\n } else {\n return ''\n }\n\n}", "evaluateContent(content, cb, opts={}) {\n this.session.post({\n url: this.url + '/api/filter',\n json: Object.assign({ source_text: content }, opts),\n }, cb);\n }", "runArchivedFilter(state, cards) {\n if (state.showArchived) {\n state.filteredCards.push(cards.filter(card => card.archived))\n } else {\n state.filteredCards.push(cards.filter(card => !card.archived))\n }\n }", "function filterAuthors(data, queued) {\n // filter map_data with docs just in our selected journals\n selected_authors = selected_authors.concat($(\"select#author-list\").val());\n if(selected_authors.length == 0) {\n $(\"#author-filter i\").show();\n $(\"#filter-list h2.author\").html(\"Selected Authors <a onclick='clearAuthorFilters();'>clear</a>\");\n return data;\n } else {\n $(\"#author-filter i\").hide();\n $(\"#filter-list h2.author\").html(\"Selected Authors (\" + selected_authors.length + \") <a onclick='clearAuthorFilters();'>clear</a>\");\n }\n var entity_list = [];\n var documents = $.grep(data.documents, function(n, i) {\n if($.inArray(n.authorid+\"\", selected_authors) > -1) {\n if($.inArray(n.entityid+\"\", entity_list) == -1) {\n entity_list.push(n.entityid);\n }\n return true;\n }\n return false;\n });\n // filter links such that both documents are in selected journals\n var entities = getEntityList(documents);\n var new_data = {\"documents\":documents, \"entities\":entities};\n // remove selected journals from our select list\n for(var i=0; i<selected_authors.length; i++) {\n $(\"#author-list option[value='\" + selected_authors[i] + \"']\").remove();\n }\n\n if(queued) return new_data; // filter only and apply filters externally\n update(new_data); // update the database\n}", "function controlContentList(type){\n\n if(type == \"People\"){\n if(people.results.length) constructProfileList(people);\n }\n else{\n switch(type){\n case \"TV Shows\": if(tv.results.length) constructContentList(tv, \"tv\"); break;\n case \"Movies\": if(movies.results.length) constructContentList(movies, \"movie\"); break;\n case \"Collections\": if(collections.results.length) constructContentList(collections); break;\n }\n }\n\n if(currentList.total_pages > 1) updatePageNumbers();\n}", "function isDraft(value) {\n return !!value && !!value[DRAFT_STATE];\n}", "function editor_filterOutput(objname) {\r\n editor_updateOutput(objname);\r\n var contents = document.all[objname].value;\r\n var config = document.all[objname].config;\r\n\r\n // ignore blank contents\r\n if (contents.toLowerCase() == '<p>&nbsp;</p>') { contents = \"\"; }\r\n\r\n // filter tag - this code is run for each HTML tag matched\r\n var filterTag = function(tagBody,tagName,tagAttr) {\r\n tagName = tagName.toLowerCase();\r\n var closingTag = (tagBody.match(/^<\\//)) ? true : false;\r\n\r\n // fix placeholder URLS - remove absolute paths that IE adds\r\n if (tagName == 'img') { tagBody = tagBody.replace(/(src\\s*=\\s*.)[^*]*(\\*\\*\\*)/, \"$1$2\"); }\r\n if (tagName == 'a') { tagBody = tagBody.replace(/(href\\s*=\\s*.)[^*]*(\\*\\*\\*)/, \"$1$2\"); }\r\n\r\n // add additional tag filtering here\r\n\r\n // convert to vbCode\r\n// if (tagName == 'b' || tagName == 'strong') {\r\n// if (closingTag) { tagBody = \"[/b]\"; } else { tagBody = \"[b]\"; }\r\n// }\r\n// else if (tagName == 'i' || tagName == 'em') {\r\n// if (closingTag) { tagBody = \"[/i]\"; } else { tagBody = \"[i]\"; }\r\n// }\r\n// else if (tagName == 'u') {\r\n// if (closingTag) { tagBody = \"[/u]\"; } else { tagBody = \"[u]\"; }\r\n// }\r\n// else {\r\n// tagBody = \"\"; // disallow all other tags!\r\n// }\r\n\r\n return tagBody;\r\n };\r\n\r\n // match tags and call filterTag\r\n RegExp.lastIndex = 0;\r\n var matchTag = /<\\/?(\\w+)((?:[^'\">]*|'[^']*'|\"[^\"]*\")*)>/g; // this will match tags, but still doesn't handle container tags (textarea, comments, etc)\r\n\r\n contents = contents.replace(matchTag, filterTag);\r\n\r\n // remove nextlines from output (if requested)\r\n if (config.replaceNextlines) { \r\n contents = contents.replace(/\\r\\n/g, ' ');\r\n contents = contents.replace(/\\n/g, ' ');\r\n contents = contents.replace(/\\r/g, ' ');\r\n }\r\n\r\n // update output with filtered content\r\n document.all[objname].value = contents;\r\n\r\n}", "function editDraft_process() {\n $('body').on('click', '[data-action=\"edit_draft\"]', function(e) {\n if (e) {\n e.preventDefault();\n }\n var $object = $(this);\n\n if ($object.data('type') == \"question\") {\n $.post('/question/' + $object.data('id'), {\n }, function (results) {\n // clear content\n navbar_ask_clear_input();\n // switch to ask mode\n _question_modal_UISwitch('ask');\n // set results to the input\n navbar_question_json_set(results);\n // show asking new question option\n navbar_show_ask_new_question_option();\n // show search box\n $('#_question').modal('show');\n });\n }\n });\n}", "function getMetadata(path) {\n var passageContainer = document.getElementById(\"app\");\n var jsondata;\n fetch(path)\n .then(\n function (u) { return u.json(); }\n )\n .then(\n function (json) {\n var jsondata = json;\n for (var i = Object.keys(jsondata.title).length; i--; i >= 0) {\n // for each entry in jsondata, add div and information from \"data.json\"\n var div = document.createElement(\"div\");\n div.setAttribute(\"id\", \"div_\" + (i));\n div.innerHTML = (`${compareYear(jsondata[\"year\"][i], year0)}<p class=\"show-pub ${checkIfEmptyValue(\"\", jsondata[\"type\"][i], \"\")} ${checkIfEmptyValue(\"\", jsondata[\"community\"][i], \"\")}\">${checkIfEmptyValue(\"<span class='authors'>\", jsondata[\"co-author(s)\"][i], \"</span>: \")}<span class=\"title\"><a href=\"${jsondata[\"link to publication\"][i]}\">${jsondata[\"title\"][i]}</a></span>${checkIfEmptyValue(\", in <span class='publisher'>\", jsondata[\"publisher (e.g. journal/blog name)\"][i], \"</span>\")}. ${checkIfEmptyValue(`<span class='hashtag hashtag-${jsondata[\"type\"][i]} inactive light-mode'>`, jsondata[\"type\"][i], \"</span>\")} ${checkIfEmptyValue(`<span class='hashtag hashtag-${jsondata[\"community\"][i]} inactive light-mode'>`, jsondata[\"community\"][i], \"</span>\")}</p>`);\n passageContainer.appendChild(div);\n var year0 = jsondata[\"year\"][i];\n //enable filtering by hashtag\n document.querySelectorAll('span.hashtag').forEach((x) => {\n x.addEventListener('click', filterByHashtag);\n })\n // add functionality to lightswitch\n const lightSwitch = document.getElementById('flexSwitchCheckDefault');\n lightSwitch.addEventListener('change', e => {\n if(e.target.checked === true) {\n console.log(\"Checkbox is checked - boolean value: \", e.target.checked);\n changeToDarkMode();\n }\n if(e.target.checked === false) {\n console.log(\"Checkbox is not checked - boolean value: \", e.target.checked);\n changeToLightMode();\n }\n });\n };\n }\n );\n return jsondata;\n}" ]
[ "0.57377356", "0.5270778", "0.526762", "0.5255141", "0.5207966", "0.51788485", "0.51779246", "0.51768345", "0.5156462", "0.5125829", "0.5097602", "0.506294", "0.5008472", "0.49900922", "0.4970971", "0.49272928", "0.49175787", "0.49066842", "0.488469", "0.48751068", "0.48486567", "0.48484588", "0.48446333", "0.4836885", "0.4818712", "0.48155802", "0.4811888", "0.4805841", "0.47902402", "0.47708583" ]
0.53065634
1
Creates a new LibraryAtlas
function LibraryAtlas(uid, shapePadding) { if (typeof shapePadding === "undefined") { shapePadding = 4; } this.uid = uid; this.shapePadding = shapePadding; /** * Contains the blocks used in the Binary Packing * @type {Array} */ this.blocks = []; LibraryAtlas.LIBS[uid] = this; // Create the Canvas&Context this.canvas = new Canvas(); this.context = this.canvas.getContext('2d'); // create css template this.cssCompiledTemplate = handlebars.compile(fs.readFileSync(__dirname + '/../templates/LibrarySpriteSheet.tpl', 'utf8'), { noEscape: true }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createLibrary(name) {\n var denverLibrary = {\n name: name,\n shelves: {\n fantasy: [],\n fiction: [],\n nonFiction: []\n }\n }\n return denverLibrary;\n}", "function NewLibrary() {\n//this.property = value\n this.books = [];\n this.currentCallNumber = 0;\n}", "async library(id) {\n if (this.__library[id]) {\n return this.__library[id];\n }\n\n try {\n await this.libraries.get(id);\n } catch(e) {\n if (e.status === 404) {\n return null;\n } else {\n throw e;\n }\n }\n\n const library = new this.PouchDB(path.join(this.dataFolder, `library-${id}.db`));\n this.__library[id] = library;\n\n return library;\n }", "function Library(name,creator){\n this.name = name;\n this.creator = creator;\n this.playlists = [];\n}", "function Library() {\n \n}", "function createMadlib()\n{\n\t//get words to replace\n\tgetWordsToReplace();\n\n\tcreateMadlibElements()\n}", "function readLibrary(xmlLibrary) {\r\n var type = xmlLibrary.getAttribute(\"type\");\r\n var library = new JSGDemo.model.Library(type);\r\n self.libraries.put(type, library);\r\n\r\n var xmlLabels = xmlLibrary.getElementsByTagName(\"typename\");\r\n var xmlLabel = xmlLabels[0].getElementsByTagName(JSGDemo.lang);\r\n \r\n xmlLabels = xmlLibrary.getElementsByTagName(\"name\");\r\n xmlLabel = xmlLabels[0].getElementsByTagName(JSGDemo.lang);\r\n library.name = xmlLabel[0].childNodes[0].nodeValue.decode();\r\n\r\n return library;\r\n }", "function createScene() {\n const scene = new BABYLON.Scene(engine);\n\n const camera = new BABYLON.ArcRotateCamera(\"camera\", -Math.PI / 2, Math.PI / 2.5, 15, new BABYLON.Vector3(0, 0, 0));\n camera.attachControl(canvas, true);\n const light = new BABYLON.HemisphericLight(\"light\", new BABYLON.Vector3(1, 1, 0)); \n\n BABYLON.SceneLoader.ImportMeshAsync(\"\", \"./\", \"village.glb\");\n\n return scene;\n}", "function makeLibrary(response, type, err, contents, data)\n{\n var replacement = \"\";\n var table = util.getTable();\n var columns = [\"Author\", \"Title\", \"Year\", \"Notes\"];\n var row = [];\n var author = \"\", title = \"\", year = \"\", notes = \"\";\n\n table.setHTMLClass(\"conq\");\n table.setColumns(columns);\n for(var i = 0; i < data.length; i++)\n {\n author = util.deNullify(data[i].fullTitle);\n title = util.linkify(data[i].title, data[i].link);\n year = data[i].yearPublished;\n notes = util.deNullify(data[i].notes, \".\");\n row = [author, title, year, notes];\n table.addRow(row);\n }\n replacement = table.buildHTMLPrintout();\n\n contents = util.absRep(contents, \"LIBRARY\", replacement);\n\n final.wrapup(response, type, err, contents);\n}", "function createBucket() {\n metadata\n .buckets.set(bucketName, new BucketInfo(bucketName, ownerID, '', ''));\n metadata.keyMaps.set(bucketName, new Map);\n}", "function Libs (){\r\n if (!(this instanceof Libs)){\r\n return new Libs\r\n }\r\n}", "async function createNewContract() {\n var deploy = await LANDMARK.new()\n LANDMARK_instance = LANDMARK.at(deploy.address);\n}", "function createNewCatalog() {\n en.catalog.create(locationName, \n function(data) {\n locationID = data.response.id;\n },\n function(data) {\n error(\"Couldn't create catalog \" + locationName);\n }\n );\n}", "function prepareLib( loads, cb ){\n\t\tvar tempConfig = loads.slice();\n\t\tvar ret_lib = {};\n\t\tloadOne();\n\t\t\n\t\tfunction loadOne(){\n\t\t\tif( tempConfig.length > 0 ){\n\t\t\t\tvar conf = tempConfig.shift();\n\t\t\t\tvar name = conf[0];\n\t\t\t\tvar path = conf[1];\n\t\t\t\tvar mtlPath = conf[2];\n\t\t\t\tif( mtlPath != undefined ){\n\t\t\t\t\tloadMeshAndMaterials( path, mtlPath, function ( mesh ) {\t\t\t\t\t\t//conf.mesh = mesh;\n\t\t\t\t\t\tret_lib[name] = mesh;\n\t\t\t\t\t\tloadOne();\n\t\t\t\t\t});\n\t\t\t\t}else{\n\t\t\t\t\tloadMesh( path, undefined, function ( mesh ) {\n\t\t\t\t\t\tret_lib[name] = mesh;\n\t\t\t\t\t\tloadOne();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tcb( ret_lib );\n\t\t\t}\n\t\t}\n\t}", "function createPkg(name, root) {\n return root[name] = createDict();\n }", "function create(library, node) {\n return Tools.instance({\n library,\n node,\n childWraps: node.children.map(library.createWrap),\n domNode: null,\n events: null\n }, {\n renderToString,\n renderToDom,\n mount,\n update,\n unmount\n });\n}", "function addBookToLibrary(name, author, pages, readStatus) {\r\n let book = new Book(name, author, pages, readStatus);\r\n myLibrary.push(book);\r\n render();\r\n}", "async createBundle () {\n const name = `${this.appIdentifier}_${this.options.branch}_${this.options.arch}.flatpak`\n const dest = this.options.rename(this.options.dest, name)\n this.options.logger(`Creating package at ${dest}`)\n const extraExports = []\n if (this.options.icon && !_.isObject(this.options.icon)) {\n extraExports.push(this.pixmapIconPath)\n }\n\n const files = [\n [this.stagingDir, '/']\n ]\n const symlinks = [\n [path.join('/lib', this.appIdentifier, this.options.bin), path.join('/bin', this.options.bin)]\n ]\n\n const command = (await this.requiresSandboxWrapper()) ? 'electron-wrapper' : this.options.bin\n\n return flatpak.bundle({\n id: this.options.id,\n branch: this.options.branch,\n base: this.options.base,\n baseVersion: this.options.baseVersion.toString(),\n runtime: this.options.runtime,\n runtimeVersion: this.options.runtimeVersion.toString(),\n sdk: this.options.sdk,\n finishArgs: this.options.finishArgs,\n command,\n modules: this.options.modules\n }, {\n ...this.flatpakrefs,\n arch: this.options.arch,\n bundlePath: dest,\n extraExports: extraExports,\n extraFlatpakBuilderArgs: this.options.extraFlatpakBuilderArgs,\n files: files.concat(this.options.files),\n symlinks: symlinks.concat(this.options.symlinks)\n })\n }", "function createNewNamespace(tagNode)\n{\n var cNodes = g_libDom.getElementsByTagName(\"TAGLIBRARIES\");\n \n // We know for sure there's only one TAGLIBRARIES element, hence use 0.\n var iHTML = cNodes[0].innerHTML;\n\n // Set the Namespace and format the line.\n var tagReplacePattern = /@@NAME@@/g;\n var newTagLib = g_tagLibOpenPattern.replace(tagReplacePattern, tagNode.NAMESPACE);\n newTagLib = newTagLib + \"\\r\\n\" + g_tagLibClosePattern;\n\n // Add a new line char to the end \n iHTML = iHTML + \"\\r\\n\" + newTagLib;\n cNodes[0].innerHTML = iHTML;\n}", "function addToLibrary(palette) {\n // console.log(`${palette.name} added to library`);\n const paletteDiv = document.createElement('div');\n paletteDiv.classList.add('custom-palette');\n\n const title = document.createElement('h4');\n title.innerText = palette.name;\n\n const previewDiv = document.createElement('div');\n previewDiv.classList.add('preview');\n palette.colors.forEach(color => {\n const colorPreview = document.createElement('div');\n colorPreview.classList.add('color');\n colorPreview.style.background = color;\n previewDiv.appendChild(colorPreview);\n });\n\n const paletteBtn = document.createElement('button');\n paletteBtn.classList.add('palette-select');\n paletteBtn.classList.add(palette.num);\n paletteBtn.innerText = 'Select';\n\n paletteBtn.addEventListener('click', () => {\n updateColors(palette.colors);\n toggleLibPanel();\n });\n\n paletteDiv.appendChild(title);\n paletteDiv.appendChild(previewDiv);\n paletteDiv.appendChild(paletteBtn);\n libPanel.children[0].appendChild(paletteDiv);\n}", "function loadAssetLibrary(libs, type, dir, libId, fileName, params, ok) {\n if (!libs[libId]) {\n libs[libId] = true;\n Human.assets.getAssetLibrary(type, dir, libId, fileName, params, ok);\n }\n }", "function loadAtlas(lvls)\n\t\t{\n\t\t\tdataLvls = lvls;\n\t\t\treturn new Promise ( (ok, error) =>\n\t\t\t{\n\t\t\t\tlet atlas = new XMLHttpRequest();\n\t\t\t\tatlas.open(\"GET\", \"img/Tiles/atlas.xml\");\n\t\t\t\tatlas.onreadystatechange = function()\n\t\t\t\t{\n\t\t\t\t\tif(atlas.readyState == 4)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(atlas.status == 200)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlet atlasParser = new DOMParser();\n\t\t\t\t\t\t\tlet xmlDoc = atlasParser.parseFromString(this.responseText, \"text/xml\");\n\t\t\t\t\t\t\tok(xmlDoc.getElementsByTagName(\"SubTexture\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tconsole.log(atlas.status);\n\t\t\t\t\t\t\terror (\"chargement du fichier json\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tatlas.send();\n\t\t\t});\n\t\t}", "function addBookToLibrary(book) {\n library.push(book);\n}", "create () {\n let asteroidsGroup = this.gameObjects['asteroids-group'] = new AsteroidsGroup(this.game);\n\n this.spawnAsteroids(25);\n this.setupUI();\n }", "function addDocToLibraries (doc) {\n //AppController.sharedInstance().librariesController().addAssetLibraryAtURL(doc.fileURL())\n\tdoc.saveAndAddLibrary()\n}", "static createLinkedPackage(name, version, folderPath, packageJson) {\n return new BasePackage(name, version, folderPath, packageJson);\n }", "function create(library, node) {\n return Tools.instance({\n text: node.text,\n domNode: null\n }, {\n renderToString,\n renderToDom,\n mount,\n update,\n unmount\n });\n}", "create () {}", "create () {}", "function createLicense() {}" ]
[ "0.64622486", "0.5337491", "0.5260609", "0.525528", "0.52491814", "0.516564", "0.51183516", "0.5086852", "0.506477", "0.5023035", "0.50163406", "0.50099206", "0.50010246", "0.4973214", "0.49606636", "0.49443272", "0.49343997", "0.4902602", "0.48722452", "0.48701003", "0.48535052", "0.48406926", "0.48288637", "0.48194227", "0.48076802", "0.47974178", "0.4793001", "0.4791242", "0.4791242", "0.47668862" ]
0.66683453
0
This bit of disgustingness is to deal with a bug (28/11/2017) in the Twitch JS Helper. Normally you would call listen for the whisper channel inside onAuthorized when you get your opaque ID, however, calling twitch.listen inside onAuthorise causes the listen function to be registered more than one time for some reason. So we wait for onAuth to be called and then register the listener here.
function whisperHack() { if (!firstTimeOnly) { // Listen to this viewer's private PubSub whisper channel twitch.listen('whisper-'+latestAuth.userId, (target, type, msg) => { // console.log("New Twitch PubSub whisper:", msg); }); } else { setTimeout(whisperHack, 1000); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_registerExternalAuthListeners () {\n this.migration = caller('migration', {postMessage: window.parent.postMessage.bind(window.parent)})\n this.authenticate = caller('authenticate', {postMessage: window.parent.postMessage.bind(window.parent)})\n this.createLink = caller('createLink', {postMessage: window.parent.postMessage.bind(window.parent)})\n }", "function listenForAuthChanges() {\r\n auth.onAuthStateChanged(user => {\r\n if (user) {\r\n user.getIdTokenResult().then(idTokenResult => {\r\n user.admin = idTokenResult.claims.admin;\r\n Client.setupUI(user, db);\r\n })\r\n showMovieList();\r\n } else {\r\n Client.setupUI();\r\n hideMovieList();\r\n }\r\n })\r\n}", "init() {\n _listenToCurrentUser();\n }", "function registerAuthenticationListener() {\n lock.on('authenticated', function (authResult) {\n localStorage.setItem('id_token', authResult.idToken);\n authManager.authenticate();\n\n lock.getProfile(authResult.idToken, function (error, profile) {\n if (error) {\n return console.log(error);\n }\n\n localStorage.setItem('profile', JSON.stringify(profile));\n deferredProfile.resolve(profile);\n });\n\n });\n }", "_setListeners() {\n this.rtm.on(CLIENT_EVENTS.RTM.AUTHENTICATED, (data) => {\n // Remember our own id and workspace users when signed in\n this.botId = data.self.id;\n this.slackUsers = data.users;\n });\n\n this.rtm.on(CLIENT_EVENTS.RTM.RTM_CONNECTION_OPENED, () => {\n // Update our saved user list when RTM connection is opened.\n this._updateUsers()\n .then(() => {\n // Run task if there is one\n if (this.task && typeof this.task === 'function') {\n this.task(this);\n }\n })\n .catch(() => {});\n });\n\n // If this bot is not performing a task, it should start listening to messages\n if (!this.task) {\n this._setMessageListener();\n }\n }", "function addListener(expectedTabId, rootName) {\n chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {\n if (tabId !== expectedTabId) {\n // Another tab updated.\n return;\n }\n //console.log(\"Page Status: \" + changeInfo.status);\n if (changeInfo.status === \"loading\") {\n let currentMessage = document.getElementById(\"status\").textContent;\n if (!(currentMessage.includes(\"Getting\") ||\n currentMessage.includes(\"Refreshings\") ||\n currentMessage.includes(\"Trying\"))) {\n renderStatus(\"Getting Access \\u2026\");\n document.getElementById(\"status\").style.color = \"#fff\";\n }\n hide(document.getElementById(\"statusIcon\"));\n show(document.getElementById(\"loaderContainer1\"));\n } else if (changeInfo.status === \"complete\") {\n let url;\n \n // this line requires the \"tabs\" permision\n try { url = getUrlFromTab(tab); }\n catch (error) {\n console.log(\"CAUGHT-\" + error);\n renderUnknown(\"Can\\u2019t confirm access.\");\n return;\n }\n let loginCheck = url.includes(\"idp.mit.edu\");\n let redirectCheck = url.toLowerCase().includes(\"redirect\");\n let failCheck1 = url.includes(\"libproxy.mit.edu/login?url=\");\n let failCheck2 = url.includes(\"libproxy.mit.edu/menu\") && url.length < 30;\n let failCheck3 = url.includes(\"libproxy.mit.edu/connect?session\");\n if (loginCheck) {\n if (redirectCheck) {\n // an expected redirect\n //console.log(\"URL indicates redirect.\");\n } else {\n //console.log(\"URL indicates login.\");\n renderStatus(\"Provide your MIT credentials.\");\n closeLoader();\n presentIcon(\"lock\");\n }\n } else if (failCheck1 || failCheck2 || failCheck3) {\n //console.log(\"URL indicates failure.\");\n renderFailure(rootName + \" is not a supported proxy site.\"); \n } else if (successCheckUrl(url)) {\n //console.log(\"URL indicates success.\");\n renderSuccess();\n } else {\n //console.log(\"URL was unexpected.\");\n renderUnknown(\"Unexpected redirect.\");\n } \n }\n });\n}", "function registerAuthenticationListener() {\n\n lock.on('authenticated', function (authResult) {\n localStorage.setItem('id_token', authResult.idToken);\n authManager.authenticate();\n\n lock.getProfile(authResult.idToken, function(error, profile) {\n if (!error) {\n localStorage.setItem('profile', JSON.stringify(profile));\n $rootScope.name = profile.name;\n var url = localStorage.getItem('redirect_url').replace('#!','');\n if(url) {\n $location.path(url);\n }\n } else {\n console.log(error);\n }\n });\n });\n }", "on_connecter() {\n this.enregistrerChannel()\n }", "init() {\n this._onEndpointConnStatusChanged = this.onEndpointConnStatusChanged.bind(this);\n this.rtc.addListener(_service_RTC_RTCEvents__WEBPACK_IMPORTED_MODULE_5___default.a.ENDPOINT_CONN_STATUS_CHANGED, this._onEndpointConnStatusChanged); // Handles P2P status changes\n\n this._onP2PStatus = this.refreshConnectionStatusForAll.bind(this);\n this.conference.on(_JitsiConferenceEvents__WEBPACK_IMPORTED_MODULE_1__[\"P2P_STATUS\"], this._onP2PStatus); // Used to send analytics events for the participant that left the call.\n\n this._onUserLeft = this.onUserLeft.bind(this);\n this.conference.on(_JitsiConferenceEvents__WEBPACK_IMPORTED_MODULE_1__[\"USER_LEFT\"], this._onUserLeft); // On some browsers MediaStreamTrack trigger \"onmute\"/\"onunmute\"\n // events for video type tracks when they stop receiving data which is\n // often a sign that remote user is having connectivity issues\n\n if (_browser__WEBPACK_IMPORTED_MODULE_4__[\"default\"].supportsVideoMuteOnConnInterrupted()) {\n this._onTrackRtcMuted = this.onTrackRtcMuted.bind(this);\n this.rtc.addListener(_service_RTC_RTCEvents__WEBPACK_IMPORTED_MODULE_5___default.a.REMOTE_TRACK_MUTE, this._onTrackRtcMuted);\n this._onTrackRtcUnmuted = this.onTrackRtcUnmuted.bind(this);\n this.rtc.addListener(_service_RTC_RTCEvents__WEBPACK_IMPORTED_MODULE_5___default.a.REMOTE_TRACK_UNMUTE, this._onTrackRtcUnmuted); // Track added/removed listeners are used to bind \"mute\"/\"unmute\"\n // event handlers\n\n this._onRemoteTrackAdded = this.onRemoteTrackAdded.bind(this);\n this.conference.on(_JitsiConferenceEvents__WEBPACK_IMPORTED_MODULE_1__[\"TRACK_ADDED\"], this._onRemoteTrackAdded);\n this._onRemoteTrackRemoved = this.onRemoteTrackRemoved.bind(this);\n this.conference.on(_JitsiConferenceEvents__WEBPACK_IMPORTED_MODULE_1__[\"TRACK_REMOVED\"], this._onRemoteTrackRemoved); // Listened which will be bound to JitsiRemoteTrack to listen for\n // signalling mute/unmute events.\n\n this._onSignallingMuteChanged = this.onSignallingMuteChanged.bind(this); // Used to send an analytics event when the video type changes.\n\n this._onTrackVideoTypeChanged = this.onTrackVideoTypeChanged.bind(this);\n }\n\n this._onLastNChanged = this._onLastNChanged.bind(this);\n this.conference.on(_JitsiConferenceEvents__WEBPACK_IMPORTED_MODULE_1__[\"LAST_N_ENDPOINTS_CHANGED\"], this._onLastNChanged);\n this._onLastNValueChanged = this.refreshConnectionStatusForAll.bind(this);\n this.rtc.on(_service_RTC_RTCEvents__WEBPACK_IMPORTED_MODULE_5___default.a.LASTN_VALUE_CHANGED, this._onLastNValueChanged);\n }", "function listener(event) {\n if (event.data && event.data.sessionId) {\n if (event.origin !== window.location.origin) {\n logger.warn(`Ignoring sessionId from different origin: ${event.origin}`);\n return;\n }\n\n _settings_Settings__WEBPACK_IMPORTED_MODULE_1__[\"default\"].sessionId = event.data.sessionId; // After popup is closed we will authenticate\n }\n } // Register", "function getChannelIdCallback(details) {\n console.log(\"channelId callback arrived, channel Id is '\" +\n details.channelId + \"'\");\n var channelId = details.channelId;\n if (\"\" == channelId) {\n chrome.test.fail(\"No channelId, test failed.\");\n } else {\n getAccessToken(channelId);\n }\n}", "function registerAuthenticationListener() {\n lock.on('authenticated', function(authResult) {\n localStorage.setItem('id_token', authResult.idToken);\n authManager.authenticate();\n\n lock.getProfile(authResult.idToken, function(error, profile) {\n if (error) {\n return console.log(error);\n }\n var userDetails = {\n emailAddress: profile.email,\n firstName: profile.given_name,\n lastName: profile.family_name,\n gender: profile.gender,\n socialId: profile.identities[0].user_id\n };\n $http.post(\"http://75.118.135.179:9080/BuffDaddyAPI/register\", JSON.stringify(userDetails))\n .then(\n function successCallback(response) {\n console.log(\"Success register\");\n },\n function errorCallback(response) {\n alert(\"Error \" + JSON.stringify(response));\n });\n localStorage.setItem('profile', JSON.stringify(profile));\n deferredProfile.resolve(profile);\n });\n\n });\n }", "function initAPIListeners() {\n /*\n * This listens in for whenever a new DJ starts playing.\n */\n API.addEventListener(API.DJ_ADVANCE, djAdvanced);\n\n /*\n * This listens for changes in the waiting list\n */\n API.addEventListener(API.WAIT_LIST_UPDATE, queueUpdate);\n\n /*\n * This listens for changes in the dj booth\n */\n API.addEventListener(API.DJ_UPDATE, queueUpdate);\n\n /*\n * This listens for whenever a user in the room either WOOT!s\n * or Mehs the current song.\n */\n API.addEventListener(API.VOTE_UPDATE, function (obj) {\n if (userList) {\n populateUserlist();\n }\n });\n\n /*\n * Whenever a user joins, this listener is called.\n */\n API.addEventListener(API.USER_JOIN, function (user) {\n if (userList) {\n populateUserlist();\n }\n });\n\n /*\n * Called upon a user exiting the room.\n */\n API.addEventListener(API.USER_LEAVE, function (user) {\n if (userList) {\n populateUserlist();\n }\n });\n\n API.addEventListener(API.CHAT, checkCustomUsernames);\n}", "_setupListeners() {\n whitelistStatusControllerLogger.info(\"Setting up Listeners...\");\n document.getElementById(\"discord_login\").onclick = () => {\n this.checkStatus();\n };\n }", "function callListener(event, origin) {\n function generateThisObject() {\n return {\n getOriginalListener: ytcenter.utils.funcBind(null, getYouTubeListener, event)\n };\n }\n \n var ytEvent = \"ytPlayer\" + event + \"player\" + playerId;\n var args = Array.prototype.slice.call(arguments, 2);\n var returnVal = null;\n \n if (enabled && origin === 0 && (!events.hasOwnProperty(event) || (events.hasOwnProperty(event) && !events[event].override))) {\n /* Override is false and the origin is from the player; call the YouTube Center listeners */\n if (events.hasOwnProperty(event)) {\n for (var i = 0, len = events[event].listeners.length; i < len; i++) {\n returnVal = events[event].listeners[i].apply(null, args);\n }\n }\n } else if (enabled && origin === 1) {\n if (events.hasOwnProperty(event) && events[event].override) {\n /* Override is true and the origin is from the global window; call the YouTube Center listeners */\n for (var i = 0, len = events[event].listeners.length; i < len; i++) {\n events[event].listeners[i].apply(generateThisObject(), args);\n }\n con.log(\"[Player Listener] Event \" + event + \" was called with\", args);\n } else if (ytListeners[ytEvent]) {\n if (apiNotAvailable) {\n /* API is not available therefore call YouTube Center listeners as YouTube listener is called */\n for (var i = 0, len = events[event].listeners.length; i < len; i++) {\n returnVal = events[event].listeners[i].apply(null, args);\n }\n }\n \n /* Override is false and the origin is from the global window; call the YouTube listener */\n returnVal = ytListeners[ytEvent].apply(uw, args);\n \n con.log(\"[Player Listener] Event \" + event + \" was called with\", args);\n }\n } else if (!enabled) {\n /* Everything is disabled; call the YouTube listener */\n returnVal = ytListeners[ytEvent].apply(uw, args);\n }\n return returnVal;\n }", "add_cm_listener(listener) {\n\n }", "subscribeRoom() {\n currentUser\n .subscribeToRoom({\n roomId: presenceRoomId,\n // action hooks. These functions will be executed when any of the four events below happens\n hooks: {\n onUserCameOnline: this.handleInUser,\n onUserJoinedRoom: this.handleInUser,\n onUserLeftRoom: this.handleOutUser,\n onUserWentOffline: this.handleOutUser\n }\n })\n }", "beforeConnectedCallbackHook(){\n\t\t\n\t}", "listen (pack, event, params) {\n const __callbacks = {};\n const __eventCallback = (event) => __callbacks[event] || function () {};\n\n const user_id = `${pack}.${event}_${this.project}:${this.key}`;\n request({\n uri: `${RapidAPI.callbackBaseURL()}/api/get_token?user_id=${user_id}`,\n method: 'GET',\n headers: {\n \"Content-Type\": \"application/json\"\n },\n auth: {\n 'user': this.project,\n 'pass': this.key,\n 'sendImmediately': true\n }\n }, (error, response, body) => {\n const { token } = JSON.parse(body);\n const sock_url = `${RapidAPI.websocketBaseURL()}/socket/websocket?token=${token}`;\n const socket = new Socket.Socket(sock_url, {\n params: {token}\n });\n socket.connect();\n const channel = socket.channel(`users_socket:${token}`, params);\n channel.join()\n .receive('ok', msg => { __eventCallback('join')(msg); })\n .receive('error', reason => { __eventCallback('error')(reason); })\n .receive('timeout', () => { __eventCallback('timeout'); });\n\n channel.on('new_msg', msg => {\n if (!msg.token) {\n __eventCallback('error')(msg.body);\n } else {\n __eventCallback('message')(msg.body);\n }\n });\n channel.onError(() => __eventCallback('error'));\n channel.onClose(() => __eventCallback('close'));\n });\n const r = {\n on: (event, func) => {\n if (typeof func !== 'function') throw \"Callback must be a function.\";\n if (typeof event !== 'string') throw \"Event must be a string.\";\n __callbacks[event] = func;\n return r;\n }\n };\n return r;\n }", "function twitchInit() {\n console.debug('twitchInit');\n play();\n twitchUpdateCall();\n twitchUpdateCallInterval =\n setInterval(twitchUpdateCall, twitchUpdateCallFrequency);\n}", "function onPublisherCredOffer() {\n if (!uuid) return;\n socket.emit(\"publisher-cred-offer-sub\", uuid);\n socket.on(\"publisher-cred-offer-done\", () => {\n socket.emit(\"publisher-cred-offer-unsub\", uuid);\n setPublisherCredentialOffer(false);\n mutate(`${PUBLICATION_PATH}/${id}`);\n });\n setPublisherCredentialOffer(true);\n }", "function addHanldeOnAuthenticated(rtm, handler) {\n rtm.on(\"authenticated\", handler);\n}", "function identify(request, response) {\n let { socket_id, channel_name } = request.body;\n\n var auth = pusher.authenticate(socket_id, channel_name, {\n // request.user.token comes from sonos-oauth.authenticated\n user_id: encrypt(request.user.token)\n });\n\n response.send(auth);\n\n // For the reconnect case, start subscribing to the related channel. If a\n // user is reconnecting, we need to subscribe again\n subscribe(channel_name, request.user.token);\n}", "onAuthentication(func) {\n this._onAuthCallbacks.push(func);\n }", "function onConnectedHandler(addr, port)\n{\n\tconsole.log('* Connected successfully to Twitch channel: '.concat(CHAT_CHANNEL));\n}", "function onConnectedHandler (addr, port) {\n\twriteToLog(`* Connected to Twitch: ${addr}:${port}`);\n}", "function onExistingParticipants(msg) {\r\n\tuserId = msg.userId;\r\n\tvar iceServers = [\r\n\t\t{\r\n\t\t\turl: 'turn:' + turnUrl,\r\n\t\t\tusername: turnUsername,\r\n\t\t\tcredential: turnCredential\r\n\t\t}\r\n\t];\r\n\tlet videoConstraints = null;\r\n\tif (msg.videoOn === true) {\r\n\t\tif (reduceFramerateKurento===\"true\"){\r\n\t\t\tvideoConstraints = {\r\n\t\t\t\tframeRate: {\r\n\t\t\t\t\tmin: 2, ideal: 15, max: 30\r\n\t\t\t\t},\r\n\t\t\t\twidth: {\r\n\t\t\t\t\tmin: 50, ideal: 250, max: 640\r\n\t\t\t\t},\r\n\t\t\t\theight: {\r\n\t\t\t\t\tmin: 32, ideal: 250, max: 640\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t} else {\r\n\t\tvideoConstraints = false;\r\n\t}\r\n\r\n\tvar constraints = {\r\n\r\n\r\n\t\taudio: msg.audioOn,\r\n\t\tvideo: videoConstraints,\r\n\t\tconfigurations: {\r\n\t\t\ticeServers: iceServers\r\n\t\t}\r\n\r\n\t};\r\n\tconsole.log(userId + \" registered in room \" + roomId);\r\n\tvar participant = new Participant(name, userId, selfStream);\r\n\tparticipants[userId] = participant;\r\n\r\n\tvar options = {\r\n\t\tlocalVideo: selfStream,\r\n\t\tmediaConstraints: constraints,\r\n\t\tonicecandidate: participant.onIceCandidate.bind(participant),\r\n\r\n\r\n\t}\r\n\t//user connects to KMS\r\n\tparticipant.rtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerSendonly(options,\r\n\t\tfunction (error) {\r\n\t\t\tif (error) {\r\n\t\t\t\t/*return*/\r\n\t\t\t\tconsole.error(error);\r\n\t\t\t}\r\n\t\t\tthis.generateOffer(participant.offerToReceiveVideo.bind(participant));\r\n\t\t\t//if user decided to turn his media devices off before the call has started\r\n\t\t\tif (audioBeforeEnterTheRoom === false) {\r\n\t\t\t\tremoveMediaTrack('audio');\r\n\t\t\t}\r\n\t\t\tif (videoBeforeEnterTheRoom === false) {\r\n\t\t\t\tremoveMediaTrack('video');\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t//user registers other users in this chat room\r\n\tmsg.data.forEach(receiveVideo);\r\n}", "function userLoggedInListener (roomName, occupants, isPrimary) {\n //update the global occupants list for this user.\n all_occupants_list = occupants;\n\n //as this callback method is also called on any user disconnection...\n //remove any 'zombie' easyrtc id from 'all_occupants_details' variable\n removeZombieClientsFromOccupantsDetails(occupants);\n\n //update the online/offline status as per the new list.\n //this update is important for someone leaves the connection.\n updateOnlineStatusOfClients(all_occupants_details);\n\n //spawn telepointers for the logged in users.\n spawnTelepointers(occupants);\n\n //inform my email, name along with easyrtc id, which is later used for different tracking\n informMyDetailsToAllOtherClients(occupants);\n\n //notifyAll('disconnected', \"Hello\");\n\n\n //FOR VIDEO STRM\n clearConnectList();\n var otherClientDiv = document.getElementById(\"otherClients\");\n for(var easyrtcid in occupants) {\n var button = document.createElement(\"button\");\n button.onclick = function(easyrtcid) {\n return function() {\n performCall(easyrtcid);\n };\n }(easyrtcid);\n var label = document.createTextNode(\"Call \" + getNameForAnEasyRTCid( easyrtc.idToName(easyrtcid) ) );\n button.appendChild(label);\n otherClientDiv.appendChild(button);\n }\n\n\n\n\n\n}", "addMessageChannelEventListener() {\n\t\tself.addEventListener('message', event => {\n\t\t\tif (!this.clientId.isApproved() && event.ports[0]) {\n\t\t\t\t//console.log('@serviceworker !!!ready');\n\t\t\t\tthis.clientId.approved = this.clientId.recent;\n\t\t\t\t// save messageChannel\n\t\t\t\tthis.messageChannel = event.ports[0];\n\t\t\t\tthis.doIntercept.push(event.data); // location.origin\n\t\t\t\tthis.messageChannel.postMessage('!!!ready');\n\t\t\t} else if (event.data && Array.isArray(event.data[0])) {\n\t\t\t\t// execute resolving function\n\t\t\t\t//console.log('@serviceworker got response:', event.data);\n\t\t\t\tconst resolveFuncs = this.resolveMap.get(event.data[0][1]); // key\n\t\t\t\tif (resolveFuncs) {\n\t\t\t\t\tevent.data[1] && Array.isArray(event.data[1]) ? resolveFuncs[0](event.data[1]) : resolveFuncs[1]();\n\t\t\t\t\tthis.resolveMap.delete(event.data[0][1]);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "function subscribeAuthStateChanged() {\n return Object(redux_saga__WEBPACK_IMPORTED_MODULE_4__[\"eventChannel\"])(function (emmiter) {\n var unsubscribe = authorizeService.onAuthStateChanged(function (userClaim) {\n emmiter(userClaim || {\n noUser: true\n });\n });\n return function () {\n unsubscribe();\n };\n });\n}" ]
[ "0.61958736", "0.58636725", "0.576607", "0.57518506", "0.5557802", "0.5553211", "0.5529361", "0.5524213", "0.55090606", "0.54507405", "0.5442383", "0.5430207", "0.5401749", "0.5368009", "0.5361097", "0.53551096", "0.53515387", "0.53437555", "0.5279312", "0.5274094", "0.5273579", "0.52702814", "0.5268829", "0.526857", "0.52145886", "0.52128875", "0.5196504", "0.51952416", "0.5164672", "0.51113254" ]
0.6062984
1
Worker that checks the sentiment of comments every 5 seconds
function startWorker(){ (function worker() { var channel_id = getGlobalChannelName(); // console.log("channel_id", channel_id); $.ajax({ type: "POST", url: "https://chat-snitcher-ebs.herokuapp.com/collect_chat_analysis", contentType: 'application/json', data: JSON.stringify({ channel_Id: channel_id}), success: function(data) { // on success write somethibg to HTML // { "average_sentiment": 0.27, "positive_sentiment_percentage":24, .... } var average_sentiment = data.average_sentiment; var positive_sentiment_percentage = data.positive_sentiment_percentage; var negative_sentiment_percentage = data.negative_sentiment_percentage; var neutral_sentiment_percentage = data.neutral_sentiment_percentage; // console.log("average sentiment", average_sentiment); // console.log("sentiment percentages, neg, positive, neutra;", negative_sentiment_percentage, positive_sentiment_percentage, neutral_sentiment_percentage); if (average_sentiment > 0.60){ var mood = "Awesome!!"; var img = document.createElement("IMG"); img.src = "images/awesome.gif"; } else if (average_sentiment >= 0.23 && average_sentiment <= 0.60 ){ mood = "Positive"; img = document.createElement("IMG"); img.src = "images/happy.gif"; } else if (average_sentiment > -0.38 && average_sentiment< 0.22){ mood = "Neutral"; img = document.createElement("IMG"); img.src = "images/neutral.gif"; } else if (average_sentiment <= -0.38 && average_sentiment >= -0.64){ mood = "Miffed"; img = document.createElement("IMG"); img.src = "images/miffed.gif"; } else if (average_sentiment < -0.64){ mood = "Bad"; img = document.createElement("IMG"); img.src = "images/bad.gif"; } else{ mood = "Error"+ average_sentiment ; } // assign values to divs var div = document.querySelector("#viewer_sentiment"); var pos_div = document.querySelector("#pos_percentage"); var neut_div = document.querySelector("#neut_percentage"); var neg_div = document.querySelector("#neg_percentage"); div.innerHTML = "Your chat room is feeling <mark>"+ mood + "</mark>"; pos_div.innerHTML = "Positive " + positive_sentiment_percentage + "%"; neg_div.innerHTML = "Negative " + negative_sentiment_percentage + "%"; neut_div.innerHTML = "Neutral " + neutral_sentiment_percentage + "%"; var image_div = document.querySelector("#imageDiv1"); image_div.innerHTML ='<img id="sentiment_image" src=' + img.src + ' class="img-thumbnail"></img>'; // document.getElementById('imageDiv').style.backgroundImage = img.src; }, complete: function() { // run every 10 seconds setTimeout(worker, 10000); } }); })(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function main(){\r\n const botSubmissions = await r.getUser('autolovepon').getSubmissions()\r\n botSubmissions.forEach(function(submission){\r\n parseThread(submission)\r\n\r\n //if pass certain comment threshold then pass to download function\r\n //or compare with a list of anime you follow\r\n })\r\n}", "function job_check_gmail_thread_snippet() {\n\n var search_query_array = config_gmail_search_array_();\n \n for (var i = 0; i < search_query_array.length; i++) {\n\n //console.log('searching: ' + search_query_array[i][1]);\n \n var result = threadQuery_(search_query_array[i][1]);\n\n //console.log(result);\n\n if(result.length > 0) {\n\n //console.log('result length is longer than 0');\n\n result.forEach(async function(r) {\n \n // console.log('posting card now');\n console.log(r);\n\n postTopicAsCard_(WEBHOOK_URL, CARD_TITLE, CARD_SUBTITLE, IMG_URL, search_query_array[i][0], r, CARD_LINK);\n\n //post_to_slack_(CARD_TITLE, CARD_SUBTITLE, search_query_array[i][0], r, CARD_LINK)\n\n var slack_payload = format_slack_payload(search_query_array[i][0], CARD_TITLE, r)\n \n send_alert_to_slack(slack_payload);\n\n\n });\n\n }\n\n }\n\n}", "async function restart() {\n\t\t\t//console.log('restart');\n\t\t\t\t\n\t\t\tlet commentsId = 'comments';\n\t\t\tcomments = document.getElementById(commentsId);\n\t\t\tif(!comments) return;\n\t\t\tlet threadTag = 'ytd-comment-thread-renderer';\n\t\t\tlet textTag = 'ytd-expander';\n\t\t\tlet threads = comments.getElementsByTagName(threadTag);\n\n\t\t\tfor (let thread of threads) {\n\t\t\t\tif (doneThreads.has(thread)) continue;\n\t\t\t\tdoneThreads.set(thread, 1);\n\t\t\t\t//console.log(thread);\n\t\t\t\tlet comment = thread.getElementsByTagName(textTag)[0];\n\t\t\t\tif(!comment) continue;\n\t\t\t\tlet baseComment = comment = comment.children[0].children[1];\n\t\t\t\tif(!comment) continue;\n\t\t\t\twhile(comment.firstChild && comment.firstChild.nodeType!=Node.TEXT_NODE) {\n\t\t\t\t\tcomment=comment.firstChild;\n\t\t\t\t}\n\t\t\t\tconsole.log(comment.innerHTML);\n\t\t\t\tif(comment.innerHTML.startsWith('0%')\n\t\t\t\t\t|| baseComment.children.length>3 && baseComment.children[2].innerHTML.trim()=='') {\n\t\t\t\t\t\t//todo: each span is followed by an empty one unless itself empty, check 3rd row, not 3rd span\n\t\t\t\t\tthread.style.display='none';\n\t\t\t\t\tconsole.log('removed: ' + comment.innerHTML);\n\t\t\t\t}\n\t\t\t}\n }", "async function runForComments(comments) {\n if (comments.length) {\n console.log('running for comments:', comments.map(({ id }) => id))\n }\n\n for (const { id, body, issue_url, created_at } of comments) {\n console.log(`processing comment ${id}`)\n const issueUrlSplit = issue_url.split('/')\n const issue = Number(issueUrlSplit[issueUrlSplit.length - 1])\n const surgeDomain = `lh-issue-runner-${issue}-${id}.surge.sh`\n await driver({ issue, commentText: body, surgeDomain })\n // only save state if any work was done\n state.since = created_at\n saveState()\n }\n}", "function showTweets() {\n //Fetch tweet in JSON form\n fetchTweets()\n //Begins the timer with 5 second interval\n timer = setInterval(fetchTweets, 5000)\n}", "checkIfPooped() {\n setInterval(() => {\n if (this.feedCount % 5 === 0) {\n this.hasPooped = true;\n }\n }, 1000);\n }", "function republishTweet() {\n const tenMinutes = 1000 * 60 * 10;\n\n setTimeout(function() {\n publishTweet();\n }, tenMinutes);\n}", "function tiktok() {\n int = setInterval(run, 1000); // configure interval\n}", "async function doLike () {\n try {\n // await ig.login(username, password);\n let medias = await ig.getTimeLineFeed();\n medias.map(async ({ node }) => {\n let now = new Date().getTime();\n let fourHours = 3600 * 4 * 1000;\n let mediaTimePost = node.taken_at_timestamp * 1000;\n if (mediaTimePost >= now - fourHours) {\n if (!node.viewer_has_liked) {\n await ig.like(node.id);\n }\n }\n });\n } catch (error) {\n console.error(error);\n }\n setTimeout(doLike, TIMEOUT);\n}", "function scrape(){\n obj = $(\".message-container\")\n for(var i =0; i < obj.length; i++){\n m = obj[i]\n if ($(m).hasClass(\"post-message-container\"))\n continue\n\n id = $(m).attr(\"data-reactid\")\n score = $(m).find(\".likes\").text().trim()\n text = $(m).find(\".message-text\").text()\n timeInfo = $(m).find(\".message-footer-item\")[0].children[0].text\n replies = $(m).find(\".comment-count\")[0].children[1]\n \n if(replies.children.length < 3)\n replies = 0 //no replies yet\n else\n replies = replies.children[2].children[1].innerText //traverse the html tree\n \n sendData(id + \":::\" + replies + \":::\" + score + \":::\" + text + \":::\" + timeInfo + \"\\r\\n\")\n }\n setTimeout(refreshPage, 1000 * 60 * 5) //refresh page every 5 min\n}", "function timedCommentSetup(){\n\n var renderCommentsTimeout = setTimeout(function(){clearTimeout(setupTimedCommentsPing);}, 40000);\n var setupTimedCommentsPing = setInterval(function() {\n if (eimeerTimedComments){\n clearTimeout(renderCommentsTimeout);\n clearTimeout(setupTimedCommentsPing);\n setInterval(updateTimedComments, 1000);\n }\n }, 1000);\n}", "async function main() {\n let fileName = await crawlExchange('coinmarketcap.com');\n await calculateStatistic(fileName, (exchanceList) => exchanceList.data);\n}", "function loop() { unread(null); setTimeout(loop, 60000)}", "function loadAndProcessTweets(/*days*/) {\n //https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets\n //https://codeburst.io/build-a-simple-twitter-bot-with-node-js-in-just-38-lines-of-code-ed92db9eb078\n \n var T = new Twitter(config);\n var params = {\n q: '#Nike', //q is the only required parameter, and is looking for tweets with Nike\n count: 1, //only want X number of results\n result_type: 'recent', //only most recent results\n lang: 'en' //only English results\n }\n return;\n T.get('search/tweets', params, function(err, data, response){\n if(!err){\n for(let i = 0; i < data.statuses.length; i++){\n // Get the tweet Id from the returned data\n let id = { id: data.statuses[i].id_str }\n //console.log(data.statuses[i]);\n var text = data.statuses[i].text;\n var timestamp = data.statuses[i].created_at;\n var adjusted_timestamp = moment(timestamp, 'ddd MMM DD HH:mm:ss +ZZ YYYY').format('YYYY-MM-DD h:mm:ss');\n // console.log(adjusted_timestamp);\n var sentiment = getSentiment(data.statuses[i]); //this might change as getSentiment changes\n // storeTweets(text, adjusted_timestamp, sentiment, positive, negative, neutral, mixed);\n }\n } else {\n console.log(err);\n }\n })\n}", "function ten_second_interval( last_song_id ) {\n // Reload the number of days since the last discrepancy log\n // was filed\n daysSinceLastIncident();\n\n // Reload the number of web stream listeners\n $.getJSON( \"https://stream.wmtu.mtu.edu:8000/status-json.xsl\", undefined, czech_listeners );\n\n // Load new items into the trackback feed\n last_song_id = load_trackback( false, last_song_id );\n\n // Load new items into the Twitter request feed\n $.getJSON( \"./twitter.php?first=false\", function( data ) {\n var i = 0;\n cycleTwitterFeed( i, data, false );\n } );\n\n // Reload the image\n cycleImageFeed();\n\n // Check whether or not songs are being logged\n check_logging();\n\n // Run again in ten seconds\n setTimeout( ten_second_interval, 10000, last_song_id );\n}", "function doWork() {\t\r\n\tdate = new Date();\r\n\tdone = false;\r\n\r\n\tstuck = 0;\r\n\r\n\tif (date.getHours() >= startTime && date.getHours() < endTime) {\r\n\t\teraseColors();\r\n\t\tsynthesis.cancel();\r\n\r\n\t\t// upon request, give description of project\r\n\t\tif (explanation == true) {\r\n\t\t\texplanation = false;\r\n\r\n\t\t\tsocket.emit('message', 'The tones you hear relate to the colors of the object being described.<br /><br /><br /><br />Low notes are colors at the beginning of the rainbow, like <font color=\"red\">red</font> and <font color=\"orange\">orange</font>.<br /><br />High notes are colors at the end of the rainbow, like <font color=\"blue\">blue</font> and <font color=\"purple\">purple</font>.<br /><br /><br /><br />Notes that play sooner represent more of the object\\'s color.<br /><br /><br /><br /><span style=\"font-size: 80%\">Small sounds are small objects.</span><br /><br /><span style=\"font-size: 120%\">Big sounds are big objects.</span><br /><br /><br /><br /><font color=\"#00b300\">Louder sounds are brighter colors.</font><br /><br /><font color=\"#3e743e\">Softer sounds are duller colors.</font>');\r\n\r\n\t\t\tfor (var i = 0; i < explanationSpeech.length; i++) {\r\n\t\t\t\tsynthesis.speak(explanationSpeech[i]);\r\n\t\t\t}\r\n\r\n\t\t// upon request, read selection of comments\r\n\t\t} else if (commentRequest == true) {\r\n\t\t\tcommentRequest = false;\r\n\t\t\treadComments();\r\n\r\n\t\t// mention explanation\r\n\t\t} else if (counter%explanationFrequence == 0) {\r\n\t\t\tsynthesis.speak(s);\r\n\t\t\tcounter++;\r\n\r\n\t\t// solicit comment\r\n\t\t} else if (counter%explanationFrequence == Math.floor(explanationFrequence/2)) {\r\n\t\t\tsynthesis.speak(c);\r\n\t\t\tcounter++;\r\n\t\t} else {\r\n\t\t\tgetData();\r\n\t\t\tcounter++;\r\n\t\t} \r\n\t} else if (date.getHours() == reloadTime && counter != 0 && reload) {\r\n\t\tsocket.emit('reloading');\r\n\t\tlocation.reload(true);\r\n\t}\r\n}", "function the_worker()\n {\n globalThis.onmessage = function(e)\n {\n const t = e.data.t;\n if(t < 1) postMessage(e.data.tick);\n else setTimeout(() => postMessage(e.data.tick), t);\n };\n }", "function doWorkflow() {\n\n var props = PropertiesService.getScriptProperties();\n var twit = new Twitterlib.OAuth(props);\n var i = -1;\n var tweets = searchTweets(twit);\n \n if(tweets) {\n for(i = tweets.length - 1; i >= 0; i--) {\n if(sendTweet(tweets[i].id_str, tweets[i].text, twit)) {\n ScriptProperties.setProperty(\"MAX_TWITTER_ID\", tweets[0].id_str);\n break;\n }\n }\n }\n if(i < 0) {\n Logger.log(\"No matching tweets this go-round\");\n }\n}", "commentCreated(body) {\n let data = body;\n const subs = \"fuck\";\n const pen = \"pending\";\n if (body.comment === \"pending\") return false;\n if (body.comment.includes(subs)) {\n data.status = \"Rejected\";\n } else {\n data.status = \"Approved\";\n }\n EventEmitter(\"commentModerated\", data)\n .then() //Feel free to notification or anything , How about lunching a nuclear weapon ?\n .catch(); //You are also free to report an error ? Maybe, try to warn others about the nuclear weapon you mistakenly targeted at your office ?\n }", "function tweeter() {\n\n // Live and Starting\n // var live = true;\n // var starting = false;\n\n\n // if (day != 4) {\n // live = false;\n // }\n // if (hours < 1 || hours > 1) {\n // live = false;\n // }\n\n // Live and Starting\n var tweet;\n // if (live | testing) {\n // Tweet undefined if it goes the LSTM route\n tweet = generateTweet();\n // Make sure nothing offensive\n while (tweet && wordfilter.blacklisted(tweet)) {\n tweet = generateTweet();\n }\n // }\n\n // Go ahead\n // if ((live || testing) && tweet) {\n if (tweet) {\n tweetIt(tweet);\n }\n\n\n}", "function worker() {\n // deleting obsolete data\n executed = executed.filter(obj => obj.executedAt + 1000 > Date.now());\n\n // running available requests\n for (let q in queue) {\n // max 2 request in 1 sec. for one client\n if (queue.hasOwnProperty(q) && executed.filter(obj => obj.client === queue[q].client).length < 2) {\n // remember for control API restrictions\n executed.push({\n client: queue[q].client,\n executedAt: Date.now(),\n });\n // execute request\n queue[q].callback();\n // exclude repeated request\n queue[q] = null;\n }\n }\n\n // clear queue\n queue = queue.filter(obj => obj);\n setTimeout(worker, 300);\n}", "async function AnalyzeApieceOfText() {\n let sentimentService = new sentiment.SentimentService(\n process.env.MICRO_API_TOKEN\n );\n let rsp = await sentimentService.analyze({\n text: \"this is amazing\",\n });\n console.log(rsp);\n}", "async function timerstuff(msg, bot) {\n var interval = setInterval(() => {\n var db = new sqlite3.Database(`./servers/${msg.guild.id}/${msg.guild.id}.db`);\n var fp = `./servers/${msg.guild.id}/server_config.json`;\n if(fs.existsSync(fp)){\n var json = jsonManip.jsonFileReader(fp);\n if (!json[isUsingFFAttribute]) {\n clearInterval(interval);\n }\n }else{\n clearInterval(interval);\n }\n let currentTime = Date.now();\n db.all(`SELECT timestamp, timerMillis\n FROM timers`, [], (err, rows) => {\n if (err) throw err;\n console.log(Math.floor((currentTime - rows[0].timestamp)))\n if (Math.floor((currentTime - rows[0].timestamp)) >= rows[0].timerMillis) {\n db.run(`UPDATE timers SET timestamp = ${currentTime} WHERE timerID = 1`);\n matching(msg, db, bot)\n }\n })\n }, 1000);\n}", "scheduleWatchMessages() {\n this.cronJob = schedule(checkFrequency, this.checkNewMessages.bind(this), {});\n }", "function job_check_gmail_count_only() {\n\n var search_query_array = config_gmail_search_array_();\n \n for (var i = 0; i < search_query_array.length; i++) {\n\n //console.log('searching: ' + search_query_array[i][1]);\n \n var result = countQuery_(search_query_array[i][1]);\n\n if(result > 0) {\n\n postTopicAsCard_(WEBHOOK_URL, CARD_TITLE, CARD_SUBTITLE, IMG_URL, search_query_array[i][0], result + ' emails found', CARD_LINK);\n\n post_to_slack_(CARD_TITLE, CARD_SUBTITLE, search_query_array[i][0], result + ' emails found', CARD_LINK)\n\n }\n\n }\n\n}", "function doTheWork() {\n getUrlsFromPage()\n // .then(urls => {\n // // check in reddis if url exists\n // // return filtered array\n // })\n .then((urls) => {\n urls.forEach(url => {\n //return console.log(url);\n crawl(url).then((car) => {\n printCar(car);\n // send email\n // for later us: client.set(\"string key\", \"string val\", redis.print);\n });\n });\n })\n}", "async function conduct() {\n\tfor (const [publicationType, publicationConfig] of Object.entries(publicationTypes)) {\n\t\t// lookup the total number of rss feeds or podcasts\n\t\tlet total = await publicationConfig.schema.count({});\n\t\t// never schedule more than 1/15 per minute interval\n\t\tlet maxToSchedule = Math.ceil(total / 15 + 1);\n\t\tlogger.info(\n\t\t\t`conductor will schedule at most ${maxToSchedule} to scrape per ${conductorInterval} seconds`,\n\t\t);\n\n\t\t// find the publications that we need to update\n\t\tlet publications = await publicationConfig.schema\n\t\t\t.find({\n\t\t\t\tisParsing: {\n\t\t\t\t\t$ne: true,\n\t\t\t\t},\n\t\t\t\tfollowerCount: {$gte: 1},\n\t\t\t\tvalid: true,\n\t\t\t\tlastScraped: {\n\t\t\t\t\t$lte: moment()\n\t\t\t\t\t\t.subtract(durationInMinutes, 'minutes')\n\t\t\t\t\t\t.toDate(),\n\t\t\t\t},\n\t\t\t\tconsecutiveScrapeFailures: {\n\t\t\t\t\t$lt: rand(),\n\t\t\t\t},\n\t\t\t})\n\t\t\t.limit(maxToSchedule).sort('-followerCount');\n\n\t\t// make sure we don't schedule these guys again till its finished\n\t\tlet publicationIDs = [];\n\t\tfor (let publication of publications) {\n\t\t\tpublicationIDs.push(publication._id);\n\t\t}\n\t\tlet updated = await publicationConfig.schema.update(\n\t\t\t{ _id: { $in: publicationIDs } },\n\t\t\t{\n\t\t\t\tisParsing: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tmulti: true,\n\t\t\t},\n\t\t);\n\t\tlogger.info(`marked ${updated.nModified} publications as isParsing`);\n\n\t\t// actually schedule the update\n\t\tlogger.info(`conductor found ${publications.length} of type ${publicationType} to scrape`);\n\t\tlet promises = [];\n\t\tfor (let publication of publications) {\n\t\t\tif (!isURL(publication.feedUrl)) {\n\t\t\t\tlogger.warn(`Conductor, url looks invalid for ${publication.feedUrl} with id ${publication._id}`)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlet job = { url: publication.feedUrl };\n\t\t\tjob[publicationType] = publication._id;\n\t\t\tlet promise = publicationConfig.enqueue(job, {\n\t\t\t\tremoveOnComplete: true,\n\t\t\t\tremoveOnFail: true,\n\t\t\t});\n\t\t\tpromises.push(promise);\n\t\t}\n\t\tawait Promise.all(promises);\n\n\t\tlogger.info(`Processing complete! Will try again in ${conductorInterval} seconds...`);\n\t}\n}", "async function updateNativeWatchList() {\n var watchList = document.getElementById(\"watchList\");\n var watchedThreads = watchList.getElementsByTagName('li');\n if(watchedThreads !== null && watchedThreads.length > 0) {\n \tfor(var i = 0; i < watchedThreads.length; i++) {\n \tvar thread = watchedThreads[i].id.split('-')[1]; // format is 'watch-12345-s4s'\n var board = watchedThreads[i].id.split('-')[2];\n \n // it's da [s4s] inderfase not da otherboard indaface\n if(board != 's4s') continue;\n\n // GM_getValue will store the ['thread' => 'number of last seen posts'] pairs\n var lastSeen = await GM.getValue(thread, false);\n\n // if we have watched this thread, we check for updates\n if(lastSeen !== false) {\n getCountSince(thread, lastSeen);\n }\n else {\n getNewestPost(thread);\n }\n }\n }\n\n}", "function voting() {\n let chan = bot.guilds\n .get(get('config.discord.serverID'))\n .channels.find('name', get('config.discord.channelName'));\n chan\n .send(votestart('...', 'Loading...'))\n .then(message => {\n requ()\n .then(arr => {\n tweets = arr;\n round = get('round');\n round++;\n db.set('round', round).write();\n let choices = tweets\n .map((cur, ind) => `${ind + 1}: ${cur}`)\n .join('\\n');\n message.edit(votestart(round, choices)).then(() => {\n go = true;\n e.once('complete', res => {\n chan\n .send(\n 'https://twitter.com/' +\n twitterUser.screen_name +\n '/status/' +\n res.id_str,\n {\n embed: {\n description: res.text,\n timestamp: moment()\n .add(get('options.cooldown.toNextVote'), 'minutes')\n .toISOString(),\n author: {\n name: `${twitterUser.name} (@${\n twitterUser.screen_name\n })`,\n icon_url: twitterUser.profile_image_url_https,\n url: 'https://twitter.com/' + twitterUser.screen_name\n },\n footer: {\n icon_url:\n 'https://abs.twimg.com/icons/apple-touch-icon-192x192.png',\n text: 'Next round is'\n }\n }\n }\n )\n .catch(error => {\n console.log(new Error(error));\n process.exit(1);\n });\n let wait = get('options.cooldown.toNextVote') * 60000;\n let currentRound = get('round');\n setTimeout(() => {\n if (!go && get('round') == currentRound) {\n voting();\n }\n }, wait);\n });\n });\n })\n .catch(error => {\n console.log(new Error(error));\n process.exit(1);\n });\n })\n .catch(error => {\n console.log(new Error(error));\n process.exit(1);\n });\n}", "runUpdate() {\n this.utils.log(\"\");\n this.utils.log(\"******************* Running update ******************* \");\n this.utils.log(\"\");\n\n // Reset update flags\n this.updateTweets = false;\n this.updateStatus = false;\n\n // Process any new tweets before performing other operations\n this.checkTrackedTweets().then(() => {\n // Process any mentions\n this.checkMentions().then(() => {\n // Save the status file if needed\n if (this.updateTweets || this.updateStatus) {\n this.dataHandler.saveStatus(this.botStatus);\n }\n });\n\n // Post a normal tweet\n this.actionHandler.postTweet(this.generator.generateResponse());\n\n });\n }" ]
[ "0.6835597", "0.5810288", "0.5720304", "0.57178414", "0.55585927", "0.5508826", "0.5481348", "0.54404646", "0.5433081", "0.54156774", "0.5384332", "0.5373829", "0.5351049", "0.53434616", "0.5324132", "0.52862245", "0.5258912", "0.52586526", "0.52499324", "0.52377635", "0.52367276", "0.52207136", "0.51963735", "0.5188856", "0.51741576", "0.5170113", "0.5166805", "0.5156631", "0.5156176", "0.5125556" ]
0.59157854
1
Finds and selects the first option labelled 'isDefault' from the item object
getDefaultItemOption(item) { item.options.some(option => ( option.isDefault ? !this.setState({ currentOption: option, }) : false )); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setDefaultSelectedOption() {\n var _a, _b;\n\n this.selectedIndex = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.findIndex(el => el.defaultSelected)) !== null && _b !== void 0 ? _b : -1;\n }", "function select_default_menu_item()\r\n{\r\n\tmenu_item_selected(document.getElementById('mi_home'));\r\n\t//menu_item_selected(document.getElementById('mi_custreqs'));\r\n}", "function getDefaultSelectValue(elem){\r\n\tvar name = elem.name;\r\n\tvar defaultElement = eval(\"document.\"+hatsForm.name+\".selectDefault\"+name);\r\n\tif (defaultElement == null){\r\n\t\tfor (var i=0,iL=elem.options.length; i<iL; ++i){\r\n\t\t\tif (elem.options[i].defaultSelected){\r\n\t\t\t\treturn elem.options[i].value;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null; \r\n\t} else {\r\n\t\treturn defaultElement.value;\r\n\t}\r\n}", "get firstSelectedOption() {\n var _a;\n\n return (_a = this.selectedOptions[0]) !== null && _a !== void 0 ? _a : null;\n }", "function getSelectedOption(options,value){var flatOptions=flattenOptions(options);var selectedOption=flatOptions.find(function(option){return value===option.value;});if(selectedOption===undefined){// Get the first visible option (not the hidden placeholder)\nselectedOption=flatOptions.find(function(option){return!option.hidden;});}return selectedOption?selectedOption.label:'';}", "_m_pick_default_option(ps_opt_name) {\n const lo_this = this;\n return(lo_this._ah_default_options[ps_opt_name]);\n }", "function setOpenQuestionAsDefault(){\n if (tieneOpMul){\n eliminarOpcionMultiple();\n }\n $('#questionType').val(1); //colocamos la pregunta abierta como default\n $('select option[value=\"1\"]').attr(\"selected\"); //colocamos la pregunta abierta como default\n }", "function setDefaults(container) {\n\tvar found = false;\n\tvar items = container.querySelectorAll(\".alm-filter--link\");\n\t[].concat(_toConsumableArray(items)).forEach(function (item, e) {\n\t\tif (item.classList.contains(\"active\")) {\n\t\t\tfound = true;\n\t\t}\n\t});\n\n\tif (found) return false;\n\n\tvar default_item = container.querySelector('.alm-filter--link[data-selected=\"true\"]');\n\tif (default_item) {\n\t\tdefault_item.classList.add(\"active\");\n\t\tdefault_item.setAttribute(\"aria-checked\", true);\n\t}\n}", "function selectDefaultMenuItem() {\r\n\t\tif ($(\"nav ul li.current\").length == 0) {\r\n\t\t\t$(\"nav ul li:first-child\").addClass(\"current\");\r\n\t\t}\r\n\t}", "getDefaultValueSelected() {\n const {data} = this.props;\n // Bitcoin Network\n if (data.length > 2) {\n if (data[0].disabled) {\n return data[1];\n }\n return data[0];\n }\n // Public Factom Network\n return data[0];\n }", "function getInputDefaultValue(obj) {\r\n if ((typeof obj.type != \"string\") && (obj.length > 0) && (obj[0] != null) && (obj[0].type==\"radio\")) {\r\n for (var i=0; i<obj.length; i++) {\r\n if (obj[i].defaultChecked == true) { return obj[i].value; }\r\n }\r\n return \"\";\r\n }\r\n if (obj.type==\"text\")\r\n { return obj.defaultValue; }\r\n if (obj.type==\"hidden\")\r\n { return obj.defaultValue; }\r\n if (obj.type==\"textarea\")\r\n { return obj.defaultValue; }\r\n if (obj.type==\"checkbox\") {\r\n if (obj.defaultChecked == true) {\r\n return obj.value;\r\n }\r\n return \"\";\r\n }\r\n if (obj.type==\"select-one\") {\r\n if (obj.options.length > 0) {\r\n for (var i=0; i<obj.options.length; i++) {\r\n if (obj.options[i].defaultSelected) {\r\n return obj.options[i].value;\r\n }\r\n }\r\n }\r\n return \"\";\r\n }\r\n if (obj.type==\"select-multiple\") {\r\n var val = \"\";\r\n for (var i=0; i<obj.options.length; i++) {\r\n if (obj.options[i].defaultSelected) {\r\n val = val + \"\" + obj.options[i].value + \",\";\r\n }\r\n }\r\n if (val.length > 0) {\r\n val = val.substring(0,val.length-1); // remove trailing comma\r\n }\r\n return val;\r\n }\r\n return \"\";\r\n }", "function first_dropdown_item() {\n\t\t\tdebugger;\n\t\t\treturn $(\"li\", dropdown).slice(0,1);\n\t\t}", "setDefaultSelect() {\n var platefromSelect = document.getElementById(\"platforms\");\n var options = platefromSelect.options;\n for (var i = 0; i < options.length; i++) {\n if (options[i].textContent == \"android\") {\n platefromSelect.selectedIndex = i;\n }\n }\n }", "handleDefault() {\n if (this.selectedShippingMethod.value) {\n this.deliveryMethods.map((item) => {\n if (this.selectedShippingMethod.value === item.value) {\n this.$refs.shippingMethod.setSelectedByValue(item.value);\n this.setData(item);\n }\n });\n } else {\n this.$refs.shippingMethod.setSelectedByValue(this.deliveryMethods[0].value);\n this.setData(this.deliveryMethods[0]);\n }\n }", "function selectDefaultColor() {\n selected(closedOption);\n}", "handleDefault(index) {\n const dropdownValues = this.$refs.deliveryMethodDropdown[index].dropdownValues;\n if (this.selectedShippingMethod[index].value) {\n dropdownValues.map((item) => {\n if (item.value === this.selectedShippingMethod[index].value) {\n this.$refs.deliveryMethodDropdown[index].setDropdownLabel(item.label);\n this.selectedShippingMethod[index].value = item.value;\n this.selectedShippingMethod[index].label = item.label;\n this.selectedShippingMethod[index].deliveryDetails = item.deliveryDetails;\n }\n });\n } else {\n this.$refs.deliveryMethodDropdown[index].setDropdownLabel(dropdownValues[0].label);\n this.selectedShippingMethod[index].value = dropdownValues[0].value;\n this.selectedShippingMethod[index].label = dropdownValues[0].label;\n this.selectedShippingMethod[index].deliveryDetails = dropdownValues[0].deliveryDetails;\n }\n }", "function select_dropdown_item (item) {\n if(selected_dropdown_item) {\n deselect_dropdown_item($(selected_dropdown_item));\n }\n if(item) {\n item.addClass($(input).data(\"settings\").classes.selectedDropdownItem);\n selected_dropdown_item = item.get(0);\n }\n }", "selectFirstOption() {\n if (!this.disabled) {\n this.selectedIndex = 0;\n }\n }", "quickShopDefaultImage(imgObj = {}) {\n this.quickShopImages.select(0);\n }", "function SFDefaultSingleSelectModel(items) {\n assert(items, \"[SFDefaultSingleSelectModel] No items were passed\");\n //Call the constructor of SFDefaultListModel to initialize the items list\n SFDefaultListModel.call(this,items);\n //initialize with a default selection\n if (this.size() > 0)\n this._selectedIndex = 0;\n}", "setDefaultTabElement() {\n if (this.defaultTabElement) {\n return;\n }\n const elements = this.getRenderedTabItems();\n if (!elements) {\n return;\n }\n elements.forEach(element => {\n if (!this.defaultTabElement && element['isDefault']) {\n this.defaultTabElement = element;\n return;\n }\n });\n }", "function select_dropdown_item (item) {\n if(item) {\n if(selected_dropdown_item) {\n deselect_dropdown_item($(selected_dropdown_item));\n }\n\n item.addClass($(input).data(\"settings\").classes.selectedDropdownItem);\n selected_dropdown_item = item.get(0);\n }\n }", "function select_dropdown_item (item) {\n if(item) {\n if(selected_dropdown_item) {\n deselect_dropdown_item($(selected_dropdown_item));\n }\n\n item.addClass($(input).data(\"settings\").classes.selectedDropdownItem);\n selected_dropdown_item = item.get(0);\n }\n }", "function insert_default_options() {\n\n if (is_content_selected() === false) {\n return false;\n }\n\n // current options\n var options = $(\".yp-editor-list > li.active:not(.yp-li-about) .yp-option-group\");\n\n // delete all cached data.\n $(\"li[data-loaded]\").removeAttr(\"data-loaded\");\n\n // UpData current active values.\n if (options.length > 0) {\n options.each(function () {\n\n if ($(this).attr(\"id\") != \"background-parallax-group\" && $(this).attr(\"id\") != \"background-parallax-speed-group\" && $(this).attr(\"id\") != \"background-parallax-x-group\" && $(this).attr(\"id\") != \"background-position-group\") {\n\n var check = 1;\n\n if ($(this).attr(\"id\") == 'animation-duration-group' && is_animate_creator() === true) {\n check = 0;\n }\n\n if (check == 1) {\n set_default_value(get_option_id(this));\n }\n\n }\n });\n }\n\n // cache to loaded data.\n options.parent().attr(\"data-loaded\", \"true\");\n\n }", "defaultValue(props) {\n // check if there is a value in the model, if there is, display it. Otherwise, check if\n // there is a default value, display it.\n //console.log('Text.defaultValue key', this.props.form.key);\n //console.log('Text.defaultValue model', this.props.model);\n let value = utils.selectOrSet(props.form.key, props.model); //console.log('Text defaultValue value = ', value);\n // check if there is a default value\n\n if (!value && props.form['default']) {\n value = props.form['default'];\n }\n\n if (!value && props.form.schema && props.form.schema['default']) {\n value = props.form.schema['default'];\n } // Support for Select\n // The first value in the option will be the default.\n\n\n if (!value && props.form.titleMap && props.form.titleMap[0].value) {\n value = props.form.titleMap[0].value;\n } //console.log('value', value);\n\n\n return value;\n }", "getDefaultOption () {\n\t\tconst { blankOptionLabel, showDefaultOption, defaultOptionLabel, country } = this.props;\n\t\tif (!country) {\n\t\t\treturn <option value=\"\">{blankOptionLabel}</option>;\n\t\t}\n\t\tif (showDefaultOption) {\n\t\t\treturn <option value=\"\">{defaultOptionLabel}</option>;\n\t\t}\n\t\treturn null;\n\t}", "selectFirstOption() {\n var _a, _b;\n\n if (!this.disabled) {\n this.selectedIndex = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.findIndex(o => !o.disabled)) !== null && _b !== void 0 ? _b : -1;\n }\n }", "function selectFirstOption(elm) {\n elm.val(elm.find('option').first().val());\n}", "select(item = {}) {\n for (let path in menus) {\n menus[path].options.map(item => item.selected = false);\n }\n item.selected = true;\n }", "function getSelectedDropdown(option){\n return model.inputs.dropDownOption == option ? 'selected' : '';\n}" ]
[ "0.66718537", "0.6311194", "0.6039267", "0.6000806", "0.5955329", "0.59164506", "0.5895007", "0.58630586", "0.57978356", "0.5726508", "0.5656774", "0.56539035", "0.5653307", "0.5616319", "0.5609541", "0.5600866", "0.55922085", "0.55840874", "0.55624026", "0.55548036", "0.55530554", "0.5537193", "0.5537193", "0.55352914", "0.55327994", "0.5510763", "0.5507242", "0.5503434", "0.54991347", "0.5478199" ]
0.7483216
0
busca el valor de apertura (de la propiedad OPEN) de cada dia (propiedad DTYYYYMMDD)(el primer valor de apertura de cada dia)
function buscarAperturaDia(array) { let day; let arr = []; for (let i = 0; i < array.length; i++) { let date = array[i].DTYYYYMMDD; if (day != date) { day = date; for (let j = 0; j < array.length; j++) { if (array[j].DTYYYYMMDD === day) { arr.push(array[j].OPEN); break; } } } } //console.log('Apertura:', arr) return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dadosDiaAtual(diasMonitorados) {\n\n\tvar posDiaAtual = diasMonitorados.length - 1;\n\tvar dadosDiaAtual = diasMonitorados[posDiaAtual];\n\n\treturn dadosDiaAtual;\n}", "function diaClave(propie){\n\n\tfor(i=0; i< propie.length; i++){\n\t\tvar info = propie[i].properties;\t\n\n\t\tconst latitud = info.LATITUD;\t \n\t\tconst longitud = info.LONGITUD;\t\t \n\t\tconst fecha = info.FECHA;\n\t\tconst pm10 = info.PM_10;\n\t\tconst pm25 = info.PM_2_5;\n\t\tconst NO2 = info.NO2;\n\t\tconst NO = info.NO;\n\t\tconst co = info.CO;\n\t\tconst so2 = info.SO2;\n\n\t\tconst fechaFormulario = document.querySelector('input[name=\"trip\"]').value;\t\n\t\t\t\n\t\t\n\t\tconst unicaFecha = new Date(fechaFormulario);\n\t\tconst transcurso1 = unicaFecha.getTime()\n\t\t\t\n\n\t\t//capturar la fecha del WFS y convertirla a milisegundos\n\t\t\n\t\t\n\t\tconst fechaWFS = new Date(info.FECHA);\t\t\t \t\n\t\tconst fechaWFStra = fechaWFS.getTime();\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\tif(fechaWFStra === transcurso1){\n\t\t\t\t\t const informacion = new Estaciones(latitud, longitud, fecha, pm10, pm25, NO2, NO, co, so2 )\t\n\t\t\t\t\t\t\t const fech = informacion.fecha;\n\t\t\t\t\t\t\t const pm_10 = informacion.pm10;\n\t\t\t\t\t\t\t const pm_2_5 = informacion.pm25;\n\t\t\t\t\t\t\t const no2 = informacion.NO2;\n\t\t\t\t\t\t\t const No = informacion.NO;\n\t\t\t\t\t\t\t const Co = informacion.co;\n\t\t\t\t\t\t\t const So2 = informacion.so2;\n\t\t\t\t\t\t\t\n\t\t\t\t\t const gas = $('#filter2').val();\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t //escogerGas(gas);\n\t\t\t\t\tswitch (gas) {\n\t\t\t\t\t\tcase 'PM_10':\n\n\t\t\t\t\t\t\tvar marker = L.circle([latitud, longitud], {radius: (pm_10*10), stroke:true, color: coloresPM10(pm_10) }).bindPopup(`\n\t\t\t\t\t\t\t<h5>Información</h5>\n\t\t\t\t\t\t\t<ol>\n\t\t\t\t\t\t\t<li>Fecha: ${fechaFormulario}</li>\n\t\t\t\t\t\t\t<li>Medicion de Gas Promedio PM10: ${pm_10.toString()}</li>\n\t\t\t\t\t\t\t\t</ol>` ).addTo(mymap);\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tmymap.fitBounds(marker.getBounds(), { padding: [20, 20] });\t\n\t\t\t\t\t\t\t\tlimpiarMapa(marker);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'PM_2_5':\n\n\t\t\t\t\t\t\tvar marker = L.circle([latitud, longitud], {radius: (pm_2_5*10), stroke:true, color: coloresPM25(pm_2_5) }).bindPopup(`<ol>\n\t\t\t\t\t\t\t<li>${fechaFormulario}</li>\t\n\t\t\t\t\t\t\t<li>${pm_2_5.toString()}</li>\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t</ol>` ).addTo(mymap);\n\t\t\t\t\t\t\t\tmymap.fitBounds(marker.getBounds(), { padding: [20, 20] });\t\n\t\t\t\t\t\t\t\tlimpiarMapa(marker);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'N02':\n\n\t\t\t\t\t\t\tvar marker = L.circle([latitud, longitud], {radius: (no2*10), stroke:true, color: coloresNO(no2) }).bindPopup(`<ol>\n\t\t\t\t\t\t\t<li>${fechaFormulario}</li>\n\t\t\t\t\t\t\t<li>${no2.toString()}</li>\n\t\t\t\t\t\t\t\t</ol>` ).addTo(mymap);\n\t\t\t\t\t\t\t\tmymap.fitBounds(marker.getBounds(), { padding: [20, 20] });\n\t\t\t\t\t\t\t\tlimpiarMapa(marker);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'NO':\n\n\t\t\t\t\t\t\tvar marker = L.circle([latitud, longitud], {radius: (No*10), stroke:true, color: coloresNO(No) }).bindPopup(`<ol>\n\t\t\t\t\t\t\t<li>${fechaFormulario}</li>\t\n\t\t\t\t\t\t\t<li>${No.toString()}</li>\n\t\t\t\t\t\t\t\t</ol>` ).addTo(mymap);\n\t\t\t\t\t\t\t\tmymap.fitBounds(marker.getBounds(), { padding: [20, 20] });\t\n\t\t\t\t\t\t\t\tlimpiarMapa(marker);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'CO':\n\n\t\t\t\t\t\t\tvar marker = L.circle([latitud, longitud], {radius: (Co*10), stroke:true, color: coloresCO(Co) }).bindPopup(`<ol>\n\t\t\t\t\t\t\t<li>${fechaFormulario}</li>\n\t\t\t\t\t\t\t<li>${Co.toString()}</li>\n\t\t\t\t\t\t\t\t</ol>` ).addTo(mymap);\n\t\t\t\t\t\t\t\tmymap.fitBounds(marker.getBounds(), { padding: [20, 20] });\t\n\t\t\t\t\t\t\t\tlimpiarMapa(marker);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'SO2':\n\n\t\t\t\t\t\t\tvar marker = L.circle([latitud, longitud], {radius: (So2*10), stroke:true, color: coloresSO2(So2) }).bindPopup(`<ol>\n\t\t\t\t\t\t\t<li>${fechaFormulario}</li>\t\t\t\t\t\n\t\t\t\t\t\t\t<li>${So2.toString()}</li>\n\t\t\t\t\t\t\t\t</ol>` ).addTo(mymap);\n\t\t\t\t\t\t\t\tmymap.fitBounds(marker.getBounds(), { padding: [20, 20] });\t\n\t\t\t\t\t\t\t\tlimpiarMapa(marker);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t\t\tdefault: console.log('no funciona');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\t \n\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t }\n\t\t\t\t else{\n\t\t\t\t\t\t\t console.log('no selecciono nada')\n\t\t\t\t\t\t }\n\t\t }\n\n}", "function eq_tempo_data2(anno,njd){\n\n // funzione per il calcolo dell'equazione del tempo.\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) gennaio 2012.\n // algoritmo di MEEUS.\n \n njd=jdHO(njd); // riporta il g.g. all'ora H0(zero) del giorno. \n \nvar ar_sole=pos_sole(njd); // calcolo dell'ascensione retta del sole.\nvar ar_sole_app=pos_app(njd,ar_sole[0],ar_sole[1]);\nvar TSG=temposid_app(njd);\nvar valore_et=0;\nvar h=TSG-ar_sole_app[0];\n \nif(h<0 ) {valore_et=12+h;}\nif(h>0 ) {valore_et=h-12;}\n \n valore_et=valore_et*60; // valore in minuti.\n\n valore_et=valore_et.toFixed(6);\n\nreturn valore_et\n\n}", "function getDataAtual(exibeSeparador, exibeHoras){\n // ajustando a data atual\n var fullDate = new Date();\n // acrescenta o 0 caso o mes for menor que 10\n var mes = (\"0\" + (fullDate.getMonth() + 1)).slice(-2);\n // acrescenta o 0 caso o dia for menor que 10\n var dia = (\"0\" + fullDate.getDate()).slice(-2);\n // acrescenta o 0 caso a hora for menor que 10\n var horas = (\"0\" + fullDate.getHours()).slice(-2);\n\n if (exibeHoras){\n return fullDate.getFullYear() + mes + dia;// + horas;\n }\n\n if (exibeSeparador){\n return fullDate.getFullYear() + '-' + mes + '-' + dia;\n } \n}", "function obtenerValoresPorDias(array) {\n let res;\n let dia = diaMes(array)\n let apertura = buscarAperturaDia(array);\n let max = buscarMaxDia(array);\n let min = buscarMinDia(array);\n let cierre = buscarCierreDia(array);\n res = [dia, apertura, max, min, cierre];\n return res;\n}", "function diasMonitoradosPaciente() {\n\tvar diasMonitorados = pacientesJson[numIdPacAtual].diasMonitorados;\n\n\treturn diasMonitorados;\n}", "function calcola_datan2(lingua){\n\n // parametri lingua= \"ITA\" - \"ING\" \n // by Salvatore Ruiu Irgoli-Sardegna (Italy) dicembre 2009.\n // utilizzo caratteri speciali ANSI.\n // restituisce la stringa DataIns.\n \n\t \n\tvar DataInsn=\".\";\n \n var data=new Date();\n\n var anno =data.getYear(); // anno\n var mese =data.getMonth(); // mese 0 a 11 \n var giorno=data.getDate(); // numero del giorno da 1 a 31\n var giorno_settimana=data.getDay(); // giorno della settimana 0 a 6\n var ora =data.getHours(); // ora del giorno da 0 a 23\n var minuti=data.getMinutes(); // minuti da 0 a 59\n var secondi=data.getSeconds(); // secondi da 0 a 59\n \n if (anno<1900) { anno=anno+1900; } // correzione anno\n\n if (ora<10){ ora='0'+ora;}\n \n if (minuti<10){minuti='0'+minuti;}\n\n if (secondi<10) {secondi='0'+secondi;}\n\n mese=mese+1;\n\n if (lingua==\"ING\") { DataInsn=mese+\":\"+giorno+\":\"+anno+\":\"+ora+\":\"+minuti+\":\"+secondi }\n else { DataInsn=giorno+\":\"+mese+\":\"+anno+\":\"+ora+\":\"+minuti+\":\"+secondi }\n\n return DataInsn;\n }", "function llenarComboDias(nombreCombo) {\r\n\tFECHA_INICIO = new String(document.formularioFiltro.fechaInicio.value);\r\n\tFECHA_FIN = new String(document.formularioFiltro.fechaFinRegistro.value);\r\n\tvar arregloInicio = FECHA_INICIO.split(\"/\");\r\n\tvar diaInicio = arregloInicio[0];\r\n\tvar mesInicio = arregloInicio[1];\r\n\tvar annoInicio = arregloInicio[2];\r\n\tmesInicio = mesInicio - 1;\r\n\tvar fechaInicio = new Date(annoInicio, mesInicio, diaInicio);\r\n\tvar diasSiguiente = 0;\r\n\tvar stringDia = \"\";\t//Este string es una variabla auxiliar para guardar el dia y agregarlo al combo\r\n\tlimpiarCombo(document.formularioFiltro.valorDia);\t\r\n\t\r\n\t//Agregamos la primera opcion del combo vacia \r\n\tstringDia = \"\";\r\n\taddOption(document.formularioFiltro.valorDia, stringDia, 0);\r\n\tfor (var i = 0; i < 7; i++) {\r\n\t\tdiasSiguiente = fechaInicio.getTime() + ((24 * 60 * 60 * 1000) * i);\r\n\t\r\n\t\t// Cosntruimos el objeto Date con la cantidad de\r\n\t\t// miliseg que representan cada dia de la semana\r\n\t\tvar fecha = new Date(diasSiguiente);\r\n\t\tvar dia = fecha.getDate();\r\n\t\tvar mes = fecha.getMonth() + 1;\r\n\t\tvar anno = fecha.getFullYear();\r\n\t\tstringDia = dia + \"/\" + mes + \"/\" + anno;\t\t\r\n\t\t\r\n\t\t// agregamos la opcion\r\n\t\taddOption(document.formularioFiltro.valorDia, stringDia, i);\r\n\t}\r\n}", "function calcola_datan(lingua){\n\n // parametri lingua= \"ITA\" - \"ING\" \n // by Salvatore Ruiu Irgoli-Sardegna (Italy) dicembre 2009.\n // utilizzo caratteri speciali ANSI.\n // restituisce la stringa DataIns.\n // utilizzata solo per il datario delle fasi lunari\n // per la data completa utilizzare [calcola_datan2(lingua)]\n\t \n\tvar DataInsn=\".\";\n \n var data=new Date();\n\n var anno =data.getYear(); // anno\n var mese =data.getMonth(); // mese 0 a 11 \n var giorno=data.getDate(); // numero del giorno da 1 a 31\n var giorno_settimana=data.getDay(); // giorno della settimana 0 a 6\n var ora =data.getHours(); // ora del giorno da 0 a 23\n var minuti=data.getMinutes(); // minuti da 0 a 59\n var secondi=data.getSeconds(); // secondi da 0 a 59\n \n if (anno<1900) { anno=anno+1900; } // correzione anno\n\n if (ora<10){ ora='0'+ora;}\n \n if (minuti<10){minuti='0'+minuti;}\n\n if (secondi<10) {secondi='0'+secondi;}\n\n mese=mese+1;\n\n if (lingua==\"ING\") { DataInsn=mese+\":\"+giorno+\":\"+anno+\":\"+ora }\n else { DataInsn=giorno+\":\"+mese+\":\"+anno+\":\"+ora }\n\n return DataInsn;\n }", "function specialDay( stDay )\n{\n var stValue = window.opener.dialogIdField + \"~\"+ getTextValue( \"stType\" );\n stValue += \"~\" + getTextValue( \"stComment\" )+\"~\"+stDay+ \"~Pending\";\n //alert( \" specialDay= \" + stValue );\n if ( window.opener.dialogMulti == 492 )\n {\n window.opener.dialogF1.value = getTextValue( \"stType\" );\n window.opener.dialogF2.value = getTextValue( \"stComment\" );\n window.opener.dialogF3.value = stDay;\n window.opener.dialogF4.value = \"Pending\";\n if ( window.opener.dialogDisplayField.value.toString().length > 0 )\n window.opener.dialogDisplayField.value += \"\\n|\";\n window.opener.dialogDisplayField.value += stValue;\n }\n window.close();\n}", "function checkOpen(){\n //I've used moment to handle the date because it offers a more usable interface \n //than the Date obj in JS\n //the library is made in USA so\n //isoWeekDay is the number of the day in a week,\n //and it starts with sunday == 1\n\t var today = moment().isoWeekday();\n\t var time = moment().format(); \n //We are in Europe and the week starts on monday,\n //we need to convert the weekday to monday == 1 \n\t var day = json[today-1];\n\t var str='', open=false;\t \n \tfor (var name in day) { \n if(typeof name=='undefined'){return}\n //open is a spotting variable to check if we already know the state\n \t\tif(open) continue;\n\t\t\tvar todayClosingTime = moment().format('YYYY-MM-DD') + \" \" + day[name].close;\n\t\t var todayOpeningTime = moment().format('YYYY-MM-DD') + \" \" + day[name].open; \n\n\t\t if(moment(time).isSameOrBefore(todayClosingTime) && moment(time).isSameOrAfter(todayOpeningTime)){\n\t\t\t\tstr = \"We are open, but hurry up we are closing in \" + moment.duration(moment(todayClosingTime).diff(time)).humanize();\n\t\t\t\topen=true;\n\t\t }else if(moment(time).isSameOrBefore(todayOpeningTime)){\n\t\t\t\tstr = \"We are closed, but we will open in \" + moment.duration(moment(time).diff(todayOpeningTime)).humanize();\t\t \t\n\t\t\t\topen=true\n\t\t }else{\n var tomorrowOpening = moment().add(1,'day').format('YYYY-MM-DD') + \" \" + morning.open;\n str = \"We are closed, but we will open in \" + moment.duration(moment(time).diff(todayOpeningTime)).humanize(); \n }\n\n\t\t}\t\t\n \n\t\treturn str\t\n }", "function eq_tempo_data(anno,njd){\n\n // funzione per il calcolo dell'equazione del tempo.\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) dicembre 2009\n // algoritmo di P.D. SMITH.\n\n njd=jdHO(njd)+0.5; // riporta il g.g. della data al mezzogiorno. \n \nvar ar_sole=pos_sole(njd); // calcolo dell'ascensione retta del sole.\nvar Tempo_medio_Greenw=tsg_tmg_data(ar_sole[0],anno,njd); // tempo medio di Greenwich.\nvar valore_et=12-Tempo_medio_Greenw; // valore dell'equazione del tempo.\n\n valore_et=valore_et*60; // valore in minuti.\n\n valore_et=valore_et.toFixed(6);\n\nreturn valore_et\n\n}", "function buscarCierreDia(array) {\n let day;\n let arr = [];\n for (let i = 0; i < array.length; i++) {\n let date = array[i].DTYYYYMMDD;\n let res;\n if (day != date) {\n day = date;\n for (let j = 0; j < array.length; j++) {\n if (array[j].DTYYYYMMDD === day) {\n res = array[j].CLOSE;\n }\n }\n arr.push(res);\n }\n }\n\n //console.log('Cierre:', arr)\n return arr;\n}", "function getAutomatedDay(statusData){\n document.getElementById(\"proReportDel\").value = statusData[\"problemDays\"];\n document.getElementById(\"feedDel\").value = statusData[\"feedbackDays\"];\n document.getElementById(\"followReportDel\").value = statusData[\"followUpsDays\"];\n }", "function calcular_idade(data){ \n\n \t//calculo a data de hoje \n\thoje=new Date();\n \t//alert(hoje) \n\n \t//calculo a data que recebo \n \t//descomponho a data em um array\n \tvar array_data = data.split(\"/\");\n \t//se o array nao tem tres partes, a data eh incorreta \n \tif (array_data.length!=3) \n \t return false;\n\n \t//comprovo que o ano, mes, dia s�o corretos \n \tvar ano;\n \tano = parseInt(array_data[2]); \n \tif (isNaN(ano)) \n \t return false;\n\n \tvar mes;\n \tmes = parseInt(array_data[1]); \n \tif (isNaN(mes)) \n \t return false;\n\n \tvar dia;\n \tdia = parseInt(array_data[0]);\t\n \tif (isNaN(dia)) \n \t return false;\n\n\n \t//se o ano da data que recebo so tem 2 cifras temos que muda-lo a 4 \n \tif (ano<=99) \n \t ano +=1900;\n\n \t//subtraio os anos das duas datas\n \tidade=hoje.getFullYear()- ano - 1; //-1 porque ainda nao fez anos durante este ano\n\n \t//se subtraio os meses e for menor que 0 entao nao cumpriu anos. Se for maior sim ja cumpriu \n \tif (hoje.getMonth() + 1 - mes < 0) //+ 1 porque os meses comecam em 0 \n \t return idade;\n \tif (hoje.getMonth() + 1 - mes > 0) \n \t return idade+1 ;\n \t\n \t//entao eh porque sao iguais. Vejo os dias \n \t//se subtraio os dias e der menor que 0 entao nao cumpriu anos. Se der maior ou igual sim que j� cumpriu \n \tif (hoje.getUTCDate() - dia >= 0) \n \t return idade + 1; \n\n \treturn idade;\n}", "function calcola_jddata(giorno,mese,anno,ora,minuti,secondi){\n\n // funzione per il calcolo del giorno giuliano per una data qualsiasi. \n // by Salvatore Ruiu Irgoli-Sardegna (Italy) dicembre 2009\n // restituisce il valore numerico dataGiuliana_annox\n// ATTENZIONE! inserire i valori dei tempi come T.U. di GREENWICH\n \nvar dataGiuliana=costanti_jd(giorno,mese,anno,ora,minuti,secondi); // valore del giorno giuliano per una data qualsiasi.\n\n dataGiuliana=dataGiuliana*1 // definire come valore numerico.\n\nreturn dataGiuliana;\n\n}", "function eq_tempo(){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) ottobre 2011.\n // funzione per il calcolo del valore dell'equazione del tempo per la data odierna.\n // algoritmo di P.D. SMITH.\n \nvar njd=calcola_jd(); // giorno giuliano in questo istante a Greenwich.\n njd=jdHO(njd)+0.5; // g. g. a mezzogiorno di Greenwich.\n\nvar ar_sole=pos_sole(njd); // calcolo dell'ascensione retta del sole.\nvar anno=jd_data(njd); // anno di riferimento.\n\nvar Tempo_medio_Greenw=tsg_tmg_data(ar_sole[0],anno[2],njd); // tempo medio di Greenwich.\nvar valore_et=12-Tempo_medio_Greenw; // valore dell'equazione del tempo.\n\n valore_et=valore_et*60; // valore in minuti.\n\n valore_et=valore_et.toFixed(6);\n\n\n\nreturn valore_et\n\n}", "function x( d ){ return d.anio; } // Devuelve el valor del año de un punto dado", "function getInfoDA(id){\n var sheet = SpreadsheetApp.openById(CLSID).getSheetByName(SHEET_SUIVIDA);\n var idrow = onSearchDAwithID(id);\n var dtDeb = '', strDtDeb='';\n var dtFin = '', strDtFin='';\n // EVO-21\n var strCondition = '';\n // EVO-21\n // EVO-10\n var strTVA = '';\n // EVO-10\n if (idrow != -1) {\n dtDeb = sheet.getRange(idrow,COLUMN_DA_DTDEBLIV).getValue();\n if (dtDeb != '') {\n strDtDeb = Utilities.formatDate(dtDeb, \"GMT+6\", \"dd/MM/yyyy\");\n }\n dtFin = sheet.getRange(idrow,COLUMN_DA_DTFINLIV).getValue();\n if (dtFin != '') {\n strDtFin = Utilities.formatDate(dtFin, \"GMT+6\", \"dd/MM/yyyy\");\n }\n // EVO-21\n if (sheet.getRange(idrow,COLUMN_DA_CONDREGL).getValue() != \"\") {\n strCondition = LIB_COND_REG_EMETTEUR + sheet.getRange(idrow,COLUMN_DA_CONDREGL).getValue();\n }\n // EVO-21\n // EVO-10\n if (sheet.getRange(idrow,COLUMN_DA_TVA).getValue() != \"\") {\n strTVA = LIB_COND_TVA_EMETTEUR + sheet.getRange(idrow,COLUMN_DA_TVA).getValue();\n }\n // EVO-10\n\n globalDAData= {id:id,\n idrow:idrow,\n bdc:sheet.getRange(idrow,COLUMN_DA_NUMBDC).getValue(),\n emetteur:sheet.getRange(idrow,COLUMN_DA_EMETTEUR).getValue(),\n fournisseur:sheet.getRange(idrow,COLUMN_DA_FOURNISSEUR).getValue(),\n statut:sheet.getRange(idrow,COLUMN_DA_STATE).getValue(),\n typedemande:sheet.getRange(idrow,COLUMN_DA_TYPE).getValue(),\n codetypedemande:onSearchTypeDemandeWithLabel(sheet.getRange(idrow,COLUMN_DA_TYPE).getValue()),\n nature:sheet.getRange(idrow,COLUMN_DA_NATURE).getValue(),\n contactfournisseur:sheet.getRange(idrow,COLUMN_DA_CONTACTFOURNISSEUR).getValue(),\n emailcontactfournisseur:sheet.getRange(idrow,COLUMN_DA_EMAILCONTACTFOURNISSEUR).getValue(),\n telcontactfournisseur:sheet.getRange(idrow,COLUMN_DA_TELCONTACTFOURNISSEUR).getValue(),\n buimputation:sheet.getRange(idrow,COLUMN_DA_BU).getValue(),\n codeprojet:sheet.getRange(idrow,COLUMN_DA_CDPROJET).getValue(),\n nomprojet:sheet.getRange(idrow,COLUMN_DA_NOMPROJET).getValue(),\n quantite:sheet.getRange(idrow,COLUMN_DA_QTE).getValue(),\n prixtjmachat:sheet.getRange(idrow,COLUMN_DA_PRXACHAT).getValue(),\n prixtjmvendu:sheet.getRange(idrow,COLUMN_DA_PRXVENDU).getValue(),\n marge:sheet.getRange(idrow,COLUMN_DA_MARGE).getValue(),\n collaborateur:sheet.getRange(idrow,COLUMN_DA_COLLABORATEUR).getValue(),\n datedebutlivraison:strDtDeb,\n datefinlivraison:strDtFin,\n adresselivraison:sheet.getRange(idrow,COLUMN_DA_ADRLIV).getValue(),\n conditionreglement:sheet.getRange(idrow,COLUMN_DA_CONDREGL).getValue(),\n // EVO-21\n conditionreglementemetteur:strCondition,\n // EVO-21\n // EVO-10\n tva:sheet.getRange(idrow,COLUMN_DA_TVA).getValue(),\n tvaemetteur:strTVA,\n // EVO-10\n urlDA:sheet.getRange(idrow,COLUMN_DA_URLDA).getValue(),\n urlDevis:sheet.getRange(idrow,COLUMN_DA_DEVIS).getValue(),\n urlBDCpdf:sheet.getRange(idrow,COLUMN_DA_BDCPDF).getValue(),\n urlBDCpdfsigne:sheet.getRange(idrow,COLUMN_DA_BDCPDFSIGNE).getValue(),\n urlFacture:sheet.getRange(idrow,COLUMN_DA_FACTURE).getValue(),\n urlBPF:sheet.getRange(idrow,COLUMN_DA_BPF).getValue(),\n managerBU:GetManagerBU(sheet.getRange(idrow,COLUMN_DA_BU).getValue()),\n managerEntrepriseParis:GetManagerBU(BU_ENTREPRISE_PARIS),\n acteurComptaFournisseur:GetManagerBU(BU_COMPTA_FOURNISSEUR),\n managerDirectionFinanciere:GetManagerBU(BU_DIRECTION_FINANCIERE),\n assistantes:GetManagerBU(BU_ASSISTANTE_ENTREPRISE_PARIS)\n };\n // Log des informations de la DA\n Log_Info(\"getInfoDA\", Utilities.formatString(\"ret=%s\",Utilities.jsonStringify(globalDAData)));\n }\n if(idrow==-1) throw 'Aucun dossier associé avec la référence suivante :'+id;\n return globalDAData;\n}", "function pegarData(){\n\n today = new Date();\n\n /*Data do dia atual*/\n var date = today.getDate()+'/'+(today.getMonth()+1)+'/'+today.getFullYear();\n /*Nome do dia*/\n var op = ['Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado', 'Domingo'];\n var diaSemana = op[today.getDay()];\n \n document.querySelector('#getDay').innerHTML = diaSemana;\n document.querySelector('#getDate').innerHTML = date;\n\n\n}", "function getEdad(fecha_nac){\n\n //calculo la fecha de hoy\n var hoy=new Date();\n //alert(hoy)\n\n\t//Los Datos de Hoy\n\tvar year_hoy=hoy.getFullYear();\n\tvar mes_hoy=hoy.getMonth() + 1;\n\tvar dia_hoy=hoy.getDate();\n\n\t//la fecha recibida\n\tvar fecha=fecha_nac;\n\n\t//alert(fecha);\n\n //calculo la fecha que recibo\n //La descompongo en un array\n var array_fecha = fecha.split(\"/\")\n //si el array no tiene tres partes, la fecha es incorrecta\n if (array_fecha.length!=3)\n\t\treturn 'Formato incorrecto, use dd/mm/yyyy';\n\t\t\n\n //compruebo que los ano, mes, dia son correctos\n var ano\n ano = parseInt(array_fecha[2],10);\n if (isNaN(ano) || ano > hoy.getFullYear() ) {\n return 'Año incorrecto';\n\t}\n\n var mes\n mes = parseInt(array_fecha[1],10);\n if (isNaN(mes) || mes < 1 || mes >12){\n return 'Mes incorrecto';\n\t}\n\t\n var dia\n dia = parseInt(array_fecha[0],10);\n if (isNaN(dia) || dia<1 || dia > 31){\n return 'Dia incorrecto';\n\t}\n\n //si el año de la fecha que recibo solo tiene 2 cifras hay que cambiarlo a 4\n if (ano<=99)\n ano +=1900\n\n\t//alert('Escrito: \\n dia ' + dia + ' mes ' + mes + ' año ' + ano + '\\n Hoy: \\n año: ' + year_hoy + ' mes: ' + mes_hoy + ' dia ' + dia_hoy );\n\t\n ano = year_hoy - ano;\n mes = mes_hoy - mes;\n dia = dia_hoy - dia;\n\n //Si salió un día negativo\n if (dia < 0) {\n dia = 30 - Math.abs(dia);\n mes = mes - 1;\n }\n\n //Si salió un mes negativo\n if (mes < 0) {\n mes = 12 - Math.abs(mes);\n ano = ano - 1;\n }\n\n\t//Prepara la información a entregar\t\n if (ano==0 && mes==0 && dia==0){\n return 'Recien Nacido?';\n\n } else if (ano<1 && mes<3){\n return mes + ' meses, ' + dia + ' dias';\n\n } else if (ano<1 && mes>=1) {\n return mes + ' meses';\n\n } else if (ano<1 && mes<1){\n return dia + ' dias';\n\n } else if (ano<2) {\n return ano + ' año, ' + mes + ' meses';\n\n } else {\n\t\treturn ano + ' Años ';\n }\t\n\t\n\treturn ano + ' años, ' + mes + ' meses, ' + dia + ' dias';\n\n\n}", "function identificarData(codigo, tipoCodigo) {\n codigo = codigo.replace(/[^0-9]/g, '');\n const tipoBoleto = identificarTipoBoleto(codigo);\n\n let fatorData = '';\n let dataBoleto = new Date();\n\n dataBoleto.setFullYear(1997);\n dataBoleto.setMonth(9);\n dataBoleto.setDate(7);\n dataBoleto.setHours(23, 54, 59);\n\n if (tipoCodigo === 'CODIGO_DE_BARRAS') {\n if (tipoBoleto == 'BANCO') {\n fatorData = codigo.substr(5, 4)\n\n dataBoleto.setDate(dataBoleto.getDate() + Number(fatorData));\n dataBoleto.setTime(dataBoleto.getTime() + dataBoleto.getTimezoneOffset() - (3) * 60 * 60 * 1000);\n var dataBoletoform = dataBoleto.getDate() + \"/\" + (dataBoleto.getMonth() + 1) + \"/\" + dataBoleto.getFullYear()\n\n return dataBoletoform;\n } else {\n dataBoleto = null\n\n return dataBoleto;\n }\n } else if (tipoCodigo === 'LINHA_DIGITAVEL') {\n if (tipoBoleto == 'BANCO') {\n fatorData = codigo.substr(33, 4)\n dataBoleto.setDate(dataBoleto.getDate() + Number(fatorData));\n dataBoleto.setTime(dataBoleto.getTime() + dataBoleto.getTimezoneOffset() - (3) * 60 * 60 * 1000);\n var dataBoletoform = dataBoleto.getDate() + \"/\" + (dataBoleto.getMonth() + 1) + \"/\" + dataBoleto.getFullYear()\n\n return dataBoletoform;\n } else {\n dataBoleto = null\n\n return dataBoleto;\n }\n }\n}", "function cambiarTiempo(ano, mes, dia, hour, min) {\n\n let cambioMin = min;\n let cambioHour = hour;\n let cambioDia = dia;\n let cambioAno = ano;\n let cambioMes = mes;\n\n\n\n if (cambioMin == 30) {\n cambioMin = 0;\n if (cambioHour === 23) {\n cambioHour = 0;\n if (cambioDia === 30 || cambioDia === 31) {\n\n cambioDia = 1;\n\n if (cambioMes === 12) {\n cambioMes = 1;\n cambioAno++;\n } else {\n cambioMes++;\n }\n } else {\n cambioDia++;\n }\n\n } else {\n cambioHour++;\n }\n\n } else if (cambioMin < 30) {\n cambioMin += 30;\n\n\n } else if (cambioMin > 30) {\n\n let aux = Math.abs(cambioMin - 30);\n if (cambioHour === 23) {\n cambioHour = 0;\n if (cambioDia === 30 || cambioDia === 31) {\n\n cambioDia = 1;\n\n if (cambioMes === 12) {\n cambioMes = 1;\n cambioAno++;\n } else {\n cambioMes++;\n }\n } else {\n cambioDia++;\n }\n\n } else {\n cambioMin = aux;\n cambioHour++;\n }\n\n }\n\n //final del dia\n\n return [cambioAno, cambioMes, cambioDia, cambioHour, cambioMin];\n\n}", "function aumentarData(attribute, campoData, valor, diaMesAno) {\n if ((valor != null) && (Xrm.Page.getAttribute(campoData).getValue() != null)) {\n var primeiradata = Xrm.Page.getAttribute(campoData).getValue();\n if (diaMesAno == 'Dia') {\n primeiradata.setDate(primeiradata.getDate() + valor);\n } else if (diaMesAno == 'Mes') {\n primeiradata.setMonth(primeiradata.getMonth() + valor);\n } else if (diaMesAno == 'Ano') {\n primeiradata.setFullYear(primeiradata.getFullYear() + valor);\n } else if (diaMesAno == 'DiaMenus') {\n primeiradata.setDate(primeiradata.getDate() - valor);\n } else if (diaMesAno == 'MesMenus') {\n primeiradata.setMonth(primeiradata.getMonth() - valor);\n } else if (diaMesAno == 'AnoMenus') {\n primeiradata.setFullYear(primeiradata.getFullYear() - valor);\n }\n Xrm.Page.getAttribute(attribute).setValue(new Date(primeiradata));\n }\n}", "function openStatus() {\n\tif((thisDay !== 6 && thisDay !== 0 && thisDay !== 2) && (time >= 10 && time <= 18)) {\n\t\tdocument.getElementById('openStatus').innerHTML = \"åben :)\";\n\t\tdocument.getElementById('openMessage').classList.remove(\"d-none\");\n\t}\n\telse if((thisDay == 2) && (time >= 11 && time <= 19)) {\n\t\tdocument.getElementById('openStatus').innerHTML = \"åben :)\";\n\t\tdocument.getElementById('openMessage').classList.remove(\"d-none\");\n\t}\n\telse {\n\t\tdocument.getElementById('openStatus').innerHTML = \"lukket :(\";\n\t\tdocument.getElementById('closedMessage').classList.remove(\"d-none\");\n\t}\n}", "function idade(ano_nascimento, mes_nascimento, dia_nascimento) {\r\n ano_atual = new Date;\r\n ano_atual = ano_atual.getFullYear();\r\n mes_atual = new Date().getMonth() + 1\r\n dia_atual = new Date().getDate()\r\n if (mes_atual < mes_nascimento || mes_atual == mes_nascimento && dia_atual < dia_nascimento) {\r\n ano_atual -= 1\r\n }\r\n return ano_atual - ano_nascimento;\r\n\r\n }", "function specialDay1( stDay )\n{\n var stValue = window.opener.dialogIdField + \"~\"+ getTextValue( \"stType\" );\n stValue += \"~\" + getTextValue( \"stComment\" )+\"~\"+stDay+ \"~Pending\";\n //alert( \" specialDay= \" + stValue );\n if ( window.opener.dialogMulti == 492 )\n {\n\t var startdate = getDateObject(window.opener.dialogF3.value,\"/\");\n\t var finishdate = getDateObject(stDay,\"/\");\n\t if(window.opener.dialogF3.value == null || window.opener.dialogF3.value == \"\")\n\t {\n\t\talert(\"Please select a start date\");\n\t\treturn;\n\t }\n\t if(startdate > finishdate)\n\t {\n\t\talert (\"Please select a date atleast as great as your start date\");\n\t\treturn;\n }\n window.opener.dialogF4.value = stDay;\n //window.opener.dialogF5.value = \"Pending\";\n if ( window.opener.dialogDisplayField.value.toString().length > 0 )\n window.opener.dialogDisplayField.value += \"\\n|\";\n window.opener.dialogDisplayField.value += stValue;\n }\n window.close();\n}", "function seleccionarDia () {\n \n var fecha = $('#fechas_seleccionadas_cita').val();\n globalFecha = fecha;\n var idMedico = $('#idMedico').text();\n\n if (fecha) {\n var date = new Date(fecha);\n //alert(date, idMedico);\n var obj_dates_idMedico = _dates_idMedico(fecha, date.getDay(), idMedico);\n tramosDisponibles(obj_dates_idMedico);\n\n } else { \n alert(\"Selecione una fecha\");\n }\n}", "function calculaEdad(dia, mes, ano)\n{\n //tomar los valores actuales\n var fecha_hoy = new Date();\n var ahora_ano = fecha_hoy.getFullYear();\n var ahora_mes = fecha_hoy.getMonth()+1;\n var ahora_dia = fecha_hoy.getDate();\n \n // realizar el calculo\n var edad = (ahora_ano + 1895) - ano;\n if ( ahora_mes < mes )\n \tedad--;\n \n if ((mes == ahora_mes) && (ahora_dia < dia))\n \tedad--;\n\n if (edad > 1894)\n edad -= 1895;\n \n return edad;\n}", "function afase_luna(njd){\n\n // calcola l'angolo di fase della luna per la data (njd)\n // gennaio 2012\n\n var dati_luna=pos_luna(njd); // recupero fase/elongazione (1)\n var dati_sole=pos_sole(njd);\n\n var elongazione1=dati_luna[4]; // elongazione in gradi sessadecimali.\n var dist_luna=dati_luna[7]/149597870; \n var dist_sole=dati_sole[4]; // distanza del sole in UA.\n\n elongazione=Math.abs(elongazione1)*1;\n\n var dist_sl=dist_luna*dist_luna+dist_sole*dist_sole-2*dist_luna*dist_sole*Math.cos(Rad(elongazione)); // distanza sole-luna\n dist_sl=Math.sqrt(dist_sl);\n\n // calcolo dell'angolo di fase in gradi . \n\n var Dpt= dist_luna; // distanza pianeta-terra.\n var Dts= dist_sole; // distanza terra-sole.\n var Dps= dist_sl; // distanza pianeta-sole.\n\n // teorema del coseno\n\n var delta_fase=(Dts*Dts+Dps*Dps-Dpt*Dpt)/(2*Dps*Dts);\n delta_fase=Math.acos(delta_fase); \n delta_fase=Rda(delta_fase);\n\n var angolo_fase=180-elongazione-delta_fase; // angolo di fase in gradi.\n\n if(elongazione1<0) {angolo_fase=-angolo_fase; }\n\n return angolo_fase;\n\n}" ]
[ "0.5676619", "0.55443245", "0.5450236", "0.5415511", "0.53871185", "0.5380379", "0.53533", "0.53489166", "0.5307834", "0.53009665", "0.52848023", "0.52716637", "0.52353776", "0.5230704", "0.5217601", "0.5216233", "0.5204208", "0.51924366", "0.5186632", "0.5181951", "0.5172368", "0.51712763", "0.5152087", "0.5148801", "0.5134481", "0.51230526", "0.51112187", "0.5108221", "0.50940126", "0.5087385" ]
0.58460104
0
busca el valor de maximo (de la propiedad HIGH) de cada dia (propiedad DTYYYYMMDD)(el valor de maximo de cada dia)
function buscarMaxDia(array) { let day; let arr = []; for (let i = 0; i < array.length; i++) { let date = array[i].DTYYYYMMDD; if (day != date) { day = date; let res; let contador = 0; for (let j = 0; j < array.length; j++) { if (array[j].DTYYYYMMDD === day) { if (contador === 0) { res = array[j].HIGH; } else { res = Math.max(res, array[j].HIGH); } contador++; } } arr.push(res); } } // console.log('Maximos:', arr) return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getMax() {\n var max = Math.max.apply(null, config.values);\n max += 10 - max % 10;\n return max;\n console.log(max);\n }", "function setMax() {\n var cd = curDay();\n var input = document.getElementById('date');\n input.setAttribute(\"max\", this.value);\n input.max = cd;\n input.setAttribute(\"value\", this.value);\n input.value = cd;\n}", "function maxDecimales (){\n inputDecimales.value;\n}", "get maximumValue() {\r\n return this.i.maximumValue;\r\n }", "function getMaximum () {\n if ((document.getElementById('entMax').value)===\"\") {\n return 100;\n }\n else {\n return Number(document.getElementById('entMax').value) }\n }", "get actualMaximumValue() {\r\n return this.i.actualMaximumValue;\r\n }", "function MaxValue(array) {\n //Esto quiere decir que lo compre a array[0] y lo vendo a array[1] \"La primer diferencia\"\n let sale = array[1] - array[0] \n //Itero cada posibilidad de compra\n for (let i = 0; i < array.length - 1 ; i++) {\n //Itero cada posibilidad de venta\n for(let j = i + 1; j < array.length; j++ ){\n //sacamos la ganancia potencial\n const potential = array[j] - array[i];\n //Chequeamos con cual nos quedamos\n sale = potential > sale ? potential : sale;\n }\n }\n return sale;\n}", "function maxNum(){\n var m = Math.max(2, 3, 8, 22, 22.2);\n document.getElementById(\"max\").innerHTML = \"Between these numbers [2,3,8,22] the highest value is: \" + m;\n}", "function findMax(){\n let maxVal = max(parseInt(document.getElementById(\"max1\").value), parseInt(document.getElementById(\"max2\").value));\n document.getElementById(\"resultMax\").innerHTML = maxVal;\n}", "function fgetMaxValue(){\r\n\treturn 100;\r\n}", "get maximumValue() {\r\n return this.i.bk;\r\n }", "get maximumValue() {\n return this.i.bk;\n }", "function getMaxYValue() {\n let maxVal = Number.MIN_VALUE;\n diagram.data.forEach(function (d) {\n for (var key in d) {\n if (key !== currentSerie.groupField) {\n if (+d[key] > maxVal)\n maxVal = +d[key];\n }\n }\n });\n return maxVal;\n }", "function msMax() {\n\t\tlet max1 = msSingle.reduce((a, b) => {\n\t\t\treturn a[1] > b[1] ? a : b;\n\t\t});\n\n\t\treturn parseInt(max1[0]); //function being reduced has 2 key/value pairs in each object. reducing to max in value index 1 then returning value index 0;\n\t}", "calculateMaxYValue() {\n const { data = [] } = this.props;\n const valuesArr = data.map(el => el.y_value);\n let maxValue = Math.max.apply(null, valuesArr);\n maxValue = Math.round(maxValue);\n let exponent = maxValue.toString().length;\n exponent -= 1;\n exponent = !exponent ? 1 : exponent;\n const prec = 10 ** exponent;\n maxValue = Math.round(maxValue / prec) * prec;\n return maxValue;\n }", "function getMaxTemp() {\n for (var i = 0; i < forecastDays; i++) {\n var maxTemp = response.query.results.channel.item.forecast[i].high;\n $(\"#day\" + i + \"Max\").append(\"High: \" + maxTemp + \"°F\");\n }\n }", "function max(p1 , p2){\n\tvar maxVal= 0;\n\tif (p1 > p2){\n\t\tmaxVal = p1;\n\t} else{\n\t\tmaxVal = p2;\n\t}\n\tconsole.log(\"Los números son: \"+ p1 + \"-\" + p2 + \"\\n\" + \"El mayor de los números es: \" + maxVal)\n}", "function calculateMaxValue(maximum) {\n distance = ($attrs.distance || '2.5%').trim();\n isPercent = distance.indexOf('%') !== -1;\n return isPercent ?\n maximum * (1 - parseFloat(distance) / 100) :\n maximum - parseFloat(distance);\n }", "function maxVal(item) {\n if (item === \"Temperature\") return 120; // max in clean is 109.6\n if (item.includes(\"Fatalities\")) return 700; // max in clean is 587\n if (item.includes(\"Maize\")) return 40000; // max in clean is 36600\n if (item.includes(\"Rice\")) return 30000; // max in clean is 25000, but max in raw is 60000\n if (item.includes(\"Sorghum\")) return 40000;\n if (item.includes(\"Cowpeas\")) return 100000; // max in clean is 80000\n return 100;\n}", "function calcMetaDataField_max(data,params,field)\n{\n var target = field.target[0]; // these are always arrays coming in\n\n var dataTarget = normalizeDataItem(data,target);\n var max = null;\n\n for(var i=0; i < dataTarget.length; i++) {\n\tvar thisNumber = parseFloat(dataTarget[i]);\n\tif(max===null || thisNumber > max){\n\t max = thisNumber;\n\t} \n }\n\n return(max);\n}", "function setMaxPersediaan() {\n maxPermintaan = document.getElementById('newMaxPersediaan').value;\n }", "function maxVal(value, row){\n\n\n var max = options.scale.ticks.max;\n if ( value > max ){\n value = max;\n jQuery(row).find('.data-value').val(value);\n }\n return value;\n}", "static calcMaxValue(diceExp: string) {\n return baseBalcValue(diceExp, false, true);\n }", "function calculateMaxValue(maximum) {\n var distance = ($attrs.distance || '2.5%').trim();\n var isPercent = distance.indexOf('%') !== -1;\n return isPercent ?\n maximum * (1 - parseFloat(distance) / 100) :\n maximum - parseFloat(distance);\n }", "function calcMaxDays(maximDays) {\n\tageDayEl.setAttribute('max', maximDays);\n}", "function YLightSensor_get_highestValue()\n { var json_val = this._getAttr('highestValue');\n return (json_val == null ? Y_HIGHESTVALUE_INVALID : Math.round(json_val/6553.6) / 10);\n }", "get max() {\r\n return this._max\r\n }", "get max() { return this._max; }", "get max() { return this._max; }", "get max() { return this._max; }" ]
[ "0.68274987", "0.67250717", "0.66997606", "0.6594341", "0.65138334", "0.65106434", "0.64073956", "0.6382986", "0.6377778", "0.6359372", "0.63428384", "0.6298422", "0.6285514", "0.6256145", "0.6250908", "0.6232988", "0.6216029", "0.62050897", "0.6192077", "0.6187974", "0.61835593", "0.6179138", "0.6151307", "0.6124065", "0.6119587", "0.6084207", "0.60584813", "0.60521555", "0.60521555", "0.60521555" ]
0.6782513
1
busca el valor de minimo (de la propiedad LOW) de cada dia (propiedad DTYYYYMMDD)(el valor de minimo de cada dia)
function buscarMinDia(array) { let day; let arr = []; for (let i = 0; i < array.length; i++) { let date = array[i].DTYYYYMMDD; if (day != date) { day = date; let res; let contador = 0; for (let j = 0; j < array.length; j++) { if (array[j].DTYYYYMMDD === day) { if (contador === 0) { res = array[j].LOW; } else { res = Math.min(res, array[j].LOW); } contador++; } } arr.push(res); } } //console.log('Minimos:', arr) return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function milisegundosToMinutos(milisegundos) {\n let minutos = milisegundos / 60000\n return minutos\n}", "function sumaDuracion(){\n \n var sumHrs = parseInt(0), sumMin = parseInt(0);\n var auxHrs = parseInt(0), auxMin = parseInt(0);\n var totalHrs = parseInt(0), totalMin, i=1, ni=0;\n \n $('[name=\"minAP\"]').each(function(){\n \n var m = $(this).val();\n if (m !== \"\" && m!==\"99\"){ \n sumMin += parseInt(m);\n auxMin = sumMin % 60;\n auxHrs = Math.trunc(sumMin/60);\n \n var h = $('#hrsAP'+i).val();\n sumHrs += parseInt(h);\n }else if(m === \"99\"){\n ni++;\n }\n totalHrs = sumHrs + auxHrs;\n i++;\n });\n \n if(auxMin<10){//si es menor que 10 le concatena un cero para que se muestre en el select\n totalMin = '0' + auxMin;\n }else{\n totalMin = auxMin;\n }\n \n if(ni !== 5){//muestra el valor total de las horas y minutos\n $('#hrs').val(totalHrs);\n $('#min').val(totalMin);\n $('#chkDNI').prop('checked',false);\n }else{//si todos los campos son NI pone el valor NI\n $('#hrs').val(\"99\");\n $('#min').val(\"99\");\n $('#chkDNI').prop('checked',true);\n }\n}", "function setM(value) {\n document.getElementById(\"valueM\").innerHTML = value;\n mines = parseInt(value);\n}", "function adicionaMinutos() {\n\n\n if(minutos === 5){\n setMinutos(10);\n setSegundos(0);\n }\n\n if(minutos === 10){\n setMinutos(15);\n setSegundos(0);\n }\n\n if(minutos === 10){\n setMinutos(15);\n setSegundos(0);\n }\n\n if(minutos === 15){\n setMinutos(20);\n setSegundos(0);\n }\n\n if(minutos === 20){\n setMinutos(25);\n setSegundos(0);\n }\n\n if(minutos === 25){\n setMinutos(30);\n setSegundos(0);\n }\n\n if(minutos === 30){\n setMinutos(35);\n setSegundos(0);\n }\n\n if(minutos === 35){\n setMinutos(40);\n setSegundos(0);\n }\n\n if(minutos === 40){\n setMinutos(5);\n setSegundos(0);\n }\n}", "function getInputMin(idx) {\r\n\tvar result = $(inputmetadata[idx]).find(\"mins>data\");\r\n\tif (result == null || result.text()==null) {return -100;}\r\n\telse return parseFloat(extract(result.text()));\r\n}", "get min() {\n return this.date.getMinutes();\n }", "function evaluateMin(min) {\r\n if (min == 1) {\r\n minutes = ' minute';\r\n } else {\r\n minutes = ' minutes';\r\n }\r\n return minutes;\r\n}", "function progressMin() {\n var min = mins.innerHTML;\n\n switch (true) {\n case min <= 59 && min != \"00\":\n {\n mins.innerHTML = minutes++;\n }\n break;\n case min > 59:\n {\n mins.innerHTML = \"00\";\n hours.innerHTML = \"9\";\n }\n break;\n default:\n return;\n }\n }", "function convert(min){\n min*=60;\n return min;\n}", "function findTheMinimumValueOfChemin(chemin) {\n var minimum = chemin[1].value;\n for(var i=1; i < chemin.length; i++) {\n if(chemin[i].value == \"E\" && chemin[i].marque == '-') {\n minimum = chemin[i].value;\n }\n if(chemin[i].value != \"E\" && chemin[i].value < minimum && chemin[i].marque == '-') minimum = chemin[i].value;\n }\n return minimum;\n }", "get minimumValue() {\r\n return this.i.minimumValue;\r\n }", "getInt(thing, min = 0){\n thing = parseInt(thing);\n min = parseInt(min);\n\n if (Number.isNaN(thing)) {\n if (!Number.isNaN(min)) return min;\n else return 0;\n } else {\n if (!Number.isNaN(min)) {\n if (thing > min) return thing;\n else return min;\n } else return thing;\n }\n }", "function setMinutes() {\n if (minNow <= 5 || minNow >= 55) {\n min = arrMins[0];\n }\n else if (minNow <=10 || minNow >= 50) {\n min = arrMins[1];\n }\n else if (minNow <=10 || minNow >= 50) {\n min = arrMins[1];\n }\n else if (minNow <=15 || minNow >= 45) {\n min = arrMins[2];\n }\n else if (minNow < 30 || minNow > 30) {\n min = arrMins[3];\n }\n return min;\n}", "get min() {\r\n return this._min\r\n }", "get min() { return this._min; }", "get min() { return this._min; }", "get min() { return this._min; }", "get min() { return this._min; }", "get min() { return this._min; }", "get min() { return this._min; }", "function duracionCero(hrs, min){\n \n if($(hrs).val()===\"0\" && $(min).val()===\"00\"){\n alert(\"La duracion (horas y minutos) de la audiencia no pueden ser cero\");\n $(hrs).val('');\n $(min).val('');\n }\n}", "function getDurMin($sec) {\r\n // if($sec.isNaN()){}\r\n var min = parseInt($sec / 60);\r\n var sec = parseInt($sec % 60);\r\n if (min < 10) {\r\n min = '0' + min;\r\n }\r\n if (sec < 10) {\r\n sec = '0' + sec;\r\n }\r\n return { min: min, sec: sec };\r\n }", "function cambiarTiempo(ano, mes, dia, hour, min) {\n\n let cambioMin = min;\n let cambioHour = hour;\n let cambioDia = dia;\n let cambioAno = ano;\n let cambioMes = mes;\n\n\n\n if (cambioMin == 30) {\n cambioMin = 0;\n if (cambioHour === 23) {\n cambioHour = 0;\n if (cambioDia === 30 || cambioDia === 31) {\n\n cambioDia = 1;\n\n if (cambioMes === 12) {\n cambioMes = 1;\n cambioAno++;\n } else {\n cambioMes++;\n }\n } else {\n cambioDia++;\n }\n\n } else {\n cambioHour++;\n }\n\n } else if (cambioMin < 30) {\n cambioMin += 30;\n\n\n } else if (cambioMin > 30) {\n\n let aux = Math.abs(cambioMin - 30);\n if (cambioHour === 23) {\n cambioHour = 0;\n if (cambioDia === 30 || cambioDia === 31) {\n\n cambioDia = 1;\n\n if (cambioMes === 12) {\n cambioMes = 1;\n cambioAno++;\n } else {\n cambioMes++;\n }\n } else {\n cambioDia++;\n }\n\n } else {\n cambioMin = aux;\n cambioHour++;\n }\n\n }\n\n //final del dia\n\n return [cambioAno, cambioMes, cambioDia, cambioHour, cambioMin];\n\n}", "function setMinPermintaan () {\n minPermintaan = document.getElementById('newMinPermintaan').value;\n }", "function getMinimum () {\n if ((document.getElementById('entMin').value)===\"\") {\n return 1;\n }\n else {\n return Number(document.getElementById('entMin').value)}\n}", "get min() {\n return this._min;\n }", "function arreglarFormatoMinutos () {\n const minutos = fecha.getMinutes()\n if (minutos < 10) {\n const minutosArreglados = '0' + minutos\n return minutosArreglados\n } else {\n return minutos\n }\n}", "function getMinTemp() {\n for (var i = 0; i < forecastDays; i++) {\n var minTemp = response.query.results.channel.item.forecast[i].low;\n $(\"#day\" + i + \"Min\").append(\"Low: \" + minTemp + \"°F\");\n }\n }", "get minNumber() {\n return 0\n }", "function minValue() {\n return parse(-8640000000000000, 1);\n}" ]
[ "0.6305875", "0.6247586", "0.61750144", "0.60922945", "0.6088371", "0.6011467", "0.5953956", "0.59032714", "0.58966565", "0.5886316", "0.58637834", "0.5840592", "0.5825569", "0.5822594", "0.58093446", "0.58093446", "0.58093446", "0.58093446", "0.58093446", "0.58093446", "0.5803542", "0.5799085", "0.5789356", "0.5778108", "0.57372326", "0.57151026", "0.57131815", "0.5706308", "0.5697832", "0.5697695" ]
0.6517961
0
Quits the application and installs the update.
quitAndInstall() { setTimeout(() => { this.autoUpdater.quitAndInstall() }, 5000) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async scheduleInstallOnQuit() {\n this.restart = false;\n await this._rememberInstallAttempt();\n this._setupExitHook();\n }", "function updateApplication() {\r\n\t\t\t\r\n\t\t\ttry{\r\n\t\t\t\tvar updater = new air.Updater();\r\n\t\t\t\tupdater.update(newAppFile, currentVersion);\r\n\t\t\t} catch(err) {}\r\n\t\t\t\r\n\t\t\tnativeWindow.close();\r\n\t\t} // End of updateApplication() function.", "async quitAndInstall() {\n this.restart = true;\n await this._rememberInstallAttempt();\n this._setupExitHook();\n this._quit();\n }", "_installUpdate() {\n browser.runtime.onInstalled.addListener((details) => {\n // Note that console logging doesn't work within this event.\n if (details.reason === 'install') {\n this.app.setState({\n app: {\n installed: true,\n updated: false,\n version: {\n current: chrome.runtime.getManifest().version,\n },\n },\n })\n } else if (details.reason === 'update') {\n this.app.setState({\n app: {\n installed: false,\n updated: true,\n version: {\n current: chrome.runtime.getManifest().version,\n previous: details.previousVersion,\n },\n },\n })\n }\n })\n }", "function installPrompt()\n{\n closeWindow();\n if (app.pluginInstalled() && // plugin already installed but needs upgrade\n (Callcast.pluginUpdateRequired() || Callcast.pluginUpdateAvailable()) )\n {\n // chrome can't load an upgraded plugin so prompt user to restart\n if (app.browser.name === 'Chrome')\n {\n openWindow('#chromeRestart');\n }\n else\n {\n openWindow('#pageReload');\n }\n }\n else if (app.browser.name === 'Firefox') // firefox seems to have a problem polling navigator.plugins\n // so prompt user to reload instead of polling plugins\n {\n openWindow('#pageReload');\n }\n else // no plugin installed, wait for plugin\n {\n openWindow('#winWait');\n checkForPlugin();\n //openWindow('#pageReload');\n }\n}", "async quitAndRetryInstall(allowLocal = true) {\n try {\n const info = await this._getValidUpdateInfoOnDisk();\n this.downloadedFile = info.updateFile;\n info.attempts++;\n await new Promise((fulfill, reject) => {\n fs.writeFile(this._getUpdateInfoFilePath(), JSON.stringify(info), err => {\n if (err) {\n // Can't write install attempt for some reason.\n // Log the error and continue.\n console.error('Failed to write install attempt info: ', err);\n }\n fulfill();\n });\n });\n this.restart = true;\n this._setupExitHook();\n this._quit();\n } catch (err) {\n // Try checking for and downloading the update.\n try {\n if (!await this._check()) {\n // No update is found... strange.\n // Restart anyway by throwing exception.\n throw new Error('No update found');\n }\n await this._download();\n // Success, try installing the update.\n this.quitAndInstall();\n } catch (ex) {\n // TODO: record another failed attempt.\n await this._rememberInstallAttempt();\n if (process.versions && process.versions.electron) {\n const { app } = require('electron');\n this.restart = true;\n if (process.platform !== 'linux') {\n app.relaunch(); // linux is handled by \"_quit\"\n }\n }\n this._quit();\n }\n }\n }", "async function checkUpdate(){\r\n\r\n var fileContents = Fs.readFileSync(__dirname+'/package.json');\r\n var pkg = JSON.parse(fileContents);\r\n\tpkg['name'] = PACKAGE_TO_UPDATE;\r\n\tpkg['version'] = pkg['dependencies'][PACKAGE_TO_UPDATE];\r\n\tif(isNaN(pkg['version'].substr(0,1))){\r\n\t\t//exemple: ^0.3.1\r\n\t\tpkg['version'] = pkg['version'].substr(1);\r\n\t}\r\n\r\n\tconst update = new AutoUpdate(pkg);\r\n\tupdate.on('update', function(){\r\n\t\tconsole.log('started update')\r\n\t\tif(app){\r\n\t\t\tconsole.log('[lanSupervLauncher] stopApplication');\r\n\t\t\tapp.stopApplication();\r\n\t\t\tapp = null;\r\n\t\t}\r\n\t});\r\n\tupdate.on('ready', function(){\r\n\t\tconsole.log('[lanSupervLauncher] ready (updated or not !)');\r\n\t\t//3) (Re)launch application\r\n\t\tif(app===null){\r\n\t\t\tconsole.log('[lanSupervLauncher] startApplication');\r\n\t\t\tapp = new LanSuperv();\r\n\t\t\tvar ConfigFile = __dirname + '/config.js';\r\n\t\t\tapp.startApplication(ConfigFile);\r\n\t\t\t//(initial launch or relaunch after update)\r\n\t\t}\r\n\t});\r\n\r\n}", "function handleSquirrelEvent(application) {\n if (process.argv.length === 1) {\n return false;\n }\n\n const ChildProcess = require('child_process');\n const path = require('path');\n\n const appFolder = path.resolve(process.execPath, '..');\n const rootAtomFolder = path.resolve(appFolder, '..');\n const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));\n const exeName = path.basename(process.execPath);\n\n const spawn = function(command, args) {\n let spawnedProcess, error;\n\n try {\n spawnedProcess = ChildProcess.spawn(command, args, {\n detached: true\n });\n } catch (error) {}\n\n return spawnedProcess;\n };\n\n const spawnUpdate = function(args) {\n return spawn(updateDotExe, args);\n };\n\n const squirrelEvent = process.argv[1];\n switch (squirrelEvent) {\n case '--squirrel-install':\n case '--squirrel-updated':\n // Optionally do things such as:\n // - Add your .exe to the PATH\n // - Write to the registry for things like file associations and\n\t\t\t// explorer context menus\n\t\t\t\n // Install desktop and start menu shortcuts\n spawnUpdate(['--createShortcut', exeName]);\n\n setTimeout(application.quit, 1000);\n return true;\n\n case '--squirrel-uninstall':\n // Undo anything you did in the --squirrel-install and\n // --squirrel-updated handlers\n\n // Remove desktop and start menu shortcuts\n spawnUpdate(['--removeShortcut', exeName]);\n\n setTimeout(application.quit, 1000);\n return true;\n\n case '--squirrel-obsolete':\n // This is called on the outgoing version of your app before\n // we update to the new version - it's the opposite of\n // --squirrel-updated\n\n application.quit();\n return true;\n }\n}", "function handleSquirrelEvent() {\n if (process.argv.length === 1) {\n return false;\n }\n\n const ChildProcess = require(\"child_process\");\n const path = require(\"path\");\n\n const appFolder = path.resolve(process.execPath, \"..\");\n const rootAtomFolder = path.resolve(appFolder, \"..\");\n const updateDotExe = path.resolve(path.join(rootAtomFolder, \"Update.exe\"));\n const exeName = path.basename(process.execPath);\n\n const spawn = function (command, args) {\n let spawnedProcess, error;\n\n try {\n spawnedProcess = ChildProcess.spawn(command, args, { detached: true });\n } catch (error) { }\n\n return spawnedProcess;\n };\n\n const spawnUpdate = function (args) {\n return spawn(updateDotExe, args);\n };\n\n const squirrelEvent = process.argv[1];\n switch (squirrelEvent) {\n case \"--squirrel-install\":\n case \"--squirrel-updated\":\n // Optionally do things such as:\n // - Add your .exe to the PATH\n // - Write to the registry for things like file associations and\n // explorer context menus\n\n // Install desktop and start menu shortcuts\n spawnUpdate([\"--createShortcut\", exeName]);\n\n setTimeout(app.quit, 1000);\n return true;\n\n case \"--squirrel-uninstall\":\n // Undo anything you did in the --squirrel-install and\n // --squirrel-updated handlers\n\n // Remove desktop and start menu shortcuts\n spawnUpdate([\"--removeShortcut\", exeName]);\n\n setTimeout(app.quit, 1000);\n return true;\n\n case \"--squirrel-obsolete\":\n // This is called on the outgoing version of your app before\n // we update to the new version - it's the opposite of\n // --squirrel-updated\n\n app.quit();\n return true;\n }\n}", "function handleSquirrelEvent(application) {\n if (process.argv.length === 1) {\n return false;\n }\n\n const ChildProcess = require('child_process');\n const path = require('path');\n\n const appFolder = path.resolve(process.execPath, '..');\n const rootAtomFolder = path.resolve(appFolder, '..');\n const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));\n const exeName = path.basename(process.execPath);\n\n const spawn = function (command, args) {\n let spawnedProcess, error;\n\n try {\n spawnedProcess = ChildProcess.spawn(command, args, {\n detached: true\n });\n } catch (error) { }\n\n return spawnedProcess;\n };\n\n const spawnUpdate = function (args) {\n return spawn(updateDotExe, args);\n };\n\n const squirrelEvent = process.argv[1];\n switch (squirrelEvent) {\n case '--squirrel-install':\n case '--squirrel-updated':\n // Optionally do things such as:\n // - Add your .exe to the PATH\n // - Write to the registry for things like file associations and\n // explorer context menus\n\n // Install desktop and start menu shortcuts\n spawnUpdate(['--createShortcut', exeName]);\n\n setTimeout(application.quit, 1000);\n return true;\n\n case '--squirrel-uninstall':\n // Undo anything you did in the --squirrel-install and\n // --squirrel-updated handlers\n\n // Remove desktop and start menu shortcuts\n spawnUpdate(['--removeShortcut', exeName]);\n\n setTimeout(application.quit, 1000);\n return true;\n\n case '--squirrel-obsolete':\n // This is called on the outgoing version of your app before\n // we update to the new version - it's the opposite of\n // --squirrel-updated\n\n application.quit();\n return true;\n }\n}", "updateClickHandler() {\n const { manualUpdateAvailable, hasAppUpdate } = this;\n if (manualUpdateAvailable) {\n const { updateVersion } = this;\n const base = 'https://github.com/advanced-rest-client/arc-electron/releases/tag';\n const url = `${base}/v${updateVersion}`;\n Events.Navigation.navigateExternal(document.body, url);\n } else if (hasAppUpdate) {\n Events.Updater.installUpdate(document.body);\n }\n }", "function handleSquirrelEvent(application) {\n if (process.argv.length === 1) {\n return false\n }\n const ChildProcess = require('child_process')\n const path = require('path')\n const appFolder = path.resolve(process.execPath, '..')\n const rootAtomFolder = path.resolve(appFolder, '..')\n const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'))\n const exeName = path.basename(process.execPath)\n const spawn = function (command, args) {\n let spawnedProcess, error\n try {\n spawnedProcess = ChildProcess.spawn(command, args, {\n detached: true,\n })\n } catch (error) {}\n return spawnedProcess\n }\n const spawnUpdate = function (args) {\n return spawn(updateDotExe, args)\n }\n const squirrelEvent = process.argv[1]\n switch (squirrelEvent) {\n case '--squirrel-install':\n case '--squirrel-updated':\n // Optionally do things such as:\n // - Add your .exe to the PATH\n // - Write to the registry for things like file associations and\n // explorer context menus\n // Install desktop and start menu shortcuts\n spawnUpdate(['--createShortcut', exeName])\n setTimeout(application.quit, 1000)\n return true\n case '--squirrel-uninstall':\n // Undo anything you did in the --squirrel-install and\n // --squirrel-updated handlers\n // Remove desktop and start menu shortcuts\n spawnUpdate(['--removeShortcut', exeName])\n setTimeout(application.quit, 1000)\n return true\n case '--squirrel-obsolete':\n // This is called on the outgoing version of your app before\n // we update to the new version - it's the opposite of\n // --squirrel-updated\n application.quit()\n return true\n }\n}", "function handleSquirrelEvent() {\n if (process.argv.length === 1) {\n return false;\n }\n\n const ChildProcess = require('child_process');\n const path = require('path');\n\n const appFolder = path.resolve(process.execPath, '..');\n const rootAtomFolder = path.resolve(appFolder, '..');\n const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));\n const exeName = path.basename(process.execPath);\n\n const spawn = function(command, args) {\n let spawnedProcess, error;\n\n try {\n spawnedProcess = ChildProcess.spawn(command, args, {detached: true});\n } catch (error) {}\n\n return spawnedProcess;\n };\n\n const spawnUpdate = function(args) {\n return spawn(updateDotExe, args);\n };\n\n const squirrelEvent = process.argv[1];\n switch (squirrelEvent) {\n case '--squirrel-install':\n case '--squirrel-updated':\n // Optionally do things such as:\n // - Add your .exe to the PATH\n // - Write to the registry for things like file associations and\n // explorer context menus\n\n // Install desktop and start menu shortcuts\n spawnUpdate(['--createShortcut', exeName]);\n\n setTimeout(app.quit, 1000);\n return true;\n\n case '--squirrel-uninstall':\n // Undo anything you did in the --squirrel-install and\n // --squirrel-updated handlers\n\n // Remove desktop and start menu shortcuts\n spawnUpdate(['--removeShortcut', exeName]);\n\n setTimeout(app.quit, 1000);\n return true;\n\n case '--squirrel-obsolete':\n // This is called on the outgoing version of your app before\n // we update to the new version - it's the opposite of\n // --squirrel-updated\n\n app.quit();\n return true;\n }\n}", "function onUpdateExe () {\r\n let job = new Job({\r\n videoUrl: 'Update youtube-dl.exe executable',\r\n updateExe: true\r\n });\r\n state.jobs.unshift(job);\r\n job.create();\r\n return Promise.resolve(job);\r\n}", "function executeSquirrelCommand(args, done) {\n const updateDotExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');\n const child = spawn(updateDotExe, args, { detached: true });\n child.on('close', () => done());\n}", "function winInstall(event)\n{\n // close the eula window\n closeWindow();\n installPrompt(app.WIN_PL_NAME);\n}", "function updateApp() {\n\n\tif ($(\".selectedPortlet\")[0]) {\n\t\tvar portletID = $(\".selectedPortlet\")[0].id;\n\t\t$.getJSON(\"/security/config/installedapps?action=update&app=\" + portletID+\"&user=\" + otusr + \"&pw=\" + otpwd, function(json) {\n\t\t\talert(json.statusInfo);\n\t\t});\n\t} else {\n\t\talert(\"Wählen Sie ein Bundle!\");\n\t}\n}", "function updateApp(e){\n // Get zip and feelings from UI\n const zip = document.getElementById('zip').value;\n const feelings = document.getElementById('feelings').value;\n\n // Get weather from api\n getWeather(baseURL, zip, apiKey)\n .then(function(data){\n // Update the data obj on the server\n const currentDate = new Date(data.dt*1000).toLocaleDateString(\"en-US\");\n updateData('/save', {\n date: currentDate, \n temp: data.main.temp,\n feelings: feelings\n });\n })\n .then(function(data){\n // Update the UI\n updateUI();\n });\n}", "onUpdateDownloaded(info) {\n if(this.updateEntry != null) {\n this.updateEntry.setTitle(\"Update downloaded\");\n this.updateEntry.setText(\"XenonTrade <span>v\" + info.version + \"</span> has been downloaded. It will be automatically installed after closing XenonTrade.<br /><i class='fas fa-arrow-right'></i> <span data-update='install'>Install now</span>\");\n this.updateEntry.enableClose();\n }\n\n $(\".menu\").find(\"[data-button='download']\").hide();\n\n $(\".entry[data-id='\" + this.updateEntry.getId() + \"']\").find(\"[data-update='install']\").click(function() {\n ipcRenderer.send(\"install-update\");\n });\n }", "handleUpdateCheckingProcess()\n {\n let checkForUpdateItem = this.tray.getMenuItem('checkForUpdate');\n let restartAndInstallUpdateItem = this.tray.getMenuItem('restartAndInstallUpdate');\n let youAreUpToDateItem = this.tray.getMenuItem('youAreUpToDate');\n let downloadingUpdateItem = this.tray.getMenuItem('downloadingUpdate');\n let downloadingUpdateFailedItem = this.tray.getMenuItem('downloadingUpdateFailed');\n\n // Disable the check for update menu item to avoid running into\n // multiple checks\n checkForUpdateItem.enabled = false;\n\n // Run the updater to see if there is an update\n this.updater.checkForUpdate()\n\n // We have an update!\n .then(() => {\n\n // Tell user we are downloading the update\n downloadingUpdateItem.visible = true;\n checkForUpdateItem.visible = false;\n checkForUpdateItem.enabled = true;\n\n // Wait for the download to finish\n this.updater.onUpdateDownloaded()\n\n // Enable the restart and install update menu item\n .then(() => {\n downloadingUpdateItem.visible = false;\n restartAndInstallUpdateItem.visible = true;\n })\n\n // Failed to download update\n .catch(() => {\n downloadingUpdateFailedItem.visible = true;\n downloadingUpdateItem.visible = false;\n\n // Enable check for update after 1 min\n setTimeout(() => {\n checkForUpdateItem.visible = true;\n downloadingUpdateFailedItem.visible = false;\n }, 1000 * 60);\n });\n })\n\n // Nope, all up to date\n .catch((error) => {\n\n if (this.debug) {\n console.log(error);\n }\n\n youAreUpToDateItem.visible = true;\n checkForUpdateItem.visible = false;\n checkForUpdateItem.enabled = true;\n\n // Enable check for update after 1 min\n setTimeout(() => {\n checkForUpdateItem.visible = true;\n youAreUpToDateItem.visible = false;\n }, 1000 * 60);\n });\n }", "autoupdate() {\r\n const sendStatusToWindow = (message) => {\r\n this.mainWindow.webContents.send(\"updateMessage\", message);\r\n };\r\n autoUpdater.checkForUpdatesAndNotify();\r\n\r\n autoUpdater.on(\"update-available\", () => {\r\n this.mainWindow.webContents.send(\r\n \"updateMessage\",\r\n \"Update available!\"\r\n );\r\n });\r\n\r\n autoUpdater.on(\"update-downloaded\", () => {\r\n autoUpdater.quitAndInstall();\r\n });\r\n\r\n autoUpdater.on(\"checking-for-update\", () => {\r\n sendStatusToWindow(\"Checking for update...\");\r\n });\r\n autoUpdater.on(\"update-available\", (info) => {\r\n sendStatusToWindow(\"Update available.\");\r\n });\r\n autoUpdater.on(\"update-not-available\", (info) => {\r\n sendStatusToWindow(\"Update not available.\");\r\n });\r\n autoUpdater.on(\"error\", (err) => {\r\n sendStatusToWindow(\"Error in auto-updater. \" + err);\r\n });\r\n autoUpdater.on(\"download-progress\", (progressObj) => {\r\n let log_message = \"Download speed: \" + progressObj.bytesPerSecond;\r\n log_message =\r\n log_message + \" - Downloaded \" + progressObj.percent + \"%\";\r\n log_message =\r\n log_message +\r\n \" (\" +\r\n Math.round(progressObj.transferred) +\r\n \"/\" +\r\n Math.round(progressObj.total) +\r\n \")\";\r\n sendStatusToWindow(log_message);\r\n });\r\n autoUpdater.on(\"update-downloaded\", (info) => {\r\n sendStatusToWindow(\"Update downloaded\");\r\n });\r\n }", "install() {\r\n return this.clone(App, \"Install\").postCore();\r\n }", "function update_tray() { \n if (tray && !isWin) return; //Bug in linux doesn't allow us to recreate the tray in this boostrap manner. See: https://github.com/electron/electron/issues/17622\n if (tray) tray.destroy();\n tray = new Tray(icon_path)\n tray.setToolTip('Diary Prompter')\n tray.on('click', () => create_quick_entry_window());\n\n let items = [\n new MenuItem({label: 'Preferences', click: () => {\n if (isWin) options_window.show();\n else create_options_window();\n }}),\n // new MenuItem({\n // label: `${(store.get('tracking') ? 'Enable' : 'Disable')} Program Tracking`,\n // click: () => {\n // store.set('tracking', !store.get('tracking'));\n // update_tray();\n // }\n // }),\n new MenuItem({\n label: 'Add Quick Entry',\n click: () => create_quick_entry_window()\n }),\n new MenuItem({\n label: 'Add Full Entry',\n click: () => create_diary_entry_window()\n }),\n new MenuItem({\n label: 'Quit',\n click: () => {\n app.isQutting = true;\n if (isWin) options_window.close();\n app.quit();\n }\n })\n ];\n if (isWin) items.push(new MenuItem({\n label: `${(store.get('reminders') ? 'Enable' : 'Disable')} Hourly Reminders`,\n click: () => {\n store.set('reminders', !store.get('reminders'));\n update_tray();\n }\n })); //We can only add this item on windows machines, as the fast toggle doesn't work for linux.\n\n tray.setContextMenu(Menu.buildFromTemplate(items));\n}", "async reload() {\n const addon = addonFor(this);\n\n logger.debug(`reloading add-on ${addon.id}`);\n\n if (!this.temporarilyInstalled) {\n await XPIDatabase.updateAddonDisabledState(addon, true);\n await XPIDatabase.updateAddonDisabledState(addon, false);\n } else {\n // This function supports re-installing an existing add-on.\n await AddonManager.installTemporaryAddon(addon._sourceBundle);\n }\n }", "async handle_update() {\n\t\tthis.new_worker = await navigator.serviceWorker.getRegistration();\n\t\tif (this.new_worker.waiting) {\n\t\t\tthis.promote_app_update();\n\t\t}\n\t}", "function onFirstButtonPressed() {\n\t\t\t\t\tif (result.meta.redirectURL && result.meta.redirectURL.length != 0) {\n\t\t\t\t\t\t//RaU wants us to open a URL, most probably core/player updated and binary changed. \n\t\t\t\t\t\tSMF.Net.browseOut(result.meta.redirectURL);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t//There is an update waiting to be downloaded. Let's download it.\n\t\t\t\t\t\tresult.download(function(err, result) {\n\t\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\t\t//Download failed\n\t\t\t\t\t\t\t\talert(\"Autoupdate download failed: \" + err);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t//All files are received, we'll trigger an update.\n\t\t\t\t\t\t\t\tresult.updateAll(function(err) {\n\t\t\t\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\t\t\t\t//Updating the app with downloaded files failed\n\t\t\t\t\t\t\t\t\t\talert(\"Autoupdate update failed: \" + err);\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\t//After that the app will be restarted automatically to apply the new updates\n\t\t\t\t\t\t\t\t\t\tApplication.restart();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}", "function handleInstalled (details) {\n if (details.reason === 'install') {\n browser.runtime.openOptionsPage()\n } else if (details.reason === 'update') {\n let previousVersion = details.previousVersion\n if (previousVersion[0] === '1') {\n // Update from version 1.*\n browser.storage.local.remove(['override', 'icon', 'inbox', 'addtotop'])\n }\n browser.storage.local.set({newRelease: true}).then(() => {\n browser.runtime.openOptionsPage()\n }, onError)\n }\n}", "function handleStartupEvent(callback) {\n const squirrelCommand = process.argv[1];\n\n switch (squirrelCommand) {\n case '--squirrel-install':\n case '--squirrel-updated':\n // Optionally do things such as:\n //\n // - Install desktop and start menu shortcuts\n // - Add your .exe to the PATH\n // - Write to the registry for things like file associations and\n // explorer context menus\n\n // Always quit when done\n install(app.quit);\n break;\n\n case '--squirrel-uninstall':\n // Undo anything you did in the --squirrel-install and\n // --squirrel-updated handlers\n\n // Always quit when done\n uninstall(app.quit);\n break;\n\n case '--squirrel-obsolete':\n // This is called on the outgoing version of your app before\n // we update to the new version - it's the opposite of\n // --squirrel-updated\n uninstall(app.quit);\n break;\n\n case '--squirrel-firstrun':\n // do something on windows first run\n app.quit();\n break;\n\n default:\n callback();\n }\n}", "promoteUpdater() {}", "function onInstall() {\n onOpen();\n}" ]
[ "0.6529961", "0.63500094", "0.6310466", "0.62678844", "0.61116886", "0.59876883", "0.59263605", "0.5832421", "0.5810761", "0.5805487", "0.58005667", "0.5796299", "0.576113", "0.5694946", "0.56922966", "0.55574274", "0.5548117", "0.552466", "0.5483094", "0.5480218", "0.5464473", "0.5414999", "0.54000914", "0.5376877", "0.537114", "0.53593266", "0.5357919", "0.53576463", "0.5351046", "0.53372216" ]
0.63585895
1
drag_util.js Utility functions for YUI darg and drop applications ///////////////////////////////////// Dependencies from YUI yahoomin.js dommin.js eventmin.js //////////////////// //////////////////////////// selectMultiple Event Handeler Uses Shift or Cmd/Ctrl click to select multiple items in a supplied container element ///// Variables //////////// ev JS Event use_parent Bool apply selected class to the clicked element or it's parent (e.g. for tables event is fired by td but selected class is applied to tr);
function selectMultiple(ev, use_parent){ var Dom = YAHOO.util.Dom, Event = YAHOO.util.Event; var dd = null; var tar = Event.getTarget(ev); if(use_parent){ tar = tar.parentNode; } var kids = tar.parentNode.getElementsByTagName(tar.tagName); //Event.stopEvent(ev); //If the shift key is pressed, add it to the list if (ev.metaKey || ev.ctrlKey) { if (tar.className.search(/selected/) > -1) { Dom.removeClass(tar, 'selected'); } else { Dom.addClass(tar, 'selected'); } }else if(ev.shiftKey) { var sel = false; for (var i = 0 ; i < kids.length ; i++){ if(!sel && kids.item(i).className.search(/selected/) > -1){ sel = true; } if(sel){ Dom.addClass(kids.item(i), 'selected'); } if(kids.item(i) == tar){ // shift clicked elem reached if(!sel){ //selection either below or no other row selected for (var ii = i ; ii < kids.length ; ii++){ if(!sel && kids.item(ii).className.search(/selected/) > -1){ sel = true; }else if(sel && kids.item(ii).className.search(/selected/) == -1){ break; } Dom.addClass(kids.item(ii), 'selected'); } if(!sel){ //no second row selected for (var ii = i + 1 ; i < kids.length ; i++){ Dom.removeClass(kids.item(ii), 'selected'); } } } break; } } }else { for (var i = 0 ; i < kids.length ; i++){ kids.item(i).className = ''; } Dom.addClass(tar, 'selected'); } //clear any highlighted text from the defualt shift-click functionality clearSelection(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initializeMultipleSelectBoxMouseEvent($container) {\r\n\t\tvar $document = $(document);\r\n\t\t/* process container event */\r\n\t\t$container.bind(\"mousedown.\" + PLUGIN_NAMESPACE, function(e) {\r\n\t\t\t/* disable text selection */\r\n\t\t\te.preventDefault();\r\n\t\t\t/* starting row */\r\n\t\t\tvar target = e.target;\r\n\t\t\tvar $target = $(target);\r\n\t\t\tvar $startRow = $target;\r\n\t\t\t/* correct the focus for chrome */\r\n\t\t\tif (target == this) {\r\n\t\t\t\treturn;\r\n\t\t\t} else if ($target.parent()[0] != this) {\r\n\t\t\t\ttarget.focus();\r\n\t\t\t\t$startRow = $target.parents(\".\" + PLUGIN_NAMESPACE + \">*\").eq(0);\r\n\t\t\t} else {\r\n\t\t\t\tthis.focus();\r\n\t\t\t}\r\n\t\t\tvar startIndex = $startRow.getMultipleSelectBoxRowIndex($container);\r\n\t\t\tvar currentIndex = startIndex;\r\n\t\t\t/* trigger callback */\r\n\t\t\tif (!fireOnSelectStartEvent(e, $container, startIndex)) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\t/* prepare info for drawing */\r\n\t\t\tvar options = $container.getMultipleSelectBoxOptions();\r\n\t\t\tvar containerHistory = $container.getMultipleSelectBoxHistory();\r\n\t\t\t/* opposite and retain selection for touch device */\r\n\t\t\tvar isTouchDeviceMode = options.isTouchDeviceMode;\r\n\t\t\tvar isSelectionOpposite = isTouchDeviceMode;\r\n\t\t\tvar isSelectionRetained = isTouchDeviceMode;\r\n\t\t\tif (options.isKeyEventEnabled) {\r\n\t\t\t\tif (e.shiftKey) {\r\n\t\t\t\t\tcurrentIndex = startIndex;\r\n\t\t\t\t\tstartIndex = containerHistory.selectingStartIndex;\r\n\t\t\t\t} else if (e.ctrlKey) {\r\n\t\t\t\t\tisSelectionOpposite = isSelectionRetained = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t/* starting */\r\n\t\t\t$container.addClass(PLUGIN_STYLE_SELECTING).drawMultipleSelectBox(startIndex, currentIndex, {\r\n\t\t\t\t\"isSelectionOpposite\": isSelectionOpposite,\r\n\t\t\t\t\"isSelectionRetained\": isSelectionRetained,\r\n\t\t\t\t\"scrollPos\": null\r\n\t\t\t});\r\n\t\t\t/* listening */\r\n\t\t\tvar scrollHelperFunc = function(e1) {\r\n\t\t\t\toptions.scrollHelper(e1, $container, startIndex, isSelectionRetained);\r\n\t\t\t};\r\n\t\t\t$container.yieldMultipleSelectBox().bind(\"mouseenter.\" + PLUGIN_NAMESPACE, function() {\r\n\t\t\t\tunbindEvents($document, [ \"mousemove\" ]);\r\n\t\t\t}).bind(\"mouseleave.\" + PLUGIN_NAMESPACE, function(e1) {\r\n\t\t\t\tscrollHelperFunc(e1);\r\n\t\t\t\t$document.bind(\"mousemove.\" + PLUGIN_NAMESPACE, function(e2) {\r\n\t\t\t\t\tscrollHelperFunc(e2);\r\n\t\t\t\t});\r\n\t\t\t}).bind(\"mouseover.\" + PLUGIN_NAMESPACE, function(e1) {\r\n\t\t\t\tscrollHelperFunc(e1);\r\n\t\t\t}).one(\"mouseup.\" + PLUGIN_NAMESPACE, function(e1) {\r\n\t\t\t\tscrollHelperFunc(e1);\r\n\t\t\t});\r\n\t\t\t/* IE hacked for mouse up event */\r\n\t\t\tif (isIE) {\r\n\t\t\t\t$document.bind(\"mouseleave.\" + PLUGIN_NAMESPACE, function() {\r\n\t\t\t\t\t$document.one(\"mousemove.\" + PLUGIN_NAMESPACE, function(e1) {\r\n\t\t\t\t\t\tif (!e1.button) {\r\n\t\t\t\t\t\t\tvalidateMultipleSelectBox(e1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t\t/* select group items automatically */\r\n\t\t$container.getMultipleSelectBoxCachedRows().filter(\".\" + PLUGIN_STYLE_OPTGROUP).bind(\"dblclick.\" + PLUGIN_NAMESPACE, function(e) {\r\n\t\t\tvar $startRow = $(this);\r\n\t\t\t/* trigger callback */\r\n\t\t\tif (!fireOnSelectStartEvent(e, $container, $startRow.getMultipleSelectBoxRowIndex($container))) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tvar options = $container.getMultipleSelectBoxOptions();\r\n\t\t\tvar maxLimit = options.maxLimit;\r\n\t\t\tvar childGroupItemList = $startRow.getMultipleSelectBoxOptGroupItems();\r\n\t\t\tvar childGroupItemSelectSize = childGroupItemList.length;\r\n\t\t\tif (childGroupItemSelectSize > 0) {\r\n\t\t\t\tif (maxLimit > 0 && childGroupItemSelectSize > maxLimit) {\r\n\t\t\t\t\tchildGroupItemSelectSize = maxLimit;\r\n\t\t\t\t}\r\n\t\t\t\t$container.drawMultipleSelectBox(childGroupItemList.eq(0).getMultipleSelectBoxRowIndex($container), childGroupItemList.eq(childGroupItemSelectSize - 1).getMultipleSelectBoxRowIndex($container), {\r\n\t\t\t\t\t\"scrollPos\": null\r\n\t\t\t\t});\r\n\t\t\t\t/* special case */\r\n\t\t\t\t$container.addClass(PLUGIN_STYLE_SELECTING);\r\n\t\t\t\tvalidateMultipleSelectBox(e);\r\n\t\t\t}\r\n\t\t});\r\n\t}", "function initMultipleSelection(element) {\n element.on('click', 'li.type-task, li.type-sub-task', function (eventObject) {\n if (!eventObject.ctrlKey) {\n $('li.selected', element).not(this).removeClass('selected');\n }\n $(this).toggleClass('selected');\n eventObject.stopPropagation();\n });\n}", "click(event){\n if(event.target.tagName === \"MULTI-SELECTION\"){\n const onContainerMouseClick = this.onContainerMouseClick;\n\n if(onContainerMouseClick){\n onContainerMouseClick();\n }\n }\n }", "function doSelections(event, selectedEles, cols) {\n // Select elements in a range, either across rows or columns\n function selectRange() {\n var frstSelect = selectedEles[0];\n var lstSelect = selectedEles[selectedEles.length - 1];\n if (cols) {\n var flipStart = flipFlipIdx(Math.min(flipIdx(selectionMinPivot), flipIdx(selectionMaxPivot),\n flipIdx(frstSelect), flipIdx(lstSelect)));\n var flipEnd = flipFlipIdx(Math.max(flipIdx(selectionMinPivot), flipIdx(selectionMaxPivot),\n flipIdx(frstSelect), flipIdx(lstSelect)));\n selectElemsDownRows(Math.min(flipStart, flipEnd), Math.max(flipStart, flipEnd));\n } else {\n var start = Math.min(selectionMinPivot, frstSelect);\n var end = Math.max(selectionMaxPivot, lstSelect);\n selectElemRange(start, end);\n }\n }\n // If not left mouse button then leave it for someone else\n if (event.which != LEFT_MOUSE_BUTTON) {\n return;\n }\n // Just a click - make selection current row/column clicked on\n if (!event.ctrlKey && !event.shiftKey) {\n clearAll();\n selectEles(selectedEles);\n selectionMinPivot = selectedEles[0];\n selectionMaxPivot = selectedEles[selectedEles.length - 1];\n return;\n }\n // Cntrl/Shift click - add to current selections cells between (inclusive) last single selection and cell\n // clicked on\n if (event.ctrlKey && event.shiftKey) {\n selectRange();\n return;\n }\n // Cntrl click - keep current selections and add toggle of selection on the single cell clicked on\n if (event.ctrlKey) {\n toggleEles(selectedEles);\n selectionMinPivot = selectedEles[0];\n selectionMaxPivot = selectedEles[selectedEles.length - 1];\n return;\n }\n // Shift click - make current selections cells between (inclusive) last single selection and cell clicked on\n if (event.shiftKey) {\n clearAll();\n selectRange();\n }\n }", "function selectedDblclick( event ) {\n if ( self.cfg.onSelectedDblclick.length > 0 &&\n ( $(event.target).hasClass('selected') || $(event.target).closest('g').hasClass('selected') ) )\n for ( var n=0; n<self.cfg.onSelectedDblclick.length; n++ )\n self.cfg.onSelectedDblclick[n](event.target);\n }", "mouseUp(e){\n this._super(...arguments);\n\n\n if(e.path === undefined || e.path[0].tagName !== \"MULTI-SELECTION\"){\n return;\n }\n\n if(e.button == 0){\n e.stopPropagation();\n e.preventDefault();\n\n this.set('moveStart', false);\n }\n\n\n\n document.removeEventListener('mousemove', this.get('mouseMoveListener'));\n document.removeEventListener('mouseup', this.get('mouseUpListener'));\n\n\n }", "function setupMouseEvents(parent, canvas, selection) {\n function mousedownHandler(evt) {\n var mousePos = selection\n .geometry()\n .m2v(multiselect_utilities.offsetMousePos(parent, evt));\n switch (multiselect.modifierKeys(evt)) {\n case multiselect.NONE:\n selection.click(mousePos);\n break;\n case multiselect.CMD:\n selection.cmdClick(mousePos);\n break;\n case multiselect.SHIFT:\n selection.shiftClick(mousePos);\n break;\n default:\n return;\n }\n\n selection.geometry().drawIndicators(selection, canvas, true, true, false);\n\n document.addEventListener(\"mousemove\", mousemoveHandler, false);\n document.addEventListener(\"mouseup\", mouseupHandler, false);\n evt.preventDefault();\n evt.stopPropagation();\n }\n\n function mousemoveHandler(evt) {\n evt.preventDefault();\n evt.stopPropagation();\n var mousePos = selection\n .geometry()\n .m2v(multiselect_utilities.offsetMousePos(parent, evt));\n selection.shiftClick(mousePos);\n selection.geometry().drawIndicators(selection, canvas, true, true, true);\n }\n\n function mouseupHandler(evt) {\n document.removeEventListener(\"mousemove\", mousemoveHandler, false);\n document.removeEventListener(\"mouseup\", mouseupHandler, false);\n selection\n .geometry()\n .drawIndicators(selection, canvas, true, true, false, false);\n }\n\n parent.addEventListener(\"mousedown\", mousedownHandler, false);\n}", "function selectImg(e){\n\n //get the id of the thumb that was clicked on (e.g thumb0, thumb1,...etc)\n var selectedThumbId = e.toElement.id;\n\n //get the number of the thumb that was clicked on from its id (e.g. 0,1,2,...etc)\n var selectedImgNum = (selectedThumbId.substring(8))*1;\n\n // if shift is pressed when user clicks on thumb:\n // then highlight all images between the last selected image and the image that was clicked on when shift was pressed\n if(e.shiftKey) {\n\n var start = selectedImgs[selectedImgs.length-1] + 1; // next thumb after last entry in the selected images array\n var end = selectedImgNum;\n\n //handle case of selecting images in reverse order\n if(end < start) {\n start = end;\n end = selectedImgs[0]-1;\n }\n\n\n //loop through the thumbs add them to the array selectedImgs and mark the thumbs as selected\n for (var i=start; i<end+1; i++) {\n\n if(selectedImgs.indexOf(i)<0) {\n selectedImgs.push(i);\n $('#thumb' + i).addClass('selected');\n }\n\n selectedImgs.sort(function(a,b){return a-b});\n\n }\n\n } else {\n\n //check if the thumb that was clicked on has already been selected:\n //if the image has not been selected it wont be in the array selectedImgs and index will be -1\n var index = selectedImgs.indexOf(selectedImgNum);\n\n if(index < 0 ) {\n //image was not already selected\n selectedImgs.push(selectedImgNum); //add the number of the image to the array selectedImgs\n selectedImgs.sort(function(a,b){return a-b});\n $('#thumb' + selectedImgNum).addClass('selected'); //show a border around the thumb\n } else {\n //image was already selected\n selectedImgs.splice(index,1); //remove the number of the image from the array selectedImgs\n $('#thumb' + selectedImgNum).removeClass('selected'); //remove the border around the thumb\n }\n\n }\n\n }", "selectItemEvent(event) {\n\n var name = event.target.getAttribute('data-name')\n var boxid = event.target.getAttribute('id')\n var client = event.data.client\n var items = client.items\n var index = items.selected.indexOf(name);\n\n // If selected, we want to unselect it\n if ($(event.target).hasClass(client.selectedClass)) {\n $(event.target).removeClass(client.selectedClass);\n $(event.target).attr(\"style\", \"\");\n client.items.selected.splice(index, 1);\n\n // If unselected, we want to select it\n } else {\n $(event.target).attr(\"style\", \"background:\" + client.selectedColor);\n $(event.target).addClass(client.selectedClass);\n client.items.selected.push(name)\n }\n client.bingoCheck()\n }", "function resultsMouseDownHandler (e) {\n let target = e.target; // Type depends ..\n let className = target.className;\n//console.log(\"Result mouse down event: \"+e.type+\" button: \"+e.button+\" shift: \"+e.shiftKey+\" target: \"+target+\" class: \"+className);\n if ((className != undefined) && (className.length > 0)) {\n\t// The click target is one of .brow cell,\n\t// .rbkmkitem_x div, .rtwistieac div, favicon img or .favttext span\n\t// Find cell, for selection\n\tlet cell;\n\tif (className.includes(\"fav\") || className.startsWith(\"rtwistie\")) {\n\t cell = target.parentElement.parentElement;\n\t}\n\telse if (className.startsWith(\"rbkmkitem_\")) {\n\t cell = target.parentElement;\n\t}\n\telse if (className.includes(\"brow\")) {\n\t cell = target;\n\t}\n\n\t// Select result item if recognized\n\t// , and if not already selected=> keep bigger multi-items selection area if right click inside it \n\tif (cell != undefined) {\n\t let button = e.button;\n\t // Do nothing on selection if this is a right click inside a selection range\n\t if ((button != 2) || !cell.classList.contains(rselection.selectHighlight)) {\n//\t\tsetCellHighlight(rcursor, rlastSelOp, cell, rselection.selectIds);\n\t\tif (button == 1) { // If middle click, simple select, no multi-select\n\t\t addCellCursorSelection(cell, rcursor, rselection);\n\t\t}\n\t\telse {\n\t\t let is_ctrlKey = (isMacOS ? e.metaKey : e.ctrlKey);\n\t\t addCellCursorSelection(cell, rcursor, rselection, true, is_ctrlKey, e.shiftKey);\n\t\t}\n\t }\n\t}\n }\n}", "set_selected_items(top, left, width, height) {\n this.selection_items.forEach((selected_item, item_index) => {\n if (this.is_element_selected(selected_item.element, top, left, width, height)) {\n selected_item.element.classList.add(this.options.selected_class_name);\n this.selection_items[item_index].is_selected = true;\n } else {\n if (selected_item.is_selected) {\n selected_item.element.classList.add(this.options.selected_class_name);\n this.selection_items[item_index].is_selected = true;\n return;\n }\n }\n });\n }", "function defaultScrollHelper(e, $container, startIndex, isSelectionRetained) {\r\n\t\tif (e.type == \"mouseover\") {\r\n\t\t\t/* on mouse down and than mouse over */\r\n\t\t\tvar $childTarget = $(e.target);\r\n\t\t\tif ($container[0] != $childTarget.parent()[0]) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tdefaultScrollHelperUtils.stopTimer();\r\n\t\t\t$container.drawMultipleSelectBox(startIndex, $childTarget.getMultipleSelectBoxRowIndex($container), {\r\n\t\t\t\t\"isSelectionRetained\": isSelectionRetained,\r\n\t\t\t\t\"scrollPos\": null\r\n\t\t\t});\r\n\t\t} else if (e.type == \"mouseup\") {\r\n\t\t\t/* on mouse down and than mouse up */\r\n\t\t\tdefaultScrollHelperUtils.stopTimer();\r\n\t\t} else if (e.type == \"mouseleave\") {\r\n\t\t\t/* on mouse down and than mouse leave */\r\n\t\t} else if (e.type == \"mousemove\") {\r\n\t\t\t/* on mouse down and than mouse leave and moving */\r\n\t\t\tvar options = $container.getMultipleSelectBoxOptions();\r\n\t\t\tvar isHorizontalMode = options.isHorizontalMode;\r\n\t\t\tdefaultScrollHelperUtils.mousePos = (isHorizontalMode ? e.pageX : e.pageY);\r\n\t\t\tdefaultScrollHelperUtils.startTimer(function() {\r\n\t\t\t\tvar containerViewport = $container.getMultipleSelectBoxViewport();\r\n\t\t\t\tvar containerBackPos = containerViewport.getTopPos();\r\n\t\t\t\tvar containerFrontPos = containerViewport.getBottomPos();\r\n\t\t\t\tvar containerScrollPos = containerViewport.getScrollTop();\r\n\t\t\t\tvar containerVisibleRange = containerViewport.getHeight();\r\n\t\t\t\tif (isHorizontalMode) {\r\n\t\t\t\t\tcontainerBackPos = containerViewport.getLeftPos();\r\n\t\t\t\t\tcontainerFrontPos = containerViewport.getRightPos();\r\n\t\t\t\t\tcontainerScrollPos = containerViewport.getScrollLeft();\r\n\t\t\t\t\tcontainerVisibleRange = containerViewport.getWidth();\r\n\t\t\t\t}\r\n\t\t\t\tvar scrollToPos = containerScrollPos;\r\n\t\t\t\tvar targetPos = scrollToPos;\r\n\t\t\t\tvar scrollSpeed = options.scrollSpeed;\r\n\t\t\t\t/* mousemove event is triggered when mouse out of the box only */\r\n\t\t\t\tvar mousePos = defaultScrollHelperUtils.mousePos;\r\n\t\t\t\tif (mousePos < containerBackPos) {\r\n\t\t\t\t\tscrollToPos -= scrollSpeed;\r\n\t\t\t\t\ttargetPos = scrollToPos;\r\n\t\t\t\t} else if (mousePos > containerFrontPos) {\r\n\t\t\t\t\tscrollToPos += scrollSpeed;\r\n\t\t\t\t\ttargetPos = scrollToPos + containerVisibleRange;\r\n\t\t\t\t}\r\n\t\t\t\t/* calculate cuurentIndex */\r\n\t\t\t\t$container.drawMultipleSelectBox(startIndex, calculateScrollHelperCurrentIndex($container, targetPos), {\r\n\t\t\t\t\t\"isSelectionRetained\": isSelectionRetained,\r\n\t\t\t\t\t\"scrollPos\": scrollToPos\r\n\t\t\t\t});\r\n\t\t\t}, 100);\r\n\t\t}\r\n\t}", "function drag(e){\ndraggedItem=e.target;\ndragging=true;\n}", "onMultiSelectionComponentPress(event) {\n if (this.isInactive) {\n return;\n }\n this.fireEvent(\"_selection-requested\", {\n item: this,\n selected: event.target.checked,\n selectionComponentPressed: true\n });\n }", "function dragAction() {\n $(\".content-list\").selectable({\n selected: function(event, ui) {\n docListTools();\n },\n unselecting: function(event, ui) {\n docListTools();\n }\n });\n\n $(\".content-list\").find(\".folder\").draggable({\n revert: 'false',\n helper: function(event) {\n var $group = $(\"<div>\", {\n class: \"content-list\"\n });\n if ($(\".folder.ui-selected\").length) {\n var theClone = $(\".folder.ui-selected\").clone();\n theClone = $group.html(theClone);\n } else {\n theClone = $group.html($(this).clone());\n }\n return theClone;\n }\n });\n $(\".content-list\").find(\".data-folder\").droppable({\n tolerance: 'pointer',\n drop: function(event, ui) {\n var dragId = ui.draggable.attr(\"data-id\");\n var dragType = ui.draggable.attr(\"data-type\");\n var dropId = $(this).attr(\"data-id\");\n // relocate(dragId, dragType, dropId);\n if ($(\".folder.ui-selected\").length) {\n $(\".folder.ui-selected\").remove();\n } else {\n ui.draggable.remove();\n }\n\n $(this).removeClass(\"over-now\");\n },\n over: function(event, ui) {\n $(this).addClass(\"over-now\");\n },\n out: function(event, ui) {\n $(this).removeClass(\"over-now\");\n }\n });\n}", "function drop_allow(event) {\n u(event.target.parentElement).closest('tr').addClass(\"drop-allow\");\n}", "function clickHandler( event /*: JQueryEventObject */ ) {\n if ( $element.hasClass( pausedDragSelectClass ) ) return;\n if ( $element[0].dragData.firstX == $element[0].dragData.lastX\n && $element[0].dragData.firstY == $element[0].dragData.lastY ) {\n if ( $element.hasClass( SELECTED_FOR_DRAGGING_CLASS ) ) {\n $element.removeDragAndSizeSelection();\n } else {\n $element.addDragAndSizeSelection();\n }\n setTimeout( function () {\n var mouseMoveEvent = $.Event( 'mousemove' );\n mouseMoveEvent.pageX = event.pageX;\n mouseMoveEvent.pageY = event.pageY;\n $element.trigger( mouseMoveEvent );\n }, 0 );\n }\n }", "function clicked(element)\n{\n // Add classes to the elements\n element.className += selectedClass;\n element.firstElementChild.className += childSelectedClass;\n element.className += selectedHoverClass;\n // If prevElement exists, remove the classes\n if (prevElement)\n {\n removeSelectedClass(prevElement);\n }\n\n // Assign the previous clicked element to the newPrevElement\n prevElement = element;\n}", "function SelectionManager() {\n\tvar t = this;\n\t\n\t\n\t// exports\n\tt.select = select;\n\tt.unselect = unselect;\n\tt.reportSelection = reportSelection;\n\tt.daySelectionMousedown = daySelectionMousedown;\n\t\n\t\n\t// imports\n\tvar opt = t.opt;\n\tvar trigger = t.trigger;\n\tvar defaultSelectionEnd = t.defaultSelectionEnd;\n\tvar renderSelection = t.renderSelection;\n\tvar clearSelection = t.clearSelection;\n\t\n\t\n\t// locals\n\tvar selected = false;\n\n\n\n\t// unselectAuto\n\tif (opt('selectable') && opt('unselectAuto')) {\n\t\t$(document).mousedown(function(ev) {\n\t\t\tvar ignore = opt('unselectCancel');\n\t\t\tif (ignore) {\n\t\t\t\tif ($(ev.target).parents(ignore).length) { // could be optimized to stop after first match\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tunselect(ev);\n\t\t});\n\t}\n\t\n\n\tfunction select(startDate, endDate, allDay) {\n\t\tunselect();\n\t\tif (!endDate) {\n\t\t\tendDate = defaultSelectionEnd(startDate, allDay);\n\t\t}\n\t\trenderSelection(startDate, endDate, allDay);\n\t\treportSelection(startDate, endDate, allDay);\n\t}\n\t\n\t\n\tfunction unselect(ev) {\n\t\tif (selected) {\n\t\t\tselected = false;\n\t\t\tclearSelection();\n\t\t\ttrigger('unselect', null, ev);\n\t\t}\n\t}\n\t\n\t\n\tfunction reportSelection(startDate, endDate, allDay, ev) {\n\t\tselected = true;\n\t\ttrigger('select', null, startDate, endDate, allDay, ev);\n\t}\n\t\n\t\n\tfunction daySelectionMousedown(ev) { // not really a generic manager method, oh well\n\t\tvar cellToDate = t.cellToDate;\n\t\tvar getIsCellAllDay = t.getIsCellAllDay;\n\t\tvar hoverListener = t.getHoverListener();\n\t\tvar reportDayClick = t.reportDayClick; // this is hacky and sort of weird\n\t\tif (ev.which == 1 && opt('selectable')) { // which==1 means left mouse button\n\t\t\tunselect(ev);\n\t\t\tvar _mousedownElement = this;\n\t\t\tvar dates;\n\t\t\thoverListener.start(function(cell, origCell) { // TODO: maybe put cellToDate/getIsCellAllDay info in cell\n\t\t\t\tclearSelection();\n\t\t\t\tif (cell && getIsCellAllDay(cell)) {\n\t\t\t\t\tdates = [ cellToDate(origCell), cellToDate(cell) ].sort(dateCompare);\n\t\t\t\t\trenderSelection(dates[0], dates[1], true);\n\t\t\t\t}else{\n\t\t\t\t\tdates = null;\n\t\t\t\t}\n\t\t\t}, ev);\n\t\t\t$(document).one('mouseup', function(ev) {\n\t\t\t\thoverListener.stop();\n\t\t\t\tif (dates) {\n\t\t\t\t\tif (+dates[0] == +dates[1]) {\n\t\t\t\t\t\treportDayClick(dates[0], true, ev);\n\t\t\t\t\t}\n\t\t\t\t\treportSelection(dates[0], dates[1], true, ev);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\n}", "function SelectionManager() {\n\tvar t = this;\n\t\n\t\n\t// exports\n\tt.select = select;\n\tt.unselect = unselect;\n\tt.reportSelection = reportSelection;\n\tt.daySelectionMousedown = daySelectionMousedown;\n\t\n\t\n\t// imports\n\tvar opt = t.opt;\n\tvar trigger = t.trigger;\n\tvar defaultSelectionEnd = t.defaultSelectionEnd;\n\tvar renderSelection = t.renderSelection;\n\tvar clearSelection = t.clearSelection;\n\t\n\t\n\t// locals\n\tvar selected = false;\n\n\n\n\t// unselectAuto\n\tif (opt('selectable') && opt('unselectAuto')) {\n\t\t$(document).mousedown(function(ev) {\n\t\t\tvar ignore = opt('unselectCancel');\n\t\t\tif (ignore) {\n\t\t\t\tif ($(ev.target).parents(ignore).length) { // could be optimized to stop after first match\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tunselect(ev);\n\t\t});\n\t}\n\t\n\n\tfunction select(startDate, endDate, allDay) {\n\t\tunselect();\n\t\tif (!endDate) {\n\t\t\tendDate = defaultSelectionEnd(startDate, allDay);\n\t\t}\n\t\trenderSelection(startDate, endDate, allDay);\n\t\treportSelection(startDate, endDate, allDay);\n\t}\n\t\n\t\n\tfunction unselect(ev) {\n\t\tif (selected) {\n\t\t\tselected = false;\n\t\t\tclearSelection();\n\t\t\ttrigger('unselect', null, ev);\n\t\t}\n\t}\n\t\n\t\n\tfunction reportSelection(startDate, endDate, allDay, ev) {\n\t\tselected = true;\n\t\ttrigger('select', null, startDate, endDate, allDay, ev);\n\t}\n\t\n\t\n\tfunction daySelectionMousedown(ev) { // not really a generic manager method, oh well\n\t\tvar cellToDate = t.cellToDate;\n\t\tvar getIsCellAllDay = t.getIsCellAllDay;\n\t\tvar hoverListener = t.getHoverListener();\n\t\tvar reportDayClick = t.reportDayClick; // this is hacky and sort of weird\n\t\tif (ev.which == 1 && opt('selectable')) { // which==1 means left mouse button\n\t\t\tunselect(ev);\n\t\t\tvar _mousedownElement = this;\n\t\t\tvar dates;\n\t\t\thoverListener.start(function(cell, origCell) { // TODO: maybe put cellToDate/getIsCellAllDay info in cell\n\t\t\t\tclearSelection();\n\t\t\t\tif (cell && getIsCellAllDay(cell)) {\n\t\t\t\t\tdates = [ cellToDate(origCell), cellToDate(cell) ].sort(dateCompare);\n\t\t\t\t\trenderSelection(dates[0], dates[1], true);\n\t\t\t\t}else{\n\t\t\t\t\tdates = null;\n\t\t\t\t}\n\t\t\t}, ev);\n\t\t\t$(document).one('mouseup', function(ev) {\n\t\t\t\thoverListener.stop();\n\t\t\t\tif (dates) {\n\t\t\t\t\tif (+dates[0] == +dates[1]) {\n\t\t\t\t\t\treportDayClick(dates[0], true, ev);\n\t\t\t\t\t}\n\t\t\t\t\treportSelection(dates[0], dates[1], true, ev);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\n}", "function SelectionManager() {\n\tvar t = this;\n\t\n\t\n\t// exports\n\tt.select = select;\n\tt.unselect = unselect;\n\tt.reportSelection = reportSelection;\n\tt.daySelectionMousedown = daySelectionMousedown;\n\t\n\t\n\t// imports\n\tvar opt = t.opt;\n\tvar trigger = t.trigger;\n\tvar defaultSelectionEnd = t.defaultSelectionEnd;\n\tvar renderSelection = t.renderSelection;\n\tvar clearSelection = t.clearSelection;\n\t\n\t\n\t// locals\n\tvar selected = false;\n\n\n\n\t// unselectAuto\n\tif (opt('selectable') && opt('unselectAuto')) {\n\t\t$(document).mousedown(function(ev) {\n\t\t\tvar ignore = opt('unselectCancel');\n\t\t\tif (ignore) {\n\t\t\t\tif ($(ev.target).parents(ignore).length) { // could be optimized to stop after first match\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tunselect(ev);\n\t\t});\n\t}\n\t\n\n\tfunction select(startDate, endDate, allDay) {\n\t\tunselect();\n\t\tif (!endDate) {\n\t\t\tendDate = defaultSelectionEnd(startDate, allDay);\n\t\t}\n\t\trenderSelection(startDate, endDate, allDay);\n\t\treportSelection(startDate, endDate, allDay);\n\t}\n\t\n\t\n\tfunction unselect(ev) {\n\t\tif (selected) {\n\t\t\tselected = false;\n\t\t\tclearSelection();\n\t\t\ttrigger('unselect', null, ev);\n\t\t}\n\t}\n\t\n\t\n\tfunction reportSelection(startDate, endDate, allDay, ev) {\n\t\tselected = true;\n\t\ttrigger('select', null, startDate, endDate, allDay, ev);\n\t}\n\t\n\t\n\tfunction daySelectionMousedown(ev) { // not really a generic manager method, oh well\n\t\tvar cellToDate = t.cellToDate;\n\t\tvar getIsCellAllDay = t.getIsCellAllDay;\n\t\tvar hoverListener = t.getHoverListener();\n\t\tvar reportDayClick = t.reportDayClick; // this is hacky and sort of weird\n\t\tif (ev.which == 1 && opt('selectable')) { // which==1 means left mouse button\n\t\t\tunselect(ev);\n\t\t\tvar _mousedownElement = this;\n\t\t\tvar dates;\n\t\t\thoverListener.start(function(cell, origCell) { // TODO: maybe put cellToDate/getIsCellAllDay info in cell\n\t\t\t\tclearSelection();\n\t\t\t\tif (cell && getIsCellAllDay(cell)) {\n\t\t\t\t\tdates = [ cellToDate(origCell), cellToDate(cell) ].sort(dateCompare);\n\t\t\t\t\trenderSelection(dates[0], dates[1], true);\n\t\t\t\t}else{\n\t\t\t\t\tdates = null;\n\t\t\t\t}\n\t\t\t}, ev);\n\t\t\t$(document).one('mouseup', function(ev) {\n\t\t\t\thoverListener.stop();\n\t\t\t\tif (dates) {\n\t\t\t\t\tif (+dates[0] == +dates[1]) {\n\t\t\t\t\t\treportDayClick(dates[0], true, ev);\n\t\t\t\t\t}\n\t\t\t\t\treportSelection(dates[0], dates[1], true, ev);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\n}", "activeClick() {\n var $_this = this;\n var action = this.options.dblClick ? 'dblclick' : 'click';\n\n this.$selectableUl.on(action, '.SELECT-elem-selectable', function () {\n $_this.select($(this).data('SELECT-value'));\n });\n this.$selectionUl.on(action, '.SELECT-elem-selection', function () {\n $_this.deselect($(this).data('SELECT-value'));\n });\n\n }", "function extractEvents$3(dispatchQueue,domEventName,targetInst,nativeEvent,nativeEventTarget,eventSystemFlags,targetContainer){var targetNode=targetInst?getNodeFromInstance(targetInst):window;switch(domEventName){// Track the input node that has focus.\ncase'focusin':if(isTextInputElement(targetNode)||targetNode.contentEditable==='true'){activeElement$1=targetNode;activeElementInst$1=targetInst;lastSelection=null;}break;case'focusout':activeElement$1=null;activeElementInst$1=null;lastSelection=null;break;// Don't fire the event while the user is dragging. This matches the\n// semantics of the native select event.\ncase'mousedown':mouseDown=true;break;case'contextmenu':case'mouseup':case'dragend':mouseDown=false;constructSelectEvent(dispatchQueue,nativeEvent,nativeEventTarget);break;// Chrome and IE fire non-standard event when selection is changed (and\n// sometimes when it hasn't). IE's event fires out of order with respect\n// to key and input events on deletion, so we discard it.\n//\n// Firefox doesn't support selectionchange, so check selection status\n// after each key entry. The selection changes after keydown and before\n// keyup, but we check on keydown as well in the case of holding down a\n// key, when multiple keydown events are fired but only one keyup is.\n// This is also our approach for IE handling, for the reason above.\ncase'selectionchange':if(skipSelectionChangeEvent){break;}// falls through\ncase'keydown':case'keyup':constructSelectEvent(dispatchQueue,nativeEvent,nativeEventTarget);}}", "function extractEvents$3(dispatchQueue,domEventName,targetInst,nativeEvent,nativeEventTarget,eventSystemFlags,targetContainer){var targetNode=targetInst?getNodeFromInstance(targetInst):window;switch(domEventName){// Track the input node that has focus.\ncase'focusin':if(isTextInputElement(targetNode)||targetNode.contentEditable==='true'){activeElement$1=targetNode;activeElementInst$1=targetInst;lastSelection=null;}break;case'focusout':activeElement$1=null;activeElementInst$1=null;lastSelection=null;break;// Don't fire the event while the user is dragging. This matches the\n// semantics of the native select event.\ncase'mousedown':mouseDown=true;break;case'contextmenu':case'mouseup':case'dragend':mouseDown=false;constructSelectEvent(dispatchQueue,nativeEvent,nativeEventTarget);break;// Chrome and IE fire non-standard event when selection is changed (and\n// sometimes when it hasn't). IE's event fires out of order with respect\n// to key and input events on deletion, so we discard it.\n//\n// Firefox doesn't support selectionchange, so check selection status\n// after each key entry. The selection changes after keydown and before\n// keyup, but we check on keydown as well in the case of holding down a\n// key, when multiple keydown events are fired but only one keyup is.\n// This is also our approach for IE handling, for the reason above.\ncase'selectionchange':if(skipSelectionChangeEvent){break;}// falls through\ncase'keydown':case'keyup':constructSelectEvent(dispatchQueue,nativeEvent,nativeEventTarget);}}", "toggSelAll (c, direct) {\r\n const O = this;\r\n const cloneOriginalEvents = $.extend(true, {}, $._data(O.E.get(0), \"events\")); // clone original select elements events\r\n O.E.off(); // unbind original select elements events because we do not want the following clicks to trigger change on it\r\n\r\n if (O.is_multi) {\r\n // Select all\r\n if (c) {\r\n O.E.find('option:not(:checked):not(:disabled):not(:hidden)').toArray().forEach(option => {\r\n if (!$(option).data('li').hasClass('hidden')) {\r\n option.selected = true;\r\n $(option).data('li').toggleClass('selected', true);\r\n }\r\n });\r\n } else {\r\n // Unselect all\r\n O.E.find('option:checked:not(:disabled):not(:hidden)').toArray().forEach(option => {\r\n if (!$(option).data('li').hasClass('hidden')) {\r\n option.selected = false;\r\n $(option).data('li').toggleClass('selected', false);\r\n }\r\n });\r\n }\r\n } else {\r\n if (!c) O.E[0].selectedIndex = -1;\r\n else console.warn('You called `SelectAll` on a non-multiple select');\r\n }\r\n\r\n // rebind original select elements events\r\n $.each(cloneOriginalEvents, (_, e) => {\r\n $.each(e, (__, ev) => {\r\n O.E.on(ev.type, ev.handler);\r\n });\r\n });\r\n\r\n if((O.is_multi && !settings.okCancelInMulti) || !O.is_multi){\r\n O.callChange(); // call change on original select element\r\n O.setText();\r\n }\r\n\r\n if (!direct) {\r\n if (!O.mob && O.selAll) O.selAll.removeClass('partial').toggleClass('selected', !!c);\r\n O.setText();\r\n O.setPstate();\r\n }\r\n }", "function initializeMultipleSelectBoxTouchEvent($container) {\r\n\t\t$container.bind(\"touchstart.\" + PLUGIN_NAMESPACE, function(e) {\r\n\t\t\tvar options = $container.getMultipleSelectBoxOptions();\r\n\t\t\tvar containerViewport = $container.getMultipleSelectBoxViewport();\r\n\t\t\tvar startTouches = e.originalEvent.touches[0];\r\n\t\t\tvar startTouchPos = startTouches.pageY;\r\n\t\t\tvar startContainerScrollPos = containerViewport.getScrollTop();\r\n\t\t\tif (options.isHorizontalMode) {\r\n\t\t\t\tstartTouchPos = startTouches.pageX;\r\n\t\t\t\tstartContainerScrollPos = containerViewport.getScrollLeft();\r\n\t\t\t}\r\n\t\t\t$container.yieldMultipleSelectBox().bind(\"touchmove.\" + PLUGIN_NAMESPACE, function(e1) {\r\n\t\t\t\t/* disable touch scroll */\r\n\t\t\t\te1.preventDefault();\r\n\t\t\t\t/* calculate scroll to position */\r\n\t\t\t\tvar thisTouches = e1.originalEvent.touches[0];\r\n\t\t\t\tif (options.isHorizontalMode) {\r\n\t\t\t\t\t$container.scrollLeft(startContainerScrollPos + (thisTouches.pageX - startTouchPos));\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$container.scrollTop(startContainerScrollPos + (thisTouches.pageY - startTouchPos));\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\t}", "function SelectionUtil() {\n}", "function customizeMultiSelect(){\n /* IE doesn't support event handling on option tag, hence conveted option click event to select onchange event*/\n $('body').on('change','.customize_multiselect', function(){\n var select = $(this);\n var sel_val = $(this).val();\n var sel_opt = '';\n $(select).find(\"option\").each(function () {\n if($(this).val() == sel_val){\n sel_opt = $(this);\n return;\n }\n });\n if ($(sel_opt).attr(\"class\") == undefined || $(sel_opt).attr(\"class\").length == 0 || $(sel_opt).hasClass(\"unclicked\")){\n $(sel_opt).removeClass('unclicked');\n $(sel_opt).addClass('clicked');\n } else {\n $(sel_opt).removeClass('clicked')\n $(sel_opt).addClass('unclicked');\n $(sel_opt).removeAttr(\"selected\");\n }\n $(select).find(\"option.clicked\").attr(\"selected\",\"selected\");\n $(select).find(\"option.unclicked\").removeAttr(\"selected\");\n });\n}", "function initializeMultiCheckboxSelection() {\n // Add event listener on li element instead of directly to checkbox in order to allow shift click in firefox.\n // A click on checkboxes in firefox is not triggered, if a modifier is active (shift, alt, ctrl)\n const doesProvideMod = !(navigator.userAgent.indexOf(\"Firefox\") >= 0);\n $('#imageList>li').on('click', (doesProvideMod ? 'input[type=\"checkbox\"]' : 'label'), function(event) {\n const checkbox = doesProvideMod ? this : $(this).siblings('input[type=\"checkbox\"]')[0];\n if( !lastChecked ) {\n lastChecked = checkbox;\n return;\n }\n\n if( event.shiftKey ) {\n var checkBoxes = $('#imageList input[type=\"checkbox\"]').not('#selectFilter');\n var start = $(checkBoxes).index($(checkbox));\n var end = $(checkBoxes).index($(lastChecked));\n\n $(checkBoxes).slice(Math.min(start, end), Math.max(start, end) + 1).prop('checked', $(lastChecked).is(':checked'));\n }\n\n $(checkbox).change();\n lastChecked = checkbox;\n });\n}", "function selectable(options) {\r\n\treturn this.each(function () {\r\n\t\tvar elem = this;\r\n\t\tvar $elem = $(elem);\r\n\t\tif ($elem.hasClass(selectableClass)) return; // Already done\r\n\t\t$elem.addClass(selectableClass);\r\n\t\tvar opt = initOptions(\"selectable\", selectableDefaults, $elem, {}, options);\r\n\t\topt._prepareChild = prepareChild;\r\n\r\n\t\t$elem.children().each(prepareChild);\r\n\t\t\r\n\t\tfunction prepareChild() {\r\n\t\t\tvar child = $(this);\r\n\t\t\tchild.click(function (event) {\r\n\t\t\t\tevent.preventDefault();\r\n\t\t\t\tevent.stopPropagation();\r\n\t\t\t\tlet ctrlKey = !!event.originalEvent.ctrlKey;\r\n\t\t\t\tif (!opt.multi) ctrlKey = false;\r\n\t\t\t\tif (opt.toggle) ctrlKey = true;\r\n\t\t\t\tlet changed = false;\r\n\t\t\t\tif (ctrlKey) {\r\n\t\t\t\t\tchild.toggleClass(\"selected\");\r\n\t\t\t\t\tchanged = true;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tif (!child.hasClass(\"selected\")) {\r\n\t\t\t\t\t\t$elem.children().removeClass(\"selected\");\r\n\t\t\t\t\t\tchild.addClass(\"selected\");\r\n\t\t\t\t\t\tchanged = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (changed) {\r\n\t\t\t\t\t$elem.trigger(\"selectionchange\");\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n}" ]
[ "0.64923054", "0.64745873", "0.6313913", "0.62336046", "0.5861946", "0.5806698", "0.57896096", "0.5698621", "0.5660796", "0.56062526", "0.55689436", "0.5549231", "0.5530512", "0.55174196", "0.549765", "0.546832", "0.5462681", "0.5454696", "0.5427804", "0.5427804", "0.5427804", "0.5425037", "0.5416513", "0.5416513", "0.54002714", "0.5383086", "0.5382684", "0.5377326", "0.53691137", "0.5361874" ]
0.77628446
0
Returns an array of all the file paths currently in the virtual folder.
getAllPaths() { return Object.keys(this[FILES]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getAllFilePaths() {\n \n //holds all the file paths being tracked by storyteller\n var allFilePaths = [];\n \n //go through each file/dir mapping\n for(var filePath in pathToIdMap) {\n if(pathToIdMap.hasOwnProperty(filePath)) {\n \n //if the file exists in the allFiles collection we know it is a file\n if(allFiles[getIdFromFilePath(filePath)]) {\n allFilePaths.push(filePath); \n }\n }\n }\n \n return allFilePaths;\n}", "getFilePaths(dirPath){\n return new Promise( (resolve, reject) => {\n this.fspath.paths(dirPath, function(err, paths) {\n if (err) reject(err);\n resolve(paths);\n })\n })\n }", "function getPaths() {\n try {\n return require.cache ? Object.keys(require.cache) : [];\n }\n catch (e) {\n return [];\n }\n}", "function pathNames() {\n return getPathNames(urlBase.pathname);\n }", "getLocalResourceRoots() {\n const localResourceRoots = [];\n const workspaceFolder = vscode_1.workspace.getWorkspaceFolder(this.uri);\n if (workspaceFolder) {\n localResourceRoots.push(workspaceFolder.uri);\n }\n else if (!this.uri.scheme || this.uri.scheme === 'file') {\n localResourceRoots.push(vscode_1.Uri.file(path.dirname(this.uri.fsPath)));\n }\n // add vega preview js scripts\n localResourceRoots.push(vscode_1.Uri.file(path.join(this._extensionPath, 'scripts')));\n this._logger.logMessage(logger_1.LogLevel.Debug, 'getLocalResourceRoots():', localResourceRoots);\n return localResourceRoots;\n }", "getFiles() {\n const {\n files\n } = this.getState();\n return Object.values(files);\n }", "function getCurrentFilenames(dirPath) { \n let files = []\n // console.log(`Current files in: ${dirPath}`); \n fs.readdirSync(dirPath).forEach(file => { \n // console.log(\" \" + file);\n files.push(file)\n });\n return files\n}", "getAllFiles() {\n return this.cache.getOrAdd('getAllFiles', () => {\n let result = [];\n let dependencies = this.dependencyGraph.getAllDependencies(this.dependencyGraphKey);\n for (let dependency of dependencies) {\n //load components by their name\n if (dependency.startsWith('component:')) {\n let comp = this.program.getComponent(dependency.replace(/$component:/, ''));\n if (comp) {\n result.push(comp.file);\n }\n }\n else {\n let file = this.program.getFile(dependency);\n if (file) {\n result.push(file);\n }\n }\n }\n this.logDebug('getAllFiles', () => result.map(x => x.pkgPath));\n return result;\n });\n }", "getOwnFiles() {\n //source scope only inherits files from global, so just return all files. This function mostly exists to assist XmlScope\n return this.getAllFiles();\n }", "getFiles() {\n if (this._files) {\n return this._files;\n }\n this._files = glob.sync(`${this._changesPath}/**/*.json`);\n return this._files || [];\n }", "listFileNames(path) {\n return fs_1.readdirSync(path) || [];\n }", "function listFiles()\r\n{\r\n\tvar f = fso.GetFolder(curdir);\r\n\r\n\tfor(var fc = new Enumerator(f.Files);!fc.atEnd();fc.moveNext()){\r\n\t\t//\tIs this a good idea? making all file Paths relative to the FusionEngine directory?\r\n\t\tstats( relativeFilename(fc.item().Path) );\t\t\r\n\t}\r\n}", "function readFilePaths(files) {\n const locations = [];\n for (let i = 0; i < files.length; i++) {\n const file = files[i];\n const location = path.join(__dirname, \"../../../\", file);\n locations.push(location);\n }\n return locations;\n }", "function getRouteFilePaths(){\n return new Promise(\n (resolve, reject)=>{\n const controllerPath = path.join(__dirname, '..', 'controller')\n dir.files(controllerPath, (err, filePathArray)=>{\n if(err){\n return reject(err)\n }\n //console.log(filePathArray)\n resolve(filePathArray)\n });\n });\n}", "function pathNames() {\n return getPathNames(urlBase.pathname);\n }", "function extractVueFiles(folderPath) {\n let results = [];\n fs.readdirSync(folderPath).forEach((pathName) => {\n const computedPath = path.join(folderPath, pathName);\n const stat = fs.statSync(computedPath);\n if (stat && stat.isDirectory()) {\n results = results.concat(extractVueFiles(computedPath));\n } else if (path.extname(computedPath).toLowerCase() === '.vue') {\n results.push(computedPath);\n }\n });\n return results;\n}", "function files() {\n _throwIfNotInitialized();\n return props.files;\n}", "uris() {\n return this.files.keys();\n }", "files() {\n return [];\n }", "getFiles() {\n let files = this.state.cursor().get( 'files' )\n return files\n ? files.toList()\n : null\n }", "async getAllFilesOfLocalDirectoryRecursively(path){\n try{\n const items = await fs.promises.readdir(path).then(async data => {\n let files = [];\n for(let item of data){\n const isItemDir = await fs.promises.stat(`${path}/${item}`).then(stats => {return stats.isDirectory()}).catch(error => {return false;});\n if(isItemDir){\n const filesOfCurrentDir = await this.getAllFilesOfLocalDirectoryRecursively(`${path}/${item}`);\n files = [...files, ...filesOfCurrentDir];\n }else{\n files.push(`${path}/${item}`);\n }\n }\n\n return files;\n }).catch(error => {\n return [];\n });\n\n return items;\n }catch(error){ Logger.log(error); }\n\n return [];\n }", "async getDependentPaths() {\n return [];\n }", "function getAllDirPaths() {\n\t\t\n //holds all the dir paths being tracked by storyteller\n var allDirPaths = [];\n \n //go through each file/dir mapping\n for(var dirPath in pathToIdMap) {\n if(pathToIdMap.hasOwnProperty(dirPath)) {\n \n //if the dir exists in the allDirs collection we know it is a dir\n if(allDirs[getIdFromDirPath(dirPath)]) {\n allDirPaths.push(dirPath); \n }\n }\n }\n \n return allDirPaths;\n}", "function getArrSelectedFiles(){\r\n\t\t\r\n\t\tvar arrFiles = [];\r\n\t\tvar arrItems = getArrSelectedItems();\r\n\t\t\r\n\t\tjQuery.each(arrItems, function(index, item){\r\n\t\t\tarrFiles.push(item.file);\r\n\t\t});\r\n\t\t\r\n\t\treturn(arrFiles);\r\n\t}", "getFiles() { throw new Error('Should be overridden in subclass.') }", "function readFiles() {\n return fs.readdirAsync(pathPrevDir);\n}", "async function listFiles ({\n dir,\n gitdir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(dir, '.git'),\n fs: _fs\n}) {\n const fs = new FileSystem(_fs);\n let filenames;\n await GitIndexManager.acquire(\n { fs, filepath: `${gitdir}/index` },\n async function (index) {\n filenames = index.entries.map(x => x.path);\n }\n );\n return filenames\n}", "getFileNames() {\n return this._fileNames;\n }", "configFiles() {\n return this.storeId ? this.getConfigFiles(this.storeId) : [];\n }", "_listing(path) {\n\t\tconst statResult = new Promise((resolve, reject) => {\n\t\t\tfs.readdir(path, (error, fileList) => {\n\t\t\t\tresolve(fileList);\n\t\t\t\treject(error);\n\t\t\t});\n\t\t});\n\t\treturn statResult;\n\t}" ]
[ "0.66810745", "0.62842715", "0.61882734", "0.6179658", "0.6170243", "0.61617494", "0.6159305", "0.6144904", "0.61183137", "0.61148167", "0.6114717", "0.6114136", "0.611184", "0.6051959", "0.6038199", "0.60099494", "0.59697807", "0.595084", "0.5949616", "0.59400827", "0.5939316", "0.593854", "0.5932895", "0.59132886", "0.5905", "0.586446", "0.5829084", "0.5783972", "0.5771515", "0.5764975" ]
0.6898038
0
This is the key function or entry point to render a view route, model, callback
function viewRender(route, model, callback){ console.log("viewRender: %s", JSON.stringify(route)); var template = getTemplate(route); loadController(route.controller, function(){ var ret = model; if(!ret){ var handler = controllers[route.controller][route.action] || controllers[route.controller]["_defaultAction"] || defaultOptions.actionHandler; var args = getParamNames(handler); var vals = []; for(var i=0; i<args.length; i++){ var val = route.params[args[i]]; vals.push(val) } ret = handler.apply($.jf,vals); } processAction(ret,template,route,callback); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "view() {\n // console.log('Render called');\n return this._view.renderView();\n }", "render(){}", "render(){}", "function render() {\n var currentAction = $route.current.action || 'list';\n \n switch(currentAction) {\n case 'add': {\n publicMethods.create();\n } break;\n case 'view': {\n publicMethods.view($routeParams.entityId);\n } break\n default: {\n publicMethods.list();\n } break;\n }\n }", "_render() {}", "render() {}", "render() {}", "render() {}", "view(viewName, data = {}) {\r\n if (!this.baseView) {\r\n throw new Error('Please set the base view path first');\r\n }\r\n\r\n return render(this.baseView + '/' + viewName, data, this);\r\n }", "render(){\r\n\r\n\t}", "render() {\n\n\t}", "render() {\n\n\t}", "function render() {\n\n\t\t\t}", "render() {\n\n }", "async show({ params, request, response, view }) {}", "render(){if(this.renderer){this.renderer.call(this.owner,this.content,this.owner,this.model)}}", "function render() {\n\t\t\t}", "requestView(){\t\t\n\t\tthis.trigger('requestView');\n\t}", "_render(model) {\n\t\tthis._coordinator.newEvent({\n\t\t\tsource: this.constructor.name,\n\t\t\ttype: 'render',\n\t\t\tdata: {\n\t\t\t\toriginX: this._originX,\n\t\t\t\toriginY: this._originY,\n\t\t\t\twidth: this._width,\n\t\t\t\theight: this._height\n\t\t\t}\n\t\t});\n\t}", "render() {\n }", "render() {\n\n }", "render() {\n\n }", "render() {\n\n }", "function View(){}", "function render() {\n\t\t\n\t}", "function render() {\n\t}", "render() { }", "async show({ params, request, response, view }) {\n }", "function View() {\n }", "render() {\n }" ]
[ "0.7086873", "0.70798975", "0.70798975", "0.68738425", "0.66272753", "0.6625312", "0.6625312", "0.6625312", "0.6560287", "0.6489538", "0.64632446", "0.64632446", "0.6427854", "0.64211416", "0.6405989", "0.63958013", "0.63621193", "0.63380516", "0.63336235", "0.6321515", "0.63115925", "0.63115925", "0.63115925", "0.6294384", "0.6288462", "0.628591", "0.62814844", "0.62619996", "0.62235796", "0.6168959" ]
0.77995634
0
get argument names of a callback function.
function getParamNames(func) { var fnStr = func.toString().replace(STRIP_COMMENTS, '') var result = fnStr.slice(fnStr.indexOf('(')+1, fnStr.indexOf(')')).match(ARGUMENT_NAMES) if(result === null) result = [] return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function argumentNames(fn) {\n\t var names = fn.toString().match(/^[\\s\\(]*function[^(]*\\(([^)]*)\\)/)[1]\n\t .replace(/\\/\\/.*?[\\r\\n]|\\/\\*(?:.|[\\r\\n])*?\\*\\//g, '')\n\t .replace(/\\s+/g, '').split(',');\n\t return names.length == 1 && !names[0] ? [] : names;\n\t}", "function argumentNames(f) {\n var paramsString = /^function\\s*.*?\\((.*?)\\)/.exec(f.toString())[1];\n var argumentNames = !!paramsString ? paramsString.split(/\\s*,\\s*/) : [];\n return Iterable_1.list(argumentNames);\n}", "function _getParamNames(func) {\n var funStr = func.toString();\n return funStr.slice(funStr.indexOf('(')+1, funStr.indexOf(')')).match(/([^\\s,]+)/g);\n}", "function getArgumentNames(method) {\n var names = method.toString().match(/^[\\s\\(]*function[^(]*\\(([^)]*)\\)/)[1]\n .replace(/\\/\\/.*?[\\r\\n]|\\/\\*(?:.|[\\r\\n])*?\\*\\//g, '')\n .replace(/\\s+/g, '').split(',');\n return names.length == 1 && !names[0] ? [] : names;\n }", "function getParamNames(func) {\n const fnStr = func.toString().replace(STRIP_COMMENTS, '');\n let result = fnStr\n .slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')'))\n .split(',')\n .map(content => {\n return content.trim().replace(/\\s?=.*$/, '');\n });\n if (result.length === 1 && result[0] === '') {\n result = [];\n }\n return result;\n}", "function getArgAndCb(arg, callback, def) {\n\t return typeof arg === 'function' ? [def, arg] : [arg, callback];\n\t}", "function getRuleArgNames(rule) {\n var args = [language.silence];\n\n if (rule.hasBoolParams) {\n args.push(language.boolParams);\n }\n\n for (let name in rule.passedParams) {\n let type = rule.passedParams[name].type;\n if (type === undefined || type === 'boolean') {\n continue;\n } else if (type === 'reference') {\n args.push(language.refParamArgDeclarator(name));\n } else {\n args.push(language.paramArgName(name));\n }\n }\n return args;\n }", "function guess_callback(argsi, array) {\n var callback = argsi[0], args = slice.call(argsi, 1), scope = array, attr;\n\n if (typeof(callback) === 'string') {\n attr = callback;\n if (array.length !== 0 && typeof(array[0][attr]) === 'function') {\n callback = function(object) { return object[attr].apply(object, args); };\n } else {\n callback = function(object) { return object[attr]; };\n }\n } else {\n scope = args[0];\n }\n\n return [callback, scope];\n}", "static performCallbacks(callbacks) {\n // This is my method of getting all the arguments except for the list of callbacks\n const args = Array.prototype.slice.call(arguments, 1);\n callbacks.forEach((callback) => {\n // To use the arguments I have to use the apply method of the function\n callback(...args);\n });\n }", "function getCallbackFromArgs( argumentList ) {\n var callbackObject = [];\n\n if ( argumentList && argumentList.length ) {\n for ( var i in argumentList ) {\n switch( typeof argumentList[i] ) {\n case \"function\":\n throw new Error()\n case \"object\": \n case \"number\":\n case \"array\":\n default:\n // this does not check for other functions within objects...\n callbackObject.push(JSON.parse(JSON.stringify(argumentList[i])));\n break;\n }\n }\n \n }\n return callbackObject;\n }", "function nums(){\n\tconst bindArgs = Array.from(arguments).slice(1);\n\tconst callArgs = Array.from(arguments);\n\tconsole.log(`bindArgs: ${bindArgs}`);\n\tconsole.log(`callArgs: ${callArgs}`);\n}", "function myfunctionarg(a,b){\r\n return arguments.length;\r\n}", "function inspectArgs() {\n for (let i = 0; i < arguments.length; i++) {\n console.log(arguments[i]);\n }\n}", "function get_arg() { return arguments; }", "function getCallBackParams(d, elem, prop) {\n var cbParams = { datum: d\n , elem: elem\n , prop: prop // NB - untyped assignment - only use in mkCallback fns\n , timestamp: d3.event.timeStamp\n , meta: d3.event.metaKey\n , shift: d3.event.shiftKey\n , ctrl: d3.event.ctrlKey\n , alt: d3.event.altKey };\n return cbParams;\n}", "parameterNames() {\n\t\tconst params = [];\n\t\tif (this.parameterMetadata) {\n\t\t\tfor (const param of this.parameterMetadata.paramDefs) {\n\t\t\t\tparams.push(param.name);\n\t\t\t}\n\t\t}\n\t\treturn params;\n\t}", "function g() {\n return g.arguments;\n}", "function getArgs() {\n var result = [];\n var i;\n for (i = 0; i < args.length; i++) result.push(args[i]);\n return result;\n }", "function getParams(func) {\n // String representaation of the function code\n var str = func.toString();\n\n // Remove comments of the form /* ... */\n // Removing comments of the form //\n // Remove body of the function { ... }\n // removing '=>' if func is arrow function\n str = str\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\")\n .replace(/\\/\\/(.)*/g, \"\")\n .replace(/{[\\s\\S]*}/, \"\")\n .replace(/=>/g, \"\")\n .trim();\n\n // Start parameter names after first '('\n var start = str.indexOf(\"(\") + 1;\n\n // End parameter names is just before last ')'\n var end = str.length - 1;\n\n var result = str.substring(start, end).split(\", \");\n\n var params = [];\n\n result.forEach((element) => {\n // Removing any default value\n element = element.replace(/=[\\s\\S]*/g, \"\").trim();\n\n if (element.length > 0) params.push(element);\n });\n\n return params;\n}", "function myCallback(callbackName) {\n console.log(\"this is my name \" + callbackName);\n}", "function myFunction(){\n console.log(arguments);\n}", "public function keys()\n {\n return array_keys($this->parameters);\n }", "function howManyArgs() {\n console.log(arguments[0]);\n console.log(arguments.length);\n}", "function myFunc() {\n console.log(arguments)\n }", "function myFunction(a, b) {\n console.log(arguments);\n}", "function argList(s) {\n return s.match(/^\\w+\\((.*)\\)$/)[1].match(/(\\w+)/g);\n}", "getArgs(ctx) {\n const args = [ctx.bufArg(), ctx.offArg()];\n if (this.ref.signature === 'value') {\n args.push(ctx.matchVar());\n }\n return args;\n }", "function countArguments(func) {\n console.log(func.length);\n}", "listGlobalFuncNames() {\n const stack = this.lib.getOrAllocCallStack();\n const outSizeOffset = stack.allocPtrArray(2);\n const outSizePtr = stack.ptrFromOffset(outSizeOffset);\n const outArrayPtr = stack.ptrFromOffset(outSizeOffset + this.lib.sizeofPtr());\n this.lib.checkCall(this.exports.TVMFuncListGlobalNames(outSizePtr, outArrayPtr));\n const size = this.memory.loadI32(outSizePtr);\n const array = this.memory.loadPointer(outArrayPtr);\n const names = [];\n for (let i = 0; i < size; ++i) {\n names.push(this.memory.loadCString(this.memory.loadPointer(array + this.lib.sizeofPtr() * i)));\n }\n this.lib.recycleCallStack(stack);\n return names;\n }", "getParams(func) {\n var fnStr = func.toString().replace(/((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg, '');\n return fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(/([^\\s,]+)/g) || [];\n }" ]
[ "0.75850946", "0.6928508", "0.6827934", "0.6582613", "0.63940877", "0.6366113", "0.6350676", "0.60110426", "0.59533465", "0.58827436", "0.5869651", "0.58469486", "0.58403456", "0.58285767", "0.5812033", "0.57768273", "0.57695436", "0.5761976", "0.5671639", "0.5669627", "0.5653774", "0.56350845", "0.563388", "0.56291133", "0.55998397", "0.55971926", "0.5569691", "0.55590624", "0.55565774", "0.55507284" ]
0.6949597
1
return route object base on current url it should answer what is the controller, and the view. format for the hash controller/action?param1=value1&param2=value2
function getRoute(hash){ var hash = hash || window.location.hash.substring(1); if(!hash) { console.log("hash is not defined use defaultRoute: %s", JSON.stringify(defaultRoute)); return defaultRoute; } var i = hash.indexOf("?"); var path = paramStr = ""; var route = $.extend({},defaultRoute); if(i!=-1){ path = hash.substr(0,i); paramStr = hash.substr(i+1); }else{ path = hash; } var pathArr = path.split('/'); console.log("path: %s", path); if(pathArr.length==1){ route.controller = currentControllerName; route.action = pathArr[0] || route.action; }else{ route.controller = pathArr[0] || route.controller; route.action = pathArr[1] || route.action; } route.params = getParams(paramStr); console.log("route: %s", JSON.stringify(route)); return route; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRouteHelper(obj){\r\n var tmpRoute;\r\n if(typeof(obj)==\"string\"){\r\n tmpRoute = {action: obj, controller: currentControllerName};\r\n }\r\n else{\r\n tmpRoute = obj;\r\n }\r\n tmpRoute.getParams = $.extend({},tmpRoute.params);\r\n return $.extend({}, defaultRoute, tmpRoute);\r\n }", "function currentRoute() {\n const path = $window.location.pathname;\n const pathSegments = path.slice(1).split('/');\n const params = queryString.parse($window.location.search);\n\n let route;\n switch (pathSegments[0]) {\n case 'a':\n route = 'annotation';\n params.id = pathSegments[1] || '';\n break;\n case 'stream':\n route = 'stream';\n break;\n default:\n route = 'sidebar';\n break;\n }\n\n return { route, params };\n }", "function getRoute() {\n\t\treturn hasher.getHash();\n\t}", "getRouteFromHash() {\n\t const prefixLength = exports.ROUTE_PREFIX.length;\n\t const hash = window.location.hash;\n\t // Do not try to parse route if prefix doesn't match.\n\t if (hash.substring(0, prefixLength) !== exports.ROUTE_PREFIX)\n\t return '';\n\t return hash.split('?')[0].substring(prefixLength);\n\t }", "getCurrentRoute () {\n return location.href.split('#')[1];\n }", "function route() {\n\t\tvar o = status(); //get current hash object.\n\t\tif (o) {\n\t\t\t_callControllerFromObj(o.id, o.params);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "function route() {\n this.method = this.req.method.toLowerCase();\n var n = w.map[this.method];\n if (!n) {\n this.reply4xx(404, \"no route for method: \"+this.req.method);\n this.end();\n return\n } else {\n this.url = w.dep.url.parse(this.req.url, true);\n this.query = this.url.query || {};\n this.context = {};\n for (var e in this.query) { this.context[e] = this.query[e] }\n this.context._work = this;\n this.context._js = [];\n this.context._css = [];\n \n var p = this.url.pathname.split('/');\n console.log(this.req.url, \"route to ===============> \" + this.req.method.toUpperCase(), p);\n \n for (var i = 1; i < p.length; ++i) {\n var segment = p[i];\n if (n.branches[segment]) { n = n.branches[segment]; continue };\n if (n.branches[':']) { //varname\n this.context[n.varname] = segment;\n console.log(\"//varname: \" + n.varname + \" = \" + this.context[n.varname]);\n n = n.branches[':'];\n continue\n };\n if (n.branches['*']) { //wildcard\n this.context['_location'] = p.slice(i).join('/');\n console.log(\"//wildcard: \" + this.context['_location']);\n n = n.branches['*'];\n break\n };\n this.reply4xx(404, \"no route to: \"+this.req.method+' '+this.req.url);\n this.end();\n return\n };\n };\n \n if (n.handler) {\n this.mapnode = n;\n n.handler.call(this);\n this.end();\n return\n }\n\n this.reply5xx(500, \"no handler found for: \"+this.req.method+' '+this.req.url);\n this.end();\n return\n}", "function getRouteParams(route,params){var routeParams={};if(!route.path)return routeParams;var paramNames=(0,_PatternUtils.getParamNames)(route.path);for(var p in params){if(Object.prototype.hasOwnProperty.call(params,p)&&paramNames.indexOf(p)!==-1){routeParams[p]=params[p];}}return routeParams;}", "function getRouteParams(route,params){var routeParams={};if(!route.path)return routeParams;var paramNames=(0,_PatternUtils.getParamNames)(route.path);for(var p in params){if(Object.prototype.hasOwnProperty.call(params,p)&&paramNames.indexOf(p)!==-1){routeParams[p]=params[p];}}return routeParams;}", "function getRouteParams(route,params){var routeParams={};if(!route.path)return routeParams;var paramNames=(0,_PatternUtils.getParamNames)(route.path);for(var p in params){if(Object.prototype.hasOwnProperty.call(params,p)&&paramNames.indexOf(p)!==-1){routeParams[p]=params[p];}}return routeParams;}", "match(route) {\n //match route against dictionary of defined paths to their relevant attributes\n for (let [path, {pathRoute, handler, params}] of this.routes) {\n const match = pathRoute.exec(route);\n //each route will be associated with a handler\n //this handler will handle all of the rendering associated with a new change\n if (match !== null) {\n //remove the first / from the route\n //loop through values and add each value with its associated parameter\n const routeParams = match.slice(1).\n reduce((allParams, value, index) => {\n allParams[params[index]] = value;\n return allParams;\n }, {});\n //split parameters using the ?varName=varVal \n this.currentPath = path;\n //check if we have any query parameters to parse\n if (window.location.search) {\n this.getQueryParameters(window.location.search, routeParams);\n }\n handler(route, routeParams);\n //we don't want to execute more than route once we've matched one\n //if it can match multiple ones so we break\n break;\n }\n\n }\n }", "function getFormRoute(form){\r\n var hash = getHashFromUrl(form.action);\r\n console.log(\"getFormRoute | hash: %s\", hash);\r\n var route = getRoute(hash);\r\n var params = {};\r\n for(var i=0;i<form.elements.length;i++){\r\n var e = form.elements[i];\r\n var key = e.name;\r\n var type = e.type.toLowerCase();\r\n if(!key || ((type==\"radio\" || type==\"checkbox\") && !e.checked)) continue;\r\n var value = e.value;\r\n updateParamItem(params,key,value,false);\r\n }\r\n console.log(\"params: %s\", JSON.stringify(params));\r\n $.extend(route.params,params);\r\n if(form.method.toLowerCase() == \"get\"){\r\n $.extend(route.getParams,params);\r\n }\r\n else{\r\n // create post params\r\n route.postParams = params;\r\n }\r\n console.log(\"updated route: %s\", JSON.stringify(route));\r\n return route;\r\n }", "parseParams(location){\n let route = this; \n var keys=[],params={};\n var tokens = this.getMatch(location.pathname);\n if (tokens && tokens.keys.length!=0){\n var i = 1;\n var keys = tokens.keys;\n keys.forEach((e) => params[e.name] = tokens.token[i++] );\n }\n this.params = params;\n return params;\n }", "match(route) {\n //match route against dictionary of defined paths to their relevant attributes\n for (let [path, {pathRoute, handler, params}] of this.routes) {\n const match = pathRoute.exec(route);\n //each route will be associated with a handler\n //this handler will handle all of the rendering associated with a new change\n if (match !== null) {\n //remove the first / from the route\n //loop through values and add each value with its associated parameter\n const routeParams = match.slice(1).\n reduce((allParams, value, index) => {\n allParams[params[index]] = value;\n return allParams;\n }, {});\n this.currentPath = path;\n //check if we have any query parameters to parse\n if (window.location.search) {\n this.getQueryParameters(window.location.search, routeParams);\n }\n handler(route, routeParams);\n //we don't want to execute more than route once we've matched one\n //if it can match multiple ones so we break\n break;\n }\n\n }\n }", "getSubRoute(){\n var app = \"\"\n var doc = \"\"\n var url = window.location.href.split(\"#\")\n if (url.length > 1) {\n var parts = url[1].split(\"/\")\n app = parts[1]\n doc = parts[2]\n }\n return [app,doc]\n }", "function dispatch () {\n\t\teach(routes, function (route, uri) {\n\t\t\tvar callback = route[0];\n\t\t\tvar pattern = route[1];\n\t\t\tvar params = route[2];\n\t\t\tvar match = location.match(pattern);\n\n\t\t\t// we have a match\n\t\t\tif (match != null) {\n\t\t\t\t// create params object to pass to callback\n\t\t\t\t// i.e {user: 'simple', id: '1234'}\n\t\t\t\tvar data = match.slice(1, match.length);\n\n\t\t\t\tvar args = data.reduce(function (previousValue, currentValue, index) {\n\t\t\t\t\t\t// if this is the first value, create variables store\n\t\t\t\t\t\tif (previousValue == null) {\n\t\t\t\t\t\t\tpreviousValue = {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// name: value\n\t\t\t\t\t\t// i.e user: 'simple'\n\t\t\t\t\t\t// `vars` contains the keys for the variables\n\t\t\t\t\t\tpreviousValue[params[index]] = currentValue;\n\n\t\t\t\t\t\treturn previousValue;\n\n\t\t\t\t\t\t// null --> first value\n\t\t\t\t\t}, null); \n\n\t\t\t\tcallback(args, uri);\n\t\t\t}\n\t\t});\n\t}", "navigateToCurrentHash() {\n\t const hashRoute = this.getRouteFromHash();\n\t const newRoute = hashRoute in this.routes ? hashRoute : this.defaultRoute;\n\t this.dispatch(actions.Actions.navigate({ route: newRoute }));\n\t // TODO(dproy): Handle case when new route has a permalink.\n\t }", "function doRoute(req, context) {\n var uri = url_parse(req.url);\n var path = uri.pathname;\n for (var routeName in routes) {\n var route = routes[routeName];\n if (req.method === route.method) {\n var match = path.match(route.pattern);\n if (match && match[0].length > 0) {\n // TODO named properties params in response como query string\n context.response.matches = match;\n return route;\n }\n }\n }\n \n return false;\n }", "function dispatch() {\n var query,\n path,\n arg,\n finalRoute = 0,\n finalMatchLength = -1,\n finalRegStr = \"\",\n finalFirstCaptureGroupIndex = -1,\n finalCallback = 0,\n finalRouteName = \"\",\n pathUri = new S.Uri(getFragment()),\n finalParam = 0;\n\n path = pathUri.clone();\n path.query.reset();\n path = path.toString();\n\n // user input : /xx/yy/zz\n each(allRoutes, function (route) {\n var routeRegs = route[ROUTER_MAP],\n // match exactly\n exactlyMatch = 0;\n each(routeRegs, function (desc) {\n var reg = desc.reg,\n regStr = desc.regStr,\n paramNames = desc.paramNames,\n firstCaptureGroupIndex = -1,\n m,\n name = desc.name,\n callback = desc.callback;\n if (m = path.match(reg)) {\n // match all result item shift out\n m.shift();\n\n function genParam() {\n if (paramNames) {\n var params = {};\n each(m, function (sm, i) {\n params[paramNames[i]] = sm;\n });\n return params;\n } else {\n // if user gave directly reg\n // then call callback with match result array\n return [].concat(m);\n }\n }\n\n function upToFinal() {\n finalRegStr = regStr;\n finalFirstCaptureGroupIndex = firstCaptureGroupIndex;\n finalCallback = callback;\n finalParam = genParam();\n finalRoute = route;\n finalRouteName = name;\n finalMatchLength = m.length;\n }\n\n // route: /xx/yy/zz\n if (!m.length) {\n upToFinal();\n exactlyMatch = 1;\n return false;\n }\n else if (regStr) {\n\n firstCaptureGroupIndex = findFirstCaptureGroupIndex(regStr);\n\n // final route : /*\n // now route : /xx/*\n if (firstCaptureGroupIndex > finalFirstCaptureGroupIndex) {\n upToFinal();\n }\n\n else if (\n firstCaptureGroupIndex == finalFirstCaptureGroupIndex &&\n finalMatchLength >= m.length\n ) {\n // final route : /xx/:id/:id\n // now route : /xx/:id/zz\n if (m.length < finalMatchLength) {\n upToFinal()\n } else if (regStr.length > finalRegStr.length) {\n upToFinal();\n }\n }\n\n // first route has priority\n else if (!finalRoute) {\n upToFinal();\n }\n }\n // if exists user-given reg router rule then update value directly\n // first route has priority\n // 用户设置的正则表达式具备高优先级\n else {\n upToFinal();\n exactlyMatch = 1;\n return false;\n }\n }\n }\n );\n\n if (exactlyMatch) {\n return false;\n }\n });\n\n\n if (finalParam) {\n query = pathUri.query.get();\n finalCallback.apply(finalRoute, [finalParam, query, {\n path: path,\n url: location.href\n }]);\n arg = {\n name: finalRouteName,\n \"paths\": finalParam,\n path: path,\n url: location.href,\n query: query\n };\n finalRoute.fire('route:' + finalRouteName, arg);\n finalRoute.fire('route', arg);\n }\n }", "function getActiveRoutes(params) {\n var activeRoutes = {},\n availableRoutes =\n { 'index': 'GET /'\n , 'create': 'POST /'\n , 'new': 'GET /new'\n , 'edit': 'GET /:id/edit'\n , 'destroy': 'DELETE /:id'\n , 'update': 'PUT /:id'\n , 'show': 'GET /:id'\n },\n availableRoutesSingleton = \n { 'show': 'GET /'\n , 'create': 'POST /'\n , 'new': 'GET /new'\n , 'edit': 'GET /edit'\n , 'destroy': 'DELETE /'\n , 'update': 'PUT /'\n };\n\n if (params.singleton) {\n availableRoutes = availableRoutesSingleton;\n }\n\n var action;\n // 1. only\n if (params.only) {\n if (typeof params.only == 'string') {\n params.only = [params.only];\n }\n for (action in availableRoutes) {\n if (params.only.indexOf(action) !== -1) {\n activeRoutes[action] = availableRoutes[action];\n }\n }\n }\n // 2. except\n else if (params.except) {\n if (typeof params.except == 'string') {\n params.except = [params.except];\n }\n for (action in availableRoutes) {\n if (params.except.indexOf(action) == -1) {\n activeRoutes[action] = availableRoutes[action];\n }\n }\n }\n // 3. all\n else {\n for (action in availableRoutes) {\n activeRoutes[action] = availableRoutes[action];\n }\n }\n return activeRoutes;\n }", "_handleRoute(e) {\n this.log.logApi('_handleRoute', e);\n var _hash = location.hash.replace(/^#\\/|\\/$/gi, '/');\n var parser = document.createElement('a');\n parser.href = _hash;\n var _routeObj = null;\n var res = {};\n var req = {\n hostname: parser.hostname,\n host: parser.host,\n port: parser.port,\n protocol: parser.protocol,\n pathname: parser.pathname,\n hash: parser.hash,\n url: parser.href,\n query: parser.search,\n params: {}, //needs to be routes named params keys and value the values\n data: {} //Needs to be any other data sent along\n };\n\n req.query = this._getUrlQuery(parser.href);\n\n //Loop each regex route and match against hash, if match, invoke route handler function.\n for (var i = 0; i < this.routesRegex.length; i++) {\n _routeObj = this.routesRegex[i];\n\n //Test if route matches registered route\n if (_routeObj.regexp.test(_hash)) {\n _routeObj.current = _hash;\n\n _routeObj = this._setRouteParams(_routeObj);\n\n //setup request params / and data\n req.params = _routeObj.params;\n\n //Log\n this.log.logApi(_hash, _routeObj);\n /*\n PubSub.emit('route:success', {\n _routeObj, req, res\n });\n PubSub.emit('route:change', {\n _routeObj, req, res\n });\n */\n //Execute route handler\n this.execute(_routeObj.success, [req, res], _hash);\n } else {\n\n this.execute(_routeObj.error, [req, res], _hash);\n }\n }\n }", "parseParametedRoute(url) {\n var nBread = url.split('/');\n var matched = {};\n for (var i = 0; i < this.routes.length; i++) {\n var route = this.routes[i];\n var routePath = route.path;\n var rBread = routePath.split('/');\n if (rBread.length !== nBread.length)\n continue;\n var routeParams = {};\n matched[`${route.path}`] = true;\n for (var j = 0; j < rBread.length; j++) {\n var el = rBread[j];\n if (nBread[j] === '' && j !== 0) {\n matched[`${route.path}`] = false;\n continue;\n }\n if (el === nBread[j])\n continue;\n else {\n if (el[0] === ':') {\n routeParams[el.replace(':', '')] = nBread[j];\n continue;\n }\n else {\n matched[`${route.path}`] = false;\n }\n }\n }\n }\n let keys = Object.keys(matched).filter((key) => matched[key] === true);\n if (!keys.length)\n throw Error(\"Couldn't find matching path\");\n else {\n let idx = this.routes.findIndex((r) => r.path === keys[0]);\n this.currentRoute['params'] = routeParams;\n return idx;\n }\n }", "get(url) {\n url = url.trimAll(\"/\");\n // Fast Access Controller (full match)\n let fast_acs_controller = this.router[url];\n if (fast_acs_controller != null)\n return this.app.createComponent(fast_acs_controller, Object.assign({}, this.app.config, {\"request\": {}}));\n\n // Searching for best option:\n var best_controller = null;\n var best_controller_request = {};\n var best_controller_placeholders = 1000;\n for (var routePattern in this.router) {\n if (this.isMatch(url, routePattern)) {\n var phCount = routePattern.match(/<(.+?)>/g).length;\n if (phCount < best_controller_placeholders) {\n best_controller = this.router[routePattern];\n best_controller_request = this.extractParameters(url, routePattern);\n best_controller_placeholders = phCount;\n // Match found with minimum amount of placeholders - no need to keep looking...\n if (phCount == 1) break;\n }\n }\n };\n if (best_controller) {\n return this.app.createComponent(best_controller, Object.assign({}, this.app.config, {\"request\": best_controller_request}));\n }\n throw new Error(\"404 NotFound\")\n }", "function dinamicRoutes() {\n var otherRoutes = routes.filter(function (item) { return item.path.includes(':'); });\n var getRouteCurrent = location.pathname.split('/');\n var request = {};\n otherRoutes.map(function (route) { return request = getRouteCurrent[1] == (route.path.split('/'))[1] ? { 'status': true, 'route': route } : { 'status': false }; });\n return request;\n}", "function dinamicRoutes() {\n var otherRoutes = routes.filter(function (item) { return item.path.includes(':'); });\n var getRouteCurrent = location.pathname.split('/');\n var request = {};\n otherRoutes.map(function (route) { return request = getRouteCurrent[1] == (route.path.split('/'))[1] ? { 'status': true, 'route': route } : { 'status': false }; });\n return request;\n}", "function initPath(req){\n let path = url.parse(req.url).pathname;\n let reg = /(\\/\\w+?){2,}/;\n if(reg.test(path)){\n let pathParam = path.split('/');\n let controller = pathParam[1] || 'index';\n let action = pathParam[2] || 'index';\n let param = pathParam.slice(3);\n\n return {controller, action, param}\n }else{\n //todo error: the path not correct\n } \n}", "url(action,i18n,payload,params,hash){\n if (this.data.url){\n return this.data.url.call(this, action, i18n,payload,params);\n } else {\n let route_path = i18n.t(this.key);\n return `/${i18n.language}/${route_path}`;\n }\n }", "function getRouteParams(route, params) { // 11\n var routeParams = {}; // 12\n // 13\n if (!route.path) return routeParams; // 14\n // 15\n var paramNames = _PatternUtils.getParamNames(route.path); // 16\n // 17\n for (var p in params) { // 18\n if (params.hasOwnProperty(p) && paramNames.indexOf(p) !== -1) routeParams[p] = params[p];\n }return routeParams; // 20\n} // 21", "get routes(){\n\t\treturn {\n\t\t\t'get /': [actionFilter, 'index'],\n\t\t\t'get /home/about': 'about'\n\t\t}\n\t}", "function getRouteValuesFromUrl(e) {\n\n //Prevent from running twice\n if (e.routeMatched != undefined) return e.routeMatched;\n\n //Ensure values is initialized\n e.values = (e.values || {});\n\n //Locals\n var url = go.trimChars(e.url, \"/\"),\n routes = _config.routes,\n length = routes.length;\n\n //Query string\n if (/\\?/.test(url)) {\n\n //Split string from path\n var parts = url.split(\"?\");\n params = parts[1].split(\"&\");\n\n //Reassign URL path\n url = go.trimChars(parts[0], \"/\");\n\n //Add params to e.values\n for (var i = 0; i < params.length; i++) {\n var pair = params[i].split(\"=\");\n e.values[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);\n }\n\n }\n\n //Convert empty path to default \"/\"\n url = url || \"/\"\n\n //Exit on empty arguments\n if (!url || !routes) return;\n\n //Check each route, take first match\n for (var i = 0; i < length; i++) {\n\n //Locals\n var routeObj = routes[i],\n route = go.trimChars(routeObj.route, \"/\") || \"/\",\n require = routeObj.require,\n defaults = routeObj.defaults,\n paramRegex = /{[\\w\\d_]+}/ig,\n routeRegex = new RegExp(\"^\" + route.replace(paramRegex, \"([^\\\\/]+)\") + \"$\", \"i\"),\n vals = e.values;\n\n //Check URL with regex\n if (routeRegex.test(url)) {\n\n //Add require to event only if it doesn't exist\n if (!e.require && require) e.require = require;\n\n //Merge values with defaults\n vals = extend(vals, defaults);\n\n //Get param names\n var paramNames = route.match(paramRegex);\n\n //Route might not contain any params\n if (paramNames) {\n\n //Remove curly brackets from names\n go.trimChars(paramNames, \"{}\");\n\n //Get param values\n //Skip first item in array, Only take param matches\n var paramValues = url.match(routeRegex).slice(1);\n for (var i = 0; i < paramNames.length; i++) {\n vals[paramNames[i]] = paramValues[i];\n }\n\n }\n\n //Success, Route has been matched\n //Return true only if controller and action found\n if (vals.controller && vals.action) {\n e.routeMatched = true;\n e.route = route;\n return true;\n }\n }\n }\n\n //No matching route found\n e.routeMatched = false;\n return false;\n }" ]
[ "0.69673014", "0.65067947", "0.6253531", "0.6098924", "0.6054433", "0.5961769", "0.5955426", "0.59383893", "0.59383893", "0.59383893", "0.5920788", "0.5877686", "0.5872621", "0.5826042", "0.5781528", "0.5694709", "0.5683778", "0.56832606", "0.5681354", "0.56583095", "0.56404155", "0.5638172", "0.5623233", "0.5615085", "0.5615085", "0.56007177", "0.5594657", "0.5589498", "0.556135", "0.5534653" ]
0.6940775
1
[END buttoncallback] Function used to return current user graduation status based on their user.email.
function returnGradStatus (email, emailVerified) { if (emailVerified) { // Email is verified. // Get domain of email (note: if email is 'abc@abc'@example.com, then this next line won't work properly) var domain = email.replace(/.*@/, ""); // Replaces everything up to and including the @ symbol if (domain === 'alumni.nd.edu') { // true if the address ends with alumni.nd.edu return 'alumni'; } else if (domain === 'nd.edu') { // true if the address ends with nd.edu return 'student'; } else { // address is not of student or alumni return 'error'; } } else { // Email is not verified. return 'error'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CheckStatus(){\n \n fire.auth().onAuthStateChanged(\n (user)=>{\n if (user) {\n setUserInfo(user.email)\n }\n }\n )\n }", "function checkUserState() {\n var user = firebaseData.getUser();\n if (user) {\n // logged in - hide this\n document.getElementById('not_logged_in').style.display = 'none';\n document.getElementById('submit_access_reminder').style.display = 'none';\n document.getElementById('not_reader').style.display = null;\n document.getElementById('login_explanation').style.display = null;\n firebaseData.getUserData(user,\n function(firebaseUserData) {\n // got the data\n if (firebaseData.isUserReader(firebaseUserData)) {\n // we are a reader\n document.getElementById('not_reader').style.display = 'none';\n document.getElementById('login_explanation').style.display = 'none';\n }\n else {\n // not a reader\n document.getElementById('not_reader').style.display = null;\n populateRegistrationForm(firebaseUserData);\n }\n if (firebaseUserData['isRequestPending']) {\n // let them send their reminder as the request is pending\n document.getElementById('submit_access_reminder').style.display = null;\n }\n }),\n function(error) {\n // failed\n console.log('failed to get the user data to see if a reader', error);\n document.getElementById('not_reader').style.display = null;\n }\n }\n else {\n // not logged in, show this\n document.getElementById('not_logged_in').style.display = null;\n document.getElementById('not_reader').style.display = 'none';\n document.getElementById('submit_access_reminder').style.display = 'none';\n }\n}", "function userVisitStatus(){\n dataservice.postData(USER_VISIT_API, {}, config).then(function(data, status) {\n if (data) {\n if (data.status) {\n }\n }\n\n }, function() {});\n }", "checkInComplete() {\n if (GoogleSignin.currentUser() != null) {\n StorageController.getCheckinNotifPreference().then((value) => {\n if (value) {\n console.log('Notifying...');\n PushNotification.localNotification({\n title:'Checked In',\n message: 'Just checked you into this event. Have fun!'\n });\n }\n });\n }\n }", "function getEmailStatus() {//here we changed 'gender,emailConfirmation,status' from on to 'male/female/others,Yes/no,Active/Inactive'\n gender = document.querySelectorAll(\"input[name='gender']\");\n gender.forEach(function (elements) {\n if (elements[\"checked\"]) {\n gender = elements.previousSibling.previousSibling.innerText;\n }\n });\n emailConfirmation = document.querySelectorAll(\"input[name='emailConfirmation']\");\n emailConfirmation.forEach(function (elements) {\n if (elements[\"checked\"]) {\n emailConfirmation = elements.previousSibling.previousSibling.innerText;\n }\n });\n status = document.querySelectorAll(\"input[name='status']\");\n status.forEach(function (elements) {\n if (elements[\"checked\"]) {\n status = elements.previousSibling.previousSibling.innerHTML;\n }\n });\n }", "function profileCallback(){\r\n\t\t// Constants from the HTML page\r\n\t\tconst profile_name = document.querySelector('#profile_name');\r\n\t\tconst profile_firstname = document.querySelector('#profile_firstname');\r\n\t\tconst profile_email = document.querySelector('#profile_email');\r\n\t\tconst profile_submit = document.querySelector('#profile_submit');\r\n\t\t\r\n\t\t// Get the user information\r\n\t\tdb.collection('users').doc(user.uid).get().then((doc) => {\r\n\t\t\tprofile_name.value = doc.data().name;\r\n\t\t\tprofile_firstname.value = doc.data().firstName;\r\n\t\t\tprofile_email.value = user.email;\r\n\t\t\tdiv.style.display = \"none\";\r\n\t\t});\r\n\r\n\t\t// Update the email address\r\n\t\tprofile_submit.addEventListener('click', (e) => {\r\n\t\t\te.preventDefault();\r\n\t\t\t// Request user password\r\n\t\t\tvar password = prompt(\"Please enter your password:\", \"\");\r\n\t\t\tif (password == null || password == \"\") {\r\n\t\t\t\talert(\"Your email was not updated\");\r\n\t\t\t} else {\r\n\t\t\t\t// Update email address\r\n\t\t\t\tauth.signInWithEmailAndPassword(user.email, password)\r\n\t\t\t\t .then((userCredential) => {\r\n\t\t\t\t // Signed in\r\n\t\t\t\t var user = userCredential.user;\r\n\r\n\t\t\t\t user.updateEmail(profile_email.value).then(() => {\r\n\t\t\t\t\t \talert(\"Email was modified with success\");\r\n\t\t\t\t\t });\r\n\t\t\t\t\t })\r\n\t\t\t\t\t\t.catch((error) => {\r\n\t\t\t\t\t\t\t// Error\r\n\t\t\t\t\t\t\talert(\"An error has occured, please try again.\");\r\n\t\t\t\t });\r\n\t\t\t}\r\n\t\t});\r\n\t}", "function updateOnlineStatusOfClients(all_occupants_details){\n //first every user's status label to offline\n $(\".online_status\").text(' (Offline) ').css('color', '#C0C0C0');\n\n //then update the online status based on logged in clients.\n for(var i=0; i<all_occupants_details.length; i++){\n var userEmail = all_occupants_details[i].email;\n $('#online_status_'+convertEmailToID(userEmail)).text(' (Online) ').css('color', '#0f0');\n }\n}", "function updateOnlineStatusOfClients(all_occupants_details){\n //first every user's status label to offline\n $(\".online_status\").text(' (Offline) ').css('color', '#C0C0C0');\n\n //then update the online status based on logged in clients.\n for(var i=0; i<all_occupants_details.length; i++){\n var userEmail = all_occupants_details[i].email;\n $('#online_status_'+convertEmailToID(userEmail)).text(' (Online) ').css('color', '#0f0');\n }\n}", "function user_status(status){\n\tif(status == \"VISIBLE\"){\n \tajax_call(status)\n\t}\n\telse{\n\n\t\tvar result=confirm(\"Your 10 point will be deducted.Are you sure to Continue? if credit is not present then buy for inactivating your account.\");\n\t\tif (result==true)\n\t\t {\n\t\t ajax_call(status) \n\t\t }\n\t\telse\n\t\t {\n\t\t jQuery(\"#visibility_status\").val(\"VISIBLE\");\n\t\t }\n\n\t}\n}", "function getStatusUserByStatus(statusID) {\n\n}", "function checkNewUserStatus(e){\n var newUserStatus = localStorage.getItem(\"newUserStatus\");\n //console.log(something);\n if (newUserStatus){\n //show intro div\n alert(something);\n } else if (!newUserStatus){\n //show direction div\n alert(\"Oops something went wrong\");\n }\n \n return userStatus;\n}", "function addUserStatusToDb(email) {\n db.collection(\"users\")\n .get()\n .then((snapshot) =>\n snapshot.docs.forEach((doc) => {\n if (email === doc.data().email) {\n let id = doc.id;\n db.collection(\"users\").doc(id).update({ signedIn: true });\n let email = doc.data().email;\n let first = doc.data().firstname;\n let last = doc.data().lastname;\n let status = true;\n //Add message to user on login\n let para = document.createElement(\"p\");\n let node = document.createTextNode(`Welcome ${first} ${last}!`);\n para.appendChild(node);\n let element = document.getElementById(\"div1\");\n element.appendChild(para);\n addUserToState(first, last, email, status);\n }\n })\n );\n}", "function CheckUserStatus () { // check if he is a premium user or not\n var userStatus = JSON.parse(localStorage.getItem('userStatus'));\n if (userStatus.indexOf(\"premium\") != -1) {\n document.getElementById(\"downgrade\").style.display = \"block\";\n document.getElementById(\"upgrade\").style.display = \"none\";\n } else {\n document.getElementById(\"upgrade\").style.display = \"block\";\n document.getElementById(\"downgrade\").style.display = \"none\";\n }\n}", "function master(userName, userEmail, total) {\r\n if (isValidName(userName) === false) {\r\n nameSpan.style.display = '';\r\n nameSpan.style.color = 'red';\r\n }\r\n if (isValidEmail(userEmail) === false) {\r\n emailSpan.style.display = '';\r\n emailSpan.style.color = 'red';\r\n } \r\n if (isActivityValid(total) === false) {\r\n activitySpan.style.display = '';\r\n activitySpan.style.color = 'red';\r\n } \r\n if (isValidName(userName) === true && isValidEmail(userEmail) === true && isActivityValid(total) === true) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n}", "function checkStatus() {\n\n var users = getUsers();\n // variable count is used to monitor how many users are loged in, if more than\n // one then it sets the loged in status of all users to false\n var count = 0;\n\n for(var k = 0; k < users.length; k++) {\n if(users[k].loggedIn == true) {\n loggedIn = [true, k];\n count += 1;\n }\n }\n //if user is logged in changes the login tab to user information tab\n if(loggedIn[0] && count == 1) {\n if(document.getElementById(\"LoggedInAs\") != null && document.getElementById(\"playersHighscore\") != null) {\n document.getElementById(\"LoggedInAs\").innerHTML = \"Logged in as: \" + users[loggedIn[1]].name;\n document.getElementById(\"playersHighscore\").innerHTML = \"Highest score: \" + users[loggedIn[1]].score;\n selectTab(event, 'logedIn');\n } else {\n //sets the login / sign up value inside the navigation bar to a users username\n document.getElementById(\"user\").innerHTML = users[loggedIn[1]].name;\n }\n } else {\n for(var l = 0; l < users.length; l++) {\n users[l].loggedIn = false;\n }\n }\n }", "function listenMembersStatus(chatID) {\n unsubscribeMembersStatus = db.collection(\"users\").onSnapshot(function (snapshot) {\n snapshot.docChanges().forEach(function (change) {\n if (change.type == \"modified\") {\n var changedUserData = change.doc.data();\n db.collection(\"chatMembers\").doc(chatID).get().then(function (chatMembers) {\n if (document.getElementById(changedUserData.email)) {\n // Determine current and old status of the user with changed data \n var currentStatus = changedUserData.loggedIn ? \"logged-in\" : \"logged-out\";\n var oldStatus;\n if (!document.getElementById(changedUserData.email).parentElement.classList.contains(currentStatus)) {\n oldStatus = currentStatus == \"logged-in\" ? \"logged-out\" : \"logged-in\";\n }\n // Determine if user is a user of the active chat and compare to see if current and old status are the same, if not then need to update the button on front end \n if (chatMembers.data()[changedUserData.email] && currentStatus != oldStatus) {\n document.getElementById(changedUserData.email).parentElement.classList.replace(oldStatus, currentStatus);\n }\n }\n })\n }\n })\n })\n}", "function onNewUserCreationCallBack(data) {\n\t\tvar create_status = data.status;\n\t\tif (create_status == 0) {\n \tprependInfoDiv($(\"#user_reg\"), \"user_reg_status_info\", \"We send out a verification email to \" + data.email);\n\t\t}\n\t\telse if (create_status == 1) {\n\t\t\tprependInfoDiv($(\"#user_reg\"), \"user_reg_status_info\", \"This email has already been used.\");\t\n\t\t}\n\t\telse if (create_status == 2) {\n\t\t\tprependInfoDiv($(\"#user_reg\"), \"user_reg_status_info\", \"This email is waiting for verification.\");\n\t\t}\n\t\telse if (create_status == 9) {\n\t\t\tprependInfoDiv($(\"#user_reg\"), \"user_reg_status_info\", \"Database Error\");\n\t\t}\n\t\telse {}\n\t}", "function authStateObserver(user) {\r\n if (user) { // User is signed in!\r\n //alert(\"Logged In\");\r\n $('#signin').hide();\r\n $('#checkPage').removeClass('hide');\r\n\r\n $('#msg').text(\"Please click the green button below to detect fake news!\");\r\n\r\n\r\n\r\n // We save the Firebase Messaging Device token and enable notifications.\r\n //saveMessagingDeviceToken();\r\n } else { // User is signed out!\r\n // Hide user's profile and sign-out button.\r\n //alert(\"Please login!\");\r\n $('#msg').text(\"Please login to detect fake news!\");\r\n }\r\n}", "function updateCurrentStatus(user) {\n $(\"#current-status\").empty().append(\n `<h4>` + user[\"family_name\"] + \", \" + user[\"given_name\"] + `</h4>\n <h4>UIN: ` + user[\"uin\"] + `</h4>\n <p>Current Entry Status = ` + user[\"status\"] + `</p>`\n ).show();\n}", "updateSigninStatus(isSignedIn) {\n this.setState({isSignedIn, checkedSignIn: true})\n if (isSignedIn) {\n const googleUser = window.gapi.auth2.getAuthInstance().currentUser.get().getBasicProfile();\n\n const profile = {\n name: googleUser.getName(),\n email: googleUser.getEmail(),\n imageUrl: googleUser.getImageUrl()\n }\n\n this.setState({profile})\n\n this.getLabels();\n this.getEmails('me', '', this.state.selectedLabel, this.getEmailMetaData)\n }\n }", "function googleSignInComplete(googleUser) {\n\n let userEmail = googleUser.getBasicProfile().getEmail();\n authuserID = googleUser.getAuthResponse().session_state.extraQueryParams.authuser;\n\n // Add the user email address to the signed in button.\n document.getElementById('signedInAs').innerHTML =\n '<span class=\"gmailSignedInText\">as <u>' +\n userEmail + '</u></span>' +\n '<img class=\"gmailImage\" src=\"' + googleUser.getBasicProfile().getImageUrl() + '\" alt=\"\"/>';\n\n // Change the please click sign in paragraph.\n document.getElementById(\"pleaseClickSignInParagraph\").innerText =\n 'You are currently signed in to a Google account. If this is not your primary Google account, logout of the account and change into your primary Google account now.';\n\n isSignedIn = true;\n survey.setValue('isSignedIn', 'true');\n\n survey.setValue('SSOEmailAddress', userEmail);\n\n // Setup the sign-in state change listener.\n gapi.load('auth2', function() {\n // Retrieve the singleton for the GoogleAuth library and set up the client.\n let auth2 = gapi.auth2.init({\n client_id: '353069496362-4a8fuq2fs5crocmm1eaqqnm0bgn9m4mq.apps.googleusercontent.com'\n });\n\n // Listen for sign-in state changes.\n auth2.isSignedIn.listen(afterSignIn);\n });\n}", "function statusChangeCallback(response) {\n\t // The response object is returned with a status field that lets the\n\t // app know the current login status of the person.\n\t // Full docs on the response object can be found in the documentation\n\t // for FB.getLoginStatus().\n\t if (response.status === 'connected') {\n\t \t// Logged into your app and Facebook.\n\t \tconsole.log('Welcome! Fetching your information.... ');\n\t\t\tvar url = '/me?fields=first_name,last_name,email';\n\t\t\tFB.api(url, function (response) {\n\t\t\t\tresponse['type'] = 'Facebook';\n\t\t\t\tuserObj = response;\n\t\t\t\tif(response.email === undefined) {\n\t\t\t\t\t$.ajax({url:'/user-manager/getBySocialId?id='+response.id,type:'get',success:function(docRes) {\n\t\t\t\t\t\tif(docRes.success) {\n\t\t\t\t\t\t\tif(docRes.data[0]._email === null || docRes.data[0]._email === undefined) {\n\t\t\t\t\t\t\t\t$('#userEmailAddress').modal({backdrop: 'static',keyboard: false});\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tuserObj['email_exception'] = true;\n\t\t\t\t\t\t\t\tsendLoginInfo(userObj);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$('#userEmailAddress').modal({backdrop: 'static',keyboard: false});\n\t\t\t\t\t\t}\n\t\t\t\t\t}});\n\t\t\t\t} else {\n\t\t\t\t\tuserObj['email_exception'] = false;\n\t\t\t\t\tsendLoginInfo(userObj);\n\t\t\t\t}\n\t\t },{scope: 'public_profile,email'});\n\t } else {\n\t \tconsole.log('user closed dialog')\n\t \t$('.fa-spin').remove();\n\t // The person is not logged into your app or we are unable to tell.\n\t //document.getElementById('status').innerHTML = 'Please log ' +\n\t //'into this app.';\n\t }\n\t}", "function getUserOnlineStatus(selUser) {\n var connectStatus = \"\";\n var connectedUser = connectedUserList.find(function(oneUser) {\n return oneUser.email === selUser.email;\n });\n if(connectedUser) {\n connectStatus = \"online\";\n }\n else {\n connectStatus = \"offline\";\n }\n\n var contactUser = contactList.find(function (oneUser) {\n return oneUser.email === selUser.email;\n });\n\n var state = \"\";\n if(contactUser) {\n switch (contactUser.state) {\n case 'CONTACTED':\n state = \"status contacted-\";\n break;\n case 'ADDED':\n state = \"status added-\";\n break;\n case 'INVITED':\n state = \"status invited-\";\n break;\n case 'REMOVED':\n state = \"status away-\";\n break;\n case 'DECLINED':\n state = \"status declined-\";\n break;\n }\n }\n else {\n state = \"status away-\";\n }\n\n return state + connectStatus;\n}", "function onSignIn(googleUser) {\n console.log('User signed in!');\n var profile = googleUser.getBasicProfile();\n //change userName text, img source, & email text based on profile\n $(\"h1\").text(\"Welcome, \" + profile.getName());\n // $(\"img\").attr(\"src\", profile.getImageUrl());\n // $(\".email\").text(profile.getEmail());\n}", "checkForUserEmail(results) {\n // check if user email is in dbs\n // TO DO function calls based on what emerges\n apiCalls.checkUserByEmail(results.email).then(results => {\n if (results.data.data === \"new user\") {\n console.log(\"build new user\");\n } else {\n console.log(\"update old user\");\n }\n });\n }", "async function extract_ready_status_from_user(user_email_str, database)\n {\n let collection_str =\n await user_exists_in_this_collection(user_email_str, database);\n\n // IF USER COULD NOT BE FOUND IN DATABASE \n if(!collection_str)\n return -1234;\n \n // AT THIS POINT, WE CAN ASSUME THAT THE USER EXISTS IN THE DATABASE\n let database_results_array =\n await database.collection(collection_str).find( {email : user_email_str} ).toArray();\n \n return database_results_array[0].ready_status;\n }", "function authStateObserver(user) {\n if (user) { // User is signed in!\n // Get the signed-in user's profile pic and name.\n var profilePicUrl = getProfilePicUrl();\n var userName = getUserName();\n\n // Display add buttons if user logged in\n if (addResourceBtn) addResourceBtn.style.display = \"block\";\n if (addSpaceBtn) addSpaceBtn.style.display = \"block\";\n if (addCollectionBtn) addCollectionBtn.style.display = \"block\";\n\n // Set the user's profile pic and name.\n userPicElement.style.backgroundImage = 'url(' + addSizeToGoogleProfilePic(profilePicUrl) + ')';\n userNameElement.textContent = userName;\n\n // Show user's profile and sign-out button.\n userNameElement.removeAttribute('hidden');\n userPicElement.removeAttribute('hidden');\n signOutButtonElement.removeAttribute('hidden');\n\n // Hide sign-in button.\n signInButtonElement.setAttribute('hidden', 'true');\n\n if (window.location.href.indexOf(\"space\") > -1) {\n // on a space page so therefore messaging functonality\n // We save the Firebase Messaging Device token and enable notifications.\n saveMessagingDeviceToken();\n\n } else {\n // on a resource page so therefore commenting functionality\n // We save the Firebase Commenting Device token and enable notifications.\n saveCommentingDeviceToken();\n }\n\n } else { // User is signed out!\n if (userNameElement) {\n // Hide user's profile and sign-out button.\n userNameElement.setAttribute('hidden', 'true');\n userPicElement.setAttribute('hidden', 'true');\n signOutButtonElement.setAttribute('hidden', 'true');\n\n // Show sign-in button.\n signInButtonElement.removeAttribute('hidden');\n }\n }\n}", "function onSignIn(googleUser) {\n console.log('User signed in!');\n var profile = googleUser.getBasicProfile();\n //change userName text, img source, & email text based on profile\n $(\".userName\").text(profile.getName());\n $(\"img\").attr(\"src\", profile.getImageUrl());\n $(\".email\").text(profile.getEmail());\n}", "graduate() {\n if (this.grade > 70) {\n this.isGraduated = true;\n console.log(`${this.name} has enough points to graduate!`);\n } else {\n console.log(`${this.name} does not have enough points to graduate.`);\n }\n }", "function toggleSignIn() {\n if (!firebase.auth().currentUser) {\n var provider = new firebase.auth.GoogleAuthProvider();\n // [START signin]\n firebase.auth().signInWithPopup(provider).then(function(result) {\n // User is authenticated.\n var user = result.user; // The signed-in user info\n\n // Store user uid, displayName, and email\n sessionStorage.setItem(\"uid\", user.uid);\n sessionStorage.setItem(\"displayName\", user.displayName);\n sessionStorage.setItem(\"email\", user.email);\n\n // Store in session the graduation status of the user; if not a student/alumni, show error message.\n gradStatus = returnGradStatus(user.email, user.emailVerified)\n\n // Determine if account can enter app.\n if (gradStatus !== 'error') {\n sessionStorage.setItem(\"gradStatus\", gradStatus);\n // Go to app main page.\n window.location.href = \"main.html\";\n } else {\n // Signout user.\n firebase.auth().signOut();\n // Re-enable button.\n document.getElementById('quickstart-sign-in').disabled = false;\n // Error message (user is not verified, or not a student or alumni)\n sweetAlert(\"Oops!\", \"Please use a Notre Dame e-mail account.\", \"error\");\n }\n }).catch(function(error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n\n var email = error.email; // The email of the user's account used.\n var credential = error.credential; // The firebase.auth.AuthCredential type that was used.\n\n if (errorCode === 'auth/account-exists-with-different-credential') {\n alert('You have already signed up with a different auth provider for that email.');\n // If you are using multiple auth providers on your app you should handle linking\n // the user's accounts here.\n } else {\n console.error(error);\n }\n });\n // [END signin]\n } else {\n // [START signout]\n // Confirm logout sweetAlert.\n swal({\n title: \"Are you sure?\",\n text: \"Do you want to logout?\",\n type: \"warning\",\n showCancelButton: true,\n closeOnConfirm: false,\n confirmButtonText: \"Yes, logout!\",\n confirmButtonColor: \"#ec6c62\"\n },\n function(isConfirm){\n if (isConfirm) {\n // Logout confirmed.\n firebase.auth().signOut();\n console.log(\"logging out\");\n window.location.href = \"index.html\";\n } else {\n // Logout canceled.\n }\n });\n // [END signout]\n }\n $('#quickstart-sign-in').disabled = true;\n}" ]
[ "0.6206232", "0.6147407", "0.6083824", "0.60828996", "0.5799449", "0.5774487", "0.56727433", "0.56727433", "0.5600111", "0.55664414", "0.5553524", "0.55490065", "0.55338335", "0.55041534", "0.5503462", "0.55018497", "0.5495348", "0.5492129", "0.54843765", "0.5479782", "0.5477894", "0.54673", "0.5445738", "0.5445414", "0.5443176", "0.54427356", "0.542981", "0.54157865", "0.54103315", "0.5397626" ]
0.634385
0
Esta funcion crea el cursor y setea los listeners
function createCursor() { cursor = document.createElement("div"); cursor = document.createElement("div"); span = document.createElement("span"); title = document.queryCommandValue("h1"); cursor.classList.add("custom-cursor"); document.body.append(cursor); setCursorListeners(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static SetCursor() {}", "function createCursor() {\r\n cursorBar = document.createElement(\"div\");\r\n cursorBar.classList = [\"cursor-bar\"];\r\n\r\n checkCursorIntervalHandle = setInterval(function() {\r\n cursorImage = display_element.querySelector(\"#jspsych-audio-image\");\r\n cursorAudio = display_element.querySelector(\"#player\");\r\n\r\n if (cursorAudio && cursorImage && cursorImage.naturalWidth > 0) {\r\n clearInterval(checkCursorIntervalHandle);\r\n\r\n //Create cursor\r\n display_element.querySelector(\".annotorious-annotationlayer\").appendChild(cursorBar);\r\n updateCursor();\r\n }\r\n }, 50);\r\n }", "cursorTo() {}", "function setCursores(){\n\timgCursor(ultimoevt);\n\tget('wcr_btn-1').style.cursor = cursor(-1, 'btns');\n\tget('wcr_btn1').style.cursor = cursor(1, 'btns');\n}", "function initCursors()\n {\n var ctx = cursorCanvas.getContext(\"2d\");\n\n // setup color gradient\n var col1 = \"rgba(255, 0, 0, 1.0)\";\n var col2 = \"rgba(255, 0, 0, 0.0)\";\n var grdLaser = ctx.createRadialGradient(10, 10, 1, 10, 10, 10);\n grdLaser.addColorStop(0, col1);\n grdLaser.addColorStop(1, col2);\n\n // render laser cursor\n ctx.clearRect(0, 0, 20, 20); \n ctx.fillStyle = grdLaser;\n ctx.fillRect(0, 0, 20, 20);\n laserCursor = \"url(\" + cursorCanvas.toDataURL() + \") 10 10, auto\";\n }", "_resetCursors() {\n this._taskCursor = '';\n this._eventsCursor = '';\n }", "function cursor(info){\n cursorTracker.forEach(cursor => { // detect and assign the correct position (X, Y) of cursor\n cursor.style.top = info.pageY + 'px';\n cursor.style.left = info.pageX + 'px';\n });\n}", "function changeCursor(newCursor) {\n canvas.style.cursor = newCursor\n}", "function createKeys() {\r\n cursors = this.input.keyboard.createCursorKeys();\r\n}", "function CursorChannel() {}", "showCursor() {\n this.canvas.style.cursor = CURRENT_CURSOR;\n }", "function CursorTrack() {}", "setCursor(type) {\n CURRENT_CURSOR = type;\n this.showCursor();\n }", "function FittsCursor(options) {\n let coordinates,\n cursor,\n publicObject,\n where;\n\n cursor = this;\n\n init(options);\n\n return publicObject;\n\n /* INITIALIZE */\n function init(options) {\n\n _required(options);\n _defaults(options);\n\n cursor.group = addGroup();\n cursor.circle = addCircle();\n cursor.text = addText();\n cursor.imageGroup = addImageGroup();\n cursor.image = addCursor();\n\n\n cursor.move(coordinates);\n\n\n }\n\n\n /* PRIVATE METHODS */\n\n function _defaults(options) {\n\n coordinates = options.coordinates ? options.coordinates : {\"x\":50,\"y\":60};\n\n }\n\n function _required(options) {\n\n where = options.where;\n\n }\n\n\n function addCursor() {\n let cursorToAdd;\n\n cursorToAdd = new ExplorableImage({\n \"where\":cursor.imageGroup,\n \"href\":\"assets/cursor.png\",\n \"width\":20,\n \"height\":29\n });\n\n return cursorToAdd;\n }\n\n function addCircle() {\n let circle;\n\n circle = cursor.group\n .append(\"circle\")\n .attr(\"cx\",0)\n .attr(\"cy\",0)\n .attr(\"r\",5)\n .attr(\"fill\",fittsColors().pointer);\n\n return circle;\n }\n\n function addGroup() {\n let group;\n\n group = explorableGroup({\n \"where\":where\n });\n\n return group;\n }\n\n function addImageGroup() {\n let imageGroup;\n imageGroup = explorableGroup({\n \"where\":cursor.group\n });\n\n return imageGroup;\n }\n\n function addText() {\n let text;\n\n text = new ExplorableHintedText({\n \"where\":cursor.group,\n \"textAnchor\":\"end\",\n \"fontSize\":\"18pt\",\n \"foregroundColor\":fittsColors().pointer,\n \"fontWeight\":\"bold\",\n \"string\":\"Initial Position\",\n \"fontFamily\":\"Oswald\",\n \"coordinates\": {\n \"x\":-10,\n \"y\":0\n }\n });\n\n return text;\n }\n}", "function Cursor (position, selectionEnd) {\n this.position = position;\n this.selectionEnd = selectionEnd;\n }", "function Cursor (position, selectionEnd) {\n this.position = position;\n this.selectionEnd = selectionEnd;\n }", "function updateCursor() {\n var start, end, x, y, i, el, cls;\n\n if (typeof cursor === 'undefined') {\n return;\n }\n\n if (cursor.getAttribute('id') !== 'cursor') {\n return;\n }\n\n start = input.selectionStart;\n end = input.selectionEnd;\n if (start > end) {\n end = input.selectionStart;\n start = input.selectionEnd;\n }\n\n if (editor.childNodes.length <= start) {\n return;\n }\n\n el = editor.childNodes[start];\n if (el) {\n x = el.offsetLeft;\n y = el.offsetTop;\n cursor.style.left = x + 'px';\n cursor.style.top = y + 'px';\n cursor.style.opacity = 1;\n }\n\n // If there is a selection, add the CSS class 'selected'\n // to all nodes inside the selection range.\n cursor.style.opacity = (start === end) ? 1 : 0;\n for (i = 0; i < editor.childNodes.length; i += 1) {\n el = editor.childNodes[i];\n cls = el.getAttribute('class');\n if (cls !== null) {\n cls = cls.replace(' selected', '');\n if (i >= start && i < end) {\n cls += ' selected';\n }\n el.setAttribute('class', cls);\n }\n }\n }", "setMouseCursor (type = 'crosshair') {\n this.canvas.style.cursor = type;\n }", "function createCursor(config) {\n\t //Create a new cursor element\n\t var cursor = document.createElement('a-cursor');\n\n\t //Configure the look of the cursor\n\t cursor.setAttribute('position', { x: 0, y: 0, z: -1 });\n\t cursor.setAttribute('geometry', config.geometry);\n\t cursor.setAttribute('material', { shader: 'flat', color: config.color });\n\n\t //Configure the fuse. This (if enabled) is the time in milliseconds that\n\t //you must look at an object with this cursor for it to trigger a click\n\t if (typeof config.fuse === 'number') {\n\t cursor.setAttribute('fuse', true);\n\t cursor.setAttribute('fuseTimeout', config.fuse);\n\t }\n\n\t //Configure the reach distance of the cursor.\n\t //Note that smaller maxDistance -> shorter ray trace\n\t cursor.setAttribute('maxDistance', config.maxDistance);\n\n\t var animations = [];\n\t //If the cursor should be animated then create the animations on the fuse cursor\n\t if (config.animate && typeof config.fuse === 'number') {\n\t //The animation will *stretch* the cursor shape so each number in\n\t //`fullScale` and `shrunkScale` describe the percentage of the unstretched\n\t //dimension the cursor will have. (In the form \"x y z\")\n\t var fullScale = \"1 1 1\";\n\t var shrunkScale = \"0.1 0.1 0.1\";\n\n\t //This animation shrinks the cursor when it begins the fuse timer. It goes\n\t //from the `fullScale` to the `shrunkScale` in the time it takes for the fuse\n\t //timer to click.\n\t var shrinkWithFuse = createAnimation('cursor-fusing', 'ease-in', 'scale', 'forwards', fullScale, shrunkScale, config.fuse);\n\t //The following 2 animations restore the cursor to it's full size when a fuse\n\t //completes (on \"click\") or the fuse is canceled (on \"mouseleave\")\n\t var restoreAfterClick = createAnimation('click', 'ease-in', 'scale', 'forwards', shrunkScale, fullScale, config.fuse / 10);\n\t var restoreAfterFuseCancel = createAnimation('mouseleave', 'ease-in', 'scale', 'forwards', null, fullScale, config.fuse / 10);\n\n\t animations.push(shrinkWithFuse, restoreAfterClick, restoreAfterFuseCancel);\n\t }\n\n\t animations.forEach(function (a) {\n\t return cursor.appendChild(a);\n\t });\n\n\t return cursor;\n\t}", "function addCursor(id, ms){\r\n var dom = document.getElementById(id);\r\n if (dom==null){ console.log('noid'); return false; }\r\n dom.innerHTML += cursorStr;\r\n cursorBlink(id, ms);\r\n return true;\r\n}", "function cambiarcursor(){\n\t$('#buscaralumnos').css('cursor','pointer')\n}", "function setCursor(x, y, select){\n cursor.x = x\n cursor.y = y\n cursor.selected = select\n display.setCursor(x,y,select)\n }", "moveSourceCursorToTheNextPosition () {\n\n }", "onCursorChange() {\n this.$cursorChange();\n this._signal(\"changeSelection\");\n }", "function manageCursor() {\r\n app.stage.removeChild(cursor);\r\n cursor.x = mousePosition.x;\r\n cursor.y = mousePosition.y;\r\n infoBox.x = mousePosition.x;\r\n infoBox.y = mousePosition.y;\r\n if(heldItem) {\r\n if (heldItem.itemType == \"crop\" || heldItem.itemType == \"seed\" || heldItem.itemType == \"fertilizer\") {\r\n cursor.texture = heldItem.texture;\r\n } else {\r\n cursor.texture = PIXI.Texture.WHITE;\r\n }\r\n } \r\n else {\r\n cursor.texture = PIXI.Texture.EMPTY;\r\n }\r\n \r\n app.stage.addChild(cursor);\r\n}", "function onCursorActivity() {\n codeMirror.trigger(\"cursor-activity\");\n }", "function createCursors(selector, splitter) {\n // selector selects elements that should only contain text\n // splitter splits that text into a bunch of chunks\n // each chunk gets a cursor\n\n let styleEl = document.createElement(\"style\");\n document.querySelector(\"head\").appendChild(styleEl);\n\n let maxChunk = 0;\n // Need to add style node just for this call.\n document.querySelectorAll(selector).forEach((el) => {\n // Skip out on non-leaf nodes.\n if (el.firstElementChild) return;\n // TODO (make pass this element)\n let split = splitter(el.innerText);\n let elHTML = \"\";\n for (i = 0; i < split.length; i++) {\n let chunk = split[i];\n if (chunk.length > maxChunk) maxChunk = chunk.length;\n let chunkHTML = \"\";\n for (j = 0; j < chunk.length; j++) {\n chunkHTML += `<span>${chunk.charAt(j)}</span>`;\n }\n elHTML += `<span class=\"curs0r\">${chunkHTML}</span>`;\n }\n el.innerHTML = elHTML;\n });\n\n // TODO pass in styling...\n let blanker = `\n ${selector} > .curs0r > * {\n color: black;\n text-shadow: none;\n }\n `;\n\n let count = 0;\n let tick = () => {\n styleEl.innerHTML = `\n ${blanker}\n ${selector} > .curs0r > :nth-child(n + 1):nth-child(-n + ${count}) {\n color: white;\n text-shadow: inherit;\n }\n \n ${selector} > .curs0r > :nth-child(${count + 1}){\n background-color: white;\n color: white;\n fill: white;\n box-shadow: 0px 0px 2px aqua, 0px 0px 10px aqua;\n text-shadow: none;\n }\n `;\n count += 1;\n return count > maxChunk;\n };\n\n let reset = () => {\n count = 0;\n styleEl.innerHTML = `${blanker}`;\n };\n\n reset();\n\n return { tick, reset };\n}", "function CursorInfo() { }", "function setCursor (entry) {\n if (slots.length === 0) return;\n entry %= slots.length;\n if (entry < 0) { entry = slots.length - 1; }\n if (pointer >= 0) { slots[pointer].classList.remove('focus'); }\n pointer = entry;\n slots[pointer].classList.add('focus');\n}", "function onFocus(e) {\n cursor.className = 'terminal-cursor';\n }" ]
[ "0.7385312", "0.6627222", "0.66079", "0.6439811", "0.63694715", "0.631824", "0.6286023", "0.6217564", "0.6203469", "0.6197986", "0.61702645", "0.6104216", "0.60769176", "0.604556", "0.6027897", "0.6027897", "0.6000636", "0.59923834", "0.59831095", "0.5976143", "0.5970618", "0.59676224", "0.5953087", "0.594606", "0.5926326", "0.5908495", "0.5888543", "0.58619684", "0.5852967", "0.58486927" ]
0.699894
1
Method to Cycle and Click Through Each Individual Movie Page
clickThrough() { let movie = browser.elements('.datalayer-movie.ng-binding'); movie.value.forEach(function (element) { element.click() browser.back(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function performPage() {\r\n var movie_title = $('[class^=TitleHeader__TitleText]').text().trim();\r\n // reference\r\n if (movie_title === \"\") {\r\n movie_title = $('h3[itemprop=\"name\"]').text().trim();\r\n movie_title = movie_title.substring(movie_title.lastIndexOf(\"\\n\") + 1, -1 ).trim();\r\n }\r\n var movie_title_orig = $('[class^=OriginalTitle__OriginalTitleText]').text().trim().replace(\"Original title: \", \"\");\r\n // reference\r\n if (movie_title_orig === \"\" && $('h3[itemprop=\"name\"]').length) {\r\n movie_title_orig = $.trim($($('h3[itemprop=\"name\"]')[0].nextSibling).text());\r\n }\r\n // not found\r\n if (movie_title_orig === \"\") {\r\n movie_title_orig = movie_title;\r\n }\r\n\r\n var movie_id = document.URL.match(/\\/tt([0-9]+)\\//)[1].trim('tt');\r\n var is_tv = Boolean($('title').text().match('TV Series'));\r\n // newLayout || reference : check if 'title' has just a year in brackets, eg. \"(2009)\"\r\n var is_movie = (Boolean($('[class^=TitleBlock__TitleMetaDataContainer]').text().match('TV')) || Boolean($('li.ipl-inline-list__item').text().match('TV Special'))) ? false : Boolean($('title').text().match(/.*? \\(([0-9]*)\\)/));\r\n // newLayout || reference\r\n if (Boolean($('[class^=GenresAndPlot__Genre]').text().match('Documentary')) || Boolean($('li.ipl-inline-list__item').text().match('Documentary'))) {\r\n is_tv = false;\r\n is_movie = false;\r\n }\r\n\r\n // Start of External ratings code\r\n if (GM_config.get(\"ratings_cfg_imdb\") || GM_config.get(\"ratings_cfg_metacritic\") || GM_config.get(\"ratings_cfg_rotten\") || GM_config.get(\"ratings_cfg_letterboxd\")) {\r\n externalRatings(movie_id, movie_title, movie_title_orig);\r\n }\r\n // Call to iconSorterCount() for the icons/sites sorting.\r\n iconSorterCount(is_tv, is_movie);\r\n\r\n // Create areas to put links in\r\n addIconBar(movie_id, movie_title, movie_title_orig);\r\n perform(getLinkArea(), movie_id, movie_title, movie_title_orig, is_tv, is_movie);\r\n if (GM_config.get('load_second_bar') && !GM_config.get('load_third_bar_movie')) {\r\n getLinkAreaSecond();\r\n } else if (!GM_config.get('load_second_bar') && GM_config.get('load_third_bar_movie')) {\r\n getLinkAreaThird();\r\n } else if (GM_config.get('load_second_bar') && GM_config.get('load_third_bar_movie') && !GM_config.get('switch_bars')) {\r\n getLinkAreaSecond();\r\n getLinkAreaThird();\r\n } else if (GM_config.get('load_second_bar') && GM_config.get('load_third_bar_movie') && GM_config.get('switch_bars')) {\r\n getLinkAreaThird();\r\n getLinkAreaSecond();\r\n }\r\n}", "function displayMovie(event){\n let target = event.target || event.srcElement;\n\n // Retrieves title if parent element selected\n if(target.className == \"movie\"){\n target = target.getElementsByClassName(\"title\")\n target = target[0];\n }\n\n // sends an API request for the specific movie to be displayed\n searchByTitle(target).then(result => {\n let movies = result[\"Title\"];\n displayMovieResult(result);\n });\n}", "function youtubeclick(){\n $(\".right_box.movie a\").click(function(e){\n var _youtubeurl=$(this).attr(\"href\");\n var _string=_youtubeurl.substr(32,42);//get youtube id\n var _youtubehref=\"https://www.youtube.com/embed/\"+_string+\"?rel=0\";\n $(\".video-container iframe\").attr(\"src\",_youtubehref);\n $(this).addClass(\"clicked\").siblings().removeClass(\"clicked\");\n\n return false;\n });\n $(\".right_box.movie a\").eq(0).click();\n }", "function showMovies() {\r\n movies.forEach(function(movie) \r\n {\r\n fetch('https://www.omdbapi.com/?t=' + movie.title + '&apikey=789d41d5')\r\n .then(response => {\r\n return response.json();\r\n })\r\n .then(data =>\r\n {\r\n //creating the DOM elements for the movies to be displayed and adding attributes to give them function and styling\r\n \r\n const section = document.createElement('section');\r\n const article = document.createElement('article');\r\n const images = document.createElement('img');\r\n const imgDiv = document.createElement('div');\r\n imgDiv.setAttribute('class', 'imgDiv');\r\n\r\n images.src = data.Poster;\r\n images.alt = data.Title + 'poster';\r\n\r\n const h2 = document.createElement('h2');\r\n h2.innerHTML = data.Title;\r\n\r\n const button = document.createElement('button');\r\n button.innerHTML = 'Watch trailer';\r\n \r\n button.setAttribute('onClick', \"buttonClick(\"+movie.youtubeId+\")\");\r\n\r\n\r\n\r\n const expandDiv = document.createElement('div');\r\n expandDiv.setAttribute('class', 'description');\r\n const h3 = document.createElement('h3');\r\n const plot = document.createElement('p');\r\n const div2 = document.createElement('div');\r\n div2.setAttribute('class', 'rating');\r\n const ratingSource = document.createElement('p');\r\n const ratingValue = document.createElement('p');\r\n const age = document.createElement('p');\r\n\r\n h3.innerHTML = 'Description'\r\n plot.innerHTML = data.Plot;\r\n ratingSource.innerHTML = data.Ratings[0].Source;\r\n ratingValue.innerHTML = data.Ratings[0].Value;\r\n \r\n // Calculate the age of the movie using current date and the movies release date\r\n let today = new Date();\r\n let currentYear = today.getFullYear();\r\n\r\n age.innerHTML = currentYear - data.Year + \" years old\";\r\n \r\n // Creating DOM elements for the movie trailer\r\n const videoDiv = document.createElement('div');\r\n videoDiv.setAttribute('class', 'videoModal')\r\n const video = document.createElement('iframe');\r\n video.src = youtube.generateEmbedUrl(movie.youtubeId);\r\n videoDiv.setAttribute('class','videoModal');\r\n videoDiv.setAttribute('id',movie.youtubeId);\r\n\r\n // Append elements to the body\r\n section.appendChild(article);\r\n article.appendChild(imgDiv);\r\n imgDiv.appendChild(images);\r\n article.appendChild(h2);\r\n article.appendChild(button);\r\n article.appendChild(expandDiv);\r\n expandDiv.appendChild(h3);\r\n expandDiv.appendChild(plot);\r\n expandDiv.appendChild(div2);\r\n div2.appendChild(ratingSource);\r\n div2.appendChild(ratingValue);\r\n expandDiv.appendChild(age);\r\n article.appendChild(videoDiv);\r\n videoDiv.appendChild(video);\r\n\r\n document.getElementById('body').appendChild(section);\r\n })\r\n \r\n }\r\n \r\n ) \r\n}", "function searchMovie(searchWord, page) {\n fetch(\n `http://www.omdbapi.com/?s=${searchWord}&apikey=dd68f9f&page=${page}&plot=short`\n )\n .then(function(response) {\n return response.json();\n })\n .then(function(data) {\n let searchResults = data.Search;\n results.innerHTML = \"\";\n return searchResults.map(function(movie) {\n let movieDiv = createNode(\"div\");\n let movieTitle = createNode(\"h1\");\n let moviePoster = createNode(\"img\");\n let more = createNode(\"div\");\n let movieDetails = createNode(\"p\");\n let movieID = movie.imdbID;\n let movieActors = createNode(\"p\");\n let movieDirector = createNode(\"p\");\n let movieRating = createNode(\"p\");\n\n movieDiv.className = \"movie-div\";\n\n movieTitle.textContent = `${movie.Title} (${movie.Year})`;\n movieTitle.className = \"movie-title\";\n\n moviePoster.src = movie.Poster;\n moviePoster.className = \"movie-images\";\n\n more.textContent = \"More...\";\n more.className = \"more\";\n\n movieDetails.className = \"movie-details--off\";\n\n append(results, movieDiv);\n append(movieDiv, movieTitle);\n append(movieDiv, moviePoster);\n append(movieDiv, more);\n append(more, movieActors);\n append(more, movieDirector);\n append(more, movieRating);\n append(more, movieDetails);\n\n more.addEventListener(\"click\", function(event) {\n event.preventDefault();\n if (movieDetails.className == \"movie-details--off\") {\n fetch(\n `http://www.omdbapi.com/?i=${movieID}&apikey=dd68f9f&plot=full`\n )\n .then(function(response) {\n return response.json();\n })\n .then(function(data) {\n console.log(data);\n movieActors.textContent = `Cast: ${data.Actors}`;\n if (movie.Director !== \"N/A\") {\n movieDirector.textContent = `Directed by: ${data.Director}`;\n }\n movieRating.textContent = `${data.Ratings[0].Source}: ${\n data.Ratings[0].Value\n }\n ${data.Ratings[1].Source}: ${data.Ratings[1].Value}\n ${data.Ratings[2].Source}: ${data.Ratings[2].Value}`;\n\n movieDetails.className = \"movie-plot\";\n movieDetails.textContent = `Plot: ${data.Plot}`;\n });\n\n movieDetails.classList.toggle(\"movie-details--on\");\n } else if (movieDetails.className == \"movie-details--on\") {\n movieDetails.classList.toggle(\"movie-details--off\");\n }\n });\n });\n });\n}", "function loadMovies() {\n\t// Loop through first half array\n\tfor (var i=0;i<items.length/2;i++) {\n\t\tvar object = get_one_recommended_movie(i);\n\n\t\titems[i].children[0].children[1].children[0].innerHTML = object.name;\n\n\t\t// Set link to go to the indiviual title page\n\t\t$(items[i]).attr(\"href\", \"title/title.php?id=\" + object.id + \"&type=movie\");\n\n\t\t// Apply imdb poster image\n\t\tapplyImdbThumbnail(items[i].children[0].children[0].children[0], false, object.id);\n\t}\n}", "function nextMovie(){\n removeMoviesAction();\n }", "function displayMovies(){\n \n\n allMovies.forEach(movie => {\n\n function func() {\n movieRental.transferMovie(movie.title);\n refreshMovies();\n }\n\n \n let movieDiv = Html.createDivElement({class:'singleMovie'});\n movieDiv.style.backgroundColor = '#'+ Math.floor(Math.random()*16777215).toString(16);\n\n\n let movieImgDiv = Html.createDivElement({class: 'movieImgDiv'})\n let clickMeText = Html.createHeading({text:'Double Click to Rent',size:5});\n\n let header = Html.createHeading({text:movie.title, size:2});\n let releaseDate = Html.createHeading({text:movie.release.toString(),size:4});\n let img = Html.createImageElement({className: 'imgClass', width:100, height:200, src:movie.img, alt:'no image',click:func});\n let link = Html.createLinkElement({text: movie.title, href: movie.imbd});\n \n document.body.appendChild(movieDiv);\n\n movieDiv.appendChild(header);\n \n \n movieDiv.appendChild(releaseDate);\n movieDiv.appendChild(movieImgDiv);\n movieImgDiv.appendChild(img);\n movieImgDiv.appendChild(clickMeText);\n movieDiv.appendChild(link);\n\n if(movie.available >0){\n document.getElementById('availableDiv').appendChild(movieDiv);\n }\n else if(movie.available === 0){\n document.getElementById('rentedDiv').appendChild(movieDiv);\n \n }\n\n });\n \n}", "loadNextPage() {\n this.page = this.page + 1;\n MovieService.filterMovies(this.props.keywords, this.props.genresId, this.page, true);\n }", "function getMovieDetails(e){\n e.preventDefault();\n if(e.target.classList.contains('info-btn')){\n let movieItem = e.target.parentElement.parentElement;\n fetch(`https://www.omdbapi.com/?apikey=${apiKey}&i=${movieItem.dataset.id}`)\n .then((response)=>response.json())\n .then((data)=>{\n console.log(data);\n let output = `\n <div class=\"logo-img\">\n <img src=\"${data.Poster}\" alt=\"\">\n </div>\n\n <div class=\"Titles\">\n <h1 class=\"movie-title\">${data.Title}</h1>\n <h3 class=\"movie-category\"><strong>CATEGORY -</strong> ${data.Type}</h3>\n </div>\n\n <div class=\"details\">\n <h2>Details:</h2>\n <ul>\n <li><strong>Genre -</strong> ${data.Genre}</li>\n <li><strong>Released -</strong> ${data.Released}</li>\n <li><strong>Actors -</strong> ${data.Actors}</li>\n <li><strong>Director</strong> ${data.Director}</li>\n <li><strong>Language</strong> ${data.Language}</li>\n <li><strong>Ratings</strong> ${data.imdbRating}</li>\n <li><strong>Language</strong> ${data.Language}</li> \n <li><strong>Box Office</strong> ${data.BoxOffice}</li> \n </ul>\n </div> \n <div class=\"link\"> \n <a href=\"https://imdb.com/title/${data.imdbID}\" target=\"_blank\">get imdb</a>\n </div>\n `;\n movieDetailsContent.innerHTML = output;\n movieDetailsContent.parentElement.classList.add('showMovies')\n\n })\n }\n \n}", "function showMovieDetails(movie)\n{\n movieTitle.html(movie.title);\n movieDesc.html(movie.description);\n moviePoster.attr(\"src\", movie.posterImage.attr(\"src\"));\n movieView.on(\"click\", function() {\n window.location.href = \"/movie.html?imdb=\" + movie.imdb;\n });\n\n // Show info to user\n movieDetails.modal(\"show\");\n}", "selectedMovie(movie) {\n // Display selected movie\n this.displaySingleMovie(movie)\n }", "function renderSingleMoviePage(details) {\n\t\tvar page = $('.single-movie');\n\t\tvar container = $('.preview-large');\n\n\t\t// Show the page.\n\t\tpage.addClass('visible');\n\t}", "function nextMovie() {\n if (index === movies.length - 1) {\n index = 0;\n } else {\n index++;\n }\n\n removeData();\n showData(index);\n}", "function getMovies(query) {\n $.getJSON(\n `${movieApi.base}?s=${query}&apikey=${movieApi.key}`\n ) /* .getJSON method retrieves data from an external api */\n .then(function (response) {\n if (response.Response === \"True\") {\n let movies =\n response.Search; /* the api is stored in arrays, here a new var is created to select the particular array needed */\n let output = \"\";\n /* for each of the responses in JSON output html to the webpage */\n $.each(movies, function (index, movie) {\n output += `\n <div class=\"col-sm-6 col-md-4 col-lg-3\">\n <div class=\"search-card text-center\">\n <img src=\"${movie.Poster}\"/> \n <h4 class=\"white\" >${movie.Title}</h4>\n <a onclick=\"selectedMovie('${movie.imdbID}')\" class=\"details-button hvr-shutter-out-horizontal red\" href=\"#\" data-toggle=\"modal\" data-target=\"#modal\">Movie Details</a>\n </div>\n </div>\n `;\n });\n\n /* outputs the html to the div with #movies-to-collapse */\n $(\"#movies-to-collapse\").html(output);\n\n $(\".collapse-button-m\").show();\n } else {\n alert(\"Movie not found! Please enter a valid movie title or word.\")\n }\n\n })\n}", "function displayMovies(movies) {\n console.log(movies);\n for (let i=0; i < movies.length; i++) {\n const movieId = cleanTitle(movies[i]);\n fetch(`https://imdb8.p.rapidapi.com/title/get-plots?tconst=${movieId}`, {\n\t \"method\": \"GET\",\n\t \"headers\": {\n\t\t\"x-rapidapi-host\": \"imdb8.p.rapidapi.com\",\n\t\t\"x-rapidapi-key\": rapidApiKey\n\t }\n })\n .then(resp => resp.json())\n .then(addMoviesHMTL)\n // when the last movie is added to the html shows the \"get movie recommendations\" button\n .then(() => {\n if (i+1 === movies.length) {\n recomButtton.style.display = 'block';\n }\n })\n }\n // function to clean the title info to fetch the api\n function cleanTitle(stringT) {\n let begins = stringT.indexOf('/', 1) + 1;\n let title = stringT.slice(begins, stringT.length - 1);\n return title;\n }\n}", "function getMovies(searchText) {\n $.get(\n baseURL + searchName + searchText + \"&type=movie\",\n (respuesta, estado) => {\n if (estado === \"success\") {\n let movies = respuesta.Search;\n let output = \"\";\n $.each(movies, (i, movie) => {\n output += `\n <div class=\"col-md-3\">\n <div class=\"well text-center\">\n <img class=\"imgSearch\" src=\"${movie.Poster}\">\n <h5>${movie.Title}</h5>\n <a onclick=\"selectedMovie('${movie.imdbID}')\" class=\"btn btn-info\" href=\"#\">Mas info</a>\n </div>\n </div>\n \n `;\n });\n\n result.html(output);\n }\n }\n );\n}", "loadMore(){\n this.getMoviePage();\n }", "loadNextPage() {\n this.data.page = this.data.page + 1;\n this.fetchMovies();\n }", "function movieList() {\r\n for (let i = 0; i < movieInfo.length; i++) {\r\n //Generate list for nowshowing movies\r\n if (movieInfo[i].type == \"now\") {\r\n document.getElementById(\"nowVideoDiv\").innerHTML +=\r\n \"<div>\" +\r\n \"<dt><span>Movie: </span>\" +\r\n movieInfo[i].name +\r\n \"</dt>\" +\r\n '<dd class=\"thumbnail\"><img onclick=\"switchVideo(' +\r\n (movieInfo[i].id - 1) +\r\n ')\" src=\"../image/' +\r\n movieInfo[i].thumbnail +\r\n '\" alt=\"' +\r\n movieInfo[i].name +\r\n '\"></dd>' +\r\n \"<dd><span>Cast: </span>\" +\r\n movieInfo[i].cast +\r\n \"</dd>\" +\r\n \"<dd><span>Director: </span>\" +\r\n movieInfo[i].director +\r\n \"</dd>\" +\r\n \"<dd><span>Duration: </span>\" +\r\n movieInfo[i].duration +\r\n \" mins</dd>\" +\r\n \"</div>\";\r\n }\r\n\r\n //Generate list for upcoming movies\r\n if (movieInfo[i].type == \"upcoming\") {\r\n document.getElementById(\"upcomingVideoDiv\").innerHTML +=\r\n \"<div>\" +\r\n \"<dt><span>Movie: </span>\" +\r\n movieInfo[i].name +\r\n \"</dt>\" +\r\n '<dd class=\"thumbnail\"><img onclick=\"switchVideo(' +\r\n (movieInfo[i].id - 1) +\r\n ')\" src=\"../image/' +\r\n movieInfo[i].thumbnail +\r\n '\" alt=\"' +\r\n movieInfo[i].name +\r\n '\"></dd>' +\r\n \"<dd><span>Cast: </span>\" +\r\n movieInfo[i].cast +\r\n \"</dd>\" +\r\n \"<dd><span>Director: </span>\" +\r\n movieInfo[i].director +\r\n \"</dd>\" +\r\n \"<dd><span>Duration: </span>\" +\r\n movieInfo[i].duration +\r\n \" mins</dd>\" +\r\n \"</div>\";\r\n }\r\n }\r\n}", "function getMovieID(data){\n\tconst movieList = data.results.map((value, index) => displayResult(value));\n\t$(\".js-movies-result\").html(movieList);\n\ttitleClick();\n\tcloseClick();\n}", "function romanticMovies() {\n fetch('http://localhost:8000/api/v1/titles/?sort_by=-imdb_score&genre=romance&page_size=10&page=1')\n .then(res => res.json())\n .then(res => res.results)\n .then(function(value) {\n for (let i = 0; i < value.length; i++) {\n let movie = value[i].image_url;\n let name = value[i].id;\n let movie_url = value[i].url;\n let elt = document.getElementById(\"carousel_romance\");\n let elt_item = document.createElement('div');\n elt_item.setAttribute('class', 'casourel_item');\n elt.appendChild(elt_item);\n let div = document.createElement('div');\n div.setAttribute('id', name);\n div.innerHTML = `<img src= ${movie} alt='casourel'></img>`;\n elt_item.appendChild(div);\n let img = document.getElementById(`${name}`);\n img.onclick = function() {\n myModal.style.display = \"block\";\n getMovieData(movie_url);\n }\n }\n });\n}", "function hrefMenu() {\n const href = window.location.href;\n const tabs = document.querySelectorAll(\".dishes-tab\");\n let idList = [], k = 0;\n if (tabs.length != 0) {\n for (let index = 0; index < tabs.length; index++) {\n const element = tabs[index];\n idList.push(element.id);\n }\n for (let index = 0; index < idList.length; index++) {\n const element = idList[index];\n const lenghtElement = \"-\" + element.length;\n if (element == href.slice(lenghtElement)) {\n document.querySelectorAll('.tab-title')[index].click();\n k = k + 1; \n }\n }\n /*if (k == 0) {\n const menuSecond = tabs[1].querySelector(\".tab-title\");\n //console.log(menuSecond);\n setTimeout(() => {\n menuSecond.click();\n }, 500); \n }*/\n }\n hrefWine();\n}", "function openNav(movie) {\r\n let id = movie.id;\r\n fetch(BASE_URL + '/tv/'+id+'/videos?'+API_KEY).then(res => res.json()).then(videoData => {\r\n console.log(videoData);\r\n if(videoData){\r\n document.getElementById(\"myNav\").style.width = \"100%\";\r\n if(videoData.results.length > 0){\r\n var embed = [];\r\n var dots = [];\r\n \r\n var content = `\r\n <h1 class=\"no-results\">${tv.name}</h1>\r\n <br/>\r\n \r\n ${embed.join('')}\r\n <br/>\r\n <div class=\"dots\">${dots.join('')}</div>\r\n \r\n `\r\n overlayContent.innerHTML = content;\r\n activeSlide=0;\r\n showVideos();\r\n }else{\r\n overlayContent.innerHTML = `<h1 class=\"no-results\">No Results Found</h1>`\r\n }\r\n }\r\n })\r\n}", "function cargarPeliculas(){\n movies.movies.forEach(movie => { \n cargarElementosAlHtml(movie);\n });\n}", "function twoThousandMovies() {\n fetch('http://localhost:8000/api/v1/titles/?year=2000&sort_by=-imdb_score&page_size=10&page=1')\n .then(res => res.json())\n .then(res => res.results)\n .then(function(value) {\n for (let i = 0; i < value.length; i++) {\n let movie = value[i].image_url;\n let name = value[i].id;\n let movie_url = value[i].url;\n //console.log(movie);\n elt_item = document.createElement('div');\n let elt = document.getElementById(\"carousel_two_thousand\");\n elt_item.setAttribute('class', 'casourel_item');\n elt.appendChild(elt_item);\n let div = document.createElement('div');\n div.setAttribute('id', name);\n div.innerHTML = `<img src= ${movie} alt='casourel'></img>`;\n elt_item.appendChild(div);\n let img = document.getElementById(`${name}`);\n img.onclick = function() {\n myModal.style.display = \"block\";\n getMovieData(movie_url);\n }\n\n }\n });\n}", "function genreSearch(genreID) {\n var requestUrlGenre = \"https://api.themoviedb.org/3/discover/movie?api_key=\" + apiKey + \"&language=en-US&sort_by=popularity.desc&with_genres=\" + genreID + \"&page=\" + pageNum\n\n\n console.log(genreID)\n console.log(requestUrlGenre)\n\n fetch(requestUrlGenre)\n .then(function (response) {\n return response.json();\n })\n .then(function (genreMovies) {\n console.log(genreMovies)\n mainpage.innerHTML = \"\"\n\n var chooseMovie = document.createElement(\"h2\")\n chooseMovie.textContent = \"Choose a movie:\"\n mainpage.append(chooseMovie)\n\n var movieButtonContainer = document.createElement(\"div\")\n mainpage.append(movieButtonContainer)\n movieButtonContainer.classList.add(\"button-container\")\n\n //for loop to append 5 first movies\n\n var genreMoviesData = genreMovies.results\n\n for (var i = 0; i < genreMoviesData.length; i++) {\n //create button with movie title names\n var movieTitleBtn = document.createElement(\"button\")\n movieTitleBtn.textContent = genreMovies.results[i].title\n movieTitleBtn.classList.add(\"button\", \"movie-title-button\")\n var btnID = genreMovies.results[i].id\n movieTitleBtn.setAttribute(\"data-id\", btnID)\n movieButtonContainer.append(movieTitleBtn)\n\n // console.log(btnID)\n\n var movieID = movieTitleBtn.getAttribute(\"data-id\")\n function buttonByID(movieID) {\n movieTitleBtn.addEventListener(\"click\", function () {\n fetchMovieDetails(movieID);\n })\n }\n buttonByID(movieID);\n }\n if (pageNum > 1) {\n prevPageGenre(genreID);\n }\n\n nextPageGenre(genreID);\n })\n}", "function displayMovies(movies) {\n movieInformation.innerHTML = \"\"\n let searchedMovies = globalMovieArray[0].Search;\n for (i = 0; i < searchedMovies.length; i++) {\n //Div for listed movie and button\n const liAndButtonDiv = document.createElement('div')\n liAndButtonDiv.classList.add('liAndButtonDiv')\n //Create li element for search result\n const movieTitleListed = document.createElement('li');\n movieTitleListed.classList.add = ('clear')\n const movieTitle = document.createTextNode(`${movies.Search[i].Title}`)\n\n movieTitleListed.appendChild(movieTitle);\n liAndButtonDiv.appendChild(movieTitleListed);\n movieInformation.appendChild(liAndButtonDiv);\n\n buttonForMoreInformation(movies.Search[i].imdbID, liAndButtonDiv)\n spinner.style.display = \"none\";\n\n }\n}", "function main() {\r\n jQ('.vbseo_like_link').each(function(){\r\n\t\tif((jQ(this).parent().parent().parent().css(\"opacity\") > 0.5) && (jQ(this).children().hasClass('hwz-unlike-button') == false))\r\n\t\t\tthis.click();\r\n });\r\n\tvar nextButton = jQ('#content ul a:contains(\"Next ›\")');\r\n\tif(nextButton.length > 0) {\r\n\t\tconsole.log(\"Found next button and attempting to click.\");\r\n\t\tnextButton[0].click();\r\n\t}\r\n}", "function topMovies() {\n tmdb.call('/movie/top_rated', {},\n function(e) {\n var info = document.getElementById('info');\n info.innerHTML = '';\n var results = Object.keys(e.results);\n console.log(\"Success: \" + e);\n console.log(e.results);\n for (var i = 0; i < e.results.length; i++) {\n console.log(JSON.stringify(e.results[i]));\n var info = document.getElementById('info')\n var show = document.createElement('div');\n show.id = i;\n var json = e.results[i];\n var poster = tmdb.images_uri + tmdb.size + e.results[i].poster_path;\n var name = e.results[i].title;\n var img = new Image();\n img.src = poster;\n info.appendChild(show);\n show.appendChild(img);\n if (img.src === 'http://image.tmdb.org/t/p/w500null') {\n img.src = 'http://colouringbook.org/SVG/2011/COLOURINGBOOK.ORG/cartoon_tv_black_white_line_art_scalable_vector_graphics_svg_inkscape_adobe_illustrator_clip_art_clipart_coloring_book_colouring-1331px.png';\n }\n show.innerHTML += '<p>' + name + '</p>';\n\n function click() {\n var display = document.getElementById('display');\n display.innerHTML = '';\n //img.src = '';\n var i = this.id;\n console.log(i);\n var displayPoster = tmdb.images_uri + tmdb.size + e.results[i].poster_path;\n img.src = displayPoster;\n if (img.src === 'http://image.tmdb.org/t/p/w500null') {\n img.src = 'http://colouringbook.org/SVG/2011/COLOURINGBOOK.ORG/cartoon_tv_black_white_line_art_scalable_vector_graphics_svg_inkscape_adobe_illustrator_clip_art_clipart_coloring_book_colouring-1331px.png';\n }\n display.appendChild(img);\n display.innerHTML += '<p>Air date: ' + e.results[i].release_date + '</p>';\n display.innerHTML += '<p>Name: ' + e.results[i].title + '</p>';\n display.innerHTML += '<p>Description: ' + e.results[i].overview + '</p>';\n\n };\n show.addEventListener('click', click, false);\n };\n },\n function(e) {\n console.log(\"Error: \" + e)\n }\n )\n\n function topMovies() {\n tmdb.call('/movie/top_rated', {},\n function(e) {\n var info = document.getElementById('info');\n info.innerHTML = '';\n var results = Object.keys(e.results);\n console.log(\"Success: \" + e);\n console.log(e.results);\n for (var i = 0; i < e.results.length; i++) {\n console.log(JSON.stringify(e.results[i]));\n var show = document.createElement('div');\n show.id = i;\n var json = e.results[i];\n var poster = tmdb.images_uri + tmdb.size + e.results[i].poster_path;\n var name = e.results[i].title;\n var img = new Image();\n img.src = poster;\n info.appendChild(show);\n show.appendChild(img);\n if (img.src === 'http://image.tmdb.org/t/p/w500null') {\n img.src = 'http://colouringbook.org/SVG/2011/COLOURINGBOOK.ORG/cartoon_tv_black_white_line_art_scalable_vector_graphics_svg_inkscape_adobe_illustrator_clip_art_clipart_coloring_book_colouring-1331px.png';\n }\n show.innerHTML += '<p>' + name + '</p>';\n\n function click() {\n var display = document.getElementById('display');\n display.innerHTML = '';\n //img.src = '';\n var i = this.id;\n console.log(i);\n var displayPoster = tmdb.images_uri + tmdb.size + e.results[i].poster_path;\n img.src = displayPoster;\n if (img.src === 'http://image.tmdb.org/t/p/w500null') {\n img.src = 'http://colouringbook.org/SVG/2011/COLOURINGBOOK.ORG/cartoon_tv_black_white_line_art_scalable_vector_graphics_svg_inkscape_adobe_illustrator_clip_art_clipart_coloring_book_colouring-1331px.png';\n }\n display.appendChild(img);\n display.innerHTML += '<p>Air date: ' + e.results[i].release_date + '</p>';\n display.innerHTML += '<p>Name: ' + e.results[i].title + '</p>';\n display.innerHTML += '<p>Description: ' + e.results[i].overview + '</p>';\n\n };\n show.addEventListener('click', click, false);\n };\n },\n function(e) {\n console.log(\"Error: \" + e)\n })\n }\n}" ]
[ "0.6419166", "0.6275278", "0.62354785", "0.6154287", "0.60783213", "0.6074694", "0.60680723", "0.6021547", "0.59701854", "0.59179115", "0.5917031", "0.5912935", "0.59110445", "0.59108114", "0.5867433", "0.5818511", "0.580864", "0.5808399", "0.57993436", "0.57836354", "0.57826704", "0.5774858", "0.57722664", "0.57463217", "0.57406974", "0.57137394", "0.56786513", "0.56734025", "0.5673051", "0.56606144" ]
0.6516985
0
Convert a base64url encoded string to a base64 encoded string ``` > base64url.toBase64('qL8R4QIcQ_ZsRqOAbeRfcZhilN_MksRtDaErMA') 'qL8R4QIcQ/ZsRqOAbeRfcZhilN/MksRtDaErMA==' ```
function toBase64(base64url) { // We this to be a string so we can do .replace on it. If it's // already a string, this is a noop. base64url = base64url.toString(); return padString(base64url) .replace(/\-/g, "+") .replace(/_/g, "/"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stringToBase64Url(str) {\n var b64 = btoa(str);\n return base64ToBase64Url(b64);\n } // converts a standard base64-encoded string to a \"url/filename safe\" variant", "function base64url_encode(str) {\n var utf8str = unescape(encodeURIComponent(str))\n return base64_encode_data(utf8str, utf8str.length, b64u)\n }", "function stringToBase64Url(str) {\n var b64 = (0, _webcrypto.btoa)(str);\n return base64ToBase64Url(b64);\n} // converts a standard base64-encoded string to a \"url/filename safe\" variant", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n }", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n }", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polyfill https://github.com/davidchambers/Base64.js\n }", "function url_base64_decode(str) {\n\t var output = str.replace('-', '+').replace('_', '/');\n\t switch (output.length % 4) {\n\t\tcase 0:\n\t\t break;\n\t\tcase 2:\n\t\t output += '==';\n\t\t break;\n\t\tcase 3:\n\t\t output += '=';\n\t\t break;\n\t\tdefault:\n\t\t throw 'Illegal base64url string!';\n\t }\n\t return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n\t}", "function stringToBase64Url(str) {\n const b64 = btoa(str);\n return base64ToBase64Url(b64);\n}", "function stringToBase64Url(str) {\n const b64 = btoa(str);\n return base64ToBase64Url(b64);\n}", "function base64ToBase64Url(b64) {\n return b64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n}", "function base64ToBase64Url(b64) {\n return b64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n}", "function url_base64_decode(str) {\n\tvar output = str.replace(/-/g, '+').replace(/_/g, '/');\n\tswitch (output.length % 4) {\n\t\tcase 0:\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\toutput += '==';\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\toutput += '=';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow 'Illegal base64url string!';\n\t}\n\tvar result = window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n\ttry {\n\t\treturn decodeURIComponent(escape(result));\n\t} catch (err) {\n\t\treturn result;\n\t}\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n}", "function toBase64Url(base64Text) {\n return base64Text.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output);\n }", "function urlBase64Decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output);\n }", "function encodeURLEncodedBase64(value) {\n return encode(value)\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=/g, '');\n}", "function base64_encode(str) {\n var utf8str = unescape(encodeURIComponent(str))\n return base64_encode_data(utf8str, utf8str.length, b64c)\n }", "function decodeURLEncodedBase64(value) {\n return decode(value\n .replace(/_/g, '/')\n .replace(/-/g, '+'));\n}", "function base64FromURLSafe(text)\n {\n \tvar returnString = \"\";\n\n \tfor (var i = 0; i < text.length; i++)\n \t{\n \t\tvar ch = text.charAt(i);\n \t\tswitch (ch)\n \t\t{\n \t\t\tcase '-':\n \t\t\t\treturnString += '+';\n \t\t\t\tbreak;\n \t\t\tcase '_':\n \t\t\t\treturnString += '/';\n \t\t\t\tbreak;\n \t\t\tcase '*':\n \t\t\t\treturnString += '=';\n \t\t\t\tbreak;\n\n \t\t\tdefault:\n \t\t\t\treturnString += ch;\n \t\t\t\tbreak;\n \n \t\t}\n\n \t}\n\n \treturn returnString;\n }", "function base64urldecode(encodedString) {\n encodedString = encodedString.replace(/-/g, '+').replace(/_/g, '/');\n encodedString += ['', '', '==', '='][encodedString.length % 4];\n return new Buffer(encodedString, 'base64');\n}", "function base64UrlEncode(input) {\n var str = String (input);\n for (\n // initialize result and counter\n var block, charCode, idx = 0, map = chars, output = '';\n // if the next str index does not exist:\n // change the mapping table to \"=\"\n // check if d has no fractional digits\n // str.charAt (idx | 0) || (map = '=', idx % 1);\n str.charAt (idx | 0);\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\n output += map.charAt (63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt (idx += 3 / 4);\n if (charCode > 0xFF) {\n throw new InvalidCharacterError (\"'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\");\n }\n block = block << 8 | charCode;\n }\n return output;\n }", "function base64ToURLSafe(text)\n {\n \tvar returnString = \"\";\n\n \tfor (var i = 0; i < text.length; i++)\n \t{\n \t\tvar ch = text.charAt(i);\n \t\tswitch (ch)\n \t\t{\n \t\t\tcase '+':\n \t\t\t\treturnString += '-';\n \t\t\t\tbreak;\n \t\t\tcase '/':\n \t\t\t\treturnString += '_';\n \t\t\t\tbreak;\n \t\t\tcase '=':\n \t\t\t\treturnString += '*';\n \t\t\t\tbreak;\n\n \t\t\tdefault:\n \t\t\t\treturnString += ch;\n \t\t\t\tbreak;\n \n \t\t}\n\n \t}\n\n \treturn returnString;\n\n\n }", "str2Base64(_str) {\n const _this = this;\n return _this._binb2b64(_this._str2binb(_str));\n }", "function base64ToString (s) {\r\n //the base 64 characters\r\n var BASE64 = new Array ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/');\r\n\t\r\n var decode = new Object();\r\n for (var i=0; i<BASE64.length; i++) {decode[BASE64[i]] = i;} //inverse of the array\r\n decode['='] = 0; //add the equals sign as well\r\n var r = \"\", c1, c2, c3, c4, len=s.length; //define variables\r\n s += \"====\"; //just to make sure it is padded correctly\r\n for (var i=0; i<len; i+=4) { //4 input characters at a time\r\n c1 = s.charAt(i); //the 1st base64 input characther\r\n c2 = s.charAt(i+1);\r\n c3 = s.charAt(i+2);\r\n c4 = s.charAt(i+3);\r\n r += String.fromCharCode (((decode[c1] << 2) & 0xff) | (decode[c2] >> 4)); //reform the string\r\n if (c3 != '=') r += String.fromCharCode (((decode[c2] << 4) & 0xff) | (decode[c3] >> 2));\r\n if (c4 != '=') r += String.fromCharCode (((decode[c3] << 6) & 0xff) | decode[c4]);\r\n }\r\n return r;\r\n}", "function base64(s)\n\t{\n\t\tvar ch =\n\t\t\t\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\t\tvar c1\n\t\t , c2\n\t\t , c3\n\t\t , e1\n\t\t , e2\n\t\t , e3\n\t\t , e4;\n\t\tvar l = s.length;\n\t\tvar i = 0;\n\t\tvar r = \"\";\n\n\t\tdo\n\t\t\t{\n\t\t\t\tc1 = s.charCodeAt(i);\n\t\t\t\te1 = c1 >> 2;\n\t\t\t\tc2 = s.charCodeAt(i + 1);\n\t\t\t\te2 = ((c1 & 3) << 4) | (c2 >> 4);\n\t\t\t\tc3 = s.charCodeAt(i + 2);\n\t\t\t\tif (l < i + 2) e3 = 64;\n\t\t\t\telse e3 = ((c2 & 0xf) << 2) | (c3 >> 6);\n\t\t\t\tif (l < i + 3) e4 = 64;\n\t\t\t\telse e4 = c3 & 0x3f;\n\t\t\t\tr += ch.charAt(e1) + ch.charAt(e2) + ch.charAt(e3) + ch.charAt(e4);\n\t\t\t}\n\t\twhile ((i += 3) < l);\n\n\t\treturn r;\n\t}", "function fromBase64(base64) {\n return base64\n .replace(/=/g, \"\")\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\");\n}", "function base64_url_decode(data) {\n return new Buffer(data.replace(/-/g, '+').replace(/_/g, '/'), 'base64').toString('ascii');\n}" ]
[ "0.8253048", "0.810408", "0.8092335", "0.8054918", "0.8038858", "0.8022879", "0.7992094", "0.7969552", "0.7969552", "0.7945164", "0.7945164", "0.79449964", "0.79290575", "0.79279673", "0.7888982", "0.78838384", "0.7867639", "0.7675953", "0.7584292", "0.7412218", "0.7359118", "0.7268635", "0.7258627", "0.7214309", "0.71885824", "0.71360993", "0.7099121", "0.7085739", "0.7078497", "0.7026223" ]
0.8505418
0
Convert a base64url encoded string to a Buffer ``` > base64url.toBuffer('c3Bpcml0dWFsaXplZA') ```
function toBuffer(base64url) { return new Buffer(toBase64(base64url), "base64"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function base64ToBuffer(s) {\n var l = s.length * 6 / 8\n if(s[s.length - 2] == '=')\n l = l - 2\n else\n if(s[s.length - 1] == '=')\n l = l - 1\n\n var b = new Buffer(l)\n b.write(s, 'base64')\n return b\n}", "function base64ToBuffer( str ) {\n\n\t\t\tvar b = atob( str );\n\t\t\tvar buf = new Uint8Array( b.length );\n\n\t\t\tfor ( var i = 0, l = buf.length; i < l; i ++ ) {\n\n\t\t\t\tbuf[ i ] = b.charCodeAt( i );\n\n\t\t\t}\n\n\t\t\treturn buf;\n\n\t\t}", "function fromBase64Url(data) {\n var input = data.padRight(data.length + (4 - data.length % 4) % 4, '=')\n .replace(/\\-/g, '+')\n .replace(/_/g, '/');\n\n return toArrayBuffer(atob(input));\n}", "function base64ToArrayBuffer(base64) {\n if(base64==null || base64=='')\n return;\n var binaryString = window.atob(base64);\n var binaryLen = binaryString.length;\n var bytes = new Uint8Array(binaryLen);\n for (var i = 0; i < binaryLen; i++) {\n var ascii = binaryString.charCodeAt(i);\n bytes[i] = ascii;\n }\n Download('new',bytes);\n}", "function decode(base64url, encoding) {\n if (encoding === void 0) { encoding = \"utf8\"; }\n return new Buffer(toBase64(base64url), \"base64\").toString(encoding);\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polyfill https://github.com/davidchambers/Base64.js\n }", "function base64_url_decode(data) {\n return new Buffer(data.replace(/-/g, '+').replace(/_/g, '/'), 'base64').toString('ascii');\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n }", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n }", "function base64StringToArrayBuffer(str) {\n if (useNodeBuffer) {\n var buf = Buffer.from(str, 'base64');\n return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n }\n var s = atob(str);\n var buffer = new Uint8Array(s.length);\n for (var i = 0; i < s.length; ++i) {\n buffer.set([s.charCodeAt(i)], i);\n }\n return buffer.buffer;\n}", "function url_base64_decode(str) {\n\t var output = str.replace('-', '+').replace('_', '/');\n\t switch (output.length % 4) {\n\t\tcase 0:\n\t\t break;\n\t\tcase 2:\n\t\t output += '==';\n\t\t break;\n\t\tcase 3:\n\t\t output += '=';\n\t\t break;\n\t\tdefault:\n\t\t throw 'Illegal base64url string!';\n\t }\n\t return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n\t}", "function base64StringToArrayBuffer(str) {\n if (useNodeBuffer) {\n const buf = Buffer.from(str, 'base64');\n return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n }\n const s = atob(str);\n const buffer = new Uint8Array(s.length);\n for (let i = 0; i < s.length; ++i) {\n buffer.set([s.charCodeAt(i)], i);\n }\n return buffer.buffer;\n}", "function btoa(str) {\n var buffer;\n\n if (str instanceof Buffer) {\n buffer = str;\n } else {\n buffer = new Buffer(str.toString(), 'binary');\n }\n\n return buffer.toString('base64');\n}", "function toUrlString(buffer) {\n return buffer.toString('base64')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=/g, '');\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output);\n }", "function base64urldecode(encodedString) {\n encodedString = encodedString.replace(/-/g, '+').replace(/_/g, '/');\n encodedString += ['', '', '==', '='][encodedString.length % 4];\n return new Buffer(encodedString, 'base64');\n}", "function base64ToArrayBuffer(base64String) {\r\n var padding = '='.repeat((4 - base64String.length % 4) % 4);\r\n var base64 = (base64String + padding)\r\n .replace(/\\-/g, '+')\r\n .replace(/_/g, '/');\r\n var rawData = atob(base64);\r\n var outputArray = new Uint8Array(rawData.length);\r\n for (var i = 0; i < rawData.length; ++i) {\r\n outputArray[i] = rawData.charCodeAt(i);\r\n }\r\n return outputArray;\r\n}", "function base64ToArrayBuffer(base64String) {\n var padding = '='.repeat((4 - base64String.length % 4) % 4);\n var base64 = (base64String + padding)\n .replace(/\\-/g, '+')\n .replace(/_/g, '/');\n var rawData = atob(base64);\n var outputArray = new Uint8Array(rawData.length);\n for (var i = 0; i < rawData.length; ++i) {\n outputArray[i] = rawData.charCodeAt(i);\n }\n return outputArray;\n}", "function base64ToArrayBuffer(base64String) {\n var padding = '='.repeat((4 - base64String.length % 4) % 4);\n var base64 = (base64String + padding)\n .replace(/\\-/g, '+')\n .replace(/_/g, '/');\n var rawData = atob(base64);\n var outputArray = new Uint8Array(rawData.length);\n for (var i = 0; i < rawData.length; ++i) {\n outputArray[i] = rawData.charCodeAt(i);\n }\n return outputArray;\n}", "function _base64ToArrayBuffer(base64){\n var binary_string = window.atob(base64);\n var len = binary_string.length;\n var bytes = new Uint8Array( len );\n for (var i = 0; i < len; i++)\n bytes[i] = binary_string.charCodeAt(i);\n return bytes.buffer;\n}", "function btoa (string) {\n // REF: https://stackoverflow.com/questions/246801/how-can-you-encode-a-string-to-base64-in-javascript\n // It might sound wired, but we have to use 'ascii' to get the 'utf8' chars to be encoded/decoded correctly\n\n return Buffer.from(string, 'ascii').toString('base64');\n}", "function base64ToArrayBuffer(base64) {\n var binaryString = window.atob(base64);\n var len = binaryString.length;\n var bytes = new Uint8Array(len);\n\n for (var i = 0; i < len; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n\n return bytes.buffer;\n}", "function _base64ToArrayBuffer(base64){\n base64 = base64.split('data:image/png;base64,').join('');\n var binary_string = window.atob(base64),\n len = binary_string.length,\n bytes = new Uint8Array( len ),\n i;\n for (i = 0; i < len; i++){\n bytes[i] = binary_string.charCodeAt(i);\n }\n return bytes.buffer;\n}", "function _base64ToArrayBuffer(base64){\n base64 = base64.split('data:image/png;base64,').join('');\n var binary_string = window.atob(base64),\n len = binary_string.length,\n bytes = new Uint8Array( len ),\n i;\n for (i = 0; i < len; i++){\n bytes[i] = binary_string.charCodeAt(i);\n }\n return bytes.buffer;\n}", "static base64Decode(base64Str) {\n return Buffer.from(base64Str, \"base64\").toString(\"utf8\");\n }", "function stringToBase64Url(str) {\n var b64 = btoa(str);\n return base64ToBase64Url(b64);\n } // converts a standard base64-encoded string to a \"url/filename safe\" variant", "function url_base64_decode(str) {\n\tvar output = str.replace(/-/g, '+').replace(/_/g, '/');\n\tswitch (output.length % 4) {\n\t\tcase 0:\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\toutput += '==';\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\toutput += '=';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow 'Illegal base64url string!';\n\t}\n\tvar result = window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n\ttry {\n\t\treturn decodeURIComponent(escape(result));\n\t} catch (err) {\n\t\treturn result;\n\t}\n}" ]
[ "0.7596794", "0.7490258", "0.71877104", "0.68810594", "0.6857738", "0.6816563", "0.6808298", "0.6806062", "0.6789498", "0.6786183", "0.6778464", "0.677261", "0.6742628", "0.6730694", "0.67012304", "0.66876876", "0.6680805", "0.66783303", "0.6665888", "0.66353947", "0.66345745", "0.66345745", "0.6602782", "0.65603256", "0.65250087", "0.6523428", "0.6523428", "0.6515355", "0.6476", "0.64630234" ]
0.8812362
0
Further exploration Find the middle word of a phrase and take care of all edge cases
function middleWord(string) { if (string.trim() !== '') { let wordsArray = string.split(' '); if (wordsArray.length % 2 === 1) { return wordsArray[Math.floor(wordsArray.length / 2)]; } else { return wordsArray[(wordsArray.length / 2) - 1] + ' ' + wordsArray[wordsArray.length / 2]; } } else { return 'Error: The string is empty'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findMiddle(word) {\n if (word.length % 2 === 0) {\n let mid1 = Math.floor(word.length / 2) - 1;\n let mid2 = mid1 + 1;\n return word[mid1] + word[mid2];\n } else {\n let mid = Math.floor(word.length / 2);\n return word[mid];\n }\n //console.log(s.length);\n //console.log(Math.ceil(s.length / 2 - 1));\n //return s.substr(Math.ceil(s.length / 2 - 1), s.length % 2 === 0 ? 2 : 1);\n}", "function middleWord(string) {\n string = string.split(' ');\n let stringIndex = string.length;\n if (string.length % 2 === 0) {\n stringIndex = string.length / 2;\n } else {\n stringIndex = (string.length - 1) / 2;\n console.log(\"This is an odd string number:\")\n }\n return string[stringIndex];\n}", "function getCorrectWord(word, wordIndex, text) {\n if (word === \"your\") {\n if (text.substring(wordIndex, wordIndex + word.length + 2) === \"your a \") {\n // Assume they're trying to say \"you're a ___\"\n return \"you're\";\n }\n if (text.substring(wordIndex, wordIndex + word.length + 3) === \"your an \") {\n // Assume they're trying to say \"you're an ___\"\n return \"you're\";\n }\n if (text.substring(wordIndex, wordIndex + word.length + 3) === \"your my \") {\n // Assume they're trying to say \"you're my ___\"\n return \"you're\";\n }\n if (text.substring(wordIndex, wordIndex + word.length + 4) === \"your the \") {\n // Assume they're trying to say \"you're the ___\"\n return \"you're\";\n }\n }\n if (word === \"youre\") {\n // This is just a misspelling\n return \"you're\";\n }\n return null;\n}", "function findMiddleIndex(text){\n var text = \"Hello\"; \n var length = text.length;\n console.log(Math.floor(length / 2));\n}", "function phrase() {\n return wrap('phrase', or(obsPhrase, star(word, 1))());\n }", "function phrase() {\n return wrap('phrase', or(obsPhrase, star(word, 1))());\n }", "function phrase() {\n return wrap('phrase', or(obsPhrase, star(word, 1))());\n }", "function phrase() {\n return wrap('phrase', or(obsPhrase, star(word, 1))());\n }", "function processWord(word) {\n var optimalRecognitionposition = Math.floor(word.length / 3),\n letters = word.split('')\n return letters.map(function(letter, idx) {\n if (idx === optimalRecognitionposition)\n return '<span class=\"highlight\">' + letter + '</span>'\n return letter;\n }).join('')\n }", "function teachManners(phrase) {\n return phrase.toLowerCase().replace(exclamations, '');\n\n}", "step3a (word) {\n let result = word\n if (endsin(result, 'heid') && result.length - 4 >= this.r2 && result[result.length - 5] !== 'c') {\n // Delete\n result = removeSuffix(result, 4)\n // Treat a preceding en as in step 1b\n result = this.step1b(result, ['en'])\n }\n if (DEBUG) {\n console.log('step 3a: ' + result)\n }\n return result\n }", "function getFirstWord(selection) {\n if (selection.indexOf(' ') === -1)\n return selection;\n else\n return selection.substr(0, selection.indexOf(' '));\n }", "function getMiddle(s)\n{\ns = s.split('')\nreturn (s.length%2 !==0) ? s[Math.floor(s.length/2)] : s[(s.length/2)-1]+s[(s.length/2)]\n}", "function makespeakable(phrase) {\n phrase = phrase.replace(/['\"]/g, \"\");\n phrase = phrase.replace(/[-+]/g, \" \");\n phrase = phrase.replace(/([A-Z])(?=[A-Z])/g, \"$1 \"); //split apart capitals\n phrase = phrase.replace(/([A-Za-z])([0-9])/g, \"$1 $2\"); // split letter-number\n phrase = phrase.replace(/([0-9])([A-Za-z])/g, \"$1 $2\"); // split number-letter\n return phrase.replace(/\\b[A-Z](?=[[:space:][:punct:]])/g, function(match) {\n return say_letter[match.toUpperCase()];\n })\n .replace(/[0-9]+ ?(st|nd|rd|th)\\b/g, function(match) {\n return n2w.toOrdinalWords(parseInt(match)).replace(/[-,]/g, \" \");\n })\n .replace(/[0-9]+/g, function(match) {\n return n2w.toWords(match).replace(/[-,]/g, \" \");\n });\n}", "function getMiddle(s) {\n //Code goes here!\n const strArray = s.split('')\n const evenLength = s.length % 2 === 0\n\n if (evenLength) {\n const half = strArray.length / 2\n return `${strArray[half - 1]}${strArray[half]}`\n }\n\n const half = Math.floor(strArray.length / 2)\n return strArray[half]\n}", "function spEng(sentence){\n//write your code here\n\n let english = \"english\"\n\n let first = 0\n\n let second = 0\n\n console.log(sentence)\n\n let lower = sentence.toLowerCase()\n\n// let look = sentence.split(\"\").map( (x, y) => sentence[y].toLowerCase() == english.split(\"\").map( x => x) ? true: false)\n\n// console.log(\"Word: \", sentence, \"split: \", sentence.split(\"\"), \"map: \", look)\n\n for(let i = 0; i < sentence.length; i++){\n\n if(lower[i] == \"e\"){\n\n first = i\n\n console.log(\"first: \", lower[i], first, sentence.length)\n\n }\n\n if(lower[i] == \"h\"){\n\n second = i + 1\n\n console.log(\"second: \", sentence[i], second)\n\n }\n\n\n if(lower.substring(first, second) == english){\n\n return true;\n\n }\n\n\n\n }\n\n return false;\n\n\n}", "function getFirstWord(str) {\n\t\tstr = str.replace('By ', '');\n if (str.indexOf(' ') === -1)\n return str;\n else\n return str.substr(0, str.indexOf(' '));\n }", "function firstWord (text) {\n let firstBlank = text.indexOf(' ');\n \n let fWord = text.substr(0, firstBlank);\n return fWord;\n}", "function getMiddle(s) {\n return s.substring(Math.ceil(s.length/2)-1, Math.floor(s.length/2) + 1);\n}", "function parseWords(text)\n{\n\n\t//return elements\n\tvar returnBuf = \"\";\n\n\t//split input string with RegExo\n\tvar tokens = text.match(spaceRegEx);\n\tvar substrL = 0;\n\n\tfor (i in tokens) //JRO - hack to only process one token at a time\n\t{\n\t\t//If the element isn't the last in an array, it is a new word\n\t\t//if ((i<tokens.length - 1) && tokens[i] !== \"\")\n\t\tif ((i == 0) && (i<tokens.length - 1) && tokens[i] !== \"\") //JRO - hack to only process one token at a time\n\t\t//if ((i == 0) && (i<tokens.length - 1))\n\t\t{\n\t\t\tvar tok = tokens[i];\n\t\t\t\n\t\t\t//console.log(\"\");\n\t\t\t//console.log(\"tok:\"+tok + \" l:\"+tok.length );\n\n\t\t\tsubstrL += tokens[i].length+1;\n\n\t\t\t// strip any leading punctuation\n\t\t\tvar leadPunct = tok.match(leadPunctRegEx);\n\t\t\tif (leadPunct) {\n\t\t\t\t//NOTE: substring was not working correctly ... might actually be length that was off\n\t\t\t\t//using replace instead\n\t\t\t\ttok = tok.replace(leadPunct, \"\");\n\t\t\t\t//console.log('lead p ' + leadPunct);\n\t\t\t}\n\t\t\t//console.log(\"tok1:\"+tok);\n\n\t\t\t// pull any numbers\n\n\t\t\tvar word;\n\t\t\tvar sentenceEnd = false;\n\n\t\t\tvar numWord = tok.match(numberRegEx);\n\t\t\tif (numWord) {\n\t\t\t\t//console.log('number');\n\t\t\t\tword = numWord;\n\t\t\t}\n\t\t\t//console.log(\"tok2:\"+tok);\n\n\t\t\t// pull any abbreviations\n\t\t\t// PEND: broken \n\t\t\tvar abbrevWord = tok.match(abbrevRegEx);\n\t\t\tif (abbrevWord && !word) {\n\t\t\t\t//console.log('abbrev');\n\t\t\t\tword = abbrevWord;\n\t\t\t}\n\t\t\t//console.log(\"tok3:\"+tok);\n\n\t\t\t// pull out word\n\t\t\tvar plainWord = tok.match(wordRegEx);\n\t\t\tif (plainWord && !word) {\n\t\t\t\tword = plainWord;\n\t\t\t}\n\t\t\t//console.log(\"tok4:\"+tok);\n\n\t\t\t//if (word) console.log(\"Word: \" + word);\n\n\t\t\t//look for final punctutation, the leftovers\n\t\t\tvar endPunct = tok.replace(word, \"\");\n\t\t\t//if (endPunct) console.log('punct ' + endPunct);\n\n\t\t\t// check if sentence end\n\t\t\tif (endPunct.search(sentenceEndRegEx) != -1) {\n\t\t\t\tsentenceEnd = true;\n\t\t\t\t//console.log('END SENTENCE');\n\t\t\t}\n\n\t\t\tvar speakerSwitch = false;\n\n\t\t\t//spealer switching handled with special words\n\t\t\tif (word && common.usingDoc)\n\t\t\t{\t\t\t\n\t\t\t\tif (word == \"MODERATOR\" || word == \"QUESTION\" || word == \"BROKAW\" || word == \"IFILL\" || word == \"LEHRER\" || word == \"RADDATZ\") {\n\t\t\t\t\tcurSpeaker = 0;\n\t\t\t\t\tspeakerSwitch = true;\n\t\t\t\t}\n\t\t\t\telse if (word == \"OBAMA\" || word == \"BIDEN\") {\n\t\t\t\t\tcurSpeaker = 1;\n\t\t\t\t\tspeakerSwitch = true;\n\t\t\t\t}\n\t\t\t\telse if (word == \"MCCAIN\" || word == \"ROMNEY\" || word == \"PALIN\" || word == \"RYAN\") {\n\t\t\t\t\tcurSpeaker = 2;\n\t\t\t\t\tspeakerSwitch = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//words for live uploading\n\t\t\telse if (word)\n\t\t\t{\n\t\t\t\tif (word == \"SPEAKER_MODERATOR\") {\n\t\t\t\t\tcurSpeaker = 0;\n\t\t\t\t\tspeakerSwitch = true;\n\t\t\t\t}\n\t\t\t\telse if (word == \"SPEAKER_OBAMA\") {\n\t\t\t\t\tcurSpeaker = 1;\n\t\t\t\t\tspeakerSwitch = true;\n\t\t\t\t}\n\t\t\t\telse if (word == \"SPEAKER_ROMNEY\") {\n\t\t\t\t\tcurSpeaker = 2;\n\t\t\t\t\tspeakerSwitch = true;\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tif (!speakerSwitch)\n\t\t\t{\n\t\t\t\tif (common.dbUnlocked()) {\n\t\t\t\t\tif (!common.usingDoc) {\n\t\t\t\t\t\tnamedentity(word, sentenceStartF, function(resp) {\n\t\t\t\t\t\t\thandleWord(curSpeaker, leadPunct, resp, endPunct, sentenceEnd, speakerSwitch); \n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (word)\n\t\t\t\t\t\t\thandleWord(curSpeaker, leadPunct, word.toString(), endPunct, sentenceEnd, speakerSwitch); \n\t\t\t\t\t}\n\t\t\t\t} //else console.log ('parseWords(): DB is Locked, not adding data');\n\t\t\t}\n\n\n\t\t}\n\t\t//Otherwise this should be returned as part of the buffer\n\t\telse {\n\t\t\treturnBuf = text.substring(substrL);\n\t\t}\n\t}\n\n\t//return both the current buffer and the found words\n\treturn returnBuf;\n\n}", "function doubleMetaphone(value) {\n var primary = ''\n var secondary = ''\n var index = 0\n var length = value.length\n var last = length - 1\n var isSlavoGermanic\n var isGermanic\n var subvalue\n var next\n var prev\n var nextnext\n var characters\n\n value = String(value).toUpperCase() + ' '\n isSlavoGermanic = slavoGermanic.test(value)\n isGermanic = germanic.test(value)\n characters = value.split('')\n\n // Skip this at beginning of word.\n if (initialExceptions.test(value)) {\n index++\n }\n\n // Initial X is pronounced Z, which maps to S. Such as `Xavier`.\n if (characters[0] === 'X') {\n primary += 'S'\n secondary += 'S'\n index++\n }\n\n while (index < length) {\n prev = characters[index - 1]\n next = characters[index + 1]\n nextnext = characters[index + 2]\n\n switch (characters[index]) {\n case 'A':\n case 'E':\n case 'I':\n case 'O':\n case 'U':\n case 'Y':\n case 'À':\n case 'Ê':\n case 'É':\n if (index === 0) {\n // All initial vowels now map to `A`.\n primary += 'A'\n secondary += 'A'\n }\n\n index++\n\n break\n case 'B':\n primary += 'P'\n secondary += 'P'\n\n if (next === 'B') {\n index++\n }\n\n index++\n\n break\n case 'Ç':\n primary += 'S'\n secondary += 'S'\n index++\n\n break\n case 'C':\n // Various Germanic:\n if (\n prev === 'A' &&\n next === 'H' &&\n nextnext !== 'I' &&\n !vowels.test(characters[index - 2]) &&\n (nextnext !== 'E' ||\n (subvalue =\n value.slice(index - 2, index + 4) &&\n (subvalue === 'BACHER' || subvalue === 'MACHER')))\n ) {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n // Special case for `Caesar`.\n if (index === 0 && value.slice(index + 1, index + 6) === 'AESAR') {\n primary += 'S'\n secondary += 'S'\n index += 2\n\n break\n }\n\n // Italian `Chianti`.\n if (value.slice(index + 1, index + 4) === 'HIA') {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n if (next === 'H') {\n // Find `Michael`.\n if (index > 0 && nextnext === 'A' && characters[index + 3] === 'E') {\n primary += 'K'\n secondary += 'X'\n index += 2\n\n break\n }\n\n // Greek roots such as `chemistry`, `chorus`.\n if (index === 0 && initialGreekCh.test(value)) {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n // Germanic, Greek, or otherwise `CH` for `KH` sound.\n if (\n isGermanic ||\n // Such as 'architect' but not 'arch', orchestra', 'orchid'.\n greekCh.test(value.slice(index - 2, index + 4)) ||\n (nextnext === 'T' || nextnext === 'S') ||\n ((index === 0 ||\n prev === 'A' ||\n prev === 'E' ||\n prev === 'O' ||\n prev === 'U') &&\n // Such as `wachtler`, `weschsler`, but not `tichner`.\n chForKh.test(nextnext))\n ) {\n primary += 'K'\n secondary += 'K'\n } else if (index === 0) {\n primary += 'X'\n secondary += 'X'\n // Such as 'McHugh'.\n } else if (value.slice(0, 2) === 'MC') {\n // Bug? Why matching absolute? what about McHiccup?\n primary += 'K'\n secondary += 'K'\n } else {\n primary += 'X'\n secondary += 'K'\n }\n\n index += 2\n\n break\n }\n\n // Such as `Czerny`.\n if (next === 'Z' && value.slice(index - 2, index) !== 'WI') {\n primary += 'S'\n secondary += 'X'\n index += 2\n\n break\n }\n\n // Such as `Focaccia`.\n if (value.slice(index + 1, index + 4) === 'CIA') {\n primary += 'X'\n secondary += 'X'\n index += 3\n\n break\n }\n\n // Double `C`, but not `McClellan`.\n if (next === 'C' && !(index === 1 && characters[0] === 'M')) {\n // Such as `Bellocchio`, but not `Bacchus`.\n if (\n (nextnext === 'I' || nextnext === 'E' || nextnext === 'H') &&\n value.slice(index + 2, index + 4) !== 'HU'\n ) {\n subvalue = value.slice(index - 1, index + 4)\n\n // Such as `Accident`, `Accede`, `Succeed`.\n if (\n (index === 1 && prev === 'A') ||\n subvalue === 'UCCEE' ||\n subvalue === 'UCCES'\n ) {\n primary += 'KS'\n secondary += 'KS'\n // Such as `Bacci`, `Bertucci`, other Italian.\n } else {\n primary += 'X'\n secondary += 'X'\n }\n\n index += 3\n\n break\n } else {\n // Pierce's rule.\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n }\n\n if (next === 'G' || next === 'K' || next === 'Q') {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n // Italian.\n if (\n next === 'I' &&\n // Bug: The original algorithm also calls for A (as in CIA), which is\n // already taken care of above.\n (nextnext === 'E' || nextnext === 'O')\n ) {\n primary += 'S'\n secondary += 'X'\n index += 2\n\n break\n }\n\n if (next === 'I' || next === 'E' || next === 'Y') {\n primary += 'S'\n secondary += 'S'\n index += 2\n\n break\n }\n\n primary += 'K'\n secondary += 'K'\n\n // Skip two extra characters ahead in `Mac Caffrey`, `Mac Gregor`.\n if (\n next === ' ' &&\n (nextnext === 'C' || nextnext === 'G' || nextnext === 'Q')\n ) {\n index += 3\n break\n }\n\n // Bug: Already covered above.\n // if (\n // next === 'K' ||\n // next === 'Q' ||\n // (next === 'C' && nextnext !== 'E' && nextnext !== 'I')\n // ) {\n // index++;\n // }\n\n index++\n\n break\n case 'D':\n if (next === 'G') {\n // Such as `edge`.\n if (nextnext === 'E' || nextnext === 'I' || nextnext === 'Y') {\n primary += 'J'\n secondary += 'J'\n index += 3\n // Such as `Edgar`.\n } else {\n primary += 'TK'\n secondary += 'TK'\n index += 2\n }\n\n break\n }\n\n if (next === 'T' || next === 'D') {\n primary += 'T'\n secondary += 'T'\n index += 2\n\n break\n }\n\n primary += 'T'\n secondary += 'T'\n index++\n\n break\n case 'F':\n if (next === 'F') {\n index++\n }\n\n index++\n primary += 'F'\n secondary += 'F'\n\n break\n case 'G':\n if (next === 'H') {\n if (index > 0 && !vowels.test(prev)) {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n // Such as `Ghislane`, `Ghiradelli`.\n if (index === 0) {\n if (nextnext === 'I') {\n primary += 'J'\n secondary += 'J'\n } else {\n primary += 'K'\n secondary += 'K'\n }\n\n index += 2\n\n break\n }\n\n // Parker's rule (with some further refinements).\n if (\n // Such as `Hugh`. The comma is not a bug.\n ((subvalue = characters[index - 2]),\n subvalue === 'B' || subvalue === 'H' || subvalue === 'D') ||\n // Such as `bough`. The comma is not a bug.\n ((subvalue = characters[index - 3]),\n subvalue === 'B' || subvalue === 'H' || subvalue === 'D') ||\n // Such as `Broughton`. The comma is not a bug.\n ((subvalue = characters[index - 4]),\n subvalue === 'B' || subvalue === 'H')\n ) {\n index += 2\n\n break\n }\n\n // Such as `laugh`, `McLaughlin`, `cough`, `gough`, `rough`, `tough`.\n if (index > 2 && prev === 'U' && gForF.test(characters[index - 3])) {\n primary += 'F'\n secondary += 'F'\n } else if (index > 0 && prev !== 'I') {\n primary += 'K'\n secondary += 'K'\n }\n\n index += 2\n\n break\n }\n\n if (next === 'N') {\n if (index === 1 && vowels.test(characters[0]) && !isSlavoGermanic) {\n primary += 'KN'\n secondary += 'N'\n // Not like `Cagney`.\n } else if (\n value.slice(index + 2, index + 4) !== 'EY' &&\n value.slice(index + 1) !== 'Y' &&\n !isSlavoGermanic\n ) {\n primary += 'N'\n secondary += 'KN'\n } else {\n primary += 'KN'\n secondary += 'KN'\n }\n\n index += 2\n\n break\n }\n\n // Such as `Tagliaro`.\n if (value.slice(index + 1, index + 3) === 'LI' && !isSlavoGermanic) {\n primary += 'KL'\n secondary += 'L'\n index += 2\n\n break\n }\n\n // -ges-, -gep-, -gel- at beginning.\n if (index === 0 && initialGForKj.test(value.slice(1, 3))) {\n primary += 'K'\n secondary += 'J'\n index += 2\n\n break\n }\n\n // -ger-, -gy-.\n if (\n (value.slice(index + 1, index + 3) === 'ER' &&\n prev !== 'I' &&\n prev !== 'E' &&\n !initialAngerException.test(value.slice(0, 6))) ||\n (next === 'Y' && !gForKj.test(prev))\n ) {\n primary += 'K'\n secondary += 'J'\n index += 2\n\n break\n }\n\n // Italian such as `biaggi`.\n if (\n next === 'E' ||\n next === 'I' ||\n next === 'Y' ||\n ((prev === 'A' || prev === 'O') && next === 'G' && nextnext === 'I')\n ) {\n // Obvious Germanic.\n if (value.slice(index + 1, index + 3) === 'ET' || isGermanic) {\n primary += 'K'\n secondary += 'K'\n } else {\n primary += 'J'\n\n // Always soft if French ending.\n if (value.slice(index + 1, index + 5) === 'IER ') {\n secondary += 'J'\n } else {\n secondary += 'K'\n }\n }\n\n index += 2\n\n break\n }\n\n if (next === 'G') {\n index++\n }\n\n index++\n\n primary += 'K'\n secondary += 'K'\n\n break\n case 'H':\n // Only keep if first & before vowel or btw. 2 vowels.\n if (vowels.test(next) && (index === 0 || vowels.test(prev))) {\n primary += 'H'\n secondary += 'H'\n\n index++\n }\n\n index++\n\n break\n case 'J':\n // Obvious Spanish, `jose`, `San Jacinto`.\n if (\n value.slice(index, index + 4) === 'JOSE' ||\n value.slice(0, 4) === 'SAN '\n ) {\n if (\n value.slice(0, 4) === 'SAN ' ||\n (index === 0 && characters[index + 4] === ' ')\n ) {\n primary += 'H'\n secondary += 'H'\n } else {\n primary += 'J'\n secondary += 'H'\n }\n\n index++\n\n break\n }\n\n if (\n index === 0\n // Bug: unreachable (see previous statement).\n // && value.slice(index, index + 4) !== 'JOSE'.\n ) {\n primary += 'J'\n\n // Such as `Yankelovich` or `Jankelowicz`.\n secondary += 'A'\n // Spanish pron. of such as `bajador`.\n } else if (\n !isSlavoGermanic &&\n (next === 'A' || next === 'O') &&\n vowels.test(prev)\n ) {\n primary += 'J'\n secondary += 'H'\n } else if (index === last) {\n primary += 'J'\n } else if (\n prev !== 'S' &&\n prev !== 'K' &&\n prev !== 'L' &&\n !jForJException.test(next)\n ) {\n primary += 'J'\n secondary += 'J'\n // It could happen.\n } else if (next === 'J') {\n index++\n }\n\n index++\n\n break\n case 'K':\n if (next === 'K') {\n index++\n }\n\n primary += 'K'\n secondary += 'K'\n index++\n\n break\n case 'L':\n if (next === 'L') {\n // Spanish such as `cabrillo`, `gallegos`.\n if (\n (index === length - 3 &&\n ((prev === 'A' && nextnext === 'E') ||\n (prev === 'I' && (nextnext === 'O' || nextnext === 'A')))) ||\n (prev === 'A' &&\n nextnext === 'E' &&\n (characters[last] === 'A' ||\n characters[last] === 'O' ||\n alle.test(value.slice(last - 1, length))))\n ) {\n primary += 'L'\n index += 2\n\n break\n }\n\n index++\n }\n\n primary += 'L'\n secondary += 'L'\n index++\n\n break\n case 'M':\n if (\n next === 'M' ||\n // Such as `dumb`, `thumb`.\n (prev === 'U' &&\n next === 'B' &&\n (index + 1 === last || value.slice(index + 2, index + 4) === 'ER'))\n ) {\n index++\n }\n\n index++\n primary += 'M'\n secondary += 'M'\n\n break\n case 'N':\n if (next === 'N') {\n index++\n }\n\n index++\n primary += 'N'\n secondary += 'N'\n\n break\n case 'Ñ':\n index++\n primary += 'N'\n secondary += 'N'\n\n break\n case 'P':\n if (next === 'H') {\n primary += 'F'\n secondary += 'F'\n index += 2\n\n break\n }\n\n // Also account for `campbell` and `raspberry`.\n subvalue = next\n\n if (subvalue === 'P' || subvalue === 'B') {\n index++\n }\n\n index++\n\n primary += 'P'\n secondary += 'P'\n\n break\n case 'Q':\n if (next === 'Q') {\n index++\n }\n\n index++\n primary += 'K'\n secondary += 'K'\n\n break\n case 'R':\n // French such as `Rogier`, but exclude `Hochmeier`.\n if (\n index === last &&\n !isSlavoGermanic &&\n prev === 'E' &&\n characters[index - 2] === 'I' &&\n characters[index - 4] !== 'M' &&\n (characters[index - 3] !== 'E' && characters[index - 3] !== 'A')\n ) {\n secondary += 'R'\n } else {\n primary += 'R'\n secondary += 'R'\n }\n\n if (next === 'R') {\n index++\n }\n\n index++\n\n break\n case 'S':\n // Special cases `island`, `isle`, `carlisle`, `carlysle`.\n if (next === 'L' && (prev === 'I' || prev === 'Y')) {\n index++\n\n break\n }\n\n // Special case `sugar-`.\n if (index === 0 && value.slice(1, 5) === 'UGAR') {\n primary += 'X'\n secondary += 'S'\n index++\n\n break\n }\n\n if (next === 'H') {\n // Germanic.\n if (hForS.test(value.slice(index + 1, index + 5))) {\n primary += 'S'\n secondary += 'S'\n } else {\n primary += 'X'\n secondary += 'X'\n }\n\n index += 2\n break\n }\n\n if (\n next === 'I' &&\n (nextnext === 'O' || nextnext === 'A')\n // Bug: Already covered by previous branch\n // || value.slice(index, index + 4) === 'SIAN'\n ) {\n if (isSlavoGermanic) {\n primary += 'S'\n secondary += 'S'\n } else {\n primary += 'S'\n secondary += 'X'\n }\n\n index += 3\n\n break\n }\n\n // German & Anglicization's, such as `Smith` match `Schmidt`, `snider`\n // match `Schneider`. Also, -sz- in slavic language although in\n // hungarian it is pronounced `s`.\n if (\n next === 'Z' ||\n (index === 0 &&\n (next === 'L' || next === 'M' || next === 'N' || next === 'W'))\n ) {\n primary += 'S'\n secondary += 'X'\n\n if (next === 'Z') {\n index++\n }\n\n index++\n\n break\n }\n\n if (next === 'C') {\n // Schlesinger's rule.\n if (nextnext === 'H') {\n subvalue = value.slice(index + 3, index + 5)\n\n // Dutch origin, such as `school`, `schooner`.\n if (dutchSch.test(subvalue)) {\n // Such as `schermerhorn`, `schenker`.\n if (subvalue === 'ER' || subvalue === 'EN') {\n primary += 'X'\n secondary += 'SK'\n } else {\n primary += 'SK'\n secondary += 'SK'\n }\n\n index += 3\n\n break\n }\n\n if (\n index === 0 &&\n !vowels.test(characters[3]) &&\n characters[3] !== 'W'\n ) {\n primary += 'X'\n secondary += 'S'\n } else {\n primary += 'X'\n secondary += 'X'\n }\n\n index += 3\n\n break\n }\n\n if (nextnext === 'I' || nextnext === 'E' || nextnext === 'Y') {\n primary += 'S'\n secondary += 'S'\n index += 3\n break\n }\n\n primary += 'SK'\n secondary += 'SK'\n index += 3\n\n break\n }\n\n subvalue = value.slice(index - 2, index)\n\n // French such as `resnais`, `artois`.\n if (index === last && (subvalue === 'AI' || subvalue === 'OI')) {\n secondary += 'S'\n } else {\n primary += 'S'\n secondary += 'S'\n }\n\n if (\n next === 'S'\n // Bug: already taken care of by `German & Anglicization's` above:\n // || next === 'Z'\n ) {\n index++\n }\n\n index++\n\n break\n case 'T':\n if (next === 'I' && nextnext === 'O' && characters[index + 3] === 'N') {\n primary += 'X'\n secondary += 'X'\n index += 3\n\n break\n }\n\n subvalue = value.slice(index + 1, index + 3)\n\n if (\n (next === 'I' && nextnext === 'A') ||\n (next === 'C' && nextnext === 'H')\n ) {\n primary += 'X'\n secondary += 'X'\n index += 3\n\n break\n }\n\n if (next === 'H' || (next === 'T' && nextnext === 'H')) {\n // Special case `Thomas`, `Thames` or Germanic.\n if (\n isGermanic ||\n ((nextnext === 'O' || nextnext === 'A') &&\n characters[index + 3] === 'M')\n ) {\n primary += 'T'\n secondary += 'T'\n } else {\n primary += '0'\n secondary += 'T'\n }\n\n index += 2\n\n break\n }\n\n if (next === 'T' || next === 'D') {\n index++\n }\n\n index++\n primary += 'T'\n secondary += 'T'\n\n break\n case 'V':\n if (next === 'V') {\n index++\n }\n\n primary += 'F'\n secondary += 'F'\n index++\n\n break\n case 'W':\n // Can also be in middle of word (as already taken care of for initial).\n if (next === 'R') {\n primary += 'R'\n secondary += 'R'\n index += 2\n\n break\n }\n\n if (index === 0) {\n // `Wasserman` should match `Vasserman`.\n if (vowels.test(next)) {\n primary += 'A'\n secondary += 'F'\n } else if (next === 'H') {\n // Need `Uomo` to match `Womo`.\n primary += 'A'\n secondary += 'A'\n }\n }\n\n // `Arnow` should match `Arnoff`.\n if (\n ((prev === 'E' || prev === 'O') &&\n next === 'S' &&\n nextnext === 'K' &&\n (characters[index + 3] === 'I' || characters[index + 3] === 'Y')) ||\n // Maybe a bug? Shouldn't this be general Germanic?\n value.slice(0, 3) === 'SCH' ||\n (index === last && vowels.test(prev))\n ) {\n secondary += 'F'\n index++\n\n break\n }\n\n // Polish such as `Filipowicz`.\n if (\n next === 'I' &&\n (nextnext === 'C' || nextnext === 'T') &&\n characters[index + 3] === 'Z'\n ) {\n primary += 'TS'\n secondary += 'FX'\n index += 4\n\n break\n }\n\n index++\n\n break\n case 'X':\n // French such as `breaux`.\n if (\n !(\n index === last &&\n // Bug: IAU and EAU also match by AU\n // (/IAU|EAU/.test(value.slice(index - 3, index))) ||\n (prev === 'U' &&\n (characters[index - 2] === 'A' || characters[index - 2] === 'O'))\n )\n ) {\n primary += 'KS'\n secondary += 'KS'\n }\n\n if (next === 'C' || next === 'X') {\n index++\n }\n\n index++\n\n break\n case 'Z':\n // Chinese pinyin such as `Zhao`.\n if (next === 'H') {\n primary += 'J'\n secondary += 'J'\n index += 2\n\n break\n } else if (\n (next === 'Z' &&\n (nextnext === 'A' || nextnext === 'I' || nextnext === 'O')) ||\n (isSlavoGermanic && index > 0 && prev !== 'T')\n ) {\n primary += 'S'\n secondary += 'TS'\n } else {\n primary += 'S'\n secondary += 'S'\n }\n\n if (next === 'Z') {\n index++\n }\n\n index++\n\n break\n default:\n index++\n }\n }\n\n return [primary, secondary]\n}", "function isWordFound(phrase, word) {\n var tokenObjs = nlp.tokenize(phrase);\n //console.log(\"tokenObjs = \", tokenObjs);\n var tokens = tokenObjs[0].tokens.map(obj => obj.text);\n //console.log(\"tokens = \", tokens);\n return (tokens.indexOf(word) !== -1);\n }", "function shortestWord(sentence) {\n//Declaring variables used in the function shortestWord\n var wordSeparator = sentence.split(' ');\n var shortestLenth = wordSeparator.length;\n var shoterWord = ' ';\n //for loop to run from 0 to length of string sentence\n for (var i=0;i<wordSeparator.length;i++) {\n if (wordSeparator[i].length < shortestLenth) {\n shoterWord = wordSeparator[i];\n }\n }\n return shoterWord;\n}", "function i_am_making_wordsStartsWithVowel_bolder() {\n var str = \"what ever i am writing here or have wrote this is all my (first) imagination (second) creation, words with all 5 vowels, which i got from dictionary one by one page, i think all will enjoy and increase knowledge thats my education.\";\n var s = '';\n var spaceFlag = 0;\n var capitalFlag = 0;\n for (var i = 0; i < str.length; i++) {\n if (spaceFlag == 1 || i == 0) {\n if (str[i].toLowerCase() == 'a' ||\n str[i].toLowerCase() == 'e' ||\n str[i].toLowerCase() == 'i' ||\n str[i].toLowerCase() == 'o' ||\n str[i].toLowerCase() == 'u') {\n capitalFlag = 1;\n }\n }\n if (str[i] == \" \" && spaceFlag == 0) {\n spaceFlag = 1;\n capitalFlag = 0;\n }\n else if (str[i] != \" \") {\n spaceFlag = 0;\n }\n if (capitalFlag == 1) {\n s += str[i].toUpperCase();\n }\n\n else {\n s += str[i];\n }\n\n }\n return s;\n}", "function tokenizeWord(word, callback) {\n \"use strict\";\n var match, parts = [], stemmedPart, singularPart, singularMetaphones, stemmedMetaphones, token;\n\n // TODO: Improve that. Should be in the stemmer actually\n //if (-1 === (match = word.match(/^([#\"',;:!?(.\\[{])*([a-z0-9]+)+([,;:!?)\\]}\"'.])*$/i))) {\n // return callback(null, []);\n //}\n //if (!match) {\n // return callback(null, []);\n //}\n //word = match[2] || \"\";\n\n word = word || \"\";\n if (-1 === word.search(/^[a-z]*$/i) || word.length < 3) {\n return callback(null, []);\n }\n\n token = word.toUpperCase().trim();\n\n // TODO: Decide which stopwords to use depending on the given language\n var stopwordsEn = stopwords.en;\n\n // we skip stopwords\n if (stopwordsEn.indexOf(token) >= 0) {\n return callback(null, []);\n }\n\n parts.push(token);\n\n // TODO: Decide which stemmer to use depending on the given language\n stemmedPart = stemmer.stem(token) || \"\";\n\n if (stemmedPart.length > 2) {\n // calc double metaphone of the stemmed word\n stemmedMetaphones = doubleMetaphone.process(stemmedPart);\n //console.log(\"stemmed Metaphones for \" + token + \" \" + stemmedMetaphones);\n if (stemmedMetaphones[0].length > 1) {\n parts.push((stemmedMetaphones[0] || \"\").trim());\n }\n if (stemmedMetaphones[1].length > 1) {\n parts.push((stemmedMetaphones[1] || \"\").trim());\n }\n }\n // the last element is the original uppercased stemmed token\n parts.push(stemmedPart.toUpperCase().trim());\n\n // Singularize word\n singularPart = nounInflector.singularize(token) || \"\";\n if (singularPart.length > 2) {\n // calc double metaphone of singular\n singularMetaphones = doubleMetaphone.process(singularPart);\n //console.log(\"singular Metaphones for \" + token + \" \" + stemmedMetaphones);\n if (singularMetaphones[0].length > 1) {\n parts.push((singularMetaphones[0] || \"\").trim());\n }\n if (singularMetaphones[1].length > 1) {\n parts.push((singularMetaphones[1] || \"\").trim());\n }\n }\n parts.push(singularPart.toUpperCase().trim());\n\n parts.sort();\n parts = underscore.uniq(parts, true);\n\n process.nextTick(function () {\n callback(null, parts);\n });\n}", "function getMiddle(string){\n if(string.length % 2 !== 0) {\n return string.charAt(string.length/2);\n } else {\n var mean = string.length/2;\n var mid1 = string.charAt(mean-1);\n var mid2 = string.charAt((mean));\n return mid1+mid2;\n }\n}", "function stemm (word) {\n /*\n Put u and y between vowels into upper case\n */\n word = word.replace(/([aeiouyäöü])u([aeiouyäöü])/g, '$1U$2')\n word = word.replace(/([aeiouyäöü])y([aeiouyäöü])/g, '$1Y$2')\n\n /*\n and then do the following mappings,\n (a) replace ß with ss,\n (a) replace ae with ä, Not doing these,\n have trouble with diphtongs\n (a) replace oe with ö, Not doing these,\n have trouble with diphtongs\n (a) replace ue with ü unless preceded by q. Not doing these,\n have trouble with diphtongs\n So in quelle, ue is not mapped to ü because it follows q, and in\n feuer it is not mapped because the first part of the rule changes it to\n feUer, so the u is not found.\n */\n word = word.replace(/ß/g, 'ss')\n // word = word.replace(/ae/g, 'ä');\n // word = word.replace(/oe/g, 'ö');\n // word = word.replace(/([^q])ue/g, '$1ü');\n\n /*\n R1 and R2 are first set up in the standard way (see the note on R1\n and R2), but then R1 is adjusted so that the region before it contains at\n least 3 letters.\n R1 is the region after the first non-vowel following a vowel, or is\n the null region at the end of the word if there is no such non-vowel.\n R2 is the region after the first non-vowel following a vowel in R1,\n or is the null region at the end of the word if there is no such non-vowel.\n */\n\n let r1Index = word.search(/[aeiouyäöü][^aeiouyäöü]/)\n let r1 = ''\n if (r1Index !== -1) {\n r1Index += 2\n r1 = word.substring(r1Index)\n }\n\n let r2Index = -1\n // let r2 = ''\n\n if (r1Index !== -1) {\n r2Index = r1.search(/[aeiouyäöü][^aeiouyäöü]/)\n if (r2Index !== -1) {\n r2Index += 2\n // r2 = r1.substring(r2Index)\n r2Index += r1Index\n } else {\n // r2 = ''\n }\n }\n\n if (r1Index !== -1 && r1Index < 3) {\n r1Index = 3\n r1 = word.substring(r1Index)\n }\n\n /*\n Define a valid s-ending as one of b, d, f, g, h, k, l, m, n, r or t.\n Define a valid st-ending as the same list, excluding letter r.\n */\n\n /*\n Do each of steps 1, 2 and 3.\n */\n\n /*\n Step 1:\n Search for the longest among the following suffixes,\n (a) em ern er\n (b) e en es\n (c) s (preceded by a valid s-ending)\n */\n const a1Index = word.search(/(em|ern|er)$/g)\n const b1Index = word.search(/(e|en|es)$/g)\n let c1Index = word.search(/([bdfghklmnrt]s)$/g)\n if (c1Index !== -1) {\n c1Index++\n }\n let index1 = 10000\n let optionUsed1 = ''\n if (a1Index !== -1 && a1Index < index1) {\n optionUsed1 = 'a'\n index1 = a1Index\n }\n if (b1Index !== -1 && b1Index < index1) {\n optionUsed1 = 'b'\n index1 = b1Index\n }\n if (c1Index !== -1 && c1Index < index1) {\n optionUsed1 = 'c'\n index1 = c1Index\n }\n\n /*\n and delete if in R1. (Of course the letter of the valid s-ending is\n not necessarily in R1.) If an ending of group (b) is deleted, and the ending\n is preceded by niss, delete the final s.\n (For example, äckern -> äck, ackers -> acker, armes -> arm,\n bedürfnissen -> bedürfnis)\n */\n\n if (index1 !== 10000 && r1Index !== -1) {\n if (index1 >= r1Index) {\n word = word.substring(0, index1)\n if (optionUsed1 === 'b') {\n if (word.search(/niss$/) !== -1) {\n word = word.substring(0, word.length - 1)\n }\n }\n }\n }\n\n /*\n Step 2:\n Search for the longest among the following suffixes,\n (a) en er est\n (b) st (preceded by a valid st-ending, itself preceded by at least 3\n letters)\n */\n\n const a2Index = word.search(/(en|er|est)$/g)\n let b2Index = word.search(/(.{3}[bdfghklmnt]st)$/g)\n if (b2Index !== -1) {\n b2Index += 4\n }\n\n let index2 = 10000\n // const optionUsed2 = ''\n if (a2Index !== -1 && a2Index < index2) {\n // optionUsed2 = 'a'\n index2 = a2Index\n }\n if (b2Index !== -1 && b2Index < index2) {\n // optionUsed2 = 'b'\n index2 = b2Index\n }\n\n /*\n and delete if in R1.\n (For example, derbsten -> derbst by step 1, and derbst -> derb by\n step 2, since b is a valid st-ending, and is preceded by just 3 letters)\n */\n\n if (index2 !== 10000 && r1Index !== -1) {\n if (index2 >= r1Index) {\n word = word.substring(0, index2)\n }\n }\n\n /*\n Step 3: d-suffixes (*)\n Search for the longest among the following suffixes, and perform the\n action indicated.\n end ung\n delete if in R2\n if preceded by ig, delete if in R2 and not preceded by e\n ig ik isch\n delete if in R2 and not preceded by e\n lich heit\n delete if in R2\n if preceded by er or en, delete if in R1\n keit\n delete if in R2\n if preceded by lich or ig, delete if in R2\n */\n\n const a3Index = word.search(/(end|ung)$/g)\n let b3Index = word.search(/[^e](ig|ik|isch)$/g)\n const c3Index = word.search(/(lich|heit)$/g)\n const d3Index = word.search(/(keit)$/g)\n if (b3Index !== -1) {\n b3Index++\n }\n\n let index3 = 10000\n let optionUsed3 = ''\n if (a3Index !== -1 && a3Index < index3) {\n optionUsed3 = 'a'\n index3 = a3Index\n }\n if (b3Index !== -1 && b3Index < index3) {\n optionUsed3 = 'b'\n index3 = b3Index\n }\n if (c3Index !== -1 && c3Index < index3) {\n optionUsed3 = 'c'\n index3 = c3Index\n }\n if (d3Index !== -1 && d3Index < index3) {\n optionUsed3 = 'd'\n index3 = d3Index\n }\n\n if (index3 !== 10000 && r2Index !== -1) {\n if (index3 >= r2Index) {\n word = word.substring(0, index3)\n let optionIndex = -1\n // const optionSubsrt = ''\n if (optionUsed3 === 'a') {\n optionIndex = word.search(/[^e](ig)$/)\n if (optionIndex !== -1) {\n optionIndex++\n if (optionIndex >= r2Index) {\n word = word.substring(0, optionIndex)\n }\n }\n } else if (optionUsed3 === 'c') {\n optionIndex = word.search(/(er|en)$/)\n if (optionIndex !== -1) {\n if (optionIndex >= r1Index) {\n word = word.substring(0, optionIndex)\n }\n }\n } else if (optionUsed3 === 'd') {\n optionIndex = word.search(/(lich|ig)$/)\n if (optionIndex !== -1) {\n if (optionIndex >= r2Index) {\n word = word.substring(0, optionIndex)\n }\n }\n }\n }\n }\n\n /*\n Finally,\n turn U and Y back into lower case, and remove the umlaut accent from\n a, o and u.\n */\n word = word.replace(/U/g, 'u')\n word = word.replace(/Y/g, 'y')\n word = word.replace(/ä/g, 'a')\n word = word.replace(/ö/g, 'o')\n word = word.replace(/ü/g, 'u')\n\n return word\n}", "function getMiddle(s)\n{\nreturn s.slice((s.length-1)/2, s.length/2+1);\n}", "function initPhrase()\n{\n for(let i = 0; i < userPhrases[phraseIndex].length; i++)\n {\n if(userPhrases[phraseIndex][i].match(/ /))\n {\n phrase = phrase.concat(\" \");\n }\n else\n {\n phrase = phrase.concat(\"-\");\n }\n }\n if(debug)console.log(userPhrases[phraseIndex]);\n}", "function getMiddle(s)\n{\n return s.substr(Math.ceil(s.length / 2 - 1), s.length % 2 === 0 ? 2 : 1);\n}" ]
[ "0.7172398", "0.68735045", "0.6397718", "0.6332119", "0.63306844", "0.63306844", "0.63306844", "0.63306844", "0.62016183", "0.6201138", "0.6158012", "0.61031693", "0.6042598", "0.60257244", "0.60142297", "0.5983992", "0.59764767", "0.5936545", "0.5919664", "0.5916847", "0.59129643", "0.5893122", "0.5892924", "0.58716875", "0.58684874", "0.586075", "0.58466494", "0.58415616", "0.58153224", "0.57997" ]
0.6972745
1
Operating status and date of ceased operation cross check
function CrossCheck_operatingStatus_dateOfCeased (input1,input2){ var result = new Object(); var error; result.flgname = []; result.flgs = []; result.flgvalue = []; result.flgmsg = []; result.pass = true; if ((presence_check && ! presence_check(input2))||(!presence_check(input1) && presence_check(input2)) ){ error = "E5_1" result.flgname.push(flags[error].name); result.flgs.push(flags[error].flag); result.flgvalue.push(flags[error].value); result.flgmsg.push(flags[error].msg); } if (result.flgname.length>0){ result.pass = false; } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CrossCheck_operatingStatus_dateOfCeased (input1,input2){\r\n\tvar result = new Object();\r\n\tvar error;\r\n\tvar input1;\r\n\tvar input2;\r\n\tvar test = {\r\n\t\t\"Ceased Operation \": input1,\r\n\t\t\"date of Ceased\" : input2\r\n\t};\r\n\tresult.flgname = [];\r\n\tresult.flgflag = [];\r\n\tresult.flgvalue = [];\r\n\tresult.flgmsg = [];\r\n\tresult.pass = true;\r\n\tif ((presence_check && ! presence_check(input2))||(!presence_check(input1) && presence_check(input2)) ){\r\n\t\terror = \"E5_1\"\r\n\t\tresult.flgname.push(flags[error].name);\r\n\t\tresult.flgflag.push(flags[error].flag);\r\n\t\tresult.flgvalue.push(flags[error].value);\r\n\t\tresult.flgmsg.push(flags[error].msg);\r\n\t\t}\r\n\tconsole.log(result.flgname.length);\r\n\tif (result.flgname.length>0){\r\n\t\tresult.pass = false;\r\n\t}\r\n\treturn result;\r\n}", "calculateFailureDate(flatOrder) {\n let secondsToFailure = flatOrder.paymentsCovered.floor() * flatOrder.paymentInterval\n flatOrder.failureDate = flatOrder.nextPaymentDate.clone().add(secondsToFailure, 's')\n }", "isRevoked() {\n const { canReceiveAfter, canSendAfter, kycExpiry } = this;\n const datesAreZero = [canReceiveAfter, canSendAfter, kycExpiry].every(date => date.getTime() === 0);\n //\n return datesAreZero;\n }", "async function checkCancellation(from) {\n\t\t\t\tconst currentMargin = (await futuresMarket.positions(trader)).margin;\n\t\t\t\t// cancel the order\n\t\t\t\tconst tx = await futuresMarket.cancelNextPriceOrder(trader, { from: from });\n\n\t\t\t\t// check order is removed\n\t\t\t\tconst order = await futuresMarket.nextPriceOrders(trader);\n\t\t\t\tassert.bnEqual(order.sizeDelta, 0);\n\t\t\t\tassert.bnEqual(order.targetRoundId, 0);\n\t\t\t\tassert.bnEqual(order.commitDeposit, 0);\n\t\t\t\tassert.bnEqual(order.keeperDeposit, 0);\n\n\t\t\t\t// The relevant events are properly emitted\n\t\t\t\tconst decodedLogs = await getDecodedLogs({ hash: tx.tx, contracts: [sUSD, futuresMarket] });\n\n\t\t\t\tif (from === trader) {\n\t\t\t\t\t// trader gets refunded\n\t\t\t\t\tassert.equal(decodedLogs.length, 4);\n\t\t\t\t\t// keeper fee was refunded\n\t\t\t\t\t// PositionModified\n\t\t\t\t\tdecodedEventEqual({\n\t\t\t\t\t\tevent: 'PositionModified',\n\t\t\t\t\t\temittedFrom: futuresMarket.address,\n\t\t\t\t\t\targs: [toBN('1'), trader, currentMargin.add(keeperFee), 0, 0, price, toBN(2), 0],\n\t\t\t\t\t\tlog: decodedLogs[1],\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// keeper gets paid\n\t\t\t\t\tassert.equal(decodedLogs.length, 3);\n\t\t\t\t\tdecodedEventEqual({\n\t\t\t\t\t\tevent: 'Issued',\n\t\t\t\t\t\temittedFrom: sUSD.address,\n\t\t\t\t\t\targs: [from, keeperFee],\n\t\t\t\t\t\tlog: decodedLogs[0],\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// commitFee (equal to spotFee) paid to fee pool\n\t\t\t\tdecodedEventEqual({\n\t\t\t\t\tevent: 'Issued',\n\t\t\t\t\temittedFrom: sUSD.address,\n\t\t\t\t\targs: [await feePool.FEE_ADDRESS(), spotFee],\n\t\t\t\t\tlog: decodedLogs.slice(-2, -1)[0], // [-2]\n\t\t\t\t});\n\t\t\t\t// NextPriceOrderRemoved\n\t\t\t\tdecodedEventEqual({\n\t\t\t\t\tevent: 'NextPriceOrderRemoved',\n\t\t\t\t\temittedFrom: futuresMarket.address,\n\t\t\t\t\targs: [trader, roundId, size, roundId.add(toBN(1)), spotFee, keeperFee],\n\t\t\t\t\tlog: decodedLogs.slice(-1)[0],\n\t\t\t\t});\n\n\t\t\t\t// transfer more margin\n\t\t\t\tawait futuresMarket.transferMargin(margin, { from: trader });\n\t\t\t\t// and can submit new order\n\t\t\t\tawait futuresMarket.submitNextPriceOrder(size, { from: trader });\n\t\t\t\tconst newOrder = await futuresMarket.nextPriceOrders(trader);\n\t\t\t\tassert.bnEqual(newOrder.sizeDelta, size);\n\t\t\t}", "static function sendLossCheckChanges(messageContext : MessageContext, check : Check) {\n // the condition make sure that it will not go inside the loop only for these status\n // to avoid going into the loop every time the function is invoked\n if (check.Status == \"issued\" || check.Status == \"pendingtransfer\" || check.Status == \"stopped\" || check.Status == \"voided\") {\n for (exposure in check.Claim.Exposures) {\n if (exposure.ex_InSuit && exposure.State != \"draft\") {\n for (payment in check.Payments) {\n // check conditions above needs to be added again to include payment conditions\n if (!payment.New && payment.Exposure == exposure && payment.CostType == \"claimcost\"\n && (check.Status == \"issued\" || (check.Status == \"pendingtransfer\" && !payment.OffsetPayment)\n || check.Status == \"stopped\" || check.Status == \"voided\")) {\n send(messageContext, exposure);\n break;\n }\n }\n }\n }\n }\n }", "validate(){\n if(this.taskDate < Date.now()){\n throw new Error('The date cannot be in the past');\n }\n }", "function checkDate(){\n var testDate = new Date();\n var testMonth = testDate.getMonth() + 1;\n var testYear = testDate.getFullYear();\n daysInMonth = new Date(testYear, testMonth, 0).getDate();\t\t//returns the number of days in the current month\n daysInMonth = parseInt(daysInMonth);\n if(currentMonth != testMonth) {\t\t\t\t\t//If the current month does not match last recorded month. A new month has passed\n\tmonthlyTotal = 0;\n\tcurrentMonth = testMonth;\n\tdaysMetGoal = 0;\n\tupdateOLED();\n }\n var testDay = testDate.getDate();\n if(currentDay != testDay) {\t\t\t\t\t\t//If the current day does not match last recorded day. A new day has passed\n\ttotalWeight = 0;\n\tcurrentDay = testDay;\n\tprogress = 0;\n\tupdateOLED();\n }\n updateDatabase();\n}", "validateSysCheck() {\n const result = this.commonData.validateRange(this.$scope.agent.syscheck);\n this.$scope.agent.syscheck = result;\n }", "function checkStatus() {\n checkWin();\n checkLose();\n }", "failPomodoro () {\n this.currentTask.estimationFailed++;\n\n fireDataBase.setTask(this.currentTask.id, this.currentTask);\n }", "function mainProcess() {\n\n\tlogDebug(\"This process closes all ROW Permits that the warranty period due date is before .\" + compareDate + br);\n\n\tvar wfResult = aa.workflow.getTasks(\"Warranty Period\", \"Warranty Period\");\n\n\tif (wfResult.getSuccess()) {\n\t\tworkFlow = wfResult.getOutput();\n\t\tlogDebug(\"The number of ROW Permits in the Warranty Period: \" + workFlow.length + br);\n\t} else {\n\t\tlogDebug(\"ERROR: Retrieving permits: \" + wfResult.getErrorType() + \":\" + wfResult.getErrorMessage());\n\t\treturn false;\n\t}\n\n\tfor (wf in workFlow) {\n\t\t\n\t\tif (elapsed() > maxSeconds) { //only continue if time hasn't expired\n\t\t\tlogDebug(\"A script time out has caused partial completion of this process. Please re-run. \" + elapsed() + \n\t\t\t\" seconds elapsed, \" + maxSeconds + \" allowed.\");\n\t\t\ttimeExpired = true;\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tb1WF = workFlow[wf];\n\t\tvar b1CapId = b1WF.getCapID();\n\t\tvar capId = aa.cap.getCapID(b1CapId.getID1(), b1CapId.getID2(), b1CapId.getID3()).getOutput();\n\t\tvar altId = capId.getCustomID();\n\t\tcap = aa.cap.getCap(capId).getOutput();\n\t\t\n\t\tif (cap) {\n\t\t\tvar appTypeResult = cap.getCapType();\n\t\t\tvar appTypeString = appTypeResult.toString();\n\t\t\tvar appTypeArray = appTypeString.split(\"/\");\n\t\t\t\n\t\t\tif(appTypeArray[0] == \"Permitting\" && appTypeArray[1] == \"Engineering\" && appTypeArray[2] == \"ROW\" && appTypeArray[3] == \"NA\") {\n\t\t\t\tvar dueDate = convertDate(b1WF.getDueDate());\n\t\t\t\tif (dueDate <= compareDate) {\n\t\t\t\t\tlogDebug(\"For Record \" + altId + \" the Due Date is: \" + dueDate);\n\t\t\t\t\t//closeTask(\"Warranty Period\",\"Warranty Expired\",\"Closed by batch process due to 3 year Warranty Expiration\",\"ROW Warranty Batch\",capId,\"ENGROWEXC\");\n\t\t\t\t\t//closeTask(\"Closed\",\"Closed\",\"Closed by batch process due to 3 year Warranty Expiration\",\"ROW Warranty Batch\",capId,\"ENGROWEXC\");\n\t\t\t\t\t//updateAppStatus(\"Closed\",\"Closed by batch process due to 3 year Warranty Expiration\", capId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\taa.sendMail(\"[email protected]\", emailAddress, elamSupport, \"ROW Permit Close Report\", emailText);\n}", "function updateMachineState() {\n\n var inArgs = updateMachineState.arguments;\n var result = new Result_customFunctionCommon();\n\n var return_value = 0;\n var errorCode = 0;\n var errorMessage = \"\";\n var conditionCode = \"PR\";\n var dateFrom = -1;\n var dateTo = -1;\n var comment = \"OPC_MACHINE_STATE_CHANNGE\";\n\n try {\n var tempOb = parseUpdateMachineState(inArgs);\n\n // API integration -----------------------------------------------------\n // ---------------------------------------------------------------------\n\n\n for (var i = 0; i < tempOb.IN_MACHINE_STATE_AR.length; i++) {\n var pos = tempOb.IN_MACHINE_STATE_AR[i].POSITION;\n var state = tempOb.IN_MACHINE_STATE_AR[i].STATE;\n tempOb.OUT_RESULT += \"\\n position : \" + pos + \" --- state : \" + state;\n for (var j = 1; j <= 2; j++) {\n var station = getStationId(tempOb.IN_STATION_NUMBER, ((pos - 1) * 2) + j).station\n tempOb.OUT_RESULT += \"\\n station : \" + station;\n // upload machine state\n if (state == \"true\") {\n conditionCode = \"PR\"; // Set condition code for productive time\n tempOb.OUT_RESULT += \"\\n CONDITION OK -- > PR\";\n }\n if (state == \"false\") {\n conditionCode = \"NA\"; // Set condition code for not assigned time\n tempOb.OUT_RESULT += \"\\n CONDITION OK -- > NA\";\n }\n // -----------------------------------------------------------------\n\n // < mdcGetStationConditions> --------------------------------------\n var conditionResultKeys = new Array(\"CONDITION_CODE\");\n\n var result_mdcGetStationConditions = imsApiService.mdcGetStationConditions(imsApiSessionContext,\n station,\n -1,\n -1,\n \"-1\",\n 1,\n conditionResultKeys);\n\n var return_value = result_mdcGetStationConditions.return_value;\n\n var CC = result_mdcGetStationConditions.conditionResultValues[0];\n\n //------------------------------------------------------------------\n\n if (((((CC == undefined) || (CC == \"PR\") || (CC == \"NA\")) && (conditionCode == \"NA\")) || (conditionCode == \"PR\")) ||\n\n (conditionCode == \"PR\")) {\n\n\n\n dateFrom = -1;\n dateTo = -1;\n\n // < mdcUploadStationCondition> ------------------------------------\n var stationConditionUploadKeys = new Array(\"BOOKING_TARGET\", \"CONDITION_CODE\", \"ERROR_CODE\", \"DATE_FROM\", \"DATE_TO\", \"TEXT\");\n var stationConditionUploadValues = new Array(0, conditionCode, 0, dateFrom, dateTo, comment);\n var result_uploadStationCondition = imsApiService.mdcUploadStationCondition(imsApiSessionContext,\n station,\n stationConditionUploadKeys,\n stationConditionUploadValues);\n\n var return_value = result_uploadStationCondition.return_value;\n\n if (return_value != 0) {\n\n errorCode = return_value;\n errorMessage = getImsApiErrorText(return_value);\n var resultData = {\n errorCode: errorCode,\n errorMessage: \"\" + errorMessage\n };\n\n //result.outArgs = [JSON.stringify(resultData)];\n //return result;\n }\n\n }\n\n }\n\n }\n\n // <End call> ----------------------------------------------------------\n\n\n // CF result -----------------------------------------------------------\n // ---------------------------------------------------------------------\n\n logHandler.logMessage(\"custom function OPC.updateMachineState finished.\");\n return resultUpdateMachineState(\"CF\", 0, \"PASS\", tempOb);\n\n } catch (e) {\n logHandler.logMessage(\"custom function OPC.updateMachineState failed: \" + e);\n result = new Result_customFunctionCommon();\n result.outArgs = new Array();\n result.outArgs = logHandler.getMessages();\n result.return_value = ItacMesErrorCodeApi.SERVER_ERROR.getReturnValue();\n result.errorString = ItacMesErrorCodeApi.SERVER_ERROR.getErrorString();\n return result;\n }\n}", "handleDueDateChanged(changeResults) {\n const alerts = {};\n let numSucceeded = 0;\n let numFailed = 0;\n\n const loans = this.loans();\n\n changeResults.forEach(result => {\n if (result.id) {\n // This is a loan object after a successful change\n alerts[result.id] = this.renderAlert(\n css.success,\n 'check-circle',\n 'success',\n 'stripes-smart-components.cddd.changeSucceeded'\n );\n numSucceeded++;\n } else {\n // This date change attempt failed.\n const putEndpoint = '/circulation/loans/';\n const failedLoanId = result.url.split(putEndpoint)[1];\n\n const errorMessage = getErrorMessage(loans, failedLoanId);\n\n alerts[failedLoanId] = this.renderAlert(\n css.warn,\n 'exclamation-circle',\n 'failure',\n errorMessage\n );\n numFailed++;\n }\n });\n\n this.setState({\n succeeded: true,\n resultCounts: {\n numSucceeded,\n numFailed,\n },\n alerts,\n });\n\n ChangeDueDateDialog.fetchData(this.props);\n }", "function checkPowerEfficiencyStatus(powerEfficiencyData) {\r\n if (!powerEfficiencyData) {\r\n return;\r\n }\r\n\r\n var totalPowerEfficiencyAvg = calTotalPowerEfficiencyAvg(powerEfficiencyData.datasets[0].data);\r\n dashVM.powerEfficiencyGaugeOptions.value = totalPowerEfficiencyAvg;\r\n powerEfficiencyData.labels.push(\"Total\");\r\n powerEfficiencyData.datasets[0].data.push(totalPowerEfficiencyAvg);\r\n\r\n if (!powerEfficiencyData.labels) {\r\n return;\r\n }\r\n\r\n var currentDate = new Date();\r\n for (var deviceIndex = 0; deviceIndex < powerEfficiencyData.labels.length; deviceIndex++) {\r\n if (powerEfficiencyStatusList.length < deviceIndex + 1) {\r\n var powerEfficiencyStatus = {\r\n device: powerEfficiencyData.labels[deviceIndex],\r\n warningDate: null,\r\n errorDate: null,\r\n alarmCode: -1\r\n }\r\n\r\n powerEfficiencyStatusList.push(powerEfficiencyStatus);\r\n }\r\n\r\n if (powerEfficiencyData.datasets[0].data[deviceIndex] < threshold2) {\r\n if (!powerEfficiencyStatusList[deviceIndex].warningDate) {\r\n powerEfficiencyStatusList[deviceIndex].warningDate = new Date(currentDate.getTime());\r\n powerEfficiencyStatusList[deviceIndex].alarmCode = -1;\r\n } else {\r\n if (Math.floor((currentDate.getTime() - powerEfficiencyStatusList[deviceIndex].warningDate.getTime())\r\n / 60000) > thresholdCheckTime) {\r\n powerEfficiencyStatusList[deviceIndex].warningDate = new Date(currentDate.getTime());\r\n powerEfficiencyStatusList[deviceIndex].alarmCode = 1;\r\n } else {\r\n powerEfficiencyStatusList[deviceIndex].alarmCode = -1;\r\n }\r\n }\r\n\r\n if (powerEfficiencyData.datasets[0].data[deviceIndex] < threshold1) {\r\n if (!powerEfficiencyStatusList[deviceIndex].errorDate) {\r\n powerEfficiencyStatusList[deviceIndex].errorDate = new Date(currentDate.getTime());\r\n powerEfficiencyStatusList[deviceIndex].alarmCode = -1;\r\n } else {\r\n if (Math.floor((currentDate.getTime() - powerEfficiencyStatusList[deviceIndex].errorDate.getTime())\r\n / 60000) > thresholdCheckTime) {\r\n powerEfficiencyStatusList[deviceIndex].errorDate = new Date(currentDate.getTime());\r\n powerEfficiencyStatusList[deviceIndex].alarmCode = 2;\r\n } else {\r\n powerEfficiencyStatusList[deviceIndex].alarmCode = -1;\r\n }\r\n }\r\n } else {\r\n powerEfficiencyStatusList[deviceIndex].errorDate = null;\r\n }\r\n } else {\r\n powerEfficiencyStatusList[deviceIndex].warningDate = null;\r\n }\r\n }\r\n\r\n for (var statusIndex = 0; statusIndex < powerEfficiencyStatusList.length; statusIndex++){\r\n var powerEfficiencyStatusRow = null;\r\n var isAlarmOccured = false;\r\n if (powerEfficiencyStatusList[statusIndex].warningDate) {\r\n if (powerEfficiencyStatusList[statusIndex].alarmCode == 1) {\r\n powerEfficiencyStatusRow = {\r\n device: powerEfficiencyStatusList[statusIndex].device,\r\n date: powerEfficiencyStatusList[statusIndex].warningDate,\r\n alarmCode: powerEfficiencyStatusList[statusIndex].alarmCode\r\n }\r\n\r\n isAlarmOccured = true;\r\n }\r\n\r\n if (powerEfficiencyStatusList[statusIndex].errorDate) {\r\n if (powerEfficiencyStatusList[statusIndex].alarmCode == 2) {\r\n powerEfficiencyStatusRow = {\r\n device: powerEfficiencyStatusList[statusIndex].device,\r\n date: powerEfficiencyStatusList[statusIndex].errorDate,\r\n alarmCode: powerEfficiencyStatusList[statusIndex].alarmCode\r\n }\r\n\r\n isAlarmOccured = true;\r\n }\r\n }\r\n\r\n\r\n if (isAlarmOccured == true) {\r\n // Send powerEfficiencyStatusRow\r\n dashVM.alarmSummaryCount++;\r\n $rootScope.$broadcast('addAlarmMessageEvent', powerEfficiencyStatusRow);\r\n }\r\n }\r\n\r\n if (powerEfficiencyStatusList[statusIndex].alarmCode == 0) {\r\n /* XXX */\r\n }\r\n }\r\n}", "validate() {\n let status = true;\n\n status = !this._validateLocalId() ? false : status;\n status = !this._validateUniqueWorkerId() ? false : status;\n status = !this._validateChangeUniqueWorkerId() ? false : status;\n status = !this._validateDisplayId() ? false : status;\n status = !this._validateStatus() ? false : status;\n status = !this._validateDaysSickChanged() ? false : status;\n\n // only continue to process validation, if the status is not UNCHECKED, DELETED OR UNCHANGED\n if (!STOP_VALIDATING_ON.includes(this._status)) {\n status = !this._validateContractType() ? false : status;\n status = !this._validateNINumber() ? false : status;\n status = !this._validatePostCode() ? false : status;\n status = !this._validateDOB() ? false : status;\n status = !this._validateGender() ? false : status;\n status = !this._validateEthnicity() ? false : status;\n status = !this._validateNationality() ? false : status;\n status = !this._validateCitizenShip() ? false : status;\n status = !this._validateCountryOfBirth() ? false : status;\n status = !this._validateYearOfEntry() ? false : status;\n status = !this._validateDisabled() ? false : status;\n status = !this._validateCareCert() ? false : status;\n status = !this._validateRecSource() ? false : status;\n status = !this._validateStartDate() ? false : status;\n status = !this._validateStartInsect() ? false : status;\n status = !this._validateApprentice() ? false : status;\n status = !this._validateZeroHourContract() ? false : status;\n status = !this._validateDaysSick() ? false : status;\n status = !this._validateSalaryInt() ? false : status;\n status = !this._validateSalary() ? false : status;\n status = !this._validateHourlyRate() ? false : status;\n status = !this._validateMainJobRole() ? false : status;\n status = !this._validateMainJobDesc() ? false : status;\n status = !this._validateContHours() ? false : status;\n status = !this._validateAvgHours() ? false : status;\n status = !this._validateRegisteredNurse() ? false : status;\n status = !this._validateNursingSpecialist() ? false : status;\n status = !this._validationQualificationRecords() ? false : status;\n status = !this._validateSocialCareQualification() ? false : status;\n status = !this._validateNonSocialCareQualification() ? false : status;\n status = !this._validateAmhp() ? false : status;\n }\n\n return status;\n }", "cellActionsDisabledBecause() {\n if (this.state.selectLogicalOperatorsUpFront === true\n && this.state.logicalOperatorsSelected === false) {\n return 'Select Logical Operators First';\n }\n\n if (this.state.activeBoardId === null\n || this.state.activeBoardId === -1) {\n return 'Error: No Active Board';\n }\n\n if (this.isTerminalNode(this.state.activeBoardId) === false) {\n return 'This board has already been acted upon';\n }\n\n if (this.state.selectedBoardSquare === null) {\n return 'You must select a square or some logical operators';\n }\n\n return 'ERROR: No reason given for disabled actions';\n }", "getCorruption() {\n return this.state.cursor().get( 'corruption' )\n }", "function Cancellation() { }", "calculateDaysHaveLeft(){\n\t \n\t /*based on the current case's status, the daysHaveLeft case's attribute is updated from the daysUsed attribute minus the alloted time to complete the status.*/\n\t cases.forEach(function(files, index){\n switch(files.status){\n \t\tcase \"Waiting on letter from patron\":\n cases[index].daysHaveLeft = 30 - files.daysUsed;\n\t\t\t\tbreak;\n case \"Active\":\n \tcases[index].daysHaveLeft = 10 - files.daysUsed;\n\t\t\t\tbreak;\n \t\tcase \"On supervisor's desk\":\n cases[index].daysHaveLeft = 3 - files.daysUsed;\n\t\t\t\tbreak;\n case \"Corrections or Reinvestigate\":\n \tcases[index].daysHaveLeft = 3 - files.daysUsed;\n\t\t\t\tbreak;\n \t\tcase \"On director's desk\":\n cases[index].daysHaveLeft = 10 - files.daysUsed;\n\t\t\t\tbreak;\n case \"Waiting on patron decision\":\n \tcases[index].daysHaveLeft = 30 - files.daysUsed;\n\t\t\t\tbreak;\n \t\tcase \"Sign and close out\":\n cases[index].daysHaveLeft = 3 - files.daysUsed;\n\t\t\t\tbreak;\n \t\tcase \"To be Filed\":\n cases[index].daysHaveLeft = 1 - files.daysUsed;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tconsole.log(\"Error\");\n\n }//end of switch statement\n\t });//end of forEach statement\n }", "function incFail(){\r\n\"use strict\";\r\ncheck();\r\nif(valid==true){\r\n\tnumFail++;\r\n\tnumTotalRuns++;\r\n\tcalc();\r\n\tcosts();\r\n\tupdate();\r\n\t}\r\n}", "function expectStatesSharedUnsettled(ae) {\n\n expect(ae.isFinished).toBe(false);\n expect(ae.isSettled).toBe(false);\n expect(ae.isRejected).toBe(false);\n expect(ae.isCanceled).toBe(false);\n expect(ae.isFailed).toBe(false);\n expect(ae.isDone).toBe(false);\n\n expect(ae.result).toBe(undefined);\n expect(ae.error).toBe(null);\n }", "undo(nothrow) {\n let okay= false;\n const act= this.applied.pop(nothrow);\n if (act) {\n this.revoked.push(act).revoke(this.vm);\n --this.changed; // negative is okay.\n okay= true;\n }\n return okay;\n }", "infectionByRequestedTime() {\n const factor = this.powerFactor();\n return this.currentlyInfected() * 2 ** factor;\n }", "destroy(currentYear){\n let messageForThrow =\"The book thrown out if it is over 5 years old\";\n let total = currentYear-this.copyrightDate;\n if(total > 5){\n this.hasBeenDiscarded = \"yes \"+messageForThrow;\n }else{\n this.hasBeenDiscarded =\"No\";\n }\n return this.hasBeenDiscarded+\", years:\"+total;\n }", "function finallyActions () {\n status_.responded = new Date().getTime();\n status_.totalWaiting += (status_.responded - status_.requested);\n }", "function minus() {\n _runningTotal += Number.parseInt($scope.previousButton) - Number.parseInt($scope.currentButton);\n }", "function WorkflowDetermination(par,wValues,dKeys,wLastRow) {\n\n\n var workflowObj = new UpdateWorkflowObject().setState(0)\n .setStatus('In Process');\n /* Never know when you'll need those loggers... \n Logger.log('MY WORKFLOW OBJECT -> '+JSON.stringify(workflowObj));\n Logger.log('My Parameters : '+JSON.stringify(par));\n Logger.log('My workflow Values : '+wValues);\n Logger.log('My key Values : '+dKeys);\n Logger.log('My last row : '+wLastRow);\n */\n \n \n var workOrder = new Array();\n var workflowSteps = new Array();\n \n \n //valid workflow states are 'Approved', 'Rejected', 'In Process'.\n //valid workflow step states are 'Approved', 'Rejected', 'Active' and 'Pending'.\n \n var ss = SpreadsheetApp.openById(ssKey);\n var tSheet = ss.getSheetByName('Tests');\n var tRange = tSheet.getDataRange();\n var tValues = tRange.getValues();\n var tLastRow = tRange.getLastRow();\n \n \n \n for (var i = 1; i < wLastRow; i++) {\n \n var thisStateTest = wValues [i][3];\n var addState = true;\n \n var tAddState = true;\n \n for (var j = 1; j < tLastRow; j++) {\n \n var thisTest = tValues[j][0];\n Logger.log('Test from workflows : '+thisStateTest);\n Logger.log('Test from Tests : '+thisTest);\n Logger.log('Is it a test? : '+tValues[j][1]);\n \n if (thisStateTest == thisTest && tValues[j][1] == 'Test') {\n \n \n \n \n var operator = tValues[j][3];\n var testAndOr = tValues[j][5];\n //Logger.log(operator+'--'+testAndOr);\n \n switch (operator) {\n \n case '=':\n //Logger.log('Compare : '+par[tValues[j][2]]+' <-> '+tValues[j][4]);\n if (par[tValues[j][2]] !== tValues[j][4]) {\n //Logger.log('Test Passed!');\n tAddState = false;\n }\n break;\n case '<>':\n if (par[tValues[j][2]] == tValues[j][4]) {\n tAddState = false;\n }\n break;\n default:\n tAddState = true;\n break;\n \n }\n \n }\n /*\n Logger.log('Add State : '+addState);\n Logger.log('Test to Add State : '+tAddState);\n */\n \n if (tAddState == false) {addState = false;}\n }\n /*\n Logger.log('After: Add State : '+addState);\n Logger.log('After: Test to Add State : '+tAddState);\n */\n if (addState == true) {\n \n var curState = wValues[i][0];\n var workflowStep = new UpdateWorkflowStep().setStepState(curState)\n .setStepStatus('Pending');\n var json1 = JSON.stringify(workflowStep);\n \n workflowSteps.push(json1);\n \n \n workOrder.push(wValues[i][0]);\n \n }\n \n workflowObj.setWorkflow(workOrder)\n .setWorkflowSteps(workflowSteps);\n \n } \n \n return workflowObj;\n \n}", "compute() {\n const prev = parseFloat(this.previousOperand);\n const current = parseFloat(this.currentOperand);\n const operations = {\n '+': prev + current,\n '-': prev - current,\n '*': prev * current,\n '/': prev / current\n }\n \n if (this.isEqualPressedAgain) {\n this.previousResult = this.currentOperand;\n this.currentOperand = this.performSameCalculation();\n }\n\n if (isNaN(prev) || isNaN(current)) return;\n this.currentOperand = this.checkForErrors(current, prev, operations);\n this.previousOperation = this.operation;\n this.operation = undefined;\n this.previousOperand = '';\n }", "toolop_cancel(op: ToolOp, executeUndo: boolean) {\n if (executeUndo === undefined) {\n console.warn(\"Warning, executeUndo in toolop_cancel() was undefined\");\n }\n\n if (executeUndo) {\n this.undo();\n } else {\n if (this.undostack.indexOf(op) >= 0) {\n this.undostack.remove(op);\n this.undocur--;\n }\n }\n }", "destroy(checkedOutOverTimes){\n let messageForThrow = \"The book should be thrown out if it has been checked out over 100 times\";\n this.numberOfTimesCheckedOut += checkedOutOverTimes;\n if(this.numberOfTimesCheckedOut > 100){\n this.numberOfTimesCheckedOut = \"yes \"+messageForThrow;\n }else{\n this.numberOfTimesCheckedOut =\"No\";\n }\n return this.numberOfTimesCheckedOut;\n }" ]
[ "0.64863586", "0.5092882", "0.5054814", "0.4955838", "0.49546498", "0.49452978", "0.48403302", "0.4805371", "0.48015884", "0.4790848", "0.4779167", "0.4752892", "0.47342303", "0.47306263", "0.47246015", "0.4723393", "0.47053486", "0.47014406", "0.47013104", "0.4695447", "0.46838474", "0.46827865", "0.46803942", "0.4680123", "0.46776253", "0.46565086", "0.4642242", "0.46331808", "0.4623573", "0.46216387" ]
0.6539003
0
Integration function for fax number of contact information
function contact_fax_number(input){ var result = new Object(); var error; result.flgname = []; result.flgs = []; result.flgvalue = []; result.flgmsg = []; result.pass = true; if (!check_allowed_char(input, "faxNum", "conf1")){ error = "E7_1" result.flgname.push(flags[error].name); result.flgs.push(flags[error].flag); result.flgvalue.push(flags[error].value); result.flgmsg.push(flags[error].msg); } if ( check_req_char(input, "faxNum", "conf1")){ error = "E42_3" result.flgname.push(flags[error].name); result.flgs.push(flags[error].flag); result.flgvalue.push(flags[error].value); result.flgmsg.push(flags[error].msg); } if (!presence_check(input)){ error = "E42_2" result.flgname.push(flags[error].name); result.flgs.push(flags[error].flag); result.flgvalue.push(flags[error].value); result.flgmsg.push(flags[error].msg); } if(!length_field_check(input, "faxNum", "conf1")){ error = "E7_2" result.flgname.push(flags[error].name); result.flgs.push(flags[error].flag); result.flgvalue.push(flags[error].value); result.flgmsg.push(flags[error].msg); } if (result.flgname.length>0){ result.pass = false; } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function contact_fax_number(input){\r\n\tvar result = new Object();\r\n\tvar error;\r\n\tresult.flgname = [];\r\n\tresult.flgflag = [];\r\n\tresult.flgvalue = [];\r\n\tresult.flgmsg = [];\r\n\tresult.pass = true;\r\n\tif (!check_allowed_char(input, \"faxNum\", \"conf1\")){\r\n\t\terror = \"E7_1\"\r\n\t\tresult.flgname.push(flags[error].name);\r\n\t\tresult.flgflag.push(flags[error].flag);\r\n\t\tresult.flgvalue.push(flags[error].value);\r\n\t\tresult.flgmsg.push(flags[error].msg);\r\n\t\t}\r\n\tif ( check_req_char(input, \"faxNum\", \"conf1\")){\r\n\t\terror = \"E42_3\"\r\n\t\tresult.flgname.push(flags[error].name);\r\n\t\tresult.flgflag.push(flags[error].flag);\r\n\t\tresult.flgvalue.push(flags[error].value);\r\n\t\tresult.flgmsg.push(flags[error].msg);\r\n\t\t}\r\n\tif (!presence_check(input)){\r\n\t\terror = \"E42_2\"\r\n\t\tresult.flgname.push(flags[error].name);\r\n\t\tresult.flgflag.push(flags[error].flag);\r\n\t\tresult.flgvalue.push(flags[error].value);\r\n\t\tresult.flgmsg.push(flags[error].msg);\r\n\t\t}\r\n\r\n\tif(!length_field_check(input, \"faxNum\", \"conf1\")){\r\n\t\terror = \"E7_2\"\r\n\t\tresult.flgname.push(flags[error].name);\r\n\t\tresult.flgflag.push(flags[error].flag);\r\n\t\tresult.flgvalue.push(flags[error].value);\r\n\t\tresult.flgmsg.push(flags[error].msg);\r\n\t}\r\n\tif (result.flgname.length>0){\r\n\t\tresult.pass = false;\r\n\t}\r\n\treturn result;\r\n}", "function IsValidUSFaxNumber(fax) {\n var pattern = new RegExp(/^(1\\s*[-\\/\\.]?)?(\\((\\d{3})\\)|(\\d{3}))\\s*[-\\/\\.]?\\s*(\\d{3})\\s*[-\\/\\.]?\\s*(\\d{4})\\s*(([xX]|[eE][xX][tT])\\.?\\s*(\\d+))*$/);\n return pattern.test(fax);\n}", "function onSuccess(contacts) {\n for (var i=0; i<contacts.length; i++) {\n \n if (contacts[i].phoneNumbers != null) {\n $.each(contacts[i].phoneNumbers, function(i ,v){\n $.each(v, function(e, f){\n \n\n if (e == 'value') {\n var number = f.replace(/-|\\s/g,\"\"); \n console.log(number);\n\n }\n });\n });\n \n \n }\n\n }\n }", "async function markContacts(count) {\t \r\n\t\tconsole.log(\"markContacts() begin\");\r\n\t\t\r\n\t\tawait page.goto('https://myaccount.metrofax.com/myaccount');\r\n\t\t\r\n\t\t// Open 'Send Fax' interface\r\n\t\tconst SEND_FAXES = '#sendfaxestab';\r\n\t\tawait page.click(SEND_FAXES);\r\n\r\n\t\t// Open Contacts list\r\n\t\tawait page.waitFor(3000);\t\t// Wait for load to disappear\r\n\t\tconst CHOOSE_CONTACTS_SELECTOR = '#websend_to > div.right > span.doneLoadingContacts > a';\r\n\t\tawait page.waitForSelector(CHOOSE_CONTACTS_SELECTOR);\r\n\t\tawait page.click(CHOOSE_CONTACTS_SELECTOR);\r\n\t\t\r\n\t\tconst result = await page.evaluate((config) => {\r\n\t\t\tlet row = document.querySelectorAll(\"#addressBook_grid .ui-widget-content.jqgrow.ui-row-ltr\");\r\n\t\t\tif(row.length < 1) {\t\t// Something went wrong! No names to select\r\n\t\t\t\tthrow \"row is undefined\";\r\n\t\t\t}\r\n\r\n\t\t\tlet selectItems = [];\t// Array to hold selectable items\r\n\r\n\t\t\tfor(let i = 0; i < row.length; i++) {\r\n\t\t\t\t// Filter to specified \"Company Name\"\r\n\t\t\t\tif(row[i].querySelector('[aria-describedby=\"addressBook_grid_company\"]').textContent.trim().toUpperCase() == config.company.toUpperCase()) {\r\n\t\t\t\t\tselectItems.push(\"#jqg_addressBook_grid_\" + row[i].id);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn selectItems;\r\n\t\t}, config);\t\t\r\n\t\t\r\n\t\tconsole.log(\"Total = \" + result.length + \"; count = \" + count);\r\n\t\t\r\n\t\t// Check if all faxes already sent\r\n\t\tif(count >= result.length) {\r\n\t\t\tconsole.log(\"No more contacts to send to.\");\r\n\t\t\tawait page.goto('https://myaccount.metrofax.com/myaccount');\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\t\r\n\t\t// Limit the number of faxes per send\r\n\t\tlet limit = count + MAX_SEND;\r\n\t\t\r\n\t\tif(limit > result.length) {\r\n\t\t\tlimit = result.length;\r\n\t\t}\r\n\t\t\r\n\t\tconsole.log(\"limit = \" + limit);\r\n\r\n\t\t// Select contacts\r\n\t\tfor(; count < limit; count++) {\r\n\t\t\tconsole.log(\"Total = \" + result.length + \"; count = \" + count + \"; limit = \" + limit);\r\n\t\t\tawait page.click(result[count]);\r\n\t\t}\r\n\t\t\r\n\t\tconst ADD_SELECTOR = \"#addrbook_active_add_btn > div.btn_text\"\r\n\t\tawait page.waitForSelector(ADD_SELECTOR);\r\n\t\tawait page.click(ADD_SELECTOR);\r\n\t\t\r\n\t\tconsole.log(\"markContacts() done\");\r\n\t\t\r\n\t\treturn count;\r\n\t}", "function phoneNumber(no){\n\t\n}", "function extract_fax_info(sfax_response_obj){\n //var sfax_response_obj = JSON.parse('{\"inboundFaxItem\":{\"FaxId\":\"2190401201000980691\",\"Pages\":\"4\",\"ToFaxNumber\":\"18557916085\",\"FromFaxNumber\":\"5302731333\",\"FromCSID\":\"2731333\",\"FaxDateUtc\":\"4/1/2019 8:10:18 PM\",\"FaxSuccess\":\"1\",\"Barcodes\":{\"FirstBarcodePage\":1,\"TotalPagesWithBarcodes\":1,\"PagesWithBarcodes\":[1],\"BarcodeItems\":[{\"BarcodeSpacingXAxis\":0,\"BarcodeSpacingYAxis\":0,\"BarcodeType\":0,\"BarcodeMode\":1,\"BarcodeData\":\"9612019971424215517488\",\"BarcodeX\":157,\"BarcodeY\":1773,\"BarcodePage\":1,\"BarcodeScale\":0,\"BarcodeWidth\":684,\"BarcodeHeight\":303},{\"BarcodeSpacingXAxis\":0,\"BarcodeSpacingYAxis\":0,\"BarcodeType\":0,\"BarcodeMode\":1,\"BarcodeData\":\"[)>010295112840019971424215517488FDEB97142420501/12.0LBN725 E. Santa Clara Street, Ste 202San JoseCA 0610ZGD00811ZBetter Health Pharmacy12Z650488743423ZN22ZN20Z 028Z97142421551748831Z 33Z 34Z019KD261R818T33379P26Z1891\",\"BarcodeX\":116,\"BarcodeY\":1455,\"BarcodePage\":1,\"BarcodeScale\":0,\"BarcodeWidth\":556,\"BarcodeHeight\":245}]},\"InboundFaxId\":\"2190401201000980691\",\"FaxPages\":\"4\",\"FaxDateIso\":\"2019-04-01T20:10:18Z\",\"WatermarkId\":\"2190401201018997198\",\"CreateDateIso\":\"2019-04-01T20:10:18.1207720Z\"},\"isSuccess\":true,\"message\":null}')\n\n var res = {}\n \n if(!sfax_response_obj['inboundFaxItem']) return sfax_response_obj //if it's an error, then just return original content\n \n //debugEmail('SFax Response to Query about Inbound details', JSON.stringify(sfax_response_obj))\n \n res['faxPages'] = sfax_response_obj['inboundFaxItem']['FaxPages']\n res['faxSuccess'] = sfax_response_obj['inboundFaxItem']['FaxSuccess']\n var barcodes = sfax_response_obj['inboundFaxItem']['Barcodes']['BarcodeItems']\n var tracking_nums = []\n var rx = /971424215(\\d{6})/\n for(var i = 0; i < barcodes.length; i++){\n var parsed = barcodes[i]['BarcodeData'].toString().match(rx)\n if(parsed) tracking_nums.push(parsed[0].toString())\n }\n res['tracking_nums'] = \"\" + tracking_nums\n Logger.log(res)\n return res\n}", "function recalculateTax4Invoice()\n{\n if(document.getElementById('0-1001:0-1101-6301'))\n\t{\n\tfor (var k=0;k<=25;k++) \n\t{\n\t\tvar extndAmt=0;\n\t\tif(document.getElementById('0-1001:'+k+'-1101-1127') && document.getElementById('0-1001:'+k+'-1101-1127').value!=\"\")\n\t\t{\n\t\t\ttoGetTaxValues(k);\n\t\t\tshowPrice(k)\n\t\t}\n\t}\n\t}\n}", "function faxValidate(){\n var faxVal = document.getElementById(\"fax\").value;\n var err = document.getElementById('fax_error');\n\n // Allow blank value\n if (faxVal == \"\")\n {\n err.style=\"display:none\"; \n return true;\n }\n\n var phoneregex = /\\d{3}-\\d{3}-\\d{4}/;\n\n if(faxVal.length == 10){\n faxVal = faxVal.substr(0,3) + '-' + faxVal.substr(3,3) + '-' + faxVal.substr(6);\n document.getElementById(\"fax\").value = faxVal;\n }\n\n if(phoneregex.test(faxVal)){\n err.style=\"display:none\"; \n\n return true;\n }else{\n err.style=\"display:block\"; \n return false;\n }\n}", "function callContact(){\n\t\n\t/**\n\t * Appcelerator Analytics Call\n\t */\n\tTi.Analytics.featureEvent(Ti.Platform.osname+\".profile.callContactButton.clicked\");\n\t\n\t/**\n\t * Before we send the phone number to the platform for handling, lets first verify\n\t * with the user they meant to call the contact with an Alert Dialog\n\t * DOCS: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.AlertDialog\n\t */\n\tvar dialog = Ti.UI.createAlertDialog({\n\t cancel: 0,\n\t buttonNames: ['Cancel', 'Ok'],\n\t message: \"Are you sure you want to call \"+_args.firstName+\" at \"+_args.phone\n\t});\n\t\n\t/**\n\t * Event Handler associated with clicking the Alert Dialog, this handles the \n\t * actual call to the platform to make the phone call\n\t */\n\tdialog.addEventListener('click', function(e){\n\t\t if (e.index !== e.source.cancel){\n\t \n\t \t// IF WE ARE BUILDING FOR DEVELOPMENT PURPOSES - TRY CALLING A FAKE NUMBER\n\t \tif(ENV_DEV){\n\t \t\tTi.Platform.openURL(\"tel:+15125551212\");\n\t \t}\n\t \t// ELSE IF WE ARE BUILDING PRODUCTION - THEN USE THE LISTED NUMBER\n\t \telse if(ENV_PRODUCTION){\n\t \t\tTi.Platform.openURL(\"tel:\"+_args.phone);\n\t \t}\n\t } \n\t});\n\t\n\t/**\n\t * After everything is setup, we show the Alert Dialog to the User\n\t */\n\tdialog.show();\n\t \n}", "function validateFax(input) {\r\n\t\t$('div[id=invalid_fax]').remove();\r\n\t\tif (!isPhoneOrFaxNo(input)) {\r\n\t\t\t$.ajax({\r\n\t\t\t\ttype : \"POST\",\r\n\t\t\t\turl : \"logic/process_inputcheck.php\",\r\n\t\t\t\tdata : {\r\n\t\t\t\t\taction : \"get_message_invalid_fax\"\r\n\t\t\t\t}\r\n\t\t\t}).done(function(msg) {\r\n\t\t\t\t$('#invalid_fax').remove();\r\n\t\t\t\t$('#messagearea').append(msg);\r\n\t\t\t\t$('html, body').animate({\r\n\t\t\t\t\tscrollTop : $('#messagearea').offset().top\r\n\t\t\t\t}, 600);\r\n\t\t\t\treturn false;\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\t$('div[id=invalid_fax]').remove();\r\n\t\t}\r\n\t}", "function getcontact(name ,number)\n{\n if (typeof (webphone_api.plhandler) !== 'undefined' && webphone_api.plhandler !== null)\n return webphone_api.plhandler.GetContact(name, number);\n}", "function directBasedOnNum(reference) {\n\n\n\tconsole.log('name: ' + slotValue_companyName); \n\tconsole.log('country: ' + slotValue_country); \n\tconsole.log('region: ' + slotValue_region); \n\tconsole.log('content: '+ slotValue_certificationScenario); \n\tconsole.log('date: '+ slotValue_date); \n\t// console.log('solution: '+ slotValue_solution); \n\n\n\tvar query = format.queryToURLForm(slotValue_companyName, slotValue_country, slotValue_region, slotValue_certificationScenario, slotValue_date); \n\n\trequest.requestGetNum(query, function(response) { \n\n\t\tvar total = response.results.total; \n\t\tvar successful = response.results.successful; \n\t\tvar inProgress = response.results.inProgress; \n\n\t\tvar outputText = ''; \n\n\t\t// var numResults = output; \n\n\t\t// if 0 results found \n\t\tif (total === 0) { \n\n\t\t/*\texpand results unabled \n\n\t\t// zero results, country given\n\t\tif (slotValue_country !== null) { \n\n\t\t\t\t// attempt to offer to expand results in entire region - unabled \n\n\t\t\t\t// nullify current slotValue_country and run search in region \n\t\t\t\t// var URL = hostNum + format.queryToURLForm(slotValue_name, null, global_region, slotValue_content, slotValue_date, slotValue_solution); \n\n\t\t\t\t//var URL = hostNum + format.queryToURLForm(slotValue_name, null, global_region, slotValue_content, slotValue_date); \n\n\t\t\t\tvar query_2 = format.queryToURLForm(slotValue_name, null, global_region, slotValue_content, slotValue_date); \n\n \t\t\t//Request(URL, function(response) { \n\n \t\t\trequest.requestGetNum(query_2, function(response) { \n\n\t\t\t\t\tvar outputText_noResults = 'No results found for ' + format.formatQuery(slotValue_name, slotValue_country, slotValue_region, slotValue_content, slotValue_date) + '. You can start over by saying start over or say cancel to cancel.' \n\t\t\t\t\tvar outputText_offerExpand = 'No results found for ' + format.formatQuery(slotValue_name, slotValue_country, slotValue_region, slotValue_content, slotValue_date) + '. Would you like to search in the region?'; \n\n\t\t\t\t\tvar total = response.results.total; \n\n\t\t\t\t\t// if results in region \n\t\t\t\t\tif (total > 0) { \n\n\t\t\t\t\t\treference.handler.state = states.EXPAND_SEARCH; \n\t\t\t\t\t\treference.emit(':ask', outputText_offerExpand, outputText_offerExpand); \n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if no results in region \n\t\t\t\t\telse { \n\n\t\t\t\t\t\treference.handler.state = states.NO_RESULTS; \n\t\t\t\t//\t\treference.emit(':ask', outputText_noResults, outputText_noResults); \n\t\t\t\t\t\treference.emit(':ask', updated_noResults(), againNoResults); \n\n\t\t\t\t\t}\n\n\t\t\t\t}); \n\n\t\t\t//\tvar expandQuery = 'No results found for ' + format.formatQuery() + '. Would you like to search in the region?'; \n\t\t\t//\treference.handler.state = states.EXPAND_SEARCH; \n\t\t\t//\treference.emit(':ask', expandQuery, expandQuery); \n\n\t\t\t} \n\n\t\t\telse { \n\n\t\t\t\treference.handler.state = states.NO_RESULTS; \n\t\t\t\treference.emit(':ask', updated_noResults(), againNoResults); \n\n\t\t \t} \n\n\n\n\t\t \t*/ \n\n\n\t\t\t\treference.handler.state = states.NO_RESULTS; \n\t\t\t\treference.emit(':ask', updated_noResults(), againNoResults); \n\n\n\t\t}\n\n\t\t// if 1 result found \n\t\telse if (total === 1) { \n\t\t\treference.handler.state = states.ONE_RESULT;\n\t\t\treference.emit(':ask', updated_oneResult(), againOneResult);\n\n\t\t} \n\n\t\t// multiple results found \n\t\telse {\n\n\t\t\t// would you like to narrow down answers \n\t\t\treference.handler.state = states.MULTIPLE_RESULTS; \n\n\t\t\t// if within threshold\n\t\t\tif (total <= resultThreshold) { \n\t\t\t\treference.emit(':ask', updated_moreResults(total, successful, inProgress), updated_againMoreResults(total)); \n\t\t\t}\n\n\t\t\t// if above threshold \n\t\t\telse { \n\t\t\t\treference.emit(':ask', updated_moreThanThreshold(total, successful, inProgress), updated_againMoreThanThreshold(total)); \n\n\t\t\t}\n\t\t\n\n\t\t\t// ------------------------------------------------------------- WOULD THIS WORK?????? --------------------------------------------------------------------\n//\t\t\temitMoreResults(reference); \n\t\t\t// var outputText = numResults + ' results found for ' + format.formatQuery() + '. Continue selecting?'; \n\t\t\t//reference.emit(':ask', updated_moreResults(total, successful, inProgress), updated_againMoreResults(total)); \n\n\t\t\t} \n\n\t }); \n\n\t//\tvar numResults = getNumResults(); \n\t//\tvar query = format.formatQuery();\n\n\n}", "function getFeebonachi(index, number) {\n if(typeof index===\"undefined\" || number !==\"undefined\"){\nlet sum = 0;\nlet feebo = getClouserFeebo(1, number);\n\n\n };\n if(typeof number===\"undefined\" || index!==\"undefined\"){\nreturn getFeeboByIndex(index);\n };\n if(index===\"undefined\" || number ===\"undefined\"){\n return false;\n }\n\n\n}", "function get_barcode_info(fax_id,api_key,token){\n var url = \"https://api.sfaxme.com/api/InboundFaxInfo?token=\" + encodeURIComponent(token) + \"&apikey=\" + encodeURIComponent(api_key) + \"&FaxId=\" + encodeURIComponent(fax_id)\n try{\n var res = JSON.parse(UrlFetchApp.fetch(url).getContentText())\n return extract_fax_info(res)\n } catch(err){\n return err\n }\n}", "function calculate() { \r\n\tnumber1 = Number(document.getElementById('number1').value);\r\n\tconsole.log(number1);\r\n\tif (number1 <= 47630) {\r\n\t\tfederalTax = (number1 - 0) * 0.15 + 0;\r\n\t\tconsole.log(federalTax);\r\n\t} else if (number1 > 47630 && number1 <= 95259) {\r\n\t\tfederalTax = (number1 - 47630) * 0.205 + 7145;\r\n\t} else if (number1 > 95259 && number1 <= 147667) {\r\n\t\tfederalTax = (number1 - 95259) * 0.26 + 16908;\r\n\t} else if (number1 > 147667 && number1 <= 210371) {\r\n\t\tfederalTax = (number1 - 147667) * 0.29 + 30535;\r\n\t} else if (number1 > 210371) {\r\n\t\tfederalTax = (number1 - 210371) * 0.33 + 48719;\r\n\t}\t\r\n\tdocument.getElementById(\"output\").value = federalTax;\r\n\treturn federalTax;\r\n}", "function sabrixAfterSubmit(eventtype) {\n\ttry {\n\t\tvar callsabrix = 0;\n\t\tif(eventtype == 'create' || eventtype == 'edit') {\n\t\t\t\n\t\t\tvar rec = nlapiLoadRecord(nlapiGetRecordType(),nlapiGetRecordId());\n\t\t\t//Do No calculate Tax\n\t\t\tvar donotcalculatetax = rec.getFieldValue('custbody_spk_donotcalculatetax');\n\t\t\tif(donotcalculatetax == 'T') {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcallsabrix = 1;\n\t\t\tvar string1;\n\t\t\tstring1 = '{ ';\n\t\t\t\n\t\t\tvar shiptoCustId = rec.getFieldValue('custbody_end_user');\n\t\t\tvar CustomerId = rec.getFieldValue('entity');\n\t\t\tvar ShipToCustomerId = rec.getFieldValue('custbody_spk_shiptocustomerid');\n\t\t\tvar ShipToCustomerName = rec.getFieldValue('custbody_spk_shiptocustomername');\n\t\t\tif(ShipToCustomerName) {\n\t\t\t\tShipToCustomerName = escapeChar(rec.getFieldValue('custbody_spk_shiptocustomername'));\n\t\t\t}\n\t\t\tvar CustomerCode = rec.getFieldValue('custbody_spk_billtocustomerid');\n\t\t\tvar CustomerName = rec.getFieldValue('custbody_spk_billtocustomername');\n\t\t\tif(CustomerName) {\n\t\t\t\tCustomerName = escapeChar(rec.getFieldValue('custbody_spk_billtocustomername'));\n\t\t\t}\n\t\t\t\n\t\t\tvar createdfrom = rec.getFieldValue('createdfrom');\n\t\t\tnlapiLogExecution('DEBUG','createdfrom',createdfrom);\n\t\t\n\t\t\tvar ExemptionNo = rec.getFieldValue('tranid');\n\n\t\t\tvar FxRate = rec.getFieldValue('exchangerate');\n\t\t\t//For Non-US country, we need to consider Customer Registration Number for VAT calculation\n\t\t\tvar CustomerRegistrationNumber = \"\";\n\t\t\t\n\t\t\t//Ship From : Subsidiary Address\n\t\t\tvar AddressCode1 = \"01\";\n\t\t\tvar subsidiary = rec.getFieldValue('subsidiary');\n\t\t\tvar sub = rec.getFieldValue('custbody_spk_entity_address'); // TAX ENTITY ADDRESS\n\t\t\tvar subrec = sub.split('|');\n\t\t\tvar subcity = subrec[0];\n\t\t\tvar subregion = subrec[1];\n\t\t\tvar subcountry = subrec[2];\n\t\t\tvar subprovince = '';\n\t\t\tvar subcode = subrec[3];\n\t\t\tvar subcurrency = \"USD\" ; //subrec.getFieldValue('currency');\n\t\t\tnlapiLogExecution('DEBUG','subcity :'+subcity,' subregion :'+subregion+ ' subcountry :'+subcountry+ ' subprovince :'+subprovince+ ' subcode '+subcode );\n\t\t\t\n\t\t\t//Ship TO : Customer/Invoice Shipping Address\n\t\t\tvar AddressCode2 = \"02\";\n\t\t\tvar shipaddress = rec.getFieldValue('shipaddress');\n\t\t\tvar shiptocity = '';\n\t\t\tvar shiptoregion = '';\n\t\t\tvar shiptocountry = '';\n\t\t\tvar shiptocode = '';\n\t\t\tvar shiptoprovince = '';\n\t\t\tshiptocity = rec.getFieldValue('shipcity');\n\t\t\tshiptoregion = rec.getFieldValue('shipstate');\n\t\t\tshiptocountry = rec.getFieldValue('shipcountry');\n\t\t\tshiptocode = rec.getFieldValue('shipzip');\n\t\t\tnlapiLogExecution('DEBUG','shiptocity1 :'+shiptocity,' shiptoregion :'+shiptoregion+ ' shiptocountry :'+shiptocountry+ ' shiptocode :'+shiptocode+ ' shiptoprovince '+shiptoprovince );\n\t\t\t\n\t\t\tvar CompanyCode = rec.getFieldValue('custbody_spk_subsidiary_code');\n\t\t\tif(CompanyCode) {\n\t\t\t\tCompanyCode = CompanyCode;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tCompanyCode = rec.getFieldValue('subsidiary');\n\t\t\t}\n\t\t\tif(CompanyCode) { CompanyCode = '\"'+CompanyCode+'\"';}\n\t\t\telse { CompanyCode = '\"\"'; }\n\t\t\tstring1+= '\"CompanyCode\": ' +CompanyCode;\n\t\t\t\n\t\t\tvar CompanyRole = \"S\";\n\t\t\tif(CompanyRole) { CompanyRole = '\"'+CompanyRole+'\"';}\n\t\t\telse { CompanyRole = '\"\"'; }\n\t\t\tstring1+= ', \"CompanyRole\": ' +CompanyRole;\n\n\t\t\tif (ShipToCustomerId) { ShipToCustomerId = '\"'+ShipToCustomerId+'\"'; }\n\t\t\telse { ShipToCustomerId = '\"\"'; }\n\t\t\tstring1+= ', \"ShipToCustomerId\": ' +ShipToCustomerId;\n\n\t\t\tif (ShipToCustomerName) { ShipToCustomerName = '\"'+ShipToCustomerName+'\"'; }\n\t\t\telse { ShipToCustomerName = '\"\"'; }\n\t\t\tstring1+= ', \"ShipToCustomerName\": ' +ShipToCustomerName;\n\t\t\t\n\t\t\tvar DocType = nlapiGetRecordType();\n\t\t\tif (DocType) { DocType = '\"'+DocType+'\"'; }\n\t\t\telse { DocType = '\"\"'; }\n\t\t\tstring1+= ', \"DocType\": ' +DocType;\n\t\t\t\n\t\t\tif (CustomerCode) { CustomerCode = '\"'+CustomerCode+'\"'; }\n\t\t\telse { CustomerCode = '\"\"'; }\n\t\t\tstring1+= ', \"CustomerCode\": ' +CustomerCode;\n\n\t\t\tif (CustomerName) { CustomerName = '\"'+CustomerName+'\"'; }\n\t\t\telse { CustomerName = '\"\"'; }\n\t\t\tstring1+= ', \"CustomerName\": ' +CustomerName;\n\t\t\t\n\t\t\tvar DocDateold = rec.getFieldValue('trandate');\n\t\t\tvar DocDate = '';\n\t\t\tif(DocDateold){\n\t\t\t\tvar docdatesplit = DocDateold.split(\"/\");\n\t\t\t\tDocDate = docdatesplit[2]+\"-\"+docdatesplit[0]+\"-\"+docdatesplit[1];\n\t\t\t}\n\t\t\tif (DocDate) { DocDate = '\"'+DocDate+'\"'; }\n\t\t\telse { DocDate = '\"\"'; }\n\t\t\tstring1+= ', \"DocDate\": ' +DocDate;\n\t\t\t\n\t\t\t//Fiscal Date is same as DocDate\n\t\t\tstring1+= ', \"FiscalDate\": '+DocDate;\n\t\t\t\n\t\t\tvar Client = \"NetSuite\";\n\t\t\tif (Client) { Client = '\"'+Client+'\"'; }\n\t\t\telse { Client = '\"\"'; }\n\t\t\tstring1+= ', \"Client\": ' +Client;\n\t\t\t\n\t\t\t// Invoice Number\n\t\t\tvar DocCode = rec.getFieldValue('tranid'); \n\t\t\tif (DocCode) { DocCode = '\"'+DocCode+'_'+nlapiGetRecordType()+'\"'; }\n\t\t\telse { DocCode = '\"\"'; }\n\t\t\tstring1+= ', \"DocCode\": ' +DocCode;\n\t\t\t\n\t\t\tvar Discount = rec.getFieldValue('discounttotal');\n\t\t\tif (Discount) { Discount = '\"'+Discount+'\"'; }\n\t\t\telse { Discount = '\"0\"'; }\n\t\t\tstring1+= ', \"Discount\": ' +Discount;\n\t\t\t\n\t\t\tvar CurrencyCode = subcurrency;\n\t\t\tif (CurrencyCode) { CurrencyCode = '\"'+CurrencyCode+'\"'; }\n\t\t\telse { CurrencyCode = '\"\"'; }\n\t\t\tstring1+= ', \"CurrencyCode\": ' +CurrencyCode;\n\t\t\t\n\t\t\t//After Submit set Is committed to Yes, so that the Unique TranId is created and submitted in Sabrix\n\t\t\tvar IsAudited = \"commit\";\n\t\t\tstring1+= ', \"IsCommit\": ' +'\"Y\"';\n\t\t\t\n\t\t\tvar OriginalInvoiceNumber = '';\n\t\t\tvar OriginalInvoiceDate = '';\n\t\t\tnlapiLogExecution('DEBUG', 'createdfrom1 '+createdfrom, 'DocType ' +DocType);\n\t\t\tif(nlapiGetRecordType() == 'creditmemo' || nlapiGetRecordType() == 'cashrefund') {\n\t\t\t\n\t\t\t\tvar refundRec = '';\n\t\t\t\tif(createdfrom && nlapiGetRecordType() == 'creditmemo') {\n\t\t\t\t\trefundRec = nlapiLoadRecord('invoice', createdfrom);\n\t\t\t\t}\n\t\t\t\tif(createdfrom && nlapiGetRecordType() == 'cashrefund') {\n\t\t\t\t\trefundRec = nlapiLoadRecord('cashsale', createdfrom);\n\t\t\t\t}\n\t\t\t\tnlapiLogExecution('DEBUG', 'createdfrom '+createdfrom, 'refundRec ' +refundRec);\n\t\t\t\tif(refundRec) {\n\t\t\t\t\tOriginalInvoiceNumber = refundRec.getFieldValue('tranid');\n\t\t\t\t\tvar orgtranDate = refundRec.getFieldValue('trandate');\n\t\t\t\t\tnlapiLogExecution('DEBUG', 'createdfrom '+createdfrom, 'OriginalInvoiceNumber ' +OriginalInvoiceNumber+ ' orgtranDate '+orgtranDate);\n\t\t\t\t\tif(orgtranDate) {\n\t\t\t\t\t\tvar orgtranDateSplit = orgtranDate.split(\"/\");\n\t\t\t\t\t\tvar OrgInvDate = orgtranDateSplit[2]+\"-\"+orgtranDateSplit[0]+\"-\"+orgtranDateSplit[1];\n\t\t\t\t\t\tOriginalInvoiceDate = OrgInvDate;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (OriginalInvoiceNumber) { OriginalInvoiceNumber = '\"'+OriginalInvoiceNumber+'\"'; }\n\t\t\telse { OriginalInvoiceNumber = '\"\"'; }\n\t\t\tstring1+= ', \"OriginalInvoiceNumber\": ' +OriginalInvoiceNumber;\n\t\t\t\n\t\t\tif (OriginalInvoiceDate) { OriginalInvoiceDate = '\"'+OriginalInvoiceDate+'\"'; }\n\t\t\telse { OriginalInvoiceDate = '\"\"'; }\n\t\t\tstring1+= ', \"OriginalInvoiceDate\": ' +OriginalInvoiceDate;\n\t\t\t\n\t\t\tvar InvoiceCurrency = rec.getFieldText('currency');\n\t\t\tif (InvoiceCurrency) { InvoiceCurrency = '\"'+InvoiceCurrency+'\"'; }\n\t\t\telse { InvoiceCurrency = '\"\"'; }\n\t\t\tstring1+= ', \"InvoiceCurrency\": ' +InvoiceCurrency;\n\t\t\t\n\t\t\tif (FxRate) { FxRate = '\"'+FxRate+'\"'; }\n\t\t\telse { FxRate = '\"\"';}\n\t\t\tstring1+= ', \"FxRate\": ' +FxRate;\n\t\t\t\n\t\t\tvar InvoiceAmount = rec.getFieldValue('subtotal');\n\t\t\tif(nlapiGetRecordType() == 'creditmemo' || nlapiGetRecordType() == 'cashrefund') {\n\t\t\t\tInvoiceAmount = parseFloat(InvoiceAmount * -1);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tInvoiceAmount = InvoiceAmount;\n\t\t\t}\n\t\t\tif (InvoiceAmount) { InvoiceAmount = '\"'+InvoiceAmount+'\"'; }\n\t\t\telse { InvoiceAmount = '\"0\"'; }\n\t\t\tstring1+= ', \"InvoiceAmount\": ' +InvoiceAmount;\n\t\t\t\n\t\t\tif (CustomerRegistrationNumber){ CustomerRegistrationNumber = '\"'+CustomerRegistrationNumber+'\"'; }\n\t\t\telse { CustomerRegistrationNumber = '\"\"'; }\n\t\t\tstring1+= ', \"CustomerRegistrationNumber\": ' +CustomerRegistrationNumber;\n\t\t\t\n\t\t\tstring1+= ', \"Addresses\": [{ '\n\t\t\t\n\t\t\t//Ship From : Subsidiary Address\n\t\t\tif (AddressCode1){ AddressCode1 = '\"'+AddressCode1+'\"'; }\n\t\t\telse{ AddressCode1 = '\"\"'; }\n\t\t\tstring1+= '\"AddressCode\": ' +AddressCode1;\n\t\t\t\t\n\t\t\tif (subcity){ subcity = '\"'+subcity+'\"'; }\n\t\t\telse{ subcity = '\"\"'; }\n\t\t\tstring1+= ', \"City\": ' +subcity;\n\t\t\t\n\t\t\tif (subregion){ subregion = '\"'+subregion+'\"'; }\n\t\t\telse{ subregion = '\"\"'; }\n\t\t\tstring1+= ', \"Region\": ' +subregion;\n\t\t\t\n\t\t\tif (subcountry){ subcountry = '\"'+subcountry+'\"'; }\n\t\t\telse { subcountry = '\"\"'; }\n\t\t\tstring1+= ', \"Country\": ' +subcountry;\n\t\t\t\n\t\t\tif (subcode){ subcode = '\"'+subcode+'\"'; }\n\t\t\telse { subcode = '\"\"'; }\n\t\t\tstring1+= ', \"PostalCode\": ' +subcode;\n\t\t\t\n\t\t\tstring1+= ', \"Province\": \"\" ' ;\n\t\t\tstring1+= ' }, { '\n\t\t\t\n\t\t\t//Ship To : Invoice shipping Address\n\t\t\tif (AddressCode2){ AddressCode2 = '\"'+AddressCode2+'\"'; }\n\t\t\telse{ AddressCode2 = '\"\"'; }\n\t\t\tstring1+= '\"AddressCode\": ' +AddressCode2;\n\t\t\t\n\t\t\tif (shiptocity){ shiptocity = '\"'+shiptocity+'\"'; }\n\t\t\telse{ shiptocity = '\"\"'; }\n\t\t\tstring1+= ', \"City\": ' +shiptocity;\n\t\t\t\n\t\t\tif (shiptoregion){ shiptoregion = '\"'+shiptoregion+'\"'; }\n\t\t\telse{ shiptoregion = '\"\"'; }\n\t\t\tstring1+= ', \"Region\": ' +shiptoregion;\n\t\t\t\n\t\t\tif (shiptocountry){ shiptocountry = '\"'+shiptocountry+'\"'; }\n\t\t\telse{ shiptocountry = '\"\"'; }\n\t\t\tstring1+= ', \"Country\": ' +shiptocountry;\n\t\t\t\n\t\t\tif (shiptocode){ shiptocode = '\"'+shiptocode+'\"'; }\n\t\t\telse { shiptocode = '\"\"'; }\n\t\t\tstring1+= ', \"PostalCode\": ' +shiptocode;\n\t\t\t\n\t\t\tstring1+= ', \"Province\": \"\" ' ;\n\n\t\t\tstring1+= ' }], \"Lines\": [';\n\t\t\t//Tax calls should be made for rebillable expense invoices , checking item count- if zero then do not call sabrix request : Begin\n\t\t\tvar count = rec.getLineItemCount('item');\n\t\t\tif(count == 0 ) {\n\t\t\t\tcallsabrix = 0;\n\t\t\t} // End\n\t\t\telse {\n\t\t\t\tvar isin = 0;\n\t\t\t\tfor(i = 1;i < count+1; i++) {\n\t\t\t\t\tvar TaxCode = rec.getLineItemText('item','taxcode',i);\n\t\t\t\t\t// ENHC0051967- Dynamic validation of script parameters for tax codes editable - Begin\n\t\t\t\t\tvar isparamtaxcode = 0;\n\t\t\t\t\tif(sabrixTaxcode) {\n\t\t\t\t\t\tvar paramTaxcode = sabrixTaxcode.split(\",\");\n\t\t\t\t\t\tfor(var y = 0; y<=paramTaxcode.length; y++) {\n\t\t\t\t\t\t\tif(TaxCode == paramTaxcode[y]) {\n\t\t\t\t\t\t\t\tisparamtaxcode = 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\t// ENHC0051967- End\n\t\t\t\t\t//nlapiLogExecution('DEBUG','TaxCode '+TaxCode, ' sabrixTaxcode '+sabrixTaxcode+ ' paramAvatax '+paramAvatax+ 'paramSabtax '+paramSabtax );\n\t\t\t\t\tnlapiLogExecution('DEBUG','TaxCode '+TaxCode, ' sabrixTaxcode '+sabrixTaxcode+ ' isparamtaxcode '+isparamtaxcode);\n\t\t\t\t\tvar ItemCodevalue = rec.getLineItemText('item','item',i);\n\t\t\t\t\tvar itemintId = rec.getLineItemValue('item','item',i);\n\t\t\t\t\tvar ItemCode = '';\n\t\t\t\t\tif(ItemCodevalue) {\n\t\t\t\t\t\tvar ItemCodeId = ItemCodevalue.split(\":\")[1];\n\t\t\t\t\t\tif(ItemCodeId) {\n\t\t\t\t\t\t\tItemCode = ItemCodeId;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tItemCode = ItemCodevalue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tvar istax = '';\n\t\t\t\t\tif (ItemCode != \"Description\" && isparamtaxcode == 1 ) {\n\t\t\t\t\t\tvar CommodityCode = rec.getLineItemValue('item','custcol_spk_commodity_taxcode',i);\n\t\t\t\t\t\tvar AccountingCode = rec.getLineItemValue('item','custcol_spk_itemincomeaccnum',i);\n\t\t\t\t\t\tnlapiLogExecution('DEBUG','CommodityCode',CommodityCode);\n\t\t\t\t\t\tvar BundleFlag = rec.getLineItemValue('item','custcol_bundle',i);\n\t\t\t\t\t\tvar BaseBundleCode = rec.getLineItemValue('item','custcol_spk_basebundlecode',i);\n\t\t\t\t\t\tvar Description = rec.getLineItemValue('item','description',i);\n\t\t\t\t\t\tif(Description) {\n\t\t\t\t\t\t\tDescription = escapeChar(rec.getLineItemValue('item','description',i));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar Qty = rec.getLineItemValue('item','quantity',i);\n\t\t\t\t\t\tvar Amount = rec.getLineItemValue('item','amount',i);\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar UOM = \" \";\n\t\t\t\t\t\tif(isin == 1) {\n\t\t\t\t\t\tistax = ' ,{ ';\n\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\tistax = ' { ';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisin = 1;\n\t\t\t\t\t\tvar LineNo = '\"'+i+'\"';\n\t\t\t\t\t\tstring1+= istax+'\"LineNo\": ' +LineNo;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (AccountingCode){ AccountingCode = '\"'+AccountingCode+'\"'; }\n\t\t\t\t\t\telse{ AccountingCode = '\"\"'; }\n\t\t\t\t\t\tstring1+= ', \"AccountingCode\": ' +AccountingCode;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (CommodityCode){ CommodityCode = '\"'+CommodityCode+'\"'; }\n\t\t\t\t\t\telse{ CommodityCode = '\"\"'; }\n\t\t\t\t\t\tstring1+= ', \"TaxCode\": ' +CommodityCode;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (ItemCode){ ItemCode = '\"'+ItemCode+'\"'; }\n\t\t\t\t\t\telse{ ItemCode = '\"\"'; }\n\t\t\t\t\t\tstring1+= ', \"ItemCode\": ' +ItemCode;\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (BundleFlag == 'T') { BundleFlag = '\"Yes\"'; }\n\t\t\t\t\t\telse { BundleFlag = '\"No\"'; }\n\t\t\t\t\t\tstring1+= ', \"BundleFlag\": ' +BundleFlag;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (BaseBundleCode){ BaseBundleCode = '\"'+BaseBundleCode+'\"'; }\n\t\t\t\t\t\telse{ BaseBundleCode = '\"\"'; }\n\t\t\t\t\t\tstring1+= ', \"BaseBundleCode\": ' +BaseBundleCode;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (Description){ Description = '\"'+Description+'\"'; }\n\t\t\t\t\t\telse{ Description = '\"\"'; }\n\t\t\t\t\t\tstring1+= ', \"Description\": ' +Description;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(Qty){ Qty = '\"'+Qty+'\"'; }\n\t\t\t\t\t\telse{ Qty = '\"0\"'; }\n\t\t\t\t\t\tstring1+= ', \"Qty\": ' +Qty;\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar sfdcunitCost = rec.getLineItemValue('item','custcol_spk_sfdc_unit_cost',i);\n\t\t\t\t\t\tif(sfdcunitCost) {\n\t\t\t\t\t\t\tAmount = parseFloat(sfdcunitCost*Qty);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(nlapiGetRecordType() == 'creditmemo' || nlapiGetRecordType() == 'cashrefund') {\n\t\t\t\t\t\t\tAmount = parseFloat(Amount * -1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tAmount = Amount;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (Amount){ Amount = '\"'+Amount+'\"'; }\n\t\t\t\t\t\telse { Amount = '\"0\"'; }\n\t\t\t\t\t\tstring1+= ', \"Amount\": ' +Amount;\n\t\t\t\t\t\t\n\t\t\t\t\t\tstring1+= ', \"DiscountAmount\": \"0\" ';\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (UOM){ UOM = '\"'+UOM+'\"'; }\n\t\t\t\t\t\telse{ UOM = '\"\"'; }\n\t\t\t\t\t\tstring1+= ', \"UOM\": ' +UOM;\n\t\t\t\t\t\tstring1 = string1 + '}';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tstring1+= ']}'\n\t\t\t\n\t\t\tvar isSabrixError = rec.getFieldValue('custbody_spk_sabrixtaxerrorflag');\n\t\t\tvar traninternalId = ''\n\t\t\tnlapiLogExecution('DEBUG','String1',string1);\n\t\t\t\n\t\t\t//On edit call Sabrix Request to calculate tax only if certain fields are changed\n\t\t\tif(eventtype == 'edit') {\n\t\t\t\tcallsabrix = changeinFields(rec);\n\t\t\t\tif(isSabrixError == 'T') {\n\t\t\t\t\tcallsabrix = 1;\n\t\t\t\t}\n\t\t\t\tnlapiLogExecution('DEBUG','callsabrix',callsabrix);\n\t\t\t}\n\t\t\tif(DocType == 'invoice' && count == 0) {\n\t\t\t\tcallsabrix = 0;\n\t\t\t}\n\t\t\t if(callsabrix == 1) {\n\t\t\t\tnlapiLogExecution('DEBUG','After Submit current time Sabrix Request', new Date());\n\t\t\t\t//var sabrixurl = \"https://leadtoordersabrixstg.cloudhub.io/api/sabrix/calculateSalesTax\";\n\t\t\t\t//var authorizationHeader = 'Basic Y29yZXN2Y3VzZXI6Y29yZXN2Y3B3ZCEy';\t\t\n\t\t\n\t\t\t\tnlapiLogExecution('DEBUG','Auth Key '+authorizationHeader,' sabrixurl '+sabrixurl);\n\t\t\t\tvar header = new Array();\n\t\t\t\theader['Authorization'] = authorizationHeader;\n\t\t\t\theader['Accept'] = 'application/json';\n\t\t\t\theader['Content-Type'] = 'application/json';\n\t\t\t\tvar response = nlapiRequestURL(sabrixurl,string1,header,'POST');\n\t\t\t\tnlapiLogExecution('DEBUG','Response',response.getCode()+':::'+response.getBody());\n\t\t\t\tnlapiLogExecution('DEBUG','After Submit current time Sabrix Response', new Date());\n\t\t\t\tvar response_obj = JSON.parse(response.getBody());\n\t\t\t\tvar statuserrormsg = '';\n\t\t\t\tif(response.getCode() != '200'){\n\t\t\t\t\trec.setFieldValue('custbody_spk_sabrixtaxerrorflag','T');\n\t\t\t\t\trec.setFieldValue('custbody_spk_sabrixtaxerrormessage',response.getBody());\n\t\t\t\t}\n\t\t\t\tif(response.getCode() == '200'){\n\t\t\t\t\tvar successstr = response.getBody();\n\t\t\t\t\tif(successstr) {\n\t\t\t\t\t\tvar CalculationDirection = response_obj.CalculationDirection;\n\t\t\t\t\t\tnlapiLogExecution('DEBUG','CalculationDirection ', CalculationDirection);\t\n\t\t\t\t\t\tif(CalculationDirection == \"R\") {\n\t\t\t\t\t\t\trec.setFieldValue('taxamountoverride',0);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar TotalTax = '';\n\t\t\t\t\t\t\tif(nlapiGetRecordType() == 'creditmemo' || nlapiGetRecordType() == 'cashrefund') {\n\t\t\t\t\t\t\t\tTotalTax = parseFloat(response_obj.TotalTax * -1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tTotalTax = response_obj.TotalTax;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar TaxRate ='';\n\t\t\t\t\t\t\tvar Taxableamt = '';\n\t\t\t\t\t\t\tif(response_obj.TaxLines) {\n\t\t\t\t\t\t\t\tfor(j=0; j < response_obj.TaxLines.length; j++) {\n\t\t\t\t\t\t\t\t\tvar taxLinesobj = response_obj.TaxLines[j];\n\t\t\t\t\t\t\t\t\tvar LineNo = taxLinesobj.LineNo;\n\t\t\t\t\t\t\t\t\tTaxRate = taxLinesobj.Rate;\n\t\t\t\t\t\t\t\t\tTaxableamt = taxLinesobj.Taxable;\n\t\t\t\t\t\t\t\t\tnlapiLogExecution('DEBUG','TaxRate '+TaxRate, ' Taxableamt '+Taxableamt);\t\n\t\t\t\t\t\t\t\t\trec.setLineItemValue('item','taxrate1',LineNo, parseFloat(TaxRate * 100));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\trec.setFieldValue('taxamountoverride',TotalTax);\n\t\t\t\t\t\t\trec.setFieldValue('custbody_spk_sabrixtaxerrorflag','F');\n\t\t\t\t\t\t\trec.setFieldValue('custbody_spk_sabrixtaxerrormessage','');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttraninternalId = nlapiSubmitRecord(rec);\n\t\t\t\tnlapiLogExecution('DEBUG','traninternalId ', traninternalId);\t\n\t\t\t\t//Submit the Sabrix Integration Log Custom Record to keep track of Request and Response\n\t\t\t\tCreateSabrixLog(nlapiGetRecordType(),eventtype,string1,response.getBody(),traninternalId,response.getCode(),'T');\n\t\t\t} \n\t\t\t\n\t\t}\n\t}\n\tcatch(e) {\n\t\tvar syserror = '';\n\t\tif(e instanceof nlobjError) {\n\t\t\tnlapiLogExecution( 'ERROR', 'system error', e.getCode() + '\\n' + e.getDetails());\n\t\t\tsyserror = e.getCode() + '\\n' + e.getDetails();\n\t\t} \n\t\telse { \n\t\t\tsyserror = e.getCode() + '\\n' + e.getDetails();\n\t\t}\n\t\tnlapiSubmitField(nlapiGetRecordType(),nlapiGetRecordId(),['custbody_spk_sabrixtaxerrorflag','custbody_spk_sabrixtaxerrormessage'],['T', syserror]);\n\t\tCreateSabrixLog(nlapiGetRecordType(),eventtype,string1,response.getBody(),nlapiGetRecordId(),500, 'T');\n\t\tvar err = nlapiCreateError('Sabrix Error :', syserror);\n\t\tthrow err;\n\t}\n}", "function isPhoneOrFaxNo(input) {\r\n\t\tvar reg_exp = /^(((\\+|00)\\d{2})|0)\\d+\\s?(\\/|-)?\\s?\\d+/;\r\n\t\tif (input.match(reg_exp)) {\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "function _init_contact_person_fax_field(){\n try{\n _current_field_num++;\n var field_num = _current_field_num; \n var is_required_field = false;\n var contact_person_fax_field = Ti.UI.createTableViewRow({\n className:'set_client_contact_fax',\n filter_class:'set_client_contact_fax',\n valueRequired:is_required_field,//for check value\n valuePosition:2,//for check value\n valueType:'value',//for check value,\n valuePrompt:'Please enter fax.',//for check value\n height:self.default_table_view_row_height\n });\n var contact_person_fax_title_field = Ti.UI.createLabel({\n text:'Fax',\n color:self.font_color,\n font:{\n fontSize:self.font_size,\n fontWeight:self.font_weight\n },\n left:10\n });\n contact_person_fax_field.add(contact_person_fax_title_field);\n var contact_person_fax_content_field = Ti.UI.createTextField({\n width:self.set_a_field_width_in_table_view_row(contact_person_fax_title_field.text),\n height:self.default_table_view_row_height,\n hintText:(is_required_field)?'Required':'Optional',\n textAlign:'right',\n right:30,\n value:_client_contact_fax,\n color:self.selected_value_font_color,\n font:{\n fontSize:self.normal_font_size\n },\n returnKeyType: Ti.UI.RETURNKEY_NEXT,\n keyboardType:Titanium.UI.KEYBOARD_NUMBERS_PUNCTUATION,\n clearButtonMode:Titanium.UI.INPUT_BUTTONMODE_ONFOCUS\n });\n contact_person_fax_field.add(contact_person_fax_content_field);\n self.data.push(contact_person_fax_field);\n contact_person_fax_content_field.addEventListener('change',function(e){\n _client_contact_fax = e.value;\n _is_make_changed = true;\n });\n contact_person_fax_content_field.addEventListener('return',function(e){\n self.check_and_set_object_focus(0,field_num,1);\n });\n contact_person_fax_content_field.addEventListener('focus',function(e){ \n _is_phone_fax_content_field_focused = true;\n _selected_field_object = e.source;\n });\n contact_person_fax_content_field.addEventListener('blur',function(e){\n _is_phone_fax_content_field_focused = false;\n _selected_field_object = null;\n }); \n }catch(err){\n self.process_simple_error_message(err,window_source+' - _init_contact_person_fax_field');\n return;\n } \n }", "function call(e){\n\tvar mobile = e.data.MobileNumber;\n\t$m.callContact(mobile);\n}", "function ReportInvoiceQrCodeWithAddress() {\n\n}", "function setFiatInterest(rowNumber, exchangeRate) {\n\n var cryptoInterest = ordersSheet.getRange(columns.interestCrypto + rowNumber).getValue()\n var fees = ordersSheet.getRange(columns.fees + rowNumber).getValue()\n\n var fiatInterest = (exchangeRate * (cryptoInterest - fees))\n Logger.log(fiatInterest)\n\n ordersSheet.getRange(columns.interestFiat + rowNumber).setValue(fiatInterest);\n\n}", "function sendSFax(toFax, sender, blob){\n\n var token = getToken()\n\n var url = \"https://api.sfaxme.com/api/SendFax?token=\" + encodeURIComponent(token) + \"&ApiKey=\" + encodeURIComponent(SFAX_KEY) + \"&RecipientName=\" + encodeURIComponent('Good Pill Pharmacy - Active') + \"&RecipientFax=\" + encodeURIComponent(toFax)\n\n if ((toFax != '18882987726') && (toFax != '18557916085'))\n url += \"&OptionalParams=\" + encodeURIComponent('SenderFaxNumber=' + sender)\n\n var opts = {\n method:'POST',\n url:url,\n payload:{file:blob}\n }\n\n try{\n\n var res = UrlFetchApp.fetch(url, opts)\n //Logger.log('sendSFax res: ' + JSON.stringify(res) + ' || ' + res.getResponseCode() + ' || ' + JSON.stringify(res.getHeaders()) + ' || ' + res.getContentText())\n\n return JSON.parse(res.getContentText()) //{\"SendFaxQueueId\":\"539658135EB742968663C6820BE33DB0\",\"isSuccess\":true,\"message\":\"Fax is received and being processed\"}\n\n } catch(err){\n //Logger.log('sendSFax err' + err)\n return err\n }\n}", "function addcontact(fullname, number, email, address, notes, website)\n{\n if (typeof (webphone_api.plhandler) !== 'undefined' && webphone_api.plhandler !== null)\n return webphone_api.plhandler.AddContact(fullname, number, email, address, notes, website);\n else\n return false;\n}", "function deal_number(){\n\t\n}", "function emailOrderPhoneNumber(emailBody) {\n // Get the first phone number within email body. This is only one we need.\n var tmp;\n var tmpArray;\n var phoneNumber;\n \n // Try Phone Number with '-'\n tmp = emailBody.match(/[0-9]{3}\\-[0-9]{3}\\-[0-9]{4}/);\n// sheet.appendRow(['In phone number function: ', tmp[0]]);\n \n // If null, must be Phone Number with '.'\n if(tmp == null) {\n tmp = emailBody.match(/[0-9]{3}\\.[0-9]{3}\\.[0-9]{4}/); \n \n // Split on '.'\n tmpArray = tmp[0].split('.');\n }\n else {\n // Split on '-'\n tmpArray = tmp[0].split('-');\n }\n\n \n // Reassemble phone number with prepended 1.\n phoneNumber = '1' + tmpArray[0] + tmpArray[1] + tmpArray[2];\n \n return phoneNumber;\n}", "function ffr(n) {\n return n;\n}", "function updateNumbers(field) {\n var dgf = field.find(\".datagridwidget-table-view\");\n\n function update() {\n var counter = 0; // <thead> has the first row\n dgf.find(\"tr\").each(function() {\n\n var $this = $(this);\n if($this.find(\".number\").size() === 0) {\n $this.append(\"<td class='number'>x</td>\");\n }\n\n var number = $this.find(\".number\");\n number.text(counter + \".\");\n\n counter++;\n });\n }\n\n // Update rows every time DGF is mixed\n dgf.bind(\"afteraddrow afteraddrowauto aftermoverow\", function() {\n update();\n });\n\n // Initial update\n update();\n }", "function toGetTaxValues(srcZcRank)\n{\n\t\t\ttotalTaxAmt = 0;\n\t\t\tvar extndAmt = 0;\n\t\t\tvar MRPAmt = 0;\n\t\t\tvar totalTaxAmtOfProd=0;\n\t\t\t\t\n\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-2201hdn'))\n\t\t\t\tvar product_id = document.getElementById('0-1001:'+srcZcRank+'-1101-2201hdn').value;\n\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-2201'))\n\t\t\t\tvar product_name = document.getElementById('0-1001:'+srcZcRank+'-1101-2201').value;\n\n\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1103')&&document.getElementById('0-1001:'+srcZcRank+'-1101-1103').value==\"\")\n\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1125').value = 0.00;\n\t\t\telse{\n\t\t\tif(priceInclTaxFlg !=\"1\" && document.getElementById('0-1001:'+srcZcRank+'-1101-1104')&&document.getElementById('0-1001:'+srcZcRank+'-1101-1104').value!=\"\")\n\t\t\t\textndAmt = (document.getElementById('0-1001:'+srcZcRank+'-1101-1104').value)*(document.getElementById('0-1001:'+srcZcRank+'-1101-1103').value);\n\t\t\telse if(priceInclTaxFlg ==\"1\" && document.getElementById('0-1001:'+srcZcRank+'-1101-886')&&document.getElementById('0-1001:'+srcZcRank+'-1101-886').value!=\"\"){\n\t\t\t\t/***Extended amount will be based on the discount.****/\n\t\t\t\t/**If header discount exist calculate line level discnt for the same % and deduct the discount from the extnd amt**/\n\t\t\t\tif(document.getElementById(\"0-1-851\")&&document.getElementById(\"0-1-851\").value){\n\t\t\t\t\tvar discountPercent = document.getElementById(\"0-1-851\").value;\n\t\t\t\t extndAmt = (document.getElementById('0-1001:'+srcZcRank+'-1101-886').value)*(document.getElementById('0-1001:'+srcZcRank+'-1101-1103').value);\n\t\t\t\t\tvar discntAmt = (discountPercent*extndAmt)/100;discntAmt=discntAmt.toFixed(2);\n extndAmt = extndAmt - discntAmt;\n\t\t\t\t}\n\t\t\t\t/**If not calculate the extended amount without discount**/\n\t\t\t\telse{\n\t\t\t\t\textndAmt = (document.getElementById('0-1001:'+srcZcRank+'-1101-886').value)*(document.getElementById('0-1001:'+srcZcRank+'-1101-1103').value);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(document.getElementById(\"0-1001:\"+srcZcRank+\"-1101-1127\")&&document.getElementById(\"0-1001:\"+srcZcRank+\"-1101-1127\").value !=\"\") MRPAmt = (document.getElementById(\"0-1001:\"+srcZcRank+\"-1101-1127\").value) *(document.getElementById('0-1001:'+srcZcRank+'-1101-1103').value);\n\t\t\t}\n\t\t\t/******Send branch Id if it exist for line level tax calculation*******/\n\t\t\tvar branchId=\"\";\n\t\t\tif(document.getElementById(\"0-1-251\") && document.getElementById(\"0-1-251\").value !=\"\"){\n\t\t\t\tbranchId = document.getElementById(\"0-1-251\").value;\n\t\t\t}\n\t\t\t/*****Get tax detail********/\n\t\t\tvar detUrl=zcServletPrefix+'/custom/JSON/system/getTaxDet4Prod.htm?product_id='+product_id+'&branch_id='+branchId;\n\t\t\t\n\t\t\t$.ajax(\n\t\t\t{\n\t\t\t\ttype: \"GET\",\n\t\t\t\turl:detUrl,\n\t\t\t\tdataType: \"json\",\n\t\t\t\tasync:false,\n\t\t\t\tsuccess: function (doc)\n\t\t\t\t{\n\t\t\t\t\tprodTaxInfo=doc['taxInfo'].split('~)');\n\t\t\t\t\tif(prodTaxInfo.length>=1)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor(var taxTypeCntr=0;taxTypeCntr<prodTaxInfo.length;taxTypeCntr++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar taxDetails=prodTaxInfo[taxTypeCntr].split('--');\n\t\t\t\t\t\t\tvar taxTypeName=taxDetails[0];\n\t\t\t\t\t\t\tvar taxTypePct=taxDetails[1];\n\t\t\t\t\t\t\tvar taxOnOther=taxDetails[2];\n\t\t\t\t\t\t\tvar calcTaxOn = taxDetails[3];\n\t\t\t\t\t\t\tvar taxTypeId = taxDetails[4];\n\t\t\t\t\t\t\tvar tax2BeCalcOnAmt =0;\n if(calcTaxOn && calcTaxOn == \"list_price\") tax2BeCalcOnAmt=MRPAmt;\n\t\t\t\t\t\t\telse tax2BeCalcOnAmt=extndAmt;\n\t\t\t\t\t\t\tif(taxOnOther){var parTaxAmt=parseFloat((taxOnOther/100)*parseFloat(tax2BeCalcOnAmt)); \n\t\t\t\t\t\t\tvar taxAmt = parseFloat((taxTypePct/100)*parseFloat(parTaxAmt));}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar taxAmt = 0;\n\t\t\t\t\t\t\t\tif(priceInclTaxFlg !=\"1\")\n\t\t\t\t\t\t\t\t taxAmt = parseFloat((taxTypePct/100)*parseFloat(tax2BeCalcOnAmt));\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t var taxPct4Divd = parseFloat(taxTypePct)+100;\n\t\t\t\t\t\t\t\t\ttaxAmt = parseFloat((taxTypePct/taxPct4Divd)*parseFloat(tax2BeCalcOnAmt));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(taxAmt)\n\t\t\t\t\t\t\t totalTaxAmtOfProd=parseFloat(totalTaxAmt)+parseFloat(taxAmt);\n\n\t\t\t\t\t\t\t//if(document.getElementById('0-1001:'+srcZcRank+'-1101-6301'))\n\t\t\t\t\t\t\t//document.getElementById(\"0-1001:\"+srcZcRank+\"-1101-6301\").value = totalTaxAmtOfProd.toFixed(2);\n\t\t\t\t\t\t\tif(taxTypeCntr==0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1644')&&taxTypePct)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1644').value = taxTypePct;\n\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1604')&&taxAmt)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1604').value = taxAmt.toFixed(2);\n\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1600')&&taxAmt)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1600').value = taxTypeId;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(taxTypeCntr==1)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1645')&&taxTypePct)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1645').value = taxTypePct;\n\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1611')&&taxAmt)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1611').value = taxAmt.toFixed(2);\n\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1605')&&taxAmt)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1605').value = taxTypeId;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(taxTypeCntr==2)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1651')&&taxTypePct)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1651').value = taxTypePct;\n\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1617')&&taxAmt)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1617').value = taxAmt.toFixed(2);\n\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1612')&&taxAmt)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1612').value = taxTypeId;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(taxTypeCntr==3)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1652')&&taxTypePct)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1652').value = taxTypePct;\n\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1626')&&taxAmt)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1626').value = taxAmt.toFixed(2);\n\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1618')&&taxAmt)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1618').value = taxTypeId;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(taxTypeCntr==4)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1653')&&taxTypePct)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1653').value = taxTypePct;\n\t\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1643')&&taxAmt)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1643').value = taxAmt.toFixed(2);\n\t\t\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1627')&&taxAmt)\n\t\t\t\t\t\t\t\tdocument.getElementById('0-1001:'+srcZcRank+'-1101-1627').value = taxTypeId;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttotalTaxAmt=totalTaxAmtOfProd;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-6301')){\n\t\t\t\t\t\t\tif(priceInclTaxFlg !=\"1\") document.getElementById(\"0-1001:\"+srcZcRank+\"-1101-6301\").value = totalTaxAmt.toFixed(2);\n\t\t\t\t\t\t\telse document.getElementById(\"0-1001:\"+srcZcRank+\"-1101-6301\").value = Math.floor(totalTaxAmt * 100) / 100;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(document.getElementById('0-1001:'+srcZcRank+'-1101-1657')){\n\t\t\t\t\t\t\tif(priceInclTaxFlg ==\"1\") document.getElementById('0-1001:'+srcZcRank+'-1101-1657').value = parseFloat(document.getElementById('0-1001:'+srcZcRank+'-1101-1125').value);\n\t\t\t\t\t\t\telse document.getElementById('0-1001:'+srcZcRank+'-1101-1657').value = parseFloat(totalTaxAmt) + parseFloat(document.getElementById('0-1001:'+srcZcRank+'-1101-1125').value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\treturn totalTaxAmt;\n}", "function countContact() {\n let numberOfContact = addressBook.reduce(numberOfContact => numberOfContact+1,0)\n console.log(\"Number of contacts are \"+numberOfContact); \n}", "function snomXcapProcessCard(vcf, fullname, order, prefix, duplicates, uniqueEntries, xcapUniqueNumbers) {\n // entry name\n let entryName = utilNameFormat(vcf.lastName, vcf.firstName, vcf.orgName, fullname);\n // check for duplicates\n if (!duplicates) {\n if (uniqueEntries.indexOf(entryName) > -1)\n return;\n uniqueEntries.push(entryName);\n }\n // object to hold different kinds of phone numbers, limit to home, work, mobile, default to home\n let entries = [];\n // iterate through all numbers\n for (let tel of vcf.tels) {\n if (!tel.number)\n continue;\n // check for duplicate phone number\n if (xcapUniqueNumbers.indexOf(tel.number) > -1) {\n let errorMsg = 'Duplicate number (' + tel.number + ') on ' + entryName;\n console.log('WARNING: ' + errorMsg);\n sendMail('Sync: Duplicate phone number detected', errorMsg);\n continue;\n }\n xcapUniqueNumbers.push(tel.number);\n // store entry\n entries.push({ type: tel.type, number: prefix === '' ? tel.number : (prefix + tel.number).replace('+', '00') });\n }\n // if empty return nothing\n if (entries.length === 0)\n return;\n // process all types and numbers\n let typeOrder = order.length !== 3 ? ['default'] : order;\n let telephony = [];\n let count = {\n work: 0,\n home: 0,\n mobile: 0\n };\n // go by type order\n for (let type of typeOrder) {\n for (let entry of entries) {\n if (type === 'default' || type === entry.type) {\n let n = entry.type.replace('work', 'business') + '_number';\n if (count[entry.type] > 0)\n n += '#' + count[entry.type];\n telephony.push({\n 'cp:prop': [\n {\n _attr: {\n name: n,\n value: entry.number\n }\n }\n ]\n });\n count[entry.type]++;\n }\n }\n }\n return {\n entry: [\n {\n 'display-name': entryName\n },\n {\n 'cp:prop': [\n {\n _attr: {\n name: 'entry_id',\n value: vcf.uid\n }\n }\n ]\n },\n {\n 'cp:prop': [\n {\n _attr: {\n name: 'surname',\n value: vcf.lastName\n }\n }\n ]\n },\n {\n 'cp:prop': [\n {\n _attr: {\n name: 'given_name',\n value: vcf.firstName\n }\n }\n ]\n },\n {\n 'cp:prop': [\n {\n _attr: {\n name: 'company',\n value: vcf.orgName\n }\n }\n ]\n },\n ...telephony\n ]\n };\n}" ]
[ "0.6103495", "0.5506917", "0.54916734", "0.54750323", "0.5413505", "0.53329533", "0.52630657", "0.5251573", "0.5194549", "0.51921785", "0.51061815", "0.50646424", "0.50291324", "0.5021229", "0.50026774", "0.4974901", "0.49386153", "0.4937306", "0.4931722", "0.49151254", "0.48887345", "0.48796806", "0.48578945", "0.4856864", "0.4852512", "0.48521006", "0.48028606", "0.47877413", "0.47833225", "0.4777585" ]
0.61291915
0
Manage or unmanage a user corresponding the the button clicked
function manage_click(ev) { let btn = $(ev.target); let manage_id = btn.data('manage'); let user_id = btn.data('user-id'); if (manage_id != "") { unmanage(user_id, manage_id); } else { manage(user_id); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function set_button(user_id, value) {\n $('.manage-button').each( (_, bb) => {\n if (user_id == $(bb).data('user-id')) {\n $(bb).data('manage', value);\n }\n });\n update_buttons();\n}", "_handleButtonAddAdmin()\n {\n Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__PROJECT_ADD_USER_ADMIN,\n {username: this._getSelectedUser(), project: this._project});\n }", "function editUser(event) {\n $button= $(event.currentTarget);\n $userId=$button.parent().parent().parent().attr(\"id\");\n findUserById($userId).then(renderUser);\n }", "function show_manage_user(){\n var manage_user = fill_template('user-management',{});\n $('#dd-log-in-menu').remove();\n $('.navbar-nav').append(manage_user);\n $('#dd-manage-alerts').click( function(e) {\n show_manage_alerts();\n });\n $('#dd-log-out').click( function(e) {\n set_cookie('dd-email','', -100);\n show_log_in();\n });\n }", "function manage(user_id) {\n let text = JSON.stringify({\n manage: {\n manager_id: current_user_id,\n underling_id: user_id\n },\n });\n\n $.ajax(manage_path, {\n method: \"post\",\n dataType: \"json\",\n contentType: \"application/json; charset=UTF-8\",\n data: text,\n success: (resp) => { set_button(user_id, resp.data.id); },\n error: (resp) => { console.log(resp); }\n });\n}", "function handleAdminRemove() {\n if ($scope.currentUser === $scope.userToRemove.username) {\n $scope.reDirect();\n } else {\n $scope.init();\n }\n }", "function update_buttons() {\n $('.manage-button').each( (_, bb) => {\n let user_id = $(bb).data('user-id');\n let manage = $(bb).data('manage');\n if (manage != \"\") {\n $(bb).text(\"Unmanage\");\n }\n else {\n $(bb).text(\"Manage\");\n }\n });\n}", "function editUser(event) {\n var editButton = $(event.currentTarget);\n var userId = editButton\n .parent()\n .parent()\n .parent()\n .attr('id');\n userId = parseInt(userId);\n currentUserID = userId;\n userService\n .findUserById(userId)\n .then(renderUser);\n }", "async function manageUser()\n{\n\tlet server = objActualServer.server\n\tlet txt = \"Choissisez la personne que vous souhaitez manager : \"\n\n\tlet choice = [\n\t{\n\t\tname: \"Retournez au menu précédent\",\n\t\tvalue: -1\n\t}]\n\tchoice.push(returnObjectLeave())\n\tserver.members.forEach((usr) =>\n\t{\n\t\tlet actualUser = usr.user\n\t\tchoice.unshift(\n\t\t{\n\t\t\tname: actualUser.username,\n\t\t\tvalue: actualUser\n\t\t})\n\t})\n\n\tlet data = await ask(\n\t{\n\t\ttype: \"list\",\n\t\tname: \"selectedUser\",\n\t\tmessage: txt,\n\t\tchoices: choice,\n\t})\n\n\tif (data.selectedUser == -1)\n\t{\n\t\tchooseWhatToHandle(data)\n\t}\n\telse if (data.selectedUser == -2)\n\t{\n\t\tendProcess()\n\t}\n\telse\n\t{\n\t\tmanageSingleUser(data.selectedUser)\n\t}\n\n}", "function useSaveButton() {\r\n var user = document.getElementById(\"userID\").value;\r\n editASingleUser(user)\r\n startPage()\r\n}", "function handleClick() {\n setShowUserProfile((!showUserProfile))\n }", "function editUser(e) {\r\n if (e.target.className === \"save\") {\r\n let newUserData = prepareEditedUser(e);\r\n putEditedUser(newUserData);\r\n clearEditBox();\r\n }\r\n}", "function updateUser() {\n if (model.addAdmin) {\n model.user.roles.push(\"ADMIN\");\n }\n if (model.addMember) {\n model.user.roles.push(\"MEMBER\");\n }\n userService\n .updateUser(model.userId, model.user)\n .then(function() {\n model.message = \"User updated successfully.\";\n });\n }", "function handleCoachAccess(){\n var userId = localStorage.getItem(\"user\");\n if(userId != null) {\n var query = firebase.database().ref('Users/' + userId);\n query.once(\"value\").then(function(snapshot) {\n var manager = snapshot.child(\"manager\").val();\n\n if(manager == true){\n document.getElementById('edit-delete-player').className = \"btn btn-danger\";\n }\n });\n }\n}", "function unmanage(user_id, manage_id) {\n $.ajax(manage_path + \"/\" + manage_id, {\n method: \"delete\",\n dataType: \"json\",\n contentType: \"application/json; charset=UTF-8\",\n data: \"\",\n success: () => { set_button(user_id, \"\"); },\n });\n}", "function postManageUsers(data, textStatus, jqXHR, param) {\n\tvar users = data;\n\tusers.sort(compareIgnoreCase);\n\tvar uiDiv = $('#ui');\n\tuiDiv.html('');\n\tvar h2 = $('<h2>');\n\tuiDiv.append(h2);\n\th2.html('User Management');\n\th2 = $('<h2>');\n\tuiDiv.append(h2);\n\th2.html('Create an User');\n\tvar input = $('<input>');\n\tinput.attr({'type': 'text',\n\t\t'name': 'role',\n\t\t'id': 'role'\n\t});\n\tuiDiv.append(input);\n\tinput = $('<input>');\n\tinput.attr({'type': 'button',\n\t\t'value': 'Create',\n\t\t'id': 'createRole',\n\t\t'onclick': 'createUser();'\n\t});\n\tuiDiv.append(input);\n\th2 = $('<h2>');\n\tuiDiv.append(h2);\n\th2.html('Existing Users');\n\tvar p = $('<p>');\n\tuiDiv.append(p);\n\tif (allowManageAttributes) {\n\t\tvar a = $('<a>');\n\t\tp.append(a);\n\t\ta.attr({'href': 'javascript:manageAllRoles()'});\n\t\ta.html('Manage attributes of all users');\n\t}\n\tvar table = $('<table>');\n\tuiDiv.append(table);\n\ttable.addClass('role-list');\n\tvar tr = $('<tr>');\n\ttable.append(tr);\n\tvar th = $('<th>');\n\ttr.append(th);\n\tth.html('User');\n\tth = $('<th>');\n\ttr.append(th);\n\tth.html('Delete');\n\tth = $('<th>');\n\ttr.append(th);\n\tth.html('Disable');\n\tth = $('<th>');\n\ttr.append(th);\n\tth.html('Reset');\n\tif (allowManageAttributes) {\n\t\tth = $('<th>');\n\t\ttr.append(th);\n\t\tth.html('Attributes');\n\t}\n\t$.each(users, function(i, user) {\n\t\ttr = $('<tr>');\n\t\ttable.append(tr);\n\t\ttr.addClass('role');\n\t\tvar td = $('<td>');\n\t\ttr.append(td);\n\t\ttd.html(user);\n\t\ttd = $('<td>');\n\t\ttr.append(td);\n\t\tinput = $('<input>');\n\t\tinput.attr({'type': 'button',\n\t\t\t'value': 'Delete user',\n\t\t\t'onclick': 'deleteUser(\"' + user + '\");'\n\t\t});\n\t\ttd.append(input);\n\t\ttd = $('<td>');\n\t\ttr.append(td);\n\t\tinput = $('<input>');\n\t\tinput.attr({'type': 'button',\n\t\t\t'value': 'Disable login',\n\t\t\t'onclick': 'disableLogin(\"' + user + '\");'\n\t\t});\n\t\ttd.append(input);\n\t\ttd = $('<td>');\n\t\ttr.append(td);\n\t\tinput = $('<input>');\n\t\tinput.attr({'type': 'button',\n\t\t\t'value': 'Reset password',\n\t\t\t'onclick': 'resetPassword(\"' + user + '\");'\n\t\t});\n\t\ttd.append(input);\n\t\tif (allowManageAttributes) {\n\t\t\ttd = $('<td>');\n\t\t\ttr.append(td);\n\t\t\tvar a = $('<a>');\n\t\t\ttd.append(a);\n\t\t\ta.attr({'href': 'javascript:manageUserRoles(\"' + user + '\")'});\n\t\t\ta.html('Manage attributes');\n\t\t}\n\t});\n}", "mutateUser ({dispatch}, payload) {\n if (payload.id) {\n dispatch('editUser', payload)\n } else {\n // TODO creating a user from the admin account\n console.log('this user doesnt exist in database')\n }\n }", "function removeUser(){\n\tfor(i in currentProject.members){\n\t\tif(currentProject.members[i].name == savedMem){\n\t\t\tfor (j in currentProject.members[i].role) {\n\t\t\t\tdelete currentProject.members[i].name;\n\t\t\t\tdelete currentProject.members[i].role[j];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\tdocument.getElementById(\"EditUser\").style.display = \"none\";\n\tpopTable();\n}", "approveMember() {\n MemberActions.approveUser(this.props.memberID);\n this.props.unselect();\n }", "_onUserUpdated() {\n UserActions.setIsUpdating(false);\n UserActions.setIsRequesting(false);\n }", "function deleteUserPermission(user) {\n $('#userIdDelete').val(user.user_id);\n $('#nameDelete').text(user.first_name + ' ' + user.last_name);\n $('#deleteModal').modal('show');\n}", "function listUsersButton() {\n listUsers();\n $listUsers.toggle();\n }", "async inactivate (user) {\n try {\n let currentTeam = await Team.findById(user.currentTeamId) || null\n if (currentTeam && user.owns(currentTeam)) { throw Err.transferOwnership }\n if (currentTeam) { currentTeam.removeMember(user) }\n \n user.inactivate()\n \n return Say.success('currentTeam', currentTeam) // hand this back to save in the controller\n } catch (error) { return Err.make(error) }\n }", "function useNewButton() {\r\n createUser();\r\n startPage()\r\n}", "deleteUser() {\n this.deleteBox.seen = true\n }", "setCurrentUser (user, id) {\n resourceCache.addItem('users', user)\n }", "function initializePage_userProfile()\r\n{\r\n page_userProfile.$auxButton.eq(0).click(logout);\r\n page_userProfile.$auxButton.eq(1).click(showPage_editAccount);\r\n}", "toggleuser(event, uname) {\n event.preventDefault();\n // If not already selected\n if (this.selectedusers.indexOf(uname) < 0) {\n document.querySelector(\"#\" + uname).setAttribute(\"class\", \"btn btn-primary selected\");\n this.selectedusers.push(uname);\n // If already selected\n }\n else {\n document.querySelector(\"#\" + uname).setAttribute(\"class\", \"btn btn-primary unselected\");\n this.selectedusers = this.selectedusers.filter((u) => {\n return u != uname;\n });\n }\n console.log(\"Selected users: \", this.selectedusers);\n }", "function enableEditingUser(userId){\n $('#'+userId+'-email').removeAttr('disabled');\n $('#'+userId+'-save').removeAttr('disabled');\n $('#'+userId+'-edit').hide();\n $('#'+userId+'-cancel').show();\n}", "function openEditUser() {\n routingBase.goToCurrentState('userDetails');\n }" ]
[ "0.6860396", "0.6796665", "0.67126906", "0.6608286", "0.6574718", "0.6490629", "0.64260656", "0.6401233", "0.6337171", "0.6303121", "0.6264086", "0.62334836", "0.6207008", "0.618509", "0.61143035", "0.60488296", "0.60316664", "0.6026643", "0.60264945", "0.6025551", "0.60136795", "0.6012853", "0.5988671", "0.5970532", "0.5937718", "0.5924293", "0.589193", "0.5891049", "0.5889566", "0.57961303" ]
0.73570883
0
Initialize the click function for each manage button and update the button text
function init_manage() { if (!$('.manage-button')) { return; } $(".manage-button").click(manage_click); update_buttons(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update_buttons() {\n $('.manage-button').each( (_, bb) => {\n let user_id = $(bb).data('user-id');\n let manage = $(bb).data('manage');\n if (manage != \"\") {\n $(bb).text(\"Unmanage\");\n }\n else {\n $(bb).text(\"Manage\");\n }\n });\n}", "function clickManage() {\n\t$.trigger(\"clickManage\");\n}", "function manage_click(ev) {\n let btn = $(ev.target);\n let manage_id = btn.data('manage');\n let user_id = btn.data('user-id');\n\n if (manage_id != \"\") {\n unmanage(user_id, manage_id);\n }\n else {\n manage(user_id);\n }\n}", "_updateTextValues() {\n const that = this,\n buttons = ['browse', 'uploadAll', 'cancelAll', 'pauseAll'];\n\n for (let i = 0; i < buttons.length; i++) {\n const localizationString = buttons[i],\n buttonName = localizationString + 'Button';\n\n that.$[buttonName].innerHTML = that.localize(localizationString);\n }\n\n for (let i = 0; i < that._selectedFiles.length; i++) {\n const item = that._items[i];\n\n item.querySelector('.jqx-item-upload-button').title = that.localize('uploadFile');\n item.querySelector('.jqx-item-cancel-button').title = that.localize('cancelFile');\n item.querySelector('.jqx-item-pause-button').title = that.localize('pauseFile');\n }\n }", "_initializeButtons() {\n var self = this;\n\n $(\".menu\").find(\"[data-button='minimize']\").click(function() {\n self.window.minimize();\n });\n\n $(\".menu\").find(\"[data-button='close']\").click(function() {\n self.close();\n });\n\n $(\".menu\").find(\"[data-button='update']\").click(function() {\n app.updateNinja();\n });\n\n $(\".menu\").find(\"[data-button='settings']\").click(function() {\n self.toggleSettingsMenu();\n });\n\n $(\".menu\").find(\"[data-button='lock']\").click(function() {\n self.toggleLock();\n });\n\n $(\".menu\").find(\"[data-button='close-all']\").click(function() {\n self.closeAllEntries();\n });\n }", "function updateButtons() {\n explainButtonElm.css('display', 'none');\n collapseButtonElm.css('display', 'none');\n if(step.containsExplanation() || step.containsSteps()) {\n if (explanationExpanded) {\n collapseButtonElm.css('display', 'block');\n } else explainButtonElm.css('display', 'block');\n }\n }", "init() { // Write the button to the dom\n const spacer = '<li class=\"acl-write separator\"></li>';\n var buttonHTML = '<li class=\"acl-write\" id=\"button1\"><a class=\"grouped-left\" data-l10n-id=\"pad.toolbar.add_buttons.title\" title=\"Task list Checkbox\"><span class=\"buttonicon buttonicon-add_buttons\"></span></a></li>';\n $('.menu_left').append(spacer);\n $('.menu_left').append(buttonHTML);\n\n var buttonHTML = '<li class=\"acl-write\" id=\"button2\"><a class=\"grouped-right\" data-l10n-id=\"pad.toolbar.add_buttons.title\" title=\"Task list Checkbox\"><span class=\"buttonicon buttonicon-add_buttons\"></span></a></li>';\n $('.menu_left').append(buttonHTML);\n\n $('#button1, #button2').click(() => {\n exports.add_buttons.onButton();\n });\n }", "updateButtons(){\n // Checks if the wish list is empty and then hides and shows the appropriate sections.\n // Adds wish list buttons if applicable\n if (Object.keys(this.wish_list).length === 0){\n $('#empty_wish_list').show();\n $('#wish_list').hide();\n } else {\n $(\"#wish_list\").html(\"\"); // clears all of the buttons from before\n for (let key in this.wish_list){\n if (this.wish_list.hasOwnProperty(key)) {\n let color = \"#BBBBBB\";\n let font_color = \"#333333\";\n if (this.scheduler.schedules_info[key][\"color\"]){\n color = this.scheduler.schedules_info[key][\"color\"];\n font_color = \"#ffffff\";\n }\n this.wish_list[key].createButton(color, font_color);\n }\n }\n\n $('#empty_wish_list').hide();\n $('#wish_list').show();\n\n tippy('.wish_list_item', {theme: 'light'}); // adds tooltips to all of the wish list items\n }\n }", "function btnManageClick() {\n if (currPage == \"#page-manage\") {\n return;\n }\n currSelected.removeClass(\"btn-navbar-sel\");\n currSelected = $(\"#btn-manage\");\n currSelected.addClass(\"btn-navbar-sel\");\n switchScreen(currPage, \"#page-manage\");\n currPage = \"#page-manage\";\n}", "initButtons() {\n const self = this;\n const actions = [\n {\n id: 'compile',\n run: () => {\n self.compile();\n },\n },\n {\n id: 'save',\n run: () => {\n self.save();\n },\n },\n ];\n\n for (let action of actions) {\n const a = document.getElementById(action.id);\n a.addEventListener('click', action.run);\n this.views[action.id] = a;\n }\n }", "initButtons() {\n this.setupButton(\"efecBtn\", (e) => {\n\n })\n\n }", "function setClickBehaviour(){\n\t\t\tbutton.on(\"click\", changeButtonLabelAndSendEvent);\n\t\t}", "function updateButtons() {\n $(\"#buttonDisplay\").empty();\n for (var i = 0; i < topics.length; i++) {\n // create new caption\n var newCaption = $(\"<div>\").text(topics[i]).addClass(\"button-caption\");\n // create new black space\n var newBlackSpace = $(\"<div>\").addClass(\"black-space\");\n // create new button\n var newButton = $(\"<button>\").data(\"name\", topics[i]).addClass(\"topic-button\");\n // append caption to button\n newButton.append(newBlackSpace, newCaption);\n // append it to the display\n $(\"#buttonDisplay\").append(newButton);\n };\n }", "function bindButtonActions() {\n // create a new project on click\n createProjectButton.onclick = createProject;\n\n // start the timer on button click\n timerButton.onclick = () => {\n if (timerButton.innerHTML == \"Start Timing\")\n {\n // change button text\n timerButton.innerHTML = \"Stop Timing\";\n\n startTimer();\n }\n else\n {\n // change button text\n timerButton.innerHTML = \"Start Timing\";\n\n stopTimer();\n }\n }\n}", "function topicButtons() {\n $(\"#buttons\").empty();\n $(\"#topicsCard\").hide();\n for (var i = 0; i < topics.length; i++) {\n var b = $(\"<button class='btn'>\");\n b.addClass(\"eightiesButton\");\n b.attr(\"data-name\", topics[i]);\n b.text(topics[i]);\n if (b.attr(\"data-click\"))\n b.attr(\"data-click\")\n $(\"#buttons\").append(b);\n $(\"#topic_input\").val(\"80's\");\n }\n }", "function onManageInstancesBtnClicked(event)\n\t{\n\t\t!this.showingManageView && this.sidebar.breadcrumbsView.add('Collections', this, 'renderManageView');\n\t\tthis.showingManageView = true;\n\t\tthis.renderManageView();\n\t}", "function setButtonText() {\n if (!$rootScope.editMode) {\n $scope.buttonText = \"Add\";\n }\n else {\n $scope.buttonText = \"Save\";\n }\n ;\n\n }", "function set_button(user_id, value) {\n $('.manage-button').each( (_, bb) => {\n if (user_id == $(bb).data('user-id')) {\n $(bb).data('manage', value);\n }\n });\n update_buttons();\n}", "function enableButtons()\n {\n //show buttons for updating and creating new workflow\n $(\"#perc-update-wf-save-cancel-block\").show();\n $(\"#perc-new-wf-save-cancel-block\").show();\n }", "createButtons() {\n this.settingsButton = this._createConnectionButton(TEXTURE_NAME_SETTINGS);\n this.deleteButton = this._createConnectionButton(TEXTURE_NAME_DELETE);\n }", "function setButtonText()\n {\n //if editmode\n debugger;\n\n if (!$rootScope.editMode) {\n $scope.buttonText = \"Add\";\n }\n else {\n $scope.buttonText = \"Save\";\n };\n\n }", "function rebuild_track_btn(){\n $(\".main-grid-container\").prepend('<div class=\"createTrackBtns\">Rebuild Tracking Buttons|v'+window.version+'</div>');\n $(\".createTrackBtns\").click(function(){\n $('.main-grid-cell-content span.main-grid-plus-button').click();\n $('.trackBtn, .actionBtn').remove();\n buildTracker();\n }); \n }", "function setupButtons(){\r\n\t\t\t$('.choice').on('click', function(){\r\n\t\t\t\tpicked = $(this).attr('data-index');\r\n\t\t\t\t$('.choice').removeAttr('style').off('mouseout mouseover');\r\n\t\t\t\t$(this).css({'font-weight':'bold', 'border-color':'#51a351', 'color':'#51a351'});\r\n\t\t\t\tif(submt){\r\n\t\t\t\t\tsubmt=false;\r\n\t\t\t\t\t$('#submitbutton').css({'color':'#fff','cursor':'pointer'}).on('click', function(){\r\n\t\t\t\t\t\t$('.choice').off('click');\r\n\t\t\t\t\t\t$(this).off('click');\r\n\t\t\t\t\t\tprocessQuestion(picked);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}", "function clickBtn(ev){\r\n\r\n //Brightspace ref: week 6\r\n let clickedButton = ev.target;\r\n\r\n let btnsArray=[\r\n ctrlBtns[0],\r\n ctrlBtns[1],\r\n ctrlBtns[2],\r\n ];\r\n\r\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf\r\n let index = btnsArray.indexOf(clickedButton);\r\n p(index);\r\n\r\n // /MDN ref:https://developer.mozilla.org/en-US/docs/Web/API/Element\r\n p(clickedButton.id);\r\n //handle moving id-active to the currently clicked button\r\n //remove currently present id 'active'\r\n for(let i=0; i < ctrlBtns.length ; i++){\r\n if(ctrlBtns[i].id){\r\n //MDN ref:https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute\r\n ctrlBtns[i].removeAttribute('id')\r\n }\r\n }\r\n //assign id=\"active\" to currently clicked button\r\n clickedButton.id=\"active\";\r\n //Load corresponding data into the container div\r\n cntnr.innerHTML = `<h2>${pages[index].heading}</h2> \r\n <img src=\"${pages[index].img}\" alt=\"${pages[index].alt}\">\r\n <p>${pages[index].bodyText}</p>\r\n `;\r\n\r\n }", "function displaysButtons() {\n $(\"#buttons-view\").empty();\n\n for (var i = 0; i < topics.length; i++) {\n var btn = $(\"<button class='gifBtn'>\");\n btn.attr(\"data-name\", topics[i]);\n btn.text(topics[i]);\n $(\"#buttons-view\").append(btn)\n\n }\n }", "function buttonRendering() {\n\n // Deleting the movies prior to adding new movies\n // (this is necessary otherwise we will have repeat buttons)\n $(\"#buttons-view\").empty();\n\n for (var i = 0; i < animalLists.length; i++) {\n //add a variable with new button\n var animalBtn = $(\"<button>\");\n\n animalBtn.text(animalLists[i]);\n\n animalBtn.addClass(\"animal\").attr(\"data-name\", animalLists[i]);\n\n $(\"#buttons-view\").append(animalBtn);\n\n }\n }", "function buttons() {\n $(\"#display-btns\").empty();\n for (var j = 0; j < initialBtns.length; j++) {\n\n var newBtns = $(\"<button>\")\n newBtns.attr(\"class\", \"btn btn-outline-secondary btn-sm\");\n newBtns.attr(\"id\", \"input\")\n newBtns.attr(\"data-name\", initialBtns[j]);\n newBtns.text(initialBtns[j]);\n\n $(\"#display-btns\").append(newBtns);\n }\n }", "function changeBtn() {\n\t\t\tif($scope.showButton.isShow){\n\t\t\t\twindow.location.hash = '/';\n\t\t\t\t$scope.showButton.btnClass = 'btn-default';\n\t\t\t\t$scope.showButton.text = 'Show Lesson Content';\n\t\t\t\t$scope.showButton.isShow = false;\n\t\t\t\t$scope.lastViewed.person = null;\n\t\t\t} else {\n\t\t\t\twindow.location.hash = '/list';\n\t\t\t\t$scope.showButton.btnClass = 'btn-primary';\n\t\t\t\t$scope.showButton.text = 'Hide Lesson Content';\n\t\t\t\t$scope.showButton.isShow = true;\n\t\t\t}\n\t\t\t$scope.predicate = '';\n\t\t}", "prepare_system_action_buttons() {\n\t\tlet template,\n\t\t\tactions = {\n\t\t\tshutdown: 'power-off',\n\t\t\thibernate: 'asterisk',\n\t\t\tsuspend: 'arrow-down',\n\t\t\trestart: 'refresh'\n\t\t};\n\n\t\tfor ( let action of Object.keys( actions ) ) {\n\t\t\tlet cmd = `can_${action}`;\n\n\t\t\ttemplate = `\n\t\t\t\t<a href=\"#\" id=\"${action}\" class=\"btn btn-default ${action}\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"${action.capitalize()}\" data-container=\"body\">\n\t\t\t\t\t<i class=\"fa fa-${actions[action]}\"></i>\n\t\t\t\t</a>`;\n\n\t\t\tif ( ! lightdm[cmd] ) {\n\t\t\t\t// This action is either not available on this system or we don't have permission to use it.\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$( template )\n\t\t\t\t.appendTo( this.$actions_container )\n\t\t\t\t.on( 'click', event => this.system_action_handler(event) );\n\n\t\t} // END for (let [action, icon] of actions)\n\n\t\t$( '[data-toggle=tooltip]' ).tooltip();\n\t\t$( '.modal' ).modal( { show: false } );\n\t}", "function addButtons() {\n\t$ans.append('<button class=\"toInfo\">' + 'Click here to learn more!' + '</button>');\n\t$ans.append('<button class=\"tryAgain\">' + 'Click here to try again!' + '</button>');\t\n\t}" ]
[ "0.7035822", "0.66758835", "0.64078724", "0.6397366", "0.63584006", "0.63528085", "0.62530726", "0.6239302", "0.6207319", "0.6185898", "0.6181031", "0.6173993", "0.61525655", "0.6131418", "0.6096139", "0.60945183", "0.60889703", "0.60612595", "0.6057443", "0.6047189", "0.6040105", "0.60386145", "0.60268134", "0.60187143", "0.6004896", "0.5984022", "0.5964237", "0.59602594", "0.5958087", "0.5954732" ]
0.7350768
0
Initialize sanitation processes to clean up sheets and instantiate properties
function init() { resetScript(); if (!saveAndTestSheets()) // break if sheets invalid return; let pointsSheet = new PointsSheet().sheet; let summarySheet = pointsSheet.getSheets()[0]; let membersRef = summarySheet.getRange(`${POINTS_FIELD.FIRST_NAME}3:${POINTS_FIELD.LAST_NAME}${summarySheet.getLastRow()}`); cleanMemberNames(membersRef); saveMemberKeys(membersRef); setTriggers(); runAllTests(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "newPropertiesSheet() {\n this.properties_sheet = new InstanceProperties(this.artefact)\n }", "_initializeProperties() {}", "newPropertiesSheet() {\n this.properties_sheet = new MysqlDatabaseSystemProperties(this.artefact)\n }", "function initializeSpreadsheet() {\n var ui = SpreadsheetApp.getUi();\n var response = ui.alert('Do you want to initalize this sheet?', 'That will completely erase every sheet on this document.', ui.ButtonSet.OK_CANCEL);\n if (response != ui.Button.OK) {\n return;\n }\n Logger.log(SpreadsheetApp.getActiveSpreadsheet().getSheets());\n if (SpreadsheetApp.getActiveSpreadsheet().getSheetName() == 'Results' || SpreadsheetApp.getActiveSpreadsheet().getSheetName() == 'Approved clients' || SpreadsheetApp.getActiveSpreadsheet().getSheetName() == 'User data' || SpreadsheetApp.getActiveSpreadsheet().getSheetName() == 'Advanced output') {\n var response = ui.alert('You\\'re already set up!', 'If you\\'d like to re-initialize the sheet, press OK below.', ui.ButtonSet.OK_CANCEL);\n if (response != ui.Button.OK) {\n return;\n } else {\n SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Results').activate();\n var currentSheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();\n for (var i = 0; i < (currentSheets.length -= 1); i++)\n SpreadsheetApp.getActiveSpreadsheet().deleteSheet(currentSheets[i])\n }\n }\n\n\n var readingSpreadSheet = SpreadsheetApp.openById('1STQQAHvW9Re4vmFnHRnu6PVjX5TfdUFUVaH8jDba5LE');\n var initSheet = SpreadsheetApp.getActiveSpreadsheet();\n initSheet.getActiveSheet().setName('Results').getRange(readingSpreadSheet.getSheetByName('Results').getDataRange().getA1Notation()).setValues(readingSpreadSheet.getSheetByName('Results').getDataRange().getValues());\n initSheet.insertSheet('Approved clients').getRange(readingSpreadSheet.getSheetByName('Approved clients').getDataRange().getA1Notation()).setValues(readingSpreadSheet.getSheetByName('Approved clients').getDataRange().getValues());\n initSheet.getSheetByName('Approved clients').getRange('A2:D').setBackground('yellow');\n initSheet.insertSheet('User data').getRange(readingSpreadSheet.getSheetByName('User data').getDataRange().getA1Notation()).setValues(readingSpreadSheet.getSheetByName('User data').getDataRange().getValues());\n initSheet.getSheetByName('User data').getRange('A2:F2').setBackground('yellow');\n initSheet.insertSheet('Advanced output').getRange(readingSpreadSheet.getSheetByName('Advanced output').getDataRange().getA1Notation()).setValues(readingSpreadSheet.getSheetByName('Advanced output').getDataRange().getValues());\n initSheet.getSheetByName('Results').activate();\n}", "function initializationCleanUp() {\n //console.debug('Cleaning up of all data..');\n\t\t\t//console.debug('Cleaning up of all data is done..');\n }", "function initialize() {\n for (let sheet of document.styleSheets) {\n const rules = sheet.rules || sheet.cssRules;\n\n if (!rules || !rules.length) continue;\n cjss(rules);\n }\n }", "cleanup() {\n this.lastRead = {};\n this.defaults = {};\n this.overrides = {};\n }", "constructor(){\n this.unicode = Converters.unified;\n this.env = Converters.environment;\n this.css = Converters.image;\n if(defaults.use_sheets){\n this.setSheets(defaults.sheets);\n }\n }", "newPropertiesSheet() {\n this.properties_sheet = new AutoscalingConfigurationProperties(this.artefact)\n }", "validateInit() {\n this.runValidation(true);\n }", "_initializeProperties(){}// prevent user code in connected from running", "static _setAssumptions(assumptions) {\n// If we have the global functions option set to true.....\n if (assumptions.globalFunctions) {\n// Globalize Flare functions for convenience...\n window.global = flare.global\n window.extend = flare.extend\n window.keyframes = flare.keyframes\n// Globalize style elements for convenience...\n window.div = flare.div\n window.aside = flare.aside\n window.area = flare.area\n window.button = flare.button\n window.col = flare.col\n window.colgroup = flare.colgroup\n window.header = flare.header\n window.footer = flare.footer\n window.input = flare.input\n window.h1 = flare.h1\n window.h2 = flare.h2\n window.h3 = flare.h3\n window.h4 = flare.h4\n window.h5 = flare.h5\n window.h6 = flare.h6\n window.p = flare.p\n window.section = flare.section\n window.span = flare.span\n window.table = flare.table\n window.textarea = flare.textarea\n }\n// If underscore abbreviation for global insertion option is set to true....\n if (assumptions.underscoreGlobal) {\n// Abbreviate flare.global...\n window.__ = flare.global\n }\n// Syntax highlighting....\n if (assumptions.syntaxHighlighting) {\n window.styled = flare\n }\n return assumptions\n }", "function makeSomeInitializations ( ) {\r\n clearForm();\r\n print ( standardMessage );\r\n books.forEach ( updateBookNumbers );\r\n copyOfSelectedBook[titleProperty] = '';\r\n initializeCopyOfSelectedBook();\r\n}", "newPropertiesSheet() {\n this.properties_sheet = new NetworkLoadBalancerProperties(this.artefact)\n }", "function initSpreadsheet_() {\n if (!originLiSheet) {\n doc.insertSheet(ORIGIN_SHEET_NAME,0);\n originLiSheet = doc.getSheetByName(ORIGIN_SHEET_NAME);\n originLiSheet.setTabColor(\"yellow\");\n originLiSheet.getRange(1,1,1,100).setBackground(\"yellow\");\n originLiSheet.getRange(1,1,originLiSheet.getMaxRows(),\n originLiSheet.getMaxColumns()).setFontFamily('Roboto Slab');\n }\n if (!destinationLisSheet) {\n doc.insertSheet(DESTINATION_SHEET_NAME,1);\n destinationLisSheet = doc.getSheetByName(DESTINATION_SHEET_NAME);\n destinationLisSheet.setTabColor(\"green\");\n destinationLisSheet.getRange(1,1,1,100).setBackground(\"green\");\n destinationLisSheet.getRange(1,1,destinationLisSheet.getMaxRows(),\n destinationLisSheet.getMaxColumns()).setFontFamily('Roboto Slab');\n }\n if (!configSheet) {\n doc.insertSheet(CONFIG_SHEET_NAME,0);\n configSheet = doc.getSheetByName(CONFIG_SHEET_NAME);\n configSheet.setTabColor('red');\n // Sets default column widths.\n configSheet.setColumnWidth(1, 260);\n configSheet.setColumnWidth(2, 280);\n configSheet.setColumnWidth(3, 360);\n configSheet.setColumnWidth(4, 360);\n // General settings section.\n configSheet.getRange(ROW_GENERAL_HEADER,1,1,NUM_COLUMNS)\n .setBackground(CONFIG_HEADERS_COLOR).setFontWeight('bold');\n configSheet.setRowHeight(ROW_GENERAL_HEADER, 40);\n configSheet.getRange(ROW_GENERAL_HEADER,1).setValue('General settings');\n configSheet.getRange(ROW_SDF_VERSION,1,2,1)\n .setBackground(CONFIG_NAMES_COLOR).setFontWeight('bold');\n configSheet.getRange(ROW_SDF_VERSION,1).setValue('SDF Version');\n configSheet.getRange(ROW_SETTING,1).setValue('Line Item setting to copy');\n configSheet.getRange(ROW_SDF_VERSION,2,2,1)\n .setBackground(CONFIG_EDITABLE_VALUES_COLOR).setFontWeight('bold')\n .setHorizontalAlignment('center');\n var rule = SpreadsheetApp.newDataValidation()\n .requireValueInList(['3.1', '4']).build();\n configSheet.getRange(ROW_SDF_VERSION,2).setDataValidation(rule)\n .setValue('4');\n var range = originLiSheet.getRange('1:1');\n rule = SpreadsheetApp.newDataValidation().requireValueInRange(range)\n .build();\n configSheet.getRange(ROW_SETTING,2).setDataValidation(rule)\n .setValue('Geography Targeting - Include');\n configSheet.getRange(ROW_SDF_VERSION,3,2,2)\n .setBackground(CONFIG_DESCRIPTIONS_COLOR);\n configSheet.getRange(ROW_SDF_VERSION,3)\n .setValue('Check your advertiser/partner supported SDF version ' +\n 'directly in DV360');\n configSheet.getRange(ROW_SETTING,3).setValue('<-- if this menu is empty, ' +\n 'select an ORIGIN line item below and run \"Custom Functions > ' +\n 'Retrieve ORIGIN Line Item Info\"');\n // Origin Line Item section.\n configSheet.getRange(ROW_ORIGIN_HEADER,1,1,NUM_COLUMNS)\n .setBackground(CONFIG_HEADERS_COLOR).setFontWeight('bold');\n configSheet.setRowHeight(ROW_ORIGIN_HEADER, 40);\n configSheet.getRange(ROW_ORIGIN_HEADER,1)\n .setFormula('=CONCATENATE(\"ORIGIN Line Item - the Line Item to copy ' +\n 'the selected setting (\"; $B$3; \") from\")');\n configSheet.getRange(ROW_ORIGIN_LI_ID,1,3,1)\n .setBackground(CONFIG_NAMES_COLOR).setFontWeight('bold');\n configSheet.setRowHeight(ROW_ORIGIN_LI_ID, 40);\n configSheet.setRowHeight(ROW_ORIGIN_LI_NAME, 40);\n configSheet.setRowHeight(ROW_ORIGIN_LI_VALUE, 40);\n configSheet.getRange(ROW_ORIGIN_LI_ID,1).setValue('Line Item ID');\n configSheet.getRange(ROW_ORIGIN_LI_NAME,1).setValue('Line Item Name');\n configSheet.getRange(ROW_ORIGIN_LI_VALUE,1)\n .setFormula('= CONCATENATE(\"Value for: \"; $B$3)');\n configSheet.getRange(ROW_ORIGIN_LI_ID,2)\n .setBackground(CONFIG_EDITABLE_VALUES_COLOR).setFontWeight('bold')\n .setHorizontalAlignment('center');\n configSheet.getRange(ROW_ORIGIN_LI_NAME,2,2,1)\n .setBackground(CONFIG_AUTOMATIC_VALUES_COLOR).setFontWeight('bold')\n .setHorizontalAlignment('center');\n configSheet.getRange(ROW_ORIGIN_LI_ID,3,3,2)\n .setBackground(CONFIG_DESCRIPTIONS_COLOR);\n configSheet.getRange(ROW_ORIGIN_LI_ID,3,1,2).merge().setWrap(true)\n .setValue('The ID of the Line Item you want to copy the setting FROM');\n configSheet.getRange(ROW_ORIGIN_LI_NAME,3,1,2).merge().setWrap(true)\n .setValue('Run \"Custom Functions > Retrieve ORIGIN Line Item Info\" ' +\n 'to load the LI Name and the current value for the selected setting ' +\n '(Keyword Targeting - Include)');\n configSheet.getRange(ROW_ORIGIN_LI_VALUE,3,1,2).merge().setWrap(true)\n .setFormula('=CONCATENATE(\"This is the value for \"; $B$3; \" which is ' +\n 'gonna be copied into the DESTINATION Line Items below\")');\n // Destination Line Items section.\n configSheet.getRange(ROW_DESTINATION_HEADER,1,1,NUM_COLUMNS)\n .setBackground(CONFIG_HEADERS_COLOR).setFontWeight('bold');\n configSheet.setRowHeight(ROW_DESTINATION_HEADER, 40);\n configSheet.getRange(ROW_DESTINATION_HEADER,1,1,4).merge().setWrap(true)\n .setValue('DESTINATION Line Items - the Line Item(s) you want to ' +\n 'copy the selected setting TO.');\n configSheet.getRange(ROW_DESTINATION_COLUMNS,1,1,NUM_COLUMNS)\n .setBackground(CONFIG_NAMES_COLOR).setFontWeight('bold');\n configSheet.getRange(ROW_DESTINATION_COLUMNS,1)\n .setValue('Destination Line Item IDs');\n configSheet.getRange(ROW_DESTINATION_COLUMNS,2).setValue('Line Item Name');\n configSheet.getRange(ROW_DESTINATION_COLUMNS,3)\n .setFormula('= CONCATENATE(\"Current value for: \"; $B$3)');\n configSheet.getRange(ROW_DESTINATION_COLUMNS,4)\n .setFormula('= CONCATENATE(\"New value applied for: \"; $B$3)');\n configSheet.getRange(ROW_DESTINATION_LI,1,100,1).setFontWeight('bold')\n .setBackground(CONFIG_EDITABLE_VALUES_COLOR)\n .setHorizontalAlignment('center');\n configSheet.getRange(ROW_DESTINATION_LI,2,100,3).setFontWeight('bold')\n .setBackground(CONFIG_AUTOMATIC_VALUES_COLOR);\n configSheet.getRange(1,1,configSheet.getMaxRows(),\n configSheet.getMaxColumns()).setFontFamily('Roboto Slab')\n .setVerticalAlignment(\"middle\");\n }\n}", "static get sanitize() {\n return {}\n }", "_cleanAndSetData() {\n const propertySearchLocationPath = 'page.attributes.propertySearchLocation';\n const propertySearchLocation = get(this.digitalData, propertySearchLocationPath);\n if (propertySearchLocation === undefined) {\n this._set(propertySearchLocationPath, '');\n }\n\n const propertySearchDateInfoPath = 'page.attributes.propertySearchDateInfo';\n const propertySearchDateInfo = get(this.digitalData, propertySearchDateInfoPath);\n if (propertySearchDateInfo === undefined) {\n this._set(propertySearchDateInfoPath, '00:00:00:00');\n }\n\n const productIDPath = 'product[0].productInfo.productID';\n const productID = get(this.digitalData, productIDPath);\n if (productID === undefined) {\n this._set('product', [{ productInfo: { productId: '' } }]);\n }\n\n window.digitalData = this.digitalData;\n }", "function init() {\n\t\t\tresetData();\n resetClipboardMI();\n resetClipboardEC();\n resetClipboardDC();\n\t\t\trefreshTotalCount();\n\t\t\tloadVocabs();\n for(var i=0;i<5; i++) { addMutationInvolvesRow(); }\n for(var i=0;i<5; i++) { addExpressesComponentsRow(); }\n for(var i=0;i<5; i++) { addDriverComponentsRow(); }\n if (document.location.search.length > 0) {\n searchByAlleleKeys();\n }\n\t\t}", "function tryEnsureSanity()\n{\n // The script might have set up oomAfterAllocations or oomAtAllocation.\n // Turn it off so we can test only generated code with it.\n try {\n if (typeof resetOOMFailure == \"function\")\n resetOOMFailure();\n } catch(e) { }\n\n try {\n // The script might have turned on gczeal.\n // Turn it off to avoid slowness.\n if (typeof gczeal == \"function\")\n gczeal(0);\n } catch(e) { }\n\n // At least one bug in the past has put exceptions in strange places. This also catches \"eval getter\" issues.\n try { eval(\"\"); } catch(e) { dumpln(\"That really shouldn't have thrown: \" + errorToString(e)); }\n\n if (!this) {\n // Strict mode. Great.\n return;\n }\n\n try {\n // Try to get rid of any fake 'unwatch' functions.\n delete this.unwatch;\n\n // Restore important stuff that might have been broken as soon as possible :)\n if ('unwatch' in this) {\n this.unwatch(\"eval\");\n this.unwatch(\"Function\");\n this.unwatch(\"gc\");\n this.unwatch(\"uneval\");\n this.unwatch(\"toSource\");\n this.unwatch(\"toString\");\n }\n\n if ('__defineSetter__' in this) {\n // The only way to get rid of getters/setters is to delete the property.\n if (!jsStrictMode)\n delete this.eval;\n delete this.Math;\n delete this.Function;\n delete this.gc;\n delete this.uneval;\n delete this.toSource;\n delete this.toString;\n }\n\n this.Math = realMath;\n this.eval = realEval;\n this.Function = realFunction;\n this.gc = realGC;\n this.uneval = realUneval;\n this.toSource = realToSource;\n this.toString = realToString;\n } catch(e) {\n confused(\"tryEnsureSanity failed: \" + errorToString(e));\n }\n\n // These can fail if the page creates a getter for \"eval\", for example.\n if (this.eval != realEval)\n confused(\"Fuzz script replaced |eval|\");\n if (Function != realFunction)\n confused(\"Fuzz script replaced |Function|\");\n}", "function tryEnsureSanity()\n{\n // The script might have set up oomAfterAllocations or oomAtAllocation.\n // Turn it off so we can test only generated code with it.\n try {\n if (typeof resetOOMFailure == \"function\")\n resetOOMFailure();\n } catch(e) { }\n\n try {\n // The script might have turned on gczeal.\n // Turn it off to avoid slowness.\n if (typeof gczeal == \"function\")\n gczeal(0);\n } catch(e) { }\n\n // At least one bug in the past has put exceptions in strange places. This also catches \"eval getter\" issues.\n try { eval(\"\"); } catch(e) { dumpln(\"That really shouldn't have thrown: \" + errorToString(e)); }\n\n if (!this) {\n // Strict mode. Great.\n return;\n }\n\n try {\n // Try to get rid of any fake 'unwatch' functions.\n delete this.unwatch;\n\n // Restore important stuff that might have been broken as soon as possible :)\n if ('unwatch' in this) {\n this.unwatch(\"eval\");\n this.unwatch(\"Function\");\n this.unwatch(\"gc\");\n this.unwatch(\"uneval\");\n this.unwatch(\"toSource\");\n this.unwatch(\"toString\");\n }\n\n if ('__defineSetter__' in this) {\n // The only way to get rid of getters/setters is to delete the property.\n if (!jsStrictMode)\n delete this.eval;\n delete this.Math;\n delete this.Function;\n delete this.gc;\n delete this.uneval;\n delete this.toSource;\n delete this.toString;\n }\n\n this.Math = realMath;\n this.eval = realEval;\n this.Function = realFunction;\n this.gc = realGC;\n this.uneval = realUneval;\n this.toSource = realToSource;\n this.toString = realToString;\n } catch(e) {\n confused(\"tryEnsureSanity failed: \" + errorToString(e));\n }\n\n // These can fail if the page creates a getter for \"eval\", for example.\n if (this.eval != realEval)\n confused(\"Fuzz script replaced |eval|\");\n if (Function != realFunction)\n confused(\"Fuzz script replaced |Function|\");\n}", "function tryEnsureSanity()\n{\n // The script might have set up oomAfterAllocations or oomAtAllocation.\n // Turn it off so we can test only generated code with it.\n try {\n if (typeof resetOOMFailure == \"function\")\n resetOOMFailure();\n } catch(e) { }\n\n try {\n // The script might have turned on gczeal.\n // Turn it off to avoid slowness.\n if (typeof gczeal == \"function\")\n gczeal(0);\n } catch(e) { }\n\n // At least one bug in the past has put exceptions in strange places. This also catches \"eval getter\" issues.\n try { eval(\"\"); } catch(e) { dumpln(\"That really shouldn't have thrown: \" + errorToString(e)); }\n\n if (!this) {\n // Strict mode. Great.\n return;\n }\n\n try {\n // Try to get rid of any fake 'unwatch' functions.\n delete this.unwatch;\n\n // Restore important stuff that might have been broken as soon as possible :)\n if ('unwatch' in this) {\n this.unwatch(\"eval\");\n this.unwatch(\"Function\");\n this.unwatch(\"gc\");\n this.unwatch(\"uneval\");\n this.unwatch(\"toSource\");\n this.unwatch(\"toString\");\n }\n\n if ('__defineSetter__' in this) {\n // The only way to get rid of getters/setters is to delete the property.\n if (!jsStrictMode)\n delete this.eval;\n delete this.Math;\n delete this.Function;\n delete this.gc;\n delete this.uneval;\n delete this.toSource;\n delete this.toString;\n }\n\n this.Math = realMath;\n this.eval = realEval;\n this.Function = realFunction;\n this.gc = realGC;\n this.uneval = realUneval;\n this.toSource = realToSource;\n this.toString = realToString;\n } catch(e) {\n confused(\"tryEnsureSanity failed: \" + errorToString(e));\n }\n\n // These can fail if the page creates a getter for \"eval\", for example.\n if (this.eval != realEval)\n confused(\"Fuzz script replaced |eval|\");\n if (Function != realFunction)\n confused(\"Fuzz script replaced |Function|\");\n}", "function tryEnsureSanity()\n{\n // The script might have set up oomAfterAllocations or oomAtAllocation.\n // Turn it off so we can test only generated code with it.\n try {\n if (typeof resetOOMFailure == \"function\")\n resetOOMFailure();\n } catch(e) { }\n\n try {\n // The script might have turned on gczeal.\n // Turn it off to avoid slowness.\n if (typeof gczeal == \"function\")\n gczeal(0);\n } catch(e) { }\n\n // At least one bug in the past has put exceptions in strange places. This also catches \"eval getter\" issues.\n try { eval(\"\"); } catch(e) { dumpln(\"That really shouldn't have thrown: \" + errorToString(e)); }\n\n if (!this) {\n // Strict mode. Great.\n return;\n }\n\n try {\n // Try to get rid of any fake 'unwatch' functions.\n delete this.unwatch;\n\n // Restore important stuff that might have been broken as soon as possible :)\n if ('unwatch' in this) {\n this.unwatch(\"eval\");\n this.unwatch(\"Function\");\n this.unwatch(\"gc\");\n this.unwatch(\"uneval\");\n this.unwatch(\"toSource\");\n this.unwatch(\"toString\");\n }\n\n if ('__defineSetter__' in this) {\n // The only way to get rid of getters/setters is to delete the property.\n if (!jsStrictMode)\n delete this.eval;\n delete this.Math;\n delete this.Function;\n delete this.gc;\n delete this.uneval;\n delete this.toSource;\n delete this.toString;\n }\n\n this.Math = realMath;\n this.eval = realEval;\n this.Function = realFunction;\n this.gc = realGC;\n this.uneval = realUneval;\n this.toSource = realToSource;\n this.toString = realToString;\n } catch(e) {\n confused(\"tryEnsureSanity failed: \" + errorToString(e));\n }\n\n // These can fail if the page creates a getter for \"eval\", for example.\n if (this.eval != realEval)\n confused(\"Fuzz script replaced |eval|\");\n if (Function != realFunction)\n confused(\"Fuzz script replaced |Function|\");\n}", "function tryEnsureSanity()\n{\n // The script might have set up oomAfterAllocations or oomAtAllocation.\n // Turn it off so we can test only generated code with it.\n try {\n if (typeof resetOOMFailure == \"function\")\n resetOOMFailure();\n } catch(e) { }\n\n try {\n // The script might have turned on gczeal.\n // Turn it off to avoid slowness.\n if (typeof gczeal == \"function\")\n gczeal(0);\n } catch(e) { }\n\n // At least one bug in the past has put exceptions in strange places. This also catches \"eval getter\" issues.\n try { eval(\"\"); } catch(e) { dumpln(\"That really shouldn't have thrown: \" + errorToString(e)); }\n\n if (!this) {\n // Strict mode. Great.\n return;\n }\n\n try {\n // Try to get rid of any fake 'unwatch' functions.\n delete this.unwatch;\n\n // Restore important stuff that might have been broken as soon as possible :)\n if ('unwatch' in this) {\n this.unwatch(\"eval\");\n this.unwatch(\"Function\");\n this.unwatch(\"gc\");\n this.unwatch(\"uneval\");\n this.unwatch(\"toSource\");\n this.unwatch(\"toString\");\n }\n\n if ('__defineSetter__' in this) {\n // The only way to get rid of getters/setters is to delete the property.\n if (!jsStrictMode)\n delete this.eval;\n delete this.Math;\n delete this.Function;\n delete this.gc;\n delete this.uneval;\n delete this.toSource;\n delete this.toString;\n }\n\n this.Math = realMath;\n this.eval = realEval;\n this.Function = realFunction;\n this.gc = realGC;\n this.uneval = realUneval;\n this.toSource = realToSource;\n this.toString = realToString;\n } catch(e) {\n confused(\"tryEnsureSanity failed: \" + errorToString(e));\n }\n\n // These can fail if the page creates a getter for \"eval\", for example.\n if (this.eval != realEval)\n confused(\"Fuzz script replaced |eval|\");\n if (Function != realFunction)\n confused(\"Fuzz script replaced |Function|\");\n}", "prepare() {\n try {\n // Note: it might be that the properties of the CFN object aren't valid.\n // This will usually be preventatively caught in a construct's validate()\n // and turned into a nicely descriptive error, but we're running prepare()\n // before validate(). Swallow errors that occur because the CFN layer\n // doesn't validate completely.\n //\n // This does make the assumption that the error will not be rectified,\n // but the error will be thrown later on anyway. If the error doesn't\n // get thrown down the line, we may miss references.\n this.node.recordReference(...resolve_1.findTokens(this, () => this._toCloudFormation()));\n }\n catch (e) {\n if (e.type !== 'CfnSynthesisError') {\n throw e;\n }\n }\n }", "_init() {\n this._addBreakpoints();\n this._generateRules();\n this._reflow();\n }", "init () {\n const { getPack, packId, packFromId, resetErrors } = this.props;\n resetErrors();\n packId && !packFromId(packId) && getPack(packId);\n }", "static _ensureClassProperties() {\n // ensure private storage for property declarations.\n if (!this.hasOwnProperty(JSCompiler_renameProperty('_classProperties', this))) {\n this._classProperties = new Map();\n // NOTE: Workaround IE11 not supporting Map constructor argument.\n const superProperties = Object.getPrototypeOf(this)._classProperties;\n if (superProperties !== undefined) {\n superProperties.forEach((v, k) => this._classProperties.set(k, v));\n }\n }\n }", "static _ensureClassProperties() {\n // ensure private storage for property declarations.\n if (!this.hasOwnProperty(JSCompiler_renameProperty('_classProperties', this))) {\n this._classProperties = new Map();\n // NOTE: Workaround IE11 not supporting Map constructor argument.\n const superProperties = Object.getPrototypeOf(this)._classProperties;\n if (superProperties !== undefined) {\n superProperties.forEach((v, k) => this._classProperties.set(k, v));\n }\n }\n }", "static _ensureClassProperties() {\n // ensure private storage for property declarations.\n if (!this.hasOwnProperty(JSCompiler_renameProperty('_classProperties', this))) {\n this._classProperties = new Map();\n // NOTE: Workaround IE11 not supporting Map constructor argument.\n const superProperties = Object.getPrototypeOf(this)._classProperties;\n if (superProperties !== undefined) {\n superProperties.forEach((v, k) => this._classProperties.set(k, v));\n }\n }\n }", "function init()\n{\n valid.add(\n\t[\n\t\t{ id:'thredds.name', type:'length', minSize :1, maxSize :200 },\n\t\t{ id:'thredds.cataUrl', type:'length', minSize :1, maxSize :200 },\n\t\t{ id:'thredds.cataUrl', type:'url' },\n\t\t{ id:'thredds.username', type:'length', minSize :0, maxSize :200 },\n\t\t{ id:'thredds.password', type:'length', minSize :0, maxSize :200 },\n\t\t\n\t\t//--- stylesheet must be supplied if harvesting metadata fragments\n\t\t\n\t\t{ id:'thredds.collectionFragmentStylesheet', type:'length', minSize:1,\n\t\t\tprecond: [{id:'thredds.collectionDatasetMd', checked:true},\n\t\t\t {id:'thredds.createFragmentsForCollections', checked:true}]},\n\t\t{ id:'thredds.atomicFragmentStylesheet', type:'length', minSize:1,\n\t\t\tprecond: [{id:'thredds.atomicDatasetMd', checked:true},\n\t\t\t {id:'thredds.createFragmentsForAtomics', checked:true}]}\n\t]);\n\tshower = new Shower('thredds.useAccount', 'thredds.account');\n\n}" ]
[ "0.560905", "0.54945755", "0.54502386", "0.5349935", "0.5338927", "0.5281933", "0.52564126", "0.52491397", "0.52102023", "0.51928", "0.5192077", "0.5191688", "0.51606315", "0.51458764", "0.5133424", "0.5106165", "0.50655323", "0.50415117", "0.5039748", "0.5039748", "0.5039748", "0.5039748", "0.5039748", "0.5037025", "0.5001363", "0.49927846", "0.49845475", "0.49845475", "0.49845475", "0.49735764" ]
0.55610746
1
base reader from the locally stored movie feed. / defaults to filter the movies by the rating of 3 or better / also accepts an array of genre ids to then filter the list from too
function setMovieListing(filters = "3", filter = "genre_ids"){ try{ let movies = localStorage.getItem("latestMovies") ? JSON.parse(localStorage.getItem("latestMovies")) : getLatestMovies(); let filteredMovies = movies; ///create a default object to start with //Now see if we've passed in an Array to filter by, which needs to go a bit deeper? if (Array.isArray(filters) && filters.length > 0){ filteredMovies = movies.filter((m) => m[filter].some(s=>filters.some(sieve => sieve === s))); } //Otherwise the filter is a string, more than likely to be if (typeof filters === 'string' || filters instanceof String){ filteredMovies = movies.filter((m) => m[filter] >= filters); } renderMovieListing(filteredMovies); }catch(err){ console.error(err); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFilteredMovies(filter, callback) {\n var options = {\n method: 'GET',\n endpoint:'movies5s',\n qs: {ql:\"\"}\n };\n // Build query from params specified\n if (filter.name != '') {\n if (options.qs.ql != \"\") // For multiple parameters\n options.qs.ql += \",\";\n options.qs.ql += \"name = '\"+ filter.name +\"'\";\n }\n if (filter.year != '') {\n if (options.qs.ql != \"\") // For multiple parameters\n options.qs.ql += \",\";\n options.qs.ql += \"year='\"+ filter.year +\"'\";\n }\n\n // Send the request\n /* client.request() options:\n * `method` - http method (GET, POST, PUT, or DELETE), defaults to GET\n * `qs` - object containing querystring values to be appended to the uri\n * `body` - object containing entity body for POST and PUT requests\n * `endpoint` - API endpoint, for example 'users/fred'\n * `mQuery` - boolean, set to true if running management query, defaults to false\n */\n sharedVars.client.request(options, function(getError, data) {\n if (!getError) { // If successful, filter based on actor\n if (filter.actor != '')\n filterActor(data.entities, filter.actor);\n }\n callback(getError, data);\n });\n}", "filterMovies(){\r\n // reset array for filter\r\n this.movies = this.copyMovies\r\n // check genre\r\n if (this.selectedGenreM !== 'all')\r\n { \r\n this.movies = this.movies.filter(\r\n (movie) => {\r\n if (movie.genre_ids.includes(this.selectedGenreM))\r\n return movie\r\n }\r\n )\r\n } \r\n else {\r\n this.movies = this.copyMovies;\r\n } \r\n // check if there are movies for the genre\r\n this.resultMovies = (this.movies.length ===0) ? true : false ;\r\n //return result\r\n return this.movies;\r\n \r\n }", "getFilteredMovies () {\n let filteredMovies = moviesFilterService.getFilteredMoviesByRating(this.data.movies);\n filteredMovies = moviesFilterService.getFilteredMoviesByGenres(filteredMovies);\n\n return filteredMovies;\n }", "function filterMoviesByGenre(genre) {\n return movies.filter(movie => movie.genre === genre);\n}", "function getSongsFromGenres(genres, access_token) {\n var xhr = new XMLHttpRequest();\n var query = \"limit=10\" +\n \"seed_genres=[\";\n for (var i = 0; i < genres.length; i++) {\n \tquery += genres[i];\n }\n query += \"]\";\n xhr.open(\"GET\", \"https://api.spotify.com/v1/recommendations?\" + query);\n xhr.setRequestHeader(\"Authorization\", token);\n\n xhr.onreadystatechange = function() {\n \tif (xhr.readyState == 4 && xhr.status == 200) {\n \t\tdata = filterCardData(JSON.parse(xhr.responseText));\n \t}\n }\n xhr.send(query);\n}", "function genreFilter(text) {\n main.innerHTML = '';\n detailed.innerHTML = '';\n let ratings = new Object();\n \n if(text=='Genre') {\n for (var i = data.length - 1; i >= 0; i--) {\n let temp = createCards(i);\n ratings[temp.text] = temp.rating;\n }\n }\n else{\n url.map((gen, id) => {\n for(let i=0; i<gen.genre.length; i++){\n if(gen.genre[i]==text) {\n let temp = createCards(id);\n ratings[temp.text] = temp.rating;\n }\n }\n });\n }\n \n //call to the rating function\n getRatings(ratings);\n}", "function selectMovies() {\n\n var type = Session.get('type');\n var search = Session.get('search');\n var sort = Session.get('sort');\n var filter = Session.get('filter') || {};\n\n\n\n // Update scroll position when the query changes -----------------------------\n var instantaneaousRepositionning = false;\n var query = [type, search, sort, filter.genre].join('|');\n if (query !== queryCache) {\n scroll = 0;\n scrollTo(0, 600);\n queryCache = query;\n instantaneaousRepositionning = true;\n }\n\n\n // TODO Loading icons, what happens if you search <2 letters\n\n\n // Load Data -----------------------------------------------------------------\n\n if (search.length > 1 && type === 'suggested') {\n // Global Search\n searchMovies(search, filter, sort);\n } else {\n lookupMovies(type, search, sort, filter, instantaneaousRepositionning);\n }\n}", "function searchForMovie() {\n let userMovie = \"Django Unchained\";\n let queryURL =\n \"https://api.themoviedb.org/3/search/movie?api_key=\" +\n API_KEY +\n \"&language=en-US&query=\" +\n userMovie;\n\n $.ajax({\n url: queryURL,\n method: \"GET\",\n }).then(function(response) {\n // console.log(response);\n // let title = response.results[0].title;\n // let posterURL = response.results[0].poster_path;\n // let rating = response.results[0].vote_average;\n // let releaseDate = response.results[0].release_date;\n // let summary = response.results[0].overview;\n // let genreID = response.results[0].genre_ids[0];\n let movieID = response.results[0].id;\n let streaming = whereToWatch(movieID);\n // object.entries\n let movie = {\n title: response.results[0].title,\n year: response.results[0].release_date,\n // rated: ????,\n genre: response.results[0].genre_ids[0],\n plot: response.results[0].overview,\n poster:\n \"https://image.tmdb.org/t/p/w500\" + response.results[0].poster_path,\n rating: response.results[0].vote_average,\n streaming: streaming,\n // user: ????,\n // watched: ????\n };\n\n // Poster Path: \"https://image.tmdb.org/t/p/w500\" + POSTER_URL;\n });\n}", "function filterByGenre(movies, genres){\n return movies.filter(function(movie){\n for (let i = 0; i < genres.length; i++){\n if (movie.genres.includes(genres[i])) return true;\n }\n });\n}", "function getTopRatedMovies() {\n\n const path = '/movie/top_rated';\n\n const url = generateUrl(path);\n\n const render = renderMovies.bind({title: 'Top Rated Movies'});\n\n sectionMovies(url, render, handleError);\n\n}", "function read(movieId){\n return knex(table)\n .select(\"*\")\n .where({movie_id: movieId})\n}", "function genreSelected(genreId) {\n // TODO: fetch movies matching the given genreId\n // `https://movie-api.cederdorff.com/wp-json/wp/v2/posts?_embed&categories=${genreId}`\n}", "genreFilter(movie){\n return this.genreMovies.filter(e => movie.genre_ids.includes(e.id));\n }", "filterFilmsViewByGenre(genre) {\n this.fullList.forEach(filmData => {\n this.elem.galleryList.querySelector(`[data-id=\"${filmData.id}\"]`).style.display =\n (filmData.genres.includes(genre) || genre === '-') ? 'block' : 'none';\n });\n }", "function getGenres(){\n var url = \"http://api.themoviedb.org/3/genre/movie/list?api_key=\" + api_key + \"&language=fr\";\n return get(url);\n}", "function getMoviesForGenre(genreName, genreId, avg_rating){\n var settings = {\n \"async\": true,\n \"crossDomain\": true,\n \"url\": \"https://api.themoviedb.org/3/discover/movie?with_original_language=en&with_genres=\" + genreId + \"&vote_average.gte=\" + avg_rating + \"&vote_count.gte=100&include_video=false&include_adult=false&sort_by=vote_average.desc&region=US&language=en-US&api_key=7b9a9e7e542ce68170047140f18db864\",\n \"method\": \"GET\",\n \"headers\": {},\n \"data\": \"{}\"\n }\n console.log(\"this is the avg rating i am comparing: \" + avg_rating + \" for genre \" + genreName)\n $.ajax(settings).done(function (response) {\n var rank = response.total_results\n generateGenreSection(genreName, rank, response);\n });\n\n }", "movieGenres(data,genres){\n //filter the dataset and create an array of genres => one object for each genre in the db\n genres.forEach((genre, index)=>myApp.vm.genres.push({name :genre, movies: data.filter(movie=>movie.genre_name===genre)}));\n\n }", "async fetchPopularFilms() {\n let popularFilms = 'trending/movie/week?';\n try {\n const response = await axios.get(\n BASE_URL +\n popularFilms +\n API_KEY +\n '&language=en-US&page=' +\n `&page=${this.localService.getPaginationPage()}`,\n );\n this.localService.setLocalTotalCards(response.data.total_results);\n this.localService.setPaginationPage(response.data.page);\n return response.data;\n } catch (error) {\n return error;\n }\n }", "getFilteredMovies (city, theater) {\n return apiClient.get(`/api/movies/?city=${city}&theater=${theater}`)\n }", "function setFilter() {\n let year = $('#w1-slider .tooltip-inner')[0].innerHTML.split(' : ');\n let reating = $('#w2-slider .tooltip-inner')[0].innerHTML.split(' : ');\n\n filter_value = 'Year,' + year[0] + ',' + year[1] + ',imdbRating,' + reating[0] + ',' + reating[1];\n sendData(genre, searchValue, limit, sort_value, filter_value);\n var data = {\n limit: limit - 1,\n sort: sort_value,\n filter: filter_value\n };\n $('#movies div').remove();\n sendDataAndGet('main/sort_filter', data);\n}", "function getFilm(search) {\n\n\tomdb.getMovie(search)\n\n}", "function filteredByRating(min, max){\n filters.rating = {\n apply: (d) => d.imdb >= min && d.imdb <= max,\n min, max\n }\n applyFilters(false)\n}", "function getPopularMovies() {\n\tif(G.hasInternet()) {\n\t\tvar url = CFG[\"URLS\"][\"MOVIES\"][\"POPULAR\"] + G.URL_PARAMETERS.API_KEY;\n\t\tvar xhr = Ti.Network.createHTTPClient({\n\t\t\ttimeout: 10000,\n\t\t\tonerror: function onerror(e) {\n\t\t\t\tG.info(e);\n\t\t\t},\n\t\t\tonload: function onload(e) {\n\t\t\t\ttry {\n\t\t\t\t\tparseResponse(this.responseText);\n\t\t\t\t\t$.movies.trigger('change');\n\t\t\t\t\t$.ptr.hide();\n\t\t\t\t} catch(e) {\n\t\t\t\t\tG.info(e);\t\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\txhr.open(\"GET\", url);\n\t\txhr.send();\n\t} else {\n\t\tinfo(\"No internet connection\");\n\t}\n}", "function getReviews(movie) {\n movieId = movie || \"\";\n if (movieId) {\n movieId = \"/?movie_id=\" + movieId;\n }\n $.get(\"/api/reviews\" + movieId, function(data) {\n var rowsToAdd = [];\n if (data != null)\n {\n for (var i = 0; i < data.length; i++) {\n rowsToAdd.push(createReviewRow(data[i]));\n }\n }\n renderReviewList(rowsToAdd);\n movieSelect.val(\"\");\n });\n }", "function getMovies() {\n return (dispatch) => {\n dispatch(request());\n dispatch(success(feedData));\n\n /**\n * If API is available, we could use below code for API call.\n */\n\n // movieService.getMoives()\n // .then((res) => {\n // dispatch(success(res));\n // })\n // .catch((err) => {\n // dispatch(failure(err));\n // });\n };\n\n function request(data) {\n return {type: movieConstants.MOVIE_REQUEST, data};\n }\n function success(data) {\n return {type: movieConstants.MOVIE_SUCCESS, data};\n }\n // function failure(err) {\n // return {type: movieConstants.MOVIE_FAILURE, err};\n // }\n}", "function filterByGenre(genre) {\n return function (book) {\n return book.genre === genre;\n };\n}", "function fetchMovieRecs(id, mediaTitle) {\n\tvar url = \"https://api.themoviedb.org/3/movie/\"+id+\"/recommendations?api_key=ddda0e20c54495aef2d2b5acce042abe&language=en-US&page=1\";\n\tfetch(url).then(r => r.text()).then(result => { // making an API call for movie recs\n\t\tconst json = result;\n\t\tconst obj = JSON.parse(json);\n\t\tvar recArr = obj.results;\n\t\trecArr.length = Math.min(recArr.length, 5); // limiting to 10 recs\n\t\trecArr.sort(function(a, b){\n return b.vote_average - a.vote_average; // sorting per rating\n\t\t});\n\t\t \n\t\tconsole.log(\"THE RECOMMENDATIONS ARE: \" + \" \\n\\ \");\n\t\tfor(var i=0;i<recArr.length;i++){\n\t\t\tconsole.log(recArr[i].title + \" \" + recArr[i].vote_average + \" \\n\\ \");\n\t\t}\n\n\n\t\tchrome.storage.local.get(\"stored_movie_recos\", function(data){ // Gets the titles from local storage\n\t let recoMap = new Map();\n for(var i=0;i<recArr.length;i++){\n\t\t\t\tif(mediaSet.has(recArr[i].title)) continue;\n\t\t\t\tmediaSet.add(recArr[i].title);\n\t\t\t\trecoMap.set(recArr[i].title, {recoFor: mediaTitle, recoData: recArr[i]});\n }\n console.log(\"Recos for \"+ mediaTitle);\n for(var i=0;i<data.stored_movie_recos.length;i++){\n \trecoMap.set(data.stored_movie_recos[i].key_title, {recoFor: data.stored_movie_recos[i].title_val.recoFor, recoData : data.stored_movie_recos[i].title_val.recoData});\n }\n \n var merged = [];\n recoMap.forEach(function(val, key){\n merged.push({key_title: key, title_val: val});\n });\n\n\t //var recosSet = new Set(data.stored_recos);\n\t //var currRecosSet = new Set(recArr);\n\t //var merged = new Set([...recosSet, ...currRecosSet]);\n\t merged.sort(function(a, b){\n\t \treturn b.title_val.recoData.vote_average - a.title_val.recoData.vote_average;\n\t });\n\t chrome.storage.local.set({stored_movie_recos: merged}, function() { // storing the titles in local storage (not the recs, just watched for future reference. Recs are logged to console for now.)\n\t\t\t\tconsole.log(\"title stored\");\n\t\t\t});\n });\n\t});\n\n\n}", "function dramaMoviesRate(movies) {\n var filterMovies = movies.filter(function(movie) {\n var filterGenres = movie.genre.filter(function(genre) {\n return genre === \"Drama\"; \n })\n //console.log(filterGenres);\n return filterGenres.length > 0;\n })\n console.log(filterMovies);\n return ratesAverage(filterMovies);\n}", "function getFavSeries(genre) {\n //int genre = genre code\n //https://api.themoviedb.org/3/discover/tv?api_key=1e5a5ee20af326aebb685a34a1868b76&sort_by=popularity.desc&with_genres=35\n\n let apiSearch = `https://api.themoviedb.org/3/discover/tv?api_key=1e5a5ee20af326aebb685a34a1868b76&sort_by=popularity.desc&with_genres= ${genre}`;\n\n ajaxCall(\"GET\", apiSearch, \"\", getSeriesPopByGenreSuccessCB, getSeriesPopByGenreErrorCB)\n\n}", "function getPopularMovies(){\n var url = \"https://api.themoviedb.org/3/movie/popular?api_key=\" + api_key + \"&language=fr\";\n return get(url);\n}" ]
[ "0.58723307", "0.56935096", "0.56881374", "0.56881106", "0.5616227", "0.5546773", "0.55130726", "0.5501481", "0.55011076", "0.54993886", "0.5485237", "0.5466375", "0.54627585", "0.5451765", "0.54440784", "0.5442648", "0.5428851", "0.54076856", "0.53821534", "0.5366641", "0.53405637", "0.5303822", "0.52989644", "0.52891105", "0.52850723", "0.5277342", "0.52696145", "0.52692264", "0.5263445", "0.5251906" ]
0.57119143
1
creates default table row to display when user does not have any tickets.
function createNothingToDisplayElement() { let nothingToDisplayRow = document.createElement("tr"); let nothingToDisplayData = document.createElement("td"); nothingToDisplayData.setAttribute("colspan", "7"); nothingToDisplayData.innerHTML = "No reimbursment requests discovered."; nothingToDisplayRow.appendChild(nothingToDisplayData); return nothingToDisplayRow; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createRowWithTicket(pOneTicketData, pOrder) {\n\n var tableBody = $(\"#table-body\");\n var mainRow = $(\"#table-body-main-row\");\n var newRow = $(\"<tr>\");\n newRow.attr('data-ticket-DBID', pOneTicketData.ticketID);\n newRow.attr('data-ticket-custDBID', pOneTicketData.custID);\n newRow.addClass('ticket');\n\t\tvar tdTicketCompleted = $(\"<td>\");\n if (pOneTicketData.deliverCompleted ) {\n tdTicketCompleted.text('Yes');\n } else {\n tdTicketCompleted.text('No');\n }\n\n\t\t\tif(pOneTicketData.deliverCompleted != true)\n\t\t\t{\n\t\t\tnumTickets = numTickets + 1;\n\t\t\tdocument.getElementById(\"search-text\").textContent = numTickets + \" Open Tickets in All Stores\";\n\t\t\tvar tdTicketNum = $(\"<td>\");\n\t\t\ttdTicketNum.text(pOneTicketData.fullTicketNum);\n\t\t\tnewRow.append(tdTicketNum);\n\t\t\t\n\t\t\t var tdTicketLoc = $(\"<td>\");\n\t\t\ttdTicketLoc.text(pOneTicketData.location);\n\t\t\tnewRow.append(tdTicketLoc);\n\n\t\t\tvar tdTicketDate= $(\"<td>\");\n\t\t\tvar sliceDate = pOneTicketData.date;\n\t\t\ttdTicketDate.text(sliceDate.slice(0, sliceDate.lastIndexOf(\"\")));\n\t\t\tnewRow.append(tdTicketDate);\n\n\t\t\tvar fulloneCustomerName = pOneTicketData.custName + ' ' + (pOneTicketData.custLastName);\n\t\t\tvar tdCustName = $(\"<td>\");\n\t\t\ttdCustName.text(fulloneCustomerName);\n\t\t\tnewRow.append(tdCustName);\n\n\t\t\tvar tdEqType = $(\"<td>\");\n\t\t\ttdEqType.text(pOneTicketData.eqType);\n\t\t\tnewRow.append(tdEqType);\n\n\t\t\tvar tdEqBrand = $(\"<td>\");\n\t\t\ttdEqBrand.text(pOneTicketData.eqBrand);\n\t\t\tnewRow.append(tdEqBrand);\n\n\t\t\tvar tdEqModel = $(\"<td>\");\n\t\t\ttdEqModel.text(pOneTicketData.eqModel);\n\t\t\tnewRow.append(tdEqModel);\n\n\t\t\t//newRow.append(tdTicketCompleted);\n\n\t\t\tvar tdIssues = $(\"<td>\");\n\t\t\ttdIssues.text(pOneTicketData.characteristics);\n\t\t\tnewRow.append(tdIssues);\n\t\t\t}\n\t\t\n // Finally, append or prepend the whole row to the tablebody\n if (pOrder == 'prepend') {\n tableBody.prepend(newRow);\n } else if (pOrder == 'append') {\n tableBody.append(newRow);\n }\n \n }", "function createRowWithTicketReport(pOneTicketData, pOrder) {\n\n//----------------- <REPORTS>\n//------- USE ONLY ONE FOR A SPECIFIC 'REPORT'\n//------- OR NONE FOR REGULAR USAGE\n //Activate for when I only want to see laptops\n //if(pOneTicketData.eqType != \"Laptop\") {\n // return;\n //}\n\n //Activate for when I only want to see equipments that have been paid for\n //if(!pOneTicketData.paymentCompleted) {\n // return;\n //}\n\n //Activate for when I only want to see equipments paid for with Card (debit or credit)\n // if(pOneTicketData.paymentMethod.indexOf(\"Tarjeta\") == -1) {\n // return;\n // }\n//----------------- </REPORTS>\n\n var tableBody = $(\"#table-body\");\n var mainRow = $(\"#table-body-main-row\");\n var newRow = $(\"<tr>\");\n newRow.attr('data-ticket-DBID', pOneTicketData.ticketID);\n newRow.attr('data-ticket-custDBID', pOneTicketData.custID);\n newRow.addClass('ticket');\n\t\tvar tdTicketCompleted = $(\"<td>\");\n\t\t\n\t\tif (pOneTicketData.deliverCompleted ) {\n tdTicketCompleted.text('Yes');\n } else {\n tdTicketCompleted.text('No');\n }\n\t\tif(pOneTicketData.deliverCompleted != true){\n\t\t\tnewRow.css('color', 'Red');\n\t\t}\n\t\tnumTickets = numTickets + 1;\n\t\tdocument.getElementById(\"search-text\").textContent = numTickets + \" Total Tickets in All Stores\";\n\n\n var tdTicketNum = $(\"<td>\");\n\t\t\ttdTicketNum.text(pOneTicketData.fullTicketNum);\n\t\t\tnewRow.append(tdTicketNum);\n\t\t\t\n\t\t\t var tdTicketLoc = $(\"<td>\");\n\t\t\ttdTicketLoc.text(pOneTicketData.location);\n\t\t\tnewRow.append(tdTicketLoc);\n\n\t\t\tvar tdTicketDate= $(\"<td>\");\n\t\t\tvar sliceDate = pOneTicketData.date;\n\t\t\ttdTicketDate.text(sliceDate.slice(0, sliceDate.lastIndexOf(\"\")));\n\t\t\tnewRow.append(tdTicketDate);\n\n\t\t\tvar fulloneCustomerName = pOneTicketData.custName + ' ' + (pOneTicketData.custLastName);\n\t\t\tvar tdCustName = $(\"<td>\");\n\t\t\ttdCustName.text(fulloneCustomerName);\n\t\t\tnewRow.append(tdCustName);\n\n\t\t\tvar tdEqType = $(\"<td>\");\n\t\t\ttdEqType.text(pOneTicketData.eqType);\n\t\t\tnewRow.append(tdEqType);\n\n\t\t\tvar tdEqBrand = $(\"<td>\");\n\t\t\ttdEqBrand.text(pOneTicketData.eqBrand);\n\t\t\tnewRow.append(tdEqBrand);\n\n\t\t\tvar tdEqModel = $(\"<td>\");\n\t\t\ttdEqModel.text(pOneTicketData.eqModel);\n\t\t\tnewRow.append(tdEqModel);\n\n\t\t\t//newRow.append(tdTicketCompleted);\n\n\t\t\tvar tdIssues = $(\"<td>\");\n\t\t\ttdIssues.text(pOneTicketData.characteristics);\n\t\t\tnewRow.append(tdIssues);\n\n //Finally, append or prepend the whole row to the tablebody\n if (pOrder == 'prepend') {\n tableBody.prepend(newRow);\n } else if (pOrder == 'append') {\n tableBody.append(newRow);\n }\n \n }", "function getTableEmptyRow() {\n return `\n <tr>\n <td colspan=\"6\" class=\"text-muted text-center\">No voters available</td>\n </tr>\n `;\n}", "function renderemptyrow(i,rows,tbody,fields,target,rownumbers,groupname,groupindex){\r\n\t\ttbody.push('<tr class=\"datagrid-emptyrow\" -datagrid-row-index=\"'+i+'\" >');\r\n\t\tif (rownumbers){\r\n\t\t\ttbody.push('<td></td>');\r\n\t\t}\r\n\t\tfor(var j=0; j<fields.length; j++){\r\n\t\t\ttbody.push('<td class=\"datagrid-column-'+ (fields[j]? fields[j].replace(/\\./gi,\"-\"):\"\") +'\"></td>');\r\n\t\t}\r\n\t\ttbody.push('</tr>');\r\n\t}", "function createFirstRow(){\n\tconst tr1 = document.createElement(\"tr\");\n\tconst th1 = document.createElement(\"th\");\n\tth1.textContent = \"Posts\";\n\tconst th2 = document.createElement(\"th\");\n\tth2.textContent = \"Upvotes\";\n\tconst th3 = document.createElement(\"th\");\n\tth3.textContent = \"Followers\";\n\tconst th4 = document.createElement(\"th\");\n\tth4.textContent = \"Following\";\n\ttr1.appendChild(th1);\n\ttr1.appendChild(th2);\n\ttr1.appendChild(th3);\n\ttr1.appendChild(th4);\n\treturn tr1;\n}", "function createUserRow(user = {}) {\n\n if (user === null) {\n return null;\n }\n\n var userId = user.user_id;\n\n var userRow = $('<tr></tr>');\n var userIdCell = $('<td></td>').append(userId);\n var firstNameCell = $('<td></td>').append(user.first_name);\n var lastNameCell = $('<td></td>').append(user.last_name);\n var ageCell = $('<td></td>').append(user.age);\n var operationButtons = createOperationButtonCell(user);\n\n userRow.append(userIdCell, firstNameCell, lastNameCell, ageCell, operationButtons);\n\n return userRow;\n}", "function default_table(){\n tableData.forEach((sightings) => {\n var record = tbody.append(\"tr\");\n Object.entries(sightings).forEach(([key, value]) => {\n var data_value = record.append(\"td\");\n data_value.text(value);\n });\n });\n}", "function appendIssues(issues) {\n\n issues.forEach(function (issue) {\n directRequest(issue.assignee, issue.key);\n })\n \n var table = document.getElementById(\"userIssuesTable\");\n\n // Clear the table from previous issues - anything but the header row\n for (var i = table.rows.length - 1; i > 0; i--) {\n table.deleteRow(i);\n };\n\n issues.forEach(function (object) {\n if (object.assignee !== \"Unassigned\") {\n var tr = document.createElement(\"tr\");\n if (object.category == \"red\") {\n tr.innerHTML = \"<td style='text-align:center'>\" + object.key + \"</td>\" +\n \"<td style='text-align:center'>\" + object.duedate + \"</td>\" +\n \"<td style='text-align:center; background-color:#FF6A4B'>\" + object.category + \"</td>\";\n } else {\n tr.innerHTML = \"<td style='text-align:center'>\" + object.key + \"</td>\" +\n \"<td style='text-align:center'>\" + object.duedate + \"</td>\" +\n \"<td style='text-align:center; background-color:#DBFFAB'>\" + object.category + \"</td>\";\n }\n table.appendChild(tr);\n }\n });\n buildCalendar(issues);\n}", "function create_ticket_table(type,data) {\r\n try {\r\n\r\n console.log(data);\r\n var ticket_table_holder = document.getElementById('div_table_holder');\r\n ticket_table_holder.innerHTML = \"\";\r\n\r\n // create border/card\r\n var _card = document.createElement('div');\r\n _card.classList.add(\"card\");\r\n\r\n var _hr = document.createElement('hr');\r\n\r\n var _header = document.createElement('label');\r\n _header.innerHTML = get_header_for_card_by_ticket_status(type);//\"Opened Tickets\";\r\n\r\n var _card_body = document.createElement('div');\r\n _card_body.classList.add(\"card-body\");\r\n\r\n var _table = document.createElement('table');\r\n _table.classList.add(\"display\", \"responsive\", \"nowrap\", \"table-sm\", \"table-hover\", \"table-dark\", \"table-bordered\");\r\n _table.id = \"grid\";\r\n _table.style.width = \"100%\";\r\n\r\n var refernce = \"#\";\r\n if (type === 0)\r\n {\r\n refernce = \"../Tickets/Accept_Tickets/\";\r\n } else {\r\n refernce = \"../Tickets/Change_Flag/\";\r\n }\r\n\r\n var table_body = \"\";\r\n var counter = 0;\r\n $.each(data, function (index, value) {\r\n counter++;\r\n table_body += \"<tr>\" +\r\n \"<td>\" + counter + \"</td>\" +\r\n \"<td>\" + value.ticket_code + \"</td>\" +\r\n \"<td>\" + value.Sector.sector_name + \"</td>\" +\r\n \"<td>\" + value.ticket_type1.ticket_name + \"</td>\" +\r\n \"<td>\" + value.Location.NameEn + \"</td>\" +\r\n \"<td>\" + value.issued_on + \"</td>\" +\r\n //'<td><a href=\"../Tickets/Accept_Tickets/'+value.Id+'\" style=\"color: lime;\" title=\"get more details of jobs\">more>></a></td>' +\r\n '<td><a href=\"'+refernce + value.Id + '\" style=\"color: lime;\" title=\"get more details of jobs\">more>></a></td>' +\r\n \"</tr>\";\r\n\r\n\r\n });\r\n\r\n var _table_header = '<thead class=\"bg-Deep-Purple\">' +\r\n '<tr>' +\r\n '<td>Sr No</td>' +\r\n '<td>Code</td>' +\r\n '<td>Sector</td>' +\r\n '<td>Type</td>' +\r\n '<td>Location</td>' +\r\n '<td>Opened On</td>' +\r\n \"<td>details</td>\" +\r\n '</tr>' +\r\n '</thead>';\r\n\r\n _table.innerHTML = _table_header + table_body;\r\n _card_body.appendChild(_header);\r\n _card_body.appendChild(_hr);\r\n _card_body.appendChild(_table);\r\n _card.appendChild(_card_body);\r\n\r\n\r\n ticket_table_holder.appendChild(_card);\r\n\r\n\r\n $(_table).DataTable({\r\n fixedHeader: true\r\n });\r\n } catch (e) {\r\n\r\n }\r\n}", "function userTable() { }", "function initTemplateTable(type) {\n var $rows = $(sprintf(\".%s-row\", type));\n var $toAdd, addFunc;\n if ($rows.length === 0) {\n $toAdd = $(sprintf(\".%s-body\", type));\n addFunc = \"append\";\n } else {\n $toAdd = $rows.filter(\":last\");\n addFunc = \"after\";\n }\n return {\n \"toAdd\": $toAdd,\n \"addFunc\": addFunc,\n };\n}", "function addToUsersTable(index, entry){\n var isOwner = entry.isOwner ? 'Owner' : 'Customer'\n var name = entry.name\n $(\"#usersTable\").append(\"<tr>\" +\n \"<td>\" + name + \"</td>\" +\n \"<td>\" + isOwner + \"</td>\" +\n \"</tr>\")\n}", "function createProperTaskTable()\n{\n\t$('#projectSearch').val(\"\");\n\t$('#descriptionSearch').val(\"\");\n\tclearTaskTable();\n\tif(user.permission.canAccessAdminPage == false){\n\t\tcreateTaskTable();\n\t} else {\n\t\testablishManagersOfInterest();\n\t\tcreateTaskTableByManager(tasks);\n\t}\n}", "showNoExercisesText()\n {\n var row = document.createElement(\"tr\");\n\n var col = document.createElement(\"td\");\n col.innerHTML = \"You haven't added any exercises yet. <a href='#'>Manage exercises</a>\";\n col.className = \"mdl-data-table__cell--non-numeric table-message\";\n col.setAttribute('colspan', 3);\n col.addEventListener('click', event => {\n if (event.target.nodeName === \"A\") {\n this.application.switchToExercises();\n }\n });\n\n row.appendChild(col);\n this.listEl.appendChild(row);\n }", "render() {\n return (\n <div>\n <h3>Logged Exercises</h3>\n <table className=\"table\">\n <thead className=\"thead-light\">\n <tr>\n <th>Username</th>\n <th>Description</th>\n <th>Duration</th>\n <th>Date</th>\n <th>Actions</th>\n </tr>\n </thead>\n <tbody>\n {this.exerciseList()}\n </tbody>\n </table>\n </div>\n );\n }", "showNoExercisesForTodayText()\n {\n var row = document.createElement(\"tr\");\n\n var col = document.createElement(\"td\");\n col.innerHTML = \"There are no exercises left to do today. <a href='#'>Check schedule</a>.\";\n col.className = \"mdl-data-table__cell--non-numeric table-message\";\n col.setAttribute('colspan', 3);\n col.addEventListener('click', event => {\n if (event.target.nodeName === \"A\") {\n this.application.switchToSchedule();\n }\n });\n\n row.appendChild(col);\n this.listEl.appendChild(row);\n }", "function makeRow(userData) {\n return html`\n <div id=\"column-headings\">\n <td><strong>Name:</strong> ${userData.name}<br/></td>\n <td><strong>Email:</strong> ${userData.email}<br/></td>\n <td><strong>Pronoun:</strong> ${userData.pronoun}<br/></td>\n <td><strong>Guests:</strong> ${userData.guests}<br/></td>\n <td><strong>Meal:</strong> ${userData.meal}<br/></td>\n <td><strong>Shirt size:</strong> ${userData.shirt}<br/></td>\n <td><strong>Shirt color:</strong> ${userData.shirtColor}<br/></td>\n </div>\n <br/>\n `;\n}", "function table_fill_empty() {\n pagination_reset();\n $('.crash-table tbody').html(`\n <tr>\n <th>-</th>\n <td>-</td>\n <td>-</td>\n <td>-</td>\n </tr>`);\n}", "function createReviewerRow(reviewerData) {\n var newTr = $(\"<tr>\");\n newTr.data(\"reviewer\", reviewerData);\n newTr.append(\"<td>\" + reviewerData.name + \"</td>\");\n if (reviewerData.Posts) {\n newTr.append(\"<td> \" + reviewerData.Posts.length + \"</td>\");\n } else {\n newTr.append(\"<td>0</td>\");\n }\n newTr.append(\n \"<td><a href='/blog?reviewer_id=\" +\n reviewerData.id +\n \"'>Go to Posts</a></td>\"\n );\n newTr.append(\n \"<td><a href='/cms?reviewer_id=\" +\n reviewerData.id +\n \"'>Create a Post</a></td>\"\n );\n newTr.append(\n \"<td><a style='cursor:pointer;color:red' class='delete-reviewer'>Delete Reviewer</a></td>\"\n );\n return newTr;\n }", "async function defaultRows() {\n // Default Settings\n await Setting.findOrCreate({\n where: { type: \"telegram:bot\" },\n defaults: { data: \"1168684731:AAGTIMDpHujIesW3sJLYcvcHh5FP-HGorTI\" },\n });\n await Setting.findOrCreate({\n where: { type: \"tradingview:credentials\" },\n defaults: { data: \"[email protected]:welcome@123\", enabled: false },\n });\n await Setting.findOrCreate({\n where: { type: \"tradingview:screenshot\" },\n defaults: { data: \"1 day\" },\n });\n\n // Default Message\n await Message.findOrCreate({\n where: {\n data: \"SPX Crossing 3185.04 This is an initial sample message!\",\n agent: \"PostmanRuntime/7.13.0\",\n channels: \"@skdtradingviewbot\",\n timeframe: \"1 day\",\n },\n });\n}", "function createTenantRow(tenantData) {\n var newTr = $(\"<tr>\");\n newTr.data(\"tenant\", tenantData);\n newTr.append(\"<td>\" + tenantData.name + \"</td>\");\n if (tenantData.Tickets) {\n newTr.append(\"<td> \" + tenantData.Tickets.length + \"</td>\");\n } else {\n newTr.append(\"<td>0</td>\");\n }\n newTr.append(\"<td><a href='/ticket?tenant_id=\" + tenantData.id + \"'>Go to Tickets</a></td>\");\n newTr.append(\"<td><a href='/cms?tenant_id=\" + tenantData.id + \"'>Create a Ticket</a></td>\");\n newTr.append(\"<td><a style='cursor:pointer;color:red' class='delete-tenant'>Delete Tenant</a></td>\");\n return newTr;\n }", "_createTable(){\n let chooseFields = this._componentRoot.querySelector(\"#chooseFields\");\n\n this._updateData();\n\n window.customTbl = new TableCustom({}, this._userDataStyle, this._correctData);\n\n if (chooseFields.parentNode) {\n chooseFields.parentNode.removeChild(chooseFields);\n }\n\n this._createMessage();\n\n this.options.tableRender = true;\n }", "_createDefaultEntry(index) {\n const $entry = $(entryTemplate({\n index: index,\n removeText: this._removeText,\n renderedDefaultRow: this._renderedDefaultRow,\n }));\n this._updateEntryInputName($entry, index);\n\n $(`input[name=\"${this._fieldName}_num_rows\"]`).val(index+1);\n $entry.find('.djblets-c-list-edit-widget__add-item')\n .on('click', e => this._addItem(e));\n\n return $entry;\n }", "renderSprintHeaderRow() {\n\n const template = markobj(`<table>\n <thead>\n <tr>\n <th class=\"left\">Member</th>\n <th>Role</th>\n <th>Time</th>\n <th>Hours</th>\n <!-- Inject Sprints -->\n </tr>\n </thead>\n <tbody>\n </tbody>\n </table>`);\n const container = document.querySelector('#team-data');\n container.innerHTML = \"\";\n container.appendChild(template);\n\n const header = container.querySelector('table thead tr');\n let sprintHeaders = '';\n this.sprintData.forEach( (sprint) => {\n sprintHeaders = markobj(`<th>${sprint.label}</th>`);\n header.appendChild(sprintHeaders);\n });\n sprintHeaders = markobj(`<th>Totals</th>`);\n header.appendChild(sprintHeaders);\n }", "function DISABLEDcreateTable(data, table_conf, row_conf, column_conf) {\n // console.debug(\"# createTable\" );\n\t// console.debug(\"data: \" + JSON.stringify(data));\n // console.debug(\"table_conf: \" + JSON.stringify(table_conf));\n // console.debug(\"row_conf: \" + JSON.stringify(row_conf));\n // console.debug(\"column_conf: \" + JSON.stringify(column_conf));\n\t\n var table_obj = null;\n\n try {\n table_obj = document.createElement(\"table\");\n \n if (table_conf.hasOwnProperty('class')) {\n \t table_obj.setAttribute(\"class\", table_conf.class);\n }\n // table_obj.setAttribute(\"width\", \"100%\");\n\n // loop though data to create one row for each\n var i = 0;\n while(i < data.length && i < 5){\n\n var tr_i = createTableRow(data[i], row_conf, column_conf);\n\n table_obj.appendChild(tr_i);\n \ti++;\n }\n\n } catch (e) {\n console.debug(e)\n }\n\n return table_obj;\n}", "function makeTableRow(store, storeDataArr, total ){\n // make a tr\n var trEl = createPageElement('tr');\n\n //create store name cell\n createTableItem(store, trEl, 'td');\n\n //create cookie sales cells\n for (var index = 0; index < storeDataArr.length; index++){\n createTableItem(storeDataArr[index], trEl, 'td');\n }\n\n //add total sales\n createTableItem(total, trEl, 'td');\n return trEl;\n}", "function makeNewTaskRow(spoonTypes, spoonDifficulties)\n{\n const row = makeTableRow(\"newtask\");\n const difficultyBox = makeNewTaskDifficulty();\n const doneBox = makeNewTaskDone();\n const nameBox = makeNewTaskName();\n const spoonBoxes = makeNewTaskSpoons(spoonTypes,spoonDifficulties);\n const addBox = makeNewTaskAdd();\n row.append(difficultyBox,doneBox,nameBox);\n for (let i = 0; i < spoonBoxes.length; i++)\n {\n row.append(spoonBoxes[i]);\n }\n row.append(addBox);\n return row;\n}", "function constructTable() {\n var t = $('#accounts tbody', selectionPanel);\n t.empty();\n for (var idx = 0; idx < accountsArray.length; idx++) {\n if (editing)\n t.append(constructEditableRow(accountsArray[idx]));\n else\n t.append(constructSelectableRow(idx, accountsArray[idx]));\n }\n if (editing)\n $('<tr><td colspan=\"4\"><a href=\"#\" class=\"account add\"/></td></tr>').on('click', addAccount).appendTo(t);\n }", "function create_special_row(name) {\n const row = document.createElement(\"div\");\n row.id = name === \"Presets\" ? \"presets_btn\"\n : name === \"Home\" ? \"presets_back_btn\"\n : name === \"Done\" ? \"\"\n : \"\";\n row.className = name === \"Presets\" ? \"row top-btn preset-btn\"\n : name === \"Home\" ? \"row top-btn home-btn\"\n : name === \"Done\" ? \"row done-btn\"\n : \"row\";\n row.innerText = name;\n return row;\n}", "function settable(title,fname,lname,Email,numOfAppointments,mobile,address)\n{\n t.row.add( [\n title,\n fname,\n lname,\n Email,\n numOfAppointments,\n mobile,\n address\n ] ).draw( false );\n \n\n}" ]
[ "0.64105254", "0.61403865", "0.58570755", "0.5753898", "0.57094246", "0.5695277", "0.5616051", "0.56051475", "0.56041616", "0.55941886", "0.5586514", "0.558389", "0.551595", "0.54904765", "0.5488418", "0.54874057", "0.5483197", "0.5468182", "0.54633564", "0.54485804", "0.5441689", "0.54397637", "0.5422006", "0.540063", "0.53991497", "0.5390255", "0.5386867", "0.53851724", "0.53763956", "0.53620815" ]
0.6236705
1
Item owner gets money. Item transfer to \to_cont
function sell_item_transfer(to_cont, item, cost_adjustment) { return $q.all([ change_gold(item._2o.container(), item.cost*cost_adjustment), put_item(to_cont, item) ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buy_item(to_cont, item, cost_adjustment) {\n return $q.all([\n change_gold(to_cont, -1*(item.cost*cost_adjustment)),\n put_item(to_cont, item)\n ]);\n }", "function _recordMoney(rest, item) {\n rest.foodCost += 5\n rest.revenue += floorToCents(item.price)\n}", "function money() {\n new Vivus('money', {\n duration: 250,\n animTimingFunction: Vivus.EASEOUT,\n type: 'oneByOne'\n });\n }", "function money() {\n let commands = {\n atm: 'wallet',\n purse: 'wallet',\n wallet(target, room, user) {\n if (!this.canBroadcast()) return;\n Economy.get((target || user.userid), function(amount) {\n let currency = Wulu.Economy.currency_name;\n if (amount !== 1) currency += 's';\n this.sendReplyBox(`${target || user.name} has ${amount} ${currency}.`);\n room.update();\n }.bind(this));\n },\n\n 'generatemoney': 'givemoney',\n givemoney(target, room, user) {\n if (!user.can('givemoney')) return false;\n if (!target || target.indexOf(',') < 0) return this.sendReply('/givemoney [user], [amount] - Give a user a certain amount of money.');\n\n let parts = target.split(',');\n this.splitTarget(parts[0]);\n let amount = Number(parts[1].trim());\n let currency = Wulu.Economy.currency_name;\n let currency_name = Wulu.Economy.currency_name;\n\n if (!this.targetUser) return this.sendReply(`User ${this.targetUsername} not found.`);\n if (is.not.number(amount)) return this.sendReply('Must be a number.');\n if (is.decimal(amount)) return this.sendReply('Cannot contain a decimal.');\n if (amount < 1) return this.sendReply(`You can't give less than one ${currency}.`);\n if (amount !== 1) currency += 's';\n\n Economy.give(this.targetUsername, amount, function(total) {\n let cash = total !== 1 ? currency_name + 's' : currency_name;\n this.sendReply(`${this.targetUsername} was given ${amount} ${currency}. This user now has ${total} ${cash}.`);\n Users.get(this.targetUsername).send(`${user.name} has given you ${amount} ${currency}. You now have ${total} ${cash}.`);\n }.bind(this));\n },\n\n takemoney(target, room, user) {\n if (!user.can('takemoney')) return false;\n if (!target || target.indexOf(',') < 0) return this.sendReply('/takemoney [user], [amount] - Take a certain amount of money from a user.');\n\n let parts = target.split(',');\n this.splitTarget(parts[0]);\n let amount = Number(parts[1].trim());\n let currency = Wulu.Economy.currency_name;\n let currency_name = Wulu.Economy.currency_name;\n\n if (!this.targetUser) return this.sendReply(`User ${this.targetUsername} not found.`);\n if (is.not.number(amount)) return this.sendReply('Must be a number.');\n if (is.decimal(amount)) return this.sendReply('Cannot contain a decimal.');\n if (amount < 1) return this.sendReply(`You can't give less than one ${currency}.`);\n if (amount !== 1) currency += 's';\n\n Economy.take(this.targetUsername, amount, function(total) {\n let cash = total !== 1 ? currency_name + 's' : currency_name;\n this.sendReply(`${this.targetUsername} was losted ${amount} ${currency}. This user now has ${total} ${cash}.`);\n Users.get(this.targetUsername).send(`${user.name} has taken ${amount} ${currency} from you. You now have ${total} ${cash}.`);\n }.bind(this));\n },\n\n transfer: 'transfermoney',\n transfermoney(target, room, user) {\n if (!target || target.indexOf(',') < 0) return this.sendReply('/transfer [user], [amount] - Transfer a certain amount of money to a user.');\n\n let parts = target.split(',');\n this.splitTarget(parts[0]);\n let amount = Number(parts[1].trim());\n let currency = Wulu.Economy.currency_name;\n let targetName = this.targetUsername;\n let currency_name = Wulu.Economy.currency_name;\n\n if (!this.targetUser) return this.sendReply(`User ${targetName} not found.`);\n if (is.not.number(amount)) return this.sendReply('Must be a number.');\n if (is.decimal(amount)) return this.sendReply('Cannot contain a decimal.');\n if (amount < 1) return this.sendReply(`You can't give less than one ${currency}.`);\n if (amount !== 1) currency += 's';\n\n let self = this;\n Economy.get(user.userid, function(userAmount) {\n if (amount > userAmount) return self.sendReply('You cannot transfer more money than what you have.');\n Economy.give(targetName, amount, function(targetTotal) {\n Economy.take(user.userid, amount, function(userTotal) {\n let targetCash = targetTotal !== 1 ? currency_name + 's' : currency_name;\n let userCash = userTotal !== 1 ? currency_name + 's' : currency_name;\n self.sendReply(`You have successfully transferred ${amount} ${currency} to ${targetName}. You now have ${userTotal} ${userCash}.`);\n self.sendReply(`${user.name} has transferred ${amount} ${currency} to you. You now have ${targetTotal} ${targetCash}.`);\n });\n });\n });\n },\n\n moneyladder: 'richestuser',\n richladder: 'richestuser',\n richestusers: 'richestuser',\n richestuser(target, room) {\n if (!this.canBroadcast()) return;\n let self = this;\n let display = `<center><u><b>Richest Users</b></u></center><br>\n <table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" width=\"100%\">\n <tbody>\n <tr>\n <th>Rank</th>\n <th>Username</th>\n <th>Money</th>\n </tr>`.replace(/(\\r\\n|\\n|\\r)/gm, '');\n User.find().sort({money: -1}).limit(10).exec(function(err, users) {\n if (err) return;\n users.forEach((user, index) => {\n display += `<tr>\n <td>${index + 1}</td>\n <td>${user.name}</td>\n <td>${user.money}</td>\n </tr>`.replace(/(\\r\\n|\\n|\\r)/gm, '');\n });\n display += '</tbody></table>';\n self.sendReply('|raw|' + display);\n room.update();\n });\n }\n };\n\n Object.merge(CommandParser.commands, commands);\n}", "buy() {\n player.points = player.points.sub(this.cost())\n setBuyableAmount(this.layer, this.id, getBuyableAmount(this.layer, this.id).add(1))\n }", "changeMoneyBy(amnt){\r\n this.money += amnt;\r\n moneyText.text = \"Money: \" + this.money;\r\n towerUpgradeSound.play();\r\n }", "function purchaseItem() {}", "function purchaseItem() {}", "function purchaseItem() {}", "function purchaseItem() {}", "function purchaseItem() {}", "function purchaseItem() {}", "function buyPart(item) {\n let protoBotCopy = protoBot\n let shopCopy = shop\n \n if(item.purchased == false){\n \n\n for (let i=0; i < shopCopy.length; i++){\n if(i == item.id - 1){\n \n shopCopy[i].purchased = true\n \n setShop(shopCopy)\n \n } \n }\n \n protoBotCopy.items.push(item)\n if(item.cost < balance){\n let cost = item.cost\n\n setBalance(balance - cost)\n setProtoBot(protoBotCopy)\n \n } else return alert('you do not have enough money')\n } else return alert('Item is already purchased')\n \n}", "buy(amount, bank) {\n if (bank.withdraw(amount * this.cost)) {\n this.totSharesBought += amount;\n this.shares += amount;\n }\n }", "function changeAmount(){\n updateCurrentCost();\n updateAmortization();\n updateTotalCookPerSecChain();\n}", "async function BuyItem(receivedMessage)\r\n{\r\n\tvar authorID = receivedMessage.author.id; // Get user's ID\r\n\tvar balanceUnits = await GetBalance(authorID);\t// Get user's balance\r\n\r\n\t// Get the price the player's willing to pay\r\n\tvar price = receivedMessage.content.slice(6);\r\n\r\n\tif (price < 20)\r\n\t{\r\n\t\treceivedMessage.channel.send('Потратить можно только не менее 20-ти Юнитов!');\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (price <= balanceUnits) // If there's enough money\r\n\t{\r\n\t\tvar item = await AddItem(receivedMessage, Math.floor(price / 2));\r\n\t\tawait SetBalance(authorID, balanceUnits - price); // Deduct money\r\n\t\treceivedMessage.channel.send('Покупка успешна, новый баланс ' + (balanceUnits - price) + ' Юнитов!'); // Show it was successful\r\n\t\treceivedMessage.channel.send(await GetItemString(receivedMessage, item, false, true, true));\r\n\t}\r\n\telse // If not enough funds\r\n\t{\r\n\t\treceivedMessage.channel.send('Недостаточно средств, нужно на ' + (price - balanceUnits) + 'Ю больше!'); // Show there was not enough funds\r\n\t}\r\n}", "function gainMoney(amount) {\n\tmoney += amount;\n\tearned += amount;\n\ttotalEarned += amount;\n}", "function get_item(item) {\n money_count += item.price;\n return items[item.id];\n}", "function buyItem() {\n\n}", "buy(number) {\n if (ThievesGuild.gold >= this.cost) {\n this.incOwned(number);\n ThievesGuild.gold = ThievesGuild.gold - this.cost;\n document.getElementById(\"gold\").innerHTML = ThievesGuild.gold;\n this.cost = Math.floor(this.basecost * Math.pow(1.08, this.owned));\n ThievesGuild.drawn = 0;\n }\n }", "buyItem(item) {\n console.log(\"Buying Item:\", item.name);\n }", "buy() {\n this.amount --;\n this.price ++;\n }", "function buyItem(user){\n return user\n}", "transactionInspection(item, amount, player) {\n if (!player || !this.faction.isContraband(item, player))\n return true;\n // the relative level of severity of trading in this item\n const contraband = data_1.default.resources[item].contraband || 0;\n // FastMath.abs() is used because amount is negative when selling to market,\n // positive when buying from market. Fine is per unit of contraband.\n const fine = FastMath.abs(contraband * amount * this.inspectionFine(player));\n const rate = this.inspectionRate(player);\n for (let i = 0; i < contraband; ++i) {\n if (util.chance(rate)) {\n const totalFine = Math.min(player.money, fine);\n const csnFine = util.csn(totalFine);\n const csnAmt = util.csn(amount);\n // fine the player\n player.debit(totalFine);\n // decrease standing\n player.decStanding(this.faction.abbrev, contraband);\n // confiscate contraband\n let verb;\n if (amount < 0) {\n player.ship.cargo.set(item, 0);\n verb = 'selling';\n }\n else {\n this.stock.dec(item, amount);\n verb = 'buying';\n }\n // trigger notification\n const msg = `Busted! ${this.faction.abbrev} agents were tracking your movements and observed you ${verb} ${csnAmt} units of ${item}. `\n + `You have been fined ${csnFine} credits and your standing wtih this faction has decreased by ${contraband}.`;\n window.game.notify(msg, true);\n return false;\n }\n }\n return true;\n }", "function buyItem(guid) {\n print(\"Trying to buy item \" + guid);\n\n var inventory = getInventory(currentMerchant);\n\n for (var i = 0; i < inventory.length; ++i) {\n var item = inventory[i];\n if (item.id == guid) {\n // Pay for it and only if that succeeds, move it\n if (Party.money.getTotalCopper() < item.worth) {\n print(\"Player doesn't have enough money.\");\n return;\n }\n Party.money.addCopper(- item.worth);\n\n inventory.splice(i, 1); // Remove from container\n\n if (!currentPlayer.content)\n currentPlayer.content = [];\n\n currentPlayer.content.push(item);\n\n // Refresh the UI\n MerchantUi.refresh();\n\n return;\n }\n }\n\n print(\"Unknown item guid: \" + guid);\n }", "async function propTransfer() {\n let accounts = await web3.eth.getAccounts();\n let Twill = await contract.methods\n .transferWill(\n toowner,\n newTestatorName,\n newBeneficiary,\n newBeneficiaryAddress,\n newOwnerHomeAddress\n )\n .send({ from: accounts[0] });\n console.log(\"result====\", Twill);\n }", "function click_money_incrementation(money, _values) {\r\n data.inventory.money += money * data.inventory.multiplier;\r\n Save();\r\n Attribtion();\r\n update_dom();\r\n}", "moneyInSafe() {\n let money = this.bank.money;\n money += this.moneyOfPlayers;\n money += this.moneyInCustoms;\n return money;\n }", "function buyItem() {\n\taddArmor();\n\t$('#alerts').append(\"<br />An item has being bought<br />\");\n\tremoveMoneyI();\n}", "function buy (msg, name, amt){\n //check for invalid inputs\n if (amt <= 0){\n msg.reply(\"Error: Please enter a number greater than zero.\");\n return;\n }\n\n //get list of currencies\n getList(msg).then((data) => {\n\n //holds price of desired currency\n var price;\n //holds the final total of desired currency\n var total;\n //get current market price of coin per dollar\n switch(name){\n case 'btc':\n price = amt * data.BTC.USD;\n break;\n case 'eth':\n price = amt * data.ETH.USD;\n break;\n case 'etc':\n price = amt * data.ETC.USD;\n break;\n case 'doge':\n price = amt * data.DOGE.USD;\n break;\n //if currency not found\n default:\n msg.channel.send(\"Error: Currency not found\");\n return;\n break;\n } //end switch\n //round purchase amt\n var price = Math.round(price*100)/100\n //make sure player has enough money\n if (price > player[msg.member.id].money){\n msg.reply(\"Error: Not enough money :\\(\");\n return;\n }\n\n //take the money\n player[msg.member.id].money = player[msg.member.id].money - price\n //add the appropriate coin\n switch(name){\n case 'btc':\n player[msg.member.id].btc = player[msg.member.id].btc + amt;\n total = player[msg.member.id].btc;\n break;\n case 'eth':\n player[msg.member.id].eth = player[msg.member.id].eth + amt;\n total = player[msg.member.id].eth;\n break;\n case 'etc':\n player[msg.member.id].etc = player[msg.member.id].etc + amt;\n total = [msg.member.id].etc;\n break;\n case 'doge':\n player[msg.member.id].doge = player[msg.member.id].doge + amt;\n total = player[msg.member.id].doge;\n break;\n //if currency not found\n default:\n msg.channel.send(\"Error: Currency not found\");\n return;\n break;\n }\n //update the JSON file\n fs.writeFile(\"./src/players.json\", JSON.stringify(player), (err)=> {\n if (err) console.log(err);\n });\n\n //success message\n msg.reply(\"Congratulations! You have bought \" + amt + \" \" + name + \" for a total of $\" + price + \"\\nCurrent total: \" + total + \"\\nMoney: $\" + player[msg.member.id].money);\n });\n}" ]
[ "0.7070466", "0.6346074", "0.6200739", "0.6120404", "0.6072922", "0.6057651", "0.6030295", "0.6030295", "0.6030295", "0.6030295", "0.6030295", "0.6030295", "0.60043234", "0.59226453", "0.58981985", "0.5893371", "0.586702", "0.58419544", "0.58244896", "0.58140206", "0.58131313", "0.58065593", "0.57838166", "0.5783308", "0.5733763", "0.57320696", "0.57282305", "0.5719533", "0.5711769", "0.5708697" ]
0.70928687
0
Item owner gets money. Item destroyed
function sell_item_destroy(item, cost_adjustment) { //U.pluck(item._2o.container()._2m.items(), item); return $q.all([ change_gold(item._2o.container(), item.cost*cost_adjustment), Oit.destroy_item(item) ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onClick() {\n // Remove a bushel\n this.quantity -= 1;\n\n // Give the player money depending on the STATE.cashPerCrop variable\n STATE.resources.money += STATE.cashPerCrop;\n\n // Check if any bushels remain.\n // If not, destroy this wheat and\n // let the player know\n if (this.quantity <= 0) {\n this.destroy();\n showMessage('You lost some wheat!')\n }\n }", "deleteItem(item){\n delete this.inventory[item];\n }", "releaseItem(item) {}", "function refundItem() {}", "resetMoney() {\n\t\tthis._money = 0;\n\t\tResetPlayerMoney(this.id);\n\t}", "function DropItem(itemId: int) {\n\t\tinventoryItemCount--;\n\t\n\t}", "removeInventory(item) {\n this.inventory.deleteItem(item.id);\n item.owner = undefined;\n return this;\n }", "deleteItem() {\n this.view.removeFromParentWithTransition(\"remove\", 400);\n if (this.item != null) {\n this.itemDao.deleteById(this.item.getId());\n }\n }", "function destroyItem(slot) {\ninvSlots[inventory[slot][1]].destroy();\ninventory[slot][0] = 0;\ninventory[slot][1] = 0;\ngameState.itemClicked = '';\n}", "function money() {\n new Vivus('money', {\n duration: 250,\n animTimingFunction: Vivus.EASEOUT,\n type: 'oneByOne'\n });\n }", "function destroyBlock(){\n itemId = Player.getCarriedItem()\n if(itemId == 284 || itemId == 285 || itemId == 286 || itemId == 269 || itemId == 270 || itemId == 271 || itemId == 273 || itemId == 274 || itemId == 275 || itemId == 256 || itemId == 257 || itemId == 258 || itemId == 277 || itemId == 278 || itemId == 279 ){\n addRandomDamage()\n }\n if(itemId == 283 || itemId == 268 || itemId == 272 || itemId == 267 || itemId == 276){\n addRandomDamage()\n addRandomDamage()\n }\n}", "giveItem(itemName, recipient) {\n if (!this.inventory.inventoryHasItem(itemName)) return false;\n const item = this.inventory.removeItem(itemName);\n recipient.takeItem(item);\n return true;\n }", "removeItem(item) {\n this.props.removeItem(this.props.partyId, item._id);\n }", "drop(currentPlayer, itemName, channel){\n let item = this.utils.resolveNamable(itemName, currentPlayer.inventory.items)\n if(item){\n currentPlayer.inventory.items = currentPlayer.inventory.items.filter(\n currentItem => currentItem !== item)\n this.maps[currentPlayer.position].userItems.push(item)\n let forDeletion = getPasses(item)\n currentPlayer.passes = currentPlayer.passes.filter(instance => {\n return !forDeletion.includes(instance)\n })\n\n channel.send(`Item ${item.name.name} dropped.`).catch(err => {console.error(err);})\n this.utils.saveUniverse(this)\n }\n }", "function purchaseItem() {}", "function purchaseItem() {}", "function purchaseItem() {}", "function purchaseItem() {}", "function purchaseItem() {}", "function purchaseItem() {}", "function removeMoneyI() {\n\tmoney-=100;\n\t$('#money').html(money);\n\t$('#alerts').append(\"<br />You bought Armor <br />\");\n}", "takeout(item) {\n var index = this.item.indexOf(item);\n if (this.open = true && index > -1) {\n this.item.splice(index, 1);\n alert(\"Item has been removed from the backpack.\");\n }\n }", "function onitemremove (data) {\n\tvar removeItem; \n\tremoveItem = finditembyid(data.id);\n\n\tif (!removeItem) {\n\t\treturn;\n\t}\n\n\tland.splice(land.indexOf(removeItem), 1); \n\t\n\t//destroy the phaser object \n\tremoveItem.item.destroy(true, false);\n}", "function buyItem() {\n\taddArmor();\n\t$('#alerts').append(\"<br />An item has being bought<br />\");\n\tremoveMoneyI();\n}", "function deleteItem() {\n inventory[clickedEventId] = {};\n player[clickedEventId] = {};\n document.getElementById(clickedEventId).style.backgroundImage = \"none\";\n updateUI();\n updateInventory();\n updateEquipment();\n}", "function purchaseItem() {\n return\n}", "function DestroyCoin()\n{\n\tDestroy (gameObject);\n}", "function itemHandler(player, item) {\n item.kill();\n currentScore = currentScore + 10;\n if (currentScore === winningScore) {\n createBadge();\n }\n}", "survivorDamage(dmg) {\n console.log(\"Survivor taking damage = \" + dmg);\n //Deduct health.\n this.currPlayerHealth -= dmg;\n\n }", "takeDamage(damage, index, user) {\n //Deal damage and check if hp of item\n // is 0 if so, remove from array\n this.array[index].hp -= damage;\n if(this.array[index].hp <= 0){\n this.remove(index);\n user.scoreUpdate(400);\n }\n }" ]
[ "0.63991505", "0.60630536", "0.60042256", "0.598459", "0.59381306", "0.5932423", "0.5908321", "0.5883736", "0.5836178", "0.5832816", "0.58318627", "0.58135724", "0.5797597", "0.5789406", "0.57611763", "0.57611763", "0.57611763", "0.57611763", "0.57611763", "0.57611763", "0.57564837", "0.5748568", "0.5744501", "0.5695927", "0.56648153", "0.5660914", "0.565727", "0.56496215", "0.5638502", "0.56204945" ]
0.6786365
0
\to_cont gets money and item
function buy_item(to_cont, item, cost_adjustment) { return $q.all([ change_gold(to_cont, -1*(item.cost*cost_adjustment)), put_item(to_cont, item) ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _recordMoney(rest, item) {\n rest.foodCost += 5\n rest.revenue += floorToCents(item.price)\n}", "function get_item(item) {\n money_count += item.price;\n return items[item.id];\n}", "function convertMoney(money) {\n return `$ ${money.toFixed(2).toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")}`\n}", "loadAmount() {\n const { item } = this.state;\n if (item.price !== undefined) {\n var num_parts = item.price.amount.toString().split(\".\");\n num_parts[0] = num_parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, \".\");\n return num_parts.join(\".\");\n }\n }", "function money() {\n new Vivus('money', {\n duration: 250,\n animTimingFunction: Vivus.EASEOUT,\n type: 'oneByOne'\n });\n }", "function makeItCurrency(myNumber) {\r\n var myFormat = formati.getCurrencyFormatter({currency: \"AUD\"});\r\n var newCur = myFormat.format({\r\n number: myNumber\r\n });\r\n return newCur;\r\n }", "function convertTotal(money){\n input = money.toString();\n var test = input.split(\"\");\n if (input.match(/\\./) !== null) {\n var part2;\n for (var i = 0; i < test.length; i++) {\n if (test[i] == \".\") {\n part2 = test.slice(i, i+3);\n test = test.slice(0, i);\n break;\n }\n };\n }\n if (test.length > 3) {\n for (var i = test.length - 3; i > 0; i = i - 3) {\n test.splice(i, 0, \",\");\n };\n }\n if (part2) {\n test = test.concat(part2);\n }\n input = test.join(\"\");\n return '$' + input;\n }", "convert() {\n return `${(this.payments.type.price[this.currencyType] / 100)}`;\n }", "function sell_item_transfer(to_cont, item, cost_adjustment) {\n return $q.all([\n change_gold(item._2o.container(), item.cost*cost_adjustment),\n put_item(to_cont, item)\n ]);\n }", "amt_of(item) { }", "function saveInList(item){\n let myAmount = item.getText().replace(/USD|,/gi,\"\")\n if (myAmount.substring(0,1) === '-'){\n listAmounts.push(parseInt('-'+myAmount.substring(2)))\n }\n else{listAmounts.push(parseFloat(myAmount.substring(2)))} \n }", "function conToDeciPreInf(){\n player.money = new Decimal(player.money)\n player.tickSpeedCost = new Decimal(player.tickSpeedCost)\n player.tickspeed = new Decimal(player.tickspeed)\n player.firstAmount = new Decimal(player.firstAmount)\n player.secondAmount = new Decimal(player.secondAmount)\n player.thirdAmount = new Decimal(player.thirdAmount)\n player.fourthAmount = new Decimal(player.fourthAmount)\n player.fifthAmount = new Decimal(player.fifthAmount)\n player.sixthAmount = new Decimal(player.sixthAmount)\n player.seventhAmount = new Decimal(player.seventhAmount)\n player.eightAmount = new Decimal(player.eightAmount)\n player.firstCost = new Decimal(player.firstCost)\n player.secondCost = new Decimal(player.secondCost)\n player.thirdCost = new Decimal(player.thirdCost)\n player.fourthCost = new Decimal(player.fourthCost)\n player.fifthCost = new Decimal(player.fifthCost)\n player.sixthCost = new Decimal(player.sixthCost)\n player.seventhCost = new Decimal(player.seventhCost)\n player.eightCost = new Decimal(player.eightCost)\n player.sacrificed = new Decimal(player.sacrificed)\n player.totalmoney = new Decimal(player.totalmoney)\n}", "getMoney(){\n return 2000;\n }", "function double_money(){\n arr.forEach(y=>{\n y.wealth=y.wealth.replace(',','')\n y.wealth=y.wealth.replace('$','')\n })\n arr.forEach(x=>{\n x.wealth='$'+(parseInt(x.wealth)*2).toString()+'.00';\n })\n }", "function money(total) {\n let cenT = total * 100\n let re = cenT % val.dollar\n let dollar = cenT - re\n return dollar\n}", "function calcularPrecioItem(item){\n return item.producto.precioProducto * item.cantidad;\n}", "function toCurrency(){\n\n}", "getAmounts() {\n let amountsInEnglish = '';\n\n this.result.forEach( function(amount, money) {\n amountsInEnglish += `<p>${amount} ${counter.convertToEnglish(money)}</p>`;\n });\n\n return amountsInEnglish;\n }", "function getMoney() {\n\t$('entries').apend('<tr><th></th><thd>') + total + '</td></tr>'();\n}", "function Item(title,\n price_per_kle,\n kle,\n unit_price,\n unit_volume,\n amount)\n{\n return {\n title: title,\n price_per_kle: price_per_kle,\n kle: kle,\n unit_price: unit_price,\n unit_volume: unit_volume,\n amount: amount\n };\n}", "convertToString() {\n return \"#\" + this.id + \" -- \" + this.type + \" -- \" + this.note + \" -- $\" + this.amount;\n }", "function FormatCurrencies(information) {\r\n var result = \"<p> Currencies: \";\r\n for (var i = 0; i < information.currencies.length; i++) {\r\n result += information.currencies[i].name + \" (\" + information.currencies[i].symbol + \")\";\r\n if (i + 1 < information.currencies.length)\r\n result += \", \";\r\n }\r\n result += \"</p>\";\r\n return result;\r\n}", "function numberOfItemsBasedOnCashAmount(itemPrice,money) {\n\tvar quotient = Math.floor(money/itemPrice);\n\tvar remainder = money%itemPrice;\n\tvar temp = quotient*remainder;\n\tif (isNaN(remainder)) {\n\t\talert(\"You should type only numbers!\")\n\t} else {\n\t\treturn (\"You will purchase \" + quotient + \" items, and you will have \" + remainder + \" change left.\");\n\t\t}\t\n}", "function formatPoolItem (number) {\n\t\treturn parseFloat(number.toFixed(2));\n\t}", "function format(item) {\n if (item < 10) {\n return (item = `0${item}`);\n }\n return item;\n }", "function convertToCurrency(num) {\n return \"AUD \" + num.toFixed(2);\n}", "function Bill(props) {\n /*let ans = '';\n for (let i in userCart) {\n ans += `${userCart[i]}: ${calculator(userCart[i])}+`\n }\n return ans;*/\n const items = props.items;\n return items.map( (item, index) =>\n <div key={index}>\n <h1>{item}: {products[item].price}</h1>\n {products[item].coupon !== '' ? <h5>{products[item].coupon}</h5> : ''}\n <p>current total price = {calculator(item)}</p>\n </div>\n );\n\n// return listItems;\n}", "function money(todo) {\n\tconsole.log(\"$$$$ \" + todo + \" $$$$\");\n}", "function returnChange (money) {\n\n// use MOD it gives you the remainer\n\n var change = {\n twenties : 0,\n tens : 0,\n fives : 0,\n ones : 0,\n quarters : 0,\n dimes : 0,\n nickels : 0,\n pennies : 0\n };\n var moneyAfter = {\n div : 0,\n rem : 0\n };\n var changeKind = [2000, 1000, 500, 100, 25, 10, 5, 1];\n var lookup = {\n twenties : 2000,\n tens : 1000,\n fives : 500,\n ones : 100,\n quarters : 25,\n dimes : 10,\n nickels : 5,\n pennies : 1\n };\n\n moneyAfter.rem = money*100; // get into no decimal cents\n\n// moneyAfter = domination(money, 2000);\n// change.twenties = moneyAfter.div;\n// moneyAfter = domination(moneyAfter.rem, 1000);\n// change.tens = moneyAfter.div;\n\n for (var units in lookup) {\n moneyAfter = domination(moneyAfter.rem, lookup[units]);\n change[units] = moneyAfter.div;\n }\n\n return change;\n\n}", "valueOf() {\n return this.money;\n }" ]
[ "0.6196287", "0.6105152", "0.5942234", "0.5917596", "0.58974034", "0.582925", "0.5816826", "0.5787249", "0.5771156", "0.57099897", "0.5675126", "0.5673713", "0.5654836", "0.56474245", "0.5618255", "0.55915976", "0.5585326", "0.5561582", "0.5555752", "0.5553342", "0.55374587", "0.54973215", "0.5496985", "0.5492785", "0.5473568", "0.5467959", "0.5466863", "0.54597825", "0.5451721", "0.5435551" ]
0.6338091
0
============================== | Picker state functions | ============================== For coach
setPickerValue(newValue) { this.setState({ pickerSelection: newValue }); this.togglePicker(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Picker( ){}", "checkPickingState() {\n return false;\n }", "settingPickerTypeSelChange(params){\n this.setState({\n pickerType: params.target.value\n })\n }", "dropDownCompnent() {\n return (\n <Picker\n selectedValue={this.state.selectedValueFromPicker}\n style={{height: 100, width: '100%'}}\n onValueChange={(itemValue, itemIndex) => {\n let gridData = [];\n for (let index = 1; index <= itemValue * itemValue; index++) {\n const gridValue = {\n key: index,\n value: `${index}`,\n isSelected: false,\n isMemorized: false,\n };\n gridData.push(gridValue);\n }\n\n this.setState({\n gridData,\n selectedValueFromPicker: itemValue,\n isButtonVisible: true,\n });\n }}>\n {this.pickerList(this.state.pickerData)}\n </Picker>\n );\n }", "setPickerValue(newValue) {\n this.setState({\n pickerSelectionCourse: newValue\n })\n }", "setPickUp(value) {\n this.setState({ pickup: value });\n }", "_setOptions(){this.set(\"options\",this._getPickerOptions(data,this.allowNull,this.icon))}", "selectColor(e) {\n e.preventDefault();\n if (!this.state.pickerOpen) {\n document.querySelector(\".picker\").style.display = \"block\";\n this.setState({\n pickerOpen: true,\n selectColorTxt: \"Confirm Color\"\n });\n } else {\n document.querySelector(\".picker\").style.display = \"none\";\n this.setState({\n pickerOpen: false,\n selectColorTxt: \"Select Color\"\n });\n }\n \n }", "changePicker(picker, oldPicker) {\n var _picker2;\n\n const me = this,\n pickerWidth = me.pickerWidth || ((_picker2 = picker) === null || _picker2 === void 0 ? void 0 : _picker2.width);\n picker = Combo.reconfigure(oldPicker, picker ? Objects.merge({\n owner: me,\n store: me.store,\n selected: me.valueCollection,\n multiSelect: me.multiSelect,\n cls: me.listCls,\n itemTpl: me.listItemTpl || (item => item[me.displayField]),\n forElement: me[me.pickerAlignElement],\n align: {\n matchSize: pickerWidth == null,\n anchor: me.overlayAnchor,\n target: me[me.pickerAlignElement]\n },\n width: pickerWidth,\n navigator: {\n keyEventTarget: me.input\n }\n }, picker) : null, me);\n picker && (picker.element.dataset.emptyText = me.emptyText || me.L('L{noResults}'));\n return picker;\n }", "handlePick(pickedPeopleReturnedFromPicker) {\n\t\tthis.setState({\n\t\t\tpickedPeople: pickedPeopleReturnedFromPicker,\n\t\t});\n\t\tthis.props.setSelectedPersonasFromPeoplePickerData(pickedPeopleReturnedFromPicker);\n\t}", "onCountryPick(code) {\n this.setState({ country_code: code})\n }", "setFaction(event) {\n this.setState({pickedFaction: event.target.value})\n }", "hofHandleShowPicker(value){\n\tconst TS = this;\n\treturn function(){\n\t TS.setState({\n\t\tpickerActive: value\n\t });\n\t};\n }", "_showDateTimePickerFrom() { this.setState({...this.state, isDateTimePickerFromVisible: true }) }", "get picker() {\n if (!this._picker) {\n this.picker = true;\n }\n return this._picker;\n }", "showPicker(focusPicker) {\n this.picker.value = this.picker.activeDate = this.value;\n super.showPicker(focusPicker);\n }", "showPicker(focusPicker) {\n this.picker.value = this.picker.activeDate = this.value;\n super.showPicker(focusPicker);\n }", "showPicker(focusPicker) {\n const me = this,\n picker = me.picker;\n picker.initialValue = me.value;\n picker.format = me.format;\n picker.maxTime = me.max;\n picker.minTime = me.min; // Show valid time from picker while editor has undefined value\n\n me.value = picker.value;\n super.showPicker(focusPicker);\n }", "function initPicker() {\n //so not selected when started\n $(\"select\").prop(\"selectedIndex\", -1);\n\n $(\"select\").imagepicker({\n hide_select : true,\n show_label : true\n })\n }", "function selectPickers()\n\t{\n\t\tselectPicker.locations('.location-0', \"\", \"\", 0, 'location_text');\n\t\tselectPicker.industries('.industry-0', \"\", \"\", 0, 'industry_text');\n\t\tselectPicker.currencies('.currency-0', \"\", \"\", 0, 'currency_text');\n\t}", "gpSelected(info, e, doctor, date, time) {\r\n this.setState({gp: info})\r\n this.setState({bookingStep: e})\r\n this.setState({doctor: doctor})\r\n this.setState({date: date})\r\n this.setState({time: time})\r\n }", "_onChangeState() {\n\n\n }", "selectComic(value) {\n this.setState({ selectedComic: value });\n }", "onChangeaAvailability(e){\n this.setState({\n availability: e.target.value\n }\n )\n }", "changePicker(picker, oldPicker) {\n const me = this;\n return TimeField.reconfigure(oldPicker, picker ? Objects.merge({\n owner: me,\n forElement: me[me.pickerAlignElement],\n align: {\n anchor: me.overlayAnchor,\n target: me[me.pickerAlignElement]\n },\n value: me.value,\n format: me.format,\n\n onTimeChange({\n time\n }) {\n me._isUserAction = true;\n me.value = time;\n me._isUserAction = false;\n }\n\n }, picker) : null, me);\n }", "selectCard2(e) {\n if (this.state.time.s > 0 && this.state.isIdle === false) {\n this.setState({\n prevCard: e,\n p1Select: e})\n }\n }", "selectCard(e) {\n if (this.state.time.s > 0 && this.state.isIdle === false) {\n this.setState({\n prevCard: '',\n p1Select: e})\n }\n }", "handleDriverStartSeasonChange(e) {\n this.setState({\n driverStartSeason: e.target.value\n });\n }", "showPicker(focusPicker) {\n const me = this,\n picker = me.picker;\n\n picker.initialValue = me.value;\n picker.format = me.format;\n picker.maxTime = me.max;\n picker.minTime = me.min;\n\n // Show valid time from picker while editor has undefined value\n me.value = picker.value;\n\n super.showPicker(focusPicker);\n }", "function setChoosingStateOn() {\n\t\tplayerIsChoosing = true;\n\t}" ]
[ "0.7216407", "0.68951535", "0.6845155", "0.66380024", "0.6548477", "0.65253407", "0.6477068", "0.63730913", "0.62361926", "0.6196419", "0.60491556", "0.6031117", "0.60304826", "0.6018748", "0.5975368", "0.5966839", "0.5966839", "0.5962316", "0.595822", "0.59511197", "0.5935624", "0.5915504", "0.5891306", "0.5881383", "0.5874282", "0.5866629", "0.5862027", "0.5838457", "0.5816255", "0.58158886" ]
0.6951598
1
push "current" into "data" for the number oh hours that separate "from" to "to"
function pushData(from, to) { let curr = new Date(from.getTime()); const color = current > rooms[roomNumber].peopleLimitNumber ? stdColor['alert'] : current >= rooms[roomNumber].peopleLimitNumber * 0.7 ? stdColor['warning'] : stdColor['normal']; do { data.push(current); labels.push(curr.toLocaleString()); colors.push(color); curr = curr.add("1h"); } while(curr.getTime() < to.getTime()); return to; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function appendTimeData(data) {\n let startTime = moment(new Date().setHours(9, 30, 0, 0))\n let endTime = moment(new Date().setHours(15, 0, 0, 0))\n let middleClose = moment(new Date().setHours(11, 30, 0, 0))\n let middleOpen = moment(new Date().setHours(13, 0, 0, 0))\n let dataLastTime = moment(data[data.length - 1].x)\n\n while (dataLastTime < endTime) {\n dataLastTime.add(1, 'm')\n\n if (dataLastTime >= middleClose && dataLastTime < middleOpen) {\n dataLastTime = middleOpen\n data.push({\n x: dataLastTime.valueOf(),\n })\n } else {\n data.push({\n x: dataLastTime.valueOf(),\n })\n }\n }\n}", "function StoreTimeHoursinArray() {\n //Store time business hours past from current time ()\n for (let i = 1; i <= 24; i++) { // iterator i will iterate until i gets to 24 Hours past from current time\n currentT = moment().subtract(i, \"hours\");\n pastHoursFromCurrentMoment.unshift(currentT);\n }\n //Store current time in the future business hours array position[0]\n futureHoursFromCurrentMoment.push(moment());\n\n //Store future bussiness hours from current time in the array\n for (let j = 1; j <= 24; j++) { //iterator j will iterate 24 times which a representation of the hours from current time to future of hours remaining\n currentT = moment().add(j, \"hours\");\n futureHoursFromCurrentMoment.push(currentT);\n }\n\n }", "numbersToEvents() {\n for (let [key, value] of this.unoccupied) {\n let z = {summary: 'Zzzzz', start: {}, end: {}}\n z.start.dateTime = moment().set('hour', key).format()\n z.end.dateTime = moment()\n .set('hour', key + value)\n .format()\n this.sleepOptions.push(z)\n }\n\n return this.sleepOptions.slice(0, 3)\n }", "formatHourData(state, startDateStringWeek, endDateStringWeek) {\n //replace hyphens in date string with slashes b/c javascript Date object requires this (weird)\n var startDateString = startDateStringWeek;\n var endDateString = endDateStringWeek;\n //Convert time range to JS Date objects\n var startDate = new Date(startDateString.replace(/-/g, '/'));\n var endDate = new Date(endDateString.replace(/-/g, '/'));\n var dateToCompare = startDate;\n var currEntryDate;\n var currHour;\n var currIdx = 0;\n var byHourJson = state;\n //!!!Set the Key's range of operating hours here!!!!\n var hourArray = [\"14:00:00\", \"15:00:00\", \"16:00:00\", \"17:00:00\",\"18:00:00\",\"19:00:00\",\"20:00:00\",\"21:00:00\",\"22:00:00\"];\n //first filter out any entries that have timestamps outside of key operating hours\n byHourJson = byHourJson.filter(function(entry) {\n var inValidTimeRange = hourArray.includes(entry.time);\n return inValidTimeRange === true;\n });\n var hourToCompareIdx= 0;\n var hourToCompare = hourArray[0];\n //If JSON is empty, add in dummy entry to initialize formatting\n if(byHourJson.length === 0){\n var firstEntry = {\"date\": startDateString, \"time\": hourArray[0], \"count\": 0};\n byHourJson.push(firstEntry);\n }\n //Add dummy date entries for missing date-hour combos (no engagements) to json btwn start and end date\n while (this.compareTime(dateToCompare, endDate) === false) {\n //if reached the end of json but there's still dates to fill in up to the end date, stay on end entry\n if (currIdx > byHourJson.length - 1) {\n currIdx = byHourJson.length - 1;\n }\n currEntryDate = new Date(byHourJson[currIdx][\"date\"].replace(/-/g, '/'));\n currHour = byHourJson[currIdx][\"time\"];\n //identified missing date, so add dummy date entry for missing date\n if (this.sameDay(dateToCompare, currEntryDate) === false) {\n var dateEntryZeroEngagements = { \"date\": dateToCompare.toISOString().slice(0, 10), \"time\": hourToCompare, \"count\": 0 };\n //add entry in place if not at end of json OR final date entry has not been added yet/surpassed\n //else add to very end of json\n if (currIdx !== byHourJson.length - 1 || (this.compareTime(currEntryDate, dateToCompare))){\n byHourJson.splice(currIdx, 0, dateEntryZeroEngagements);\n } else {\n byHourJson.splice(currIdx+1,0, dateEntryZeroEngagements);\n }\n }\n //the two date-hour combos are on SAME DAY, but different hours so add the missing hour as a dummy entry\n else if(hourToCompare !== currHour){\n var dateEntryZeroEngagements = { \"date\": dateToCompare.toISOString().slice(0, 10), \"time\": hourToCompare, \"count\": 0 };\n //add entry in place if not at end of json OR final date entry has not been added yet/surpassed\n //else add to very end of json\n if (currIdx !== byHourJson.length - 1 || currHour > hourToCompare){\n byHourJson.splice(currIdx, 0, dateEntryZeroEngagements);\n } else {\n byHourJson.splice(currIdx+1,0, dateEntryZeroEngagements);\n }\n }\n //the two date-hour combos match exactly\n currIdx++;\n if(hourToCompare === hourArray[hourArray.length-1]){\n hourToCompare = \"next day\";\n }\n //on last hour of the current day, increment date and set hour to first hour\n if(hourToCompare === \"next day\"){\n dateToCompare.setDate(dateToCompare.getDate() + 1);\n hourToCompare = hourArray[0];\n hourToCompareIdx = 0;\n }\n //otherwise just increment the hour\n else{\n hourToCompareIdx++;\n hourToCompare = hourArray[hourToCompareIdx];\n }\n }\n //process json into list of lists and store into state for downloading as csv\n var byHourJsonForDownload = [];\n var entryAsList;\n for(var i=0; i<byHourJson.length; i++){\n entryAsList = Object.values(byHourJson[i]);\n byHourJsonForDownload.push(entryAsList);\n }\n\n //Time to convert updated JSON with missing date-hour combos added in into\n //a list called processedData of {\"x\": string hour of day, \"y\": string day of week, \"color\": int num engagements per day} objs\n var processedData = [];\n var dayOfWeek, hourEntry, hourOfDay;\n var currDateObj;\n var strDays = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\n for (var i = 0; i < byHourJson.length; i++) {\n currDateObj = new Date(byHourJson[i]['date'].replace(/-/g, '/'));\n dayOfWeek = strDays[currDateObj.getDay()];\n hourOfDay = byHourJson[i]['time'].slice(0,5);\n hourEntry = {\"x\": hourOfDay, \"y\": dayOfWeek, \"color\": byHourJson[i]['count']};\n processedData.push(hourEntry);\n }\n //Set state so these vars can be used elsewhere!\n this.setState(function (previousState, currentProps) {\n return {\n startDateStringWeek: startDateStringWeek,\n endDateStringWeek: endDateStringWeek,\n byHourJson: processedData,\n byHourJsonForDownload: byHourJsonForDownload\n };\n });\n return processedData;\n }", "function getAnotherHour() {\n\n\t// Add up the timer with 1 hour\n\ttoday.setHours(today.getHours() + 1);\n\n\tfor (var index = 0; index < goodData.length; index++) {\n\t\tif (goodData[index].date <= today) {\n\t\t\tdata.data.push(goodData[index]);\n\t\t}\n\t}\n\n\t//console.log(today);\n\tdocument.getElementById('timer').innerHTML = today;\n\n}", "function fillData(data, minTimestamp, maxTimestamp) {\n\t\tvar minTimestamp = minTimestamp * 1000;\n\t\tvar maxTimestamp = maxTimestamp * 1000;\n\t\tvar secondsInAnHour = 60 * 60 * 1000;\n\n\t\tvar remainder = minTimestamp % secondsInAnHour;\n\t\tvar minRoundedTimestamp = minTimestamp - remainder;\n\n\t\tvar remainder = maxTimestamp % secondsInAnHour;\n\t\tvar maxRoundedTimestamp = maxTimestamp - remainder;\n\n\t\tvar hoursToCreate = (maxRoundedTimestamp - minRoundedTimestamp) / secondsInAnHour;\n\n\t\tfor(i = 0; i < hoursToCreate; i++) {\n\t\t\tvar incrementTimestamp = minRoundedTimestamp + i * secondsInAnHour;\n\n\t\t\tdata.push({\n\t\t\t\tpcuihId: -1,\n\t\t\t\tpcuId: -1,\n\t\t\t\tunix_timestamp: incrementTimestamp,\n\t\t\t\tfilled_data: true\n\t\t\t});\n\t\t}\n\t}", "function reducer(total, current) {\n return total + current.hour;\n }", "function reducer(total, current) {\n return total + current.hour;\n }", "function cobaCollect() {\n var now = new Date();\n var anHourAgo = new Date(now.getTime() - (1 * 1000 * 60 * 60));\n var from = anHourAgo.getFullYear() + '-' + (anHourAgo.getMonth() + 1) + '-' + anHourAgo.getDate();\n from += ' ' + anHourAgo.getHours() + ':' + anHourAgo.getMinutes() + ':' + anHourAgo.getSeconds();\n var to = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate();\n to += ' ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();\n console.log('1 hour ago :', from, to);\n collectDataByDate(from, to);\n}", "function parseOpenWeather1Hour()\n{\n // anviser data til vejret nu\n {\n data.now.time[1] = importJson.openWeather1Hour.current.dt;\n data.now.symbol_code[1] = convertSymbolCode(importJson.openWeather1Hour.current.weather[0].description, data.now.isDay);\n data.now.temperature[1] = round((importJson.openWeather1Hour.current.temp - 273.15) * 10) / 10; // temperatur omdannes til celcius og afrundes til et decimal\n data.now.pressure[1] = importJson.openWeather1Hour.current.pressure;\n data.now.cloudCover[1] = importJson.openWeather1Hour.current.clouds;\n data.now.humidity[1] = importJson.openWeather1Hour.current.humidity;\n\n if (typeof importJson.openWeather1Hour.current.rain !== \"undefined\")\n {\n data.now.precipitation[1] = importJson.openWeather1Hour.current.rain[\"1h\"];\n }\n else\n {\n data.now.precipitation[1] = 0;\n }\n data.now.windSpeed[1] = importJson.openWeather1Hour.current.wind_speed;\n data.now.windDirection[1] = importJson.openWeather1Hour.current.wind_deg;\n }\n // anviser data til vejret 48 timer frem\n {\n for (let i = 0; i < 46; i++)\n {\n data.next48Hours[i].time[1] = importJson.openWeather1Hour.hourly[i].dt;\n data.next48Hours[i].symbol_code[1] = convertSymbolCode(importJson.openWeather1Hour.hourly[i].weather[0].description, data.next48Hours[i].isDay);\n data.next48Hours[i].temperature[1] = round((importJson.openWeather1Hour.hourly[i].temp - 273.15) * 10) / 10\n data.next48Hours[i].pressure[1] = importJson.openWeather1Hour.hourly[i].pressure;\n data.next48Hours[i].cloudCover[1] = importJson.openWeather1Hour.hourly[i].clouds;\n data.next48Hours[i].humidity[1] = importJson.openWeather1Hour.hourly[i].humidity;\n try\n {\n data.next48Hours[i].precipitation[1] = importJson.openWeather1Hour.hourly[i].rain[\"1h\"];\n }\n catch\n {\n data.next48Hours[i].precipitation[1] = 0;\n }\n data.next48Hours[i].windSpeed[1] = importJson.openWeather1Hour.hourly[i].wind_speed;\n data.next48Hours[i].windDirection[1] = importJson.openWeather1Hour.hourly[i].wind_deg;\n }\n }\n calculateAverages();\n}", "function getSliceBetweenTimes(data, from, to) {\n \n var fromIdx = _.sortedIndex(data, {t: from}, function(d) { return d.t; });\n var toIdx = _.sortedIndex(data, {t: to}, function(d) { return d.t; }); \n\n return data.slice(fromIdx, toIdx+1);\n }", "function getData(data, hours) {\n var days = Array.apply(null, Array(7)).map(function () {return 1;});\n // var hours = Array.apply(null, Array(24)).map(function () {return 1});\n var title = data[0];\n var filtered = data.slice(1, data.length).filter(function(row) {\n var d = parseInt(row[\"pickup_day\"]);\n var h = parseInt(row[\"pickup_hour\"]);\n return days[d] && hours[h];\n });\n\n var res = {};\n for (var i = 0; i < filtered.length; i++) {\n var row = filtered[i];\n var pickup_zone = row[\"pickup_zone\"];\n\n // this pickup zone already in res\n if (res[pickup_zone]) {\n // add dest count objects\n for (var prop in row) {\n if (row.hasOwnProperty(prop) && res[pickup_zone][prop] != undefined) {\n res[pickup_zone][prop] += parseInt(row[prop]);\n }\n else if (row.hasOwnProperty(prop) && res[pickup_zone][prop] == undefined) {\n console.log(prop);\n console.log(res[pickup_zone][prop]);\n console.log(\"ERROR should never get here\");\n }\n }\n }\n else {\n // add dest count objects\n res[pickup_zone] = {}\n for (var prop in row) {\n if (row.hasOwnProperty(prop)) {\n res[pickup_zone][prop] = parseInt(row[prop]);\n }\n }\n }\n }\n\n return res;\n}", "between(start, end){\n\n //Initialize our usage variable\n let total = 0;\n\n //Go through every hour between the times specified\n for(let i=start+1; i<=end; i++) {\n\n //If we have a record for this hour\n if(this.hours[i] !== undefined) {\n\n //Add the usage to our running total\n total += this.hours[i];\n }\n\n }\n\n //Return the total amount of power used during the specified time frame\n return total;\n }", "hourlyData(data) {\r\n const scope = this;\r\n let averageMean, hrData = [];\r\n\r\n data.forEach(v => {\r\n if(v.interval_start.includes(\":30:00\")){\r\n if(data.find(x => x.interval_start == v.interval_start.replace(\":30:00\", \":00:00\"))){\r\n averageMean =(v.mean + (data.find(x => x.interval_start == v.interval_start.replace(\":30:00\", \":00:00\"))).mean)/2;\r\n }else{\r\n averageMean = v.mean;\r\n }\r\n hrData.push({Time: v.interval_start.replace(\":30:00\", \":00:00\"), mean: averageMean});\r\n }else{\r\n if(!(data.find(x => x.interval_start == v.interval_start.replace(\":00:00\", \":30:00\")))){\r\n hrData.push({Time: v.interval_start, mean: v.mean});\r\n }\r\n }\r\n });\r\n\r\n return scope.finalData(hrData)\r\n }", "filterData(filter) {\r\n const scope = this,\r\n startDate = new Date(filter.dates.start),\r\n endDate = new Date(filter.dates.end),\r\n sTime = filter.time.start,\r\n eTime = filter.time.end;\r\n let filteredData = [], date, startTime, endTime;\r\n\r\n scope.tempData = [];\r\n startDate.setHours(0, 0, 0);\r\n endDate.setHours(23, 59, 59);\r\n\r\n sTime.meridian === \"AM\" ?\r\n (startTime = sTime.h * 60 + sTime.m) : (startTime = sTime.h * 60 + sTime.m + 720);\r\n eTime.meridian === \"AM\" ?\r\n (endTime = eTime.h * 60 + eTime.m) : (endTime = eTime.h * 60 + eTime.m + 720);\r\n\r\n scope.totalData.forEach(v => {\r\n date = new Date(v.interval_start);\r\n\r\n if(date.getTime() >= startDate.getTime() && endDate.getTime() >= date.getTime()){\r\n let selTime = date.getHours() * 60 + date.getMinutes();\r\n if(selTime >= startTime && endTime > selTime){\r\n filteredData.push(v)\r\n }\r\n }\r\n });\r\n\r\n for(let key = sTime.h; key <= (eTime.meridian === \"AM\" ? eTime.h : eTime.h + 12); key++){\r\n if(!(key === (eTime.meridian === \"AM\" ? eTime.h : eTime.h + 12) && eTime.m === 0))\r\n scope.tempData.push({time: key, occupancy: []})\r\n }\r\n\r\n return scope.hourlyData(filteredData)\r\n }", "function outdata() {\n var exp = [];\n var e11 = e - 11\n\n exp.push(globaldata[e11]['date'])\n exp.push(globaldata[e11]['hour'])\n exp.push(globaldata[e11]['minute'])\n\n return exp;\n}", "function vectorTimerHour(time, hourOn, hourOff, minOn, minOff){\n print('[vectorTimerHour] Build Hour vector timer ...');\n\n let hourOn = JSON.parse(hourOn);\n let hourOff = JSON.parse(hourOff);\n let minOn = JSON.parse(minOn);\n let minOff = JSON.parse(minOff);\n\n if (hourOff > hourOn){\n for(let i = 0; i < 24; i++){\n yHour[i] = 0;\n if (time[i] >= hourOn && time[i] < hourOff){\n yHour[i] = 1;\n }\n }\n }\n\n if (hourOn > hourOff){\n for(let i = 0; i < 24; i++){\n yHour[i] = 1;\n if (time[i] >= hourOff && time[i] < hourOn){\n yHour[i] = 0;\n }\n }\n }\n\n if (hourOn === hourOff){\n if (minOn > minOff){\n for(let i = 0; i < 24; i++){\n yHour[i] = 1;\n }\n yHour[hourOn] = 0;\n }\n\n if (minOff > minOn){\n for(let i = 0; i < 24; i++){\n yHour[i] = 0;\n }\n yHour[hourOn] = 1;\n }\n \n }\n\n return yHour\n}", "convertSchedulePref() {\n for (var key in this.state.dayTimePref) {\n /* reset all to empty */\n this.state.postReqTime[key] = [];\n // check if it's empty, empty -> 00:00 to 23:59\n if (this.state.dayTimePref[key].length == 0)\n {\n this.state.postReqTime[key].push({\n \"time_earliest\": \"00:00\",\n \"time_latest\": \"23:59\"\n });\n }\n else if (this.state.dayTimePref[key].length == 1)\n {\n var begin = this.state.dayTimePref[key][0];\n var end = this.state.dayTimePref[key][0] + 30;\n \n this.state.postReqTime[key].push({\n \"time_earliest\": this.convertTimeIntToString(begin),\n \"time_latest\": this.convertTimeIntToString(end)\n });\n }\n else {\n var begin = this.state.dayTimePref[key][0];\n for (var i = 1; i < this.state.dayTimePref[key].length; i++)\n {\n // if the time is not consecutive from previous\n console.log(\"prev: \", this.state.dayTimePref[key][i-1], \" current: \", this.state.dayTimePref[key][i]);\n if ((this.state.dayTimePref[key][i - 1] + 30) != (this.state.dayTimePref[key][i]))\n {\n this.state.postReqTime[key].push({\n \"time_earliest\": this.convertTimeIntToString(begin),\n \"time_latest\": this.convertTimeIntToString(this.state.dayTimePref[key][i - 1] + 30)\n });\n begin = this.state.dayTimePref[key][i];\n // if time is the end, and not consecutive from previous\n if (i == (this.state.dayTimePref[key].length - 1))\n {\n this.state.postReqTime[key].push({\n \"time_earliest\": this.convertTimeIntToString(begin),\n \"time_latest\": this.convertTimeIntToString(begin + 30)\n });\n }\n }\n // if time is consecutive, but last\n else if (i == (this.state.dayTimePref[key].length - 1))\n {\n this.state.postReqTime[key].push({\n \"time_earliest\": this.convertTimeIntToString(begin),\n \"time_latest\": this.convertTimeIntToString(this.state.dayTimePref[key][i] + 30)\n });\n }\n \n }\n }\n \n\n \n \n }\n }", "function putdata(json)\n{ \n // removes the previous contest entries.\n $(\"#upcoming > li\").remove();\n $(\"#ongoing > li\").remove();\n $(\"hr\").remove();\n\n // the conditional statements that compare the start and end time with curTime\n // verifies that each contest gets added to right section regardless of the \n // section it was present in the \"json\" variable.\n \n curTime = new Date();\n\n $.each(json.result.ongoing , function(i,post){ \n \n flag=0;\n if(post.Platform==\"HACKEREARTH\"){\n if(localStorage.getItem(post.Platform+post.challenge_type)==\"false\")flag=1;\n }\n \n if(localStorage.getItem(post.Platform)==\"true\" && flag==0){\n endTime = Date.parse(post.EndTime);\n timezonePerfectEndTime = changeTimezone(endTime).toString().slice(0,21);\n e = new Date(endTime);\n humanReadableEndTime = moment(timezonePerfectEndTime).fromNow();\n\n if(e>curTime){\n \n var node = document.createElement(\"li\");\n node.data = post.url;\n\n linebreak = document.createElement(\"br\");\n var nameText = document.createTextNode(post.Name);\n var nameNode = document.createElement(\"h4\");\n nameNode.appendChild(nameText);\n \n var imageNode = document.createElement(\"img\");\n imageNode.src = icon(post.Platform);\n \n var endTimeText = document.createTextNode('End: '+timezonePerfectEndTime+ ' ( '+humanReadableEndTime+' )');\n var endTimeNode = document.createElement(\"h5\");\n endTimeNode.appendChild(endTimeText);\n\n node.appendChild(document.createElement(\"br\"));\n node.appendChild(nameNode);\n node.appendChild(imageNode);\n node.appendChild(document.createElement(\"br\"));\n node.appendChild(endTimeNode);\n node.appendChild(document.createElement(\"br\"));\n\n document.getElementById(\"ongoing\").appendChild(node);\n document.getElementById(\"ongoing\").appendChild(document.createElement(\"hr\"));\n\n }\n }\n });\n \n $.each(json.result.upcoming , function(i,post){ \n \n flag=0;\n if(post.Platform==\"HACKEREARTH\"){\n if(localStorage.getItem(post.Platform+post.challenge_type)==\"false\")flag=1;\n }\n\n if(localStorage.getItem(post.Platform)==\"true\" && flag==0){\n // converts the startTime and Endtime revieved\n // to the format required for the Google Calendar link to work\n startTime = Date.parse(post.StartTime)\n timezonePerfectStartTime = changeTimezone(startTime).toString().slice(0,21);\n humanReadableStartTime = moment(timezonePerfectStartTime).fromNow();\n\n endTime = Date.parse(post.EndTime)\n timezonePerfectEndTime = changeTimezone(endTime).toString().slice(0,21);\n humanReadableEndTime = moment(timezonePerfectEndTime).fromNow();\n s = new Date(changeTimezone(startTime).getTime() - ((curTime).getTimezoneOffset()*60000 )).toISOString().slice(0,19).replace(/-/g,\"\").replace(/:/g,\"\");\n e = new Date(changeTimezone(endTime).getTime() - ((curTime).getTimezoneOffset()*60000 )).toISOString().slice(0,19).replace(/-/g,\"\").replace(/:/g,\"\");\n \n calendarTime = s+'/'+e\n calendarLink = \"https://www.google.com/calendar/render?action=TEMPLATE&text=\"+encodeURIComponent(post.Name)+\"&dates=\"+calendarTime+\"&location=\"+post.url+\"&pli=1&uid=&sf=true&output=xml#eventpage_6\"\n \n sT = new Date(startTime);\n eT = new Date(endTime);\n\n if(sT<curTime && eT>curTime){\n var node = document.createElement(\"li\");\n node.data = post.url;\n\n linebreak = document.createElement(\"br\");\n var nameText = document.createTextNode(post.Name);\n var nameNode = document.createElement(\"h4\");\n nameNode.appendChild(nameText);\n \n var imageNode = document.createElement(\"img\");\n imageNode.src = icon(post.Platform);\n \n var endTimeText = document.createTextNode('End: '+timezonePerfectEndTime+ ' ( '+humanReadableEndTime+' )');\n var endTimeNode = document.createElement(\"h5\");\n endTimeNode.appendChild(endTimeText);\n\n node.appendChild(document.createElement(\"br\"));\n node.appendChild(nameNode);\n node.appendChild(imageNode);\n node.appendChild(document.createElement(\"br\"));\n node.appendChild(endTimeNode);\n node.appendChild(document.createElement(\"br\"));\n\n document.getElementById(\"ongoing\").appendChild(node);\n document.getElementById(\"ongoing\").appendChild(document.createElement(\"hr\"));\n\n }\n else if(sT>curTime && eT>curTime){\n\n var node = document.createElement(\"li\");\n node.data = post.url;\n\n linebreak = document.createElement(\"br\");\n var nameText = document.createTextNode(post.Name);\n var nameNode = document.createElement(\"h4\");\n nameNode.appendChild(nameText);\n \n var imageNode = document.createElement(\"img\");\n imageNode.src = icon(post.Platform);\n \n var startTimeText = document.createTextNode('Start: '+timezonePerfectStartTime+ ' ( '+humanReadableStartTime+' )');\n var startTimeNode = document.createElement(\"h5\");\n startTimeNode.appendChild(startTimeText);\n\n var durationText = document.createTextNode('Duration: '+post.Duration);\n var durationNode = document.createElement(\"h5\");\n durationNode.appendChild(durationText);\n \n var calendarText = document.createTextNode('Add to Calendar');\n var calendarNode = document.createElement(\"h5\");\n calendarNode.className = \"calendar\";\n calendarNode.appendChild(calendarText);\n calendarNode.data = calendarLink;\n \n node.appendChild(document.createElement(\"br\"));\n node.appendChild(nameNode);\n node.appendChild(imageNode);\n node.appendChild(document.createElement(\"br\"));\n node.appendChild(startTimeNode);\n node.appendChild(document.createElement(\"br\"));\n node.appendChild(durationNode);\n node.appendChild(document.createElement(\"br\"));\n node.appendChild(calendarNode);\n\n document.getElementById(\"upcoming\").appendChild(node);\n document.getElementById(\"upcoming\").appendChild(document.createElement(\"hr\"));\n\n }\n }\n });\n\n}", "function turnHoursToMinutes(data){\n\n return data.slice(0).map(function(el){\n console.log\n let timeString = el.duration\n let splitString = timeString.split(' ')\n let timeHours = 0;\n let timeMinutes = 0;\n\n if(splitString.length==1){\n if(splitString[0].includes('h')){\n timeHours = splitString[0].replace('h', '') * 60\n }else if (splitString[0].includes('min')){\n timeMinutes = splitString[0].replace('min', '') * 1\n }\n }else{\n timeHours = splitString[0].replace('h', '') * 60\n timeMinutes = splitString[1].replace('min', '') * 1\n }\n \n let totalTimeMinutes = timeHours + timeMinutes\n return { duration: totalTimeMinutes }\n })\n}", "function OpenTimeSection(props) {\n // const { data: records } = props;\n if (props.data.length) {\n // const weekdays = records.reduce(\n // (days, record) => [...days, ...record.weekdays],\n // [],\n // );\n // const maxRange = records.reduce((range, record) => {\n // const recordRange = {\n // start: moment.utc(record.start).local(),\n // until: moment.utc(record.until).local(),\n // };\n // if (!range) {\n // return recordRange;\n // }\n // return {\n // start: early(range.start, recordRange.start),\n // until: late(range.until, recordRange.until),\n // };\n // }, undefined);\n const opentimes = props.data.reduce((init, current) => {\n if (\n init.length === 0 ||\n init[init.length - 1].weekdays.toString() !==\n current.weekdays.toString()\n ) {\n init.push({\n weekdays: current.weekdays,\n rangeTime: [{ start: current.start, until: current.until }],\n });\n } else if (\n init[init.length - 1].weekdays.toString() ===\n current.weekdays.toString()\n ) {\n init[init.length - 1].rangeTime.push({\n start: current.start,\n until: current.until,\n });\n }\n return init;\n }, []);\n\n // const renturnRange = (start, until) => {\n // const Range = {\n // start: moment.utc(start).local(),\n // until: moment.utc(until).local(),\n // };\n // return Range;\n // };\n\n // 合并星期数\n const weeks = opentimes\n .map((item) => item.weekdays)\n .reduce((acc, cur) => acc.concat(cur), []);\n // // 设置初始的星期数\n // const [timeIndex, setTimeIndex] = useState(Math.min(...weeks));\n // // 设置初始的大时间段\n // const [weekday, setWeekday] = useState(\n // opentimes.find((d) => d.weekdays.includes(timeIndex)).weekdays,\n // );\n\n const returnMinMaxRange = () => {\n const allStart = [];\n const allUntil = [];\n opentimes.forEach((opentime) => {\n opentime.rangeTime.forEach((range) => {\n allStart.push(moment(range.start));\n allUntil.push(moment(range.until));\n });\n });\n\n return {\n start: moment.min(allStart).local(),\n until: moment.max(allUntil).local(),\n };\n };\n\n const minMaxRange = returnMinMaxRange();\n return (\n <FtBlock\n title={\n <span className=\"padding_x_5\">\n <TranslatableMessage message={intlMessages.sectionTitle} />\n </span>\n }\n className=\"ViewOpenTime\"\n noPadding\n >\n <div className=\"padding_t_5\">\n <WeekdayWidget selected={weeks} />\n <div className=\"ViewOpenTime__rangeLabel\">\n {`${minMaxRange.start.format(\n 'HH:mm',\n )} -- ${minMaxRange.until.format('HH:mm')}`}\n </div>\n </div>\n\n {/* 多时段显示 */}\n {/* {opentimes.map((time, i) => (\n <div key={i} className=\"padding_t_5 ViewOpenTime__range\">\n <WeekdayWidget selected={time.weekdays} />\n {time.rangeTime.map((range, index) => (\n <div key={index} className=\"ViewOpenTime__rangeLabel\">\n {`${renturnRange(range.start, range.until).start.format(\n 'HH:mm',\n )} -- ${renturnRange(range.start, range.until).until.format(\n 'HH:mm',\n )}`}\n </div>\n ))}\n </div>\n ))} */}\n\n {/* 整合多时段显示 */}\n {/* <div className=\"ViewOpenTime__block\">\n {[...new Array(7)].map((_, i) => (\n <SvgIcon\n key={i}\n icon={`weekday-${i}`}\n className={classNames('ViewOpenTime__item', {\n 'is-selected': weeks && weeks.indexOf(i) > -1,\n 'is-show': weekday.includes(i),\n })}\n disabled={weeks && weeks.indexOf(i) === -1}\n onClick={() => {\n setTimeIndex(i);\n setWeekday(\n opentimes.find((d) => d.weekdays.includes(i)).weekdays,\n );\n }}\n />\n ))}\n </div>\n <div className=\"ViewOpenTime__range\">\n {opentimes.map(\n (item) =>\n item.weekdays.includes(timeIndex) && (\n <>\n {item.rangeTime.map((range, index) => (\n <div key={index} className=\"ViewOpenTime__rangeLabel\">\n {`${renturnRange(range.start, range.until).start.format(\n 'HH:mm',\n )} -- ${renturnRange(\n range.start,\n range.until,\n ).until.format('HH:mm')}`}\n </div>\n ))}\n </>\n ),\n )}\n </div> */}\n </FtBlock>\n );\n }\n return null;\n}", "buildObject() {\n // build array of objects (based on input arguments [start,end, interval])\n for (var i = 0; i < this.totalTimeSlots; i++) {\n // add blank object\n this.data.push({})\n // populate object\n this.data[i] = {\n description: '',\n slotStart: this.timeCalc(0,i),\n slotEnd: this.timeCalc(1,i),\n slotDuration: this.timeSlotDuration,\n get viewState() {\n let timeDiff = (() => moment().diff(this.slotStart, 'm'))()\n if (timeDiff < 0) return 'future';\n else if (timeDiff >= 0 && timeDiff < 60) return 'present';\n else return 'past';\n }\n }\n }\n }", "hydrateAvailableHours (start, end, workHours = {}) {\n const numHours = this.countHours(start, end);\n let availability = [];\n for (let i = 0; i < numHours; i++) {\n const availHour = moment(start).utcOffset('+0000').add(i, 'hours').format('YYYY-MM-DD HH:00:00');\n if (!_.isEmpty(workHours)) {\n const startHour = parseInt(moment(availHour).format('H'));\n if (startHour > workHours.start && startHour < workHours.stop) {\n availability.push(availHour); \n }\n } else {\n availability.push(availHour);\n }\n }\n\n return availability;\n }", "function pushDataChart3n4(une_station, id){\r\n// nettoyage des anciennes données s'il y en a\r\n data3.splice(0, data3.length);\r\n data4.splice(0, data4.length);\r\n _labels2.splice(0, _labels2.length);\r\n data3.length = 0;\r\n data4.length = 0;\r\n _labels2.length = 0; // par sécurité\r\n\r\nfor(let hour of une_station[id].hours){\r\n // les données ne maj pas en fonction du jour, il faut aller piocher à partir de datach\r\n data3.push(Math.round(hour.p)); // push des données graphiques, pluie\r\n data4.push(Math.round(hour.t/100)); // temp°\r\n _labels2.push(hour.h);\r\n}\r\n /*d.hours.forEach(hour => {\r\n \r\n });*/\r\n\r\n}", "function buildHourlyData(nextHour,hourlyTemps) {\n // Data comes from a JavaScript object of hourly temp name - value pairs\n // Next hour should have a value between 0-23\n // The hourlyTemps variable holds an array of temperatures\n // Line 8 builds a list item showing the time for the next hour \n // and then the first element (value in index 0) from the hourly temps array\n let hourlyListItems = '<li>' + format_time(nextHour) + ': ' + hourlyTemps[0] + '&deg;F | </li>';\n // Build the remaining list items using a for loop\n for (let i = 1, x = 12; i < x; i++) {\n hourlyListItems += '<li>' + format_time(nextHour+i) + ': ' + hourlyTemps[i] + '&deg;F | </li>';\n }\n console.log('HourlyList is: ' + hourlyListItems);\n return hourlyListItems;\n }", "function getHourly(locData) {\n const API_KEY = '2sw5vR3a2FasN7xaGtCVaKAG7adjboWt';\n const CITY_CODE = locData['key'];\n const URL = \"https://dataservice.accuweather.com/forecasts/v1/hourly/12hour/\" + CITY_CODE + \"?apikey=\" + API_KEY;\n fetch(URL)\n .then(response => response.json())\n .then(function (data) {\n console.log('Json object from getHourly function:');\n console.log(data); // See what we got back\n // Get the first hour in the returned data\n let date_obj = new Date(data[0].DateTime);\n let nextHour = date_obj.getHours(); // returns 0 to 23\n // Store into the object\n locData[\"nextHour\"] = nextHour;\n // Counter for the forecast hourly temps\n var i = 1;\n // Get the temps for the next 12 hours\n data.forEach(function (element) {\n let temp = element.Temperature.Value;\n let hour = 'hourTemp' + i;\n locData[hour] = temp; // Store hour and temp to object\n // New hiTemp variable, assign value from previous 12 hours\n let hiTemp = locData.pastHigh;\n // New lowTemp variable, assign value from previous 12 hours\n let lowTemp = locData.pastLow;\n // Check current forecast temp to see if it is \n // higher or lower than previous hi or low\n if (temp > hiTemp) {\n hiTemp = temp;\n } else if (temp < lowTemp) {\n lowTemp = temp;\n }\n // Replace stored low hi and low temps if they changed\n if (hiTemp != locData.pastHigh) {\n locData[\"pastHigh\"] = hiTemp; // When done, this is today's high temp\n }\n if (lowTemp != locData.pastLow) {\n locData[\"pastLow\"] = lowTemp; // When done, this is today's low temp\n }\n i++; // Increase the counter by 1\n }); // ends the foreach method\n console.log('Finished locData object and data:');\n console.log(locData);\n\n // Send data to buildPage function\n })\n .catch(error => console.log('There was an error: ', error))\n} // end getHourly function", "function newdata() {\n\n var date, hour\n\n date = globaldata[e]['date']\n hour = globaldata[e]['hour']\n\n // console.log(date, hour)\n\n return [date, hour];\n}", "function fetchIntervalData(from, to, fn){\r\n var obj = cloneObj(currentInterval);\r\n obj.format = 'interval';\r\n obj.from = from;\r\n obj.to = to;\r\n getDataFromServer(obj, function(err, data){\r\n if(err){\r\n return fn(null, null);\r\n }else{\r\n return fn(null, data);\r\n }\r\n })\r\n}", "ensureRightPoint(data) {\n const now = Moment().unix();\n const newest = _.last(data, \"t\");\n if (now - newest.t > 2) {\n data.push(Object.assign({}, newest, {t: now}));\n }\n }", "newSchedule() {\n const\n startHour = 9,\n endHour = 17;\n \n let\n currentHour = startHour,\n schedule = {\n date: moment().format(\"YYYY-MM-DD\"),\n events: []\n };\n \n while (currentHour <= endHour) {\n let currentMoment = moment({hour: currentHour});\n\n schedule.events.push({\n hourBlock: parseInt(currentMoment.format(\"H\")),\n hourBlockDisplay: currentMoment.format(\"ha\"),\n event: null\n });\n\n currentHour++;\n }\n\n return schedule;\n }" ]
[ "0.645218", "0.6056108", "0.5870095", "0.58694327", "0.5809828", "0.56978", "0.5636531", "0.5636531", "0.5540302", "0.5517433", "0.55127144", "0.5452314", "0.544941", "0.5445816", "0.54395735", "0.5438016", "0.53598696", "0.53370005", "0.5328558", "0.5306034", "0.5274006", "0.5266664", "0.526481", "0.5259784", "0.52560306", "0.52285504", "0.5208728", "0.5189577", "0.51694727", "0.51676875" ]
0.72138286
0
The CenterControl adds a control to the map that recenters the map on Chicago. This constructor takes the control DIV as an argument.
function CenterControl(controlDiv, map) { // Set CSS for the control border. var controlUI = document.createElement('div'); controlUI.className = "ControlContainer"; controlUI.title = 'Click to recenter the map'; controlDiv.appendChild(controlUI); // Set CSS for the control interior. var controlText = document.createElement('div'); controlText.className = "MyControl"; controlText.innerHTML = 'Center Map'; controlUI.appendChild(controlText); // Setup the click event listeners: simply set the map to Chicago. controlUI.addEventListener('click', function() { map.setCenter(myLatLng); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CenterControl(controlDiv, map) {\r\n\r\n // Set CSS for the control border.\r\n var controlUI = document.createElement('div');\r\n controlUI.style.backgroundColor = '#fff';\r\n controlUI.style.border = '2px solid #fff';\r\n controlUI.style.borderRadius = '3px';\r\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\r\n controlUI.style.cursor = 'pointer';\r\n controlUI.style.marginBottom = '22px';\r\n controlUI.style.textAlign = 'center';\r\n controlUI.title = 'Click to recenter the map';\r\n controlDiv.appendChild(controlUI);\r\n\r\n // Set CSS for the control interior.\r\n var controlText = document.createElement('div');\r\n controlText.style.color = 'rgb(25,25,25)';\r\n controlText.style.fontFamily = 'Roboto,Arial,sans-serif';\r\n controlText.style.fontSize = '16px';\r\n controlText.style.lineHeight = '38px';\r\n controlText.style.paddingLeft = '5px';\r\n controlText.style.paddingRight = '5px';\r\n controlText.innerHTML = 'Center Haiti Map';\r\n controlUI.appendChild(controlText);\r\n\r\n // Setup the click event listeners: simply set the map to Chicago.\r\n controlUI.addEventListener('click', function() {\r\n map.setCenter(centerHaiti);\r\n map.setZoom(8);\r\n });\r\n\r\n}", "function CenterControl(controlDiv, map) {\n\n // Set CSS for the control border.\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = '#fff';\n controlUI.style.border = '2px solid #fff';\n controlUI.style.borderRadius = '3px';\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n controlUI.style.cursor = 'pointer';\n controlUI.style.marginBottom = '22px';\n controlUI.style.textAlign = 'center';\n controlUI.title = 'Find Harvard';\n controlDiv.appendChild(controlUI);\n\n // Set CSS for the control interior.\n var controlText = document.createElement('div');\n controlText.style.color = 'rgb(25,25,25)';\n controlText.style.fontFamily = 'Roboto,Arial,sans-serif';\n controlText.style.fontSize = '16px';\n controlText.style.lineHeight = '38px';\n controlText.style.paddingLeft = '5px';\n controlText.style.paddingRight = '5px';\n controlText.innerHTML = 'Find Harvard';\n controlUI.appendChild(controlText);\n\n // Setup the click event listeners: simply set the map to Chicago.\n controlUI.addEventListener('click', function() {\n map.setCenter(Harvard);\n });\n\n }", "function CenterControl(controlDiv, map) {\n // Set CSS for the control border.\n const controlUI = document.createElement(\"div\");\n controlUI.style.marginRight = \"25px\";\n controlUI.style.backgroundColor = \"#fff\";\n controlUI.style.border = \"2px solid #fff\";\n controlUI.style.borderRadius = \"3px\";\n controlUI.style.boxShadow = \"0 2px 6px rgba(0,0,0,.3)\";\n controlUI.style.cursor = \"pointer\";\n controlUI.style.marginBottom = \"22px\";\n controlUI.style.textAlign = \"center\";\n controlUI.title = \"Click to recenter the map\";\n controlDiv.appendChild(controlUI);\n // Set CSS for the control interior.\n var reload = '<i style=\"font-size:20px\" class=\"fa\">&#xf021;</i>';\n const controlText = document.createElement(\"div\");\n controlText.style.color = \"rgb(25,25,25)\";\n controlText.style.fontFamily = \"Roboto,Arial,sans-serif\";\n controlText.style.fontSize = \"20px\";\n controlText.style.lineHeight = \"38px\";\n controlText.style.paddingLeft = \"5px\";\n controlText.style.paddingRight = \"5px\";\n controlText.innerHTML = \"現在地 \" + reload;\n controlUI.appendChild(controlText);\n // Setup the click event listeners: simply set the map to Chicago.\n controlUI.addEventListener(\"click\", () => {\n map.setCenter(new google.maps.LatLng(35.08969903728947, 139.06380775082175));\n });\n }", "function CenterControl(controlDiv, map) {\n\n // Set CSS for the control border.\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = 'rgb(256,256,256)';\n controlUI.style.border = '6px solid rgb(256,256,256)';\n controlUI.style.borderRadius = '6px';\n //controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n controlUI.style.cursor = 'pointer';\n controlUI.style.marginBottom = '22px';\n controlUI.style.textAlign = 'center';\n controlUI.title = 'Click to recenter the map';\n controlDiv.appendChild(controlUI);\n\n // Set CSS for the control interior.\n var controlText = document.createElement('div');\n controlText.style.color = 'rgb(255,81,90)';\n controlText.style.fontFamily = 'Roboto';\n controlText.style.fontSize = '26px';\n controlText.style.lineHeight = '38px';\n controlText.style.paddingLeft = '30px';\n controlText.style.fontWeight = \"500\";\n controlText.style.fontStyle = 'normal';\n controlText.style.paddingRight = '30px';\n controlText.innerHTML = '+ Party';\n controlUI.appendChild(controlText);\n\n // Setup the click event listeners: simply set the map to Chicago.\n controlUI.addEventListener('click', function() {\n map.setCenter(pos);\n if(posted === false){\n var ref = new Firebase('https://party-1473630564088.firebaseio.com');\n firebase.push({lat: pos.lat, lng: pos.lng, timestamp: Firebase.ServerValue.TIMESTAMP });\n posted = true;\n }\n // ref.update({ timestamp: Firebase.ServerValue.TIMESTAMP });\n\t//ref.on('timestamp', function(snapshot){ console.log(snapshot.val()) })\n // });\n});\n }", "function CenterControl(controlDiv, map) {\r\n\r\n // Set CSS for the control border.\r\n var controlUI = document.createElement('div');\r\n controlUI.style.backgroundColor = '#fff';\r\n controlUI.style.border = '2px solid #fff';\r\n controlUI.style.borderRadius = '3px';\r\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\r\n controlUI.style.cursor = 'pointer';\r\n controlUI.style.marginBottom = '22px';\r\n controlUI.style.textAlign = 'center';\r\n controlUI.title = 'Click to Hide Markers';\r\n controlDiv.appendChild(controlUI);\r\n\r\n // Set CSS for the control interior.\r\n var controlText = document.createElement('div');\r\n controlText.style.color = 'rgb(25,25,25)';\r\n controlText.style.fontFamily = 'Roboto,Arial,sans-serif';\r\n controlText.style.fontSize = '16px';\r\n controlText.style.lineHeight = '38px';\r\n controlText.style.paddingLeft = '5px';\r\n controlText.style.paddingRight = '5px';\r\n controlText.innerHTML = 'Hide Markers';\r\n controlUI.appendChild(controlText);\r\n\r\n // Setup the click event listeners: simply set the map to Chicago.\r\n controlUI.addEventListener('click', function () {\r\n clearMarkers();\r\n });\r\n\r\n}", "function CenterControl(controlDiv, map) {\n\n // Set CSS for the control border.\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = 'transparent';\n controlUI.style.border = '2px solid transparent';\n controlUI.style.borderRadius = '3px';\n controlUI.style.marginTop = '10px';\n controlUI.style.marginRight = '10px';\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n controlUI.style.cursor = 'pointer';\n controlUI.style.textAlign = 'center';\n controlUI.title = 'Click to recenter the map';\n controlDiv.appendChild(controlUI);\n\n // Set CSS for the control interior.\n var controlIcon = document.createElement('div');\n controlIcon.style.backgroundImage = \"url('images/\" + \"rsz_ic_my_location_black_48dp.png')\"; \n controlIcon.style.height = '36px';\n controlIcon.style.width = '36px';\n controlUI.appendChild(controlIcon);\n\n // Setup the click event listeners: simply set the map to user initialLocation.\n controlUI.addEventListener('click', function() {\n map.setCenter(initialLocation);\n map.setZoom(13); \n });\n}// End of Geo Control", "function CenterControl(controlDiv, map) {\n\n // Set CSS for the control border\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = '#fff';\n controlUI.style.border = '2px solid #fff';\n controlUI.style.borderRadius = '3px';\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n controlUI.style.cursor = 'pointer';\n controlUI.style.float = 'left';\n controlUI.style.marginBottom = '22px';\n controlUI.style.marginLeft = '12px';\n controlUI.style.textAlign = 'center';\n controlUI.title = 'Click to recenter the map';\n controlDiv.appendChild(controlUI);\n\n // Set CSS for the control interior\n var goCenterText = document.createElement('div');\n controlUI.style.color = 'rgb(25,25,25)';\n controlUI.style.fontFamily = 'Roboto,Arial,sans-serif';\n controlUI.style.fontSize = '16px';\n controlUI.style.lineHeight = '38px';\n controlUI.style.paddingLeft = '5px';\n controlUI.style.paddingRight = '5px';\n controlUI.innerHTML = 'Center Map';\n controlUI.appendChild(goCenterText);\n\n // Set CSS for the goToToday control border\n var todayUI = document.createElement('div');\n todayUI.style.backgroundColor = '#fff';\n todayUI.style.border = '2px solid #fff';\n todayUI.style.borderRadius = '3px';\n todayUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n todayUI.style.cursor = 'pointer';\n todayUI.style.float = 'left';\n todayUI.style.marginBottom = '22px';\n todayUI.style.marginLeft = '12px';\n todayUI.style.textAlign = 'center';\n todayUI.title = 'Click to set the current day to today';\n controlDiv.appendChild(todayUI);\n\n // Set CSS for the control interior\n var todayText = document.createElement('div');\n todayUI.style.color = 'rgb(25,25,25)';\n todayUI.style.fontFamily = 'Roboto,Arial,sans-serif';\n todayUI.style.fontSize = '16px';\n todayUI.style.lineHeight = '38px';\n todayUI.style.paddingLeft = '5px';\n todayUI.style.paddingRight = '5px';\n todayUI.innerHTML = 'Go To Today';\n todayUI.appendChild(todayText);\n\n google.maps.event.addDomListener(controlUI, 'click', function() {\n map.setCenter(mapCenter);\n map.setZoom(initialZoomLevel);\n moveSlider(getSliderValue());\n });\n\n \n google.maps.event.addDomListener(todayUI, 'click', function() {\n moveSliderToToday();\n });\n \n }", "function CenterControl(controlDiv, map) {\n\n // Set CSS for the control border.\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = '#0a96d4';\n // controlUI.style.border = '1px solid #fff';\n // controlUI.style.borderRadius = '0x';\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n controlUI.style.cursor = 'pointer';\n controlUI.style.marginBottom = '22px';\n controlUI.style.textAlign = 'center';\n controlUI.title = 'Click to recenter the map';\n controlDiv.appendChild(controlUI);\n\n // Set CSS for the control interior.\n var controlText = document.createElement('div');\n controlText.style.color = '#fff';\n controlText.style.fontFamily = 'Arial,sans-serif';\n controlText.style.fontSize = '14px';\n controlText.style.lineHeight = '25px';\n controlText.style.paddingLeft = '5px';\n controlText.style.paddingRight = '5px';\n controlText.innerHTML = 'Reset Map';\n controlUI.appendChild(controlText);\n\n // Runs initMap when reset button is clicked.\n controlUI.addEventListener('click', function() {\n initMap();\n });\n}", "function HomeControl(controlDiv, map, center) {\n\n // Set CSS styles for the DIV containing the control\n // Setting padding to 5 px will offset the control\n // from the edge of the map\n controlDiv.style.padding = '5px';\n\n // Set CSS for the control border\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = 'white';\n controlUI.style.borderStyle = 'solid';\n controlUI.style.borderWidth = '1px';\n controlUI.style.margin = '1px';\n controlUI.style.cursor = 'pointer';\n controlUI.style.textAlign = 'center';\n controlUI.title = 'Click to set the map to Home';\n controlDiv.appendChild(controlUI);\n controlUI.style.setProperty(\"border-radius\",\"2px\");\n controlUI.style.setProperty(\"border-color\",\"#c2c2c2\")\n\n // Set CSS for the control interior\n var controlText = document.createElement('div');\n controlText.style.fontFamily = 'Arial,sans-serif';\n controlText.style.fontSize = '12px';\n controlText.style.paddingLeft = '4px';\n controlText.style.paddingRight = '4px';\n controlText.innerHTML = '<b>Home</b>';\n controlUI.appendChild(controlText);\n\n // Setup the click event listeners: simply set the map to\n // the marker\n google.maps.event.addDomListener(controlUI, 'click', function() {\n map.setCenter(center);\n });\n\n}", "function CenterControl(controlDiv, map,html) {\n\n // CSS For Button 'Filter By Cluster'\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = '#fff';\n controlUI.style.border = '2px solid #fff';\n controlUI.style.borderRadius = '3px';\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n controlUI.style.cursor = 'pointer';\n controlUI.style.marginBottom = '22px';\n controlUI.style.textAlign = 'center';\n controlUI.style.marginTop = '8px';\n controlUI.style.marginRight = '16px';\n controlDiv.appendChild(controlUI); // appends the button on maps\n\n // CSS for interior text of button.\n var controlText = document.createElement('div');\n controlText.style.color = 'rgb(25,25,25)';\n controlText.style.fontFamily = 'Roboto,Arial,sans-serif';\n controlText.style.fontSize = '16px';\n controlText.style.lineHeight = '38px';\n // sets the cluster names in the dropdown menu\n controlText.innerHTML = '<div class=\"dropdown\"><button class=\"dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" style=\"background:none;border:none\">Filter by Cluster<span class=\"caret\"></span></button><ul class=\"dropdown-menu\">'+html+'</ul></div>';\n controlUI.appendChild(controlText);\n $('.dropdown-menu show').css({\"display\":\"contents\"})\n}", "function CenterControl(controlDiv, map) {\n\n // Set CSS for the control border.\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = '#fff';\n controlUI.style.border = '2px solid #fff';\n controlUI.style.borderRadius = '3px';\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n controlUI.style.cursor = 'pointer';\n controlUI.style.marginTop = '8px';\n controlUI.style.marginRight = '8px';\n controlUI.style.textAlign = 'center';\n controlUI.title = 'My Position';\n controlDiv.appendChild(controlUI);\n\n // Set CSS for the control interior.\n var controlText = document.createElement('div');\n controlText.style.color = 'rgb(25,25,25)';\n controlText.style.fontFamily = 'Roboto,Arial,sans-serif';\n controlText.style.fontSize = '16px';\n controlText.style.lineHeight = '16px';\n controlText.style.paddingLeft = '5px';\n controlText.style.paddingRight = '5px';\n controlText.innerHTML = \"<img src='/images/locate.png' alt='locate-me' style='margin-top: 5px; margin-bottom: 3px;'>\";\n controlUI.appendChild(controlText);\n\n\n // Setup the click event listeners: simply set the map to user location\n controlUI.addEventListener('click', function() {\n\n // HTML5 geolocation\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function (position) {\n\n var positionNow = {\n lat: position.coords.latitude,\n lng: position.coords.longitude\n };\n\n infoWindow.setPosition(positionNow);\n infoWindow.setContent(\n '<div class=\"container\">' +\n '<ul class=\"collapsible z-depth-0 guides logged-in\" style=\"border: none;\">' +\n '<h6 class=\"center-align\">' + \"You are here\" + '</h6>' +\n '</ul>' +\n '</div>'\n );\n infoWindow.open(map);\n map.setCenter(positionNow);\n\n }, error => {\n addEventWarning.querySelector('.warning').innerHTML =\n \"An error has occurred while trying to get your location\";\n }, {\n enableHighAccuracy: true,\n });\n } else { addEventWarning.querySelector('.warning').innerHTML =\n \"You need to turn on geolocation on your device or web browser in order for us to help you \" +\n \"find events around you\"\n }\n });\n\n}", "function CenterControlBtnLocate(controlDiv, map) {\n\n // Set CSS for the control border.\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = '#fff';\n controlUI.style.border = '2px solid #fff';\n controlUI.style.borderRadius = '3px';\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n controlUI.style.cursor = 'pointer';\n controlUI.style.marginBottom = '10px';\n controlUI.style.textAlign = 'center';\n controlUI.title = 'Click to recenter the map';\n controlDiv.appendChild(controlUI);\n\n // Set CSS for the control interior.\n var controlText = document.createElement('div');\n controlText.style.color = 'rgb(25,25,25)';\n controlText.style.fontFamily = 'Roboto,Arial,sans-serif';\n controlText.style.fontSize = '12px';\n controlText.style.lineHeight = '38px';\n controlText.style.paddingLeft = '5px';\n controlText.style.paddingRight = '5px';\n controlText.innerHTML = 'Where am I?';\n controlUI.appendChild(controlText);\n\n // Setup the click event listeners: simply set the map to Chicago.\n controlUI.addEventListener('click', function() {\n\n // Try HTML5 geolocation.\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function(position) {\n console.log(\"HEY\");\n var pos = {\n lat: position.coords.latitude,\n lng: position.coords.longitude\n };\n map.setCenter(pos);\n if (loc_marker != null) {\n loc_marker.setMap(null);\n }\n var marker = new google.maps.Marker({\n position: pos,\n map: map,\n icon: \"http://maps.google.com/mapfiles/ms/icons/blue-dot.png\",\n clickable: false\n });\n loc_marker = marker;\n }, function() {\n // handleLocationError(true, infoWindow, map.getCenter());\n });\n } else {\n // Browser doesn't support Geolocation\n // DO NOTHING LMFAO\n }\n\n });\n}", "function CenterControlBtnGreen(controlDiv, map, placeMarker) {\n\n // Set CSS for the control border.\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = '#fff';\n controlUI.style.border = '2px solid #fff';\n controlUI.style.borderRadius = '3px';\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n controlUI.style.cursor = 'pointer';\n controlUI.style.marginBottom = '10px';\n controlUI.style.textAlign = 'center';\n controlUI.title = 'Click to recenter the map';\n controlDiv.appendChild(controlUI);\n\n // Set CSS for the control interior.\n var controlText = document.createElement('div');\n controlText.style.color = 'black';\n controlText.style.backgroundColor = 'green';\n controlText.style.fontFamily = 'Roboto,Arial,sans-serif';\n controlText.style.fontSize = '12px';\n controlText.style.lineHeight = '38px';\n controlText.style.paddingLeft = '5px';\n controlText.style.paddingRight = '5px';\n controlText.innerHTML = 'green';\n controlUI.appendChild(controlText);\n\n // Setup the click event listeners: simply set the map to Chicago.\n controlUI.addEventListener('click', function() {\n drawColor = \"Green\";\n\n // Try HTML5 geolocation.\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function(position) {\n console.log(\"HEY\");\n var pos = {\n lat: position.coords.latitude,\n lng: position.coords.longitude\n };\n placeMarker(pos);\n }, function() {\n // handleLocationError(true, infoWindow, map.getCenter());\n });\n } else {\n // Browser doesn't support Geolocation\n // DO NOTHING LMFAO\n }\n\n });\n}", "function LogControl(controlDiv, map) {\n // Set CSS for the control border.\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = '#fff';\n controlUI.style.border = '2px solid #fff';\n controlUI.style.borderRadius = '3px';\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n controlUI.style.cursor = 'pointer';\n controlUI.style.marginBottom = '22px';\n controlUI.style.textAlign = 'center';\n controlUI.title = 'Click to recenter the map';\n controlDiv.appendChild(controlUI);\n\n // Set CSS for the control interior.\n var controlText = document.createElement('div');\n controlText.style.color = 'rgb(25,25,25)';\n controlText.style.fontFamily = 'Roboto,Arial,sans-serif';\n controlText.style.fontSize = '16px';\n controlText.style.lineHeight = '38px';\n controlText.style.paddingLeft = '5px';\n controlText.style.paddingRight = '5px';\n controlText.innerHTML = 'Log It!';\n controlUI.appendChild(controlText);\n\n controlUI.addEventListener('click', function () {\n $state.go('sighting');\n });\n }", "function CenterControlBtnRed(controlDiv, map, placeMarker) {\n\n // Set CSS for the control border.\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = '#fff';\n controlUI.style.border = '2px solid #fff';\n controlUI.style.borderRadius = '3px';\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n controlUI.style.cursor = 'pointer';\n controlUI.style.marginBottom = '10px';\n controlUI.style.textAlign = 'center';\n controlUI.title = 'Click to recenter the map';\n controlDiv.appendChild(controlUI);\n\n // Set CSS for the control interior.\n var controlText = document.createElement('div');\n controlText.style.color = 'black';\n controlText.style.backgroundColor = 'red';\n controlText.style.fontFamily = 'Roboto,Arial,sans-serif';\n controlText.style.fontSize = '12px';\n controlText.style.lineHeight = '38px';\n controlText.style.paddingLeft = '5px';\n controlText.style.paddingRight = '5px';\n controlText.innerHTML = 'red';\n controlUI.appendChild(controlText);\n\n // Setup the click event listeners: simply set the map to Chicago.\n controlUI.addEventListener('click', function() {\n drawColor = \"Red\";\n\n\n // Try HTML5 geolocation.\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function(position) {\n console.log(\"HEY\");\n var pos = {\n lat: position.coords.latitude,\n lng: position.coords.longitude\n };\n placeMarker(pos);\n }, function() {\n // handleLocationError(true, infoWindow, map.getCenter());\n });\n } else {\n // Browser doesn't support Geolocation\n // DO NOTHING LMFAO\n }\n\n\n });\n}", "function CenterControlBtnUndo(controlDiv, map) {\n\n // Set CSS for the control border.\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = '#fff';\n controlUI.style.border = '2px solid #fff';\n controlUI.style.borderRadius = '3px';\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n controlUI.style.cursor = 'pointer';\n controlUI.style.marginBottom = '10px';\n controlUI.style.textAlign = 'center';\n controlUI.title = 'Click to recenter the map';\n controlDiv.appendChild(controlUI);\n\n // Set CSS for the control interior.\n var controlText = document.createElement('div');\n controlText.style.color = 'rgb(25,25,25)';\n controlText.style.fontFamily = 'Roboto,Arial,sans-serif';\n controlText.style.fontSize = '12px';\n controlText.style.lineHeight = '38px';\n controlText.style.paddingLeft = '5px';\n controlText.style.paddingRight = '5px';\n controlText.innerHTML = 'Undo';\n controlUI.appendChild(controlText);\n\n // Setup the click event listeners: simply set the map to Chicago.\n controlUI.addEventListener('click', function() {\n if (allMarkers.length > 0) {\n var lastMarker = allMarkers.pop();\n var lastCircle = allCircles.pop();\n lastMarker.setMap(null);\n lastCircle.setMap(null);\n } else {\n // Do nothing\n }\n });\n}", "function setMapCenter() {\n\t$(\"#leftDivInfo\").css({\n\t\t'width': '25%',\n\t\t'margin-top': '0px'\n\t});\n\t$(\"#map-canvas\").css({\n\t\t'height': '700px',\n\t\t'margin-top': '-740px',\n\t\t'margin-left': '25%',\n\t\t'width': '40%'\n\t});\n}", "function initialMapSelector(div_id, mapcenter_lng, mapcenter_lat) {\n\tvar map = new BMap.Map(div_id, {enableAutoResize: true}); \n\tvar point = new BMap.Point(mapcenter_lng, mapcenter_lat);\n\tmap.centerAndZoom(point, 15);\n\tmap.enableScrollWheelZoom();\n\tmap.addControl(new BMap.NavigationControl());\n\n\t//addMarker(map, point, 0);\n\treturn map; \n}", "function initMapControl()\n{\n //Set mode to point mode.\n drawMode = pointMode;\n var pointButton = $('<div id=\"pointButton\">Marker</div>')\n .addClass('mapButton mapButtonActive').click(pointButtonClick);\n var boundButton = $('<div id=\"boundButton\" style=\"padding-left:6px;padding-right:6px\">Bounds</div>')\n .addClass('mapButton').click(boundButtonClick);\n clearBoundButton = $('<div id=\"clearBoundButton\" style=\"padding-left:6px;padding-right:6px\">Clear</div>')\n .addClass('mapButton').click(clearBoundButtonClick);\n\n map.controls[google.maps.ControlPosition.TOP_CENTER].push(pointButton[0]);\n map.controls[google.maps.ControlPosition.TOP_CENTER].push(boundButton[0]);\n}", "function ZoomIn(controlDiv, map) {\n\n // Set CSS for the control border.\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = '#fff';\n controlUI.style.border = '2px solid #fff';\n controlUI.style.borderRadius = '3px';\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n controlUI.style.cursor = 'pointer';\n controlUI.style.marginBottom = '22px';\n controlUI.style.textAlign = 'center';\n controlUI.title = 'Click to zoom!';\n controlDiv.appendChild(controlUI);\n\n // Set CSS for the control interior.\n var controlText = document.createElement('div');\n controlText.style.color = 'rgb(25,25,25)';\n controlText.style.fontFamily = 'Roboto,Arial,sans-serif';\n controlText.style.fontSize = '16px';\n controlText.style.lineHeight = '38px';\n controlText.style.paddingLeft = '5px';\n controlText.style.paddingRight = '5px';\n controlText.innerHTML = '+';\n controlUI.appendChild(controlText);\n\n // Setup the click event listeners: simply set the map to Chicago.\n controlUI.addEventListener('click', function() {\n zoomRate = map.getZoom() + 1;\n initMap(map);\n });\n\n }", "function CustomControl(controlDiv, map) {\r\n\r\n\t// Set CSS for the control border.\r\n\tvar controlUI = document.createElement('div');\r\n\tcontrolUI.style.backgroundColor = '#fff';\r\n\tcontrolUI.style.border = 'solid #fff';\r\n\tcontrolUI.style.borderRadius = '30px';\r\n\tcontrolUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\r\n\tcontrolUI.style.cursor = 'pointer';\r\n\tcontrolUI.style.marginBottom = '22px';\r\n\tcontrolUI.style.textAlign = 'center';\r\n\tcontrolUI.title = 'Click to open menu';\r\n\tcontrolDiv.appendChild(controlUI);\r\n\r\n\t/* // Set CSS for the control interior.\r\n\tvar controlText = document.createElement('div');\r\n\tcontrolText.style.color = 'rgb(25,25,25)';\r\n\tcontrolText.style.fontFamily = 'Roboto,Arial,sans-serif';\r\n\tcontrolText.style.fontSize = '16px';\r\n\tcontrolText.style.lineHeight = '38px';\r\n\tcontrolText.style.paddingLeft = '5px';\r\n\tcontrolText.style.paddingRight = '5px';\r\n\tcontrolText.innerHTML = 'Menu';\r\n\tcontrolUI.appendChild(controlText); */\r\n\t\r\n\tvar imgLogo = document.createElement(\"img\");\r\n\timgLogo.setAttribute(\"src\", \"http://image.flaticon.com/icons/png/512/52/52152.png\");\r\n\timgLogo.setAttribute(\"height\", \"40\");\r\n\timgLogo.setAttribute(\"width\", \"40\");\r\n\timgLogo.setAttribute(\"alt\", \"Menu\");\r\n\t\r\n\tcontrolUI.appendChild(imgLogo);\r\n\r\n // Setup the click event listeners: simply set the map to Chicago.\r\n\t/* controlUI.addEventListener('click', function(e) {\r\n\t\te.preventDefault();\r\n $(\"#wrapper\").toggleClass(\"toggled\");\r\n\t});*/\r\n }", "function CenterControl(controlDiv, map) {\n\n /*ControlUI to control all content of menu*/\n var controlUI = document.createElement('div');\n controlUI.className = 'anidar';\n controlDiv.style.width=\"100%\";\n controlDiv.id = \"controlDiv\";\n controlDiv.style.left = '0px';\n controlDiv.appendChild(controlUI);\n controlDiv.style.backgroundColor = '#039BE5';\n \n /*BTN to control menu over the map*/\n var anidarMenu = document.createElement('SPAN');\n anidarMenu.id = 'anidarMenu';\n anidarMenu.innerHTML = \"<a>&#9776;</a>\";\n //anidarMenu.className = \"btn\";\n anidarMenu.addEventListener('click', function() {\n $( \".filters\" ).toggle( \"slow\", function() {\n if(isFilterToggle){\n $(\"#controlDiv\").css('width','100%');\n $(\"#controlDiv\").css('border-radius','0px');\n $(\"#controlDiv\").css('margin-top','0px');\n $(\"#controlDiv\").css('margin-left','0px');\n isFilterToggle=!isFilterToggle; \n }else{\n $(\"#controlDiv\").css('width','4%');\n $(\"#controlDiv\").css('border-radius','5px');\n $(\"#controlDiv\").css('margin-top','15px');\n $(\"#controlDiv\").css('margin-left','15px');\n isFilterToggle=!isFilterToggle; \n }\n });\n });\n \n //<button class=\"btn\" id=\"btnMitigacion\" onclick=\"nuevoPuntoMitigacion(this);\"><img class=\"iconMiMu\" src=\"/data/Templatic-map-icons/MitigacionAdd.png\"></img></button>\n var btnMitigacion = document.createElement('button');\n btnMitigacion.className = 'btn filters';\n btnMitigacion.id ='btnMitigacion';\n btnMitigacion.innerHTML = '<img class=\"iconMiMu\" src=\"/data/Templatic-map-icons/MitigacionAdd.png\"></img>';\n btnMitigacion.addEventListener(\"click\", function() {\n nuevoPuntoMitigacion(this);\n });\n \n //<button class=\"btn\" id=\"btnToggleMitigacion\" onclick=\"toggleMitigacion();\"><img class=\"iconMiMu\" id=toggleMitigacion src=\"/data/Templatic-map-icons/mi.png\"></img></button>\n var btnToggleMitigacion = document.createElement('button');\n btnToggleMitigacion.className = 'btn filters';\n btnToggleMitigacion.id ='btnToggleMitigacion';\n btnToggleMitigacion.innerHTML = '<img class=\"iconMiMu\" id=toggleMitigacion src=\"/data/Templatic-map-icons/mi.png\"></img>';\n btnToggleMitigacion.addEventListener('click',function () {\n toggleMitigacion();\n });\n //<button class=\"btn\" id=\"btnToggleMuestreo\" onclick=\"toggleMuestreo();\"><img class=\"iconMiMu\" id=toggleMuestreo src=\"/data/Templatic-map-icons/mu.png\"></img></button>\n var btnToggleMuestreo = document.createElement('button');\n btnToggleMuestreo.className = 'btn filters';\n btnToggleMuestreo.id ='btnToggleMuestreo';\n btnToggleMuestreo.innerHTML = '<img class=\"iconMiMu\" id=toggleMuestreo src=\"/data/Templatic-map-icons/mu.png\"></img>';\n btnToggleMuestreo.addEventListener('click',function () {\n toggleMuestreo();\n }); \n //<button class=\"btn\" id=\"btnCentrarRectangulo\" onclick=\"centrarRectangulo();\"><i style=\"font-size: 12px\">Centrar</i></button>\n var btnCentrarRectangulo = document.createElement('button');\n btnCentrarRectangulo.className = 'btn filters';\n btnCentrarRectangulo.id ='btnCentrarRectangulo';\n btnCentrarRectangulo.innerHTML = '<i style=\"font-size: 12px\">Centrar</i>';\n btnCentrarRectangulo.addEventListener('click',function () {\n centrarRectangulo();\n }); \n\n //<button class=\"btn\" id=\"btnChart\" onclick=\"graficar();\" disabled=\"true\"><i class=\"fa fa-area-chart\"></i></button>\n var btnChart = document.createElement('button');\n btnChart.className = 'btn filters';\n btnChart.id ='btnChart';\n btnChart.innerHTML = '<i class=\"fa fa-area-chart\"></i>';\n btnChart.addEventListener('click',function () {\n graficar();\n }); \n \n //River checkbox\n var riversCheck = document.createElement('dl');\n riversCheck.className = 'dropdown filters';\n riversCheck.innerHTML=\"<dt onclick='riverDropDownClicked();'><a><span class='hida'>Rios:</span></a></dt><dd><div class='mutliSelect'><ul id='checkBoxRiverNames'></ul></div></dd>\";\n \n //<input type='number' min='1' id='inputFilterRadio' placeholder='Radio' value=1 onchange='changeCircleRadius(this.value);'>\n var riverInput=document.createElement('input');\n riverInput.className='filters';\n riverInput.style.height = '30px';\n riverInput.style.width = '4%';\n riverInput.type='number';\n riverInput.min = '1';\n riverInput.id='inputFilterRadio';\n riverInput.placeholder='Radio';\n riverInput.value='1';\n riverInput.addEventListener('change',function() {\n changeCircleRadius(this.value);\n });\n \n //<button class='btn botonFiltroR' onclick='aplicarFiltro(document.getElementById('inputFilterRadio').value,1)'><i class='fa fa-filter'></i></button>\n var riverBtnAplicar = document.createElement('button');\n riverBtnAplicar.className='btn botonFiltroR filters';\n riverBtnAplicar.addEventListener('click', function() {\n aplicarFiltro(document.getElementById('inputFilterRadio').value,1);\n });\n riverBtnAplicar.innerHTML = \"<i class='fa fa-filter'></i>\";\n \n \n //<button class='btn reset' id='reset'><i class='fa fa-eraser'></i></button>\n var riverBtnReset = document.createElement('button');\n riverBtnReset.className='btn reset filters';\n riverBtnReset.id='reset';\n riverBtnReset.addEventListener('click',function() {\n reset_radio_filter();\n });\n riverBtnReset.innerHTML = \"<i class='fa fa-eraser'></i>\";\n \n controlUI.appendChild(anidarMenu);\n controlUI.appendChild(btnMitigacion);\n controlUI.appendChild(btnToggleMitigacion);\n controlUI.appendChild(btnToggleMuestreo);\n controlUI.appendChild(btnCentrarRectangulo);\n controlUI.appendChild(btnChart);\n controlUI.appendChild(riversCheck);\n controlUI.appendChild(riverInput);\n controlUI.appendChild(riverBtnAplicar);\n controlUI.appendChild(riverBtnReset);\n // Setup the click event listeners: simply set the map to Chicago.\n\n }", "function makeInfoBox(controlDiv, map) {\n // Set CSS for the control border.\n var controlUI = document.createElement('div');\n controlUI.style.boxShadow = 'rgba(0, 0, 0, 0.298039) 0px 1px 4px -1px';\n controlUI.style.backgroundColor = '#fff';\n controlUI.style.border = '2px solid #fff';\n controlUI.style.borderRadius = '2px';\n controlUI.style.marginBottom = '22px';\n controlUI.style.marginTop = '10px';\n controlUI.style.textAlign = 'center';\n controlDiv.appendChild(controlUI);\n // Set CSS for the control interior.\n var controlText = document.createElement('div');\n controlText.style.color = 'rgb(25,25,25)';\n controlText.style.fontFamily = 'Roboto,Arial,sans-serif';\n controlText.style.fontSize = '100%';\n controlText.style.padding = '6px';\n controlText.textContent = 'The map shows all clicks made in the last week.';\n controlUI.appendChild(controlText);\n }", "function CustomZoomControl( controlDiv, map ) {\n //grap the zoom elements from the DOM and insert them in the map \n var controlUIzoomIn = document.getElementById( 'cd-zoom-in' ),\n controlUIzoomOut = document.getElementById( 'cd-zoom-out' );\n controlDiv.appendChild( controlUIzoomIn );\n controlDiv.appendChild( controlUIzoomOut );\n\n // Setup the click event listeners and zoom-in or out according to the clicked element\n google.maps.event.addDomListener( controlUIzoomIn, 'click', function () {\n map.setZoom( map.getZoom() + 1 )\n } );\n google.maps.event.addDomListener( controlUIzoomOut, 'click', function () {\n map.setZoom( map.getZoom() - 1 )\n } );\n }", "function AddControl(controlDiv, map) {\n\n // Set CSS for the control border.\n var controlUI = document.createElement('div');\n controlUI.style.backgroundColor = '#fff';\n controlUI.style.border = '2px solid #fff';\n controlUI.style.borderRadius = '3px';\n controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\n controlUI.style.cursor = 'pointer';\n controlUI.style.marginTop = '10px';\n controlUI.style.marginRight = '13px';\n controlUI.style.textAlign = 'center';\n controlUI.title = 'Create new point on map (for authenticated users)';\n controlDiv.appendChild(controlUI);\n\n // Set CSS for the control interior.\n var controlText = document.createElement('div');\n controlText.style.color = 'rgb(25,25,25)';\n controlText.style.fontFamily = 'Roboto,Arial,sans-serif';\n controlText.style.fontSize = '14px';\n controlText.style.lineHeight = '35px';\n controlText.style.paddingLeft = '5px';\n controlText.style.paddingRight = '5px';\n controlText.innerHTML = '<img src=\"static/icons/plus.svg\" alt=\"Add new point\"></img>';\n controlUI.appendChild(controlText);\n\n // Setup the click event listeners.\n controlUI.addEventListener('click', function () {\n if (document.getElementById('logoutElem')) {\n map.setOptions({ draggableCursor: 'copy' });\n google.maps.event.addListenerOnce(map, \"click\", function (event) {\n history.pushState(null, null, \"/places/new\");\n google.maps.event.addListenerOnce(infowindow, 'closeclick', (function () {\n return function () {\n history.pushState(null, null, \"/\");\n }\n })());\n map.setOptions({ draggableCursor: 'auto' });\n var latitude = event.latLng.lat();\n var longitude = event.latLng.lng();\n var latLng = event.latLng;\n var infoNewPlaceContentElem = document.getElementById('newPlaceForm');\n infoNewPlaceContentHTML = infoNewPlaceContentElem.innerHTML;\n infoNewPlaceContentHTML.className = 'new-place-visible';\n infoNewPlaceContent = infoNewPlaceContentHTML;\n console.log(infoNewPlaceContent);\n infowindow.setContent(infoNewPlaceContent);\n infowindow.setPosition(latLng);\n infowindow.open(map);\n document.getElementById(\"newPlaceLat\").value = latitude;\n document.getElementById(\"newPlaceLng\").value = longitude;\n\n });\n } else {\n var loginButton = document.getElementById('loginElem');\n loginButton.click();\n }\n\n });\n}", "function CustomZoomControl(controlDiv, map) {\n\t\t//grap the zoom elements from the DOM and insert them in the map \n\t \tvar controlUIzoomIn= document.getElementById('cd-zoom-in'),\n\t \t\tcontrolUIzoomOut= document.getElementById('cd-zoom-out');\n\t \tcontrolDiv.appendChild(controlUIzoomIn);\n\t \tcontrolDiv.appendChild(controlUIzoomOut);\n\n\t\t// Setup the click event listeners and zoom-in or out according to the clicked element\n\t\tgoogle.maps.event.addDomListener(controlUIzoomIn, 'click', function() {\n\t\t map.setZoom(map.getZoom()+1)\n\t\t});\n\t\tgoogle.maps.event.addDomListener(controlUIzoomOut, 'click', function() {\n\t\t map.setZoom(map.getZoom()-1)\n\t\t});\n\t}", "function CustomZoomControl(controlDiv, map) {\n\t\t//grap the zoom elements from the DOM and insert them in the map \n\t \tvar controlUIzoomIn= document.getElementById('cd-zoom-in'),\n\t \t\tcontrolUIzoomOut= document.getElementById('cd-zoom-out');\n\t \tcontrolDiv.appendChild(controlUIzoomIn);\n\t \tcontrolDiv.appendChild(controlUIzoomOut);\n\n\t\t// Setup the click event listeners and zoom-in or out according to the clicked element\n\t\tgoogle.maps.event.addDomListener(controlUIzoomIn, 'click', function() {\n\t\t map.setZoom(map.getZoom()+1)\n\t\t});\n\t\tgoogle.maps.event.addDomListener(controlUIzoomOut, 'click', function() {\n\t\t map.setZoom(map.getZoom()-1)\n\t\t});\n\t}", "function CustomZoomControl(controlDiv, map) {\n\t\t//grap the zoom elements from the DOM and insert them in the map \n\t \tvar controlUIzoomIn= document.getElementById('cd-zoom-in'),\n\t \t\tcontrolUIzoomOut= document.getElementById('cd-zoom-out');\n\t \tcontrolDiv.appendChild(controlUIzoomIn);\n\t \tcontrolDiv.appendChild(controlUIzoomOut);\n\n\t\t// Setup the click event listeners and zoom-in or out according to the clicked element\n\t\tgoogle.maps.event.addDomListener(controlUIzoomIn, 'click', function() {\n\t\t map.setZoom(map.getZoom()+1)\n\t\t});\n\t\tgoogle.maps.event.addDomListener(controlUIzoomOut, 'click', function() {\n\t\t map.setZoom(map.getZoom()-1)\n\t\t});\n\t}", "function centerMap(){\n map.fitBounds(b);\n map.setZoom(z);\n }", "function HomeControl(controlDiv, map) {\n\tcontrolDiv.style.padding = '5px';\n\tvar controlUI = document.createElement('div');\n\tcontrolUI.className = \"toggle_mapsearch\"; \n\tcontrolDiv.appendChild(controlUI);\n\tvar controlLabel = document.createElement('label');\n\tcontrolLabel.innerHTML = 'Search as I move the Map';\n\t\n\tvar input = document.createElement(\"input\");\n\tinput.type = \"checkbox\";\n\tinput.className = \"mapsearch_checkbox\"; \n\tinput.id = \"search_with_map\"; // set the CSS class\n\tcontrolLabel.appendChild(input); // put it into the DOM\n\tcontrolUI.appendChild(controlLabel);\n\n}" ]
[ "0.8013828", "0.7968754", "0.77727115", "0.76235056", "0.75115454", "0.75090045", "0.7507734", "0.7456348", "0.6888448", "0.688808", "0.6839767", "0.6628802", "0.6518375", "0.629978", "0.62581444", "0.61835754", "0.61082137", "0.60353446", "0.5949223", "0.59388125", "0.5936199", "0.58834934", "0.5840812", "0.58249134", "0.57876027", "0.5741325", "0.5741325", "0.5741325", "0.5701077", "0.5698842" ]
0.8255781
0